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();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -388,6 +388,16 @@ angular.module('copayApp.services')
|
|||
$rootScope.pendingTxCount = pendingForUs;
|
||||
};
|
||||
|
||||
root.deleteWallet = function($scope, w) {
|
||||
w = w || $rootScope.wallet;
|
||||
$rootScope.iden.deleteWallet(w.id, function() {
|
||||
notification.info('Wallet deleted', $filter('translate')('Wallet deleted'));
|
||||
$rootScope.wallet = null;
|
||||
var lastFocused = $rootScope.iden.profile.getLastFocusedWallet();
|
||||
root.bindProfile($scope, $rootScope.iden, lastFocused);
|
||||
});
|
||||
};
|
||||
|
||||
function getActionList(actions) {
|
||||
var peers = Object.keys(actions).map(function(i) {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -9,14 +9,13 @@
|
|||
{{$root.wallet.getName()}}
|
||||
<small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small>
|
||||
</h1>
|
||||
<div class="panel">
|
||||
<div class="panel oh">
|
||||
<qrcode size="350" data="{{$root.wallet.getSecret()}}"></qrcode>
|
||||
<div class="secret">
|
||||
<h2 translate>Share this secret with your other copayers</h2>
|
||||
{{$root.wallet.getSecret()}}
|
||||
<span class="btn-copy" clip-copy="$root.wallet.getSecret()"></span>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<h1 ng-if="$root.wallet &&
|
||||
|
|
@ -52,7 +51,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="oh">
|
||||
<a translate class="size-12 text-warning left m20t" ng-really-click="deleteWallet()"
|
||||
ng-really-message="Are you sure to delete this wallet from this computer?">Delete wallet</a>
|
||||
<button class="button primary right m0"
|
||||
ng-click="backup()"
|
||||
ng-show="!$root.wallet.publicKeyRing.isBackupReady() && !hideViewBackup"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue