From e21592dec8c05a5ef3f86bbe854af4584be8db79 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 2 Aug 2018 20:43:18 +1200 Subject: [PATCH 1/7] UI for crypto fee. --- src/js/controllers/review.controller.js | 39 +++++++++++++++++++++++-- www/views/review.html | 7 ++--- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/js/controllers/review.controller.js b/src/js/controllers/review.controller.js index b81645488..f42d25350 100644 --- a/src/js/controllers/review.controller.js +++ b/src/js/controllers/review.controller.js @@ -4,7 +4,7 @@ angular .module('copayApp.controllers') .controller('reviewController', reviewController); -function reviewController(addressbookService, configService, profileService, $log, $scope, txFormatService) { +function reviewController(addressbookService, configService, $ionicConfig, $log, profileService, $scope, txFormatService) { var vm = this; vm.destination = { @@ -18,7 +18,14 @@ function reviewController(addressbookService, configService, profileService, $lo kind: '', // 'address', 'contact', 'wallet' name: '' }; - vm.feeCrypto = ''; + vm.fee = { + cryptoAmount: '', + cryptoCurrencyCode: '', + cryptoDescription: '', + fiatAmount: '', + fiatCurrency: '' + }; + vm.fee vm.feeFiat = ''; vm.origin = { balanceAmount: '', @@ -34,6 +41,7 @@ function reviewController(addressbookService, configService, profileService, $lo vm.secondaryCurrency = ''; var config = null; + var configFeeLevel = ''; var coin = ''; var originWalletId = ''; var priceDisplayIsFiat = true; @@ -43,11 +51,25 @@ function reviewController(addressbookService, configService, profileService, $lo $scope.$on("$ionicView.beforeEnter", onBeforeEnter); + $scope.$on("$ionicView.beforeLeave", onBeforeLeave); + $scope.$on("$ionicView.enter", onEnter); + function onBeforeEnter(event, data) { + // Dummy values for testing + vm.fee = { + cryptoAmount: '0.00195823', + cryptoCurrencyCode: 'BCH', + cryptoDescription: 'Less than 1 cent', + fiatAmount: '', + fiatCurrency: '' + }; + originWalletId = data.stateParams.fromWalletId; + // For testing only + //originWalletId = data.stateParams.fromWalletId || 'bf00af8f-0788-4b57-b30a-0390747407e9'; satoshis = parseInt(data.stateParams.amount, 10); toAddress = data.stateParams.toAddr; @@ -65,12 +87,23 @@ function reviewController(addressbookService, configService, profileService, $lo priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat'; vm.origin.currencyColor = originWallet.coin === 'btc' ? config.bitcoinWalletColor : config.bitcoinCashWalletColor; } + + configFeeLevel = config.wallet.settings.feeLevel ? config.wallet.settings.feeLevel : 'normal'; + updateSendAmounts(); getOriginWalletBalance(originWallet); handleDestinationAsAddress(toAddress, coin); handleDestinationAsWallet(data.stateParams.toWalletId); }); - } + } + + function onBeforeLeave(event, data) { + $ionicConfig.views.swipeBackEnabled(true); + } + + function onEnter(event, data) { + $ionicConfig.views.swipeBackEnabled(false); + }; function getOriginWalletBalance(originWallet) { var balanceText = getWalletBalanceDisplayText(originWallet); diff --git a/www/views/review.html b/www/views/review.html index 36bb67410..f8b44c19a 100644 --- a/www/views/review.html +++ b/www/views/review.html @@ -73,11 +73,8 @@
Fee: Less than 1 cent
-
- +
+ {{vm.fee.cryptoAmount}} {{vm.fee.cryptoCurrencyCode}}
From 85a74bbd0e2f292035f471c591fc5cd3c5f1494c Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Thu, 2 Aug 2018 21:11:28 +1200 Subject: [PATCH 2/7] UI for crypto fee warning. --- src/js/controllers/review.controller.js | 10 ++++++---- www/views/review.html | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/review.controller.js b/src/js/controllers/review.controller.js index f42d25350..5bf032fbd 100644 --- a/src/js/controllers/review.controller.js +++ b/src/js/controllers/review.controller.js @@ -21,9 +21,10 @@ function reviewController(addressbookService, configService, $ionicConfig, $log, vm.fee = { cryptoAmount: '', cryptoCurrencyCode: '', - cryptoDescription: '', + description: '', fiatAmount: '', - fiatCurrency: '' + fiatCurrency: '', + high: false }; vm.fee vm.feeFiat = ''; @@ -62,9 +63,10 @@ function reviewController(addressbookService, configService, $ionicConfig, $log, vm.fee = { cryptoAmount: '0.00195823', cryptoCurrencyCode: 'BCH', - cryptoDescription: 'Less than 1 cent', + description: 'Less than 1 cent', fiatAmount: '', - fiatCurrency: '' + fiatCurrency: '', + high: false }; originWalletId = data.stateParams.fromWalletId; diff --git a/www/views/review.html b/www/views/review.html index f8b44c19a..20cb2bd2d 100644 --- a/www/views/review.html +++ b/www/views/review.html @@ -72,7 +72,9 @@
-
Fee: Less than 1 cent
+
+ Fee: {{vm.fee.description}}{{vm.fee.fiatAmount}} {{vm.fee.fiatCurrency}} +
{{vm.fee.cryptoAmount}} {{vm.fee.cryptoCurrencyCode}}
From 947c2d324f4103c34a0f7a03e2f3f642b1c746ac Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Tue, 14 Aug 2018 11:38:24 +0900 Subject: [PATCH 3/7] Upgrade text --- i18n/po/template.pot | 2 +- src/js/controllers/walletSelectorController.js | 4 ++-- www/views/tab-send.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n/po/template.pot b/i18n/po/template.pot index d8281988f..725aa3de7 100644 --- a/i18n/po/template.pot +++ b/i18n/po/template.pot @@ -2631,7 +2631,7 @@ msgid "Paste Address" msgstr "" #: www/views/tab-send.html:27 -msgid "Wallet to Wallet Transfer" +msgid "Transfer between wallets" msgstr "" #: www/views/tab-send.html:35 diff --git a/src/js/controllers/walletSelectorController.js b/src/js/controllers/walletSelectorController.js index a4ff3ab3e..42506dace 100644 --- a/src/js/controllers/walletSelectorController.js +++ b/src/js/controllers/walletSelectorController.js @@ -15,11 +15,11 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu switch($state.current.name) { case 'tabs.send.wallet-to-wallet': - $scope.sendFlowTitle = gettextCatalog.getString('Wallet to Wallet Transfer'); + $scope.sendFlowTitle = gettextCatalog.getString('Transfer between wallets'); break; case 'tabs.send.destination': if (data.stateParams.fromWalletId) { - $scope.sendFlowTitle = gettextCatalog.getString('Wallet to Wallet Transfer'); + $scope.sendFlowTitle = gettextCatalog.getString('Transfer between wallets'); } break; default: diff --git a/www/views/tab-send.html b/www/views/tab-send.html index 20198c7f0..8f1fc1a93 100644 --- a/www/views/tab-send.html +++ b/www/views/tab-send.html @@ -24,7 +24,7 @@
From cf6658c83afa08e8028656e937640b66e79b50b7 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Tue, 14 Aug 2018 14:48:07 +1200 Subject: [PATCH 4/7] Removed $apply() inside $watch. --- src/js/directives/formattedAmount.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/directives/formattedAmount.js b/src/js/directives/formattedAmount.js index f81615593..5ee9be050 100644 --- a/src/js/directives/formattedAmount.js +++ b/src/js/directives/formattedAmount.js @@ -165,7 +165,6 @@ break; } $scope.canShow = true; - $scope.$apply(); }; function getDecimalPlaces(currency) { From 05e204dec897f87c222c5e977f793fb0779c3c64 Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Tue, 14 Aug 2018 16:58:13 +1200 Subject: [PATCH 5/7] Changed the review controller to allow the transaction to be shared, once successful. --- src/js/controllers/review.controller.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/js/controllers/review.controller.js b/src/js/controllers/review.controller.js index c1f120241..788368e9e 100644 --- a/src/js/controllers/review.controller.js +++ b/src/js/controllers/review.controller.js @@ -4,7 +4,7 @@ angular .module('copayApp.controllers') .controller('reviewController', reviewController); -function reviewController(addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) { +function reviewController(addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, clipboardService, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, ionicToast, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) { var vm = this; vm.buttonText = ''; @@ -52,6 +52,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit // Functions vm.goBack = goBack; vm.onSuccessConfirm = onSuccessConfirm; + vm.onShareTransaction = onShareTransaction; var sendFlowData; var config = null; @@ -62,6 +63,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit var usingCustomFee = false; var usingMerchantFee = false; var destinationWalletId = ''; + var lastTxId = ''; var originWalletId = ''; var priceDisplayIsFiat = true; var satoshis = null; @@ -156,6 +158,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit txConfirmNotification.subscribe(vm.originWallet, { txid: txp.txid }); + lastTxId = txp.txid; } }, statusChangeHandler); }; @@ -522,6 +525,21 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit } } + function onShareTransaction() { + var explorerTxUrl = 'https://explorer.bitcoin.com/' + tx.coin + '/tx/' + lastTxId; + if (platformInfo.isCordova) { + var text = gettextCatalog.getString('Take a look at this Bitcoin Cash transaction here: ') + explorerTxUrl; + if (coin === 'btc') { + text = gettextCatalog.getString('Take a look at this Bitcoin transaction here: ') + explorerTxUrl; + } + window.plugins.socialsharing.share(text, null, null, null); + } else { + ionicToast.show(gettextCatalog.getString('Copied to clipboard'), 'bottom', false, 3000); + clipboardService.copyToClipboard(explorerTxUrl); + } + + } + function startExpirationTimer(expirationTime) { vm.paymentExpired = false; setExpirationTime(); From 197ee9eeeb49e216192b4dab37261a7929bf796b Mon Sep 17 00:00:00 2001 From: Brendon Duncan Date: Tue, 14 Aug 2018 17:24:17 +1200 Subject: [PATCH 6/7] Fix for the Custom Amount screen now following the price display setting. --- www/views/customAmount.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/views/customAmount.html b/www/views/customAmount.html index a7130a729..079a5543d 100644 --- a/www/views/customAmount.html +++ b/www/views/customAmount.html @@ -31,13 +31,13 @@

-
+
-
+
From f18546b8d639f383d81c59df6a91e67388c06056 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Tue, 14 Aug 2018 16:48:55 +0900 Subject: [PATCH 7/7] Update appConfig.json --- app-template/bitcoincom/appConfig.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app-template/bitcoincom/appConfig.json b/app-template/bitcoincom/appConfig.json index 084a586ce..4b3281f6e 100644 --- a/app-template/bitcoincom/appConfig.json +++ b/app-template/bitcoincom/appConfig.json @@ -24,9 +24,9 @@ "windowsAppId": "804636ee-b017-4cad-8719-e58ac97ffa5c", "pushSenderId": "1036948132229", "description": "A Secure Bitcoin Wallet", - "version": "4.13.2", - "fullVersion": "4.13-rc3", - "androidVersion": "413200", + "version": "5.0.0", + "fullVersion": "5.0-rc1", + "androidVersion": "500000", "_extraCSS": "", "_enabledExtensions": { "coinbase": false,