fixes when deleting wallets

This commit is contained in:
Matias Alejo Garcia 2014-12-02 16:53:24 -03:00
commit 394a5b474a
4 changed files with 29 additions and 11 deletions

View file

@ -63,7 +63,19 @@ angular.module('copayApp.controllers').controller('SidebarController', function(
$scope.walletSelection = false;
$scope.setWallets();
});
iden.on('deleteWallet', function() {
iden.on('walletDeleted', function(wid) {
if (wid == $rootScope.wallet.id) {
copay.logger.debug('Deleted focused wallet:', wid);
// new focus
var newWid = $rootScope.iden.getLastFocusedWalletId();
if (newWid && $rootScope.iden.getWalletById(newWid)) {
identityService.setFocusedWallet(newWid);
} else {
copay.logger.debug('No wallets');
identityService.noFocusedWallet(newWid);
}
}
$scope.walletSelection = false;
$scope.setWallets();
});