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

How to know if a controller view is in the front screen? #660

Open
johnjeremih opened this issue Oct 13, 2021 · 3 comments
Open

How to know if a controller view is in the front screen? #660

johnjeremih opened this issue Oct 13, 2021 · 3 comments

Comments

@johnjeremih
Copy link

johnjeremih commented Oct 13, 2021

I'm using EventBus. A child controller depends on the main controller, the child controller is calling the methods from the main controller. Now, I need to know how I can check whether the user is on main controller or not. I tried using onViewBound and onViewView, but the onViewBound and onViewView get called only when the user opens the controller for the first time, if the user goes back to the previous controller the onViewBound and onViewView never get called.

Any thoughts?

@ursusursus
Copy link

router.backstack

@johnjeremih
Copy link
Author

@ursusursus can you please tell me how do you use it? Using backstack.size doesn't work for me.

@ursusursus
Copy link

its a iterable you can look into to see if your controller is there

router.backstack.firstOrNull { it.controller is MainController }

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

2 participants