mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 21:29:33 +02:00
Improve scrolling thru My Purchases
This commit is contained in:
parent
dcfceab078
commit
611f25d542
2 changed files with 19 additions and 5 deletions
|
@ -36,6 +36,7 @@ Rectangle {
|
||||||
property bool pendingInventoryReply: true;
|
property bool pendingInventoryReply: true;
|
||||||
property bool isShowingMyItems: false;
|
property bool isShowingMyItems: false;
|
||||||
property bool isDebuggingFirstUseTutorial: false;
|
property bool isDebuggingFirstUseTutorial: false;
|
||||||
|
property int pendingItemCount: 0;
|
||||||
// Style
|
// Style
|
||||||
color: hifi.colors.white;
|
color: hifi.colors.white;
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -79,18 +80,22 @@ Rectangle {
|
||||||
onInventoryResult: {
|
onInventoryResult: {
|
||||||
purchasesReceived = true;
|
purchasesReceived = true;
|
||||||
|
|
||||||
if (root.pendingInventoryReply) {
|
|
||||||
inventoryTimer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
console.log("Failed to get purchases", result.message);
|
console.log("Failed to get purchases", result.message);
|
||||||
} else {
|
} else if (!purchasesContentsList.dragging) { // Don't modify the view if the user's scrolling
|
||||||
var inventoryResult = processInventoryResult(result.data.assets);
|
var inventoryResult = processInventoryResult(result.data.assets);
|
||||||
|
|
||||||
|
var currentIndex = purchasesContentsList.currentIndex === -1 ? 0 : purchasesContentsList.currentIndex;
|
||||||
purchasesModel.clear();
|
purchasesModel.clear();
|
||||||
purchasesModel.append(inventoryResult);
|
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) {
|
if (previousPurchasesModel.count !== 0) {
|
||||||
checkIfAnyItemStatusChanged();
|
checkIfAnyItemStatusChanged();
|
||||||
} else {
|
} else {
|
||||||
|
@ -103,6 +108,12 @@ Rectangle {
|
||||||
previousPurchasesModel.append(inventoryResult);
|
previousPurchasesModel.append(inventoryResult);
|
||||||
|
|
||||||
buildFilteredPurchasesModel();
|
buildFilteredPurchasesModel();
|
||||||
|
|
||||||
|
purchasesContentsList.positionViewAtIndex(currentIndex, ListView.Beginning);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (root.pendingInventoryReply && root.pendingItemCount > 0) {
|
||||||
|
inventoryTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
root.pendingInventoryReply = false;
|
root.pendingInventoryReply = false;
|
||||||
|
@ -419,6 +430,8 @@ Rectangle {
|
||||||
visible: (root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0);
|
visible: (root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0);
|
||||||
clip: true;
|
clip: true;
|
||||||
model: filteredPurchasesModel;
|
model: filteredPurchasesModel;
|
||||||
|
snapMode: ListView.SnapToItem;
|
||||||
|
highlightRangeMode: ListView.StrictlyEnforceRange;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.top: root.canRezCertifiedItems ? separator.bottom : cantRezCertified.bottom;
|
anchors.top: root.canRezCertifiedItems ? separator.bottom : cantRezCertified.bottom;
|
||||||
anchors.topMargin: 12;
|
anchors.topMargin: 12;
|
||||||
|
|
|
@ -48,6 +48,7 @@ Item {
|
||||||
|
|
||||||
if (result.data.history.length === 0) {
|
if (result.data.history.length === 0) {
|
||||||
root.noMoreHistoryData = true;
|
root.noMoreHistoryData = true;
|
||||||
|
console.log("No more data to retrieve from Commerce.history() endpoint.")
|
||||||
} else if (root.currentHistoryPage === 1) {
|
} else if (root.currentHistoryPage === 1) {
|
||||||
var sameItemCount = 0;
|
var sameItemCount = 0;
|
||||||
tempTransactionHistoryModel.clear();
|
tempTransactionHistoryModel.clear();
|
||||||
|
|
Loading…
Reference in a new issue