From 621c60a2cedc4e7aebef25370b2c3f692e909318 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Dominguez Date: Wed, 26 Sep 2018 20:15:25 +0200 Subject: [PATCH] Set thirdParty on the sendflow --- src/js/controllers/amount.controller.js | 7 +- src/js/controllers/review.controller.js | 92 +++++++++---------- .../controllers/wallet-selector.controller.js | 9 +- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/js/controllers/amount.controller.js b/src/js/controllers/amount.controller.js index 07f31bb3e..f837ff2f3 100644 --- a/src/js/controllers/amount.controller.js +++ b/src/js/controllers/amount.controller.js @@ -30,7 +30,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, vm.sendableFunds = ''; vm.showSendMaxButton = false; vm.showSendLimitMaxButton = false; - vm.thirdParty = false; + vm.thirdParty = null; vm.unit = ''; // Functions @@ -88,11 +88,16 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory, sendFlowService.state.pop(); } + + initCurrencies(); passthroughParams = sendFlowService.state.getClone(); console.log('amount onBeforeEnter after back sendflow ', passthroughParams); + // Init thirdParty, should be done for all the variable + vm.thirdParty = null; + vm.fromWalletId = passthroughParams.fromWalletId; vm.toWalletId = passthroughParams.toWalletId; vm.minAmount = parseFloat(passthroughParams.minAmount); diff --git a/src/js/controllers/review.controller.js b/src/js/controllers/review.controller.js index d7d69f611..67a4164c8 100644 --- a/src/js/controllers/review.controller.js +++ b/src/js/controllers/review.controller.js @@ -9,6 +9,50 @@ 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) { 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.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; + // Functions vm.goBack = goBack; vm.onSuccessConfirm = onSuccessConfirm; @@ -35,57 +79,11 @@ angular $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) { $log.debug('reviewController onBeforeEnter sendflow ', sendFlowService.state); // Reset from last time - initVariables(); + vm.thirdParty = null; defaults = configService.getDefaults(); sendFlowData = sendFlowService.state.getClone(); diff --git a/src/js/controllers/wallet-selector.controller.js b/src/js/controllers/wallet-selector.controller.js index 036727333..3d954821c 100644 --- a/src/js/controllers/wallet-selector.controller.js +++ b/src/js/controllers/wallet-selector.controller.js @@ -52,9 +52,6 @@ angular $scope.specificAmount = $scope.specificAlternativeAmount = ''; $scope.isPaymentRequest = true; } - if ($scope.params.thirdParty) { - $scope.thirdParty = $scope.params.thirdParty; - } }; function onEnter (event, data) { @@ -62,7 +59,7 @@ angular $scope.selectedPriceDisplay = config.wallet.settings.priceDisplay; }); - if ($scope.thirdParty) { + if ($scope.params.thirdParty) { // Third party services specific logic handleThirdPartyIfShapeshift(); } @@ -102,8 +99,8 @@ angular } function handleThirdPartyIfShapeshift() { - console.log($scope.thirdParty, $scope.coin); - if ($scope.thirdParty.id === 'shapeshift' && $scope.type === 'destination') { // Shapeshift wants to know the + console.log($scope.params.thirdParty, $scope.coin); + if ($scope.params.thirdParty.id === 'shapeshift' && $scope.type === 'destination') { // Shapeshift wants to know the $scope.coin = profileService.getWallet(fromWalletId).coin; if ($scope.coin === 'bch') { $scope.coin = 'btc';