persist balance hidden on local storage
This commit is contained in:
parent
e73091ae46
commit
a2261ae572
2 changed files with 16 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, storageService, $ionicPopup) {
|
||||
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup) {
|
||||
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isWP = platformInfo.isWP;
|
||||
|
|
@ -176,7 +176,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
}
|
||||
|
||||
$scope.hideToggle = function() {
|
||||
profileService.setHideBalanceFlag(wallet.credentials.walletId);
|
||||
profileService.setHideBalanceFlag(wallet.credentials.walletId, function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
var currentTxHistoryPage;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,13 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
function _balanceIsHidden(wallet, cb) {
|
||||
storageService.getHideBalanceFlag(wallet.credentials.walletId, function(err, shouldHideBalance) {
|
||||
if (err) $log.error(err);
|
||||
var hideBalance = (shouldHideBalance == 'true') ? true : false;
|
||||
return cb(hideBalance);
|
||||
});
|
||||
};
|
||||
// Adds a wallet client to profileService
|
||||
root.bindWalletClient = function(wallet, opts) {
|
||||
var opts = opts || {};
|
||||
|
|
@ -90,6 +97,10 @@ angular.module('copayApp.services')
|
|||
wallet.needsBackup = val;
|
||||
});
|
||||
|
||||
_balanceIsHidden(wallet, function(val) {
|
||||
wallet.balanceHidden = val;
|
||||
});
|
||||
|
||||
wallet.removeAllListeners();
|
||||
|
||||
wallet.on('report', function(n) {
|
||||
|
|
@ -729,6 +740,7 @@ angular.module('copayApp.services')
|
|||
|
||||
root.setHideBalanceFlag = function(walletId) {
|
||||
root.wallet[walletId].balanceHidden = !root.wallet[walletId].balanceHidden;
|
||||
storageService.setHideBalanceFlag(walletId, root.wallet[walletId].balanceHidden.toString(), cb);
|
||||
}
|
||||
|
||||
return root;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue