Move large screen check to wrapper.

This commit is contained in:
Alex Hart
2025-09-22 11:24:48 -03:00
committed by Jeffrey Starke
parent cbfdc4b57a
commit 3352ebaa06
4 changed files with 14 additions and 11 deletions

View File

@@ -23,7 +23,7 @@ import org.thoughtcrime.securesms.jobs.ConversationShortcutUpdateJob
import org.thoughtcrime.securesms.util.ConfigurationUtil import org.thoughtcrime.securesms.util.ConfigurationUtil
import org.thoughtcrime.securesms.util.Debouncer import org.thoughtcrime.securesms.util.Debouncer
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme
import org.thoughtcrime.securesms.util.RemoteConfig import org.thoughtcrime.securesms.window.WindowSizeClass
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
/** /**
@@ -53,7 +53,7 @@ open class ConversationActivity : PassphraseRequiredActivity(), VoiceNoteMediaCo
} }
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) { override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
if (RemoteConfig.largeScreenUi) { if (WindowSizeClass.isLargeScreenSupportEnabled()) {
startActivity( startActivity(
MainActivity.clearTop(this).apply { MainActivity.clearTop(this).apply {
action = ConversationIntents.ACTION action = ConversationIntents.ACTION

View File

@@ -28,7 +28,7 @@ import org.thoughtcrime.securesms.megaphone.Megaphone
import org.thoughtcrime.securesms.megaphone.Megaphones import org.thoughtcrime.securesms.megaphone.Megaphones
import org.thoughtcrime.securesms.notifications.profiles.NotificationProfile import org.thoughtcrime.securesms.notifications.profiles.NotificationProfile
import org.thoughtcrime.securesms.stories.Stories import org.thoughtcrime.securesms.stories.Stories
import org.thoughtcrime.securesms.util.RemoteConfig import org.thoughtcrime.securesms.window.WindowSizeClass
@OptIn(ExperimentalMaterial3AdaptiveApi::class) @OptIn(ExperimentalMaterial3AdaptiveApi::class)
class MainNavigationViewModel( class MainNavigationViewModel(
@@ -120,7 +120,7 @@ class MainNavigationViewModel(
* "default" location to that specified, and we will route the user there when the navigator is set. * "default" location to that specified, and we will route the user there when the navigator is set.
*/ */
override fun goTo(location: MainNavigationDetailLocation) { override fun goTo(location: MainNavigationDetailLocation) {
if (!RemoteConfig.largeScreenUi) { if (!WindowSizeClass.isLargeScreenSupportEnabled()) {
goToLegacyDetailLocation?.invoke(location) goToLegacyDetailLocation?.invoke(location)
return return
} }

View File

@@ -1180,12 +1180,11 @@ object RemoteConfig {
) )
/** Whether to allow different WindowSizeClasses to be used to determine screen layout */ /** Whether to allow different WindowSizeClasses to be used to determine screen layout */
val largeScreenUi: Boolean by remoteValue( val largeScreenUi: Boolean by remoteBoolean(
key = "android.largeScreenUI", key = "android.largeScreenUI",
hotSwappable = false hotSwappable = false,
) { value -> defaultValue = false
value.asBoolean(false) && SignalStore.internal.largeScreenUi )
}
@JvmStatic @JvmStatic
@get:JvmName("useMessageSendRestFallback") @get:JvmName("useMessageSendRestFallback")

View File

@@ -95,7 +95,7 @@ enum class WindowSizeClass(
fun isPortrait(): Boolean = !isLandscape() fun isPortrait(): Boolean = !isLandscape()
fun isSplitPane(): Boolean { fun isSplitPane(): Boolean {
return if (RemoteConfig.largeScreenUi && SignalStore.internal.forceSplitPaneOnCompactLandscape) { return if (isLargeScreenSupportEnabled() && SignalStore.internal.forceSplitPaneOnCompactLandscape) {
this != COMPACT_PORTRAIT this != COMPACT_PORTRAIT
} else { } else {
this.navigation != Navigation.BAR this.navigation != Navigation.BAR
@@ -120,8 +120,12 @@ enum class WindowSizeClass(
return getSizeClassForOrientationAndSystemSizeClass(orientation, windowSizeClass) return getSizeClassForOrientationAndSystemSizeClass(orientation, windowSizeClass)
} }
fun isLargeScreenSupportEnabled(): Boolean {
return RemoteConfig.largeScreenUi && SignalStore.internal.largeScreenUi
}
fun isForcedCompact(): Boolean { fun isForcedCompact(): Boolean {
return !RemoteConfig.largeScreenUi return !isLargeScreenSupportEnabled()
} }
@Composable @Composable