From 4d6cacdb3d3ccfc3a0dcf002b3a172c90f449689 Mon Sep 17 00:00:00 2001 From: Alex Hart Date: Mon, 23 Feb 2026 11:00:32 -0400 Subject: [PATCH] Fix call controls flickering when starting a video call. Co-authored-by: Greyson Parrelli --- .../securesms/components/webrtc/v2/CallControls.kt | 10 ++++++++++ .../securesms/components/webrtc/v2/CallScreen.kt | 3 ++- .../components/webrtc/v2/WebRtcCallViewModel.kt | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallControls.kt b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallControls.kt index 15e3354746..ad741386af 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallControls.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallControls.kt @@ -216,6 +216,16 @@ data class CallControlsState( val startCallButtonText: Int = R.string.WebRtcCallView__start_call, val displayEndCallButton: Boolean = false ) { + + val hasAnyControls: Boolean + get() = displayAudioOutputToggle || + displayVideoToggle || + displayMicToggle || + displayGroupRingingToggle || + displayAdditionalActions || + displayStartCallButton || + displayEndCallButton + companion object { /** * Presentation-level method to build out the controls state from legacy objects. diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallScreen.kt b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallScreen.kt index 9a7284e31e..dc81b2d870 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallScreen.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallScreen.kt @@ -180,11 +180,12 @@ fun CallScreen( val maxOffset = maxHeight - maxSheetHeight var peekHeight by remember { mutableFloatStateOf(88f) } + val effectivePeekHeight = if (callControlsState.hasAnyControls) peekHeight else 0f BottomSheetScaffold( scaffoldState = callScreenController.scaffoldState, sheetDragHandle = null, - sheetPeekHeight = peekHeight.dp, + sheetPeekHeight = effectivePeekHeight.dp, sheetContainerColor = SignalTheme.colors.colorSurface1, containerColor = Color.Black, sheetMaxWidth = CallScreenMetrics.SheetMaxWidth, diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallViewModel.kt index b1346f06d9..b18210f2b5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/WebRtcCallViewModel.kt @@ -22,6 +22,7 @@ import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch @@ -174,6 +175,7 @@ class WebRtcCallViewModel : ViewModel() { 0 } } + .onStart { emit(0) } return combine( callParticipantsState,