Displaying more cached data while waiting for first tx history fetch.

This commit is contained in:
Brendon Duncan 2018-08-22 19:51:10 +12:00
commit e6beb6fed1

View file

@ -267,7 +267,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
}
if (fetchedAllTransactions) {
console.log("All transactions seem to be fetched..");
console.log("pagination Fetched all transactions.");
$scope.vm.fetchedAllTxHistory = true;
}
@ -284,7 +284,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
function showHistory(showAll) {
if (completeTxHistory) {
$scope.txHistory = showAll ? completeTxHistory : completeTxHistory.slice(0, (currentTxHistoryDisplayPage + 1) * DISPLAY_PAGE_SIZE);
$scope.vm.allowInfiniteScroll = !$scope.vm.fetchedAllTxHistory;//(completeTxHistory.length > $scope.txHistory.length || !$scope.vm.gettingInitialHistory) || (!$scope.vm.gettingInitialHistory && !$scope.vm.fetchedAllTxHistory);
$scope.vm.allowInfiniteScroll = !$scope.vm.fetchedAllTxHistory && !(completeTxHistory.length === $scope.txHistory.length && $scope.vm.gettingInitialHistory);
console.log('pagination Showing txs: ', $scope.txHistory.length);
} else {
$scope.vm.allowInfiniteScroll = false;
@ -332,18 +332,19 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
// on-infinite="showMore()"
$scope.showMore = function() {
console.log('pagination showMore()');
if ($scope.vm.updatingTxHistory) {
return;
}
// Check if we have more than we are displaying
if (completeTxHistory.length > $scope.txHistory.length) {
console.log('pagination We have more data than we are displaying.');
currentTxHistoryDisplayPage++;
showHistory(false);
$scope.$broadcast('scroll.infiniteScrollComplete');
return;
}
if ($scope.vm.updatingTxHistory) {
return;
}
fetchAndShowTxHistory(false, false);
};