feat(rn, security) added flag for controlling security options button visibility

This commit is contained in:
Calinteodor 2021-05-14 16:01:43 +03:00 committed by GitHub
parent 7db9fc94e2
commit 9b5eae7a60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 2 deletions

View File

@ -104,6 +104,12 @@ export const KICK_OUT_ENABLED = 'kick-out.enabled';
*/ */
export const LIVE_STREAMING_ENABLED = 'live-streaming.enabled'; export const LIVE_STREAMING_ENABLED = 'live-streaming.enabled';
/**
* Flag indicating if lobby mode button should be enabled.
* Default: enabled.
*/
export const LOBBY_MODE_ENABLED = 'lobby-mode.enabled';
/** /**
* Flag indicating if displaying the meeting name should be enabled. * Flag indicating if displaying the meeting name should be enabled.
* Default: enabled (true). * Default: enabled (true).
@ -113,7 +119,7 @@ export const MEETING_NAME_ENABLED = 'meeting-name.enabled';
/** /**
* Flag indicating if the meeting password button should be enabled. * Flag indicating if the meeting password button should be enabled.
* Note that this flag just decides on the button, if a meeting has a password * Note that this flag just decides on the button, if a meeting has a password
* set, the password ddialog will still show up. * set, the password dialog will still show up.
* Default: enabled (true). * Default: enabled (true).
*/ */
export const MEETING_PASSWORD_ENABLED = 'meeting-password.enabled'; export const MEETING_PASSWORD_ENABLED = 'meeting-password.enabled';
@ -155,6 +161,12 @@ export const RECORDING_ENABLED = 'recording.enabled';
*/ */
export const RESOLUTION = 'resolution'; export const RESOLUTION = 'resolution';
/**
* Flag indicating if the security options button should be enabled.
* Default: enabled (true)
*/
export const SECURITY_OPTIONS_ENABLED = 'security-options.enabled';
/** /**
* Flag indicating if server URL change is enabled. * Flag indicating if server URL change is enabled.
* Default: enabled (true) * Default: enabled (true)

View File

@ -3,8 +3,15 @@
import type { Dispatch } from 'redux'; import type { Dispatch } from 'redux';
import { createToolbarEvent, sendAnalytics } from '../../../analytics'; import { createToolbarEvent, sendAnalytics } from '../../../analytics';
import {
getFeatureFlag,
LOBBY_MODE_ENABLED,
MEETING_PASSWORD_ENABLED,
SECURITY_OPTIONS_ENABLED
} from '../../../base/flags';
import { translate } from '../../../base/i18n'; import { translate } from '../../../base/i18n';
import { IconSecurityOff, IconSecurityOn } from '../../../base/icons'; import { IconSecurityOff, IconSecurityOn } from '../../../base/icons';
import { isLocalParticipantModerator } from '../../../base/participants';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components'; import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
import { toggleSecurityDialog } from '../../actions'; import { toggleSecurityDialog } from '../../actions';
@ -62,11 +69,19 @@ class SecurityDialogButton extends AbstractButton<Props, *> {
* @returns {Props} * @returns {Props}
*/ */
function mapStateToProps(state: Object) { function mapStateToProps(state: Object) {
const { conference } = state['features/base/conference'];
const { hideLobbyButton } = state['features/base/config'];
const { locked } = state['features/base/conference']; const { locked } = state['features/base/conference'];
const { lobbyEnabled } = state['features/lobby']; const { lobbyEnabled } = state['features/lobby'];
const lobbySupported = conference && conference.isLobbySupported();
const lobby = lobbySupported && isLocalParticipantModerator(state) && !hideLobbyButton;
const enabledFlag = getFeatureFlag(state, SECURITY_OPTIONS_ENABLED, true);
const enabledLobbyModeFlag = getFeatureFlag(state, LOBBY_MODE_ENABLED, true) && lobby;
const enabledMeetingPassFlag = getFeatureFlag(state, MEETING_PASSWORD_ENABLED, true);
return { return {
_locked: locked || lobbyEnabled _locked: locked || lobbyEnabled,
visible: enabledFlag || (enabledLobbyModeFlag || enabledMeetingPassFlag)
}; };
} }