Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global Stepper implementation #25

Closed
TobiasRe opened this issue Feb 7, 2018 · 4 comments
Closed

Global Stepper implementation #25

TobiasRe opened this issue Feb 7, 2018 · 4 comments

Comments

@TobiasRe
Copy link

TobiasRe commented Feb 7, 2018

I really like the RxFlow approach for separating navigation with flows.
Which works really well with navigating step by step as the user uses the app gets complicated with deep linking (e.g.: Navigating to ViewController after receiving a push notification).

How do I implement a global stepper for deep linking?
The Stepper should do the following:

  1. Accept a specific Step
  2. Select or create and attach the corresponding Flow
  3. Add the Stepto the flow
@twittemb
Copy link
Collaborator

twittemb commented Feb 8, 2018

Hi @TobiasRe

Thanks for your feedback.

I think you could use the new "CompositeStepper" feature. In your AppDelegate you could something like that (adapt to your case of course)

let deepLinkStepper = DeepLinkStepper()
let mainStepper = CompositeStepper(steppers: [OneStepper(withSingleStep: DemoStep.apiKey), deepLinkStepper])
 coordinator.coordinate(flow: mainFlow, withStepper: mainStepper)

DeepLinkStepper should be a custom Stepper that you have to write (just implement the Stepper protocol).

You will trigger your instance of deepLinkStepper when a notification is received (DeepLinkStepper can have a function per notification type for instance). As it is associated to the MainFlow, Steps triggered by the DeepLinkStepper will be catched in that flow and you just have to implement the navigation in the switch statement of the navigate(to:) function.

Does it fit with your needs ?

@TobiasRe
Copy link
Author

TobiasRe commented Feb 9, 2018

Thanks @twittemb

Yes the CompositeStepper helps, if I including navigation to the corresponding sub flows in my MainFlow.
The issue that remains is how to handle deep linking on app start. Especially if the app needs some kind of bootstrapping/login before the app is ready to handle the deep link.

I guess the best to create an Observable where the deep link step is queued until the app is ready.

let deepLinkObservable = deepLinkSteps.sample(mainStepper.steps.filter{$0 == AppSteps.ready})
deepLinkObsersavable.subscribe(onNext: {step in 
    deepLinkStepper.accept(step)
}).disposed(by: disposeBag)

or similar.

@TobiasRe
Copy link
Author

TobiasRe commented Mar 2, 2018

This feature is currently on hold for me.
There are serious memory management issues with RxFlow to fix first.

I can create a PR when the Deeplink Stepper implementation is done.
Let's close this for now.

@TobiasRe TobiasRe closed this as completed Mar 2, 2018
@sirvon
Copy link
Contributor

sirvon commented Mar 2, 2018

@TobiasRe please make an issue or talk about the memory issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants