Fix GOTO notifs; fix WALLET notifs (pending backend change)

This commit is contained in:
Zach Fox 2018-09-26 14:57:32 -07:00
parent be304ea975
commit 6877af04f1
2 changed files with 7 additions and 55 deletions

View file

@ -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);
}

View file

@ -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);
}
}