Set variables before enter in the screen. (Fix lost after merging)
This commit is contained in:
parent
a9b84f3942
commit
4f7004f5a3
1 changed files with 55 additions and 48 deletions
|
|
@ -9,49 +9,6 @@ angular
|
||||||
function reviewController(addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, clipboardService, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, ionicToast, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) {
|
function reviewController(addressbookService, bitcoinCashJsService, bitcore, bitcoreCash, bwcError, clipboardService, configService, feeService, gettextCatalog, $interval, $ionicHistory, $ionicModal, ionicToast, lodash, $log, ongoingProcess, platformInfo, popupService, profileService, $scope, sendFlowService, shapeshiftService, soundService, $state, $timeout, txConfirmNotification, txFormatService, walletService) {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
vm.buttonText = '';
|
|
||||||
vm.destination = {
|
|
||||||
address: '',
|
|
||||||
balanceAmount: '',
|
|
||||||
balanceCurrency: '',
|
|
||||||
coin: '',
|
|
||||||
color: '',
|
|
||||||
currency: '',
|
|
||||||
currencyColor: '',
|
|
||||||
kind: '', // 'address', 'contact', 'wallet'
|
|
||||||
name: ''
|
|
||||||
};
|
|
||||||
vm.displayAddress = '';
|
|
||||||
vm.feeCrypto = '';
|
|
||||||
vm.feeFiat = '';
|
|
||||||
vm.fiatCurrency = '';
|
|
||||||
vm.feeIsHigh = false;
|
|
||||||
vm.feeLessThanACent = false;
|
|
||||||
vm.isCordova = platformInfo.isCordova;
|
|
||||||
vm.notReadyMessage = '';
|
|
||||||
vm.origin = {
|
|
||||||
balanceAmount: '',
|
|
||||||
balanceCurrency: '',
|
|
||||||
currency: '',
|
|
||||||
currencyColor: '',
|
|
||||||
};
|
|
||||||
vm.originWallet = null;
|
|
||||||
vm.paymentExpired = false;
|
|
||||||
vm.personalNotePlaceholder = gettextCatalog.getString('Enter text here');
|
|
||||||
vm.primaryAmount = '';
|
|
||||||
vm.primaryCurrency = '';
|
|
||||||
vm.usingMerchantFee = false;
|
|
||||||
vm.readyToSend = false;
|
|
||||||
vm.remainingTimeStr = '';
|
|
||||||
vm.secondaryAmount = '';
|
|
||||||
vm.secondaryCurrency = '';
|
|
||||||
vm.sendingTitle = gettextCatalog.getString('You are sending');
|
|
||||||
vm.sendStatus = '';
|
|
||||||
vm.showAddress = true;
|
|
||||||
vm.thirdParty = null;
|
|
||||||
vm.wallet = null;
|
|
||||||
vm.memoExpanded = false;
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
vm.goBack = goBack;
|
vm.goBack = goBack;
|
||||||
vm.onSuccessConfirm = onSuccessConfirm;
|
vm.onSuccessConfirm = onSuccessConfirm;
|
||||||
|
|
@ -78,9 +35,58 @@ angular
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", onBeforeEnter);
|
$scope.$on("$ionicView.beforeEnter", onBeforeEnter);
|
||||||
|
|
||||||
|
function initVariables() {
|
||||||
|
vm.buttonText = '';
|
||||||
|
vm.destination = {
|
||||||
|
address: '',
|
||||||
|
balanceAmount: '',
|
||||||
|
balanceCurrency: '',
|
||||||
|
coin: '',
|
||||||
|
color: '',
|
||||||
|
currency: '',
|
||||||
|
currencyColor: '',
|
||||||
|
kind: '', // 'address', 'contact', 'wallet'
|
||||||
|
name: ''
|
||||||
|
};
|
||||||
|
vm.displayAddress = '';
|
||||||
|
vm.feeCrypto = '';
|
||||||
|
vm.feeFiat = '';
|
||||||
|
vm.fiatCurrency = '';
|
||||||
|
vm.feeIsHigh = false;
|
||||||
|
vm.feeLessThanACent = false;
|
||||||
|
vm.isCordova = platformInfo.isCordova;
|
||||||
|
vm.memo = '';
|
||||||
|
vm.notReadyMessage = '';
|
||||||
|
vm.origin = {
|
||||||
|
balanceAmount: '',
|
||||||
|
balanceCurrency: '',
|
||||||
|
currency: '',
|
||||||
|
currencyColor: '',
|
||||||
|
};
|
||||||
|
vm.originWallet = null;
|
||||||
|
vm.paymentExpired = false;
|
||||||
|
vm.personalNotePlaceholder = gettextCatalog.getString('Enter text here');
|
||||||
|
vm.primaryAmount = '';
|
||||||
|
vm.primaryCurrency = '';
|
||||||
|
vm.usingMerchantFee = false;
|
||||||
|
vm.readyToSend = false;
|
||||||
|
vm.remainingTimeStr = '';
|
||||||
|
vm.secondaryAmount = '';
|
||||||
|
vm.secondaryCurrency = '';
|
||||||
|
vm.sendingTitle = gettextCatalog.getString('You are sending');
|
||||||
|
vm.sendStatus = '';
|
||||||
|
vm.showAddress = true;
|
||||||
|
vm.thirdParty = null;
|
||||||
|
vm.wallet = null;
|
||||||
|
vm.memoExpanded = false;
|
||||||
|
}
|
||||||
|
|
||||||
function onBeforeEnter(event, data) {
|
function onBeforeEnter(event, data) {
|
||||||
$log.debug('reviewController onBeforeEnter sendflow ', sendFlowService.state);
|
$log.debug('reviewController onBeforeEnter sendflow ', sendFlowService.state);
|
||||||
|
|
||||||
|
// Reset from last time
|
||||||
|
initVariables();
|
||||||
|
|
||||||
defaults = configService.getDefaults();
|
defaults = configService.getDefaults();
|
||||||
sendFlowData = sendFlowService.state.getClone();
|
sendFlowData = sendFlowService.state.getClone();
|
||||||
originWalletId = sendFlowData.fromWalletId;
|
originWalletId = sendFlowData.fromWalletId;
|
||||||
|
|
@ -397,14 +403,14 @@ angular
|
||||||
var balanceCryptoAmount = '';
|
var balanceCryptoAmount = '';
|
||||||
var balanceCryptoCurrencyCode = '';
|
var balanceCryptoCurrencyCode = '';
|
||||||
var balanceFiatAmount = '';
|
var balanceFiatAmount = '';
|
||||||
var balanceFiatCurrency = ''
|
var balanceFiatCurrency = '';
|
||||||
var displayAmount = '';
|
var displayAmount = '';
|
||||||
var displayCurrency = '';
|
var displayCurrency = '';
|
||||||
|
|
||||||
var walletStatus = null;
|
var walletStatus = null;
|
||||||
if (wallet.status.isValid) {
|
if (wallet.status && wallet.status.isValid) {
|
||||||
walletStatus = wallet.status;
|
walletStatus = wallet.status;
|
||||||
} else if (wallet.cachedStatus.isValid) {
|
} else if (wallet.cachedStatus && wallet.cachedStatus.isValid) {
|
||||||
walletStatus = wallet.cachedStatus;
|
walletStatus = wallet.cachedStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -507,13 +513,15 @@ angular
|
||||||
|
|
||||||
function initShapeshift(cb) {
|
function initShapeshift(cb) {
|
||||||
vm.sendingTitle = gettextCatalog.getString('You are shifting');
|
vm.sendingTitle = gettextCatalog.getString('You are shifting');
|
||||||
|
if (!vm.thirdParty.data) {
|
||||||
|
vm.thirdParty.data = {};
|
||||||
|
}
|
||||||
|
|
||||||
var toWallet = profileService.getWallet(destinationWalletId);
|
var toWallet = profileService.getWallet(destinationWalletId);
|
||||||
vm.destination.name = toWallet.name;
|
vm.destination.name = toWallet.name;
|
||||||
vm.destination.color = toWallet.color;
|
vm.destination.color = toWallet.color;
|
||||||
vm.destination.currency = toWallet.coin.toUpperCase();
|
vm.destination.currency = toWallet.coin.toUpperCase();
|
||||||
|
|
||||||
|
|
||||||
ongoingProcess.set('connectingShapeshift', true);
|
ongoingProcess.set('connectingShapeshift', true);
|
||||||
walletService.getAddress(vm.originWallet, false, function onReturnWalletAddress(err, returnAddr) {
|
walletService.getAddress(vm.originWallet, false, function onReturnWalletAddress(err, returnAddr) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -942,6 +950,5 @@ angular
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue