mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
Merge pull request #11154 from zfox23/commerce_fixMarketplacesMessagePassing
Fix marketplaces message passing
This commit is contained in:
commit
cb02ff4026
2 changed files with 25 additions and 32 deletions
|
@ -398,16 +398,18 @@
|
||||||
|
|
||||||
function onLoad() {
|
function onLoad() {
|
||||||
EventBridge.scriptEventReceived.connect(function (message) {
|
EventBridge.scriptEventReceived.connect(function (message) {
|
||||||
var parsedJsonMessage = JSON.parse(message);
|
|
||||||
|
|
||||||
if (message.slice(0, CAN_WRITE_ASSETS.length) === CAN_WRITE_ASSETS) {
|
if (message.slice(0, CAN_WRITE_ASSETS.length) === CAN_WRITE_ASSETS) {
|
||||||
canWriteAssets = message.slice(-4) === "true";
|
canWriteAssets = message.slice(-4) === "true";
|
||||||
} else if (message.slice(0, CLARA_IO_CANCEL_DOWNLOAD.length) === CLARA_IO_CANCEL_DOWNLOAD) {
|
} else if (message.slice(0, CLARA_IO_CANCEL_DOWNLOAD.length) === CLARA_IO_CANCEL_DOWNLOAD) {
|
||||||
cancelClaraDownload();
|
cancelClaraDownload();
|
||||||
} else if (parsedJsonMessage.type === "marketplaces") {
|
} else {
|
||||||
if (parsedJsonMessage.action === "inspectionModeSetting") {
|
var parsedJsonMessage = JSON.parse(message);
|
||||||
confirmAllPurchases = !!parsedJsonMessage.data;
|
|
||||||
injectCode();
|
if (parsedJsonMessage.type === "marketplaces") {
|
||||||
|
if (parsedJsonMessage.action === "inspectionModeSetting") {
|
||||||
|
confirmAllPurchases = !!parsedJsonMessage.data;
|
||||||
|
injectCode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -101,31 +101,14 @@
|
||||||
Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged);
|
Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged);
|
||||||
|
|
||||||
function onMessage(message) {
|
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) {
|
if (message === GOTO_DIRECTORY) {
|
||||||
tablet.gotoWebScreen(MARKETPLACES_URL, MARKETPLACES_INJECT_SCRIPT_URL);
|
tablet.gotoWebScreen(MARKETPLACES_URL, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||||
}
|
} else if (message === QUERY_CAN_WRITE_ASSETS) {
|
||||||
|
|
||||||
if (message === QUERY_CAN_WRITE_ASSETS) {
|
|
||||||
tablet.emitScriptEvent(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
|
tablet.emitScriptEvent(CAN_WRITE_ASSETS + " " + Entities.canWriteAssets());
|
||||||
}
|
} else if (message === WARN_USER_NO_PERMISSIONS) {
|
||||||
|
|
||||||
if (message === WARN_USER_NO_PERMISSIONS) {
|
|
||||||
Window.alert(NO_PERMISSIONS_ERROR_MESSAGE);
|
Window.alert(NO_PERMISSIONS_ERROR_MESSAGE);
|
||||||
}
|
} else if (message.slice(0, CLARA_IO_STATUS.length) === CLARA_IO_STATUS) {
|
||||||
|
|
||||||
if (message.slice(0, CLARA_IO_STATUS.length) === CLARA_IO_STATUS) {
|
|
||||||
if (isDownloadBeingCancelled) {
|
if (isDownloadBeingCancelled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -137,18 +120,26 @@
|
||||||
Window.updateMessageBox(messageBox, CLARA_DOWNLOAD_TITLE, text, CANCEL_BUTTON, NO_BUTTON);
|
Window.updateMessageBox(messageBox, CLARA_DOWNLOAD_TITLE, text, CANCEL_BUTTON, NO_BUTTON);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (message.slice(0, CLARA_IO_DOWNLOAD.length) === CLARA_IO_DOWNLOAD) {
|
||||||
|
|
||||||
if (message.slice(0, CLARA_IO_DOWNLOAD.length) === CLARA_IO_DOWNLOAD) {
|
|
||||||
if (messageBox !== null) {
|
if (messageBox !== null) {
|
||||||
Window.closeMessageBox(messageBox);
|
Window.closeMessageBox(messageBox);
|
||||||
messageBox = null;
|
messageBox = null;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (message === CLARA_IO_CANCELLED_DOWNLOAD) {
|
||||||
|
|
||||||
if (message === CLARA_IO_CANCELLED_DOWNLOAD) {
|
|
||||||
isDownloadBeingCancelled = false;
|
isDownloadBeingCancelled = false;
|
||||||
|
} else {
|
||||||
|
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)
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue