second step enhancement
This commit is contained in:
parent
d864b35513
commit
162fd685e5
7 changed files with 101 additions and 84 deletions
|
|
@ -6,9 +6,12 @@ angular
|
|||
.module('copayApp.services')
|
||||
.factory('sendFlowRouterService', sendFlowRouterService);
|
||||
|
||||
function sendFlowRouterService($state, $ionicHistory) {
|
||||
function sendFlowRouterService(
|
||||
sendFlowStateService
|
||||
, $state, $ionicHistory
|
||||
) {
|
||||
|
||||
var router = {
|
||||
var service = {
|
||||
// A separate state variable so we can ensure it is cleared of everything,
|
||||
// even other properties added that this service does not know about. (such as "coin")
|
||||
|
||||
|
|
@ -18,26 +21,41 @@ angular
|
|||
goBack: goBack,
|
||||
};
|
||||
|
||||
return router;
|
||||
return service;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function start() {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.send');
|
||||
if ($state.current.name != 'tabs.send') {
|
||||
$state.go('tabs.home').then(function () {
|
||||
$ionicHistory.clearHistory();
|
||||
$state.go('tabs.send');
|
||||
goNext();
|
||||
});
|
||||
} else {
|
||||
goNext();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
function goNext(state) {
|
||||
function goNext() {
|
||||
var state = sendFlowStateService.state;
|
||||
|
||||
/**
|
||||
* Strategy
|
||||
* Clean the history & and go to the send tab.
|
||||
*/
|
||||
// need to complete here
|
||||
if (!state.fromWalletId && (state.isWalletTransfer || (state.toWalletId || state.toAddress))) {
|
||||
$state.transitionTo('tabs.send.origin');
|
||||
} else if (state.fromWalletId && !state.toWalletId && !state.toAddress) {
|
||||
$state.transitionTo('tabs.send.destination');
|
||||
} else if (state.fromWalletId && (state.toWalletId || state.toAddress) && !state.amount) {
|
||||
$state.transitionTo('tabs.send.amount');
|
||||
} else if (state.fromWalletId && (state.toWalletId || state.toAddress) && state.amount) {
|
||||
$state.transitionTo('tabs.send.review');
|
||||
}
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue