Any ideas, guidance and pointers to design a dagge...
# dagger
k
Any ideas, guidance and pointers to design a dagger (Hilt) graph in such a way that logged in (authenticated) users can only navigate to certain destinations and once the user logs out, we can navigate them to a destination which is part of un-authenticated nav graph etc. The goal is to ensure, all data in the Singleton's is also cleared along with db / shared pref. Any other ideas to achieve same are also welcome. My work project is using navigation-compose and hilt library and am looking for suggestions and ideas thanks!
j
That is less of a DI problem and more of "how can you intercept a navigation command and redirect the user to the login/register flow". I would introduce a company's indirection and on "navigate" command I would check if the Route/Argument implements a given interface "RequireValidSession" and if so, check the login state to forward the user to the correct screen...
👍 1