override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setNavigationGraph()
}
private fun setNavigationGraph() {
val navHostFragment =
supportFragmentManager.findFragmentById(R.id.navigationHostFragmentMain) as NavHostFragment
val navController = navHostFragment.navController
val navGraph = navController.navInflater.inflate(R.navigation.nav_graph)
if (viewModel.isLoggedIn) {
navGraph.setStartDestination(R.id.homeFragment)
} else {
navGraph.setStartDestination(R.id.loginFragment)
}
navController.graph = navGraph
}