wallet transactions now refresh every 10 seconds and don't cache

This commit is contained in:
Kadir Sekha 2018-02-06 17:50:25 -04:00
commit ca7c25d01e
3 changed files with 10 additions and 5 deletions

View file

@ -71,6 +71,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
force: !!force, force: !!force,
}, function(err, status) { }, function(err, status) {
$scope.updatingStatus = false; $scope.updatingStatus = false;
var statusChanged = false;
if (err) { if (err) {
if (err === 'WALLET_NOT_REGISTERED') { if (err === 'WALLET_NOT_REGISTERED') {
$scope.walletNotRegistered = true; $scope.walletNotRegistered = true;
@ -80,8 +81,12 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.status = null; $scope.status = null;
} else { } else {
setPendingTxps(status.pendingTxps); setPendingTxps(status.pendingTxps);
$scope.status = status; if (!$scope.status || status.balance.totalConfirmedAmount != $scope.status.balance.totalConfirmedAmount) {
$scope.status = status;
statusChanged = true;
}
} }
refreshAmountSection(); refreshAmountSection();
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();
@ -404,7 +409,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.$on("$ionicView.afterEnter", function(event, data) { $scope.$on("$ionicView.afterEnter", function(event, data) {
$scope.updateAll(); $scope.updateAll();
refreshAmountSection(); refreshAmountSection();
refreshInterval = $interval($scope.onRefresh, 6 * 60 * 1000); refreshInterval = $interval($scope.onRefresh, 10 * 1000);
}); });
$scope.$on("$ionicView.afterLeave", function(event, data) { $scope.$on("$ionicView.afterLeave", function(event, data) {

View file

@ -668,7 +668,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
return wallet.completeHistory && wallet.completeHistory.isValid; return wallet.completeHistory && wallet.completeHistory.isValid;
}; };
if (isHistoryCached() && !opts.force) return cb(null, wallet.completeHistory); // disable caching
//if (isHistoryCached() && !opts.force) return cb(null, wallet.completeHistory);
$log.debug('Updating Transaction History'); $log.debug('Updating Transaction History');

View file

@ -30,7 +30,6 @@
</div> </div>
<div <div
ng-click='updateAll(true)'
ng-show="!updateStatusError && !wallet.balanceHidden && !wallet.scanning" ng-show="!updateStatusError && !wallet.balanceHidden && !wallet.scanning"
on-hold="hideToggle()" on-hold="hideToggle()"
ng-style="{'transform': amountScale}" ng-style="{'transform': amountScale}"