Show dialog when group call is full.

This commit is contained in:
Alex Hart
2025-01-22 15:15:22 -04:00
committed by GitHub
parent 594959eae2
commit ab88018f36
5 changed files with 26 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ import org.signal.core.util.concurrent.LifecycleDisposable;
import org.signal.core.util.concurrent.SignalExecutors; import org.signal.core.util.concurrent.SignalExecutors;
import org.signal.core.util.logging.Log; import org.signal.core.util.logging.Log;
import org.signal.libsignal.protocol.IdentityKey; import org.signal.libsignal.protocol.IdentityKey;
import org.signal.ringrtc.GroupCall;
import org.thoughtcrime.securesms.components.TooltipPopup; import org.thoughtcrime.securesms.components.TooltipPopup;
import org.thoughtcrime.securesms.components.sensors.Orientation; import org.thoughtcrime.securesms.components.sensors.Orientation;
import org.thoughtcrime.securesms.components.webrtc.CallLinkProfileKeySender; import org.thoughtcrime.securesms.components.webrtc.CallLinkProfileKeySender;
@@ -780,6 +781,13 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
} }
} }
private void handleGroupCallHasMaxDevices(@NonNull Recipient recipient) {
new MaterialAlertDialogBuilder(this)
.setMessage(R.string.WebRtcCallView__call_is_full)
.setPositiveButton(android.R.string.ok, (d, w) -> handleTerminate(recipient, HangupMessage.Type.NORMAL))
.show();
}
private void handleTerminate(@NonNull Recipient recipient, @NonNull HangupMessage.Type hangupType) { private void handleTerminate(@NonNull Recipient recipient, @NonNull HangupMessage.Type hangupType) {
Log.i(TAG, "handleTerminate called: " + hangupType.name()); Log.i(TAG, "handleTerminate called: " + hangupType.name());
@@ -964,7 +972,13 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
case CALL_RINGING: case CALL_RINGING:
handleCallRinging(); break; handleCallRinging(); break;
case CALL_DISCONNECTED: case CALL_DISCONNECTED:
handleTerminate(event.getRecipient(), HangupMessage.Type.NORMAL); break; if (event.getGroupCallEndReason() == GroupCall.GroupCallEndReason.HAS_MAX_DEVICES) {
handleGroupCallHasMaxDevices(event.getRecipient());
} else {
handleTerminate(event.getRecipient(), HangupMessage.Type.NORMAL);
}
break;
case CALL_DISCONNECTED_GLARE: case CALL_DISCONNECTED_GLARE:
handleGlare(event.getRecipient()); break; handleGlare(event.getRecipient()); break;
case CALL_ACCEPTED_ELSEWHERE: case CALL_ACCEPTED_ELSEWHERE:

View File

@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.events package org.thoughtcrime.securesms.events
import com.annimon.stream.OptionalLong import com.annimon.stream.OptionalLong
import org.signal.ringrtc.GroupCall.GroupCallEndReason
import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink import org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink
import org.thoughtcrime.securesms.events.CallParticipant.Companion.createLocal import org.thoughtcrime.securesms.events.CallParticipant.Companion.createLocal
import org.thoughtcrime.securesms.recipients.Recipient import org.thoughtcrime.securesms.recipients.Recipient
@@ -104,6 +105,7 @@ class WebRtcViewModel(state: WebRtcServiceState) {
val pendingParticipants: PendingParticipantCollection = state.callInfoState.pendingParticipants val pendingParticipants: PendingParticipantCollection = state.callInfoState.pendingParticipants
val isCallLink: Boolean = state.callInfoState.callRecipient.isCallLink val isCallLink: Boolean = state.callInfoState.callRecipient.isCallLink
val callLinkDisconnectReason: CallLinkDisconnectReason? = state.callInfoState.callLinkDisconnectReason val callLinkDisconnectReason: CallLinkDisconnectReason? = state.callInfoState.callLinkDisconnectReason
val groupCallEndReason: GroupCallEndReason? = state.callInfoState.groupCallEndReason
@get:JvmName("hasAtLeastOneRemote") @get:JvmName("hasAtLeastOneRemote")
val hasAtLeastOneRemote = if (state.callInfoState.callRecipient.isIndividual) { val hasAtLeastOneRemote = if (state.callInfoState.callRecipient.isIndividual) {

View File

@@ -325,6 +325,7 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
.changeCallInfoState() .changeCallInfoState()
.callState(WebRtcViewModel.State.CALL_DISCONNECTED) .callState(WebRtcViewModel.State.CALL_DISCONNECTED)
.groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED) .groupCallState(WebRtcViewModel.GroupCallState.DISCONNECTED)
.setGroupCallEndReason(groupCallEndReason)
.build(); .build();
webRtcInteractor.postStateUpdate(currentState); webRtcInteractor.postStateUpdate(currentState);

View File

@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.service.webrtc.state
import com.annimon.stream.OptionalLong import com.annimon.stream.OptionalLong
import org.signal.ringrtc.CallId import org.signal.ringrtc.CallId
import org.signal.ringrtc.GroupCall import org.signal.ringrtc.GroupCall
import org.signal.ringrtc.GroupCall.GroupCallEndReason
import org.thoughtcrime.securesms.events.CallParticipant import org.thoughtcrime.securesms.events.CallParticipant
import org.thoughtcrime.securesms.events.CallParticipantId import org.thoughtcrime.securesms.events.CallParticipantId
import org.thoughtcrime.securesms.events.WebRtcViewModel import org.thoughtcrime.securesms.events.WebRtcViewModel
@@ -30,7 +31,8 @@ data class CallInfoState(
var remoteDevicesCount: OptionalLong = OptionalLong.empty(), var remoteDevicesCount: OptionalLong = OptionalLong.empty(),
var participantLimit: Long? = null, var participantLimit: Long? = null,
var pendingParticipants: PendingParticipantCollection = PendingParticipantCollection(), var pendingParticipants: PendingParticipantCollection = PendingParticipantCollection(),
var callLinkDisconnectReason: CallLinkDisconnectReason? = null var callLinkDisconnectReason: CallLinkDisconnectReason? = null,
var groupCallEndReason: GroupCallEndReason? = null
) { ) {
val remoteCallParticipants: List<CallParticipant> val remoteCallParticipants: List<CallParticipant>

View File

@@ -369,5 +369,10 @@ public class WebRtcServiceStateBuilder {
toBuild.setCallLinkDisconnectReason(callLinkDisconnectReason); toBuild.setCallLinkDisconnectReason(callLinkDisconnectReason);
return this; return this;
} }
public @NonNull CallInfoStateBuilder setGroupCallEndReason(@Nullable GroupCall.GroupCallEndReason groupCallEndReason) {
toBuild.setGroupCallEndReason(groupCallEndReason);
return this;
}
} }
} }