deleting wallet with callback

This commit is contained in:
Gustavo Maximiliano Cortez 2014-11-11 12:54:52 -03:00
commit 74b61624e5
4 changed files with 19 additions and 10 deletions

View file

@ -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) {

View file

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

View file

@ -56,7 +56,7 @@
<td width="70" class="text-center">
<a translate
class="warning"
ng-really-message="{{'Are you sure to delete the wallet'}} {{(item.name || item.id)}}"
ng-really-message="{{'Are you sure you want to delete the wallet'}} {{(item.name || item.id)}}"
ng-really-click="deleteWallet(item)"
ng-show="activeWallet != item.id && loading != item.id">Delete</a>
<span ng-show="loading == item.id"><i class="fi-bitcoin-circle icon-rotate spinner"></i></span>

View file

@ -48,7 +48,13 @@
<div class="panel">
<h2><i class="fi-minus-circle m10r"></i> <span translate>Delete Wallet</span></h2>
<p translate class="text-gray">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.</p>
<a translate class="button warning m0" ng-really-message="{{'Are you sure to delete this wallet from this computer?'|translate}}" ng-really-click="deleteWallet()"> Delete</a>
<a class="button warning m0"
ng-really-message="{{'Are you sure you want to delete this wallet?'|translate}}"
ng-really-click="deleteWallet()"
ng-class="{'disabled':loading}">
<span ng-show="!loading">Delete</span>
<span ng-show="loading">Deleting...</span>
</a>
</div>
</div>
</div>