diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched/MainActivity.kt b/app-android/src/main/java/io/github/droidkaigi/confsched/MainActivity.kt index 141631b36..32c0f9e60 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched/MainActivity.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched/MainActivity.kt @@ -10,6 +10,7 @@ import androidx.activity.enableEdgeToEdge import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue import androidx.compose.runtime.produceState import androidx.compose.runtime.remember @@ -21,8 +22,9 @@ import androidx.window.layout.WindowInfoTracker import dagger.hilt.android.AndroidEntryPoint import io.github.droidkaigi.confsched.data.di.RepositoryProvider import io.github.droidkaigi.confsched.designsystem.theme.dotGothic16FontFamily -import io.github.droidkaigi.confsched.droidkaigiui.KaigiAppCompositionLocalProvider +import io.github.droidkaigi.confsched.droidkaigiui.ProvideAndroidContextToComposeResource import io.github.droidkaigi.confsched.droidkaigiui.compositionlocal.LocalClock +import io.github.droidkaigi.confsched.droidkaigiui.isTest import io.github.droidkaigi.confsched.model.FontFamily.DotGothic16Regular import io.github.droidkaigi.confsched.model.FontFamily.SystemDefault import io.github.droidkaigi.confsched.model.Settings.DoesNotExists @@ -90,11 +92,10 @@ class MainActivity : ComponentActivity() { } } - KaigiAppCompositionLocalProvider( - locals = arrayOf( - LocalClock provides clockProvider.clock(), - ), - ) { + CompositionLocalProvider(LocalClock provides clockProvider.clock()) { + if (isTest()) { + ProvideAndroidContextToComposeResource() + } repositoryProvider.Provide { KaigiApp( windowSize = windowSize, diff --git a/core/droidkaigiui/src/androidMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/KaigiAppCompositionLocalProvider.kt b/core/droidkaigiui/src/androidMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/KaigiAppCompositionLocalProvider.kt deleted file mode 100644 index 12cdbcd51..000000000 --- a/core/droidkaigiui/src/androidMain/kotlin/io/github/droidkaigi/confsched/droidkaigiui/KaigiAppCompositionLocalProvider.kt +++ /dev/null @@ -1,18 +0,0 @@ -package io.github.droidkaigi.confsched.droidkaigiui - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.ProvidedValue - -@Composable -inline fun KaigiAppCompositionLocalProvider( - vararg locals: ProvidedValue<*>, - crossinline content: @Composable () -> Unit, -) { - CompositionLocalProvider(*locals) { - if (isTest()) { - ProvideAndroidContextToComposeResource() - } - content() - } -}