Ref delete wallet

This commit is contained in:
Gustavo Maximiliano Cortez 2015-11-06 16:54:25 -03:00
commit 1d064d1ee1
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 22 additions and 8 deletions

View file

@ -53,12 +53,9 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
if (err) {
self.error = err.message || err;
} else {
storageService.removeTxHistory(fc.credentials.walletId, function() {
notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {
walletName: walletName
}));
return;
});
notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {
walletName: walletName
}));
}
});
};

View file

@ -303,16 +303,29 @@ angular.module('copayApp.services')
root.deleteWalletFC = function(opts, cb) {
var fc = root.focusedClient;
var walletId = fc.credentials.walletId;
$log.debug('Deleting Wallet:', fc.credentials.walletName);
fc.removeAllListeners();
root.profile.credentials = lodash.reject(root.profile.credentials, {
walletId: fc.credentials.walletId
walletId: walletId
});
delete root.walletClients[fc.credentials.walletId];
delete root.walletClients[walletId];
root.focusedClient = null;
storageService.clearLastAddress(walletId, function(err) {
if (err) $log.warn(err);
});
storageService.removeTxHistory(walletId, function(err) {
if (err) $log.warn(err);
});
storageService.clearBackupFlag(walletId, function(err) {
if (err) $log.warn(err);
});
$timeout(function() {
root.setWalletClients();
root.setAndStoreFocus(null, function() {

View file

@ -159,6 +159,10 @@ angular.module('copayApp.services')
storage.get('backup-' + walletId, cb);
};
root.clearBackupFlag = function(walletId, cb) {
storage.remove('backup-' + walletId, cb);
};
root.setCleanAndScanAddresses = function(walletId, cb) {
storage.set('CleanAndScanAddresses', walletId, cb);
};