Skip to content

Commit a8467d4

Browse files
alex-signalisopod-a
authored andcommitted
Add reactions feed to compose calling screen.
1 parent 523cb78 commit a8467d4

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/CallScreen.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ import org.signal.core.ui.TriggerAlignedPopupState
6060
import org.signal.core.util.DimensionUnit
6161
import org.thoughtcrime.securesms.components.webrtc.WebRtcLocalRenderState
6262
import org.thoughtcrime.securesms.events.CallParticipant
63+
import org.thoughtcrime.securesms.events.GroupCallReactionEvent
6364
import org.thoughtcrime.securesms.events.WebRtcViewModel
6465
import org.thoughtcrime.securesms.recipients.Recipient
6566
import kotlin.math.max
@@ -94,6 +95,7 @@ fun CallScreen(
9495
localParticipant: CallParticipant,
9596
localRenderState: WebRtcLocalRenderState,
9697
callScreenDialogType: CallScreenDialogType,
98+
reactions: List<GroupCallReactionEvent>,
9799
callInfoView: @Composable (Float) -> Unit,
98100
raiseHandSnackbar: @Composable (Modifier) -> Unit,
99101
onNavigationClick: () -> Unit,
@@ -234,6 +236,10 @@ fun CallScreen(
234236
callScreenController = callScreenController
235237
)
236238
}
239+
240+
CallScreenReactionsContainer(
241+
reactions = reactions
242+
)
237243
}
238244

239245
val onCallInfoClick: () -> Unit = {
@@ -545,7 +551,8 @@ private fun CallScreenPreview() {
545551
onNavigationClick = {},
546552
onLocalPictureInPictureClicked = {},
547553
overflowParticipants = emptyList(),
548-
onControlsToggled = {}
554+
onControlsToggled = {},
555+
reactions = emptyList()
549556
)
550557
}
551558
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2025 Signal Messenger, LLC
3+
* SPDX-License-Identifier: AGPL-3.0-only
4+
*/
5+
6+
package org.thoughtcrime.securesms.components.webrtc.v2
7+
8+
import androidx.compose.foundation.layout.fillMaxSize
9+
import androidx.compose.foundation.layout.padding
10+
import androidx.compose.runtime.Composable
11+
import androidx.compose.runtime.remember
12+
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.unit.dp
14+
import androidx.compose.ui.viewinterop.AndroidView
15+
import androidx.recyclerview.widget.LinearLayoutManager
16+
import org.thoughtcrime.securesms.components.recyclerview.NoTouchingRecyclerView
17+
import org.thoughtcrime.securesms.components.webrtc.WebRtcReactionsAlphaItemDecoration
18+
import org.thoughtcrime.securesms.components.webrtc.WebRtcReactionsItemAnimator
19+
import org.thoughtcrime.securesms.components.webrtc.WebRtcReactionsRecyclerAdapter
20+
import org.thoughtcrime.securesms.events.GroupCallReactionEvent
21+
22+
/**
23+
* Displays a list of reactions sent during a group call.
24+
*
25+
* Due to how LazyColumn deals with touch events and how Column doesn't have proper
26+
* per-item animation support, we utilize a recycler view as we do in the old call
27+
* screen.
28+
*/
29+
@Composable
30+
fun CallScreenReactionsContainer(
31+
reactions: List<GroupCallReactionEvent>
32+
) {
33+
val adapter = remember { WebRtcReactionsRecyclerAdapter() }
34+
AndroidView(factory = {
35+
val view = NoTouchingRecyclerView(it)
36+
view.layoutManager = LinearLayoutManager(it, LinearLayoutManager.VERTICAL, true)
37+
view.adapter = adapter
38+
view.addItemDecoration(WebRtcReactionsAlphaItemDecoration())
39+
view.itemAnimator = WebRtcReactionsItemAnimator()
40+
view.isClickable = false
41+
view.isVerticalScrollBarEnabled = false
42+
43+
view
44+
}, modifier = Modifier.fillMaxSize().padding(16.dp).padding(bottom = 16.dp)) {
45+
adapter.submitList(reactions.toMutableList())
46+
}
47+
}

app/src/main/java/org/thoughtcrime/securesms/components/webrtc/v2/ComposeCallScreenMediator.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ class ComposeCallScreenMediator(private val activity: WebRtcCallActivity, viewMo
133133
overflowParticipants = callParticipantsState.listParticipants,
134134
localParticipant = callParticipantsState.localParticipant,
135135
localRenderState = callParticipantsState.localRenderState,
136+
reactions = callParticipantsState.reactions,
136137
callScreenDialogType = dialog,
137138
callInfoView = {
138139
CallInfoView.View(

0 commit comments

Comments
 (0)