in tx details display new style address after release date

This commit is contained in:
Kadir Sekha 2018-01-10 12:57:03 +09:00
commit f6ab0119cf
2 changed files with 16 additions and 3 deletions

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $ionicHistory, $scope, $timeout, walletService, lodash, gettextCatalog, profileService, externalLinkService, popupService, ongoingProcess, txFormatService, txConfirmNotification, feeService, configService) {
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $ionicHistory, $scope, $timeout, walletService, lodash, gettextCatalog, profileService, externalLinkService, popupService, ongoingProcess, txFormatService, txConfirmNotification, feeService, configService, bitcoinCashJsService) {
var txId;
var listeners = [];
@ -117,6 +117,19 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
}
$scope.btx = txFormatService.processTx($scope.wallet.coin, tx);
var cashaddrDate = new Date(2018, 0, 16);
var txDate = new Date(($scope.btx.createdOn || $scope.btx.time) * 1000);
if ($scope.wallet.coin == 'bch' && txDate >= cashaddrDate) {
var bchAddresses = bitcoinCashJsService.translateAddresses($scope.btx.addressTo);
$scope.btx.displayAddress = bchAddresses.cashaddr;
$scope.btx.copyAddress = 'bitcoincash:' + $scope.btx.displayAddress;
} else {
$scope.btx.displayAddress = $scope.btx.addressTo;
$scope.btx.copyAddress = $scope.btx.displayAddress;
}
txFormatService.formatAlternativeStr($scope.wallet.coin, tx.fees, function(v) {
$scope.btx.feeFiatStr = v;
$scope.btx.feeRateStr = ($scope.btx.fees / ($scope.btx.amount + $scope.btx.fees) * 100).toFixed(2) + '%';

View file

@ -42,8 +42,8 @@
<span class="payment-proposal-to">
<img ng-if="!cardId" src="img/icon-bitcoin-small.svg">
<img ng-if="cardId" src="img/icon-card.svg" width="34">
<div copy-to-clipboard="btx.addressTo" class="ellipsis">
<contact ng-if="!toName" address="{{btx.addressTo}}" class="ellipsis" style="display: block;"></contact>
<div copy-to-clipboard="btx.copyAddress" class="ellipsis">
<contact ng-if="!toName" address="{{btx.displayAddress}}" class="ellipsis" style="display: block;"></contact>
<span class="m15l size-14" ng-if="toName">{{toName}}</span>
</div>
</span>