Is this way to have both functionality of a buyer and seller in single app correct? Tell me the best approach to declare navigation for both of them and also the whole navigation is wrapped in a bottomnavigation scaffold.
And I am using that scaffold to show bottom navigation bar at different screens.
@Composable
fun MasterNavigation (
navController: NavHostController,
currentUser:FirebaseUser?,
userType: UserType?,
sharedViewModel: SharedViewModel = hiltViewModel()
) {
val currentuser = Firebase.auth.currentUser
var startDestination = "Auth_Graph"
if(currentuser !=null){
// startDestination = "App_Navigation"
if(userType == UserType.CUSTOMER){
startDestination = "Buyer_App_Navigation"
}
else if(userType == UserType.PROVIDER){
startDestination = "App_Navigation"
}
else{
startDestination = "App_Navigation"
}
// startDestination = "test"
}
NavHost(navController = navController,startDestination = startDestination ){
composable("test"){
LoginScreen(navController = navController)
}
navigation(route= "Auth_Graph",startDestination = "Login_Screen"){
composable("Login_Screen"){
LoginScreen(navController)
}
composable("Register_Screen"){
RegisterScreen(navController)
}
}
navigation(route = "App_Navigation",startDestination = "Home_Screen" ){
composable("Home_Screen"){
// AddProductScreen()
HomeScreen(sharedViewModel = sharedViewModel,navController)
}
composable("Chat_Screen"){
ChatScreen()
}
composable("Market_Price_Screen"){
MarketPriceScreen()
}
composable("Add_Product_Screen"){
AddProductScreen()
}
composable("Profile_Screen"){
ProfileScreen(navController = navController)
}
navigation(route="Edit_Product",startDestination = "Edit_Product_Screen"){
composable("Edit_Product_Screen"){
EditProductScreen(navController,sharedViewModel)
}
}
}
navigation(route = "Buyer_App_Navigation",startDestination = "Buyer_Home_Screen"){
composable("Buyer_Home_Screen"){
BuyerHomeScreen(navController)
}
composable("Chat_Screen"){
ChatScreen()
}
composable("Market_Price_Screen"){
MarketPriceScreen()
}
composable("Profile_Screen"){
ProfileScreen(navController = navController)
}
navigation(route="Product_Detail",startDestination = "Product_Detail_Screen"){
composable("Product_Detail_Screen"){
ProductDetailScreen(navController,sharedViewModel)
}
}
}
}
}