From e4d51007530873d3496e6f21e577cacc4d0a5955 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Tue, 22 May 2018 19:29:57 -0700 Subject: [PATCH 1/9] Initial change for displaying fiat in "Recent Transactions". Does not yet display loading UI. --- src/js/services/profileService.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 068c3b2ae..ecf761b53 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -932,8 +932,19 @@ angular.module('copayApp.services') x.txid = x.data ? x.data.txid : null; x.types = [x.type]; - if (x.data && x.data.amount) - x.amountStr = txFormatService.formatAmountStr(x.wallet.coin, x.data.amount); + if (x.data && x.data.amount) { + x.amountStr = null; // Will have loading state in view + configService.whenAvailable(function(config) { + if (config.wallet.settings.priceDisplay === "fiat") { + txFormatService.formatAlternativeStr(x.wallet.coin, x.data.amount, function(formattedString) { + x.amountStr = formattedString; + // Will I need an apply() after this? + }); + } else { + x.amountStr = txFormatService.formatAmountStr(x.wallet.coin, x.data.amount); + } + }); + } x.action = function() { // TODO? From 429e9c8446ca0d2db2e1b3ee5575e0218641c3b7 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Wed, 23 May 2018 18:04:42 -0700 Subject: [PATCH 2/9] In Recent Transactions it displays the crypto amount if the fiat display setting is selected but the fiat amount is not ready yet. --- src/js/services/profileService.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index ecf761b53..dac88169f 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -933,15 +933,13 @@ angular.module('copayApp.services') x.types = [x.type]; if (x.data && x.data.amount) { - x.amountStr = null; // Will have loading state in view + // 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; - // Will I need an apply() after this? }); - } else { - x.amountStr = txFormatService.formatAmountStr(x.wallet.coin, x.data.amount); } }); } From e5734cf0833a9773307d1e31ccd6ee5f5558009f Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 24 May 2018 11:54:58 -0700 Subject: [PATCH 3/9] Wallet balance display on the Receive tab now adheres to the Price Display setting. --- src/js/controllers/tab-receive.js | 6 ++++++ www/views/tab-receive.html | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js index 1eef60954..de5f53abb 100644 --- a/src/js/controllers/tab-receive.js +++ b/src/js/controllers/tab-receive.js @@ -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, @@ -211,6 +213,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) { diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html index d15088e47..23e61b069 100644 --- a/www/views/tab-receive.html +++ b/www/views/tab-receive.html @@ -94,7 +94,8 @@ {{wallet.name || wallet.id}}

- {{wallet.status.totalBalanceStr}} + {{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} + {{wallet.status.totalBalanceStr}} [Balance Hidden] From 05a8952f877f750d185caf09954c26aab7f19151 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 24 May 2018 14:36:51 -0700 Subject: [PATCH 4/9] Displaying fiat amounts in wallet selector in Receive tab. --- src/js/directives/walletSelector.js | 6 +++++- www/views/includes/walletSelector.html | 9 ++++++--- www/views/tab-receive.html | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/js/directives/walletSelector.js b/src/js/directives/walletSelector.js index 256a2c20d..d747ef3e4 100644 --- a/src/js/directives/walletSelector.js +++ b/src/js/directives/walletSelector.js @@ -2,6 +2,9 @@ angular.module('copayApp.directives') .directive('walletSelector', function($rootScope, $timeout, configService) { + + console.log("walletSelector"); + return { restrict: 'E', templateUrl: 'views/includes/walletSelector.html', @@ -11,7 +14,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() { diff --git a/www/views/includes/walletSelector.html b/www/views/includes/walletSelector.html index a53d1c7f1..71ca11a8b 100644 --- a/www/views/includes/walletSelector.html +++ b/www/views/includes/walletSelector.html @@ -2,7 +2,8 @@ + ng-init="wallet.coin == 'btc' ? walletsBtc.push(wallet) : walletsBch.push(wallet)"> +

{{title}}
@@ -26,7 +27,8 @@ Incomplete - {{wallet.status.availableBalanceStr}} + {{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} + {{wallet.status.availableBalanceStr}} [Balance Hidden] @@ -57,7 +59,8 @@ Incomplete - {{wallet.status.availableBalanceStr}} + {{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} + {{wallet.status.availableBalanceStr}} [Balance Hidden] diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html index 23e61b069..cb53dc8e9 100644 --- a/www/views/tab-receive.html +++ b/www/views/tab-receive.html @@ -114,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"> From e0511ccb53adac96407f65ad2fb45dc395c27c39 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 24 May 2018 15:29:59 -0700 Subject: [PATCH 5/9] Dislaying fiat amounts in Send tab, according to Price Display setting. --- src/js/controllers/tab-send.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/tab-send.js b/src/js/controllers/tab-send.js index 65077995f..29f1749cb 100644 --- a/src/js/controllers/tab-send.js +++ b/src/js/controllers/tab-send.js @@ -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); }, From c3347931ef265b69fe19afc2306b5ec8b88e921e Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 24 May 2018 15:54:47 -0700 Subject: [PATCH 6/9] The wallet list in the Confirm screen nows displays balances according to the Price Display setting. --- src/js/controllers/confirm.js | 2 ++ www/views/confirm.html | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/confirm.js b/src/js/controllers/confirm.js index 6ec1d9469..fc92a2287 100644 --- a/src/js/controllers/confirm.js +++ b/src/js/controllers/confirm.js @@ -205,6 +205,8 @@ angular.module('copayApp.controllers').controller('confirmController', function( } }); + $scope.displayBalanceAsFiat = walletConfig.settings.priceDisplay === 'fiat'; + }); diff --git a/www/views/confirm.html b/www/views/confirm.html index 8bed9035f..443043d49 100644 --- a/www/views/confirm.html +++ b/www/views/confirm.html @@ -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"> From 9f1223fd9410f2f7f522f868081c02675f7c4995 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Fri, 25 May 2018 11:40:57 +0900 Subject: [PATCH 7/9] Remove console.log --- src/js/directives/walletSelector.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/js/directives/walletSelector.js b/src/js/directives/walletSelector.js index d747ef3e4..79053f812 100644 --- a/src/js/directives/walletSelector.js +++ b/src/js/directives/walletSelector.js @@ -2,9 +2,6 @@ angular.module('copayApp.directives') .directive('walletSelector', function($rootScope, $timeout, configService) { - - console.log("walletSelector"); - return { restrict: 'E', templateUrl: 'views/includes/walletSelector.html', From a1e321a764274375da96cf7f5c6ed4396ffbe2b5 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Fri, 25 May 2018 11:49:34 +0900 Subject: [PATCH 8/9] Remove parenthesis --- www/views/tab-receive.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/views/tab-receive.html b/www/views/tab-receive.html index cb53dc8e9..4806b0c88 100644 --- a/www/views/tab-receive.html +++ b/www/views/tab-receive.html @@ -95,7 +95,7 @@

{{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} - {{wallet.status.totalBalanceStr}} + {{wallet.status.totalBalanceStr}} [Balance Hidden] From 16550d3b9a658c861fd24ac685ade3847f4ba924 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Fri, 25 May 2018 11:50:00 +0900 Subject: [PATCH 9/9] Remove parenthesis --- www/views/includes/walletSelector.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/views/includes/walletSelector.html b/www/views/includes/walletSelector.html index 71ca11a8b..755331a06 100644 --- a/www/views/includes/walletSelector.html +++ b/www/views/includes/walletSelector.html @@ -28,7 +28,7 @@ {{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} - {{wallet.status.availableBalanceStr}} + {{wallet.status.availableBalanceStr}} [Balance Hidden] @@ -60,7 +60,7 @@ {{wallet.status.totalBalanceAlternative}} {{wallet.status.alternativeIsoCode}} - {{wallet.status.availableBalanceStr}} + {{wallet.status.availableBalanceStr}} [Balance Hidden]