Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,47 +4,47 @@ agp = "9.1.1"
# ANGLE's own cadence. Built by github.com/NucleusFramework/angle.
angleNatives = "8037.1"
asm = "9.10.1"
bcv = "0.18.1"
awsSdk = "2.54.4"
bcv = "0.18.2"
awsSdk = "2.55.5"
batik = "1.19"
coilVersion = "3.5.0"
compose = "1.12.0"
coilVersion = "3.6.3"
compose = "1.12.1"
coroutines = "1.11.0"
composenativetray = "2.1.0"
composewebview = "1.0.1"
composenativetray = "2.1.6"
composewebview = "1.0.3"
detekt = "2.0.0-alpha.6"
downloadTask = "5.7.0"
filekit = "0.16.0"
graalvmNative = "1.1.3"
graalvmNative = "1.1.14"
# Must match the hot-reload version bundled by the Compose Gradle plugin (which auto-applies
# hot-reload to every Compose module): TaoHotReloadBridgeImpl compiles against these artifacts
# but the runtime ones come from the agent, and the WindowsState API is not binary-stable
# across releases. Compose 1.12.x bundles 1.2.0 — bump both together.
hotReload = "1.2.0"
icons = "262.9437.16"
jewel = "0.39.1-262.9437.29"
icons = "262.10968.63"
jewel = "0.41.0-262.10968.63"
jna = "5.19.1"
kotlin = "2.4.10"
kotlinPoet = "2.3.0"
kotlin = "2.4.20"
kotlinPoet = "2.4.0"
kotlinxSerialization = "1.11.0"
kover = "0.9.9"
ktlintGradle = "14.2.0"
ktor = "3.5.2"
ktor = "3.6.0"
lifecycleViewmodelNavigation3 = "2.11.0"
lighthouse = "2.3.2"
# Only used by :examples:tao-native-test, as the native-image regression fixture for the
# SLF4J/Logback build-time-initialization clash (issue #443).
logback = "1.6.3"
material3 = "1.12.0-alpha03"
materialkolor = "4.1.1"
materialkolor = "5.0.1"
navigation3 = "1.1.1"
materialIcons = "1.7.3"
okhttp = "5.5.0"
pluginPublish = "2.1.1"
pluginPublish = "2.2.1"
reorderable = "3.1.0"
thumbnailator = "0.4.21"
vanniktechMavenPublish = "0.37.0"
versionCheck = "0.61.0"
versionCheck = "0.64.0"
zstdKmp = "0.4.0"

[plugins]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@file:Suppress("DEPRECATION")

package dev.nucleusframework.application

import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.InternalComposeUiApi
import androidx.compose.ui.LocalSystemTheme
import androidx.compose.ui.SystemTheme
import dev.nucleusframework.darkmodedetector.isSystemInDarkMode
import org.jetbrains.skiko.SystemTheme

/**
* Feeds Compose's [androidx.compose.foundation.isSystemInDarkTheme] from
* Nucleus's reactive OS detector.
*
* Compose 1.12 made [LocalSystemTheme] internal and typed it as Skiko's
* [SystemTheme]. Official `isSystemInDarkTheme()` now polls the OS about once
* a second; providing the local from [isSystemInDarkMode] keeps every call
* site on Nucleus's live detector instead of that poll.
* Official `isSystemInDarkTheme()` polls the OS about once a second; providing
* [LocalSystemTheme] from [isSystemInDarkMode] keeps every call site on
* Nucleus's live detector instead of that poll. Compose 1.12.1 deprecates the
* local (public by mistake) but still reads it, so it remains the only hook.
*
* The value is computed *outside* the provider, so the detector never reads the
* local it is about to set (preview path of [isSystemInDarkMode] falls back to
* `isSystemInDarkTheme()`).
*/
@OptIn(InternalComposeUiApi::class)
@Composable
internal fun ProvideNucleusSystemTheme(content: @Composable () -> Unit) {
val isDark = isSystemInDarkMode()
CompositionLocalProvider(
LocalSystemTheme provides if (isDark) SystemTheme.DARK else SystemTheme.LIGHT,
LocalSystemTheme provides if (isDark) SystemTheme.Dark else SystemTheme.Light,
content = content,
)
}
Loading