mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-24 19:56:00 +00:00
Add remote config support for large screen UI.
This commit is contained in:
committed by
Jeffrey Starke
parent
fd999be41a
commit
9269c66d1e
@@ -20,10 +20,10 @@ import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaController
|
||||
import org.thoughtcrime.securesms.components.voice.VoiceNoteMediaControllerOwner
|
||||
import org.thoughtcrime.securesms.conversation.ConversationIntents
|
||||
import org.thoughtcrime.securesms.jobs.ConversationShortcutUpdateJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.ConfigurationUtil
|
||||
import org.thoughtcrime.securesms.util.Debouncer
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ open class ConversationActivity : PassphraseRequiredActivity(), VoiceNoteMediaCo
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||
if (SignalStore.internal.largeScreenUi) {
|
||||
if (RemoteConfig.largeScreenUi) {
|
||||
startActivity(
|
||||
MainActivity.clearTop(this).apply {
|
||||
action = ConversationIntents.ACTION
|
||||
|
||||
@@ -46,12 +46,12 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
|
||||
/**
|
||||
* Enable or disable the large screen UI.
|
||||
*/
|
||||
var largeScreenUi by booleanValue(LARGE_SCREEN_UI, false).defaultForExternalUsers()
|
||||
var largeScreenUi by booleanValue(LARGE_SCREEN_UI, true).falseForExternalUsers()
|
||||
|
||||
/**
|
||||
* Force split-pane mode on compact landscape
|
||||
*/
|
||||
var forceSplitPaneOnCompactLandscape by booleanValue(FORCE_SPLIT_PANE_ON_COMPACT_LANDSCAPE, false).defaultForExternalUsers()
|
||||
var forceSplitPaneOnCompactLandscape by booleanValue(FORCE_SPLIT_PANE_ON_COMPACT_LANDSCAPE, false).falseForExternalUsers()
|
||||
|
||||
/**
|
||||
* Members will not be added directly to a GV2 even if they could be.
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.thoughtcrime.securesms.megaphone.Megaphone
|
||||
import org.thoughtcrime.securesms.megaphone.Megaphones
|
||||
import org.thoughtcrime.securesms.notifications.profiles.NotificationProfile
|
||||
import org.thoughtcrime.securesms.stories.Stories
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig
|
||||
|
||||
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
|
||||
class MainNavigationViewModel(
|
||||
@@ -119,7 +120,7 @@ class MainNavigationViewModel(
|
||||
* "default" location to that specified, and we will route the user there when the navigator is set.
|
||||
*/
|
||||
override fun goTo(location: MainNavigationDetailLocation) {
|
||||
if (!SignalStore.internal.largeScreenUi) {
|
||||
if (!RemoteConfig.largeScreenUi) {
|
||||
goToLegacyDetailLocation?.invoke(location)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -20,9 +20,13 @@ import org.thoughtcrime.securesms.jobs.Svr3MirrorJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.messageprocessingalarm.RoutineMessageFetchReceiver
|
||||
import org.thoughtcrime.securesms.net.SignalNetwork
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.Config
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.REMOTE_VALUES
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.asBoolean
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.asInteger
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.remoteBoolean
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.remoteValue
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.retryReceiptMaxCount
|
||||
import org.thoughtcrime.securesms.util.RemoteConfig.retryReceiptMaxCountResetAge
|
||||
import org.whispersystems.signalservice.api.NetworkResultUtil
|
||||
import java.io.IOException
|
||||
import java.util.TreeMap
|
||||
@@ -1176,11 +1180,12 @@ object RemoteConfig {
|
||||
)
|
||||
|
||||
/** Whether to allow different WindowSizeClasses to be used to determine screen layout */
|
||||
val largeScreenUi: Boolean by remoteBoolean(
|
||||
val largeScreenUi: Boolean by remoteValue(
|
||||
key = "android.largeScreenUI",
|
||||
defaultValue = false,
|
||||
hotSwappable = false
|
||||
)
|
||||
) { value ->
|
||||
value.asBoolean(false) && SignalStore.internal.largeScreenUi
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@get:JvmName("useMessageSendRestFallback")
|
||||
|
||||
@@ -95,7 +95,7 @@ enum class WindowSizeClass(
|
||||
fun isPortrait(): Boolean = !isLandscape()
|
||||
|
||||
fun isSplitPane(): Boolean {
|
||||
return if (SignalStore.internal.largeScreenUi && SignalStore.internal.forceSplitPaneOnCompactLandscape) {
|
||||
return if (RemoteConfig.largeScreenUi && SignalStore.internal.forceSplitPaneOnCompactLandscape) {
|
||||
this != COMPACT_PORTRAIT
|
||||
} else {
|
||||
this.navigation != Navigation.BAR
|
||||
@@ -121,7 +121,7 @@ enum class WindowSizeClass(
|
||||
}
|
||||
|
||||
fun isForcedCompact(): Boolean {
|
||||
return !SignalStore.internal.largeScreenUi
|
||||
return !RemoteConfig.largeScreenUi
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user