Merge pull request #17 from gabrielbazan7/feat/hiddenBalance
Feat/hidden balance
This commit is contained in:
commit
970ff5e277
4 changed files with 26 additions and 14 deletions
|
|
@ -50,9 +50,12 @@
|
|||
<span class="badge badge-assertive" ng-show="!item.isComplete()" translate>
|
||||
Incomplete
|
||||
</span>
|
||||
<span class="item-note" ng-show="item.isComplete()">
|
||||
<span class="item-note" ng-show="item.isComplete() && !item.balanceHidden">
|
||||
{{item.status.availableBalanceStr}}
|
||||
</span>
|
||||
<span class="item-note" ng-show="item.isComplete() && item.balanceHidden">
|
||||
<strong class="size-12" translate>[Balance Hidden]</strong>
|
||||
</span>
|
||||
</a>
|
||||
<a ui-sref="bitpayCard.main" ng-show="externalServices.BitpayCard" class="item item-icon-left">
|
||||
<i class="icon ion-card"></i>BitPay Card
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
</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>
|
||||
<div class="size-14" ng-if="status.totalBalanceAlternative">{{status.totalBalanceAlternative}} {{status.alternativeIsoCode}}</div>
|
||||
<div class="size-14" ng-if="status.pendingAmount">
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
</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>
|
||||
<div class="size-14" translate>
|
||||
Tap and hold to show
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -175,16 +175,10 @@ 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.toggleHideBalanceFlag(wallet.credentials.walletId, function(err) {
|
||||
if (err) $log.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
var currentTxHistoryPage;
|
||||
|
|
@ -204,7 +198,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() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
@ -727,5 +738,10 @@ angular.module('copayApp.services')
|
|||
}, 'createdOn']);
|
||||
};
|
||||
|
||||
root.toggleHideBalanceFlag = function(walletId, cb) {
|
||||
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