Delete wallet function as service
This commit is contained in:
parent
02d5604497
commit
c01cdb8b25
5 changed files with 29 additions and 19 deletions
|
|
@ -34,20 +34,21 @@ angular.module('copayApp.controllers').controller('CopayersController',
|
|||
$location.path('/receive');
|
||||
};
|
||||
|
||||
$scope.deleteWallet = function() {
|
||||
var w = $rootScope.iden;
|
||||
iden.deleteWallet(w.id, function() {
|
||||
controllerUtils.logout();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.copayersList = function() {
|
||||
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
||||
if ($rootScope.wallet) {
|
||||
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
||||
}
|
||||
return $scope.copayers;
|
||||
}
|
||||
|
||||
$scope.isBackupReady = function(copayer) {
|
||||
return $rootScope.wallet.publicKeyRing.isBackupReady(copayer.copayerId);
|
||||
if ($rootScope.wallet) {
|
||||
return $rootScope.wallet.publicKeyRing.isBackupReady(copayer.copayerId);
|
||||
}
|
||||
}
|
||||
|
||||
$scope.deleteWallet = function() {
|
||||
controllerUtils.deleteWallet($scope);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ angular.module('copayApp.controllers').controller('MoreController',
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.save = function() {
|
||||
w.changeSettings({
|
||||
unitName: $scope.selectedUnit.shortName,
|
||||
|
|
@ -83,12 +84,7 @@ angular.module('copayApp.controllers').controller('MoreController',
|
|||
};
|
||||
|
||||
$scope.deleteWallet = function() {
|
||||
$rootScope.iden.deleteWallet(w.id, function() {
|
||||
notification.info('Wallet deleted', $filter('translate')('wallet deleted'));
|
||||
$rootScope.wallet = null;
|
||||
var lastFocused = $rootScope.iden.profile.getLastFocusedWallet();
|
||||
controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused);
|
||||
});
|
||||
controllerUtils.deleteWallet($scope);
|
||||
};
|
||||
|
||||
$scope.purge = function(deleteAll) {
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
|
|||
notification.warning('Session closed', 'Session closed because a long time of inactivity');
|
||||
});
|
||||
$scope.$on('$keepalive', function() {
|
||||
$rootScope.wallet.keepAlive();
|
||||
if ($rootScope.wallet) {
|
||||
$rootScope.wallet.keepAlive();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue