Merge pull request #4061 from JDonadio/fix/delete-wallet

Fix/delete wallet
This commit is contained in:
Gustavo Maximiliano Cortez 2016-04-11 11:59:26 -03:00
commit d831c8c4a5
2 changed files with 17 additions and 1 deletions

View File

@ -6,6 +6,18 @@
<div class="content preferences" ng-controller="preferencesDeleteWalletController as preferences">
<div class="onGoingProcess" ng-show="isDeletingWallet">
<div class="onGoingProcess-content" ng-style="{'background-color':index.backgroundColor}">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
<span translate>Deleting Wallet...</span>
</div>
</div>
<div class="text-center text-gray m20t size-12">
<div class="text-warning size-18 m10b" translate>Warning!</div>
@ -13,7 +25,7 @@
</div>
<ul class="no-bullet m0">
<li ng-click="preferences.deleteWallet()">
<div class="right" ng-style="{'color':index.backgroundColor}">
<div class="right" ng-style="{'color':index.backgroundColor}" ng-show="!isDeletingWallet">
{{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
</div>
<div translate>Delete wallet</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');
@ -44,12 +45,14 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
};
var _deleteWallet = function() {
$scope.isDeletingWallet = true;
var fc = profileService.focusedClient;
var name = fc.credentials.walletName;
var walletName = (fc.alias || '') + ' [' + name + ']';
var self = this;
profileService.deleteWalletFC({}, function(err) {
$scope.isDeletingWallet = false;
if (err) {
self.error = err.message || err;
} else {
@ -62,6 +65,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
};
this.deleteWallet = function() {
if ($scope.isDeletingWallet) return;
if (isCordova) {
navigator.notification.confirm(
delete_msg,