Show call full UI when group call is full.

This commit is contained in:
Cody Henthorne
2020-12-07 16:17:39 -05:00
committed by GitHub
parent 13616b9820
commit c00b0727e3
14 changed files with 178 additions and 57 deletions

View File

@@ -430,17 +430,7 @@ public class WebRtcCallService extends Service implements CallManager.Observer,
}
public void sendMessage(@NonNull WebRtcServiceState state) {
EventBus.getDefault().postSticky(new WebRtcViewModel(state.getCallInfoState().getCallState(),
state.getCallInfoState().getGroupCallState(),
state.getCallInfoState().getCallRecipient(),
state.getLocalDeviceState().getCameraState(),
state.getVideoState().getLocalSink(),
state.getLocalDeviceState().isBluetoothAvailable(),
state.getLocalDeviceState().isMicrophoneEnabled(),
state.getCallSetupState().isRemoteVideoOffer(),
state.getCallInfoState().getCallConnectedTime(),
state.getCallInfoState().getRemoteCallParticipants(),
state.getCallInfoState().getIdentityChangedRecipients()));
EventBus.getDefault().postSticky(new WebRtcViewModel(state));
}
private @NonNull ListenableFutureTask<Boolean> sendMessage(@NonNull final RemotePeer remotePeer,

View File

@@ -62,12 +62,17 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
GroupCall groupCall = currentState.getCallInfoState().requireGroupCall();
Map<CallParticipantId, CallParticipant> participants = currentState.getCallInfoState().getRemoteCallParticipantsMap();
LongSparseArray<GroupCall.RemoteDeviceState> remoteDevices = groupCall.getRemoteDeviceStates();
if (remoteDevices == null) {
Log.w(tag, "Unable to update remote devices with null list.");
return currentState;
}
WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder()
.changeCallInfoState()
.clearParticipantMap();
LongSparseArray<GroupCall.RemoteDeviceState> remoteDevices = groupCall.getRemoteDeviceStates();
for (int i = 0; i < remoteDevices.size(); i++) {
GroupCall.RemoteDeviceState device = remoteDevices.get(remoteDevices.keyAt(i));
Recipient recipient = Recipient.externalPush(context, device.getUserId(), null, false);
@@ -96,6 +101,8 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
device.getAddedTime()));
}
builder.remoteDevicesCount(remoteDevices.size());
return builder.build();
}

View File

@@ -112,7 +112,9 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
.toList();
WebRtcServiceStateBuilder.CallInfoStateBuilder builder = currentState.builder()
.changeCallInfoState();
.changeCallInfoState()
.remoteDevicesCount(peekInfo.getDeviceCount())
.participantLimit(peekInfo.getMaxDevices());
for (Recipient recipient : callParticipants) {
builder.putParticipant(recipient, CallParticipant.createRemote(new CallParticipantId(recipient), recipient, null, new BroadcastVideoSink(null), true, true, 0, false, 0));

View File

@@ -35,6 +35,8 @@ public class CallInfoState {
GroupCall groupCall;
WebRtcViewModel.GroupCallState groupState;
Set<RecipientId> identityChangedRecipients;
long remoteDevicesCount;
Long participantLimit;
public CallInfoState() {
this(WebRtcViewModel.State.IDLE,
@@ -45,7 +47,9 @@ public class CallInfoState {
null,
null,
WebRtcViewModel.GroupCallState.IDLE,
Collections.emptySet());
Collections.emptySet(),
0L,
null);
}
public CallInfoState(@NonNull CallInfoState toCopy) {
@@ -57,7 +61,9 @@ public class CallInfoState {
toCopy.activePeer,
toCopy.groupCall,
toCopy.groupState,
toCopy.identityChangedRecipients);
toCopy.identityChangedRecipients,
toCopy.remoteDevicesCount,
toCopy.participantLimit);
}
public CallInfoState(@NonNull WebRtcViewModel.State callState,
@@ -68,7 +74,9 @@ public class CallInfoState {
@Nullable RemotePeer activePeer,
@Nullable GroupCall groupCall,
@NonNull WebRtcViewModel.GroupCallState groupState,
@NonNull Set<RecipientId> identityChangedRecipients)
@NonNull Set<RecipientId> identityChangedRecipients,
long remoteDevicesCount,
@Nullable Long participantLimit)
{
this.callState = callState;
this.callRecipient = callRecipient;
@@ -79,6 +87,8 @@ public class CallInfoState {
this.groupCall = groupCall;
this.groupState = groupState;
this.identityChangedRecipients = new HashSet<>(identityChangedRecipients);
this.remoteDevicesCount = remoteDevicesCount;
this.participantLimit = participantLimit;
}
public @NonNull Recipient getCallRecipient() {
@@ -136,4 +146,12 @@ public class CallInfoState {
public @NonNull Set<RecipientId> getIdentityChangedRecipients() {
return identityChangedRecipients;
}
public long getRemoteDevicesCount() {
return remoteDevicesCount;
}
public @Nullable Long getParticipantLimit() {
return participantLimit;
}
}

View File

@@ -256,5 +256,15 @@ public class WebRtcServiceStateBuilder {
toBuild.identityChangedRecipients.removeAll(ids);
return this;
}
public @NonNull CallInfoStateBuilder remoteDevicesCount(long remoteDevicesCount) {
toBuild.remoteDevicesCount = remoteDevicesCount;
return this;
}
public @NonNull CallInfoStateBuilder participantLimit(@Nullable Long participantLimit) {
toBuild.participantLimit = participantLimit;
return this;
}
}
}