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
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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.logging.Log;
import org.signal.libsignal.protocol.IdentityKey;
import org.signal.ringrtc.GroupCall;
import org.thoughtcrime.securesms.components.TooltipPopup;
import org.thoughtcrime.securesms.components.sensors.Orientation;
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) {
Log.i(TAG, "handleTerminate called: " + hangupType.name());
@ -964,7 +972,13 @@ public class WebRtcCallActivity extends BaseActivity implements SafetyNumberChan
case CALL_RINGING:
handleCallRinging(); break;
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:
handleGlare(event.getRecipient()); break;
case CALL_ACCEPTED_ELSEWHERE:

View file

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

View file

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

View file

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

View file

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