update local storage when a wallet is deleted

This commit is contained in:
Javier 2015-10-13 16:11:07 -03:00
parent 6e355bba3f
commit 061ec1d1fd
2 changed files with 10 additions and 8 deletions

View File

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $rootScope, $filter, $timeout, $modal, $log, notification, profileService, isCordova, go, gettext, gettextCatalog, animationService) {
function($scope, $rootScope, $filter, $timeout, $modal, $log, storageService, notification, profileService, isCordova, go, gettext, gettextCatalog, animationService) {
this.isCordova = isCordova;
this.error = null;
@ -46,14 +46,19 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
var _deleteWallet = function() {
var fc = profileService.focusedClient;
var name = fc.credentials.walletName;
var walletName = (fc.alias||'') + ' [' + name + ']';
var walletName = (fc.alias || '') + ' [' + name + ']';
var self = this;
profileService.deleteWalletFC({}, function(err) {
if (err) {
self.error = err.message || err;
} else {
notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: walletName}));
storageService.removeTxHistory(fc.credentials.walletId, function() {
notification.success(gettextCatalog.getString('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {
walletName: walletName
}));
return;
});
}
});
};

View File

@ -224,12 +224,9 @@ angular.module('copayApp.services')
storage.get('txsHistory-' + walletId, cb);
}
root.setTxHistoryFlag = function(value, walletId, cb) {
storage.set('txsHistoryFlag-' + walletId, value, cb);
root.removeTxHistory = function(walletId, cb) {
storage.remove('txsHistory-' + walletId, cb);
}
root.getTxHistoryFlag = function(walletId, cb) {
storage.get('txsHistoryFlag-' + walletId, cb);
}
return root;
});