delete focused wallet

This commit is contained in:
Gabriel Bazán 2016-08-19 13:09:27 -03:00
commit 6e4a1e7ff2
28 changed files with 184 additions and 194 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('copayersController',
function($scope, $rootScope, $timeout, $log, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog, $stateParams, $state) {
function($scope, $rootScope, $timeout, $log, $ionicModal, $stateParams, profileService, go, notification, platformInfo, gettext, gettextCatalog, $state) {
var self = this;
$scope.isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -30,9 +30,9 @@ angular.module('copayApp.controllers').controller('copayersController',
};
var doDeleteWallet = function() {
var fc = profileService.focusedClient;
var walletName = fc.credentials.walletName;
profileService.deleteWalletClient(fc, function(err) {
var wallet = profileService.getWallet($stateParams.walletId);
var walletName = wallet.credentials.walletName;
profileService.deleteWalletClient(wallet, function(err) {
if (err) {
self.error = err.message || err;
$timeout(function() {
@ -53,7 +53,7 @@ angular.module('copayApp.controllers').controller('copayersController',
};
$scope.deleteWallet = function() {
var fc = profileService.focusedClient;
var wallet = profileService.focusedClient;
if ($scope.isCordova) {
navigator.notification.confirm(
delete_msg,
@ -86,18 +86,18 @@ angular.module('copayApp.controllers').controller('copayersController',
};
if (!$stateParams.walletId) {
$log.debug('No wallet provided...back to home');
return $state.transitionTo('tabs.home')
}
if (!$stateParams.walletId) {
$log.debug('No wallet provided...back to home');
return $state.transitionTo('tabs.home')
}
var wallet = profileService.getWallet($stateParams.walletId);
var secret;
try {
secret = wallet.status.wallet.secret;
} catch (e) {};
var wallet = profileService.getWallet($stateParams.walletId);
var secret;
try {
secret = wallet.status.wallet.secret;
} catch (e) {};
$scope.wallet = wallet;
$scope.secret = secret;
});
$scope.wallet = wallet;
$scope.secret = secret;
});