Skip to content

Commit

Permalink
Remove applying default theme on app cold start
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksandarIlic committed Mar 6, 2024
1 parent 53ecd1a commit 16df47a
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions app/src/main/kotlin/net/primal/android/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MainActivity : ComponentActivity() {

setContent {
val userTheme = themeStore.userThemeState.collectAsState()
val primalTheme = userTheme.value ?: initDefaultTheme()
val primalTheme = userTheme.value ?: defaultPrimalTheme()

PrimalTheme(
primalTheme = primalTheme,
Expand All @@ -54,15 +54,6 @@ class MainActivity : ComponentActivity() {
}
}

@Composable
private fun initDefaultTheme(): PrimalTheme {
val defaultTheme = defaultPrimalTheme()
LaunchedEffect(Unit) {
themeStore.setUserTheme(theme = defaultTheme.themeName)
}
return defaultTheme
}

private fun observeThemeChanges() =
lifecycleScope.launch {
themeStore.userThemeState
Expand Down

0 comments on commit 16df47a

Please sign in to comment.