Show pasted address instead of always cashaddr format on bch

This commit is contained in:
Sebastiaan Pasma 2018-08-14 15:53:18 +02:00
commit 99d8de02da
No known key found for this signature in database
GPG key ID: 9A2B0C8B95A1D26F
6 changed files with 19 additions and 9 deletions

View file

@ -456,6 +456,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
var confirmData = {
amount: useSendMax ? undefined : satoshis,
displayAddress: passthroughParams.displayAddress,
fromWalletId: passthroughParams.fromWalletId,
sendMax: useSendMax,
toAddress: passthroughParams.toAddress,

View file

@ -19,6 +19,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
kind: '', // 'address', 'contact', 'wallet'
name: ''
};
vm.displayAddress = '';
vm.feeCrypto = '';
vm.feeFiat = '';
vm.fiatCurrency = '';
@ -56,10 +57,9 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
var sendFlowData;
var config = null;
var countDown = null;
var defaults = {};
var coin = '';
var countDown = null;
var defaults = {};
var usingCustomFee = false;
var usingMerchantFee = false;
var destinationWalletId = '';
@ -85,7 +85,8 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
satoshis = parseInt(sendFlowData.amount, 10);
toAddress = sendFlowData.toAddress;
destinationWalletId = sendFlowData.toWalletId;
vm.displayAddress = sendFlowData.displayAddress;
vm.originWallet = profileService.getWallet(originWalletId);
vm.origin.currency = vm.originWallet.coin.toUpperCase();
coin = vm.originWallet.coin;
@ -104,7 +105,7 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat';
vm.origin.currencyColor = (vm.originWallet.coin === 'btc' ? defaults.bitcoinWalletColor : defaults.bitcoinCashWalletColor);
console.log("coin", vm.originWallet.coin, vm.origin.currencyColor, config.bitcoinWalletColor, vm.originWallet.coin === 'btc');
unitFromSat = 1 / config.wallet.settings.unitToSatoshi;
unitFromSat = 1 / config.wallet.settings.unitToSatoshi;
}
updateSendAmounts();
getOriginWalletBalance(vm.originWallet);

View file

@ -11,7 +11,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
root.redir = function(data, serviceId, serviceData) {
var originalAddress = null;
var noPrefixInAddress = 0;
if (data.toLowerCase().indexOf('bitcoin') < 0) {
noPrefixInAddress = 1;
}
@ -83,7 +83,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
// Timeout is required to enable the "Back" button
$timeout(function() {
var params = sendFlowService.getStateClone();
if (amount) {
params.amount = amount;
}
@ -390,6 +390,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
$timeout(function() {
var stateParams = {
toAddress: toAddress,
displayAddress: toAddress,
coin: coin,
noPrefix: 1
};

View file

@ -13,6 +13,7 @@ angular
// even other properties added that this service does not know about. (such as "coin")
state: {
amount: '',
displayAddress: null,
fromWalletId: '',
sendMax: false,
thirdParty: null,
@ -42,6 +43,7 @@ angular
console.log("sendFlow clearCurrent()");
service.state = {
amount: '',
displayAddress: null,
fromWalletId: '',
sendMax: false,
thirdParty: null,

View file

@ -9,8 +9,8 @@
text-overflow: ellipsis;
&.expanded {
white-space: pre-wrap;
word-break: break-all;
white-space: normal;
text-overflow: clip;
}
.prefix {

View file

@ -57,7 +57,12 @@
</div>
<div class="item-content item-content-compact" ng-init="addressExpanded = false" ng-if="vm.destination.kind === 'address' && !vm.thirdParty">
<div class="address-frame" ng-class="{ 'expanded': addressExpanded }" ng-click="addressExpanded = !addressExpanded">
<span class="prefix">{{vm.destination.address.substring(0,5)}}</span><span class="mid">{{vm.destination.address.substring(5,vm.destination.address.length-4)}}</span><span class="suffix">{{vm.destination.address.substring(vm.destination.address.length-4)}}</span>
<span ng-if="!vm.displayAddress">
<span class="prefix">{{vm.destination.address.substring(0,5)}}</span><span class="mid">{{vm.destination.address.substring(5,vm.destination.address.length-4)}}</span><span class="suffix">{{vm.destination.address.substring(vm.destination.address.length-4)}}</span>
</span>
<span ng-if="vm.displayAddress">
<span class="prefix">{{vm.displayAddress.substring(0,5)}}</span><span class="mid">{{vm.displayAddress.substring(5,vm.displayAddress.length-4)}}</span><span class="suffix">{{vm.displayAddress.substring(vm.displayAddress.length-4)}}</span>
</span>
</div>
</div>
</div>