mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Add reactions feed to compose calling screen.
This commit is contained in:
committed by
Greyson Parrelli
parent
25acada838
commit
9f01d7cf67
@@ -60,6 +60,7 @@ import org.signal.core.ui.TriggerAlignedPopupState
|
||||
import org.signal.core.util.DimensionUnit
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcLocalRenderState
|
||||
import org.thoughtcrime.securesms.events.CallParticipant
|
||||
import org.thoughtcrime.securesms.events.GroupCallReactionEvent
|
||||
import org.thoughtcrime.securesms.events.WebRtcViewModel
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import kotlin.math.max
|
||||
@@ -94,6 +95,7 @@ fun CallScreen(
|
||||
localParticipant: CallParticipant,
|
||||
localRenderState: WebRtcLocalRenderState,
|
||||
callScreenDialogType: CallScreenDialogType,
|
||||
reactions: List<GroupCallReactionEvent>,
|
||||
callInfoView: @Composable (Float) -> Unit,
|
||||
raiseHandSnackbar: @Composable (Modifier) -> Unit,
|
||||
onNavigationClick: () -> Unit,
|
||||
@@ -234,6 +236,10 @@ fun CallScreen(
|
||||
callScreenController = callScreenController
|
||||
)
|
||||
}
|
||||
|
||||
CallScreenReactionsContainer(
|
||||
reactions = reactions
|
||||
)
|
||||
}
|
||||
|
||||
val onCallInfoClick: () -> Unit = {
|
||||
@@ -545,7 +551,8 @@ private fun CallScreenPreview() {
|
||||
onNavigationClick = {},
|
||||
onLocalPictureInPictureClicked = {},
|
||||
overflowParticipants = emptyList(),
|
||||
onControlsToggled = {}
|
||||
onControlsToggled = {},
|
||||
reactions = emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright 2025 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.components.webrtc.v2
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.viewinterop.AndroidView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import org.thoughtcrime.securesms.components.recyclerview.NoTouchingRecyclerView
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcReactionsAlphaItemDecoration
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcReactionsItemAnimator
|
||||
import org.thoughtcrime.securesms.components.webrtc.WebRtcReactionsRecyclerAdapter
|
||||
import org.thoughtcrime.securesms.events.GroupCallReactionEvent
|
||||
|
||||
/**
|
||||
* Displays a list of reactions sent during a group call.
|
||||
*
|
||||
* Due to how LazyColumn deals with touch events and how Column doesn't have proper
|
||||
* per-item animation support, we utilize a recycler view as we do in the old call
|
||||
* screen.
|
||||
*/
|
||||
@Composable
|
||||
fun CallScreenReactionsContainer(
|
||||
reactions: List<GroupCallReactionEvent>
|
||||
) {
|
||||
val adapter = remember { WebRtcReactionsRecyclerAdapter() }
|
||||
AndroidView(factory = {
|
||||
val view = NoTouchingRecyclerView(it)
|
||||
view.layoutManager = LinearLayoutManager(it, LinearLayoutManager.VERTICAL, true)
|
||||
view.adapter = adapter
|
||||
view.addItemDecoration(WebRtcReactionsAlphaItemDecoration())
|
||||
view.itemAnimator = WebRtcReactionsItemAnimator()
|
||||
view.isClickable = false
|
||||
view.isVerticalScrollBarEnabled = false
|
||||
|
||||
view
|
||||
}, modifier = Modifier.fillMaxSize().padding(16.dp).padding(bottom = 16.dp)) {
|
||||
adapter.submitList(reactions.toMutableList())
|
||||
}
|
||||
}
|
||||
@@ -133,6 +133,7 @@ class ComposeCallScreenMediator(private val activity: WebRtcCallActivity, viewMo
|
||||
overflowParticipants = callParticipantsState.listParticipants,
|
||||
localParticipant = callParticipantsState.localParticipant,
|
||||
localRenderState = callParticipantsState.localRenderState,
|
||||
reactions = callParticipantsState.reactions,
|
||||
callScreenDialogType = dialog,
|
||||
callInfoView = {
|
||||
CallInfoView.View(
|
||||
|
||||
Reference in New Issue
Block a user