|
@@ -1,5 +1,6 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
|
3
|
+import { SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED } from '../../video-layout/actionTypes';
|
3
|
4
|
import { ReducerRegistry, set } from '../redux';
|
4
|
5
|
|
5
|
6
|
import {
|
|
@@ -61,6 +62,7 @@ const DEFAULT_STATE = {
|
61
|
62
|
pinnedParticipant: undefined,
|
62
|
63
|
remote: new Map(),
|
63
|
64
|
sortedRemoteParticipants: new Map(),
|
|
65
|
+ sortedRemoteScreenshares: new Map(),
|
64
|
66
|
speakersList: new Map()
|
65
|
67
|
};
|
66
|
68
|
|
|
@@ -96,26 +98,18 @@ ReducerRegistry.register('features/base/participants', (state = DEFAULT_STATE, a
|
96
|
98
|
case DOMINANT_SPEAKER_CHANGED: {
|
97
|
99
|
const { participant } = action;
|
98
|
100
|
const { id, previousSpeakers = [] } = participant;
|
99
|
|
- const { dominantSpeaker, local, speakersList } = state;
|
|
101
|
+ const { dominantSpeaker, local } = state;
|
100
|
102
|
const newSpeakers = [ id, ...previousSpeakers ];
|
101
|
|
- const sortedSpeakersList = Array.from(speakersList);
|
|
103
|
+ const sortedSpeakersList = [];
|
102
|
104
|
|
103
|
|
- // Update the speakers list.
|
104
|
105
|
for (const speaker of newSpeakers) {
|
105
|
|
- if (!state.speakersList.has(speaker) && speaker !== local?.id) {
|
|
106
|
+ if (speaker !== local?.id) {
|
106
|
107
|
const remoteParticipant = state.remote.get(speaker);
|
107
|
108
|
|
108
|
109
|
remoteParticipant && sortedSpeakersList.push([ speaker, _getDisplayName(remoteParticipant.name) ]);
|
109
|
110
|
}
|
110
|
111
|
}
|
111
|
112
|
|
112
|
|
- // Also check if any of the existing speakers have been kicked off the list.
|
113
|
|
- for (const existingSpeaker of sortedSpeakersList.keys()) {
|
114
|
|
- if (!newSpeakers.find(s => s === existingSpeaker)) {
|
115
|
|
- sortedSpeakersList.filter(sortedSpeaker => sortedSpeaker[0] !== existingSpeaker);
|
116
|
|
- }
|
117
|
|
- }
|
118
|
|
-
|
119
|
113
|
// Keep the remote speaker list sorted alphabetically.
|
120
|
114
|
sortedSpeakersList.sort((a, b) => a[1].localeCompare(b[1]));
|
121
|
115
|
|
|
@@ -324,6 +318,26 @@ ReducerRegistry.register('features/base/participants', (state = DEFAULT_STATE, a
|
324
|
318
|
|
325
|
319
|
return { ...state };
|
326
|
320
|
}
|
|
321
|
+ case SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED: {
|
|
322
|
+ const { participantIds } = action;
|
|
323
|
+ const sortedSharesList = [];
|
|
324
|
+
|
|
325
|
+ for (const participant of participantIds) {
|
|
326
|
+ const remoteParticipant = state.remote.get(participant);
|
|
327
|
+
|
|
328
|
+ if (remoteParticipant) {
|
|
329
|
+ const displayName = _getDisplayName(remoteParticipant.name);
|
|
330
|
+
|
|
331
|
+ sortedSharesList.push([ participant, displayName ]);
|
|
332
|
+ }
|
|
333
|
+ }
|
|
334
|
+
|
|
335
|
+ // Keep the remote screen share list sorted alphabetically.
|
|
336
|
+ sortedSharesList.length && sortedSharesList.sort((a, b) => a[1].localeCompare(b[1]));
|
|
337
|
+ state.sortedRemoteScreenshares = new Map(sortedSharesList);
|
|
338
|
+
|
|
339
|
+ return { ...state };
|
|
340
|
+ }
|
327
|
341
|
}
|
328
|
342
|
|
329
|
343
|
return state;
|
|
@@ -335,7 +349,7 @@ ReducerRegistry.register('features/base/participants', (state = DEFAULT_STATE, a
|
335
|
349
|
* @param {string} name - The display name of the participant.
|
336
|
350
|
* @returns {string}
|
337
|
351
|
*/
|
338
|
|
- function _getDisplayName(name) {
|
|
352
|
+function _getDisplayName(name) {
|
339
|
353
|
return name
|
340
|
354
|
?? (typeof interfaceConfig === 'object' ? interfaceConfig.DEFAULT_REMOTE_DISPLAY_NAME : 'Fellow Jitser');
|
341
|
355
|
}
|
|
@@ -468,7 +482,7 @@ function _participantJoined({ participant }) {
|
468
|
482
|
* @param {*} value - The new value.
|
469
|
483
|
* @returns {boolean} - True if a participant was updated and false otherwise.
|
470
|
484
|
*/
|
471
|
|
- function _updateParticipantProperty(state, id, property, value) {
|
|
485
|
+function _updateParticipantProperty(state, id, property, value) {
|
472
|
486
|
const { remote, local } = state;
|
473
|
487
|
|
474
|
488
|
if (remote.has(id)) {
|