I have an app with 2 different home fragment depending on the user type that is logged in, I'm using navigation component with MVVM and one activity multiple fragments architecture.
What i did is turning everything into a method and check for user type in every lifecycle callback method inside HomeFragment and call the appropriate method accordingly.
What I'm trying to achieve is to navigate to a base fragment called HomeFragment after login then depending on the user type use all the logic and fragment lifecycle callback methods from a type fragment UserOneHomeFragment/UserTwoHomeFragment.
Is there a best practice way to do this?
Aucun commentaire:
Enregistrer un commentaire