Alligator icon indicating copy to clipboard operation
Alligator copied to clipboard

It makes sense to have a method returning the current screen (and maybe the activity/fragment) on AndroidNavigator?

Open emanzanoaxa opened this issue 7 years ago • 1 comments
trafficstars

It can be useful for example for knowing which screen is being displayed when receiving a notification, to know if you must resume that activity in case is already on the stack or if you need to recreate that screen.

And another question, there are plans to implement some sort of navigation stack using screens? Like the one you can create on a notification using intents, to preserve the navigation stack when navigating to a hierarchically deep screen.

emanzanoaxa avatar Oct 04 '18 09:10 emanzanoaxa

There is no such method as getCurrentScreen in Navigator. You can only pass commands to a navigator but not query it for something. The reason is that NavigationContext may be not bound yet when you call methods of a navigator. I am thinking about some kind of conditional/composite commands, but I am not ready to say how it would look like.

What about the second question, you can call several navigation methods in sequence to build a screen stack. For example:

navigator.reset(new ScreenA());
navigator.goForward(new ScreenB());
navigator.goForward(new ScreenC());

aartikov avatar Oct 05 '18 14:10 aartikov