hidden balance feature refactor

This commit is contained in:
Gabriel Bazán 2016-08-31 11:49:28 -03:00
commit e73091ae46
4 changed files with 11 additions and 13 deletions

View file

@ -175,16 +175,8 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.updateTxHistory(cb);
}
var hideBalance = function() {
storageService.getHideBalanceFlag(wallet.credentials.walletId, function(err, shouldHideBalance) {
if (err) $scope.shouldHideBalance = false;
else $scope.shouldHideBalance = (shouldHideBalance == 'true') ? true : false;
});
}
$scope.hideToggle = function() {
$scope.shouldHideBalance = !$scope.shouldHideBalance;
storageService.setHideBalanceFlag(wallet.credentials.walletId, $scope.shouldHideBalance.toString(), function() {});
profileService.setHideBalanceFlag(wallet.credentials.walletId);
}
var currentTxHistoryPage;
@ -204,7 +196,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.requiresMultipleSignatures = wallet.credentials.m > 1;
$scope.newTx = false;
hideBalance();
$ionicNavBarDelegate.title(wallet.name);
$scope.updateAll(function() {

View file

@ -727,5 +727,9 @@ angular.module('copayApp.services')
}, 'createdOn']);
};
root.setHideBalanceFlag = function(walletId) {
root.wallet[walletId].balanceHidden = !root.wallet[walletId].balanceHidden;
}
return root;
});