From cd4e56e7d54bb1f2f31955338a1b5785387e9ca6 Mon Sep 17 00:00:00 2001 From: Roxanne Skelly Date: Fri, 9 Nov 2018 14:26:20 -0800 Subject: [PATCH] Case 19808 - Change MARKET and WALLET in tray notifier to be INVENTORY along with other appropriate messaging changes. --- server-console/src/main.js | 34 ++++++------- .../src/modules/hf-notifications.js | 48 +++++++++---------- 2 files changed, 40 insertions(+), 42 deletions(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index dc3fbd4333..5adb4be4cb 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -337,7 +337,17 @@ var notificationState = NotificationState.UNNOTIFIED; function setNotificationState (notificationType, pending = undefined) { if (pending !== undefined) { - pendingNotifications[notificationType] = pending; + if ((notificationType === HifiNotificationType.TRANSACTIONS || + notificationType === HifiNotificationType.ITEMS)) { + // special case, because we want to clear the indicator light + // on INVENTORY when either Transactions or Items are + // clicked on in the notification popup, we detect that case + // here and force both to be unnotified. + pendingNotifications[HifiNotificationType.TRANSACTIONS] = pending; + pendingNotifications[HifiNotificationType.ITEMS] = pending; + } else { + pendingNotifications[notificationType] = pending; + } notificationState = NotificationState.UNNOTIFIED; for (var key in pendingNotifications) { if (pendingNotifications[key]) { @@ -428,18 +438,12 @@ var labels = { setNotificationState(HifiNotificationType.PEOPLE, false); } }, - wallet: { - label: 'Wallet', + inventory: { + label: 'Inventory', click: function () { - StartInterface("hifiapp:WALLET"); - setNotificationState(HifiNotificationType.WALLET, false); - } - }, - marketplace: { - label: 'Market', - click: function () { - StartInterface("hifiapp:MARKET"); - setNotificationState(HifiNotificationType.MARKETPLACE, false); + StartInterface("hifiapp:INVENTORY"); + setNotificationState(HifiNotificationType.ITEMS, false); + setNotificationState(HifiNotificationType.TRANSACTIONS, false); } }, restart: { @@ -528,8 +532,7 @@ function buildMenuArray(serverState) { if (trayNotifications.enabled()) { menuArray.push(labels.goto); menuArray.push(labels.people); - menuArray.push(labels.wallet); - menuArray.push(labels.marketplace); + menuArray.push(labels.inventory); menuArray.push(separator); } menuArray.push(labels.showNotifications); @@ -565,8 +568,7 @@ function updateLabels(serverState) { labels.showNotifications.checked = trayNotifications.enabled(); labels.goto.icon = pendingNotifications[HifiNotificationType.GOTO] ? menuNotificationIcon : null; labels.people.icon = pendingNotifications[HifiNotificationType.PEOPLE] ? menuNotificationIcon : null; - labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null; - labels.marketplace.icon = pendingNotifications[HifiNotificationType.MARKETPLACE] ? menuNotificationIcon : null; + labels.inventory.icon = pendingNotifications[HifiNotificationType.ITEMS] || pendingNotifications[HifiNotificationType.TRANSACTIONS]? menuNotificationIcon : null; var onlineUsers = trayNotifications.getOnlineUsers(); delete labels.people.submenu; if (onlineUsers) { diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index 8a812625b4..1ddbd1d307 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -32,10 +32,10 @@ const StartInterface=hfApp.startInterface; const IsInterfaceRunning=hfApp.isInterfaceRunning; const NotificationType = { - GOTO: 'goto', - PEOPLE: 'people', - WALLET: 'wallet', - MARKETPLACE: 'marketplace' + GOTO: 'goto', + PEOPLE: 'people', + ITEMS: 'items', + TRANSACTIONS: 'transactions' }; @@ -89,34 +89,34 @@ HifiNotification.prototype = { } break; - case NotificationType.WALLET: + case NotificationType.TRANSACTIONS: if (typeof(this.data) === "number") { if (this.data === 1) { - text = "You have " + this.data + " unread Wallet transaction."; + text = "You have " + this.data + " unread transaction."; } else { - text = "You have " + this.data + " unread Wallet transactions."; + text = "You have " + this.data + " unread transactions."; } - message = "Click to open WALLET." - url = "hifiapp:hifi/commerce/wallet/Wallet.qml"; + message = "Click to open INVENTORY." + url = "hifiapp:INVENTORY"; break; } text = this.data.message.replace(/<\/?[^>]+(>|$)/g, ""); - message = "Click to open WALLET."; - url = "hifiapp:WALLET"; + message = "Click to open INVENTORY."; + url = "hifiapp:INVENTORY"; break; - case NotificationType.MARKETPLACE: + case NotificationType.ITEMS: if (typeof(this.data) === "number") { if (this.data === 1) { - text = this.data + " of your purchased items has an update available."; + text = this.data + " of your items has an update available."; } else { - text = this.data + " of your purchased items have updates available."; + text = this.data + " of your items have updates available."; } } else { text = "Update available for " + this.data.base_item_title + "."; } - message = "Click to open MARKET."; - url = "hifiapp:MARKET"; + message = "Click to open INVENTORY."; + url = "hifiapp:INVENTORY"; break; } notifier.notify({ @@ -235,7 +235,6 @@ HifiNotifications.prototype = { }, _showNotification: function () { var _this = this; - if (osType === 'Darwin') { this.pendingNotifications[0].show(function () { // For OSX @@ -325,10 +324,10 @@ HifiNotifications.prototype = { case NotificationType.PEOPLE: notifyData = content.data.users; break; - case NotificationType.WALLET: + case NotificationType.TRANSACTIONS: notifyData = content.data.history; break; - case NotificationType.MARKETPLACE: + case NotificationType.ITEMS: notifyData = content.data.updates; break; } @@ -376,19 +375,16 @@ HifiNotifications.prototype = { } }, function (error, data) { if (error || !data.body) { - console.log("Error: unable to get " + url); - finished(false); + console.log("Error: " + error + ": unable to get " + url); return; } var content = JSON.parse(data.body); if (!content || content.status != 'success') { console.log("Error: unable to get " + url); - finished(false); return; } if (!content.total_entries) { - finished(true, token); return; } if (!content.total_entries) { @@ -487,7 +483,7 @@ HifiNotifications.prototype = { console.log("Polling for economic activity"); var url = METAVERSE_SERVER_URL + ECONOMIC_ACTIVITY_URL + '?' + options.join('&'); console.log(url); - _this._pollCommon(NotificationType.WALLET, url, since, function () {}); + _this._pollCommon(NotificationType.TRANSACTIONS, url, since, function () {}); }, pollForMarketplaceUpdates: function (since) { var _this = this; @@ -499,7 +495,7 @@ HifiNotifications.prototype = { console.log("Polling for marketplace update"); var url = METAVERSE_SERVER_URL + UPDATES_URL + '?' + options.join('&'); console.log(url); - _this._pollCommon(NotificationType.MARKETPLACE, url, since, function (success, token) { + _this._pollCommon(NotificationType.ITEMS, url, since, function (success, token) { if (success) { var options = [ 'page=1', @@ -512,7 +508,7 @@ HifiNotifications.prototype = { 'bearer': token } }, function (error, data) { - _this._pollToDisableHighlight(NotificationType.MARKETPLACE, error, data); + _this._pollToDisableHighlight(NotificationType.ITEMS, error, data); }); } });