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

@ -50,9 +50,12 @@
<span class="badge badge-assertive" ng-show="!item.isComplete()" translate> <span class="badge badge-assertive" ng-show="!item.isComplete()" translate>
Incomplete Incomplete
</span> </span>
<span class="item-note" ng-show="item.isComplete()"> <span class="item-note" ng-show="item.isComplete() && !item.balanceHidden">
{{item.status.availableBalanceStr}} {{item.status.availableBalanceStr}}
</span> </span>
<span class="item-note" ng-show="item.isComplete() && item.balanceHidden">
<strong class="size-12" translate>[Balance Hidden]</strong>
</span>
</a> </a>
<a ui-sref="bitpayCard.main" ng-show="externalServices.BitpayCard" class="item item-icon-left"> <a ui-sref="bitpayCard.main" ng-show="externalServices.BitpayCard" class="item item-icon-left">
<i class="icon ion-card"></i>BitPay Card <i class="icon ion-card"></i>BitPay Card

View file

@ -44,7 +44,7 @@
</div> </div>
<div ng-click='updateAll()' ng-show="!updateStatusError && wallet.walletScanStatus != 'error' && !shouldHideBalance" on-hold="hideToggle()"> <div ng-click='updateAll()' ng-show="!updateStatusError && wallet.walletScanStatus != 'error' && !wallet.balanceHidden" on-hold="hideToggle()">
<strong class="size-36">{{status.totalBalanceStr}}</strong> <strong class="size-36">{{status.totalBalanceStr}}</strong>
<div class="size-14" ng-if="status.totalBalanceAlternative">{{status.totalBalanceAlternative}} {{status.alternativeIsoCode}}</div> <div class="size-14" ng-if="status.totalBalanceAlternative">{{status.totalBalanceAlternative}} {{status.alternativeIsoCode}}</div>
<div class="size-14" ng-if="status.pendingAmount"> <div class="size-14" ng-if="status.pendingAmount">
@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<div ng-show="!updateStatusError && wallet.walletScanStatus != 'error' && shouldHideBalance" on-hold="hideToggle()"> <div ng-show="!updateStatusError && wallet.walletScanStatus != 'error' && wallet.balanceHidden" on-hold="hideToggle()">
<strong class="size-24" translate>[Balance Hidden]</strong> <strong class="size-24" translate>[Balance Hidden]</strong>
<div class="size-14" translate> <div class="size-14" translate>
Tap and hold to show Tap and hold to show

View file

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

View file

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