mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #4061 from JDonadio/fix/delete-wallet
Fix/delete wallet
This commit is contained in:
commit
d831c8c4a5
|
@ -6,6 +6,18 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="content preferences" ng-controller="preferencesDeleteWalletController as preferences">
|
<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-center text-gray m20t size-12">
|
||||||
<div class="text-warning size-18 m10b" translate>Warning!</div>
|
<div class="text-warning size-18 m10b" translate>Warning!</div>
|
||||||
|
@ -13,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ul class="no-bullet m0">
|
<ul class="no-bullet m0">
|
||||||
<li ng-click="preferences.deleteWallet()">
|
<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>
|
{{index.walletName}} <span ng-show="index.alias">({{index.alias}})</span>
|
||||||
</div>
|
</div>
|
||||||
<div translate>Delete wallet</div>
|
<div translate>Delete wallet</div>
|
||||||
|
|
|
@ -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');
|
||||||
|
@ -44,12 +45,14 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
||||||
};
|
};
|
||||||
|
|
||||||
var _deleteWallet = function() {
|
var _deleteWallet = function() {
|
||||||
|
$scope.isDeletingWallet = true;
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
var name = fc.credentials.walletName;
|
var name = fc.credentials.walletName;
|
||||||
var walletName = (fc.alias || '') + ' [' + name + ']';
|
var walletName = (fc.alias || '') + ' [' + name + ']';
|
||||||
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 {
|
||||||
|
@ -62,6 +65,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
||||||
};
|
};
|
||||||
|
|
||||||
this.deleteWallet = function() {
|
this.deleteWallet = function() {
|
||||||
|
if ($scope.isDeletingWallet) return;
|
||||||
if (isCordova) {
|
if (isCordova) {
|
||||||
navigator.notification.confirm(
|
navigator.notification.confirm(
|
||||||
delete_msg,
|
delete_msg,
|
||||||
|
|
Loading…
Reference in New Issue