Fix delete wallet view cache and transition. Fix UI details

This commit is contained in:
Gustavo Maximiliano Cortez 2017-01-21 19:37:39 -03:00
parent ecbe35da11
commit 6e9fa52016
No known key found for this signature in database
GPG Key ID: 15EDAD8D9F2EB1AF
2 changed files with 23 additions and 13 deletions

View File

@ -1,12 +1,19 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $stateParams, $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.walletName = wallet.credentials.walletName;
function($scope, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
$scope.$on("$ionicView.beforeEnter", function(event, data) {
if (!data.stateParams || !data.stateParams.walletId) {
popupService.showAlert(null, gettextCatalog.getString('Bad param'), function() {
$ionicHistory.goBack();
});
return;
}
$scope.wallet = profileService.getWallet(data.stateParams.walletId);
$scope.alias = lodash.isEqual($scope.wallet.name, $scope.wallet.credentials.walletName) ? null : $scope.wallet.name + ' ';
$scope.walletName = $scope.wallet.credentials.walletName;
});
$scope.showDeletePopup = function() {
var title = gettextCatalog.getString('Warning!');
@ -18,14 +25,19 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
function deleteWallet() {
ongoingProcess.set('deletingWallet', true);
profileService.deleteWalletClient(wallet, function(err) {
profileService.deleteWalletClient($scope.wallet, function(err) {
ongoingProcess.set('deletingWallet', false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$ionicHistory.nextViewOptions({
disableAnimate: true,
historyRoot: true
});
$ionicHistory.clearHistory();
$ionicHistory.clearCache();
$state.go('tabs.home');
$state.go('tabs.settings').then(function() {
$state.transitionTo('tabs.home');
});
}
});
};

View File

@ -5,9 +5,9 @@
</ion-nav-back-button>
</ion-nav-bar>
<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>
<div class="padding text-center">
<p translate>
@ -17,8 +17,6 @@
THIS ACTION CANNOT BE REVERSED
</p>
</div>
</div>
<div class="padding">
<button class="button button-standard button-assertive" ng-click="showDeletePopup()">
{{'Delete'|translate}} <span ng-show="alias">{{alias}}</span>{{walletName}}
</button>