Initial raise hand support.

This commit is contained in:
Nicholas Tinsley
2023-12-08 21:07:00 -05:00
committed by Cody Henthorne
parent f2a7824168
commit c2f5a6390e
28 changed files with 577 additions and 23 deletions

View File

@@ -16,6 +16,7 @@ data class CallParticipant constructor(
val isForwardingVideo: Boolean = true,
val isVideoEnabled: Boolean = false,
val isMicrophoneEnabled: Boolean = false,
val isHandRaised: Boolean = false,
val lastSpoke: Long = 0,
val audioLevel: AudioLevel? = null,
val isMediaKeysReceived: Boolean = true,
@@ -109,7 +110,8 @@ data class CallParticipant constructor(
fun createLocal(
cameraState: CameraState,
renderer: BroadcastVideoSink,
microphoneEnabled: Boolean
microphoneEnabled: Boolean,
isHandRaised: Boolean
): CallParticipant {
return CallParticipant(
callParticipantId = CallParticipantId(Recipient.self()),
@@ -117,7 +119,8 @@ data class CallParticipant constructor(
videoSink = renderer,
cameraState = cameraState,
isVideoEnabled = cameraState.isEnabled && cameraState.cameraCount > 0,
isMicrophoneEnabled = microphoneEnabled
isMicrophoneEnabled = microphoneEnabled,
isHandRaised = isHandRaised
)
}
@@ -130,6 +133,7 @@ data class CallParticipant constructor(
isForwardingVideo: Boolean,
audioEnabled: Boolean,
videoEnabled: Boolean,
isHandRaised: Boolean,
lastSpoke: Long,
mediaKeysReceived: Boolean,
addedToCallTime: Long,
@@ -144,6 +148,7 @@ data class CallParticipant constructor(
isForwardingVideo = isForwardingVideo,
isVideoEnabled = videoEnabled,
isMicrophoneEnabled = audioEnabled,
isHandRaised = isHandRaised,
lastSpoke = lastSpoke,
isMediaKeysReceived = mediaKeysReceived,
addedToCallTime = addedToCallTime,

View File

@@ -0,0 +1,19 @@
/*
* Copyright 2023 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.events
import org.thoughtcrime.securesms.recipients.Recipient
import java.util.concurrent.TimeUnit
data class GroupCallRaiseHandEvent(val sender: Recipient, val timestamp: Long) {
fun getCollapseTimestamp(): Long {
return timestamp + TimeUnit.SECONDS.toMillis(LIFESPAN_SECONDS)
}
companion object {
const val LIFESPAN_SECONDS = 4L
}
}

View File

@@ -92,6 +92,7 @@ class WebRtcViewModel(state: WebRtcServiceState) {
val isRemoteVideoOffer: Boolean = state.getCallSetupState(state.callInfoState.activePeer?.callId).isRemoteVideoOffer
val callConnectedTime: Long = state.callInfoState.callConnectedTime
val remoteParticipants: List<CallParticipant> = state.callInfoState.remoteCallParticipants
val raisedHands: List<GroupCallRaiseHandEvent> = state.callInfoState.raisedHands
val identityChangedParticipants: Set<RecipientId> = state.callInfoState.identityChangedRecipients
val remoteDevicesCount: OptionalLong = state.callInfoState.remoteDevicesCount
val participantLimit: Long? = state.callInfoState.participantLimit
@@ -109,7 +110,8 @@ class WebRtcViewModel(state: WebRtcServiceState) {
val localParticipant: CallParticipant = createLocal(
state.localDeviceState.cameraState,
(if (state.videoState.localSink != null) state.videoState.localSink else BroadcastVideoSink())!!,
state.localDeviceState.isMicrophoneEnabled
state.localDeviceState.isMicrophoneEnabled,
state.callInfoState.raisedHands.map { it.sender }.contains(Recipient.self())
)
val isCellularConnection: Boolean = when (state.localDeviceState.networkConnectionType) {