fix: Process pre-existing participants properties.

We were not processing properties which are set (fire properties updated) before the conference joined event is fired.
This commit is contained in:
damencho 2021-01-05 13:14:19 -06:00 committed by Дамян Минков
parent 2ba6100e36
commit 28fa1f5dbe
1 changed files with 42 additions and 40 deletions

View File

@ -206,51 +206,53 @@ StateListenerRegistry.register(
state => state['features/base/conference'].conference, state => state['features/base/conference'].conference,
(conference, store) => { (conference, store) => {
if (conference) { if (conference) {
// We joined a conference const propertyHandlers = {
conference.on( 'e2eeEnabled': (participant, value) => _e2eeUpdated(store, conference, participant.getId(), value),
JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED, 'features_e2ee': (participant, value) =>
(participant, propertyName, oldValue, newValue) => {
switch (propertyName) {
case 'e2eeEnabled':
_e2eeUpdated(store, conference, participant.getId(), newValue);
break;
case 'features_e2ee':
store.dispatch(participantUpdated({ store.dispatch(participantUpdated({
conference, conference,
id: participant.getId(), id: participant.getId(),
e2eeSupported: newValue e2eeSupported: value
})); })),
break; 'features_jigasi': (participant, value) =>
case 'features_jigasi':
store.dispatch(participantUpdated({ store.dispatch(participantUpdated({
conference, conference,
id: participant.getId(), id: participant.getId(),
isJigasi: newValue isJigasi: value
})); })),
break; 'features_screen-sharing': (participant, value) => // eslint-disable-line no-unused-vars
case 'features_screen-sharing':
store.dispatch(participantUpdated({ store.dispatch(participantUpdated({
conference, conference,
id: participant.getId(), id: participant.getId(),
features: { 'screen-sharing': true } features: { 'screen-sharing': true }
})); })),
break; 'raisedHand': (participant, value) => _raiseHandUpdated(store, conference, participant.getId(), value),
case 'raisedHand': { 'remoteControlSessionStatus': (participant, value) =>
_raiseHandUpdated(store, conference, participant.getId(), newValue);
break;
}
case 'remoteControlSessionStatus':
store.dispatch(participantUpdated({ store.dispatch(participantUpdated({
conference, conference,
id: participant.getId(), id: participant.getId(),
remoteControlSessionStatus: newValue remoteControlSessionStatus: value
})); }))
break; };
default:
// Ignore for now. // update properties for the participants that are already in the conference
conference.getParticipants().forEach(participant => {
Object.keys(propertyHandlers).forEach(propertyName => {
const value = participant.getProperty(propertyName);
if (value !== undefined) {
propertyHandlers[propertyName](participant, value);
} }
});
});
// We joined a conference
conference.on(
JitsiConferenceEvents.PARTICIPANT_PROPERTY_CHANGED,
(participant, propertyName, oldValue, newValue) => {
if (propertyHandlers.hasOwnProperty(propertyName)) {
propertyHandlers[propertyName](participant, newValue);
}
}); });
} else { } else {
const localParticipantId = getLocalParticipant(store.getState).id; const localParticipantId = getLocalParticipant(store.getState).id;