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

Getting to the flow instance from the dispatcher can be awkward #254

Open
rjrjr opened this issue Apr 22, 2017 · 2 comments
Open

Getting to the flow instance from the dispatcher can be awkward #254

rjrjr opened this issue Apr 22, 2017 · 2 comments

Comments

@rjrjr
Copy link
Collaborator

rjrjr commented Apr 22, 2017

Interesting dispatchers redirect, which means that they need access to the Flow instance. That actually be tricky to get, since the only public API is via the Context, and who says that the dispatcher is anywhere near there?

I wonder if we should include a back pointer to the Flow in Traversal? Or add a Flow parameter to the Dispatch method?

@Zhuinden
Copy link

Zhuinden commented May 26, 2017

Based on that note I added Backstack to my StateChange class which in your case is Flow being available via Traversal.

I think it makes sense.

@dcow
Copy link
Contributor

dcow commented May 31, 2017

I put stuff like redirects in a router that sits a little closer to the context and leave my dispatcher to more disptach-y things like making sure info about traversals for different types of keys gets pumped through the chain of routers and transitions get executed on the view controller corresponding to the type of key coming in. But not a bad idea. It would also be nice to have a formal api for a dispatcher to "observe but drop" a traversal. Perhaps a new method on the completion like ignore()? When a traversal is ignored it's not added to the history however the dispatcher may choose to say start an Intent. That way business logic can inform the dispatcher via flow they wish to go somewhere out of your app without pushing the activity reference all the way down to wherever that thing might be sitting.

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