feat(replace-participant): Add replaceParticipant feature-flag

This commit is contained in:
tmoldovan8x8 2021-06-16 14:08:18 +03:00 committed by GitHub
parent f560eecfa9
commit 0bd45a75d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 8 deletions

View File

@ -45,6 +45,7 @@ import {
p2pStatusChanged,
sendLocalParticipant
} from './react/features/base/conference';
import { getReplaceParticipant } from './react/features/base/config/functions';
import {
checkAndNotifyForNewDevice,
getAvailableDevices,
@ -304,9 +305,8 @@ class ConferenceConnector {
// not enough rights to create conference
case JitsiConferenceErrors.AUTHENTICATION_REQUIRED: {
const { replaceParticipant }
= APP.store.getState()['features/base/config'];
const replaceParticipant = getReplaceParticipant(APP.store.getState());
// Schedule reconnect to check if someone else created the room.
this.reconnectTimeout = setTimeout(() => {
@ -397,7 +397,7 @@ class ConferenceConnector {
*
*/
connect() {
const { replaceParticipant } = APP.store.getState()['features/base/config'];
const replaceParticipant = getReplaceParticipant(APP.store.getState());
// the local storage overrides here and in connection.js can be used by jibri
room.join(jitsiLocalStorage.getItem('xmpp_conference_password_override'), replaceParticipant);

View File

@ -11,6 +11,7 @@ import {
isTokenAuthEnabled,
getTokenAuthUrl
} from '../../../react/features/authentication/functions';
import { getReplaceParticipant } from '../../../react/features/base/config/functions';
import { isDialogOpen } from '../../../react/features/base/dialog';
import { setJWT } from '../../../react/features/base/jwt';
import UIUtil from '../util/UIUtil';
@ -209,8 +210,7 @@ function logout(room: Object) {
}).then(url => {
// de-authenticate conference on the fly
if (room.isJoined()) {
const { replaceParticipant }
= APP.store.getState()['features/base/config'];
const replaceParticipant = getReplaceParticipant(APP.store.getState());
room.join(null, replaceParticipant);
}

View File

@ -8,6 +8,7 @@ import {
} from '../../analytics';
import { getName } from '../../app/functions';
import { endpointMessageReceived } from '../../subtitles';
import { getReplaceParticipant } from '../config/functions';
import { JITSI_CONNECTION_CONFERENCE_KEY } from '../connection';
import { JitsiConferenceEvents } from '../lib-jitsi-meet';
import { MEDIA_TYPE, setAudioMuted, setVideoMuted } from '../media';
@ -460,7 +461,9 @@ export function createConference() {
sendLocalParticipant(state, conference);
conference.join(password, config.replaceParticipant);
const replaceParticipant = getReplaceParticipant(state);
conference.join(password, replaceParticipant);
};
}
@ -477,8 +480,7 @@ export function checkIfCanJoin() {
const { authRequired, password }
= getState()['features/base/conference'];
const { replaceParticipant }
= getState()['features/base/config'];
const replaceParticipant = getReplaceParticipant(APP.store.getState());
authRequired && dispatch(_conferenceWillJoin(authRequired));
authRequired && authRequired.join(password, replaceParticipant);

View File

@ -2,6 +2,8 @@
import { NativeModules } from 'react-native';
import { getFeatureFlag, REPLACE_PARTICIPANT } from '../flags';
export * from './functions.any';
/**
@ -19,3 +21,13 @@ export function _cleanupConfig(config: Object) {
delete config.callStatsSecret;
}
}
/**
* Returns the replaceParticipant config.
*
* @param {Object} state - The state of the app.
* @returns {boolean}
*/
export function getReplaceParticipant(state: Object): string {
return getFeatureFlag(state, REPLACE_PARTICIPANT, false);
}

View File

@ -33,6 +33,16 @@ export function getDialOutUrl(state: Object): string {
return state['features/base/config'].guestDialOutUrl;
}
/**
* Returns the replaceParticipant config.
*
* @param {Object} state - The state of the app.
* @returns {boolean}
*/
export function getReplaceParticipant(state: Object): string {
return state['features/base/config'].replaceParticipant;
}
/**
* Returns the list of enabled toolbar buttons.
*

View File

@ -154,6 +154,12 @@ export const RAISE_HAND_ENABLED = 'raise-hand.enabled';
*/
export const RECORDING_ENABLED = 'recording.enabled';
/**
* Flag indicating if the user should join the conference with the replaceParticipant functionality.
* Default: (false).
*/
export const REPLACE_PARTICIPANT = 'replace.participant';
/**
* Flag indicating the local and (maximum) remote video resolution. Overrides
* the server configuration.