UI for crypto fee.
This commit is contained in:
parent
4a1fd498f5
commit
e21592dec8
2 changed files with 38 additions and 8 deletions
|
|
@ -4,7 +4,7 @@ angular
|
||||||
.module('copayApp.controllers')
|
.module('copayApp.controllers')
|
||||||
.controller('reviewController', reviewController);
|
.controller('reviewController', reviewController);
|
||||||
|
|
||||||
function reviewController(addressbookService, configService, profileService, $log, $scope, txFormatService) {
|
function reviewController(addressbookService, configService, $ionicConfig, $log, profileService, $scope, txFormatService) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.destination = {
|
vm.destination = {
|
||||||
|
|
@ -18,7 +18,14 @@ function reviewController(addressbookService, configService, profileService, $lo
|
||||||
kind: '', // 'address', 'contact', 'wallet'
|
kind: '', // 'address', 'contact', 'wallet'
|
||||||
name: ''
|
name: ''
|
||||||
};
|
};
|
||||||
vm.feeCrypto = '';
|
vm.fee = {
|
||||||
|
cryptoAmount: '',
|
||||||
|
cryptoCurrencyCode: '',
|
||||||
|
cryptoDescription: '',
|
||||||
|
fiatAmount: '',
|
||||||
|
fiatCurrency: ''
|
||||||
|
};
|
||||||
|
vm.fee
|
||||||
vm.feeFiat = '';
|
vm.feeFiat = '';
|
||||||
vm.origin = {
|
vm.origin = {
|
||||||
balanceAmount: '',
|
balanceAmount: '',
|
||||||
|
|
@ -34,6 +41,7 @@ function reviewController(addressbookService, configService, profileService, $lo
|
||||||
vm.secondaryCurrency = '';
|
vm.secondaryCurrency = '';
|
||||||
|
|
||||||
var config = null;
|
var config = null;
|
||||||
|
var configFeeLevel = '';
|
||||||
var coin = '';
|
var coin = '';
|
||||||
var originWalletId = '';
|
var originWalletId = '';
|
||||||
var priceDisplayIsFiat = true;
|
var priceDisplayIsFiat = true;
|
||||||
|
|
@ -43,11 +51,25 @@ function reviewController(addressbookService, configService, profileService, $lo
|
||||||
|
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", onBeforeEnter);
|
$scope.$on("$ionicView.beforeEnter", onBeforeEnter);
|
||||||
|
$scope.$on("$ionicView.beforeLeave", onBeforeLeave);
|
||||||
|
$scope.$on("$ionicView.enter", onEnter);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onBeforeEnter(event, data) {
|
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;
|
originWalletId = data.stateParams.fromWalletId;
|
||||||
|
// For testing only
|
||||||
|
//originWalletId = data.stateParams.fromWalletId || 'bf00af8f-0788-4b57-b30a-0390747407e9';
|
||||||
satoshis = parseInt(data.stateParams.amount, 10);
|
satoshis = parseInt(data.stateParams.amount, 10);
|
||||||
toAddress = data.stateParams.toAddr;
|
toAddress = data.stateParams.toAddr;
|
||||||
|
|
||||||
|
|
@ -65,6 +87,9 @@ function reviewController(addressbookService, configService, profileService, $lo
|
||||||
priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat';
|
priceDisplayIsFiat = config.wallet.settings.priceDisplay === 'fiat';
|
||||||
vm.origin.currencyColor = originWallet.coin === 'btc' ? config.bitcoinWalletColor : config.bitcoinCashWalletColor;
|
vm.origin.currencyColor = originWallet.coin === 'btc' ? config.bitcoinWalletColor : config.bitcoinCashWalletColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configFeeLevel = config.wallet.settings.feeLevel ? config.wallet.settings.feeLevel : 'normal';
|
||||||
|
|
||||||
updateSendAmounts();
|
updateSendAmounts();
|
||||||
getOriginWalletBalance(originWallet);
|
getOriginWalletBalance(originWallet);
|
||||||
handleDestinationAsAddress(toAddress, coin);
|
handleDestinationAsAddress(toAddress, coin);
|
||||||
|
|
@ -72,6 +97,14 @@ function reviewController(addressbookService, configService, profileService, $lo
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onBeforeLeave(event, data) {
|
||||||
|
$ionicConfig.views.swipeBackEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onEnter(event, data) {
|
||||||
|
$ionicConfig.views.swipeBackEnabled(false);
|
||||||
|
};
|
||||||
|
|
||||||
function getOriginWalletBalance(originWallet) {
|
function getOriginWalletBalance(originWallet) {
|
||||||
var balanceText = getWalletBalanceDisplayText(originWallet);
|
var balanceText = getWalletBalanceDisplayText(originWallet);
|
||||||
vm.origin.balanceAmount = balanceText.amount;
|
vm.origin.balanceAmount = balanceText.amount;
|
||||||
|
|
|
||||||
|
|
@ -73,11 +73,8 @@
|
||||||
|
|
||||||
<div class="fee-summary">
|
<div class="fee-summary">
|
||||||
<div class="fee-fiat positive">Fee: Less than 1 cent</div>
|
<div class="fee-fiat positive">Fee: Less than 1 cent</div>
|
||||||
<div class="fee-crypto"
|
<div class="fee-crypto">
|
||||||
ng-init="fee = {value: '0.00195823', currency: 'BCH'};">
|
{{vm.fee.cryptoAmount}} {{vm.fee.cryptoCurrencyCode}}
|
||||||
<amount
|
|
||||||
value="fee.value"
|
|
||||||
currency="fee.currency"></amount>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue