diff --git a/js/controllers/more.js b/js/controllers/more.js index 5af6313a9..f1e129e4a 100644 --- a/js/controllers/more.js +++ b/js/controllers/more.js @@ -88,7 +88,13 @@ angular.module('copayApp.controllers').controller('MoreController', }; $scope.deleteWallet = function() { - controllerUtils.deleteWallet($scope); + $scope.loading = true; + controllerUtils.deleteWallet($scope, $rootScope.wallet, function() { + $rootScope.wallet = null; + var lastFocused = $rootScope.iden.getLastFocusedWallet(); + controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused); + $scope.loading = false; + }); }; $scope.purge = function(deleteAll) { diff --git a/js/services/controllerUtils.js b/js/services/controllerUtils.js index 73ea2d818..b54f62d2b 100644 --- a/js/services/controllerUtils.js +++ b/js/services/controllerUtils.js @@ -359,15 +359,12 @@ angular.module('copayApp.services') $rootScope.pendingTxCount = res.pendingForUs; }; - root.deleteWallet = function($scope, w, skipBind) { - w = w || $rootScope.wallet; + root.deleteWallet = function($scope, w, cb) { + if (!w) return root.onErrorDigest(); var name = w.getName(); $rootScope.iden.deleteWallet(w.id, function() { - notification.info(name + ' deleted', $filter('translate')('Wallet deleted')); - if (skipBind) return skipBind(); - $rootScope.wallet = null; - var lastFocused = $rootScope.iden.getLastFocusedWallet(); - root.bindProfile($scope, $rootScope.iden, lastFocused); + notification.info(name + ' deleted', $filter('translate')('This wallet was deleted')); + return cb(); }); }; diff --git a/views/manage.html b/views/manage.html index 1e5f8fe45..c952c85c9 100644 --- a/views/manage.html +++ b/views/manage.html @@ -56,7 +56,7 @@
If all funds have been removed from your wallet and you do not wish to have the wallet data stored on your computer anymore, you can delete your wallet.
- Delete + + Delete + Deleting... +