Fix split pane UI not showing after registration on large screen devices.

This commit is contained in:
jeffrey-signal
2025-12-09 10:34:23 -05:00
committed by Michelle Tang
parent 587c9cb46f
commit c33716c7b5
8 changed files with 9 additions and 63 deletions

View File

@@ -20,7 +20,6 @@ import org.thoughtcrime.securesms.util.ThemeUtil
import org.thoughtcrime.securesms.util.ViewUtil
import org.thoughtcrime.securesms.util.WindowUtil
import org.thoughtcrime.securesms.window.getWindowSizeClass
import org.thoughtcrime.securesms.window.isLargeScreenSupportEnabled
import org.thoughtcrime.securesms.window.isSplitPane
import com.google.android.material.R as MaterialR
@@ -33,7 +32,7 @@ abstract class FixedRoundedCornerBottomSheetDialogFragment : BottomSheetDialogFr
* Sheet corner radius in DP
*/
protected val cornerRadius: Int by lazy {
if (isLargeScreenSupportEnabled() && resources.getWindowSizeClass().isSplitPane()) {
if (resources.getWindowSizeClass().isSplitPane()) {
32
} else {
18

View File

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

View File

@@ -347,7 +347,6 @@ import org.thoughtcrime.securesms.util.SignalLocalMetrics
import org.thoughtcrime.securesms.util.TextSecurePreferences
import org.thoughtcrime.securesms.util.ThemeUtil
import org.thoughtcrime.securesms.util.ViewUtil
import org.thoughtcrime.securesms.util.WindowUtil
import org.thoughtcrime.securesms.util.atMidnight
import org.thoughtcrime.securesms.util.atUTC
import org.thoughtcrime.securesms.util.doAfterNextLayout
@@ -370,7 +369,6 @@ import org.thoughtcrime.securesms.verify.VerifyIdentityActivity
import org.thoughtcrime.securesms.wallpaper.ChatWallpaper
import org.thoughtcrime.securesms.wallpaper.ChatWallpaperDimLevelUtil
import org.thoughtcrime.securesms.window.getWindowSizeClass
import org.thoughtcrime.securesms.window.isLargeScreenSupportEnabled
import org.thoughtcrime.securesms.window.isSplitPane
import java.time.Instant
import java.time.LocalDateTime
@@ -714,11 +712,6 @@ class ConversationFragment :
override fun onResume() {
super.onResume()
if (!isLargeScreenSupportEnabled()) {
WindowUtil.setLightNavigationBarFromTheme(requireActivity())
WindowUtil.setLightStatusBarFromTheme(requireActivity())
}
EventBus.getDefault().register(this)
groupCallViewModel.peekGroupCall()
@@ -1514,16 +1507,12 @@ class ConversationFragment :
}
private fun presentNavigationIconForNormal() {
if (isLargeScreenSupportEnabled()) {
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
mainNavigationViewModel.isFullScreenPane.collect { isFullScreenPane ->
updateNavigationIconForNormal(isFullScreenPane)
}
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
mainNavigationViewModel.isFullScreenPane.collect { isFullScreenPane ->
updateNavigationIconForNormal(isFullScreenPane)
}
}
} else {
updateNavigationIconForNormal(true)
}
}
@@ -3676,11 +3665,6 @@ class ConversationFragment :
getVoiceNoteMediaController().resumePlayback(selectedConversationModel.audioUri, messageRecord.id)
}
if (!isLargeScreenSupportEnabled()) {
WindowUtil.setLightStatusBarFromTheme(requireActivity())
WindowUtil.setLightNavigationBarFromTheme(requireActivity())
}
clearFocusedItem()
if (mp4Holder != null) {
@@ -4730,9 +4714,11 @@ class ConversationFragment :
binding.navBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.signal_background_primary))
}
}
MEDIA_KEYBOARD_FRAGMENT_CREATOR_ID -> {
binding.navBar.setBackgroundColor(ThemeUtil.getThemedColor(requireContext(), R.attr.mediaKeyboardBottomBarBackgroundColor))
}
else -> {
Log.w(TAG, "Not setting navbar coloring for unknown creator id $fragmentCreatorId")
}

View File

