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');
|
$location.path('/receive');
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteWallet = function() {
|
|
||||||
var w = $rootScope.iden;
|
|
||||||
iden.deleteWallet(w.id, function() {
|
|
||||||
controllerUtils.logout();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.copayersList = function() {
|
$scope.copayersList = function() {
|
||||||
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
if ($rootScope.wallet) {
|
||||||
|
$scope.copayers = $rootScope.wallet.getRegisteredPeerIds();
|
||||||
|
}
|
||||||
return $scope.copayers;
|
return $scope.copayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.isBackupReady = function(copayer) {
|
$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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
w.changeSettings({
|
w.changeSettings({
|
||||||
unitName: $scope.selectedUnit.shortName,
|
unitName: $scope.selectedUnit.shortName,
|
||||||
|
|
@ -83,12 +84,7 @@ angular.module('copayApp.controllers').controller('MoreController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.deleteWallet = function() {
|
$scope.deleteWallet = function() {
|
||||||
$rootScope.iden.deleteWallet(w.id, function() {
|
controllerUtils.deleteWallet($scope);
|
||||||
notification.info('Wallet deleted', $filter('translate')('wallet deleted'));
|
|
||||||
$rootScope.wallet = null;
|
|
||||||
var lastFocused = $rootScope.iden.profile.getLastFocusedWallet();
|
|
||||||
controllerUtils.bindProfile($scope, $rootScope.iden, lastFocused);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.purge = function(deleteAll) {
|
$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');
|
notification.warning('Session closed', 'Session closed because a long time of inactivity');
|
||||||
});
|
});
|
||||||
$scope.$on('$keepalive', function() {
|
$scope.$on('$keepalive', function() {
|
||||||
$rootScope.wallet.keepAlive();
|
if ($rootScope.wallet) {
|
||||||
|
$rootScope.wallet.keepAlive();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,16 @@ angular.module('copayApp.services')
|
||||||
$rootScope.pendingTxCount = pendingForUs;
|
$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) {
|
function getActionList(actions) {
|
||||||
var peers = Object.keys(actions).map(function(i) {
|
var peers = Object.keys(actions).map(function(i) {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -9,14 +9,13 @@
|
||||||
{{$root.wallet.getName()}}
|
{{$root.wallet.getName()}}
|
||||||
<small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small>
|
<small>{{$root.wallet.requiredCopayers}}-{{'of'|translate}}-{{$root.wallet.totalCopayers}}</small>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="panel">
|
<div class="panel oh">
|
||||||
<qrcode size="350" data="{{$root.wallet.getSecret()}}"></qrcode>
|
<qrcode size="350" data="{{$root.wallet.getSecret()}}"></qrcode>
|
||||||
<div class="secret">
|
<div class="secret">
|
||||||
<h2 translate>Share this secret with your other copayers</h2>
|
<h2 translate>Share this secret with your other copayers</h2>
|
||||||
{{$root.wallet.getSecret()}}
|
{{$root.wallet.getSecret()}}
|
||||||
<span class="btn-copy" clip-copy="$root.wallet.getSecret()"></span>
|
<span class="btn-copy" clip-copy="$root.wallet.getSecret()"></span>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear:both;"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h1 ng-if="$root.wallet &&
|
<h1 ng-if="$root.wallet &&
|
||||||
|
|
@ -52,7 +51,9 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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"
|
<button class="button primary right m0"
|
||||||
ng-click="backup()"
|
ng-click="backup()"
|
||||||
ng-show="!$root.wallet.publicKeyRing.isBackupReady() && !hideViewBackup"
|
ng-show="!$root.wallet.publicKeyRing.isBackupReady() && !hideViewBackup"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue