mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #5501 from cmgustavo/bug/delete-wallet-01
Fix delete wallet view cache and transition. Fix UI details
This commit is contained in:
commit
5e520212b0
|
@ -1,12 +1,25 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
|
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
|
||||||
function($scope, $stateParams, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
|
function($scope, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
|
||||||
$scope.wallet = wallet;
|
|
||||||
|
|
||||||
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
$scope.walletName = wallet.credentials.walletName;
|
if (!data.stateParams || !data.stateParams.walletId) {
|
||||||
|
popupService.showAlert(null, gettextCatalog.getString('No wallet selected'), function() {
|
||||||
|
$ionicHistory.goBack();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
|
||||||
|
if (!$scope.wallet) {
|
||||||
|
popupService.showAlert(null, gettextCatalog.getString('No wallet found'), function() {
|
||||||
|
$ionicHistory.goBack();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.alias = lodash.isEqual($scope.wallet.name, $scope.wallet.credentials.walletName) ? null : $scope.wallet.name + ' ';
|
||||||
|
$scope.walletName = $scope.wallet.credentials.walletName;
|
||||||
|
});
|
||||||
|
|
||||||
$scope.showDeletePopup = function() {
|
$scope.showDeletePopup = function() {
|
||||||
var title = gettextCatalog.getString('Warning!');
|
var title = gettextCatalog.getString('Warning!');
|
||||||
|
@ -18,14 +31,19 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
||||||
|
|
||||||
function deleteWallet() {
|
function deleteWallet() {
|
||||||
ongoingProcess.set('deletingWallet', true);
|
ongoingProcess.set('deletingWallet', true);
|
||||||
profileService.deleteWalletClient(wallet, function(err) {
|
profileService.deleteWalletClient($scope.wallet, function(err) {
|
||||||
ongoingProcess.set('deletingWallet', false);
|
ongoingProcess.set('deletingWallet', false);
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
|
||||||
} else {
|
} else {
|
||||||
|
$ionicHistory.nextViewOptions({
|
||||||
|
disableAnimate: true,
|
||||||
|
historyRoot: true
|
||||||
|
});
|
||||||
$ionicHistory.clearHistory();
|
$ionicHistory.clearHistory();
|
||||||
$ionicHistory.clearCache();
|
$state.go('tabs.settings').then(function() {
|
||||||
$state.go('tabs.home');
|
$state.transitionTo('tabs.home');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
</ion-nav-back-button>
|
</ion-nav-back-button>
|
||||||
</ion-nav-bar>
|
</ion-nav-bar>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
|
<div class="list" ng-show="wallet">
|
||||||
|
<div class="wallet-item" ng-include="'views/includes/walletItem.html'"></div>
|
||||||
|
|
||||||
<div class="padding">
|
|
||||||
<h1 class="text-center assertive" translate>Warning!</h1>
|
<h1 class="text-center assertive" translate>Warning!</h1>
|
||||||
<div class="padding text-center">
|
<div class="padding text-center">
|
||||||
<p translate>
|
<p translate>
|
||||||
|
@ -17,8 +17,6 @@
|
||||||
THIS ACTION CANNOT BE REVERSED
|
THIS ACTION CANNOT BE REVERSED
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="padding">
|
|
||||||
<button class="button button-standard button-assertive" ng-click="showDeletePopup()">
|
<button class="button button-standard button-assertive" ng-click="showDeletePopup()">
|
||||||
{{'Delete'|translate}} <span ng-show="alias">{{alias}}</span>{{walletName}}
|
{{'Delete'|translate}} <span ng-show="alias">{{alias}}</span>{{walletName}}
|
||||||
</button>
|
</button>
|
||||||
|
|
Loading…
Reference in New Issue