@@ -51,7 +51,6 @@ import org.thoughtcrime.securesms.conversation.v2.ConversationFragment
import org.thoughtcrime.securesms.serialization.JsonSerializableNavType
import org.thoughtcrime.securesms.window.AppScaffoldAnimationDefaults
import org.thoughtcrime.securesms.window.AppScaffoldAnimationState
import org.thoughtcrime.securesms.window.isLargeScreenSupportEnabled
import org.thoughtcrime.securesms.window.isSplitPane
import kotlin.reflect.typeOf
import kotlin.time.Duration.Companion.milliseconds
@@ -203,7 +202,7 @@ class ChatNavGraphState private constructor(
private var hasWrittenToGraphicsLayer: Boolean by mutableStateOf(false)
suspend fun writeGraphicsLayerToBitmap() {
if (isLargeScreenSupportEnabled() && !windowSizeClass.isSplitPane() && hasWrittenToGraphicsLayer) {
if (!windowSizeClass.isSplitPane() && hasWrittenToGraphicsLayer) {
chatBitmap = graphicsLayer.toImageBitmap()
}
}

View File

@@ -34,7 +34,6 @@ import org.thoughtcrime.securesms.megaphone.Megaphones
import org.thoughtcrime.securesms.notifications.profiles.NotificationProfile
import org.thoughtcrime.securesms.stories.Stories
import org.thoughtcrime.securesms.window.AppScaffoldNavigator
import org.thoughtcrime.securesms.window.isLargeScreenSupportEnabled
import java.util.Optional
@OptIn(ExperimentalMaterial3AdaptiveApi::class)
@@ -198,11 +197,6 @@ class MainNavigationViewModel(
override fun goTo(location: MainNavigationDetailLocation) {
lockPaneToSecondary = false
if (!isLargeScreenSupportEnabled()) {
goToLegacyDetailLocation?.invoke(location)
return
}
if (navigator == null) {
earlyNavigationDetailLocationRequested = location
return

View File

@@ -1130,13 +1130,6 @@ object RemoteConfig {
hotSwappable = false
)
/** Whether to allow different WindowSizeClasses to be used to determine screen layout */
val largeScreenUi: Boolean by remoteBoolean(
key = "android.largeScreenUI.2",
hotSwappable = false,
defaultValue = false
)
@JvmStatic
@get:JvmName("useMessageSendRestFallback")
val useMessageSendRestFallback: Boolean by remoteBoolean(

View File

@@ -38,7 +38,6 @@ import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalInspectionMode
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.zIndex
@@ -103,21 +102,6 @@ fun AppScaffold(
contentWindowInsets: WindowInsets = WindowInsets.systemBars,
animatorFactory: AppScaffoldAnimationStateFactory = AppScaffoldAnimationStateFactory.Default
) {
val isForcedCompact = !LocalInspectionMode.current && !isLargeScreenSupportEnabled()
if (isForcedCompact) {
ListAndNavigation(
topBarContent = topBarContent,
listContent = secondaryContent,
navRailContent = navRailContent,
bottomNavContent = bottomNavContent,
contentWindowInsets = contentWindowInsets,
modifier = modifier
)
return
}
val minPaneWidth = navigator.scaffoldDirective.defaultPanePreferredWidth
val navigationState = navigator.state

View File

@@ -13,7 +13,6 @@ import androidx.window.core.layout.WindowHeightSizeClass
import androidx.window.core.layout.WindowSizeClass
import androidx.window.core.layout.WindowWidthSizeClass
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.util.RemoteConfig
val WindowSizeClass.listPaneDefaultPreferredWidth: Dp get() = if (windowWidthSizeClass.isAtLeast(WindowWidthSizeClass.EXPANDED)) 416.dp else 316.dp
val WindowSizeClass.horizontalPartitionDefaultSpacerSize: Dp get() = 12.dp
@@ -27,13 +26,6 @@ fun WindowWidthSizeClass.isAtLeast(other: WindowWidthSizeClass): Boolean {
return hashCode() >= other.hashCode()
}
/**
* Global check for large screen support, can be inlined after production release.
*/
fun isLargeScreenSupportEnabled(): Boolean {
return RemoteConfig.largeScreenUi
}
@OptIn(ExperimentalWindowCoreApi::class)
fun Resources.getWindowSizeClass(): WindowSizeClass {
return WindowSizeClass.compute(displayMetrics.widthPixels / displayMetrics.density, displayMetrics.heightPixels / displayMetrics.density)