From ca7c25d01e4c0bc1bd33c9f2b3ca5cab32b81173 Mon Sep 17 00:00:00 2001 From: Kadir Sekha Date: Tue, 6 Feb 2018 17:50:25 -0400 Subject: [PATCH] wallet transactions now refresh every 10 seconds and don't cache --- src/js/controllers/walletDetails.js | 11 ++++++++--- src/js/services/walletService.js | 3 ++- www/views/walletDetails.html | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/walletDetails.js b/src/js/controllers/walletDetails.js index f6fff74bd..65b15f0b5 100644 --- a/src/js/controllers/walletDetails.js +++ b/src/js/controllers/walletDetails.js @@ -71,6 +71,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun force: !!force, }, function(err, status) { $scope.updatingStatus = false; + var statusChanged = false; if (err) { if (err === 'WALLET_NOT_REGISTERED') { $scope.walletNotRegistered = true; @@ -80,8 +81,12 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun $scope.status = null; } else { setPendingTxps(status.pendingTxps); - $scope.status = status; + if (!$scope.status || status.balance.totalConfirmedAmount != $scope.status.balance.totalConfirmedAmount) { + $scope.status = status; + statusChanged = true; + } } + refreshAmountSection(); $timeout(function() { $scope.$apply(); @@ -190,7 +195,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun t.alternativeAmountStr = r.toFixed(2) + ' ' + fiatCode; }); - $scope.completeTxHistory = txHistory; + $scope.completeTxHistory = txHistory; $scope.showHistory(); $timeout(function() { @@ -404,7 +409,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun $scope.$on("$ionicView.afterEnter", function(event, data) { $scope.updateAll(); refreshAmountSection(); - refreshInterval = $interval($scope.onRefresh, 6 * 60 * 1000); + refreshInterval = $interval($scope.onRefresh, 10 * 1000); }); $scope.$on("$ionicView.afterLeave", function(event, data) { diff --git a/src/js/services/walletService.js b/src/js/services/walletService.js index 85d11371e..daf90aad1 100644 --- a/src/js/services/walletService.js +++ b/src/js/services/walletService.js @@ -668,7 +668,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim 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'); diff --git a/www/views/walletDetails.html b/www/views/walletDetails.html index 61e729cb5..fc5f8c8bb 100644 --- a/www/views/walletDetails.html +++ b/www/views/walletDetails.html @@ -30,7 +30,6 @@