Fixup Checkout for apps

This commit is contained in:
Zach Fox 2018-02-22 16:37:12 -08:00
parent 33f73fef0d
commit f14673bc50
3 changed files with 14 additions and 8 deletions

View file

@ -48,6 +48,7 @@ Rectangle {
property bool debugCheckoutSuccess: false;
property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
property string referrer;
property bool isInstalled;
// Style
color: hifi.colors.white;
Connections {
@ -122,6 +123,12 @@ Rectangle {
root.refreshBuyUI();
}
}
onAppInstalled: {
if (appHref === root.itemHref) {
root.isInstalled = true;
}
}
}
onItemIdChanged: {
@ -689,7 +696,7 @@ Rectangle {
height: 50;
anchors.left: parent.left;
anchors.right: parent.right;
text: (root.buttonTextNormal)[itemTypesArray.indexOf(root.itemType)];
text: root.itemType === "app" && root.isInstalled ? "OPEN APP" : (root.buttonTextNormal)[itemTypesArray.indexOf(root.itemType)];
onClicked: {
if (root.itemType === "contentSet") {
lightboxPopup.titleText = "Replace Content";
@ -714,8 +721,11 @@ Rectangle {
lightboxPopup.button2method = "MyAvatar.useFullAvatarURL('" + root.itemHref + "'); root.visible = false;";
lightboxPopup.visible = true;
} else if (root.itemType === "app") {
// "Run" button is separate.
Commerce.installApp(root.itemHref);
if (root.isInstalled) {
Commerce.openApp(root.itemHref);
} else {
Commerce.installApp(root.itemHref);
}
} else {
sendToScript({method: 'checkout_rezClicked', itemHref: root.itemHref, itemType: root.itemType});
rezzedNotifContainer.visible = true;

View file

@ -39,7 +39,7 @@
// for toolbar-mode: go back to home screen, this will close the window.
tablet.gotoHomeScreen();
} else {
tablet.loadQMLSource(MARKETPLACE_PURCHASES_QML_PATH);
tablet.loadQMLSource(WALLET_QML_SOURCE);
}
}

View file

@ -552,10 +552,6 @@ var selectionDisplay = null; // for gridTool.js to ignore
case 'checkout_rezClicked':
case 'purchases_rezClicked':
rezEntity(message.itemHref, message.itemType);
break;
case 'checkout_installClicked':
case 'purchases_installClicked':
break;
case 'header_marketplaceImageClicked':
case 'purchases_backClicked':