2023-01-11 18:31:20 +00:00
|
|
|
package com.vitorpamplona.amethyst.ui.navigation
|
|
|
|
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
import androidx.navigation.NavHostController
|
|
|
|
import androidx.navigation.compose.NavHost
|
|
|
|
import androidx.navigation.compose.composable
|
2023-01-19 03:00:32 +00:00
|
|
|
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
2023-01-11 18:31:20 +00:00
|
|
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
fun AppNavigation(
|
|
|
|
navController: NavHostController,
|
2023-01-19 03:00:32 +00:00
|
|
|
accountViewModel: AccountViewModel,
|
2023-01-25 00:53:22 +00:00
|
|
|
accountStateViewModel: AccountStateViewModel,
|
|
|
|
nextPage: String? = null
|
2023-01-11 18:31:20 +00:00
|
|
|
) {
|
|
|
|
NavHost(navController, startDestination = Route.Home.route) {
|
|
|
|
Routes.forEach {
|
2023-01-19 03:00:32 +00:00
|
|
|
composable(it.route, it.arguments, content = it.buildScreen(accountViewModel, accountStateViewModel, navController))
|
2023-01-11 18:31:20 +00:00
|
|
|
}
|
|
|
|
}
|
2023-01-25 00:53:22 +00:00
|
|
|
|
|
|
|
if (nextPage != null) {
|
|
|
|
navController.navigate(nextPage)
|
|
|
|
}
|
2023-01-11 18:31:20 +00:00
|
|
|
}
|