From eb2f8aa169226c97c6b0e2260896c3e9ffa9376e Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Thu, 15 Mar 2018 16:03:49 -0700 Subject: [PATCH] New notification flow for item updates --- .../hifi/commerce/purchases/PurchasedItem.qml | 2 +- .../qml/hifi/commerce/purchases/Purchases.qml | 64 +++++++++++++++++-- scripts/system/marketplaces/marketplaces.js | 13 ---- 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml index fc2e3fa24c..4cfa61c9ed 100644 --- a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml +++ b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml @@ -655,7 +655,7 @@ Item { anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; - color: "#E7F8FB"; + color: "#B5EAFF"; RalewayRegular { id: updateAvailableText; diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 6ba0a4ac41..7bb7461596 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -38,6 +38,7 @@ Rectangle { property int pendingItemCount: 0; property string installedApps; property bool keyboardRaised: false; + property int numUpdatesAvailable: 0; // Style color: hifi.colors.white; Connections { @@ -127,6 +128,7 @@ Rectangle { console.log("Failed to get Available Updates", result.data.message); } else { sendToScript({method: 'purchases_availableUpdatesReceived', numUpdates: result.data.updates.length }); + root.numUpdatesAvailable = result.data.updates.length; } } } @@ -527,6 +529,64 @@ Rectangle { } } + Rectangle { + id: updatesAvailableBanner; + visible: true; + anchors.bottom: parent.bottom; + anchors.left: parent.left; + anchors.right: parent.right; + height: 75; + color: "#B5EAFF"; + + Rectangle { + id: updatesAvailableGlyph; + anchors.verticalCenter: parent.verticalCenter; + anchors.left: parent.left; + anchors.leftMargin: 16; + // Size + width: 10; + height: width; + radius: width/2; + // Style + color: "red"; + } + + RalewaySemiBold { + text: "You have " + root.numUpdatesAvailable + " item updates available."; + // Text size + size: 18; + // Anchors + anchors.left: updatesAvailableGlyph.right; + anchors.leftMargin: 12; + height: parent.height; + width: paintedWidth; + // Style + color: hifi.colors.black; + // Alignment + verticalAlignment: Text.AlignVCenter; + } + + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + propagateComposedEvents: false; + } + + HifiControlsUit.Button { + color: hifi.buttons.white; + colorScheme: hifi.colorSchemes.dark; + anchors.verticalCenter: parent.verticalCenter; + anchors.right: parent.right; + anchors.rightMargin: 12; + width: 100; + height: 40; + text: "SHOW ME"; + onClicked: { + filterBar.changeFilterByDisplayName("Updatable"); + } + } + } + Item { id: noItemsAlertContainer; visible: !purchasesContentsList.visible && @@ -830,10 +890,6 @@ Rectangle { case 'purchases_showMyItems': root.isShowingMyItems = true; break; - case 'showUpdates': - // Uncomment and/or change this once we figure out what the correct behavior is. - //filterBar.changeFilterByDisplayName("Updatable"); - break; default: console.log('Unrecognized message from marketplaces.js:', JSON.stringify(message)); } diff --git a/scripts/system/marketplaces/marketplaces.js b/scripts/system/marketplaces/marketplaces.js index 4e235b00bf..916892c0c2 100644 --- a/scripts/system/marketplaces/marketplaces.js +++ b/scripts/system/marketplaces/marketplaces.js @@ -445,12 +445,6 @@ var selectionDisplay = null; // for gridTool.js to ignore } else if (parsedJsonMessage.type === "PURCHASES") { referrerURL = parsedJsonMessage.referrerURL; filterText = ""; - if (parsedJsonMessage.hasUpdates) { - wireEventBridge(true); - tablet.sendToQml({ - method: 'showUpdates' - }); - } tablet.pushOntoStack(MARKETPLACE_PURCHASES_QML_PATH); } else if (parsedJsonMessage.type === "LOGIN") { openLoginWindow(); @@ -553,13 +547,6 @@ var selectionDisplay = null; // for gridTool.js to ignore //tablet.popFromStack(); break; case 'header_goToPurchases': - if (message.hasUpdates) { - wireEventBridge(true); - tablet.sendToQml({ - method: 'showUpdates' - }); - } - // Fall through. case 'checkout_goToPurchases': referrerURL = MARKETPLACE_URL_INITIAL; filterText = message.filterText;