Remove from the route the stateparams, adapt some controllers in the new sendflowservice

This commit is contained in:
Jean-Baptiste Dominguez 2018-08-09 12:35:39 +09:00
commit e183643298
7 changed files with 49 additions and 34 deletions

View file

@ -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();
}
});
});
});