mirror of https://github.com/BTCPrivate/copay.git
refactor clear history method call
This commit is contained in:
parent
c20cccedc2
commit
7c21793236
|
@ -113,7 +113,7 @@
|
|||
<ul class="no-bullet m0 size-14">
|
||||
<h4 class="title m0" translate>Transaction history</h4>
|
||||
<li class="line-b p20 oh">
|
||||
<button class="black round small expand" ng-style="{'background-color':index.backgroundColor}" ng-click="info.clearTransactionHistory(); index.clearHistoryFeedback();">
|
||||
<button class="black round small expand" ng-style="{'background-color':index.backgroundColor}" ng-click="info.clearTransactionHistory();">
|
||||
<span translate>Clear history</span>
|
||||
</button>
|
||||
</li>
|
||||
|
|
|
@ -910,19 +910,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
});
|
||||
};
|
||||
|
||||
self.clearHistoryFeedback = function() {
|
||||
self.txHistory = [];
|
||||
$log.debug('The wallet transaction history has been deleted');
|
||||
self.setOngoingProcess('deletingHistory', true);
|
||||
|
||||
self.updateHistory();
|
||||
go.walletHome();
|
||||
|
||||
$timeout(function() {
|
||||
self.setOngoingProcess('deletingHistory', false);
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
self.setUxLanguage = function() {
|
||||
var userLang = uxLanguage.update();
|
||||
self.defaultLanguageIsoCode = userLang;
|
||||
|
@ -1018,6 +1005,16 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
|||
};
|
||||
|
||||
// UX event handlers
|
||||
$rootScope.$on('Local/ClearHistory', function(event, walletId) {
|
||||
storageService.removeTxHistory(walletId, function(err) {
|
||||
if (err) root.showErrorPopup(err);
|
||||
|
||||
$log.debug('The wallet transaction history has been deleted');
|
||||
self.txHistory = [];
|
||||
self.updateHistory();
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.$on('Local/ColorUpdated', function(event) {
|
||||
self.updateColor();
|
||||
$timeout(function() {
|
||||
|
|
|
@ -95,8 +95,13 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
|
|||
};
|
||||
|
||||
this.clearTransactionHistory = function() {
|
||||
storageService.removeTxHistory(c.walletId, function() {
|
||||
return;
|
||||
storageService.removeTxHistory(c.walletId, function(err) {
|
||||
if (err) return $log.err(err);
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$emit('Local/ClearHistory');
|
||||
go.walletHome();
|
||||
}, 100);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue