Remove from the route the stateparams, adapt some controllers in the new sendflowservice
This commit is contained in:
parent
188ddcba58
commit
e183643298
7 changed files with 49 additions and 34 deletions
|
|
@ -32,12 +32,16 @@ angular.module('copayApp.controllers').controller('addressbookViewController', f
|
|||
} else {
|
||||
to = $scope.addressbookEntry.address;
|
||||
}
|
||||
$state.transitionTo('tabs.send.amount', {
|
||||
|
||||
var stateParams = {
|
||||
toAddress: to,
|
||||
toName: $scope.addressbookEntry.name,
|
||||
toEmail: $scope.addressbookEntry.email,
|
||||
coin: $scope.addressbookEntry.coin
|
||||
});
|
||||
};
|
||||
|
||||
sendFlowService.pushState(stateParams);
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
vm.maxAmount = parseFloat(passthroughParams.maxAmount);
|
||||
|
||||
if (passthroughParams.thirdParty) {
|
||||
vm.thirdParty = JSON.parse(passthroughParams.thirdParty); // Parse stringified JSON-object
|
||||
vm.thirdParty = passthroughParams.thirdParty; // Parse stringified JSON-object
|
||||
if (vm.thirdParty) {
|
||||
if (vm.thirdParty.id === 'shapeshift') {
|
||||
if (!vm.thirdParty.data) {
|
||||
|
|
@ -211,16 +211,7 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
|
||||
function goBack() {
|
||||
sendFlowService.popState();
|
||||
if (vm.thirdParty && vm.thirdParty.id === 'shapeshift') {
|
||||
$state.go('tabs.send').then(function() {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.transitionTo('tabs.shapeshift');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$ionicHistory.goBack();
|
||||
}
|
||||
$ionicHistory.goBack();
|
||||
}
|
||||
|
||||
function paste(value) {
|
||||
|
|
|
|||
|
|
@ -63,16 +63,18 @@ angular.module('copayApp.controllers').controller('shapeshiftController', functi
|
|||
};
|
||||
|
||||
$scope.shapeshift = function() {
|
||||
var params = {
|
||||
thirdParty: JSON.stringify({id: 'shapeshift'})
|
||||
var stateParams = {
|
||||
thirdParty: {
|
||||
id: 'shapeshift'
|
||||
}
|
||||
};
|
||||
|
||||
sendFlowService.clear();
|
||||
$state.go('tabs.home').then(function() {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.send').then(function() {
|
||||
$timeout(function () {
|
||||
$state.transitionTo('tabs.send.origin', params);
|
||||
sendFlowService.pushState(stateParams);
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
}, 60);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -179,11 +179,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
}
|
||||
|
||||
$log.debug('Got toAddress:' + toAddress + ' | ' + item.name);
|
||||
|
||||
var stateParams = sendFlowService.getState();
|
||||
stateParams.toAddress = toAddress,
|
||||
stateParams.coin = item.coin;
|
||||
sendFlowService.pushState(stateParams);
|
||||
|
||||
if (!stateParams.fromWalletId) { // If we have no toAddress or fromWallet
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
} else {
|
||||
$state.transitionTo('tabs.send.amount');
|
||||
}
|
||||
|
||||
return $state.transitionTo('tabs.send.origin', {
|
||||
toAddress: toAddress,
|
||||
coin: item.coin
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -210,6 +217,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
console.log(data);
|
||||
console.log('tab-send onBeforeEnter sendflow ', sendFlowService.getState());
|
||||
$scope.isIOS = platformInfo.isIOS && platformInfo.isCordova;
|
||||
$scope.showWalletsBch = $scope.showWalletsBtc = $scope.showWallets = false;
|
||||
|
|
@ -225,5 +233,11 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
$scope.displayBalanceAsFiat = _config.wallet.settings.priceDisplay === 'fiat';
|
||||
});
|
||||
|
||||
var state = sendFlowService.getState();
|
||||
|
||||
if (data.direction == "back") {
|
||||
sendFlowService.clear();
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -10,6 +10,8 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
console.log('walletSelector onBeforeEnter sendflow', sendFlowService.getState());
|
||||
|
||||
var stateParams = sendFlowService.getState();
|
||||
|
||||
var config = configService.getSync().wallet.settings;
|
||||
priceDisplayAsFiat = config.priceDisplay === 'fiat';
|
||||
unitDecimals = config.unitDecimals;
|
||||
|
|
@ -20,7 +22,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
$scope.sendFlowTitle = gettextCatalog.getString('Wallet to Wallet Transfer');
|
||||
break;
|
||||
case 'tabs.send.destination':
|
||||
if (data.stateParams.fromWalletId) {
|
||||
if (stateParams.fromWalletId) {
|
||||
$scope.sendFlowTitle = gettextCatalog.getString('Wallet to Wallet Transfer');
|
||||
}
|
||||
break;
|
||||
|
|
@ -47,7 +49,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
$scope.isPaymentRequest = true;
|
||||
}
|
||||
if ($scope.params.thirdParty) {
|
||||
$scope.thirdParty = JSON.parse($scope.params.thirdParty); // Parse stringified JSON-object
|
||||
$scope.thirdParty = $scope.params.thirdParty;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -96,7 +98,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
|
||||
function getNextStep() {
|
||||
if ($scope.thirdParty) {
|
||||
$scope.params.thirdParty = JSON.stringify($scope.thirdParty) // re-stringify JSON-object
|
||||
$scope.params.thirdParty = $scope.thirdParty
|
||||
}
|
||||
if (!$scope.params.toWalletId && !$scope.params.toAddress) { // If we have no toAddress or fromWallet
|
||||
return 'tabs.send.destination';
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
*/
|
||||
|
||||
.state('tabs.send.amount', {
|
||||
url: '/amount/:thirdParty/:fromWalletId/:maxAmount/:minAmount/:toWalletId/:toAddress',
|
||||
url: '/amount',
|
||||
views: {
|
||||
'tab-send@tabs': {
|
||||
controller: 'amountController',
|
||||
|
|
@ -306,7 +306,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.send.origin', {
|
||||
url: '/origin/:thirdParty/:amount/:toAddress/:toWalletId/:coin',
|
||||
url: '/origin',
|
||||
views: {
|
||||
'tab-send@tabs': {
|
||||
controller: 'walletSelectorController',
|
||||
|
|
@ -315,7 +315,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.send.destination', {
|
||||
url: '/destination/:thirdParty/:amount/:fromWalletId',
|
||||
url: '/destination',
|
||||
views: {
|
||||
'tab-send@tabs': {
|
||||
controller: 'walletSelectorController',
|
||||
|
|
@ -324,7 +324,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.send.confirm', {
|
||||
url: '/confirm/:thirdParty/:amount/:fromWalletId/:toWalletId/:toAddress',
|
||||
url: '/confirm',
|
||||
views: {
|
||||
'tab-send@tabs': {
|
||||
controller: 'confirmController',
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
params.thirdParty.id = serviceId;
|
||||
params.thirdParty.data = serviceData;
|
||||
sendFlowService.pushState(params);
|
||||
$state.transitionTo('tabs.send.amount', params);
|
||||
$state.transitionTo('tabs.send.amount');
|
||||
} else {
|
||||
sendFlowService.pushState(params);
|
||||
$state.transitionTo('tabs.send.origin', params);
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
|
|
@ -388,11 +388,13 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
'notify': $state.current.name == 'tabs.send' ? false : true
|
||||
});
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.origin', {
|
||||
var stateParams = {
|
||||
toAddress: toAddress,
|
||||
coin: coin,
|
||||
noPrefix: 1
|
||||
});
|
||||
};
|
||||
sendFlowService.pushState(stateParams);
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
|
@ -460,7 +462,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
}).then(function() {
|
||||
$timeout(function() {
|
||||
sendFlowService.pushState(stateParams); // Need to do more here
|
||||
$state.transitionTo('tabs.send.origin', stateParams);
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue