Merge pull request #11651 from zfox23/commerce_ChangeTimerForDemo

Auto-refresh Wallet Home & Purchases on 4s timer
This commit is contained in:
Zach Fox 2017-10-23 12:40:08 -07:00 committed by GitHub
commit f90060afab
2 changed files with 19 additions and 1 deletions

View file

@ -583,9 +583,11 @@ Rectangle {
Timer { Timer {
id: inventoryTimer; id: inventoryTimer;
interval: 90000; interval: 4000; // Change this back to 90000 after demo
//interval: 90000;
onTriggered: { onTriggered: {
if (root.activeView === "purchasesMain" && !root.pendingInventoryReply) { if (root.activeView === "purchasesMain" && !root.pendingInventoryReply) {
console.log("Refreshing Purchases...");
root.pendingInventoryReply = true; root.pendingInventoryReply = true;
commerce.inventory(); commerce.inventory();
} }
@ -661,6 +663,8 @@ Rectangle {
currentPurchasesModelStatus !== previousPurchasesModelStatus) { currentPurchasesModelStatus !== previousPurchasesModelStatus) {
purchasesModel.setProperty(i, "statusChanged", true); purchasesModel.setProperty(i, "statusChanged", true);
} else {
purchasesModel.setProperty(i, "statusChanged", false);
} }
} }
} }

View file

@ -43,6 +43,7 @@ Item {
calculatePendingAndInvalidated(); calculatePendingAndInvalidated();
} }
refreshTimer.start();
} }
} }
@ -117,6 +118,8 @@ Item {
historyReceived = false; historyReceived = false;
commerce.balance(); commerce.balance();
commerce.history(); commerce.history();
} else {
refreshTimer.stop();
} }
} }
} }
@ -138,6 +141,17 @@ Item {
} }
} }
Timer {
id: refreshTimer;
interval: 4000; // Remove this after demo?
onTriggered: {
console.log("Refreshing Wallet Home...");
historyReceived = false;
commerce.balance();
commerce.history();
}
}
// Recent Activity // Recent Activity
Rectangle { Rectangle {
id: recentActivityContainer; id: recentActivityContainer;