From 6877af04f118edf56562113d60ed28b951603c28 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Wed, 26 Sep 2018 14:57:32 -0700 Subject: [PATCH] Fix GOTO notifs; fix WALLET notifs (pending backend change) --- scripts/system/commerce/wallet.js | 54 ++----------------------------- scripts/system/tablet-goto.js | 8 ++--- 2 files changed, 7 insertions(+), 55 deletions(-) diff --git a/scripts/system/commerce/wallet.js b/scripts/system/commerce/wallet.js index 639c8aa0b3..c0e044c84b 100644 --- a/scripts/system/commerce/wallet.js +++ b/scripts/system/commerce/wallet.js @@ -501,41 +501,8 @@ function notificationDataProcessPage(data) { var shouldShowDot = false; function notificationPollCallback(historyArray) { - var i; - var someoneElsePurchasedArray = []; - var proofIssuedArray = []; - var moneyReceivedArray = []; - var giftReceivedArray = []; - for (i = 0; i < historyArray.length; i++) { - var currentHistoryTxn = historyArray[i]; - - if (currentHistoryTxn.sent_certs <= 0 && - currentHistoryTxn.received_certs <= 0) { - // This is an HFC transfer. - if (currentHistoryTxn.received_money > 0) { - if (currentHistoryTxn.sender_name === "marketplace") { - someoneElsePurchasedArray.push(currentHistoryTxn); - } else { - moneyReceivedArray.push(currentHistoryTxn); - } - } - } else if (currentHistoryTxn.sent_money <= 0 && - currentHistoryTxn.received_money <= 0 && - currentHistoryTxn.received_certs > 0) { - // This is a non-HFC asset transfer. - if (currentHistoryTxn.sender_name === "marketplace") { - proofIssuedArray.push(currentHistoryTxn); - } else { - giftReceivedArray.push(currentHistoryTxn); - } - } - } - if (!ui.isOpen) { - var notificationCount = someoneElsePurchasedArray.length + - proofIssuedArray.length + - moneyReceivedArray.length + - giftReceivedArray.length; + var notificationCount = historyArray.length; shouldShowDot = shouldShowDot || notificationCount > 0; ui.messagesWaiting(shouldShowDot); @@ -546,23 +513,8 @@ function notificationPollCallback(historyArray) { "transaction" + (notificationCount === 1 ? "" : "s") + ". Open WALLET to see all activity."; ui.notificationDisplayBanner(message); } else { - for (i = 0; i < someoneElsePurchasedArray.length; i++) { - message = '"' + (someoneElsePurchasedArray[i].message) + '" ' + - "Open WALLET to see all activity."; - ui.notificationDisplayBanner(message); - } - for (i = 0; i < proofIssuedArray.length; i++) { - message = '"' + (proofIssuedArray[i].message) + '" ' + - "Open WALLET to see all activity."; - ui.notificationDisplayBanner(message); - } - for (i = 0; i < moneyReceivedArray.length; i++) { - message = '"' + (moneyReceivedArray[i].message) + '" ' + - "Open WALLET to see all activity."; - ui.notificationDisplayBanner(message); - } - for (i = 0; i < giftReceivedArray.length; i++) { - message = '"' + (giftReceivedArray[i].message) + '" ' + + for (var i = 0; i < notificationCount; i++) { + message = '"' + (historyArray[i].message) + '" ' + "Open WALLET to see all activity."; ui.notificationDisplayBanner(message); } diff --git a/scripts/system/tablet-goto.js b/scripts/system/tablet-goto.js index 902e1b7fef..6d8ba3a927 100644 --- a/scripts/system/tablet-goto.js +++ b/scripts/system/tablet-goto.js @@ -57,16 +57,16 @@ function notificationPollCallback(userStoriesArray) { storedAnnouncements[story.id] = story; if (shouldNotifyIndividually) { - message = storedAnnouncements[key].username + " says something is happening in " + - storedAnnouncements[key].place_name + ". Open GOTO to join them."; + message = story.username + " says something is happening in " + + story.place_name + ". Open GOTO to join them."; ui.notificationDisplayBanner(message); } } else if (story.audience === "for_feed") { storedFeaturedStories[story.id] = story; if (shouldNotifyIndividually) { - message = storedFeaturedStories[key].username + " invites you to an event in " + - storedFeaturedStories[key].place_name + ". Open GOTO to join them."; + message = story.username + " invites you to an event in " + + story.place_name + ". Open GOTO to join them."; ui.notificationDisplayBanner(message); } }