diff --git a/composeApp/src/androidMain/kotlin/net/newpipe/app/ComposeActivity.kt b/composeApp/src/androidMain/kotlin/net/newpipe/app/ComposeActivity.kt index d78c70d1f..bab2ebfe0 100644 --- a/composeApp/src/androidMain/kotlin/net/newpipe/app/ComposeActivity.kt +++ b/composeApp/src/androidMain/kotlin/net/newpipe/app/ComposeActivity.kt @@ -9,9 +9,13 @@ import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.compose.runtime.DisposableEffect +import androidx.compose.ui.platform.LocalView +import androidx.core.view.WindowCompat import kotlinx.serialization.json.Json import net.newpipe.Constants import net.newpipe.app.navigation.Screen +import net.newpipe.app.theme.currentService /** * Entry point for compose-related UI components on Android @@ -28,7 +32,18 @@ class ComposeActivity : ComponentActivity() { intent.getStringExtra(Constants.INTENT_SCREEN_KEY)!! ), onCloseRequest = ::finish - ) + ) { + val view = LocalView.current + val service = currentService() + + DisposableEffect(service) { + val windowController = WindowCompat.getInsetsController(window, view) + windowController.isAppearanceLightStatusBars = service.isSchemeColorDensityLight + onDispose { + windowController.isAppearanceLightStatusBars = false + } + } + } } } } diff --git a/composeApp/src/commonMain/kotlin/net/newpipe/app/App.kt b/composeApp/src/commonMain/kotlin/net/newpipe/app/App.kt index ff14ea611..d799f2665 100644 --- a/composeApp/src/commonMain/kotlin/net/newpipe/app/App.kt +++ b/composeApp/src/commonMain/kotlin/net/newpipe/app/App.kt @@ -16,9 +16,15 @@ import org.koin.plugin.module.dsl.koinConfiguration /** * Entry point for the multiplatform compose application * @param startDestination Starting destination for the activity/app, defaults to about + * @param onCloseRequest Callback to close the app + * @param withKoin Additional logic to execute after initialising Koin and setting content */ @Composable -fun App(startDestination: Screen = Screen.About, onCloseRequest : () -> Unit) { +fun App( + startDestination: Screen = Screen.About, + onCloseRequest : () -> Unit, + withKoin: @Composable () -> Unit = {} +) { KoinApplication(configuration = koinConfiguration()) { AppTheme { NavDisplay( @@ -26,5 +32,6 @@ fun App(startDestination: Screen = Screen.About, onCloseRequest : () -> Unit) { onCloseRequest = onCloseRequest ) } + withKoin() } } diff --git a/composeApp/src/commonMain/kotlin/net/newpipe/app/model/Service.kt b/composeApp/src/commonMain/kotlin/net/newpipe/app/model/Service.kt index cd18ee9c4..3814b0565 100644 --- a/composeApp/src/commonMain/kotlin/net/newpipe/app/model/Service.kt +++ b/composeApp/src/commonMain/kotlin/net/newpipe/app/model/Service.kt @@ -21,12 +21,16 @@ import net.newpipe.app.theme.youTubeLightScheme * Supported services in the NewPipe app and minor information about them for UI decisions. * @property serviceId ID of the service as defined in NewPipeExtractor * @property serviceName Name of the service as defined in NewPipeExtractor + * @property lightScheme Light color scheme to reflect the brand + * @property darkScheme Dark color scheme to reflect the brand + * @property isSchemeColorDensityLight Whether this brand's color schemes are of lighter density. */ enum class Service( val serviceId: Int, val serviceName: String, val lightScheme: ColorScheme, - val darkScheme: ColorScheme + val darkScheme: ColorScheme, + val isSchemeColorDensityLight: Boolean = false ) { YOUTUBE( serviceId = 0,