prevent walletupdate to block the ui

This commit is contained in:
Matias Alejo Garcia 2016-06-14 08:39:34 -03:00
commit 3cc17f40b6
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
3 changed files with 32 additions and 17 deletions

View file

@ -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();

View file

@ -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...'),