Fix for wallet selection header when in Shapeshift flow. Also fixed a coin already present bug that occurred in subsequent Shapeshift flows.
This commit is contained in:
parent
d28ba24e1c
commit
5445ddbecd
6 changed files with 47 additions and 43 deletions
|
|
@ -67,15 +67,14 @@ function amountController(configService, $filter, gettextCatalog, $ionicHistory,
|
|||
}
|
||||
|
||||
function onBeforeEnter(event, data) {
|
||||
console.log('amount onBeforeEnter sendflow ', sendFlowService.getState());
|
||||
|
||||
if (data.direction == "back") {
|
||||
sendFlowService.popState();
|
||||
}
|
||||
console.log('amount onBeforeEnter after back sendflow ', sendFlowService.state);
|
||||
|
||||
initCurrencies();
|
||||
|
||||
passthroughParams = sendFlowService;
|
||||
passthroughParams = sendFlowService.getStateClone();
|
||||
|
||||
vm.fromWalletId = passthroughParams.fromWalletId;
|
||||
vm.toWalletId = passthroughParams.toWalletId;
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ function reviewController(addressbookService, bitcoinCashJsService, bitcore, bit
|
|||
|
||||
|
||||
function onBeforeEnter(event, data) {
|
||||
console.log('walletSelector onBeforeEnter sendflow ', sendFlowService.getState());
|
||||
console.log('walletSelector onBeforeEnter sendflow ', sendFlowService.state);
|
||||
defaults = configService.getDefaults();
|
||||
sendFlowData = sendFlowService.getState();
|
||||
sendFlowData = sendFlowService.getStateClone();
|
||||
originWalletId = sendFlowData.fromWalletId;
|
||||
satoshis = parseInt(sendFlowData.amount, 10);
|
||||
toAddress = sendFlowData.toAddress;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
|
||||
var stateParams = sendFlowService.getState();
|
||||
var stateParams = sendFlowService.getStateClone();
|
||||
$scope.fromWallet = profileService.getWallet(stateParams.fromWalletId);
|
||||
|
||||
clipboardService.readFromClipboard(function(text) {
|
||||
|
|
@ -184,7 +184,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
|
||||
$log.debug('Got toAddress:' + toAddress + ' | ' + item.name);
|
||||
|
||||
var stateParams = sendFlowService.getState();
|
||||
var stateParams = sendFlowService.getStateClone();
|
||||
stateParams.toAddress = toAddress,
|
||||
stateParams.coin = item.coin;
|
||||
sendFlowService.pushState(stateParams);
|
||||
|
|
@ -200,7 +200,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
|
|||
|
||||
$scope.startWalletToWalletTransfer = function() {
|
||||
console.log('startWalletToWalletTransfer()');
|
||||
var params = sendFlowService.getState();
|
||||
var params = sendFlowService.getStateClone();
|
||||
sendFlowService.pushState(params);
|
||||
$state.transitionTo('tabs.send.wallet-to-wallet', {
|
||||
fromWalletId: sendFlowService.fromWalletId
|
||||
|
|
@ -222,7 +222,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());
|
||||
console.log('tab-send onBeforeEnter sendflow ', sendFlowService.state);
|
||||
$scope.isIOS = platformInfo.isIOS && platformInfo.isCordova;
|
||||
$scope.showWalletsBch = $scope.showWalletsBtc = $scope.showWallets = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,12 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
$scope.$on("$ionicView.enter", onEnter);
|
||||
|
||||
function onBeforeEnter(event, data) {
|
||||
console.log('walletSelector onBeforeEnter sendflow', sendFlowService.getState());
|
||||
|
||||
if (data.direction == "back") {
|
||||
sendFlowService.popState();
|
||||
}
|
||||
console.log('walletSelector onBeforeEnter after back sendflow', sendFlowService.state);
|
||||
|
||||
$scope.params = sendFlowService.getState();
|
||||
$scope.params = sendFlowService.getStateClone();
|
||||
|
||||
var config = configService.getSync().wallet.settings;
|
||||
priceDisplayAsFiat = config.priceDisplay === 'fiat';
|
||||
|
|
@ -29,7 +28,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
$scope.sendFlowTitle = gettextCatalog.getString('Wallet to Wallet Transfer');
|
||||
break;
|
||||
case 'tabs.send.destination':
|
||||
if ($scope.params.fromWalletId) {
|
||||
if ($scope.params.fromWalletId && !$scope.params.thirdParty) {
|
||||
$scope.sendFlowTitle = gettextCatalog.getString('Wallet to Wallet Transfer');
|
||||
}
|
||||
break;
|
||||
|
|
@ -45,7 +44,7 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
fromWalletId = $scope.params['fromWalletId'];
|
||||
|
||||
if ($scope.type === 'destination' && $scope.params.toAddress) {
|
||||
$state.transitionTo(getNextStep());
|
||||
$state.transitionTo(getNextStep($scope.params));
|
||||
}
|
||||
|
||||
if ($scope.params.coin) {
|
||||
|
|
@ -105,13 +104,10 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
}
|
||||
}
|
||||
|
||||
function getNextStep() {
|
||||
if ($scope.thirdParty) {
|
||||
$scope.params.thirdParty = $scope.thirdParty
|
||||
}
|
||||
if (!$scope.params.toWalletId && !$scope.params.toAddress) { // If we have no toAddress or fromWallet
|
||||
function getNextStep(params) {
|
||||
if (!params.toWalletId && !params.toAddress) { // If we have no toAddress or fromWallet
|
||||
return 'tabs.send.destination';
|
||||
} else if (!$scope.params.amount) { // If we have no amount
|
||||
} else if (!params.amount) { // If we have no amount
|
||||
return 'tabs.send.amount';
|
||||
} else { // If we do have them
|
||||
return 'tabs.send.review';
|
||||
|
|
@ -195,14 +191,16 @@ angular.module('copayApp.controllers').controller('walletSelectorController', fu
|
|||
|
||||
|
||||
$scope.useWallet = function(wallet) {
|
||||
var params = sendFlowService.getState();
|
||||
var params = sendFlowService.getStateClone();
|
||||
if ($scope.type === 'origin') { // we're on the origin screen, set wallet to send from
|
||||
params.fromWalletId = wallet.id;
|
||||
} else { // we're on the destination screen, set wallet to send to
|
||||
params.toWalletId = wallet.id;
|
||||
}
|
||||
sendFlowService.pushState(params);
|
||||
$state.transitionTo(getNextStep(), $scope.params);
|
||||
var nextStep = getNextStep(params);
|
||||
console.log('walletSelector nextStep', nextStep);
|
||||
$state.transitionTo(nextStep, $scope.params);
|
||||
};
|
||||
|
||||
$scope.goBack = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue