mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #6265 from JDonadio/ref/fee-txp-details
Display fee values - txp details
This commit is contained in:
commit
71f7d76599
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $log, ongoingProcess, platformInfo, $ionicScrollDelegate, txFormatService, bwcError, gettextCatalog, lodash, walletService, popupService, $ionicHistory) {
|
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $log, ongoingProcess, platformInfo, $ionicScrollDelegate, txFormatService, bwcError, gettextCatalog, lodash, walletService, popupService, $ionicHistory, feeService) {
|
||||||
var isGlidera = $scope.isGlidera;
|
var isGlidera = $scope.isGlidera;
|
||||||
var GLIDERA_LOCK_TIME = 6 * 60 * 60;
|
var GLIDERA_LOCK_TIME = 6 * 60 * 60;
|
||||||
var now = Math.floor(Date.now() / 1000);
|
var now = Math.floor(Date.now() / 1000);
|
||||||
|
@ -16,11 +16,20 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
$scope.data = {};
|
$scope.data = {};
|
||||||
$scope.displayAmount = getDisplayAmount($scope.tx.amountStr);
|
$scope.displayAmount = getDisplayAmount($scope.tx.amountStr);
|
||||||
$scope.displayUnit = getDisplayUnit($scope.tx.amountStr);
|
$scope.displayUnit = getDisplayUnit($scope.tx.amountStr);
|
||||||
|
displayFeeValues();
|
||||||
initActionList();
|
initActionList();
|
||||||
checkPaypro();
|
checkPaypro();
|
||||||
applyButtonText();
|
applyButtonText();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function displayFeeValues() {
|
||||||
|
txFormatService.formatAlternativeStr($scope.tx.fee, function(v) {
|
||||||
|
$scope.tx.feeFiatStr = v;
|
||||||
|
});
|
||||||
|
$scope.tx.feeRateStr = ($scope.tx.fee / ($scope.tx.amount + $scope.tx.fee) * 100).toFixed(2) + '%';
|
||||||
|
$scope.tx.feeLevelStr = feeService.feeOpts[$scope.tx.feeLevel];
|
||||||
|
};
|
||||||
|
|
||||||
function applyButtonText() {
|
function applyButtonText() {
|
||||||
$scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' ';
|
$scope.buttonText = $scope.isCordova ? gettextCatalog.getString('Slide') + ' ' : gettextCatalog.getString('Click') + ' ';
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
||||||
$scope.isShared = $scope.wallet.credentials.n > 1;
|
$scope.isShared = $scope.wallet.credentials.n > 1;
|
||||||
|
|
||||||
txConfirmNotification.checkIfEnabled(txId, function(res) {
|
txConfirmNotification.checkIfEnabled(txId, function(res) {
|
||||||
$scope.txNotification = { value: res };
|
$scope.txNotification = {
|
||||||
|
value: res
|
||||||
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,7 +26,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
||||||
listeners = [
|
listeners = [
|
||||||
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||||
if (type == 'NewBlock' && n && n.data && n.data.network == 'livenet') {
|
if (type == 'NewBlock' && n && n.data && n.data.network == 'livenet') {
|
||||||
updateTxDebounced({hideLoading: true});
|
updateTxDebounced({
|
||||||
|
hideLoading: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
@ -108,7 +112,8 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
||||||
|
|
||||||
$scope.btx = txFormatService.processTx(tx);
|
$scope.btx = txFormatService.processTx(tx);
|
||||||
txFormatService.formatAlternativeStr(tx.fees, function(v) {
|
txFormatService.formatAlternativeStr(tx.fees, function(v) {
|
||||||
$scope.feeFiatStr = v;
|
$scope.btx.feeFiatStr = v;
|
||||||
|
$scope.btx.feeRateStr = ($scope.btx.fees / ($scope.btx.amount + $scope.btx.fees) * 100).toFixed(2) + '%';
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($scope.btx.action != 'invalid') {
|
if ($scope.btx.action != 'invalid') {
|
||||||
|
@ -194,7 +199,9 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
||||||
|
|
||||||
$scope.txConfirmNotificationChange = function() {
|
$scope.txConfirmNotificationChange = function() {
|
||||||
if ($scope.txNotification.value) {
|
if ($scope.txNotification.value) {
|
||||||
txConfirmNotification.subscribe($scope.wallet, { txid: txId });
|
txConfirmNotification.subscribe($scope.wallet, {
|
||||||
|
txid: txId
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
txConfirmNotification.unsubscribe($scope.wallet, txId);
|
txConfirmNotification.unsubscribe($scope.wallet, txId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,12 @@
|
||||||
$item-vertical-padding: 10px;
|
$item-vertical-padding: 10px;
|
||||||
$item-border-color: #EFEFEF;
|
$item-border-color: #EFEFEF;
|
||||||
$item-label-color: #6C6C6E;
|
$item-label-color: #6C6C6E;
|
||||||
|
.item-note {
|
||||||
|
float: none;
|
||||||
|
.fee-rate {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
.list {
|
.list {
|
||||||
background: #f5f5f5;
|
background: #f5f5f5;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,10 +97,11 @@
|
||||||
{{tx.message}}
|
{{tx.message}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item single-line">
|
<div class="item">
|
||||||
<span class="label" translate>Fee</span>
|
<span class="label">{{'Fee:' | translate}} {{tx.feeLevelStr | translate}}</span>
|
||||||
<span class="item-note">
|
<span class="m10l">{{tx.feeStr || '...'}}</span>
|
||||||
{{tx.feeStr}}
|
<span class="item-note m10l">
|
||||||
|
<span>{{tx.feeFiatStr || '...'}} <span class="fee-rate" ng-if="tx.feeRateStr" translate>- {{tx.feeRateStr}} of the transaction</span></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -77,11 +77,11 @@
|
||||||
</div>
|
</div>
|
||||||
<i class="icon bp-arrow-right"></i>
|
<i class="icon bp-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="item single-line" ng-click="toggleFeeFiat = !toggleFeeFiat" ng-if="btx.action != 'received'">
|
<div class="item" ng-if="btx.action != 'received'">
|
||||||
<span class="label" translate>Fee</span>
|
<span class="label" translate>Fee</span>
|
||||||
<span class="item-note">
|
<span class="m10l">{{btx.feeStr || '...'}}</span>
|
||||||
<span ng-if="!toggleFeeFiat">{{btx.feeStr}}</span>
|
<span class="item-note m10l">
|
||||||
<span ng-if="toggleFeeFiat">{{feeFiatStr}}</span>
|
<span>{{btx.feeFiatStr || '...'}} <span class="fee-rate" ng-if="btx.feeRateStr" translate>- {{btx.feeRateStr}} of the transaction</span></span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="item low-fees" ng-if="btx.action == 'received' && btx.lowFees">
|
<div class="item low-fees" ng-if="btx.action == 'received' && btx.lowFees">
|
||||||
|
|
Loading…
Reference in New Issue