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 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

@ -355,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);
}
@ -630,7 +626,6 @@ Rectangle {
hoverEnabled: enabled;
onClicked: {
root.activeView = "walletInventory";
walletInventory.isShowingMyItems = false;
tabButtonsContainer.resetTabButtonColors();
}
onEntered: parent.color = hifi.colors.blueHighlight;
@ -961,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

@ -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,12 +141,12 @@ 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
@ -157,22 +159,20 @@ function AppUi(properties) {
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);
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout(
that.notificationPoll(indexOfRequest), that.notificationPollTimeoutMs[indexOfRequest]);
startNotificationTimer(indexOfRequest);
return;
}
if (!that.notificationPollStopPaginatingConditionMet[indexOfRequest] ||
that.notificationPollStopPaginatingConditionMet[indexOfRequest](response)) {
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout(function () {
that.notificationPoll(indexOfRequest);
}, that.notificationPollTimeoutMs[indexOfRequest]);
startNotificationTimer(indexOfRequest);
var notificationData;
if (concatenatedServerResponse[indexOfRequest].length) {
@ -181,7 +181,8 @@ function AppUi(properties) {
notificationData = that.notificationDataProcessPage[indexOfRequest](response);
}
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.notificationInitialCallbackMade[indexOfRequest] = true;
currentDataPageToRetrieve[indexOfRequest] = 1;
@ -199,15 +200,19 @@ function AppUi(properties) {
var METAVERSE_BASE = Account.metaverseServerURL;
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[i] = Script.setTimeout(
that.notificationPoll(i), that.notificationPollTimeoutMs[i]);
// 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;
}
@ -217,7 +222,7 @@ function AppUi(properties) {
var currentTimestamp = new Date().getTime();
var lastPollTimestamp = Settings.getValue(settingsKey, currentTimestamp);
if (that.notificationPollCaresAboutSince[i]) {
url = url + "&since=" + lastPollTimestamp / 1000;
url = url + "&since=" + lastPollTimestamp / MS_IN_SEC;
}
Settings.setValue(settingsKey, currentTimestamp);
@ -239,6 +244,12 @@ function AppUi(properties) {
that.notificationPoll(i);
}
function startNotificationTimer(indexOfRequest) {
that.notificationPollTimeout[indexOfRequest] = Script.setTimeout(function () {
that.notificationPoll(indexOfRequest);
}, that.notificationPollTimeoutMs[indexOfRequest]);
}
function restartNotificationPoll() {
for (var j = 0; j < that.notificationPollEndpoint.length; j++) {
that.notificationInitialCallbackMade[j] = false;

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:
@ -521,6 +529,9 @@ function fromQml(message) {
openMarketplace(itemId);
}
break;
case 'purchases_itemCertificateClicked':
setCertificateInfo(message.itemCertificateId);
break;
case 'clearShouldShowDotHistory':
shouldShowDotHistory = false;
ui.messagesWaiting(shouldShowDotUpdates || shouldShowDotHistory);
@ -698,6 +709,7 @@ function off() {
Controller.mouseMoveEvent.disconnect(handleMouseMoveEvent);
triggerMapping.disable();
triggerPressMapping.disable();
isWired = false;
}
if (isUpdateOverlaysWired) {