Merge pull request #14384 from roxanneskelly/Case19808

Case19808 - Sys tray need to remove wallet and market --> inventory
This commit is contained in:
Howard Stearns 2018-11-12 17:02:34 -08:00 committed by GitHub
commit c520e9de35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 42 deletions

View file

@ -337,7 +337,17 @@ var notificationState = NotificationState.UNNOTIFIED;
function setNotificationState (notificationType, pending = undefined) { function setNotificationState (notificationType, pending = undefined) {
if (pending !== undefined) { if (pending !== undefined) {
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; pendingNotifications[notificationType] = pending;
}
notificationState = NotificationState.UNNOTIFIED; notificationState = NotificationState.UNNOTIFIED;
for (var key in pendingNotifications) { for (var key in pendingNotifications) {
if (pendingNotifications[key]) { if (pendingNotifications[key]) {
@ -428,18 +438,12 @@ var labels = {
setNotificationState(HifiNotificationType.PEOPLE, false); setNotificationState(HifiNotificationType.PEOPLE, false);
} }
}, },
wallet: { inventory: {
label: 'Wallet', label: 'Inventory',
click: function () { click: function () {
StartInterface("hifiapp:WALLET"); StartInterface("hifiapp:INVENTORY");
setNotificationState(HifiNotificationType.WALLET, false); setNotificationState(HifiNotificationType.ITEMS, false);
} setNotificationState(HifiNotificationType.TRANSACTIONS, false);
},
marketplace: {
label: 'Market',
click: function () {
StartInterface("hifiapp:MARKET");
setNotificationState(HifiNotificationType.MARKETPLACE, false);
} }
}, },
restart: { restart: {
@ -528,8 +532,7 @@ function buildMenuArray(serverState) {
if (trayNotifications.enabled()) { if (trayNotifications.enabled()) {
menuArray.push(labels.goto); menuArray.push(labels.goto);
menuArray.push(labels.people); menuArray.push(labels.people);
menuArray.push(labels.wallet); menuArray.push(labels.inventory);
menuArray.push(labels.marketplace);
menuArray.push(separator); menuArray.push(separator);
} }
menuArray.push(labels.showNotifications); menuArray.push(labels.showNotifications);
@ -565,8 +568,7 @@ function updateLabels(serverState) {
labels.showNotifications.checked = trayNotifications.enabled(); labels.showNotifications.checked = trayNotifications.enabled();
labels.goto.icon = pendingNotifications[HifiNotificationType.GOTO] ? menuNotificationIcon : null; labels.goto.icon = pendingNotifications[HifiNotificationType.GOTO] ? menuNotificationIcon : null;
labels.people.icon = pendingNotifications[HifiNotificationType.PEOPLE] ? menuNotificationIcon : null; labels.people.icon = pendingNotifications[HifiNotificationType.PEOPLE] ? menuNotificationIcon : null;
labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null; labels.inventory.icon = pendingNotifications[HifiNotificationType.ITEMS] || pendingNotifications[HifiNotificationType.TRANSACTIONS]? menuNotificationIcon : null;
labels.marketplace.icon = pendingNotifications[HifiNotificationType.MARKETPLACE] ? menuNotificationIcon : null;
var onlineUsers = trayNotifications.getOnlineUsers(); var onlineUsers = trayNotifications.getOnlineUsers();
delete labels.people.submenu; delete labels.people.submenu;
if (onlineUsers) { if (onlineUsers) {

View file

@ -34,8 +34,8 @@ const IsInterfaceRunning=hfApp.isInterfaceRunning;
const NotificationType = { const NotificationType = {
GOTO: 'goto', GOTO: 'goto',
PEOPLE: 'people', PEOPLE: 'people',
WALLET: 'wallet', ITEMS: 'items',
MARKETPLACE: 'marketplace' TRANSACTIONS: 'transactions'
}; };
@ -89,34 +89,34 @@ HifiNotification.prototype = {
} }
break; break;
case NotificationType.WALLET: case NotificationType.TRANSACTIONS:
if (typeof(this.data) === "number") { if (typeof(this.data) === "number") {
if (this.data === 1) { if (this.data === 1) {
text = "You have " + this.data + " unread Wallet transaction."; text = "You have " + this.data + " unread transaction.";
} else { } else {
text = "You have " + this.data + " unread Wallet transactions."; text = "You have " + this.data + " unread transactions.";
} }
message = "Click to open WALLET." message = "Click to open INVENTORY."
url = "hifiapp:hifi/commerce/wallet/Wallet.qml"; url = "hifiapp:INVENTORY";
break; break;
} }
text = this.data.message.replace(/<\/?[^>]+(>|$)/g, ""); text = this.data.message.replace(/<\/?[^>]+(>|$)/g, "");
message = "Click to open WALLET."; message = "Click to open INVENTORY.";
url = "hifiapp:WALLET"; url = "hifiapp:INVENTORY";
break; break;
case NotificationType.MARKETPLACE: case NotificationType.ITEMS:
if (typeof(this.data) === "number") { if (typeof(this.data) === "number") {
if (this.data === 1) { 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 { } else {
text = this.data + " of your purchased items have updates available."; text = this.data + " of your items have updates available.";
} }
} else { } else {
text = "Update available for " + this.data.base_item_title + "."; text = "Update available for " + this.data.base_item_title + ".";
} }
message = "Click to open MARKET."; message = "Click to open INVENTORY.";
url = "hifiapp:MARKET"; url = "hifiapp:INVENTORY";
break; break;
} }
notifier.notify({ notifier.notify({
@ -235,7 +235,6 @@ HifiNotifications.prototype = {
}, },
_showNotification: function () { _showNotification: function () {
var _this = this; var _this = this;
if (osType === 'Darwin') { if (osType === 'Darwin') {
this.pendingNotifications[0].show(function () { this.pendingNotifications[0].show(function () {
// For OSX // For OSX
@ -325,10 +324,10 @@ HifiNotifications.prototype = {
case NotificationType.PEOPLE: case NotificationType.PEOPLE:
notifyData = content.data.users; notifyData = content.data.users;
break; break;
case NotificationType.WALLET: case NotificationType.TRANSACTIONS:
notifyData = content.data.history; notifyData = content.data.history;
break; break;
case NotificationType.MARKETPLACE: case NotificationType.ITEMS:
notifyData = content.data.updates; notifyData = content.data.updates;
break; break;
} }
@ -376,19 +375,16 @@ HifiNotifications.prototype = {
} }
}, function (error, data) { }, function (error, data) {
if (error || !data.body) { if (error || !data.body) {
console.log("Error: unable to get " + url); console.log("Error: " + error + ": unable to get " + url);
finished(false);
return; return;
} }
var content = JSON.parse(data.body); var content = JSON.parse(data.body);
if (!content || content.status != 'success') { if (!content || content.status != 'success') {
console.log("Error: unable to get " + url); console.log("Error: unable to get " + url);
finished(false);
return; return;
} }
if (!content.total_entries) { if (!content.total_entries) {
finished(true, token);
return; return;
} }
if (!content.total_entries) { if (!content.total_entries) {
@ -487,7 +483,7 @@ HifiNotifications.prototype = {
console.log("Polling for economic activity"); console.log("Polling for economic activity");
var url = METAVERSE_SERVER_URL + ECONOMIC_ACTIVITY_URL + '?' + options.join('&'); var url = METAVERSE_SERVER_URL + ECONOMIC_ACTIVITY_URL + '?' + options.join('&');
console.log(url); console.log(url);
_this._pollCommon(NotificationType.WALLET, url, since, function () {}); _this._pollCommon(NotificationType.TRANSACTIONS, url, since, function () {});
}, },
pollForMarketplaceUpdates: function (since) { pollForMarketplaceUpdates: function (since) {
var _this = this; var _this = this;
@ -499,7 +495,7 @@ HifiNotifications.prototype = {
console.log("Polling for marketplace update"); console.log("Polling for marketplace update");
var url = METAVERSE_SERVER_URL + UPDATES_URL + '?' + options.join('&'); var url = METAVERSE_SERVER_URL + UPDATES_URL + '?' + options.join('&');
console.log(url); console.log(url);
_this._pollCommon(NotificationType.MARKETPLACE, url, since, function (success, token) { _this._pollCommon(NotificationType.ITEMS, url, since, function (success, token) {
if (success) { if (success) {
var options = [ var options = [
'page=1', 'page=1',
@ -512,7 +508,7 @@ HifiNotifications.prototype = {
'bearer': token 'bearer': token
} }
}, function (error, data) { }, function (error, data) {
_this._pollToDisableHighlight(NotificationType.MARKETPLACE, error, data); _this._pollToDisableHighlight(NotificationType.ITEMS, error, data);
}); });
} }
}); });