From 49847ef77c9945f3474e6cb97c46008b6bbde30c Mon Sep 17 00:00:00 2001 From: StageGuard Date: Mon, 10 Feb 2025 23:55:51 +0800 Subject: [PATCH] remove expect/actual SystemBarColorEffect --- .../kotlin/ui/foundation/theme/AppTheme.android.kt | 10 +++++++++- .../kotlin/ui/foundation/theme/AppTheme.desktop.kt | 4 ---- .../iosMain/kotlin/ui/foundation/theme/AppTheme.ios.kt | 4 ---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/shared/ui-foundation/src/androidMain/kotlin/ui/foundation/theme/AppTheme.android.kt b/app/shared/ui-foundation/src/androidMain/kotlin/ui/foundation/theme/AppTheme.android.kt index d7c33e2d08..324702620d 100644 --- a/app/shared/ui-foundation/src/androidMain/kotlin/ui/foundation/theme/AppTheme.android.kt +++ b/app/shared/ui-foundation/src/androidMain/kotlin/ui/foundation/theme/AppTheme.android.kt @@ -13,6 +13,7 @@ import android.os.Build import androidx.activity.ComponentActivity import androidx.activity.SystemBarStyle import androidx.activity.enableEdgeToEdge +import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.material3.ColorScheme import androidx.compose.material3.dynamicDarkColorScheme import androidx.compose.material3.dynamicLightColorScheme @@ -22,6 +23,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import com.materialkolor.PaletteStyle import com.materialkolor.dynamicColorScheme +import me.him188.ani.app.data.models.preference.DarkMode import me.him188.ani.app.platform.findActivity @Composable @@ -55,7 +57,13 @@ actual fun appColorScheme( } @Composable -actual fun SystemBarColorEffect(isDark: Boolean) { +fun SystemBarColorEffect( + isDark: Boolean = when (LocalThemeSettings.current.darkMode) { + DarkMode.LIGHT -> false + DarkMode.DARK -> true + DarkMode.AUTO -> isSystemInDarkTheme() + }, +) { // Set statusBarStyle & navigationBarStyle val activity = LocalContext.current.findActivity() as? ComponentActivity if (activity != null) { diff --git a/app/shared/ui-foundation/src/desktopMain/kotlin/ui/foundation/theme/AppTheme.desktop.kt b/app/shared/ui-foundation/src/desktopMain/kotlin/ui/foundation/theme/AppTheme.desktop.kt index ce58a7cb38..b9038be1eb 100644 --- a/app/shared/ui-foundation/src/desktopMain/kotlin/ui/foundation/theme/AppTheme.desktop.kt +++ b/app/shared/ui-foundation/src/desktopMain/kotlin/ui/foundation/theme/AppTheme.desktop.kt @@ -31,8 +31,4 @@ actual fun appColorScheme( modifyColorSchemeForBlackBackground(colorScheme, isDark, useBlackBackground) }, ) -} - -@Composable -actual fun SystemBarColorEffect(isDark: Boolean) { } \ No newline at end of file diff --git a/app/shared/ui-foundation/src/iosMain/kotlin/ui/foundation/theme/AppTheme.ios.kt b/app/shared/ui-foundation/src/iosMain/kotlin/ui/foundation/theme/AppTheme.ios.kt index ce58a7cb38..b9038be1eb 100644 --- a/app/shared/ui-foundation/src/iosMain/kotlin/ui/foundation/theme/AppTheme.ios.kt +++ b/app/shared/ui-foundation/src/iosMain/kotlin/ui/foundation/theme/AppTheme.ios.kt @@ -31,8 +31,4 @@ actual fun appColorScheme( modifyColorSchemeForBlackBackground(colorScheme, isDark, useBlackBackground) }, ) -} - -@Composable -actual fun SystemBarColorEffect(isDark: Boolean) { } \ No newline at end of file