diff --git a/public/views/preferencesInformation.html b/public/views/preferencesInformation.html index a992ec7a0..56eedefc4 100644 --- a/public/views/preferencesInformation.html +++ b/public/views/preferencesInformation.html @@ -96,7 +96,6 @@ - + +

diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index f00b34a3e..947fd2952 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1007,6 +1007,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r }; + $rootScope.$on('Local/ClearHistory', function(event) { + $log.debug('The wallet transaction history has been deleted'); + self.txHistory = []; + self.updateHistory(); + }); + // UX event handlers $rootScope.$on('Local/ColorUpdated', function(event) { self.updateColor(); @@ -1259,4 +1265,4 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.setFocusedWallet(); }); }); -}); \ No newline at end of file +}); diff --git a/src/js/controllers/preferencesInformation.js b/src/js/controllers/preferencesInformation.js index cec749ac7..3969f26b5 100644 --- a/src/js/controllers/preferencesInformation.js +++ b/src/js/controllers/preferencesInformation.js @@ -1,12 +1,12 @@ 'use strict'; angular.module('copayApp.controllers').controller('preferencesInformation', - function($scope, $log, $timeout, isMobile, gettextCatalog, lodash, profileService) { + function($scope, $log, $timeout, isMobile, gettextCatalog, lodash, profileService, storageService, go) { var base = 'xpub'; + var fc = profileService.focusedClient; + var c = fc.credentials; this.init = function() { - var fc = profileService.focusedClient; - var c = fc.credentials; var basePath = profileService.getUtils().getBaseAddressDerivationPath(c.derivationStrategy, c.network, 0); $scope.walletName = c.walletName; @@ -28,8 +28,8 @@ angular.module('copayApp.controllers').controller('preferencesInformation', return; }; var last10 = [], - i = 0, - e = addrs.pop(); + i = 0, + e = addrs.pop(); while (i++ < 10 && e) { e.path = base + e.path.substring(1); last10.push(e); @@ -45,7 +45,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation', this.sendAddrs = function() { var self = this; - var fc = profileService.focusedClient; if (isMobile.Android() || isMobile.Windows()) { window.ignoreMobilePause = true; @@ -94,4 +93,19 @@ angular.module('copayApp.controllers').controller('preferencesInformation', }); }, 100); }; + + this.clearTransactionHistory = function() { + storageService.removeTxHistory(c.walletId, function(err) { + if (err) { + $log.error(err); + return; + } + + $scope.$emit('Local/ClearHistory'); + + $timeout(function() { + go.walletHome(); + }, 100); + }); + } });