Chris Fillmore
06/17/2021, 5:07 PM@Composable
fun MainNavHost(
  navController: NavHostController,
  plugin: Plugin,
) {
  NavHost(...) {
    // Define regular navigation within the activity
    composable(...) {
      ...
    }
    // Call this here to define nested navigation for plugin(s)
    plugin.navGraph(navController)
  }
}
interface Plugin {
  fun NavGraphBuilder.navGraph(navController: NavHostController)
  ...
}navControllerpepos
06/17/2021, 6:01 PMpepos
06/17/2021, 6:03 PMnavigationEvent: (String) -> UnitChris Fillmore
06/17/2021, 6:06 PM@Composable
fun MainNavHost(
  navController: NavHostController,
  plugin: Plugin,
) {
  NavHost(...) {
    ...
    // Call this here to define nested navigation for plugin(s)
    plugin.navGraph { route ->
      navController.navigate(route)
    }
  }
}
interface Plugin {
  fun NavGraphBuilder.navGraph(navigate: (String) -> Unit)
  ...
}pepos
06/17/2021, 6:06 PMChris Fillmore
06/17/2021, 6:07 PMMarcin Mazurek
06/17/2021, 6:15 PMMarcin Mazurek
06/17/2021, 6:16 PM