mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Provide isEnterpriseBuild value to the Composable.
This commit is contained in:
committed by
Benoit Marty
parent
9111a86be6
commit
c865cf40d6
+8
@@ -9,10 +9,12 @@ package io.element.android.libraries.designsystem.theme
|
|||||||
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.staticCompositionLocalOf
|
||||||
import io.element.android.compound.theme.ElementTheme
|
import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.compound.theme.Theme
|
import io.element.android.compound.theme.Theme
|
||||||
import io.element.android.compound.theme.isDark
|
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.features.enterprise.api.EnterpriseService
|
||||||
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
|
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
|
||||||
|
|
||||||
|
val LocalIsEnterpriseBuild = staticCompositionLocalOf { false }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme to use for all the regular screens of the application.
|
* Theme to use for all the regular screens of the application.
|
||||||
* Will manage the light / dark theme based on the user preference.
|
* Will manage the light / dark theme based on the user preference.
|
||||||
@@ -48,10 +52,14 @@ fun ElementThemeApp(
|
|||||||
}
|
}
|
||||||
val compoundLight = remember { enterpriseService.semanticColorsLight() }
|
val compoundLight = remember { enterpriseService.semanticColorsLight() }
|
||||||
val compoundDark = remember { enterpriseService.semanticColorsDark() }
|
val compoundDark = remember { enterpriseService.semanticColorsDark() }
|
||||||
|
CompositionLocalProvider(
|
||||||
|
LocalIsEnterpriseBuild provides enterpriseService.isEnterpriseBuild,
|
||||||
|
) {
|
||||||
ElementTheme(
|
ElementTheme(
|
||||||
darkTheme = theme.isDark(),
|
darkTheme = theme.isDark(),
|
||||||
content = content,
|
content = content,
|
||||||
compoundLight = compoundLight,
|
compoundLight = compoundLight,
|
||||||
compoundDark = compoundDark,
|
compoundDark = compoundDark,
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user