Search in sources :

Example 1 with PeekInfo

use of org.signal.ringrtc.PeekInfo in project Signal-Android by WhisperSystems.

the class GroupPreJoinActionProcessor method handleGroupJoinedMembershipChanged.

@Override
@NonNull
protected WebRtcServiceState handleGroupJoinedMembershipChanged(@NonNull WebRtcServiceState currentState) {
    Log.i(tag, "handleGroupJoinedMembershipChanged():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    PeekInfo peekInfo = groupCall.getPeekInfo();
    if (peekInfo == null) {
        Log.i(tag, "No peek info available");
        return currentState;
    }
    List<Recipient> callParticipants = Stream.of(peekInfo.getJoinedMembers()).map(uuid -> Recipient.externalPush(ACI.from(uuid), null, false)).toList();
    WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder().changeCallInfoState().remoteDevicesCount(peekInfo.getDeviceCount()).participantLimit(peekInfo.getMaxDevices()).clearParticipantMap();
    for (Recipient recipient : callParticipants) {
        builder.putParticipant(recipient, CallParticipant.createRemote(new CallParticipantId(recipient), recipient, null, new BroadcastVideoSink(), true, true, 0, false, 0, false, CallParticipant.DeviceOrdinal.PRIMARY));
    }
    return builder.build();
}
Also used : SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) Stream(com.annimon.stream.Stream) ACI(org.whispersystems.signalservice.api.push.ACI) NonNull(androidx.annotation.NonNull) WebRtcViewModel(org.thoughtcrime.securesms.events.WebRtcViewModel) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) TYPE_OUTGOING_RINGING(org.thoughtcrime.securesms.webrtc.CallNotificationBuilder.TYPE_OUTGOING_RINGING) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) OfferMessage(org.whispersystems.signalservice.api.messages.calls.OfferMessage) EglBaseWrapper(org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper) CallException(org.signal.ringrtc.CallException) GroupCall(org.signal.ringrtc.GroupCall) Log(org.signal.core.util.logging.Log) List(java.util.List) CallParticipantId(org.thoughtcrime.securesms.events.CallParticipantId) PeekInfo(org.signal.ringrtc.PeekInfo) NetworkUtil(org.thoughtcrime.securesms.util.NetworkUtil) Recipient(org.thoughtcrime.securesms.recipients.Recipient) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) WebRtcServiceState(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) GroupCall(org.signal.ringrtc.GroupCall) PeekInfo(org.signal.ringrtc.PeekInfo) Recipient(org.thoughtcrime.securesms.recipients.Recipient) CallParticipantId(org.thoughtcrime.securesms.events.CallParticipantId) NonNull(androidx.annotation.NonNull)

Example 2 with PeekInfo

use of org.signal.ringrtc.PeekInfo in project Signal-Android by signalapp.

the class GroupPreJoinActionProcessor method handleGroupJoinedMembershipChanged.

@Override
@NonNull
protected WebRtcServiceState handleGroupJoinedMembershipChanged(@NonNull WebRtcServiceState currentState) {
    Log.i(tag, "handleGroupJoinedMembershipChanged():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    PeekInfo peekInfo = groupCall.getPeekInfo();
    if (peekInfo == null) {
        Log.i(tag, "No peek info available");
        return currentState;
    }
    List<Recipient> callParticipants = Stream.of(peekInfo.getJoinedMembers()).map(uuid -> Recipient.externalPush(ACI.from(uuid), null, false)).toList();
    WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder().changeCallInfoState().remoteDevicesCount(peekInfo.getDeviceCount()).participantLimit(peekInfo.getMaxDevices()).clearParticipantMap();
    for (Recipient recipient : callParticipants) {
        builder.putParticipant(recipient, CallParticipant.createRemote(new CallParticipantId(recipient), recipient, null, new BroadcastVideoSink(), true, true, 0, false, 0, false, CallParticipant.DeviceOrdinal.PRIMARY));
    }
    return builder.build();
}
Also used : SignalStore(org.thoughtcrime.securesms.keyvalue.SignalStore) RemotePeer(org.thoughtcrime.securesms.ringrtc.RemotePeer) Stream(com.annimon.stream.Stream) ACI(org.whispersystems.signalservice.api.push.ACI) NonNull(androidx.annotation.NonNull) WebRtcViewModel(org.thoughtcrime.securesms.events.WebRtcViewModel) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) TYPE_OUTGOING_RINGING(org.thoughtcrime.securesms.webrtc.CallNotificationBuilder.TYPE_OUTGOING_RINGING) CallParticipant(org.thoughtcrime.securesms.events.CallParticipant) OfferMessage(org.whispersystems.signalservice.api.messages.calls.OfferMessage) EglBaseWrapper(org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper) CallException(org.signal.ringrtc.CallException) GroupCall(org.signal.ringrtc.GroupCall) Log(org.signal.core.util.logging.Log) List(java.util.List) CallParticipantId(org.thoughtcrime.securesms.events.CallParticipantId) PeekInfo(org.signal.ringrtc.PeekInfo) NetworkUtil(org.thoughtcrime.securesms.util.NetworkUtil) Recipient(org.thoughtcrime.securesms.recipients.Recipient) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) WebRtcServiceState(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState) BroadcastVideoSink(org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink) WebRtcServiceStateBuilder(org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder) GroupCall(org.signal.ringrtc.GroupCall) PeekInfo(org.signal.ringrtc.PeekInfo) Recipient(org.thoughtcrime.securesms.recipients.Recipient) CallParticipantId(org.thoughtcrime.securesms.events.CallParticipantId) NonNull(androidx.annotation.NonNull)

