mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Distinguish between primary and secondary devices in participants list.
This commit is contained in:
committed by
Greyson Parrelli
parent
2d20ceea01
commit
0ccc7e3c06
@@ -50,7 +50,8 @@ public class BeginCallActionProcessorDelegate extends WebRtcActionProcessor {
|
||||
false,
|
||||
0,
|
||||
true,
|
||||
0
|
||||
0,
|
||||
CallParticipant.DeviceOrdinal.PRIMARY
|
||||
))
|
||||
.build();
|
||||
|
||||
@@ -93,7 +94,8 @@ public class BeginCallActionProcessorDelegate extends WebRtcActionProcessor {
|
||||
false,
|
||||
0,
|
||||
true,
|
||||
0
|
||||
0,
|
||||
CallParticipant.DeviceOrdinal.PRIMARY
|
||||
))
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -30,8 +30,11 @@ import org.whispersystems.signalservice.api.messages.calls.OpaqueMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Base group call action processor that handles general callbacks around call members
|
||||
@@ -74,8 +77,16 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
|
||||
.changeCallInfoState()
|
||||
.clearParticipantMap();
|
||||
|
||||
List<GroupCall.RemoteDeviceState> remoteDeviceStates = new ArrayList<>(remoteDevices.size());
|
||||
for (int i = 0; i < remoteDevices.size(); i++) {
|
||||
GroupCall.RemoteDeviceState device = remoteDevices.get(remoteDevices.keyAt(i));
|
||||
remoteDeviceStates.add(remoteDevices.get(remoteDevices.keyAt(i)));
|
||||
}
|
||||
Collections.sort(remoteDeviceStates, (a, b) -> Long.compare(a.getAddedTime(), b.getAddedTime()));
|
||||
|
||||
Set<Recipient> seen = new HashSet<>();
|
||||
seen.add(Recipient.self());
|
||||
|
||||
for (GroupCall.RemoteDeviceState device : remoteDeviceStates) {
|
||||
Recipient recipient = Recipient.externalPush(context, device.getUserId(), null, false);
|
||||
CallParticipantId callParticipantId = new CallParticipantId(device.getDemuxId(), recipient.getId());
|
||||
CallParticipant callParticipant = participants.get(callParticipantId);
|
||||
@@ -99,7 +110,11 @@ public class GroupActionProcessor extends DeviceAwareActionProcessor {
|
||||
Boolean.FALSE.equals(device.getVideoMuted()),
|
||||
device.getSpeakerTime(),
|
||||
device.getMediaKeysReceived(),
|
||||
device.getAddedTime()));
|
||||
device.getAddedTime(),
|
||||
seen.contains(recipient) ? CallParticipant.DeviceOrdinal.SECONDARY
|
||||
: CallParticipant.DeviceOrdinal.PRIMARY));
|
||||
|
||||
seen.add(recipient);
|
||||
}
|
||||
|
||||
builder.remoteDevicesCount(remoteDevices.size());
|
||||
|
||||
@@ -122,7 +122,7 @@ public class GroupPreJoinActionProcessor extends GroupActionProcessor {
|
||||
.clearParticipantMap();
|
||||
|
||||
for (Recipient recipient : callParticipants) {
|
||||
builder.putParticipant(recipient, CallParticipant.createRemote(new CallParticipantId(recipient), recipient, null, new BroadcastVideoSink(null), true, true, 0, false, 0));
|
||||
builder.putParticipant(recipient, CallParticipant.createRemote(new CallParticipantId(recipient), recipient, null, new BroadcastVideoSink(null), true, true, 0, false, 0, CallParticipant.DeviceOrdinal.PRIMARY));
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
|
||||
Reference in New Issue
Block a user