mirror of
https://github.com/lubosz/overte.git
synced 2025-04-12 15:58:55 +02:00
Merge pull request #11148 from zfox23/commerce_singleSetting
New commerce mode now depends on 1 setting; bugfixes; Tablet -> TAB key
This commit is contained in:
commit
cc634a2d1b
3 changed files with 80 additions and 59 deletions
|
@ -131,6 +131,6 @@
|
|||
{ "from": "Keyboard.Space", "to": "Actions.SHIFT" },
|
||||
{ "from": "Keyboard.R", "to": "Actions.ACTION1" },
|
||||
{ "from": "Keyboard.T", "to": "Actions.ACTION2" },
|
||||
{ "from": "Keyboard.RightMouseClicked", "to": "Actions.ContextMenu" }
|
||||
{ "from": "Keyboard.Tab", "to": "Actions.ContextMenu" }
|
||||
]
|
||||
}
|
||||
|
|
|
@ -361,18 +361,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
|
||||
EventBridge.scriptEventReceived.connect(function (message) {
|
||||
if (message.slice(0, CAN_WRITE_ASSETS.length) === CAN_WRITE_ASSETS) {
|
||||
canWriteAssets = message.slice(-4) === "true";
|
||||
}
|
||||
|
||||
if (message.slice(0, CLARA_IO_CANCEL_DOWNLOAD.length) === CLARA_IO_CANCEL_DOWNLOAD) {
|
||||
cancelClaraDownload();
|
||||
}
|
||||
});
|
||||
|
||||
function injectCode() {
|
||||
var DIRECTORY = 0;
|
||||
var HIFI = 1;
|
||||
var CLARA = 2;
|
||||
|
@ -400,7 +389,29 @@
|
|||
}
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
EventBridge.scriptEventReceived.connect(function (message) {
|
||||
var parsedJsonMessage = JSON.parse(message);
|
||||
|
||||
if (message.slice(0, CAN_WRITE_ASSETS.length) === CAN_WRITE_ASSETS) {
|
||||
canWriteAssets = message.slice(-4) === "true";
|
||||
} else if (message.slice(0, CLARA_IO_CANCEL_DOWNLOAD.length) === CLARA_IO_CANCEL_DOWNLOAD) {
|
||||
cancelClaraDownload();
|
||||
} else if (parsedJsonMessage.type === "marketplaces") {
|
||||
if (parsedJsonMessage.action === "inspectionModeSetting") {
|
||||
confirmAllPurchases = !!parsedJsonMessage.data;
|
||||
injectCode();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Request inspection mode setting
|
||||
// Code is injected into the webpage after the setting comes back.
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: "REQUEST_SETTING"
|
||||
}));
|
||||
}
|
||||
|
||||
// Load / unload.
|
||||
window.addEventListener("load", onLoad); // More robust to Web site issues than using $(document).ready().
|
||||
|
||||
}());
|
||||
|
|
|
@ -58,51 +58,6 @@
|
|||
function showMarketplace() {
|
||||
UserActivityLogger.openedMarketplace();
|
||||
tablet.gotoWebScreen(MARKETPLACE_URL_INITIAL, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||
tablet.webEventReceived.connect(function (message) {
|
||||
var parsedJsonMessage = JSON.parse(message);
|
||||
if (parsedJsonMessage.type === "CHECKOUT") {
|
||||
tablet.sendToQml({ method: 'updateCheckoutQML', params: parsedJsonMessage });
|
||||
tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH);
|
||||
}
|
||||
|
||||
if (message === GOTO_DIRECTORY) {
|
||||
tablet.gotoWebScreen(MARKETPLACES_URL, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||
}
|
||||
|
||||
if (message === QUERY_CAN_WRITE_ASSETS) {
|
||||
tablet.emitScriptEvent(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
|
||||
}
|
||||
|
||||
if (message === WARN_USER_NO_PERMISSIONS) {
|
||||
Window.alert(NO_PERMISSIONS_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
if (message.slice(0, CLARA_IO_STATUS.length) === CLARA_IO_STATUS) {
|
||||
if (isDownloadBeingCancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = message.slice(CLARA_IO_STATUS.length);
|
||||
if (messageBox === null) {
|
||||
messageBox = Window.openMessageBox(CLARA_DOWNLOAD_TITLE, text, CANCEL_BUTTON, NO_BUTTON);
|
||||
} else {
|
||||
Window.updateMessageBox(messageBox, CLARA_DOWNLOAD_TITLE, text, CANCEL_BUTTON, NO_BUTTON);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.slice(0, CLARA_IO_DOWNLOAD.length) === CLARA_IO_DOWNLOAD) {
|
||||
if (messageBox !== null) {
|
||||
Window.closeMessageBox(messageBox);
|
||||
messageBox = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message === CLARA_IO_CANCELLED_DOWNLOAD) {
|
||||
isDownloadBeingCancelled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
|
@ -145,12 +100,67 @@
|
|||
tablet.screenChanged.connect(onScreenChanged);
|
||||
Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged);
|
||||
|
||||
function onMessage(message) {
|
||||
var parsedJsonMessage = JSON.parse(message);
|
||||
if (parsedJsonMessage.type === "CHECKOUT") {
|
||||
tablet.sendToQml({ method: 'updateCheckoutQML', params: parsedJsonMessage });
|
||||
tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH);
|
||||
} else if (parsedJsonMessage.type === "REQUEST_SETTING") {
|
||||
tablet.emitScriptEvent(JSON.stringify({
|
||||
type: "marketplaces",
|
||||
action: "inspectionModeSetting",
|
||||
data: Settings.getValue("inspectionMode", false)
|
||||
}));
|
||||
}
|
||||
|
||||
if (message === GOTO_DIRECTORY) {
|
||||
tablet.gotoWebScreen(MARKETPLACES_URL, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||
}
|
||||
|
||||
if (message === QUERY_CAN_WRITE_ASSETS) {
|
||||
tablet.emitScriptEvent(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
|
||||
}
|
||||
|
||||
if (message === WARN_USER_NO_PERMISSIONS) {
|
||||
Window.alert(NO_PERMISSIONS_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
if (message.slice(0, CLARA_IO_STATUS.length) === CLARA_IO_STATUS) {
|
||||
if (isDownloadBeingCancelled) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = message.slice(CLARA_IO_STATUS.length);
|
||||
if (messageBox === null) {
|
||||
messageBox = Window.openMessageBox(CLARA_DOWNLOAD_TITLE, text, CANCEL_BUTTON, NO_BUTTON);
|
||||
} else {
|
||||
Window.updateMessageBox(messageBox, CLARA_DOWNLOAD_TITLE, text, CANCEL_BUTTON, NO_BUTTON);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.slice(0, CLARA_IO_DOWNLOAD.length) === CLARA_IO_DOWNLOAD) {
|
||||
if (messageBox !== null) {
|
||||
Window.closeMessageBox(messageBox);
|
||||
messageBox = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (message === CLARA_IO_CANCELLED_DOWNLOAD) {
|
||||
isDownloadBeingCancelled = false;
|
||||
}
|
||||
}
|
||||
|
||||
tablet.webEventReceived.connect(onMessage);
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
if (onMarketplaceScreen) {
|
||||
tablet.gotoHomeScreen();
|
||||
}
|
||||
tablet.removeButton(marketplaceButton);
|
||||
tablet.screenChanged.disconnect(onScreenChanged);
|
||||
tablet.webEventReceived.disconnect(onMessage);
|
||||
Entities.canWriteAssetsChanged.disconnect(onCanWriteAssetsChanged);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue