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
parent f1ff334e3e
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>
<ul class="no-bullet m0">
<li ng-click="preferences.deleteWallet()">
<li ng-click="isDeletingWallet || preferences.deleteWallet()">
<div class="right" ng-style="{'color':index.backgroundColor}">
{{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
</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) {
this.isCordova = isCordova;
this.error = null;
$scope.isDeletingWallet = false;
var delete_msg = gettextCatalog.getString('Are you sure you want to delete this wallet?');
var accept_msg = gettextCatalog.getString('Accept');
@ -38,7 +39,10 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
modalInstance.result.then(function(ok) {
if (ok) {
_deleteWallet();
$timeout(function() {
$scope.isDeletingWallet = true;
_deleteWallet();
}, 100);
}
});
};
@ -50,6 +54,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
var self = this;
profileService.deleteWalletFC({}, function(err) {
$scope.isDeletingWallet = false;
if (err) {
self.error = err.message || err;
} else {
@ -67,7 +72,10 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
delete_msg,
function(buttonIndex) {
if (buttonIndex == 1) {
_deleteWallet();
$timeout(function() {
$scope.isDeletingWallet = true;
_deleteWallet();
}, 100);
}
},
confirm_msg, [accept_msg, cancel_msg]