From 3cc17f40b68cee1f5060a00a35dd4e21f8b05e8b Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 14 Jun 2016 08:39:34 -0300 Subject: [PATCH] prevent walletupdate to block the ui --- public/views/walletHome.html | 29 ++++++++++++++++++++++++----- src/js/controllers/index.js | 16 ++++++++-------- src/js/services/onGoingProcess.js | 4 ---- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/public/views/walletHome.html b/public/views/walletHome.html index f57f9e87a..2e7b1db17 100644 --- a/public/views/walletHome.html +++ b/public/views/walletHome.html @@ -16,6 +16,20 @@ +
+
+
+
+
+
+
+
+
+ Updating Wallet... +
+
+ +
@@ -79,7 +98,7 @@
-
+
@@ -319,7 +338,7 @@ -->
-

+

-
+
@@ -441,7 +460,7 @@ Cancel
- diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index f6e05baaa..cce4b547f 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -117,6 +117,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.hasProfile = true; self.isSingleAddress = false; self.noFocusedWallet = false; + self.updating = false; // Credentials Shortcuts self.m = fc.credentials.m; @@ -302,7 +303,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r $timeout(function() { if (!opts.quiet) - ongoingProcess.set('updatingStatus', true); + self.updating = true; $log.debug('Updating Status:', fc.credentials.walletName, tries); get(function(err, walletStatus) { @@ -322,8 +323,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r if (walletId != profileService.focusedClient.credentials.walletId) return; - ongoingProcess.set('updatingStatus', false); - + self.updating = false; if (err) { self.handleError(err); @@ -387,10 +387,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.updatePendingTxps = function() { var fc = profileService.focusedClient; $timeout(function() { - ongoingProcess.set('updatingPendingTxps', true); + self.updating = true; $log.debug('Updating PendingTxps'); fc.getTxProposals({}, function(err, txps) { - ongoingProcess.set('updatingPendingTxps', false); + self.updating = false; if (err) { self.handleError(err); } else { @@ -426,10 +426,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r var fc = profileService.focusedClient; $timeout(function() { $rootScope.$apply(); - ongoingProcess.set('openingWallet', true); + self.updating = true; self.updateError = false; fc.openWallet(function(err, walletStatus) { - ongoingProcess.set('openingWallet', false); + self.updating = false; if (err) { self.updateError = true; self.handleError(err); @@ -1628,7 +1628,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r lodash.each(['TxProposalRejectedBy', 'TxProposalAcceptedBy'], function(eventName) { $rootScope.$on(eventName, function() { var f = function() { - if (self.updatingStatus) { + if (self.updating) { return $timeout(f, 200); }; self.updatePendingTxps(); diff --git a/src/js/services/onGoingProcess.js b/src/js/services/onGoingProcess.js index 6208660b7..45eb69f63 100644 --- a/src/js/services/onGoingProcess.js +++ b/src/js/services/onGoingProcess.js @@ -7,10 +7,6 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti var ongoingProcess = {}; var processNames = { - 'openingWallet': gettextCatalog.getString('Updating Wallet...'), - 'updatingStatus': gettextCatalog.getString('Updating Wallet...'), - 'updatingBalance': gettextCatalog.getString('Updating Wallet...'), - 'updatingPendingTxps': gettextCatalog.getString('Updating Wallet...'), 'scanning': gettextCatalog.getString('Scanning Wallet funds...'), 'recreating': gettextCatalog.getString('Recreating Wallet...'), 'generatingCSV': gettextCatalog.getString('Generating .csv file...'),