From be10694763d1bc52e7992a7c29880710cda081fc Mon Sep 17 00:00:00 2001 From: Matias Pando Date: Thu, 6 Nov 2014 12:47:54 -0300 Subject: [PATCH] Update balance to every wallet --- js/controllers/paymentIntent.js | 3 ++- js/services/controllerUtils.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/js/controllers/paymentIntent.js b/js/controllers/paymentIntent.js index 9aa47f15e..846111383 100644 --- a/js/controllers/paymentIntent.js +++ b/js/controllers/paymentIntent.js @@ -10,11 +10,12 @@ angular.module('copayApp.controllers').controller('PaymentIntentController', fun _.each(wids, function(wid) { var w = $rootScope.iden.getWalletById(wid); if (w && w.isReady()) { + $scope.wallets.push(w); controllerUtils.clearBalanceCache(w); controllerUtils.updateBalance(w, function() { $rootScope.$digest(); - }); + }, true); } }); diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index eff844cfe..52b37c4c9 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -289,13 +289,13 @@ angular.module('copayApp.services') if (cb) return cb(); }; - root.updateBalance = function(w, cb) { + root.updateBalance = function(w, cb, refreshAll) { w = w || $rootScope.wallet; if (!w) return root.onErrorDigest(); if (!w.isReady()) return; w.balanceInfo = {}; - var scope = root.isFocusedWallet(w.id) ? $rootScope : w.balanceInfo; + var scope = root.isFocusedWallet(w.id) && !refreshAll ? $rootScope : w.balanceInfo; root.updateAddressList(); @@ -303,7 +303,7 @@ angular.module('copayApp.services') if (_balanceCache[wid]) { root._updateScope(w, _balanceCache[wid], scope, function() { - if (root.isFocusedWallet(w.id)) { + if (root.isFocusedWallet(w.id) && !refreshAll) { setTimeout(function() { $rootScope.$digest(); }, 1);