more bug fixes and cleanup of some console logging

This commit is contained in:
Roxanne Skelly 2018-10-10 16:50:07 -07:00
parent f6a8383d53
commit af055bb45c
2 changed files with 22 additions and 15 deletions

View file

@ -338,13 +338,15 @@ const HifiNotificationType = hfNotifications.NotificationType;
var pendingNotifications = {} var pendingNotifications = {}
var notificationState = NotificationState.UNNOTIFIED; var notificationState = NotificationState.UNNOTIFIED;
function setNotificationState (notificationType, pending = true) { function setNotificationState (notificationType, pending = undefined) {
pendingNotifications[notificationType] = pending; if (pending !== undefined) {
notificationState = NotificationState.UNNOTIFIED; pendingNotifications[notificationType] = pending;
for (var key in pendingNotifications) { notificationState = NotificationState.UNNOTIFIED;
if (pendingNotifications[key]) { for (var key in pendingNotifications) {
notificationState = NotificationState.NOTIFIED; if (pendingNotifications[key]) {
break; notificationState = NotificationState.NOTIFIED;
break;
}
} }
} }
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED); updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
@ -569,9 +571,12 @@ function updateLabels(serverState) {
labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null; labels.wallet.icon = pendingNotifications[HifiNotificationType.WALLET] ? menuNotificationIcon : null;
labels.marketplace.icon = pendingNotifications[HifiNotificationType.MARKETPLACE] ? menuNotificationIcon : null; labels.marketplace.icon = pendingNotifications[HifiNotificationType.MARKETPLACE] ? menuNotificationIcon : null;
var onlineUsers = trayNotifications.getOnlineUsers(); var onlineUsers = trayNotifications.getOnlineUsers();
delete labels.people.submenu;
if (onlineUsers) { if (onlineUsers) {
labels.people.submenu = [];
for (var name in onlineUsers) { for (var name in onlineUsers) {
if(labels.people.submenu == undefined) {
labels.people.submenu = [];
}
labels.people.submenu.push({ labels.people.submenu.push({
label: name, label: name,
enabled: (onlineUsers[name].location != undefined), enabled: (onlineUsers[name].location != undefined),
@ -585,14 +590,17 @@ function updateLabels(serverState) {
} }
} }
var currentStories = trayNotifications.getCurrentStories(); var currentStories = trayNotifications.getCurrentStories();
if (currentStories && currentStories.length) { delete labels.goto.submenu;
labels.goto.submenu = []; if (currentStories) {
for (var location in currentStories) { for (var location in currentStories) {
if(labels.goto.submenu == undefined) {
labels.goto.submenu = [];
}
labels.goto.submenu.push({ labels.goto.submenu.push({
label: "event in " + location, label: "event in " + location,
click: function () { click: function () {
setNotificationState(HifiNotificationType.GOTO, false); setNotificationState(HifiNotificationType.GOTO, false);
StartInterface("hifi://" + location + getCurrentStories[location].path); StartInterface("hifi://" + location + currentStories[location].path);
} }
}); });
} }

View file

@ -302,7 +302,6 @@ HifiNotifications.prototype = {
finished(false); finished(false);
return; return;
} }
console.log(content);
if (!content.total_entries) { if (!content.total_entries) {
finished(true, token); finished(true, token);
return; return;
@ -326,7 +325,6 @@ HifiNotifications.prototype = {
notifyData = content.data.updates; notifyData = content.data.updates;
break; break;
} }
notifyData.forEach(function (notifyDataEntry) { notifyData.forEach(function (notifyDataEntry) {
_this._addNotification(new HifiNotification(notifyType, notifyDataEntry)); _this._addNotification(new HifiNotification(notifyType, notifyDataEntry));
}); });
@ -381,13 +379,13 @@ HifiNotifications.prototype = {
finished(false); finished(false);
return; return;
} }
console.log(content);
if (!content.total_entries) { if (!content.total_entries) {
finished(true, token); finished(true, token);
return; return;
} }
if (!content.total_entries) { if (!content.total_entries) {
this.menuNotificationCallback(NotificationType.GOTO, false); _this.menuNotificationCallback(NotificationType.GOTO, false);
} }
_this.currentStories = {}; _this.currentStories = {};
content.user_stories.forEach(function (story) { content.user_stories.forEach(function (story) {
@ -397,6 +395,7 @@ HifiNotifications.prototype = {
// for each story. // for each story.
_this.currentStories[story.place_name] = story; _this.currentStories[story.place_name] = story;
}); });
_this.menuNotificationCallback(NotificationType.GOTO);
}); });
} }
}); });