Fix four bugs; truncate some logs

This commit is contained in:
Zach Fox 2018-11-01 10:29:38 -07:00
parent 34fb849536
commit d481f081bb
5 changed files with 40 additions and 46 deletions

View file

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

View file

@ -355,10 +355,6 @@ Rectangle {
if (msg.method === 'transactionHistory_usernameLinkClicked') { if (msg.method === 'transactionHistory_usernameLinkClicked') {
userInfoViewer.url = msg.usernameLink; userInfoViewer.url = msg.usernameLink;
userInfoViewer.visible = true; userInfoViewer.visible = true;
} else if (msg.method === 'goToPurchases_fromWalletHome') {
root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors();
} else { } else {
sendToScript(msg); sendToScript(msg);
} }
@ -630,7 +626,6 @@ Rectangle {
hoverEnabled: enabled; hoverEnabled: enabled;
onClicked: { onClicked: {
root.activeView = "walletInventory"; root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors(); tabButtonsContainer.resetTabButtonColors();
} }
onEntered: parent.color = hifi.colors.blueHighlight; onEntered: parent.color = hifi.colors.blueHighlight;
@ -961,7 +956,6 @@ Rectangle {
Commerce.getWalletStatus(); Commerce.getWalletStatus();
} else if (msg.referrer === 'purchases') { } else if (msg.referrer === 'purchases') {
root.activeView = "walletInventory"; root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors(); tabButtonsContainer.resetTabButtonColors();
} else if (msg.referrer === 'marketplace cta' || msg.referrer === 'mainPage') { } else if (msg.referrer === 'marketplace cta' || msg.referrer === 'mainPage') {
sendToScript({method: 'goToMarketplaceMainPage', itemId: msg.referrer}); sendToScript({method: 'goToMarketplaceMainPage', itemId: msg.referrer});

View file

@ -179,28 +179,6 @@ Item {
color: hifi.colors.baseGrayHighlight; 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 { HifiModels.PSFListModel {
id: transactionHistoryModel; id: transactionHistoryModel;
property int lastPendingCount: 0; property int lastPendingCount: 0;

View file

@ -129,7 +129,9 @@ function AppUi(properties) {
} }
that.isOpen = true; 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); that.wireEventBridge(false);
if (that.isOpen) { if (that.isOpen) {
that.buttonActive(false); that.buttonActive(false);
@ -139,12 +141,12 @@ function AppUi(properties) {
that.isOpen = false; 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: // 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 // START Notification Handling
@ -157,22 +159,20 @@ function AppUi(properties) {
concatenatedServerResponse[i] = new Array(); concatenatedServerResponse[i] = new Array();
} }
var MAX_LOG_LENGTH_CHARACTERS = 300;
function requestCallback(error, response, optionalParams) { function requestCallback(error, response, optionalParams) {
var indexOfRequest = optionalParams.indexOfRequest; var indexOfRequest = optionalParams.indexOfRequest;
var urlOfRequest = optionalParams.urlOfRequest; var urlOfRequest = optionalParams.urlOfRequest;
if (error || (response.status !== 'success')) { if (error || (response.status !== 'success')) {
print("Error: unable to get", urlOfRequest, error || response.status); print("Error: unable to get", urlOfRequest, error || response.status);
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout( startNotificationTimer(indexOfRequest);
that.notificationPoll(indexOfRequest), that.notificationPollTimeoutMs[indexOfRequest]);
return; return;
} }
if (!that.notificationPollStopPaginatingConditionMet[indexOfRequest] || if (!that.notificationPollStopPaginatingConditionMet[indexOfRequest] ||
that.notificationPollStopPaginatingConditionMet[indexOfRequest](response)) { that.notificationPollStopPaginatingConditionMet[indexOfRequest](response)) {
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout(function () { startNotificationTimer(indexOfRequest);
that.notificationPoll(indexOfRequest);
}, that.notificationPollTimeoutMs[indexOfRequest]);
var notificationData; var notificationData;
if (concatenatedServerResponse[indexOfRequest].length) { if (concatenatedServerResponse[indexOfRequest].length) {
@ -181,7 +181,8 @@ function AppUi(properties) {
notificationData = that.notificationDataProcessPage[indexOfRequest](response); notificationData = that.notificationDataProcessPage[indexOfRequest](response);
} }
console.debug(that.buttonName, that.notificationPollEndpoint[indexOfRequest], console.debug(that.buttonName, that.notificationPollEndpoint[indexOfRequest],
'notification data for processing:', JSON.stringify(notificationData)); 'truncated notification data for processing:',
JSON.stringify(notificationData).substring(0, MAX_LOG_LENGTH_CHARACTERS));
that.notificationPollCallback[indexOfRequest](notificationData); that.notificationPollCallback[indexOfRequest](notificationData);
that.notificationInitialCallbackMade[indexOfRequest] = true; that.notificationInitialCallbackMade[indexOfRequest] = true;
currentDataPageToRetrieve[indexOfRequest] = 1; currentDataPageToRetrieve[indexOfRequest] = 1;
@ -199,15 +200,19 @@ function AppUi(properties) {
var METAVERSE_BASE = Account.metaverseServerURL; var METAVERSE_BASE = Account.metaverseServerURL;
var MS_IN_SEC = 1000;
that.notificationPoll = function (i) { that.notificationPoll = function (i) {
if (!that.notificationPollEndpoint[i]) { if (!that.notificationPollEndpoint[i]) {
return; return;
} }
// User is "appearing offline" or is offline // User is "appearing offline" or is not logged in
if (GlobalServices.findableBy === "none" || Account.username === "") { if (GlobalServices.findableBy === "none" || Account.username === "Unknown user") {
that.notificationPollTimeout[i] = Script.setTimeout( // The notification polling will restart when the user changes their availability
that.notificationPoll(i), that.notificationPollTimeoutMs[i]); // 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; return;
} }
@ -217,7 +222,7 @@ function AppUi(properties) {
var currentTimestamp = new Date().getTime(); var currentTimestamp = new Date().getTime();
var lastPollTimestamp = Settings.getValue(settingsKey, currentTimestamp); var lastPollTimestamp = Settings.getValue(settingsKey, currentTimestamp);
if (that.notificationPollCaresAboutSince[i]) { if (that.notificationPollCaresAboutSince[i]) {
url = url + "&since=" + lastPollTimestamp / 1000; url = url + "&since=" + lastPollTimestamp / MS_IN_SEC;
} }
Settings.setValue(settingsKey, currentTimestamp); Settings.setValue(settingsKey, currentTimestamp);
@ -239,6 +244,12 @@ function AppUi(properties) {
that.notificationPoll(i); that.notificationPoll(i);
} }
function startNotificationTimer(indexOfRequest) {
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout(function () {
that.notificationPoll(indexOfRequest);
}, that.notificationPollTimeoutMs[indexOfRequest]);
}
function restartNotificationPoll() { function restartNotificationPoll() {
for (var j = 0; j < that.notificationPollEndpoint.length; j++) { for (var j = 0; j < that.notificationPollEndpoint.length; j++) {
that.notificationInitialCallbackMade[j] = false; that.notificationInitialCallbackMade[j] = false;

View file

@ -401,6 +401,14 @@ function openMarketplace(optionalItemOrUrl) {
ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL); ui.open(url, MARKETPLACES_INJECT_SCRIPT_URL);
} }
function setCertificateInfo(itemCertificateId) {
ui.tablet.sendToQml({
method: 'inspectionCertificate_setCertificateId',
entityId: "",
certificateId: itemCertificateId
});
}
// Function Name: fromQml() // Function Name: fromQml()
// //
// Description: // Description:
@ -521,6 +529,9 @@ function fromQml(message) {
openMarketplace(itemId); openMarketplace(itemId);
} }
break; break;
case 'purchases_itemCertificateClicked':
setCertificateInfo(message.itemCertificateId);
break;
case 'clearShouldShowDotHistory': case 'clearShouldShowDotHistory':
shouldShowDotHistory = false; shouldShowDotHistory = false;
ui.messagesWaiting(shouldShowDotUpdates || shouldShowDotHistory); ui.messagesWaiting(shouldShowDotUpdates || shouldShowDotHistory);
@ -698,6 +709,7 @@ function off() {
Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent); Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent);
triggerMapping.disable(); triggerMapping.disable();
triggerPressMapping.disable(); triggerPressMapping.disable();
isWired = false;
} }
if (isUpdateOverlaysWired) { if (isUpdateOverlaysWired) {