What is the best approach to clear navigation stack from anywhere in the app? #3351
-
I have implemented an auto-logout feature in the app which gets triggered after 30 mins of device inactivity. The current solution I have implemented is to send a delegate call to the RootView(LoginStore) from any child view to clear logged in credentials and clear the stack. This works correctly and the user is navigated to the login screen. Problem - While this approach is working correctly it is causing a lot of code duplication is all the child views to have a Question - Is there any alternative I can use to talk to the LoginStore from anywhere in the app to clear the stack?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It is perfectly fine to using global communication mechanisms like |
Beta Was this translation helpful? Give feedback.
It is perfectly fine to using global communication mechanisms like
NotificationCenter
for things like this. A feature can post a notification from an effect, and any other feature can subscribe to notifications in an effect. It works perfectly fine and it is completely testable too.