prevent tap on delete button if another wallet is in delete process

This commit is contained in:
Javier 2016-04-07 14:48:13 -03:00
commit ae2ad55be6
2 changed files with 11 additions and 3 deletions

View file

@ -12,7 +12,7 @@
<div class="m20b" translate>Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED</div> <div class="m20b" translate>Permanently delete this wallet. THIS ACTION CANNOT BE REVERSED</div>
</div> </div>
<ul class="no-bullet m0"> <ul class="no-bullet m0">
<li ng-click="preferences.deleteWallet()"> <li ng-click="isDeletingWallet || preferences.deleteWallet()">
<div class="right" ng-style="{'color':index.backgroundColor}"> <div class="right" ng-style="{'color':index.backgroundColor}">
{{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span> {{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
</div> </div>

View file

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
function($scope, $rootScope, $filter, $timeout, $modal, $log, storageService, notification, profileService, isCordova, go, gettext, gettextCatalog, animationService) { function($scope, $rootScope, $filter, $timeout, $modal, $log, storageService, notification, profileService, isCordova, go, gettext, gettextCatalog, animationService) {
this.isCordova = isCordova; this.isCordova = isCordova;
this.error = null; this.error = null;
$scope.isDeletingWallet = false;
var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?'); var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?');
var accept_msg = gettextCatalog.getString('Accept'); var accept_msg = gettextCatalog.getString('Accept');
@ -38,7 +39,10 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
modalInstance.result.then(function(ok) { modalInstance.result.then(function(ok) {
if (ok) { if (ok) {
_deleteWallet(); $timeout(function() {
$scope.isDeletingWallet = true;
_deleteWallet();
}, 100);
} }
}); });
}; };
@ -50,6 +54,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
var self = this; var self = this;
profileService.deleteWalletFC({}, function(err) { profileService.deleteWalletFC({}, function(err) {
$scope.isDeletingWallet = false;
if (err) { if (err) {
self.error = err.message || err; self.error = err.message || err;
} else { } else {
@ -67,7 +72,10 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
delete_msg, delete_msg,
function(buttonIndex) { function(buttonIndex) {
if (buttonIndex == 1) { if (buttonIndex == 1) {
_deleteWallet(); $timeout(function() {
$scope.isDeletingWallet = true;
_deleteWallet();
}, 100);
} }
}, },
confirm_msg, [accept_msg, cancel_msg] confirm_msg, [accept_msg, cancel_msg]