mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-28 12:44:34 +01:00
Add internal preference for large screen UI.
This commit is contained in:
@@ -240,7 +240,7 @@ class MainActivity : PassphraseRequiredActivity(), VoiceNoteMediaControllerOwner
|
|||||||
|
|
||||||
LaunchedEffect(detailLocation) {
|
LaunchedEffect(detailLocation) {
|
||||||
if (detailLocation is MainNavigationDetailLocation.Conversation) {
|
if (detailLocation is MainNavigationDetailLocation.Conversation) {
|
||||||
if (RemoteConfig.largeScreenUi) {
|
if (SignalStore.internal.largeScreenUi) {
|
||||||
scaffoldNavigator.navigateTo(ThreePaneScaffoldRole.Primary, detailLocation)
|
scaffoldNavigator.navigateTo(ThreePaneScaffoldRole.Primary, detailLocation)
|
||||||
} else {
|
} else {
|
||||||
startActivity((detailLocation as MainNavigationDetailLocation.Conversation).intent)
|
startActivity((detailLocation as MainNavigationDetailLocation.Conversation).intent)
|
||||||
|
|||||||
@@ -163,6 +163,17 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
|
|||||||
)
|
)
|
||||||
dividerPref()
|
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"))
|
sectionHeaderPref(DSLSettingsText.from("Playgrounds"))
|
||||||
|
|
||||||
clickPref(
|
clickPref(
|
||||||
|
|||||||
@@ -25,5 +25,6 @@ data class InternalSettingsState(
|
|||||||
val useConversationItemV2ForMedia: Boolean,
|
val useConversationItemV2ForMedia: Boolean,
|
||||||
val hasPendingOneTimeDonation: Boolean,
|
val hasPendingOneTimeDonation: Boolean,
|
||||||
val hevcEncoding: 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,
|
useConversationItemV2ForMedia = SignalStore.internal.useConversationItemV2Media,
|
||||||
hasPendingOneTimeDonation = SignalStore.inAppPayments.getPendingOneTimeDonation() != null,
|
hasPendingOneTimeDonation = SignalStore.inAppPayments.getPendingOneTimeDonation() != null,
|
||||||
hevcEncoding = SignalStore.internal.hevcEncoding,
|
hevcEncoding = SignalStore.internal.hevcEncoding,
|
||||||
newCallingUi = SignalStore.internal.newCallingUi
|
newCallingUi = SignalStore.internal.newCallingUi,
|
||||||
|
largeScreenUi = SignalStore.internal.largeScreenUi
|
||||||
)
|
)
|
||||||
|
|
||||||
fun onClearOnboardingState() {
|
fun onClearOnboardingState() {
|
||||||
@@ -182,6 +183,11 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
|
|||||||
refresh()
|
refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setUseLargeScreenUi(largeScreenUi: Boolean) {
|
||||||
|
SignalStore.internal.largeScreenUi = largeScreenUi
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
class Factory(private val repository: InternalSettingsRepository) : ViewModelProvider.Factory {
|
class Factory(private val repository: InternalSettingsRepository) : ViewModelProvider.Factory {
|
||||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||||
return requireNotNull(modelClass.cast(InternalSettingsViewModel(repository)))
|
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 WEB_SOCKET_SHADOWING_STATS: String = "internal.web_socket_shadowing_stats"
|
||||||
const val ENCODE_HEVC: String = "internal.hevc_encoding"
|
const val ENCODE_HEVC: String = "internal.hevc_encoding"
|
||||||
const val NEW_CALL_UI: String = "internal.new.call.ui"
|
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 onFirstEverAppLaunch() = Unit
|
||||||
|
|
||||||
public override fun getKeysToIncludeInBackup(): List<String> = emptyList()
|
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.
|
* 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.WindowHeightSizeClass
|
||||||
import androidx.window.core.layout.WindowWidthSizeClass
|
import androidx.window.core.layout.WindowWidthSizeClass
|
||||||
import org.signal.core.ui.compose.Previews
|
import org.signal.core.ui.compose.Previews
|
||||||
|
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||||
import org.thoughtcrime.securesms.main.MainNavigationBar
|
import org.thoughtcrime.securesms.main.MainNavigationBar
|
||||||
import org.thoughtcrime.securesms.main.MainNavigationRail
|
import org.thoughtcrime.securesms.main.MainNavigationRail
|
||||||
import org.thoughtcrime.securesms.main.MainNavigationState
|
import org.thoughtcrime.securesms.main.MainNavigationState
|
||||||
@@ -72,7 +73,7 @@ enum class WindowSizeClass(
|
|||||||
fun Resources.getWindowSizeClass(): WindowSizeClass {
|
fun Resources.getWindowSizeClass(): WindowSizeClass {
|
||||||
val orientation = configuration.orientation
|
val orientation = configuration.orientation
|
||||||
|
|
||||||
if (!RemoteConfig.largeScreenUi) {
|
if (isForcedCompact()) {
|
||||||
return getCompactSizeClassForOrientation(orientation)
|
return getCompactSizeClassForOrientation(orientation)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ enum class WindowSizeClass(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isForcedCompact(): Boolean {
|
fun isForcedCompact(): Boolean {
|
||||||
return !RemoteConfig.largeScreenUi
|
return !SignalStore.internal.largeScreenUi
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
Reference in New Issue
Block a user