Renamed sendFlowService functions to be more consistent.

This commit is contained in:
Brendon Duncan 2018-08-09 13:01:48 +12:00
commit bf9b467bfe
5 changed files with 46 additions and 26 deletions

View file

@ -66,6 +66,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
}
function onBeforeEnter(event, data) {
console.log('amount onBeforeEnter sendflow ', sendFlowService.getState());
initCurrencies();
@ -209,7 +210,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
}
function goBack() {
sendFlowService.previousState();
sendFlowService.popState();
if (vm.thirdParty && vm.thirdParty.id === 'shapeshift') {
$state.go('tabs.send').then(function() {
$ionicHistory.clearHistory();
@ -471,7 +472,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
confirmData['thirdParty'] = this.thirdParty;
}
sendFlowService.map(confirmData);
sendFlowService.pushState(confirmData);
if (!confirmData.fromWalletId) {
$state.transitionTo('tabs.paymentRequest.confirm', confirmData);

View file

@ -189,6 +189,8 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$scope.startWalletToWalletTransfer = function() {
console.log('startWalletToWalletTransfer()');
var params = sendFlowService.getState();
sendFlowService.pushState(params);
$state.transitionTo('tabs.send.wallet-to-wallet', {
fromWalletId: sendFlowService.fromWalletId
});
@ -208,6 +210,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
console.log('tab-send onBeforeEnter sendflow ', sendFlowService.getState());
$scope.isIOS = platformInfo.isIOS && platformInfo.isCordova;
$scope.showWalletsBch = $scope.showWalletsBtc = $scope.showWallets = false;

View file

@ -8,6 +8,8 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
var unitsFromSatoshis = 0;
$scope.$on("$ionicView.beforeEnter", function(event, data) {
console.log('walletSelector onBeforeEnter sendflow', sendFlowService.getState());
var config = configService.getSync().wallet.settings;
priceDisplayAsFiat = config.priceDisplay === 'fiat';
unitDecimals = config.unitDecimals;
@ -182,16 +184,18 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
$scope.useWallet = function(wallet) {
var params = sendFlowService.getState();
if ($scope.type === 'origin') { // we're on the origin screen, set wallet to send from
$scope.params['fromWalletId'] = wallet.id;
params.fromWalletId = wallet.id;
} else { // we're on the destination screen, set wallet to send to
$scope.params['toWalletId'] = wallet.id;
params.toWalletId = wallet.id;
}
sendFlowService.pushState(params);
$state.transitionTo(getNextStep(), $scope.params);
};
$scope.goBack = function() {
sendFlowService.previousState();
sendFlowService.popState();
$ionicHistory.goBack();
}