Merge branch 'oculus-store-commerce' into tabless

This commit is contained in:
Howard Stearns 2018-11-01 11:22:28 -07:00
commit 8f2f27f468
10 changed files with 215 additions and 155 deletions
interface/resources/qml/hifi/commerce
scripts

View file

@ -47,8 +47,7 @@ Item {
property string wornEntityID;
property string upgradeUrl;
property string upgradeTitle;
property bool updateAvailable: root.upgradeUrl !== "" && !root.isShowingMyItems;
property bool isShowingMyItems;
property bool updateAvailable: root.upgradeUrl !== "";
property bool valid;
property string originalStatusText;
@ -231,7 +230,7 @@ Item {
Loader {
id: giftButton;
visible: !root.isShowingMyItems;
visible: root.itemEdition > 0;
sourceComponent: contextCardButton;
anchors.right: parent.right;
anchors.top: parent.top;

View file

@ -90,7 +90,6 @@ Rectangle {
if (result.status !== 'success') {
console.log("Failed to get Available Updates", result.data.message);
} else {
sendToScript({method: 'purchases_availableUpdatesReceived', numUpdates: result.data.updates.length });
root.numUpdatesAvailable = result.total_entries;
}
}
@ -162,7 +161,7 @@ Rectangle {
id: titleBarContainer;
z: 997;
visible: false;
height: 100; // HRS FIXME: get rid of the header and associated code entirely?
height: 100;
// Size
width: parent.width;
// Anchors
@ -499,7 +498,7 @@ Rectangle {
"filterName": "updated"
},
{
"displayName": "Proofs",
"displayName": "My Submissions",
"filterName": "proofs"
}
]

View file

@ -99,6 +99,13 @@ Rectangle {
}
}
onActiveViewChanged: {
if (activeView === "walletHome") {
walletHomeButtonContainer.messagesWaiting = false;
sendToScript({method: 'clearShouldShowDotHistory'});
}
}
HifiCommerceCommon.CommerceLightbox {
id: lightboxPopup;
visible: false;
@ -348,10 +355,6 @@ Rectangle {
if (msg.method === 'transactionHistory_usernameLinkClicked') {
userInfoViewer.url = msg.usernameLink;
userInfoViewer.visible = true;
} else if (msg.method === 'goToPurchases_fromWalletHome') {
root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors();
} else {
sendToScript(msg);
}
@ -494,6 +497,7 @@ Rectangle {
// "WALLET HOME" tab button
Rectangle {
id: walletHomeButtonContainer;
property bool messagesWaiting: false;
visible: !walletSetup.visible;
color: root.activeView === "walletHome" ? hifi.colors.blueAccent : hifi.colors.black;
anchors.top: parent.top;
@ -514,6 +518,19 @@ Rectangle {
color: WalletScriptingInterface.limitedCommerce ? hifi.colors.lightGray50 : ((root.activeView === "walletHome" || walletHomeTabMouseArea.containsMouse) ? hifi.colors.white : hifi.colors.blueHighlight);
}
Rectangle {
id: recentActivityMessagesWaitingLight;
visible: parent.messagesWaiting;
anchors.right: homeTabIcon.left;
anchors.rightMargin: -4;
anchors.top: homeTabIcon.top;
anchors.topMargin: 16;
height: 10;
width: height;
radius: height/2;
color: "red";
}
RalewaySemiBold {
text: "RECENT ACTIVITY";
// Text size
@ -572,7 +589,7 @@ Rectangle {
}
Rectangle {
id: messagesWaitingLight;
id: exchangeMoneyMessagesWaitingLight;
visible: parent.messagesWaiting;
anchors.right: exchangeMoneyTabIcon.left;
anchors.rightMargin: -4;
@ -609,7 +626,6 @@ Rectangle {
hoverEnabled: enabled;
onClicked: {
root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors();
}
onEntered: parent.color = hifi.colors.blueHighlight;
@ -889,6 +905,9 @@ Rectangle {
case 'updateWearables':
walletInventory.fromScript(message);
break;
case 'updateRecentActivityMessageLight':
walletHomeButtonContainer.messagesWaiting = message.messagesWaiting;
break;
default:
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
}
@ -937,7 +956,6 @@ Rectangle {
Commerce.getWalletStatus();
} else if (msg.referrer === 'purchases') {
root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors();
} else if (msg.referrer === 'marketplace cta' || msg.referrer === 'mainPage') {
sendToScript({method: 'goToMarketplaceMainPage', itemId: msg.referrer});

View file

@ -179,28 +179,6 @@ Item {
color: hifi.colors.baseGrayHighlight;
}
RalewaySemiBold {
id: myPurchasesLink;
text: '<font color="#0093C5"><a href="#myPurchases">Inventory</a></font>';
// Anchors
anchors.top: parent.top;
anchors.topMargin: 26;
anchors.right: parent.right;
anchors.rightMargin: 20;
width: paintedWidth;
height: 30;
y: 4;
// Text size
size: 18;
// Style
color: hifi.colors.baseGrayHighlight;
horizontalAlignment: Text.AlignRight;
onLinkActivated: {
sendSignalToWallet({method: 'goToPurchases_fromWalletHome'});
}
}
HifiModels.PSFListModel {
id: transactionHistoryModel;
property int lastPendingCount: 0;

View file

@ -95,16 +95,16 @@ function AppUi(properties) {
activeIcon: isWaiting ? that.activeMessagesButton : that.activeButton
});
};
that.notificationPollTimeout = false;
that.notificationPollTimeoutMs = 60000;
that.notificationPollEndpoint = false;
that.notificationPollStopPaginatingConditionMet = false;
that.notificationPollTimeout = [false];
that.notificationPollTimeoutMs = [60000];
that.notificationPollEndpoint = [false];
that.notificationPollStopPaginatingConditionMet = [false];
that.notificationDataProcessPage = function (data) {
return data;
};
that.notificationPollCallback = that.ignore;
that.notificationPollCaresAboutSince = false;
that.notificationInitialCallbackMade = false;
that.notificationPollCallback = [that.ignore];
that.notificationPollCaresAboutSince = [false];
that.notificationInitialCallbackMade = [false];
that.notificationDisplayBanner = function (message) {
if (!that.isOpen) {
Window.displayAnnouncement(message);
@ -129,7 +129,9 @@ function AppUi(properties) {
}
that.isOpen = true;
}
} else { // Not us. Should we do something for type Home, Menu, and particularly Closed (meaning tablet hidden?
} else {
// A different screen is now visible, or the tablet has been closed.
// Tablet visibility is controlled separately by `tabletShownChanged()`
that.wireEventBridge(false);
if (that.isOpen) {
that.buttonActive(false);
@ -139,83 +141,124 @@ function AppUi(properties) {
that.isOpen = false;
}
}
// console.debug(that.buttonName + " app reports: Tablet screen changed.\nNew screen type: " + type +
// "\nNew screen URL: " + url + "\nCurrent app open status: " + that.isOpen + "\n");
};
// Overwrite with the given properties:
Object.keys(properties).forEach(function (key) { that[key] = properties[key]; });
Object.keys(properties).forEach(function (key) {
that[key] = properties[key];
});
//
// START Notification Handling
//
var currentDataPageToRetrieve = [];
var concatenatedServerResponse = [];
for (var i = 0; i < that.notificationPollEndpoint.length; i++) {
currentDataPageToRetrieve[i] = 1;
concatenatedServerResponse[i] = new Array();
}
var MAX_LOG_LENGTH_CHARACTERS = 300;
function requestCallback(error, response, optionalParams) {
var indexOfRequest = optionalParams.indexOfRequest;
var urlOfRequest = optionalParams.urlOfRequest;
if (error || (response.status !== 'success')) {
print("Error: unable to get", urlOfRequest, error || response.status);
startNotificationTimer(indexOfRequest);
return;
}
if (!that.notificationPollStopPaginatingConditionMet[indexOfRequest] ||
that.notificationPollStopPaginatingConditionMet[indexOfRequest](response)) {
startNotificationTimer(indexOfRequest);
var notificationData;
if (concatenatedServerResponse[indexOfRequest].length) {
notificationData = concatenatedServerResponse[indexOfRequest];
} else {
notificationData = that.notificationDataProcessPage[indexOfRequest](response);
}
console.debug(that.buttonName, that.notificationPollEndpoint[indexOfRequest],
'truncated notification data for processing:',
JSON.stringify(notificationData).substring(0, MAX_LOG_LENGTH_CHARACTERS));
that.notificationPollCallback[indexOfRequest](notificationData);
that.notificationInitialCallbackMade[indexOfRequest] = true;
currentDataPageToRetrieve[indexOfRequest] = 1;
concatenatedServerResponse[indexOfRequest] = new Array();
} else {
concatenatedServerResponse[indexOfRequest] =
concatenatedServerResponse[indexOfRequest].concat(that.notificationDataProcessPage[indexOfRequest](response));
currentDataPageToRetrieve[indexOfRequest]++;
request({
json: true,
uri: (urlOfRequest + "&page=" + currentDataPageToRetrieve[indexOfRequest])
}, requestCallback, optionalParams);
}
}
var METAVERSE_BASE = Account.metaverseServerURL;
var currentDataPageToRetrieve = 1;
var concatenatedServerResponse = new Array();
that.notificationPoll = function () {
if (!that.notificationPollEndpoint) {
var MS_IN_SEC = 1000;
that.notificationPoll = function (i) {
if (!that.notificationPollEndpoint[i]) {
return;
}
// User is "appearing offline" or is offline
if (GlobalServices.findableBy === "none" || Account.username === "") {
that.notificationPollTimeout = Script.setTimeout(that.notificationPoll, that.notificationPollTimeoutMs);
// User is "appearing offline" or is not logged in
if (GlobalServices.findableBy === "none" || Account.username === "Unknown user") {
// The notification polling will restart when the user changes their availability
// or when they log in, so it's not necessary to restart a timer here.
console.debug(that.buttonName + " Notifications: User is appearing offline or not logged in. " +
that.buttonName + " will poll for notifications when user logs in and has their availability " +
"set to not appear offline.");
return;
}
var url = METAVERSE_BASE + that.notificationPollEndpoint;
var url = METAVERSE_BASE + that.notificationPollEndpoint[i];
var settingsKey = "notifications/" + that.buttonName + "/lastPoll";
var settingsKey = "notifications/" + that.notificationPollEndpoint[i] + "/lastPoll";
var currentTimestamp = new Date().getTime();
var lastPollTimestamp = Settings.getValue(settingsKey, currentTimestamp);
if (that.notificationPollCaresAboutSince) {
url = url + "&since=" + lastPollTimestamp/1000;
if (that.notificationPollCaresAboutSince[i]) {
url = url + "&since=" + lastPollTimestamp / MS_IN_SEC;
}
Settings.setValue(settingsKey, currentTimestamp);
console.debug(that.buttonName, 'polling for notifications at endpoint', url);
function requestCallback(error, response) {
if (error || (response.status !== 'success')) {
print("Error: unable to get", url, error || response.status);
that.notificationPollTimeout = Script.setTimeout(that.notificationPoll, that.notificationPollTimeoutMs);
return;
}
if (!that.notificationPollStopPaginatingConditionMet || that.notificationPollStopPaginatingConditionMet(response)) {
that.notificationPollTimeout = Script.setTimeout(that.notificationPoll, that.notificationPollTimeoutMs);
var notificationData;
if (concatenatedServerResponse.length) {
notificationData = concatenatedServerResponse;
} else {
notificationData = that.notificationDataProcessPage(response);
}
console.debug(that.buttonName, 'notification data for processing:', JSON.stringify(notificationData));
that.notificationPollCallback(notificationData);
that.notificationInitialCallbackMade = true;
currentDataPageToRetrieve = 1;
concatenatedServerResponse = new Array();
} else {
concatenatedServerResponse = concatenatedServerResponse.concat(that.notificationDataProcessPage(response));
currentDataPageToRetrieve++;
request({ json: true, uri: (url + "&page=" + currentDataPageToRetrieve) }, requestCallback);
}
}
request({ json: true, uri: url }, requestCallback);
request({
json: true,
uri: url
},
requestCallback,
{
indexOfRequest: i,
urlOfRequest: url
});
};
// This won't do anything if there isn't a notification endpoint set
that.notificationPoll();
for (i = 0; i < that.notificationPollEndpoint.length; i++) {
that.notificationPoll(i);
}
function startNotificationTimer(indexOfRequest) {
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout(function () {
that.notificationPoll(indexOfRequest);
}, that.notificationPollTimeoutMs[indexOfRequest]);
}
function restartNotificationPoll() {
that.notificationInitialCallbackMade = false;
if (that.notificationPollTimeout) {
Script.clearTimeout(that.notificationPollTimeout);
that.notificationPollTimeout = false;
for (var j = 0; j < that.notificationPollEndpoint.length; j++) {
that.notificationInitialCallbackMade[j] = false;
if (that.notificationPollTimeout[j]) {
Script.clearTimeout(that.notificationPollTimeout[j]);
that.notificationPollTimeout[j] = false;
}
that.notificationPoll(j);
}
that.notificationPoll();
}
//
// END Notification Handling
@ -322,9 +365,11 @@ function AppUi(properties) {
}
that.tablet.removeButton(that.button);
}
if (that.notificationPollTimeout) {
Script.clearInterval(that.notificationPollTimeout);
that.notificationPollTimeout = false;
for (var i = 0; i < that.notificationPollTimeout.length; i++) {
if (that.notificationPollTimeout[i]) {
Script.clearInterval(that.notificationPollTimeout[i]);
that.notificationPollTimeout[i] = false;
}
}
};
// Set up the handlers.
@ -333,7 +378,7 @@ function AppUi(properties) {
Script.scriptEnding.connect(that.onScriptEnding);
GlobalServices.findableByChanged.connect(restartNotificationPoll);
GlobalServices.myUsernameChanged.connect(restartNotificationPoll);
if (that.buttonName == Settings.getValue("startUpApp")) {
if (that.buttonName === Settings.getValue("startUpApp")) {
Settings.setValue("startUpApp", "");
Script.setTimeout(function () {
that.open();

View file

@ -18,7 +18,8 @@
module.exports = {
// ------------------------------------------------------------------
request: function (options, callback) { // cb(error, responseOfCorrectContentType) of url. A subset of npm request.
// cb(error, responseOfCorrectContentType, optionalCallbackParameter) of url. A subset of npm request.
request: function (options, callback, optionalCallbackParameter) {
var httpRequest = new XMLHttpRequest(), key;
// QT bug: apparently doesn't handle onload. Workaround using readyState.
httpRequest.onreadystatechange = function () {
@ -38,7 +39,7 @@ module.exports = {
if (error) {
response = { statusCode: httpRequest.status };
}
callback(error, response);
callback(error, response, optionalCallbackParameter);
}
};
if (typeof options === 'string') {

View file

@ -401,6 +401,14 @@ function openMarketplace(optionalItemOrUrl) {
ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL);
}
function setCertificateInfo(itemCertificateId) {
ui.tablet.sendToQml({
method: 'inspectionCertificate_setCertificateId',
entityId: "",
certificateId: itemCertificateId
});
}
// Function Name: fromQml()
//
// Description:
@ -506,10 +514,6 @@ function fromQml(message) {
ui.tablet.sendToQml({ method: 'updateWearables', wornWearables: currentlyWornWearables });
break;
case 'purchases_availableUpdatesReceived':
shouldShowDot = message.numUpdates > 0;
ui.messagesWaiting(shouldShowDot && !ui.isOpen);
break;
case 'purchases_walletNotSetUp':
ui.tablet.sendToQml({
method: 'updateWalletReferrer',
@ -525,6 +529,13 @@ function fromQml(message) {
openMarketplace(itemId);
}
break;
case 'purchases_itemCertificateClicked':
setCertificateInfo(message.itemCertificateId);
break;
case 'clearShouldShowDotHistory':
shouldShowDotHistory = false;
ui.messagesWaiting(shouldShowDotUpdates || shouldShowDotHistory);
break;
case 'http.request':
// Handled elsewhere, don't log.
break;
@ -541,8 +552,13 @@ function walletOpened() {
triggerMapping.enable();
triggerPressMapping.enable();
isWired = true;
shouldShowDot = false;
ui.messagesWaiting(shouldShowDot);
if (shouldShowDotHistory) {
ui.sendMessage({
method: 'updateRecentActivityMessageLight',
messagesWaiting: shouldShowDotHistory
});
}
}
function walletClosed() {
@ -557,20 +573,20 @@ function notificationDataProcessPageHistory(data) {
return data.data.history;
}
var shouldShowDot = false;
var shouldShowDotUpdates = false;
function notificationPollCallbackUpdates(updatesArray) {
shouldShowDot = shouldShowDot || updatesArray.length > 0;
ui.messagesWaiting(shouldShowDot && !ui.isOpen);
shouldShowDotUpdates = shouldShowDotUpdates || updatesArray.length > 0;
ui.messagesWaiting(shouldShowDotUpdates || shouldShowDotHistory);
if (updatesArray.length > 0) {
var message;
if (!ui.notificationInitialCallbackMade) {
if (!ui.notificationInitialCallbackMade[0]) {
message = updatesArray.length + " of your purchased items " +
(updatesArray.length === 1 ? "has an update " : "have updates ") +
"available. Open WALLET to update.";
ui.notificationDisplayBanner(message);
ui.notificationPollCaresAboutSince = true;
ui.notificationPollCaresAboutSince[0] = true;
} else {
for (var i = 0; i < updatesArray.length; i++) {
message = "Update available for \"" +
@ -581,15 +597,16 @@ function notificationPollCallbackUpdates(updatesArray) {
}
}
}
var shouldShowDotHistory = false;
function notificationPollCallbackHistory(historyArray) {
if (!ui.isOpen) {
var notificationCount = historyArray.length;
shouldShowDot = shouldShowDot || notificationCount > 0;
ui.messagesWaiting(shouldShowDot);
shouldShowDotHistory = shouldShowDotHistory || notificationCount > 0;
ui.messagesWaiting(shouldShowDotUpdates || shouldShowDotHistory);
if (notificationCount > 0) {
var message;
if (!ui.notificationInitialCallbackMade) {
if (!ui.notificationInitialCallbackMade[1]) {
message = "You have " + notificationCount + " unread wallet " +
"transaction" + (notificationCount === 1 ? "" : "s") + ". Open WALLET to see all activity.";
ui.notificationDisplayBanner(message);
@ -605,8 +622,8 @@ function notificationPollCallbackHistory(historyArray) {
}
function isReturnedDataEmptyUpdates(data) {
var historyArray = data.data.history;
return historyArray.length === 0;
var updatesArray = data.data.updates;
return updatesArray.length === 0;
}
function isReturnedDataEmptyHistory(data) {
@ -649,6 +666,22 @@ var WALLET_QML_SOURCE = "hifi/commerce/wallet/Wallet.qml";
var NOTIFICATION_POLL_TIMEOUT = 300000;
var ui;
function startup() {
var notificationPollEndpointArray = ["/api/v1/commerce/available_updates?per_page=10"];
var notificationPollTimeoutMsArray = [NOTIFICATION_POLL_TIMEOUT];
var notificationDataProcessPageArray = [notificationDataProcessPageUpdates];
var notificationPollCallbackArray = [notificationPollCallbackUpdates];
var notificationPollStopPaginatingConditionMetArray = [isReturnedDataEmptyUpdates];
var notificationPollCaresAboutSinceArray = [false];
if (!WalletScriptingInterface.limitedCommerce) {
notificationPollEndpointArray[1] = "/api/v1/commerce/history?per_page=10";
notificationPollTimeoutMsArray[1] = NOTIFICATION_POLL_TIMEOUT;
notificationDataProcessPageArray[1] = notificationDataProcessPageHistory;
notificationPollCallbackArray[1] = notificationPollCallbackHistory;
notificationPollStopPaginatingConditionMetArray[1] = isReturnedDataEmptyHistory;
notificationPollCaresAboutSinceArray[1] = true;
}
ui = new AppUi({
buttonName: BUTTON_NAME,
sortOrder: 10,
@ -656,20 +689,12 @@ function startup() {
onOpened: walletOpened,
onClosed: walletClosed,
onMessage: fromQml,
/* Gotta re-add all this stuff once I get it working
notificationPollEndpoint: ["/api/v1/commerce/available_updates?per_page=10", "/api/v1/commerce/history?per_page=10"],
notificationPollTimeoutMs: [NOTIFICATION_POLL_TIMEOUT, NOTIFICATION_POLL_TIMEOUT],
notificationDataProcessPage: [notificationDataProcessPageUpdates, notificationDataProcessPageHistory],
notificationPollCallback: [notificationPollCallbackUpdates, notificationPollCallbackHistory],
notificationPollStopPaginatingConditionMet: [isReturnedDataEmptyUpdates, isReturnedDataEmptyHistory],
notificationPollCaresAboutSince: [false, true]
*/
notificationPollEndpoint: "/api/v1/commerce/available_updates?per_page=10",
notificationPollTimeoutMs: 300000,
notificationDataProcessPage: notificationDataProcessPageUpdates,
notificationPollCallback: notificationPollCallbackUpdates,
notificationPollStopPaginatingConditionMet: isReturnedDataEmptyUpdates,
notificationPollCaresAboutSince: false
notificationPollEndpoint: notificationPollEndpointArray,
notificationPollTimeoutMs: notificationPollTimeoutMsArray,
notificationDataProcessPage: notificationDataProcessPageArray,
notificationPollCallback: notificationPollCallbackArray,
notificationPollStopPaginatingConditionMet: notificationPollStopPaginatingConditionMetArray,
notificationPollCaresAboutSince: notificationPollCaresAboutSinceArray
});
GlobalServices.myUsernameChanged.connect(onUsernameChanged);
installMarketplaceItemTester();
@ -683,6 +708,7 @@ function off() {
Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent);
triggerMapping.disable();
triggerPressMapping.disable();
isWired = false;
}
if (isUpdateOverlaysWired) {

View file

@ -251,7 +251,6 @@
}
cost = $(this).closest('.col-xs-3').find('.item-cost').text();
var costInt = parseInt(cost, 10);
var disable = limitedCommerce && (costInt > 0);
$(this).closest('.col-xs-3').prev().attr("class", 'col-xs-6');
$(this).closest('.col-xs-3').attr("class", 'col-xs-6');
@ -260,22 +259,17 @@
priceElement.css({
"padding": "3px 5px",
"height": "40px",
"background": disable ? "grey" : "linear-gradient(#00b4ef, #0093C5)",
"background": "linear-gradient(#00b4ef, #0093C5)",
"color": "#FFF",
"font-weight": "600",
"line-height": "34px"
});
if (parseInt(cost) > 0) {
if (disable) {
priceElement.html('N/A'); // In case the following fails
$(this).parent().parent().parent().parent().parent().css({"display": "none"}); // HRS FIXME, oh and do I have to set display non-none in the other branch?
} else {
priceElement.css({ "width": "auto" });
priceElement.html('<span class="hifi-glyph hifi-glyph-hfc" style="filter:invert(1);background-size:20px;' +
'width:20px;height:20px;position:relative;top:5px;"></span> ' + cost);
priceElement.css({ "min-width": priceElement.width() + 30 });
}
priceElement.css({ "width": "auto" });
priceElement.html('<span class="hifi-glyph hifi-glyph-hfc" style="filter:invert(1);background-size:20px;' +
'width:20px;height:20px;position:relative;top:5px;"></span> ' + cost);
priceElement.css({ "min-width": priceElement.width() + 30 });
}
});

View file

@ -844,7 +844,7 @@ function notificationPollCallback(connectionsArray) {
newOnlineUsers++;
storedOnlineUsers[user.username] = user;
if (!ui.isOpen && ui.notificationInitialCallbackMade) {
if (!ui.isOpen && ui.notificationInitialCallbackMade[0]) {
message = user.username + " is available in " +
user.location.root.name + ". Open PEOPLE to join them.";
ui.notificationDisplayBanner(message);
@ -868,7 +868,7 @@ function notificationPollCallback(connectionsArray) {
shouldShowDot: shouldShowDot
});
if (newOnlineUsers > 0 && !ui.notificationInitialCallbackMade) {
if (newOnlineUsers > 0 && !ui.notificationInitialCallbackMade[0]) {
message = newOnlineUsers + " of your connections " +
(newOnlineUsers === 1 ? "is" : "are") + " available online. Open PEOPLE to join them.";
ui.notificationDisplayBanner(message);
@ -889,12 +889,12 @@ function startup() {
onOpened: palOpened,
onClosed: off,
onMessage: fromQml,
notificationPollEndpoint: "/api/v1/users?filter=connections&status=online&per_page=10",
notificationPollTimeoutMs: 60000,
notificationDataProcessPage: notificationDataProcessPage,
notificationPollCallback: notificationPollCallback,
notificationPollStopPaginatingConditionMet: isReturnedDataEmpty,
notificationPollCaresAboutSince: false
notificationPollEndpoint: ["/api/v1/users?filter=connections&status=online&per_page=10"],
notificationPollTimeoutMs: [60000],
notificationDataProcessPage: [notificationDataProcessPage],
notificationPollCallback: [notificationPollCallback],
notificationPollStopPaginatingConditionMet: [isReturnedDataEmpty],
notificationPollCaresAboutSince: [false]
});
Window.domainChanged.connect(clearLocalQMLDataAndClosePAL);
Window.domainConnectionRefused.connect(clearLocalQMLDataAndClosePAL);

View file

@ -37,7 +37,7 @@ function notificationPollCallback(userStoriesArray) {
//
pingPong = !pingPong;
var totalNewStories = 0;
var shouldNotifyIndividually = !ui.isOpen && ui.notificationInitialCallbackMade;
var shouldNotifyIndividually = !ui.isOpen && ui.notificationInitialCallbackMade[0];
userStoriesArray.forEach(function (story) {
if (story.audience !== "for_connections" &&
story.audience !== "for_feed") {
@ -91,7 +91,7 @@ function notificationPollCallback(userStoriesArray) {
shouldShowDot = totalNewStories > 0 || (totalStories > 0 && shouldShowDot);
ui.messagesWaiting(shouldShowDot && !ui.isOpen);
if (totalStories > 0 && !ui.isOpen && !ui.notificationInitialCallbackMade) {
if (totalStories > 0 && !ui.isOpen && !ui.notificationInitialCallbackMade[0]) {
message = "There " + (totalStories === 1 ? "is " : "are ") + totalStories + " event" +
(totalStories === 1 ? "" : "s") + " to know about. " +
"Open GOTO to see " + (totalStories === 1 ? "it" : "them") + ".";
@ -122,12 +122,12 @@ function startup() {
sortOrder: 8,
onOpened: gotoOpened,
home: GOTO_QML_SOURCE,
notificationPollEndpoint: endpoint,
notificationPollTimeoutMs: 60000,
notificationDataProcessPage: notificationDataProcessPage,
notificationPollCallback: notificationPollCallback,
notificationPollStopPaginatingConditionMet: isReturnedDataEmpty,
notificationPollCaresAboutSince: false
notificationPollEndpoint: [endpoint],
notificationPollTimeoutMs: [60000],
notificationDataProcessPage: [notificationDataProcessPage],
notificationPollCallback: [notificationPollCallback],
notificationPollStopPaginatingConditionMet: [isReturnedDataEmpty],
notificationPollCaresAboutSince: [false]
});
}