This commit is contained in:
10
react/features/base/flags/actionTypes.ts
Normal file
10
react/features/base/flags/actionTypes.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* The type of Redux action which updates the feature flags.
|
||||
*
|
||||
* {
|
||||
* type: UPDATE_FLAGS,
|
||||
* flags: Object
|
||||
* }
|
||||
*
|
||||
*/
|
||||
export const UPDATE_FLAGS = 'UPDATE_FLAGS';
|
||||
17
react/features/base/flags/actions.ts
Normal file
17
react/features/base/flags/actions.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { UPDATE_FLAGS } from './actionTypes';
|
||||
|
||||
/**
|
||||
* Updates the current features flags with the given ones. They will be merged.
|
||||
*
|
||||
* @param {Object} flags - The new flags object.
|
||||
* @returns {{
|
||||
* type: UPDATE_FLAGS,
|
||||
* flags: Object
|
||||
* }}
|
||||
*/
|
||||
export function updateFlags(flags: Object) {
|
||||
return {
|
||||
type: UPDATE_FLAGS,
|
||||
flags
|
||||
};
|
||||
}
|
||||
292
react/features/base/flags/constants.ts
Normal file
292
react/features/base/flags/constants.ts
Normal file
@@ -0,0 +1,292 @@
|
||||
/**
|
||||
* Flag indicating if add-people functionality should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const ADD_PEOPLE_ENABLED = 'add-people.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the audio device button should be displayed.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const AUDIO_DEVICE_BUTTON_ENABLED = 'audio-device-button.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the SDK should not require the audio focus.
|
||||
* Used by apps that do not use Jitsi audio.
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const AUDIO_FOCUS_DISABLED = 'audio-focus.disabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the audio mute button should be displayed.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const AUDIO_MUTE_BUTTON_ENABLED = 'audio-mute.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating that the Audio only button in the overflow menu is enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const AUDIO_ONLY_BUTTON_ENABLED = 'audio-only.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating that the Breakout Rooms button in the overflow menu is enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const BREAKOUT_ROOMS_BUTTON_ENABLED = 'breakout-rooms.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if calendar integration should be enabled.
|
||||
* Default: enabled (true) on Android, auto-detected on iOS.
|
||||
*/
|
||||
export const CALENDAR_ENABLED = 'calendar.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if call integration (CallKit on iOS, ConnectionService on Android)
|
||||
* should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const CALL_INTEGRATION_ENABLED = 'call-integration.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if car mode should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const CAR_MODE_ENABLED = 'car-mode.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if close captions should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const CLOSE_CAPTIONS_ENABLED = 'close-captions.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if conference timer should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const CONFERENCE_TIMER_ENABLED = 'conference-timer.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if chat should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const CHAT_ENABLED = 'chat.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the filmstrip should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const FILMSTRIP_ENABLED = 'filmstrip.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if fullscreen (immersive) mode should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const FULLSCREEN_ENABLED = 'fullscreen.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the Help button should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const HELP_BUTTON_ENABLED = 'help.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if invite functionality should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const INVITE_ENABLED = 'invite.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if dial-in invite functionality should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const INVITE_DIAL_IN_ENABLED = 'invite-dial-in.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if recording should be enabled in iOS.
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const IOS_RECORDING_ENABLED = 'ios.recording.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if screen sharing should be enabled in iOS.
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const IOS_SCREENSHARING_ENABLED = 'ios.screensharing.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if screen sharing should be enabled in android.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const ANDROID_SCREENSHARING_ENABLED = 'android.screensharing.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if speaker statistics should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const SPEAKERSTATS_ENABLED = 'speakerstats.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if kickout is enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const KICK_OUT_ENABLED = 'kick-out.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if live-streaming should be enabled.
|
||||
* Default: auto-detected.
|
||||
*/
|
||||
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.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const MEETING_NAME_ENABLED = 'meeting-name.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
|
||||
* set, the password dialog will still show up.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const MEETING_PASSWORD_ENABLED = 'meeting-password.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the notifications should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const NOTIFICATIONS_ENABLED = 'notifications.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the audio overflow menu button should be displayed.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const OVERFLOW_MENU_ENABLED = 'overflow-menu.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if participants should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const PARTICIPANTS_ENABLED = 'participants.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if Picture-in-Picture should be enabled.
|
||||
* Default: auto-detected.
|
||||
*/
|
||||
export const PIP_ENABLED = 'pip.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the prejoin page should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const PREJOIN_PAGE_ENABLED = 'prejoinpage.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the participant name editing field should be displayed on the prejoin page.
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const PREJOIN_PAGE_HIDE_DISPLAY_NAME = 'prejoinpage.hideDisplayName';
|
||||
|
||||
/**
|
||||
* Flag indicating if raise hand feature should be enabled.
|
||||
* Default: enabled.
|
||||
*/
|
||||
export const RAISE_HAND_ENABLED = 'raise-hand.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the reactions feature should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const REACTIONS_ENABLED = 'reactions.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if recording should be enabled.
|
||||
* Default: auto-detected.
|
||||
*/
|
||||
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.
|
||||
* Default: (unset).
|
||||
*/
|
||||
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.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const SERVER_URL_CHANGE_ENABLED = 'server-url-change.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if settings should be enabled.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const SETTINGS_ENABLED = 'settings.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if tile view feature should be enabled.
|
||||
* Default: enabled(true).
|
||||
*/
|
||||
export const TILE_VIEW_ENABLED = 'tile-view.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the toggle camera button should be enabled
|
||||
* Default: enabled(true).
|
||||
*/
|
||||
export const TOGGLE_CAMERA_BUTTON_ENABLED = 'toggle-camera-button.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the toolbox should be always be visible
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const TOOLBOX_ALWAYS_VISIBLE = 'toolbox.alwaysVisible';
|
||||
|
||||
/**
|
||||
* Flag indicating if the toolbox should be enabled
|
||||
* Default: enabled.
|
||||
*/
|
||||
export const TOOLBOX_ENABLED = 'toolbox.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the unsafe room warning should be enabled.
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const UNSAFE_ROOM_WARNING = 'unsaferoomwarning.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the video mute button should be displayed.
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const VIDEO_MUTE_BUTTON_ENABLED = 'video-mute.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the video share button should be enabled
|
||||
* Default: enabled (true).
|
||||
*/
|
||||
export const VIDEO_SHARE_BUTTON_ENABLED = 'video-share.enabled';
|
||||
|
||||
/**
|
||||
* Flag indicating if the welcome page should be enabled.
|
||||
* Default: disabled (false).
|
||||
*/
|
||||
export const WELCOME_PAGE_ENABLED = 'welcomepage.enabled';
|
||||
31
react/features/base/flags/functions.ts
Normal file
31
react/features/base/flags/functions.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { getAppProp } from '../app/functions';
|
||||
import { IStateful } from '../app/types';
|
||||
import { toState } from '../redux/functions';
|
||||
|
||||
/**
|
||||
* Gets the value of a specific feature flag.
|
||||
*
|
||||
* @param {Function|Object} stateful - The redux store or {@code getState}
|
||||
* function.
|
||||
* @param {string} flag - The name of the React {@code Component} prop of
|
||||
* the currently mounted {@code App} to get.
|
||||
* @param {*} defaultValue - A default value for the flag, in case it's not defined.
|
||||
* @returns {*} The value of the specified React {@code Component} prop of the
|
||||
* currently mounted {@code App}.
|
||||
*/
|
||||
export function getFeatureFlag(stateful: IStateful, flag: string, defaultValue?: boolean | string) {
|
||||
const state = toState(stateful)['features/base/flags'];
|
||||
|
||||
if (state) {
|
||||
const value = state[flag as keyof typeof state];
|
||||
|
||||
if (typeof value !== 'undefined') {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
// Maybe the value hasn't made it to the redux store yet, check the app props.
|
||||
const flags = getAppProp(stateful, 'flags') || {};
|
||||
|
||||
return flags[flag] || defaultValue;
|
||||
}
|
||||
35
react/features/base/flags/reducer.ts
Normal file
35
react/features/base/flags/reducer.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { isEqual, merge } from 'lodash-es';
|
||||
|
||||
import ReducerRegistry from '../redux/ReducerRegistry';
|
||||
|
||||
import { UPDATE_FLAGS } from './actionTypes';
|
||||
|
||||
/**
|
||||
* Default state value for the feature flags.
|
||||
*/
|
||||
const DEFAULT_STATE = {};
|
||||
|
||||
export interface IFlagsState {
|
||||
flags?: Object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduces redux actions which handle feature flags.
|
||||
*
|
||||
* @param {State} state - The current redux state.
|
||||
* @param {Action} action - The redux action to reduce.
|
||||
* @param {string} action.type - The type of the redux action to reduce.
|
||||
* @returns {State} The next redux state that is the result of reducing the
|
||||
* specified action.
|
||||
*/
|
||||
ReducerRegistry.register<IFlagsState>('features/base/flags', (state = DEFAULT_STATE, action): IFlagsState => {
|
||||
switch (action.type) {
|
||||
case UPDATE_FLAGS: {
|
||||
const newState = merge({}, state, action.flags);
|
||||
|
||||
return isEqual(state, newState) ? state : newState;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
});
|
||||
Reference in New Issue
Block a user