The spinner in wallet details now spins when the infinite scroll spinner spins.

This commit is contained in:
Brendon Duncan 2018-08-16 15:44:59 +12:00
commit 33d780f2e5
3 changed files with 44 additions and 16 deletions

View file

@ -5,12 +5,39 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
var HISTORY_SHOW_LIMIT = 10;
var currentTxHistoryPage = 0;
var listeners = [];
$scope.txps = [];
// For gradual migration for doing it properly
$scope.vm = {
gettingInitialHistory: false,
updatingTxHistory: false
};
$scope.amountIsCollapsible = false;
$scope.color = '#888888';
$scope.completeTxHistory = [];
$scope.openTxpModal = txpModalService.open;
$scope.filteredTxHistory = [];
$scope.isCordova = platformInfo.isCordova;
$scope.isAndroid = platformInfo.isAndroid;
$scope.isIOS = platformInfo.isIOS;
$scope.isSearching = false;
$scope.openTxpModal = txpModalService.open;
$scope.requiresMultipleSignatures = false;
$scope.showBalanceButton = false;
$scope.status = null;
$scope.txHistory = [];
$scope.txHistorySearchResults = [];
$scope.txHistoryShowMore = false;
$scope.txps = [];
$scope.updatingStatus = false;
$scope.updateStatusError = null;
$scope.updateTxHistoryError = null;
$scope.updatingTxHistoryProgress = 0;
$scope.wallet = null;
$scope.walletId = '';
$scope.walletNotRegistered = false;
var channel = "ga";
if (platformInfo.isCordova) {
@ -172,7 +199,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
walletService.getTxHistory($scope.wallet, {
feeLevels: levels
}, function(err, txHistory) {
$scope.updatingTxHistory = false;
$scope.vm.gettingInitialHistory = false;
if (err) {
$scope.txHistory = null;
$scope.updateTxHistoryError = true;
@ -256,17 +283,18 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
return !tx.confirmations || tx.confirmations === 0;
};
var loadingTxs = false;
$scope.showMore = function() {
if (loadingTxs)
if ($scope.vm.updatingTxHistory) {
return;
loadingTxs = true;
}
$scope.vm.updatingTxHistory = true;
$timeout(function() {
walletService.getMoreTxs($scope.wallet, function() {
walletService.getMoreTxs($scope.wallet, function onMoreTxs() {
currentTxHistoryPage++;
$scope.showHistory();
$scope.$broadcast('scroll.infiniteScrollComplete');
loadingTxs = false;
$scope.vm.updatingTxHistory = false;
});
}, 100);
};
@ -400,7 +428,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
if (!$scope.wallet) return;
$scope.requiresMultipleSignatures = $scope.wallet.credentials.m > 1;
$scope.updatingTxHistory = true;
$scope.vm.gettingInitialHistory = true;
addressbookService.list(function(err, ab) {
if (err) $log.error(err);

View file

@ -3,8 +3,8 @@
<a ng-show="walletNotRegistered" ng-click="recreate()" translate>Tap to recreate</a>
<a ng-show="updateStatusError" ng-click="updateAll(true)" translate>Tap to retry</a>
</div>
<span ng-click="onRefresh()" class="right" ng-show="(!updatingStatus && !updatingTxHistory)">&#8635;</span>
<ion-spinner class="spinner-dark recent right loading-wallet" icon="crescent" ng-show="(updatingStatus || updatingTxHistory) &&
<span ng-click="onRefresh()" class="right" ng-show="(!updatingStatus && !vm.updatingTxHistory && !vm.gettingInitialHistory)">&#8635;</span>
<ion-spinner class="spinner-dark recent right loading-wallet" icon="crescent" ng-show="(updatingStatus || vm.updatingTxHistory || vm.gettingInitialHistory) &&
!walletNotRegistered && !updateStatusError && !updateTxHistoryError"></ion-spinner>
<div>

View file

@ -284,29 +284,29 @@
<!-- Transactions -->
<div class="wallet-details__no-transaction"
ng-show="!txHistory[0] && !updatingTxHistory && !updateTxHistoryError && !updateStatusError" translate>
ng-show="!txHistory[0] && !vm.gettingInitialHistory && !updateTxHistoryError && !updateStatusError" translate>
No transactions yet
</div>
<div class="wallet-details__no-update-history"
ng-show="!txHistory[0] && !updatingTxHistory && updateTxHistoryError" translate>
ng-show="!txHistory[0] && !vm.gettingInitialHistory && updateTxHistoryError" translate>
Could not update transaction history
</div>
<div ng-show="updatingTxHistory && updatingTxHistoryProgress>5" class="wallet-details__updating-history">
<div ng-show="vm.gettingInitialHistory && updatingTxHistoryProgress>5" class="wallet-details__updating-history">
<span translate>Updating transaction history. Please stand by.</span><br>
<span translate>{{updatingTxHistoryProgress}} transactions downloaded</span>
</div>
<div class="wallet-details__list" ng-show="txHistory[0] && !updatingTxHistory">
<div class="wallet-details__list" ng-show="txHistory[0] && !vm.gettingInitialHistory">
<div ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
<span ng-include="'views/includes/walletHistory.html'"></span>
</div>
</div>
<ion-infinite-scroll
ng-if="txHistory[0] && !updatingTxHistory"
ng-if="txHistory[0] && !vm.gettingInitialHistory"
on-infinite="showMore()"
distance="1%">
</ion-infinite-scroll>