squash: use oldScreenSharesOrder for checking.
This commit is contained in:
parent
035d026e90
commit
1c6677f523
|
@ -12,8 +12,6 @@ import { setRemoteParticipantsWithScreenShare } from './actions';
|
|||
declare var APP: Object;
|
||||
declare var interfaceConfig: Object;
|
||||
|
||||
let latestScreenshareParticipantId;
|
||||
|
||||
/**
|
||||
* StateListenerRegistry provides a reliable way of detecting changes to
|
||||
* preferred layout state and dispatching additional actions.
|
||||
|
@ -70,7 +68,7 @@ StateListenerRegistry.register(
|
|||
store.dispatch(
|
||||
setRemoteParticipantsWithScreenShare(newScreenSharesOrder));
|
||||
|
||||
_updateAutoPinnedParticipant(store);
|
||||
_updateAutoPinnedParticipant(oldScreenSharesOrder, store);
|
||||
}
|
||||
}, 100));
|
||||
|
||||
|
@ -93,10 +91,12 @@ function _getAutoPinSetting() {
|
|||
* Private helper to automatically pin the latest screen share stream or unpin
|
||||
* if there are no more screen share streams.
|
||||
*
|
||||
* @param {Array<string>} screenShares - Array containing the list of all the screensharing endpoints
|
||||
* before the update was triggered (including the ones that have been removed from redux because of the update).
|
||||
* @param {Store} store - The redux store.
|
||||
* @returns {void}
|
||||
*/
|
||||
function _updateAutoPinnedParticipant({ dispatch, getState }) {
|
||||
function _updateAutoPinnedParticipant(screenShares, { dispatch, getState }) {
|
||||
const state = getState();
|
||||
const remoteScreenShares = state['features/video-layout'].remoteScreenShares;
|
||||
const pinned = getPinnedParticipant(getState);
|
||||
|
@ -106,17 +106,15 @@ function _updateAutoPinnedParticipant({ dispatch, getState }) {
|
|||
if (!remoteScreenShares?.length) {
|
||||
let participantId = null;
|
||||
|
||||
if (pinned && pinned.id !== latestScreenshareParticipantId) {
|
||||
if (pinned && !screenShares.find(share => share === pinned.id)) {
|
||||
participantId = pinned.id;
|
||||
}
|
||||
|
||||
latestScreenshareParticipantId = null;
|
||||
dispatch(pinParticipant(participantId));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
|
||||
const latestScreenshareParticipantId = remoteScreenShares[remoteScreenShares.length - 1];
|
||||
|
||||
if (latestScreenshareParticipantId) {
|
||||
dispatch(pinParticipant(latestScreenshareParticipantId));
|
||||
|
|
Loading…
Reference in New Issue