mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 23:36:41 +02:00
Almost working for Purchases!
This commit is contained in:
parent
0021af8714
commit
97bb014734
3 changed files with 106 additions and 160 deletions
|
@ -16,6 +16,7 @@ import QtQuick 2.5
|
||||||
import "../../../styles-uit"
|
import "../../../styles-uit"
|
||||||
import "../../../controls-uit" as HifiControlsUit
|
import "../../../controls-uit" as HifiControlsUit
|
||||||
import "../../../controls" as HifiControls
|
import "../../../controls" as HifiControls
|
||||||
|
import "../../models" as HifiModels
|
||||||
import "../wallet" as HifiWallet
|
import "../wallet" as HifiWallet
|
||||||
import "../common" as HifiCommerceCommon
|
import "../common" as HifiCommerceCommon
|
||||||
import "../inspectionCertificate" as HifiInspectionCertificate
|
import "../inspectionCertificate" as HifiInspectionCertificate
|
||||||
|
@ -34,7 +35,6 @@ Rectangle {
|
||||||
property bool punctuationMode: false;
|
property bool punctuationMode: false;
|
||||||
property bool isShowingMyItems: false;
|
property bool isShowingMyItems: false;
|
||||||
property bool isDebuggingFirstUseTutorial: false;
|
property bool isDebuggingFirstUseTutorial: false;
|
||||||
property int pendingItemCount: 0;
|
|
||||||
property string installedApps;
|
property string installedApps;
|
||||||
property bool keyboardRaised: false;
|
property bool keyboardRaised: false;
|
||||||
property int numUpdatesAvailable: 0;
|
property int numUpdatesAvailable: 0;
|
||||||
|
@ -64,7 +64,10 @@ Rectangle {
|
||||||
} else if (!Settings.getValue("isFirstUseOfPurchases", true) && root.activeView === "initialize") {
|
} else if (!Settings.getValue("isFirstUseOfPurchases", true) && root.activeView === "initialize") {
|
||||||
root.activeView = "purchasesMain";
|
root.activeView = "purchasesMain";
|
||||||
root.installedApps = Commerce.getInstalledApps();
|
root.installedApps = Commerce.getInstalledApps();
|
||||||
Commerce.inventory();
|
purchasesModel.initialResultReceived = false;
|
||||||
|
purchasesModel.currentPageToRetrieve = 1;
|
||||||
|
purchasesModel.noMoreDataToRetrieve = false;
|
||||||
|
purchasesModel.getPage();
|
||||||
Commerce.getAvailableUpdates();
|
Commerce.getAvailableUpdates();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,39 +84,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onInventoryResult: {
|
onInventoryResult: {
|
||||||
purchasesReceived = true;
|
purchasesModel.pageRetrieved(result);
|
||||||
|
|
||||||
if (result.status !== 'success') {
|
|
||||||
console.log("Failed to get purchases", result.message);
|
|
||||||
} else if (!purchasesContentsList.dragging) { // Don't modify the view if the user's scrolling
|
|
||||||
var inventoryResult = processInventoryResult(result.data.assets);
|
|
||||||
|
|
||||||
var currentIndex = purchasesContentsList.currentIndex === -1 ? 0 : purchasesContentsList.currentIndex;
|
|
||||||
purchasesModel.clear();
|
|
||||||
purchasesModel.append(inventoryResult);
|
|
||||||
|
|
||||||
root.pendingItemCount = 0;
|
|
||||||
for (var i = 0; i < purchasesModel.count; i++) {
|
|
||||||
if (purchasesModel.get(i).status === "pending") {
|
|
||||||
root.pendingItemCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previousPurchasesModel.count !== 0) {
|
|
||||||
checkIfAnyItemStatusChanged();
|
|
||||||
} else {
|
|
||||||
// Fill statusChanged default value
|
|
||||||
// Not doing this results in the default being true...
|
|
||||||
for (var i = 0; i < purchasesModel.count; i++) {
|
|
||||||
purchasesModel.setProperty(i, "statusChanged", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
previousPurchasesModel.append(inventoryResult);
|
|
||||||
|
|
||||||
buildFilteredPurchasesModel();
|
|
||||||
|
|
||||||
purchasesContentsList.positionViewAtIndex(currentIndex, ListView.Beginning);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAvailableUpdatesResult: {
|
onAvailableUpdatesResult: {
|
||||||
|
@ -134,6 +105,11 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onIsShowingMyItemsChanged: {
|
||||||
|
purchasesModel.resetModel();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: notSetUpTimer;
|
id: notSetUpTimer;
|
||||||
interval: 200;
|
interval: 200;
|
||||||
|
@ -184,7 +160,10 @@ Rectangle {
|
||||||
onSendSignalToParent: {
|
onSendSignalToParent: {
|
||||||
if (msg.method === 'sendAssetHome_back' || msg.method === 'closeSendAsset') {
|
if (msg.method === 'sendAssetHome_back' || msg.method === 'closeSendAsset') {
|
||||||
root.activeView = "purchasesMain";
|
root.activeView = "purchasesMain";
|
||||||
Commerce.inventory();
|
purchasesModel.initialResultReceived = false;
|
||||||
|
purchasesModel.currentPageToRetrieve = 1;
|
||||||
|
purchasesModel.noMoreDataToRetrieve = false;
|
||||||
|
purchasesModel.getPage();
|
||||||
Commerce.getAvailableUpdates();
|
Commerce.getAvailableUpdates();
|
||||||
} else {
|
} else {
|
||||||
sendToScript(msg);
|
sendToScript(msg);
|
||||||
|
@ -451,7 +430,10 @@ Rectangle {
|
||||||
Settings.setValue("isFirstUseOfPurchases", false);
|
Settings.setValue("isFirstUseOfPurchases", false);
|
||||||
root.activeView = "purchasesMain";
|
root.activeView = "purchasesMain";
|
||||||
root.installedApps = Commerce.getInstalledApps();
|
root.installedApps = Commerce.getInstalledApps();
|
||||||
Commerce.inventory();
|
purchasesModel.initialResultReceived = false;
|
||||||
|
purchasesModel.currentPageToRetrieve = 1;
|
||||||
|
purchasesModel.noMoreDataToRetrieve = false;
|
||||||
|
purchasesModel.getPage();
|
||||||
Commerce.getAvailableUpdates();
|
Commerce.getAvailableUpdates();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -548,14 +530,12 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPrimaryFilter_displayNameChanged: {
|
onPrimaryFilter_displayNameChanged: {
|
||||||
buildFilteredPurchasesModel();
|
purchasesModel.tagsFilter = filterBar.primaryFilter_filterName.toLowerCase();
|
||||||
purchasesContentsList.positionViewAtIndex(0, ListView.Beginning)
|
|
||||||
filterBar.previousPrimaryFilter = filterBar.primaryFilter_displayName;
|
filterBar.previousPrimaryFilter = filterBar.primaryFilter_displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
buildFilteredPurchasesModel();
|
purchasesModel.searchFilter = filterBar.text;
|
||||||
purchasesContentsList.positionViewAtIndex(0, ListView.Beginning)
|
|
||||||
filterBar.previousText = filterBar.text;
|
filterBar.previousText = filterBar.text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -574,24 +554,58 @@ Rectangle {
|
||||||
anchors.topMargin: 16;
|
anchors.topMargin: 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
ListModel {
|
HifiModels.PSFListModel {
|
||||||
id: purchasesModel;
|
id: purchasesModel;
|
||||||
}
|
|
||||||
ListModel {
|
itemsPerPage: 3;
|
||||||
id: previousPurchasesModel;
|
getPage: function() {
|
||||||
}
|
Commerce.inventory(
|
||||||
HifiCommerceCommon.SortableListModel {
|
root.isShowingMyItems ? "proofs" : "purchased",
|
||||||
id: tempPurchasesModel;
|
filterBar.primaryFilter_filterName.toLowerCase(),
|
||||||
}
|
purchasesModel.currentPageToRetrieve,
|
||||||
HifiCommerceCommon.SortableListModel {
|
purchasesModel.itemsPerPage
|
||||||
id: filteredPurchasesModel;
|
);
|
||||||
|
}
|
||||||
|
pageRetrieved: function(result) {
|
||||||
|
purchasesReceived = true;
|
||||||
|
|
||||||
|
var processedInventory = processInventoryResult(result.data.assets);
|
||||||
|
|
||||||
|
if (purchasesModel.processResult(result.status, processedInventory)) {
|
||||||
|
var currentId;
|
||||||
|
for (var i = 0; i < purchasesModel.count; i++) {
|
||||||
|
currentId = purchasesModel.get(i).id;
|
||||||
|
purchasesModel.setProperty(i, 'cardBackVisible', false);
|
||||||
|
purchasesModel.setProperty(i, 'isInstalled', ((root.installedApps).indexOf(currentId) > -1));
|
||||||
|
purchasesModel.setProperty(i, 'wornEntityID', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Client-side filter of "Updatable" items
|
||||||
|
// FIXME - this MUST be serverside (what if we don't have the
|
||||||
|
// page containing an updatable item on the client?)
|
||||||
|
if (filterBar.primaryFilter_displayName === "Updatable") {
|
||||||
|
for (var i = 0; i < purchasesModel.count; i++) {
|
||||||
|
if (purchasesModel.get(i).upgrade_url === "") {
|
||||||
|
purchasesModel.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sendToScript({ method: 'purchases_updateWearables' });
|
||||||
|
// FIXME: This ALSO *MUST* be serverside (what if we don't have
|
||||||
|
// all instances of the item on the client yet?)
|
||||||
|
//populateDisplayedItemCounts();
|
||||||
|
sortByDate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: purchasesContentsList;
|
id: purchasesContentsList;
|
||||||
visible: (root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0);
|
visible: purchasesModel.count !== 0;
|
||||||
clip: true;
|
clip: true;
|
||||||
model: filteredPurchasesModel;
|
model: purchasesModel.model;
|
||||||
snapMode: ListView.SnapToItem;
|
snapMode: ListView.SnapToItem;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: separator.bottom;
|
anchors.top: separator.bottom;
|
||||||
|
@ -608,9 +622,9 @@ Rectangle {
|
||||||
itemEdition: model.edition_number;
|
itemEdition: model.edition_number;
|
||||||
numberSold: model.number_sold;
|
numberSold: model.number_sold;
|
||||||
limitedRun: model.limited_run;
|
limitedRun: model.limited_run;
|
||||||
displayedItemCount: model.displayedItemCount;
|
displayedItemCount: model.displayedItemCount || 0;
|
||||||
cardBackVisible: model.cardBackVisible;
|
cardBackVisible: model.cardBackVisible || false;
|
||||||
isInstalled: model.isInstalled;
|
isInstalled: model.isInstalled || false;
|
||||||
wornEntityID: model.wornEntityID;
|
wornEntityID: model.wornEntityID;
|
||||||
upgradeUrl: model.upgrade_url;
|
upgradeUrl: model.upgrade_url;
|
||||||
upgradeTitle: model.upgrade_title;
|
upgradeTitle: model.upgrade_title;
|
||||||
|
@ -706,11 +720,11 @@ Rectangle {
|
||||||
} else if (msg.method === "setFilterText") {
|
} else if (msg.method === "setFilterText") {
|
||||||
filterBar.text = msg.filterText;
|
filterBar.text = msg.filterText;
|
||||||
} else if (msg.method === "flipCard") {
|
} else if (msg.method === "flipCard") {
|
||||||
for (var i = 0; i < filteredPurchasesModel.count; i++) {
|
for (var i = 0; i < purchasesModel.count; i++) {
|
||||||
if (i !== index || msg.closeAll) {
|
if (i !== index || msg.closeAll) {
|
||||||
filteredPurchasesModel.setProperty(i, "cardBackVisible", false);
|
purchasesModel.setProperty(i, "cardBackVisible", false);
|
||||||
} else {
|
} else {
|
||||||
filteredPurchasesModel.setProperty(i, "cardBackVisible", true);
|
purchasesModel.setProperty(i, "cardBackVisible", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (msg.method === "updateItemClicked") {
|
} else if (msg.method === "updateItemClicked") {
|
||||||
|
@ -761,7 +775,7 @@ Rectangle {
|
||||||
lightboxPopup.button2text = "CONFIRM";
|
lightboxPopup.button2text = "CONFIRM";
|
||||||
lightboxPopup.button2method = function() {
|
lightboxPopup.button2method = function() {
|
||||||
Entities.deleteEntity(msg.wornEntityID);
|
Entities.deleteEntity(msg.wornEntityID);
|
||||||
filteredPurchasesModel.setProperty(index, 'wornEntityID', '');
|
purchasesModel.setProperty(index, 'wornEntityID', '');
|
||||||
root.activeView = "giftAsset";
|
root.activeView = "giftAsset";
|
||||||
lightboxPopup.visible = false;
|
lightboxPopup.visible = false;
|
||||||
};
|
};
|
||||||
|
@ -773,6 +787,14 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onAtYEndChanged: {
|
||||||
|
if (purchasesContentsList.atYEnd) {
|
||||||
|
console.log("User scrolled to the bottom of 'Purchases'.");
|
||||||
|
purchasesModel.getNextPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -968,8 +990,8 @@ Rectangle {
|
||||||
function populateDisplayedItemCounts() {
|
function populateDisplayedItemCounts() {
|
||||||
var itemCountDictionary = {};
|
var itemCountDictionary = {};
|
||||||
var currentItemId;
|
var currentItemId;
|
||||||
for (var i = 0; i < filteredPurchasesModel.count; i++) {
|
for (var i = 0; i < purchasesModel.count; i++) {
|
||||||
currentItemId = filteredPurchasesModel.get(i).id;
|
currentItemId = purchasesModel.get(i).id;
|
||||||
if (itemCountDictionary[currentItemId] === undefined) {
|
if (itemCountDictionary[currentItemId] === undefined) {
|
||||||
itemCountDictionary[currentItemId] = 1;
|
itemCountDictionary[currentItemId] = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -977,109 +999,25 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < filteredPurchasesModel.count; i++) {
|
for (var i = 0; i < purchasesModel.count; i++) {
|
||||||
filteredPurchasesModel.setProperty(i, "displayedItemCount", itemCountDictionary[filteredPurchasesModel.get(i).id]);
|
purchasesModel.setProperty(i, "displayedItemCount", itemCountDictionary[purchasesModel.get(i).id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortByDate() {
|
function sortByDate() {
|
||||||
filteredPurchasesModel.sortColumnName = "purchase_date";
|
purchasesModel.sortColumnName = "purchase_date";
|
||||||
filteredPurchasesModel.isSortingDescending = true;
|
purchasesModel.isSortingDescending = true;
|
||||||
filteredPurchasesModel.valuesAreNumerical = true;
|
purchasesModel.valuesAreNumerical = true;
|
||||||
filteredPurchasesModel.quickSort();
|
purchasesModel.quickSort();
|
||||||
}
|
|
||||||
|
|
||||||
function buildFilteredPurchasesModel() {
|
|
||||||
var sameItemCount = 0;
|
|
||||||
|
|
||||||
tempPurchasesModel.clear();
|
|
||||||
|
|
||||||
for (var i = 0; i < purchasesModel.count; i++) {
|
|
||||||
if (purchasesModel.get(i).title.toLowerCase().indexOf(filterBar.text.toLowerCase()) !== -1) {
|
|
||||||
if (purchasesModel.get(i).status !== "confirmed" && !root.isShowingMyItems &&
|
|
||||||
purchasesModel.get(i).edition_number !== "0") {
|
|
||||||
tempPurchasesModel.insert(0, purchasesModel.get(i));
|
|
||||||
} else if ((root.isShowingMyItems && purchasesModel.get(i).edition_number === "0") ||
|
|
||||||
(!root.isShowingMyItems && purchasesModel.get(i).edition_number !== "0")) {
|
|
||||||
tempPurchasesModel.append(purchasesModel.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// primaryFilter filtering and adding of itemType property to model
|
|
||||||
var currentItemType, currentRootFileUrl, currentCategories;
|
|
||||||
for (var i = 0; i < tempPurchasesModel.count; i++) {
|
|
||||||
currentRootFileUrl = tempPurchasesModel.get(i).root_file_url;
|
|
||||||
currentCategories = tempPurchasesModel.get(i).categories;
|
|
||||||
currentItemType = tempPurchasesModel.get(i).item_type;
|
|
||||||
|
|
||||||
if (filterBar.primaryFilter_displayName !== "" &&
|
|
||||||
((filterBar.primaryFilter_displayName === "Updatable" && tempPurchasesModel.get(i).upgrade_url === "") ||
|
|
||||||
(filterBar.primaryFilter_displayName !== "Updatable" && filterBar.primaryFilter_filterName.toLowerCase() !== currentItemType.toLowerCase()))) {
|
|
||||||
tempPurchasesModel.remove(i);
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < tempPurchasesModel.count; i++) {
|
|
||||||
if (!filteredPurchasesModel.get(i)) {
|
|
||||||
sameItemCount = -1;
|
|
||||||
break;
|
|
||||||
} else if (tempPurchasesModel.get(i).itemId === filteredPurchasesModel.get(i).itemId &&
|
|
||||||
tempPurchasesModel.get(i).edition_number === filteredPurchasesModel.get(i).edition_number &&
|
|
||||||
tempPurchasesModel.get(i).status === filteredPurchasesModel.get(i).status) {
|
|
||||||
sameItemCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sameItemCount !== tempPurchasesModel.count ||
|
|
||||||
filterBar.text !== filterBar.previousText ||
|
|
||||||
filterBar.primaryFilter !== filterBar.previousPrimaryFilter) {
|
|
||||||
filteredPurchasesModel.clear();
|
|
||||||
var currentId;
|
|
||||||
for (var i = 0; i < tempPurchasesModel.count; i++) {
|
|
||||||
currentId = tempPurchasesModel.get(i).id;
|
|
||||||
filteredPurchasesModel.append(tempPurchasesModel.get(i));
|
|
||||||
filteredPurchasesModel.setProperty(i, 'cardBackVisible', false);
|
|
||||||
filteredPurchasesModel.setProperty(i, 'isInstalled', ((root.installedApps).indexOf(currentId) > -1));
|
|
||||||
filteredPurchasesModel.setProperty(i, 'wornEntityID', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
sendToScript({ method: 'purchases_updateWearables' });
|
|
||||||
populateDisplayedItemCounts();
|
|
||||||
sortByDate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkIfAnyItemStatusChanged() {
|
|
||||||
var currentPurchasesModelId, currentPurchasesModelEdition, currentPurchasesModelStatus;
|
|
||||||
var previousPurchasesModelStatus;
|
|
||||||
for (var i = 0; i < purchasesModel.count; i++) {
|
|
||||||
currentPurchasesModelId = purchasesModel.get(i).id;
|
|
||||||
currentPurchasesModelEdition = purchasesModel.get(i).edition_number;
|
|
||||||
currentPurchasesModelStatus = purchasesModel.get(i).status;
|
|
||||||
|
|
||||||
for (var j = 0; j < previousPurchasesModel.count; j++) {
|
|
||||||
previousPurchasesModelStatus = previousPurchasesModel.get(j).status;
|
|
||||||
if (currentPurchasesModelId === previousPurchasesModel.get(j).id &&
|
|
||||||
currentPurchasesModelEdition === previousPurchasesModel.get(j).edition_number &&
|
|
||||||
currentPurchasesModelStatus !== previousPurchasesModelStatus) {
|
|
||||||
|
|
||||||
purchasesModel.setProperty(i, "statusChanged", true);
|
|
||||||
} else {
|
|
||||||
purchasesModel.setProperty(i, "statusChanged", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCurrentlyWornWearables(wearables) {
|
function updateCurrentlyWornWearables(wearables) {
|
||||||
for (var i = 0; i < filteredPurchasesModel.count; i++) {
|
for (var i = 0; i < purchasesModel.count; i++) {
|
||||||
for (var j = 0; j < wearables.length; j++) {
|
for (var j = 0; j < wearables.length; j++) {
|
||||||
if (filteredPurchasesModel.get(i).itemType === "wearable" &&
|
if (purchasesModel.get(i).itemType === "wearable" &&
|
||||||
wearables[j].entityCertID === filteredPurchasesModel.get(i).certificate_id &&
|
wearables[j].entityCertID === purchasesModel.get(i).certificate_id &&
|
||||||
wearables[j].entityEdition.toString() === filteredPurchasesModel.get(i).edition_number) {
|
wearables[j].entityEdition.toString() === purchasesModel.get(i).edition_number) {
|
||||||
filteredPurchasesModel.setProperty(i, 'wornEntityID', wearables[j].entityID);
|
purchasesModel.setProperty(i, 'wornEntityID', wearables[j].entityID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1136,7 +1074,7 @@ Rectangle {
|
||||||
switch (message.method) {
|
switch (message.method) {
|
||||||
case 'updatePurchases':
|
case 'updatePurchases':
|
||||||
referrerURL = message.referrerURL || "";
|
referrerURL = message.referrerURL || "";
|
||||||
titleBarContainer.referrerURL = message.referrerURL;
|
titleBarContainer.referrerURL = message.referrerURL || "";
|
||||||
filterBar.text = message.filterText ? message.filterText : "";
|
filterBar.text = message.filterText ? message.filterText : "";
|
||||||
break;
|
break;
|
||||||
case 'inspectionCertificate_setCertificateId':
|
case 'inspectionCertificate_setCertificateId':
|
||||||
|
|
|
@ -34,7 +34,6 @@ Item {
|
||||||
transactionHistoryModel.initialResultReceived = false;
|
transactionHistoryModel.initialResultReceived = false;
|
||||||
transactionHistoryModel.currentPageToRetrieve = 1;
|
transactionHistoryModel.currentPageToRetrieve = 1;
|
||||||
transactionHistoryModel.noMoreDataToRetrieve = false;
|
transactionHistoryModel.noMoreDataToRetrieve = false;
|
||||||
transactionHistoryModel.requestPending = true;
|
|
||||||
transactionHistoryModel.getPage();
|
transactionHistoryModel.getPage();
|
||||||
Commerce.getAvailableUpdates();
|
Commerce.getAvailableUpdates();
|
||||||
} else {
|
} else {
|
||||||
|
@ -153,7 +152,6 @@ Item {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (transactionHistory.atYBeginning) {
|
if (transactionHistory.atYBeginning) {
|
||||||
console.log("Refreshing 1st Page of Recent Activity...");
|
console.log("Refreshing 1st Page of Recent Activity...");
|
||||||
transactionHistoryModel.requestPending = true;
|
|
||||||
Commerce.balance();
|
Commerce.balance();
|
||||||
transactionHistoryModel.currentPageToRetrieve = 1;
|
transactionHistoryModel.currentPageToRetrieve = 1;
|
||||||
transactionHistoryModel.getPage();
|
transactionHistoryModel.getPage();
|
||||||
|
@ -221,8 +219,10 @@ Item {
|
||||||
HifiModels.PSFListModel {
|
HifiModels.PSFListModel {
|
||||||
id: transactionHistoryModel;
|
id: transactionHistoryModel;
|
||||||
|
|
||||||
|
listModelName: "transaction history";
|
||||||
itemsPerPage: 100;
|
itemsPerPage: 100;
|
||||||
getPage: function() {
|
getPage: function() {
|
||||||
|
transactionHistoryModel.requestPending = true;
|
||||||
Commerce.history(transactionHistoryModel.currentPageToRetrieve, transactionHistoryModel.itemsPerPage);
|
Commerce.history(transactionHistoryModel.currentPageToRetrieve, transactionHistoryModel.itemsPerPage);
|
||||||
}
|
}
|
||||||
pageRetrieved: function(result) {
|
pageRetrieved: function(result) {
|
||||||
|
|
|
@ -111,6 +111,9 @@ Item {
|
||||||
property alias count: finalModel.count;
|
property alias count: finalModel.count;
|
||||||
function clear() { finalModel.clear(); }
|
function clear() { finalModel.clear(); }
|
||||||
function get(index) { return finalModel.get(index); }
|
function get(index) { return finalModel.get(index); }
|
||||||
|
function remove(index) { return finalModel.remove(index); }
|
||||||
|
function setProperty(index, prop, value) { return finalModel.setProperty(index, prop, value); }
|
||||||
|
function move(from, to, n) { return finalModel.move(from, to, n); }
|
||||||
|
|
||||||
// Used while processing page data and sorting
|
// Used while processing page data and sorting
|
||||||
ListModel {
|
ListModel {
|
||||||
|
@ -206,7 +209,12 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
console.log("Failed to get page result for " + root.listModelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used when sorting model data on the CLIENT
|
// Used when sorting model data on the CLIENT
|
||||||
|
|
Loading…
Reference in a new issue