mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-25 05:27:42 +00:00
Prevent scaffold from being used if we do not have flag enabled.
This commit is contained in:
@@ -84,11 +84,20 @@ enum class WindowSizeClass(
|
||||
return getSizeClassForOrientationAndSystemSizeClass(orientation, windowSizeClass)
|
||||
}
|
||||
|
||||
fun isForcedCompact(): Boolean {
|
||||
return !RemoteConfig.largeScreenUi
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun rememberWindowSizeClass(): WindowSizeClass {
|
||||
fun checkForcedCompact(): Boolean {
|
||||
return !LocalInspectionMode.current && isForcedCompact()
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun rememberWindowSizeClass(forceCompact: Boolean = checkForcedCompact()): WindowSizeClass {
|
||||
val orientation = LocalConfiguration.current.orientation
|
||||
|
||||
if (!LocalInspectionMode.current && !RemoteConfig.largeScreenUi) {
|
||||
if (forceCompact) {
|
||||
return getCompactSizeClassForOrientation(orientation)
|
||||
}
|
||||
|
||||
@@ -149,8 +158,20 @@ fun AppScaffold(
|
||||
bottomNavContent: @Composable () -> Unit = {},
|
||||
listContent: @Composable () -> Unit
|
||||
) {
|
||||
val isForcedCompact = WindowSizeClass.checkForcedCompact()
|
||||
val windowSizeClass = WindowSizeClass.rememberWindowSizeClass()
|
||||
|
||||
if (isForcedCompact) {
|
||||
ListAndNavigation(
|
||||
listContent = listContent,
|
||||
navRailContent = navRailContent,
|
||||
bottomNavContent = bottomNavContent,
|
||||
windowSizeClass = windowSizeClass
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
if (windowSizeClass.isMedium()) {
|
||||
Row {
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
|
||||
Reference in New Issue
Block a user