in shared/src/commonMain/kotlin/org/jetbrains/kotlinconf/App.kt [18:54]
fun App(
onThemeChange: ((isDarkTheme: Boolean) -> Unit)? = null,
) {
val service = koinInject<ConferenceService>()
val currentTheme by service.getTheme().collectAsStateWithLifecycle(initialValue = Theme.SYSTEM)
val isDarkTheme = when (currentTheme) {
Theme.SYSTEM -> isSystemInDarkTheme()
Theme.LIGHT -> false
Theme.DARK -> true
}
if (onThemeChange != null) {
LaunchedEffect(isDarkTheme) { onThemeChange(isDarkTheme) }
}
val isOnboardingComplete = service.isOnboardingComplete()
.collectAsStateWithLifecycle(initialValue = null)
.value
val flags by koinInject<FlagsManager>().flags.collectAsStateWithLifecycle()
CompositionLocalProvider(LocalFlags provides flags) {
KotlinConfTheme(
darkTheme = isDarkTheme,
rippleEnabled = LocalFlags.current.rippleEnabled,
) {
Box(
Modifier
.fillMaxSize()
.background(KotlinConfTheme.colors.mainBackground)
) {
if (isOnboardingComplete != null) {
KotlinConfNavHost(isOnboardingComplete)
}
}
}
}
}