Provide isEnterpriseBuild value to the Composable.

This commit is contained in:
Benoit Marty
2025-03-07 17:21:11 +01:00
committed by Benoit Marty
parent 56643f85df
commit 00507fa309

View File

@@ -9,10 +9,12 @@ package io.element.android.libraries.designsystem.theme
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.staticCompositionLocalOf
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.theme.Theme
import io.element.android.compound.theme.isDark
@@ -20,6 +22,8 @@ import io.element.android.compound.theme.mapToTheme
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
val LocalIsEnterpriseBuild = staticCompositionLocalOf { false }
/**
* Theme to use for all the regular screens of the application.
* Will manage the light / dark theme based on the user preference.
@@ -48,10 +52,14 @@ fun ElementThemeApp(
}
val compoundLight = remember { enterpriseService.semanticColorsLight() }
val compoundDark = remember { enterpriseService.semanticColorsDark() }
ElementTheme(
darkTheme = theme.isDark(),
content = content,
compoundLight = compoundLight,
compoundDark = compoundDark,
)
CompositionLocalProvider(
LocalIsEnterpriseBuild provides enterpriseService.isEnterpriseBuild,
) {
ElementTheme(
darkTheme = theme.isDark(),
content = content,
compoundLight = compoundLight,
compoundDark = compoundDark,
)
}
}