Example 3 with PeekInfo

use of org.signal.ringrtc.PeekInfo in project Signal-Android by WhisperSystems.

the class GroupConnectedActionProcessor method handleGroupJoinedMembershipChanged.

@Override
@NonNull
protected WebRtcServiceState handleGroupJoinedMembershipChanged(@NonNull WebRtcServiceState currentState) {
    Log.i(tag, "handleGroupJoinedMembershipChanged():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    PeekInfo peekInfo = groupCall.getPeekInfo();
    if (peekInfo == null) {
        return currentState;
    }
    if (currentState.getCallSetupState(RemotePeer.GROUP_CALL_ID).hasSentJoinedMessage()) {
        return currentState;
    }
    String eraId = WebRtcUtil.getGroupCallEraId(groupCall);
    webRtcInteractor.sendGroupCallMessage(currentState.getCallInfoState().getCallRecipient(), eraId);
    List<UUID> members = new ArrayList<>(peekInfo.getJoinedMembers());
    if (!members.contains(Recipient.self().requireServiceId().uuid())) {
        members.add(Recipient.self().requireServiceId().uuid());
    }
    webRtcInteractor.updateGroupCallUpdateMessage(currentState.getCallInfoState().getCallRecipient().getId(), eraId, members, WebRtcUtil.isCallFull(peekInfo));
    return currentState.builder().changeCallSetupState(RemotePeer.GROUP_CALL_ID).sentJoinedMessage(true).build();
}
Also used : GroupCall(org.signal.ringrtc.GroupCall) ArrayList(java.util.ArrayList) PeekInfo(org.signal.ringrtc.PeekInfo) UUID(java.util.UUID) NonNull(androidx.annotation.NonNull)

Example 4 with PeekInfo

use of org.signal.ringrtc.PeekInfo in project Signal-Android by signalapp.

the class GroupConnectedActionProcessor method handleGroupJoinedMembershipChanged.

@Override
@NonNull
protected WebRtcServiceState handleGroupJoinedMembershipChanged(@NonNull WebRtcServiceState currentState) {
    Log.i(tag, "handleGroupJoinedMembershipChanged():");
    GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
    PeekInfo peekInfo = groupCall.getPeekInfo();
    if (peekInfo == null) {
        return currentState;
    }
    if (currentState.getCallSetupState(RemotePeer.GROUP_CALL_ID).hasSentJoinedMessage()) {
        return currentState;
    }
    String eraId = WebRtcUtil.getGroupCallEraId(groupCall);
    webRtcInteractor.sendGroupCallMessage(currentState.getCallInfoState().getCallRecipient(), eraId);
    List<UUID> members = new ArrayList<>(peekInfo.getJoinedMembers());
    if (!members.contains(Recipient.self().requireServiceId().uuid())) {
        members.add(Recipient.self().requireServiceId().uuid());
    }
    webRtcInteractor.updateGroupCallUpdateMessage(currentState.getCallInfoState().getCallRecipient().getId(), eraId, members, WebRtcUtil.isCallFull(peekInfo));
    return currentState.builder().changeCallSetupState(RemotePeer.GROUP_CALL_ID).sentJoinedMessage(true).build();
}
Also used : GroupCall(org.signal.ringrtc.GroupCall) ArrayList(java.util.ArrayList) PeekInfo(org.signal.ringrtc.PeekInfo) UUID(java.util.UUID) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)4 GroupCall (org.signal.ringrtc.GroupCall)4 PeekInfo (org.signal.ringrtc.PeekInfo)4 Stream (com.annimon.stream.Stream)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 UUID (java.util.UUID)2 Log (org.signal.core.util.logging.Log)2 CallException (org.signal.ringrtc.CallException)2 BroadcastVideoSink (org.thoughtcrime.securesms.components.webrtc.BroadcastVideoSink)2 EglBaseWrapper (org.thoughtcrime.securesms.components.webrtc.EglBaseWrapper)2 CallParticipant (org.thoughtcrime.securesms.events.CallParticipant)2 CallParticipantId (org.thoughtcrime.securesms.events.CallParticipantId)2 WebRtcViewModel (org.thoughtcrime.securesms.events.WebRtcViewModel)2 SignalStore (org.thoughtcrime.securesms.keyvalue.SignalStore)2 Recipient (org.thoughtcrime.securesms.recipients.Recipient)2 RemotePeer (org.thoughtcrime.securesms.ringrtc.RemotePeer)2 WebRtcServiceState (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceState)2 WebRtcServiceStateBuilder (org.thoughtcrime.securesms.service.webrtc.state.WebRtcServiceStateBuilder)2 NetworkUtil (org.thoughtcrime.securesms.util.NetworkUtil)2