From 949da1704606238df551e4c93543db069c1e0e6f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 18 Oct 2017 13:51:58 -0700 Subject: [PATCH 1/4] Wear It button for items with category 'Wearables' --- interface/resources/qml/hifi/commerce/checkout/Checkout.qml | 4 +++- .../resources/qml/hifi/commerce/purchases/PurchasedItem.qml | 5 +++-- .../resources/qml/hifi/commerce/purchases/Purchases.qml | 1 + scripts/system/marketplaces/marketplaces.js | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index 8d94e284ed..b76deb41fc 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -40,6 +40,7 @@ Rectangle { property bool shouldBuyWithControlledFailure: false; property bool debugCheckoutSuccess: false; property bool canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified; + property bool isWearable; // Style color: hifi.colors.white; Hifi.QmlCommerce { @@ -573,7 +574,7 @@ Rectangle { height: 50; anchors.left: parent.left; anchors.right: parent.right; - text: "Rez It" + text: root.isWearable ? "Wear It" : "Rez It" onClicked: { if (urlHandler.canHandleUrl(root.itemHref)) { urlHandler.handleUrl(root.itemHref); @@ -832,6 +833,7 @@ Rectangle { itemName = message.params.itemName; root.itemPrice = message.params.itemPrice; itemHref = message.params.itemHref; + root.isWearable = message.params.categories.indexOf("Wearables") > -1; setBuyText(); break; default: diff --git a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml index e7e16668fe..fb42865ba4 100644 --- a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml +++ b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml @@ -39,6 +39,7 @@ Item { property int itemEdition; property int numberSold; property int limitedRun; + property bool isWearable; property string originalStatusText; property string originalStatusColor; @@ -342,7 +343,7 @@ Item { anchors.bottom: parent.bottom; anchors.right: parent.right; width: height; - enabled: root.canRezCertifiedItems && root.purchaseStatus !== "invalidated"; + enabled: (root.canRezCertifiedItems || root.isWearable) && root.purchaseStatus !== "invalidated"; onClicked: { if (urlHandler.canHandleUrl(root.itemHref)) { @@ -415,7 +416,7 @@ Item { size: 16; verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter - text: "Rez It" + text: root.isWearable ? "Wear It" : "Rez It" } } } diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index b5697f687d..6b0dc961ea 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -434,6 +434,7 @@ Rectangle { numberSold: model.number_sold; limitedRun: model.limited_run; displayedItemCount: model.displayedItemCount; + isWearable: model.categories.indexOf("Wearables") > -1; anchors.topMargin: 12; anchors.bottomMargin: 12; diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 6880d10c18..22d9b6025b 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -74,6 +74,7 @@ itemName: 'Test Flaregun', itemPrice: (debugError ? 10 : 17), itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json', + categories: ["Wearables", "Miscellaneous"] }, canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified }); From de50eef9c77399d23f4307149df027f80a5b829b Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 17 Oct 2017 13:18:29 -0700 Subject: [PATCH 2/4] Fix rez certified... --- .../resources/qml/hifi/commerce/checkout/Checkout.qml | 2 +- .../resources/qml/hifi/commerce/purchases/Purchases.qml | 2 +- scripts/system/marketplaces/marketplaces.js | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index b76deb41fc..d136caccfe 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -39,7 +39,7 @@ Rectangle { property bool itemIsJson: true; property bool shouldBuyWithControlledFailure: false; property bool debugCheckoutSuccess: false; - property bool canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified; + property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified(); property bool isWearable; // Style color: hifi.colors.white; diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 6b0dc961ea..c98f212c53 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -32,7 +32,7 @@ Rectangle { property bool securityImageResultReceived: false; property bool purchasesReceived: false; property bool punctuationMode: false; - property bool canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified; + property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified(); property bool pendingInventoryReply: true; property bool isShowingMyItems: false; property bool isDebuggingFirstUseTutorial: false; diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 22d9b6025b..5ffc35e6e5 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -75,8 +75,7 @@ itemPrice: (debugError ? 10 : 17), itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json', categories: ["Wearables", "Miscellaneous"] - }, - canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified + } }); } } @@ -116,7 +115,6 @@ if (url === MARKETPLACE_PURCHASES_QML_PATH) { tablet.sendToQml({ method: 'updatePurchases', - canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified, referrerURL: referrerURL, filterText: filterText }); @@ -204,8 +202,7 @@ tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH); tablet.sendToQml({ method: 'updateCheckoutQML', - params: parsedJsonMessage, - canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified + params: parsedJsonMessage }); } else if (parsedJsonMessage.type === "REQUEST_SETTING") { sendCommerceSettings(); From 876001146a1fe0d7e15f4f07fbc9f7a3cd52af9f Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 18 Oct 2017 14:05:47 -0700 Subject: [PATCH 3/4] Get categories from backend instead of site --- interface/resources/qml/hifi/commerce/checkout/Checkout.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index d136caccfe..b997cc9671 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -81,6 +81,7 @@ Rectangle { root.activeView = "checkoutFailure"; } else { root.itemHref = result.data.download_url; + root.isWearable = result.data.categories.indexOf("Wearables") > -1; root.activeView = "checkoutSuccess"; } } @@ -833,7 +834,6 @@ Rectangle { itemName = message.params.itemName; root.itemPrice = message.params.itemPrice; itemHref = message.params.itemHref; - root.isWearable = message.params.categories.indexOf("Wearables") > -1; setBuyText(); break; default: From 322bac035ce08f7756ddf7eb12be013045a9ea86 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 18 Oct 2017 16:19:54 -0700 Subject: [PATCH 4/4] Don't show 'no permission' text on wearables --- interface/resources/qml/hifi/commerce/checkout/Checkout.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml index b997cc9671..767164d38c 100644 --- a/interface/resources/qml/hifi/commerce/checkout/Checkout.qml +++ b/interface/resources/qml/hifi/commerce/checkout/Checkout.qml @@ -586,7 +586,7 @@ Rectangle { } RalewaySemiBold { id: noPermissionText; - visible: !root.canRezCertifiedItems; + visible: !root.canRezCertifiedItems && !root.isWearable; text: 'You do not have Certified Rez permissions in this domain.' // Text size size: 16;