Provide isEnterpriseBuild value to the Composable.
This commit is contained in:
parent
56643f85df
commit
00507fa309
1 changed files with 14 additions and 6 deletions
|
|
@ -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() }
|
||||||
ElementTheme(
|
CompositionLocalProvider(
|
||||||
darkTheme = theme.isDark(),
|
LocalIsEnterpriseBuild provides enterpriseService.isEnterpriseBuild,
|
||||||
content = content,
|
) {
|
||||||
compoundLight = compoundLight,
|
ElementTheme(
|
||||||
compoundDark = compoundDark,
|
darkTheme = theme.isDark(),
|
||||||
)
|
content = content,
|
||||||
|
compoundLight = compoundLight,
|
||||||
|
compoundDark = compoundDark,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue