Reactions / Raised hands position adjustment.

This commit is contained in:
Alex Hart
2025-12-09 10:09:42 -04:00
committed by Michelle Tang
parent c1caff8005
commit cf04bf8018

View File

@@ -62,6 +62,7 @@ import org.signal.core.ui.compose.BottomSheets
import org.signal.core.ui.compose.Previews import org.signal.core.ui.compose.Previews
import org.signal.core.ui.compose.TriggerAlignedPopupState import org.signal.core.ui.compose.TriggerAlignedPopupState
import org.signal.core.util.DimensionUnit import org.signal.core.util.DimensionUnit
import org.thoughtcrime.securesms.components.emoji.EmojiStrings
import org.thoughtcrime.securesms.components.webrtc.WebRtcLocalRenderState import org.thoughtcrime.securesms.components.webrtc.WebRtcLocalRenderState
import org.thoughtcrime.securesms.components.webrtc.controls.RaiseHandSnackbar import org.thoughtcrime.securesms.components.webrtc.controls.RaiseHandSnackbar
import org.thoughtcrime.securesms.compose.SignalTheme import org.thoughtcrime.securesms.compose.SignalTheme
@@ -260,6 +261,12 @@ fun CallScreen(
0.dp 0.dp
} }
val reactionsAndRaisesHandBottomInset = if (shouldNotApplyBottomPaddingToViewPort) {
padding
} else {
0.dp
}
Viewport( Viewport(
localParticipant = localParticipant, localParticipant = localParticipant,
localRenderState = localRenderState, localRenderState = localRenderState,
@@ -277,7 +284,10 @@ fun CallScreen(
selfPipBottomInset = selfPipBottomInset, selfPipBottomInset = selfPipBottomInset,
modifier = if (shouldNotApplyBottomPaddingToViewPort) { modifier = if (shouldNotApplyBottomPaddingToViewPort) {
Modifier Modifier
} else Modifier.padding(bottom = padding) } else Modifier.padding(bottom = padding),
reactions = reactions,
raiseHandSnackbar = raiseHandSnackbar,
reactionsAndRaisesHandBottomInset = reactionsAndRaisesHandBottomInset
) )
val onCallInfoClick: () -> Unit = { val onCallInfoClick: () -> Unit = {
@@ -323,21 +333,6 @@ fun CallScreen(
.fillMaxSize() .fillMaxSize()
.padding(bottom = padding) .padding(bottom = padding)
) { ) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(bottom = 20.dp)
) {
CallScreenReactionsContainer(
reactions = reactions,
modifier = Modifier.weight(1f)
)
raiseHandSnackbar(
Modifier
)
}
AnimatedCallStateUpdate( AnimatedCallStateUpdate(
callControlsChange = callScreenState.callControlsChange, callControlsChange = callScreenState.callControlsChange,
modifier = Modifier modifier = Modifier
@@ -359,7 +354,9 @@ fun CallScreen(
if (callScreenState.isParticipantUpdatePopupEnabled) { if (callScreenState.isParticipantUpdatePopupEnabled) {
CallParticipantUpdatePopup( CallParticipantUpdatePopup(
controller = callParticipantUpdatePopupController, controller = callParticipantUpdatePopupController,
modifier = Modifier.statusBarsPadding().fillMaxWidth() modifier = Modifier
.statusBarsPadding()
.fillMaxWidth()
) )
} }
} }
@@ -369,6 +366,28 @@ fun CallScreen(
CallScreenDialog(callScreenDialogType, onCallScreenDialogDismissed) CallScreenDialog(callScreenDialogType, onCallScreenDialogDismissed)
} }
@Composable
private fun ReactionsAndRaiseHand(
reactions: List<GroupCallReactionEvent>,
raiseHandSnackbar: @Composable (Modifier) -> Unit,
modifier: Modifier = Modifier
) {
Column(
modifier = modifier
.fillMaxSize()
.padding(bottom = 20.dp)
) {
CallScreenReactionsContainer(
reactions = reactions,
modifier = Modifier.weight(1f)
)
raiseHandSnackbar(
Modifier
)
}
}
/** /**
* Primary 'viewport' which will either render content above or behind the controls depending on * Primary 'viewport' which will either render content above or behind the controls depending on
* whether we are in landscape or portrait. * whether we are in landscape or portrait.
@@ -385,11 +404,14 @@ private fun Viewport(
callControlsState: CallControlsState, callControlsState: CallControlsState,
callScreenState: CallScreenState, callScreenState: CallScreenState,
callScreenController: CallScreenController, callScreenController: CallScreenController,
reactions: List<GroupCallReactionEvent>,
raiseHandSnackbar: @Composable (Modifier) -> Unit,
onPipClick: () -> Unit, onPipClick: () -> Unit,
onPipFocusClick: () -> Unit, onPipFocusClick: () -> Unit,
onControlsToggled: (Boolean) -> Unit, onControlsToggled: (Boolean) -> Unit,
onToggleCameraDirection: () -> Unit, onToggleCameraDirection: () -> Unit,
selfPipBottomInset: Dp, selfPipBottomInset: Dp,
reactionsAndRaisesHandBottomInset: Dp,
modifier: Modifier = Modifier modifier: Modifier = Modifier
) { ) {
val isEmptyOngoingCall = webRtcCallState.inOngoingCall && callParticipantsPagerState.callParticipants.isEmpty() val isEmptyOngoingCall = webRtcCallState.inOngoingCall && callParticipantsPagerState.callParticipants.isEmpty()
@@ -426,13 +448,15 @@ private fun Viewport(
Row(modifier = Modifier.fillMaxSize()) { Row(modifier = Modifier.fillMaxSize()) {
Column( Column(
modifier = Modifier.weight(1f) modifier = Modifier.weight(1f)
) {
Box(
modifier = Modifier.fillMaxWidth().weight(1f)
) { ) {
CallParticipantsPager( CallParticipantsPager(
callParticipantsPagerState = callParticipantsPagerState, callParticipantsPagerState = callParticipantsPagerState,
pagerState = callScreenController.callParticipantsVerticalPagerState, pagerState = callScreenController.callParticipantsVerticalPagerState,
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxSize()
.weight(1f)
.clickable( .clickable(
onClick = { onClick = {
scope.launch { scope.launch {
@@ -443,6 +467,13 @@ private fun Viewport(
) )
) )
ReactionsAndRaiseHand(
reactions = reactions,
raiseHandSnackbar = raiseHandSnackbar,
modifier = Modifier.padding(bottom = reactionsAndRaisesHandBottomInset)
)
}
if (isPortrait && isLargeGroupCall) { if (isPortrait && isLargeGroupCall) {
Row { Row {
CallParticipantsOverflow( CallParticipantsOverflow(
@@ -451,7 +482,6 @@ private fun Viewport(
modifier = Modifier modifier = Modifier
.padding(vertical = 16.dp) .padding(vertical = 16.dp)
.height(callScreenMetrics.overflowParticipantRendererSize) .height(callScreenMetrics.overflowParticipantRendererSize)
.weight(1f)
) )
} }
} }
@@ -465,7 +495,6 @@ private fun Viewport(
modifier = Modifier modifier = Modifier
.padding(horizontal = 16.dp) .padding(horizontal = 16.dp)
.width(callScreenMetrics.overflowParticipantRendererSize) .width(callScreenMetrics.overflowParticipantRendererSize)
.weight(1f)
) )
} }
} }
@@ -606,9 +635,15 @@ private fun CallScreenPreview() {
onNavigationClick = {}, onNavigationClick = {},
onLocalPictureInPictureClicked = {}, onLocalPictureInPictureClicked = {},
onLocalPictureInPictureFocusClicked = {}, onLocalPictureInPictureFocusClicked = {},
overflowParticipants = participants, overflowParticipants = emptyList(), // participants,
onControlsToggled = {}, onControlsToggled = {},
reactions = emptyList(), reactions = listOf(
GroupCallReactionEvent(
sender = participants[0].recipient,
timestamp = System.currentTimeMillis(),
reaction = EmojiStrings.GIFT
)
),
callParticipantUpdatePopupController = remember { CallParticipantUpdatePopupController() } callParticipantUpdatePopupController = remember { CallParticipantUpdatePopupController() }
) )
} }