diff --git a/src/js/controllers/customAmount.js b/src/js/controllers/customAmount.js index a58f9767b..af0a8525b 100644 --- a/src/js/controllers/customAmount.js +++ b/src/js/controllers/customAmount.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('copayApp.controllers').controller('customAmountController', function($scope, $ionicHistory, txFormatService, platformInfo, configService, profileService, walletService, popupService) { +angular.module('copayApp.controllers').controller('customAmountController', function($scope, $ionicHistory, txFormatService, platformInfo, configService, profileService, walletService, popupService, bitcoinCashJsService) { var showErrorAndBack = function(title, msg) { popupService.showAlert(title, msg, function() { @@ -32,7 +32,20 @@ angular.module('copayApp.controllers').controller('customAmountController', func return; } - $scope.address = addr; + $scope.bchAddressType = 'cashaddr'; + var bchAddresses = {}; + + if ($scope.wallet.coin == 'bch') { + bchAddresses = bitcoinCashJsService.translateAddresses(addr); + $scope.address = bchAddresses[$scope.bchAddressType]; + } else { + $scope.address = addr; + } + + $scope.displayAddress = function(type) { + $scope.bchAddressType = type; + $scope.address = bchAddresses[$scope.bchAddressType]; + } $scope.coin = data.stateParams.coin; var parsedAmount = txFormatService.parseAmount( @@ -76,9 +89,11 @@ angular.module('copayApp.controllers').controller('customAmountController', func } $scope.copyToClipboard = function() { - var protocol = 'bitcoin'; - if ($scope.wallet.coin == 'bch') protocol += 'cash'; - return protocol + ':' + $scope.address + '?amount=' + $scope.amountBtc; + var protocol = ''; + if ($scope.wallet.coin == 'bch' && $scope.bchAddressType == 'cashaddr') { + protocol = 'bitcoincash:'; + } + return protocol + $scope.address + '?amount=' + $scope.amountBtc; }; }); diff --git a/src/sass/views/custom-amount.scss b/src/sass/views/custom-amount.scss index 3576e56a0..b9bf65459 100644 --- a/src/sass/views/custom-amount.scss +++ b/src/sass/views/custom-amount.scss @@ -13,10 +13,17 @@ font-size: 26px; } } + .button-address { + margin-top: 10px; + background: transparent; + border: none; + font-size: 12px; + color: $v-text-accent-color; + } .address { background: #fff; overflow: auto; - height: 100%; + height: 100%; .qr-code { text-align: center; margin-top: 24vh; @@ -31,7 +38,7 @@ margin-top: 8vh; } } - .info { + .info { position: absolute; width: 100%; bottom: 0; @@ -81,5 +88,8 @@ } } } + .address-types { + text-align: center; + } } } diff --git a/www/views/customAmount.html b/www/views/customAmount.html index a9a5e978d..01956c287 100644 --- a/www/views/customAmount.html +++ b/www/views/customAmount.html @@ -23,8 +23,25 @@