package eu.friedcutlet.yokan.services.media.player import platform.UIKit.UIScreen /** UIScreen brightness is system-wide, so the value before the first change is restored on exit. */ private var systemBrightness: Double? = null internal actual fun setPlayerScreenBrightness(level: Float?): Boolean { val screen = UIScreen.mainScreen if (level == null) { systemBrightness?.let { screen.brightness = it } systemBrightness = null } else { if (systemBrightness == null) systemBrightness = screen.brightness screen.brightness = level.coerceIn(0f, 1f).toDouble() } return true }