From 8185d1b5f5d604f2013885d937ccc36e9f18a1f3 Mon Sep 17 00:00:00 2001 From: howard-stearns Date: Wed, 6 Jun 2018 15:24:54 -0700 Subject: [PATCH] cleanup and consistently don't getNextPage at beginning --- interface/resources/qml/hifi/Feed.qml | 8 ++------ interface/resources/qml/hifi/Pal.qml | 6 +++++- .../resources/qml/hifi/commerce/wallet/WalletHome.qml | 2 +- interface/resources/qml/hifi/models/PSFListModel.qml | 6 ++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index fcfb61b1ca..1d28f18f9d 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -43,7 +43,6 @@ Column { property var http: null; HifiConstants { id: hifi } - //FIXME ListModel { id: suggestions; } Component.onCompleted: suggestions.getFirstPage(); HifiModels.PSFListModel { id: suggestions; @@ -57,7 +56,6 @@ Column { endpoint: '/api/v1/user_stories?' + options.join('&'); itemsPerPage: 3; processPage: function (data) { - console.log('FIXME processPage', suggestions.listModelName, JSON.stringify(data)); return data.user_stories.map(makeModelData); }; listModelName: actions; @@ -85,7 +83,7 @@ Column { data.details.connections = 4; data.action = 'announcement'; } - var fixme = { + return { place_name: name, username: data.username || "", path: data.path || "", @@ -103,8 +101,6 @@ Column { searchText: [name].concat(tags, description || []).join(' ').toUpperCase() }; - console.log('fixme makeModelData', JSON.stringify(fixme)); - return fixme; } function identity(x) { return x; @@ -238,7 +234,7 @@ Column { highlightMoveDuration: -1; highlightMoveVelocity: -1; currentIndex: -1; - onAtXEndChanged: { console.log('FIXME onAtXEndChanged', actions, scroll.atXEnd, scroll.atXBeginning); if (scroll.atXEnd && !scroll.atXBeginning) { suggestions.getNextPage(); } } + onAtXEndChanged: { if (scroll.atXEnd && !scroll.atXBeginning) { suggestions.getNextPage(); } } spacing: 12; width: parent.width; diff --git a/interface/resources/qml/hifi/Pal.qml b/interface/resources/qml/hifi/Pal.qml index 9a818ef4db..fbe34b2ebc 100644 --- a/interface/resources/qml/hifi/Pal.qml +++ b/interface/resources/qml/hifi/Pal.qml @@ -780,7 +780,11 @@ Rectangle { model: connectionsUserModel.model; Connections { target: connectionsTable.flickableItem; - onAtYEndChanged: if (connectionsTable.flickableItem.atYEnd) { connectionsUserModel.getNextPage(); } + onAtYEndChanged: { + if (connectionsTable.flickableItem.atYEnd && !connectionsTable.flickableItem.atYBeginning) { + connectionsUserModel.getNextPage(); + } + } } // This Rectangle refers to each Row in the connectionsTable. diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml index 047dcd70d1..9076f10ebc 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletHome.qml @@ -400,7 +400,7 @@ Item { } } onAtYEndChanged: { - if (transactionHistory.atYEnd) { + if (transactionHistory.atYEnd && !transactionHistory.atYBeginning) { console.log("User scrolled to the bottom of 'Recent Activity'."); transactionHistoryModel.getNextPage(); } diff --git a/interface/resources/qml/hifi/models/PSFListModel.qml b/interface/resources/qml/hifi/models/PSFListModel.qml index 124e08b6cd..5cca73af92 100644 --- a/interface/resources/qml/hifi/models/PSFListModel.qml +++ b/interface/resources/qml/hifi/models/PSFListModel.qml @@ -79,8 +79,7 @@ Item { var processed; console.debug('handlePage', listModelName, error, JSON.stringify(response)); function fail(message) { - console.warn("Warning", listModelName, JSON.stringify(message)); - console.log('FIXME fail setting currentPageToRetrieve to -1', listModelName); + console.warn("Warning page fail", listModelName, JSON.stringify(message)); currentPageToRetrieve = -1; requestPending = false; delayedClear = false; @@ -97,7 +96,6 @@ Item { } processed = processPage(response.data || response); if (response.total_pages && (response.total_pages === currentPageToRetrieve)) { - console.log('fixme hanglePage set currentPageToRetrieve to -1', listModelName, 'response.total_pages:', response.total_pages, 'old currentPageToRetrieve:', currentPageToRetrieve); currentPageToRetrieve = -1; } if (searchItemTest) { @@ -172,7 +170,7 @@ Item { // ListView { // id: theList // model: thisPSFListModelId - // onAtYEndChanged: if (theList.atYEnd) { thisPSFListModelId.getNextPage(); } + // onAtYEndChanged: if (theList.atYEnd && !theList.atYBeginning) { thisPSFListModelId.getNextPage(); } // ...} property var getNextPage: function () { console.log('fixme getNextPage', listModelName, requestPending, currentPageToRetrieve);