mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-26 14:09:58 +00:00
Add internal preference for large screen UI.
This commit is contained in:
@@ -240,7 +240,7 @@ class MainActivity : PassphraseRequiredActivity(), VoiceNoteMediaControllerOwner
|
||||
|
||||
LaunchedEffect(detailLocation) {
|
||||
if (detailLocation is MainNavigationDetailLocation.Conversation) {
|
||||
if (RemoteConfig.largeScreenUi) {
|
||||
if (SignalStore.internal.largeScreenUi) {
|
||||
scaffoldNavigator.navigateTo(ThreePaneScaffoldRole.Primary, detailLocation)
|
||||
} else {
|
||||
startActivity((detailLocation as MainNavigationDetailLocation.Conversation).intent)
|
||||
|
||||
@@ -163,6 +163,17 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
||||
)
|
||||
dividerPref()
|
||||
|
||||
sectionHeaderPref(DSLSettingsText.from("App UI"))
|
||||
|
||||
switchPref(
|
||||
title = DSLSettingsText.from("Enable new split pane UI."),
|
||||
summary = DSLSettingsText.from("Warning: Some bugs and non functional buttons are expected."),
|
||||
isChecked = state.largeScreenUi,
|
||||
onClick = {
|
||||
viewModel.setUseLargeScreenUi(!state.largeScreenUi)
|
||||
}
|
||||
)
|
||||
|
||||
sectionHeaderPref(DSLSettingsText.from("Playgrounds"))
|
||||
|
||||
clickPref(
|
||||
|
||||
@@ -25,5 +25,6 @@ data class InternalSettingsState(
|
||||
val useConversationItemV2ForMedia: Boolean,
|
||||
val hasPendingOneTimeDonation: Boolean,
|
||||
val hevcEncoding: Boolean,
|
||||
val newCallingUi: Boolean
|
||||
val newCallingUi: Boolean,
|
||||
val largeScreenUi: Boolean
|
||||
)
|
||||
|
||||
@@ -166,7 +166,8 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
||||
useConversationItemV2ForMedia = SignalStore.internal.useConversationItemV2Media,
|
||||
hasPendingOneTimeDonation = SignalStore.inAppPayments.getPendingOneTimeDonation() != null,
|
||||
hevcEncoding = SignalStore.internal.hevcEncoding,
|
||||
newCallingUi = SignalStore.internal.newCallingUi
|
||||
newCallingUi = SignalStore.internal.newCallingUi,
|
||||
largeScreenUi = SignalStore.internal.largeScreenUi
|
||||
)
|
||||
|
||||
fun onClearOnboardingState() {
|
||||
@@ -182,6 +183,11 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
||||
refresh()
|
||||
}
|
||||
|
||||
fun setUseLargeScreenUi(largeScreenUi: Boolean) {
|
||||
SignalStore.internal.largeScreenUi = largeScreenUi
|
||||
refresh()
|
||||
}
|
||||
|
||||
class Factory(private val repository: InternalSettingsRepository) : ViewModelProvider.Factory {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return requireNotNull(modelClass.cast(InternalSettingsViewModel(repository)))
|
||||
|
||||
@@ -28,12 +28,18 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
|
||||
const val WEB_SOCKET_SHADOWING_STATS: String = "internal.web_socket_shadowing_stats"
|
||||
const val ENCODE_HEVC: String = "internal.hevc_encoding"
|
||||
const val NEW_CALL_UI: String = "internal.new.call.ui"
|
||||
const val LARGE_SCREEN_UI: String = "internal.large.screen.ui"
|
||||
}
|
||||
|
||||
public override fun onFirstEverAppLaunch() = Unit
|
||||
|
||||
public override fun getKeysToIncludeInBackup(): List<String> = emptyList()
|
||||
|
||||
/**
|
||||
* Enable or disable the large screen UI.
|
||||
*/
|
||||
var largeScreenUi by booleanValue(LARGE_SCREEN_UI, false).defaultForExternalUsers()
|
||||
|
||||
/**
|
||||
* Members will not be added directly to a GV2 even if they could be.
|
||||
*/
|
||||
|
||||
@@ -32,6 +32,7 @@ import androidx.window.core.ExperimentalWindowCoreApi
|
||||
import androidx.window.core.layout.WindowHeightSizeClass
|
||||
import androidx.window.core.layout.WindowWidthSizeClass
|
||||
import org.signal.core.ui.compose.Previews
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.main.MainNavigationBar
|
||||
import org.thoughtcrime.securesms.main.MainNavigationRail
|
||||
import org.thoughtcrime.securesms.main.MainNavigationState
|
||||
@@ -72,7 +73,7 @@ enum class WindowSizeClass(
|
||||
fun Resources.getWindowSizeClass(): WindowSizeClass {
|
||||
val orientation = configuration.orientation
|
||||
|
||||
if (!RemoteConfig.largeScreenUi) {
|
||||
if (isForcedCompact()) {
|
||||
return getCompactSizeClassForOrientation(orientation)
|
||||
}
|
||||
|
||||
@@ -86,7 +87,7 @@ enum class WindowSizeClass(
|
||||
}
|
||||
|
||||
fun isForcedCompact(): Boolean {
|
||||
return !RemoteConfig.largeScreenUi
|
||||
return !SignalStore.internal.largeScreenUi
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user