mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add denial dialogs for call links.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2023 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.thoughtcrime.securesms.service.webrtc
|
||||
|
||||
/**
|
||||
* Describes why a user was not able to join a call link.
|
||||
*
|
||||
* Note: postedAt is kept as a long to ensure Java compatibility.
|
||||
*/
|
||||
sealed interface CallLinkDisconnectReason {
|
||||
val postedAt: Long
|
||||
|
||||
data class RemovedFromCall(override val postedAt: Long = System.currentTimeMillis()) : CallLinkDisconnectReason
|
||||
data class DeniedRequestToJoinCall(override val postedAt: Long = System.currentTimeMillis()) : CallLinkDisconnectReason
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.thoughtcrime.securesms.service.webrtc
|
||||
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.ringrtc.GroupCall
|
||||
import org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState
|
||||
|
||||
/**
|
||||
@@ -25,4 +26,19 @@ class CallLinkJoiningActionProcessor(
|
||||
|
||||
return currentState
|
||||
}
|
||||
|
||||
override fun handleGroupCallEnded(currentState: WebRtcServiceState, groupCallHash: Int, groupCallEndReason: GroupCall.GroupCallEndReason): WebRtcServiceState {
|
||||
val serviceState = super.handleGroupCallEnded(currentState, groupCallHash, groupCallEndReason)
|
||||
|
||||
val callLinkDisconnectReason = when (groupCallEndReason) {
|
||||
GroupCall.GroupCallEndReason.DENIED_REQUEST_TO_JOIN_CALL -> CallLinkDisconnectReason.DeniedRequestToJoinCall()
|
||||
GroupCall.GroupCallEndReason.REMOVED_FROM_CALL -> CallLinkDisconnectReason.RemovedFromCall()
|
||||
else -> null
|
||||
}
|
||||
|
||||
return serviceState.builder()
|
||||
.changeCallInfoState()
|
||||
.setCallLinkDisconnectReason(callLinkDisconnectReason)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import org.thoughtcrime.securesms.events.WebRtcViewModel
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer
|
||||
import org.thoughtcrime.securesms.service.webrtc.CallLinkDisconnectReason
|
||||
import org.thoughtcrime.securesms.service.webrtc.PendingParticipantCollection
|
||||
|
||||
/**
|
||||
@@ -28,7 +29,8 @@ data class CallInfoState(
|
||||
var identityChangedRecipients: MutableSet<RecipientId> = mutableSetOf(),
|
||||
var remoteDevicesCount: OptionalLong = OptionalLong.empty(),
|
||||
var participantLimit: Long? = null,
|
||||
var pendingParticipants: PendingParticipantCollection = PendingParticipantCollection()
|
||||
var pendingParticipants: PendingParticipantCollection = PendingParticipantCollection(),
|
||||
var callLinkDisconnectReason: CallLinkDisconnectReason? = null
|
||||
) {
|
||||
|
||||
val remoteCallParticipants: List<CallParticipant>
|
||||
|
||||
@@ -18,6 +18,7 @@ import org.thoughtcrime.securesms.recipients.RecipientId;
|
||||
import org.thoughtcrime.securesms.ringrtc.Camera;
|
||||
import org.thoughtcrime.securesms.ringrtc.CameraState;
|
||||
import org.thoughtcrime.securesms.ringrtc.RemotePeer;
|
||||
import org.thoughtcrime.securesms.service.webrtc.CallLinkDisconnectReason;
|
||||
import org.thoughtcrime.securesms.service.webrtc.WebRtcActionProcessor;
|
||||
import org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager;
|
||||
import org.webrtc.PeerConnection;
|
||||
@@ -358,5 +359,10 @@ public class WebRtcServiceStateBuilder {
|
||||
toBuild.setPendingParticipants(toBuild.getPendingParticipants().withDenial(participant));
|
||||
return this;
|
||||
}
|
||||
|
||||
public @NonNull CallInfoStateBuilder setCallLinkDisconnectReason(@Nullable CallLinkDisconnectReason callLinkDisconnectReason) {
|
||||
toBuild.setCallLinkDisconnectReason(callLinkDisconnectReason);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user