Merge pull request #145 from Bitcoin-com/wallet/task/319
Wallet/task/319
This commit is contained in:
commit
706ba298fb
8 changed files with 40 additions and 9 deletions
|
|
@ -205,6 +205,8 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
}
|
||||
});
|
||||
|
||||
$scope.displayBalanceAsFiat = walletConfig.settings.priceDisplay === 'fiat';
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
var currentAddressSocket = {};
|
||||
var paymentSubscriptionObj = { op:"addr_sub" }
|
||||
|
||||
$scope.displayBalanceAsFiat = true;
|
||||
|
||||
$scope.requestSpecificAmount = function() {
|
||||
$state.go('tabs.paymentRequest.amount', {
|
||||
id: $scope.wallet.credentials.walletId,
|
||||
|
|
@ -212,6 +214,10 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
if ($scope.wallet && walletId == $scope.wallet.id && type == 'NewIncomingTx') $scope.setAddress(true);
|
||||
})
|
||||
];
|
||||
|
||||
configService.whenAvailable(function(config) {
|
||||
$scope.displayBalanceAsFiat = config.wallet.settings.priceDisplay === 'fiat';
|
||||
});
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
|
|
|
|||
|
|
@ -72,15 +72,22 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
return item.network == 'livenet';
|
||||
});
|
||||
}
|
||||
|
||||
var walletList = [];
|
||||
lodash.each(walletsToTransfer, function(v) {
|
||||
var displayBalanceAsFiat =
|
||||
v.status.alternativeBalanceAvailable &&
|
||||
config.wallet.settings.priceDisplay === 'fiat';
|
||||
|
||||
walletList.push({
|
||||
color: v.color,
|
||||
name: v.name,
|
||||
recipientType: 'wallet',
|
||||
coin: v.coin,
|
||||
network: v.network,
|
||||
balanceString: v.cachedBalance,
|
||||
balanceString: displayBalanceAsFiat ?
|
||||
v.status.totalBalanceAlternative + ' ' + v.status.alternativeIsoCode :
|
||||
v.cachedBalance,
|
||||
getAddress: function(cb) {
|
||||
walletService.getAddress(v, false, cb);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ angular.module('copayApp.directives')
|
|||
show: '=walletSelectorShow',
|
||||
wallets: '=walletSelectorWallets',
|
||||
selectedWallet: '=walletSelectorSelectedWallet',
|
||||
onSelect: '=walletSelectorOnSelect'
|
||||
onSelect: '=walletSelectorOnSelect',
|
||||
displayBalanceAsFiat : '=walletSelectorDisplayBalanceAsFiat'
|
||||
},
|
||||
link: function(scope, element, attrs) {
|
||||
scope.hide = function() {
|
||||
|
|
|
|||
|
|
@ -932,8 +932,17 @@ angular.module('copayApp.services')
|
|||
x.txid = x.data ? x.data.txid : null;
|
||||
x.types = [x.type];
|
||||
|
||||
if (x.data && x.data.amount)
|
||||
if (x.data && x.data.amount) {
|
||||
// Default to showing amount in crypto because we have that now
|
||||
x.amountStr = txFormatService.formatAmountStr(x.wallet.coin, x.data.amount);
|
||||
configService.whenAvailable(function(config) {
|
||||
if (config.wallet.settings.priceDisplay === "fiat") {
|
||||
txFormatService.formatAlternativeStr(x.wallet.coin, x.data.amount, function(formattedString) {
|
||||
x.amountStr = formattedString;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
x.action = function() {
|
||||
// TODO?
|
||||
|
|
|
|||
|
|
@ -131,7 +131,8 @@
|
|||
wallet-selector-wallets="wallets"
|
||||
wallet-selector-selected-wallet="wallet"
|
||||
wallet-selector-show="walletSelector"
|
||||
wallet-selector-on-select="onWalletSelect">
|
||||
wallet-selector-on-select="onWalletSelect"
|
||||
wallet-selector-display-balance-as-fiat="displayBalanceAsFiat">
|
||||
</wallet-selector>
|
||||
|
||||
</ion-view>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
<img class="back-arrow" src="img/icon-back-arrow.svg" ng-click="hide()">
|
||||
|
||||
<span ng-repeat="wallet in wallets track by $index"
|
||||
ng-init="wallet.coin == 'btc' ? walletsBtc.push(wallet) : walletsBch.push(wallet)"></span>
|
||||
ng-init="wallet.coin == 'btc' ? walletsBtc.push(wallet) : walletsBch.push(wallet)">
|
||||
</span>
|
||||
|
||||
<div class="header" ng-if="!walletsBtc[0] || !walletsBch[0]">{{title}}</div>
|
||||
|
||||
|
|
@ -26,7 +27,8 @@
|
|||
Incomplete
|
||||
</span>
|
||||
<span ng-if="wallet.isComplete()">
|
||||
<span ng-if="!wallet.balanceHidden">{{wallet.status.availableBalanceStr}}</span>
|
||||
<span ng-if="displayBalanceAsFiat && !wallet.balanceHidden">{{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}}</span>
|
||||
<span ng-if="!displayBalanceAsFiat && !wallet.balanceHidden">{{wallet.status.availableBalanceStr}}</span>
|
||||
<span ng-if="wallet.balanceHidden" translate>[Balance Hidden]</span>
|
||||
</span>
|
||||
</span>
|
||||
|
|
@ -57,7 +59,8 @@
|
|||
Incomplete
|
||||
</span>
|
||||
<span ng-if="wallet.isComplete()">
|
||||
<span ng-if="!wallet.balanceHidden">{{wallet.status.availableBalanceStr}}</span>
|
||||
<span ng-if="displayBalanceAsFiat && !wallet.balanceHidden">{{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}}</span>
|
||||
<span ng-if="!displayBalanceAsFiat && !wallet.balanceHidden">{{wallet.status.availableBalanceStr}}</span>
|
||||
<span ng-if="wallet.balanceHidden" translate>[Balance Hidden]</span>
|
||||
</span>
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -94,7 +94,8 @@
|
|||
{{wallet.name || wallet.id}}
|
||||
</span>
|
||||
<p>
|
||||
<span ng-if="!wallet.balanceHidden"> {{wallet.status.totalBalanceStr}} </span>
|
||||
<span ng-if="displayBalanceAsFiat && !wallet.balanceHidden" translate> {{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} </span>
|
||||
<span ng-if="!displayBalanceAsFiat && !wallet.balanceHidden"> {{wallet.status.totalBalanceStr}} </span>
|
||||
|
||||
<span ng-if="wallet.balanceHidden" translate>[Balance Hidden]</span>
|
||||
<span class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1">
|
||||
|
|
@ -113,6 +114,7 @@
|
|||
wallet-selector-wallets="wallets"
|
||||
wallet-selector-selected-wallet="wallet"
|
||||
wallet-selector-show="showWallets"
|
||||
wallet-selector-on-select="onWalletSelect">
|
||||
wallet-selector-on-select="onWalletSelect"
|
||||
wallet-selector-display-balance-as-fiat="displayBalanceAsFiat">
|
||||
</wallet-selector>
|
||||
</ion-view>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue