feat(mobile) adds more feature flags (#8450)

Features flags added:  
-tile-view.enabled
-filmstrip.enabled
-notifications.enabled
-toolbox.enabled
This commit is contained in:
tmoldovan8x8 2021-01-22 12:03:39 +02:00 committed by GitHub
parent 01c55bdb15
commit 6a6aeb1d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 7 deletions

View File

@ -37,6 +37,12 @@ export const CONFERENCE_TIMER_ENABLED = 'conference-timer.enabled';
*/ */
export const CHAT_ENABLED = 'chat.enabled'; 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 invite functionality should be enabled. * Flag indicating if invite functionality should be enabled.
* Default: enabled (true). * Default: enabled (true).
@ -75,6 +81,13 @@ export const MEETING_NAME_ENABLED = 'meeting-name.enabled';
*/ */
export const MEETING_PASSWORD_ENABLED = 'meeting-password.enabled'; 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 Picture-in-Picture should be enabled. * Flag indicating if Picture-in-Picture should be enabled.
* Default: auto-detected. * Default: auto-detected.
@ -118,6 +131,12 @@ export const TILE_VIEW_ENABLED = 'tile-view.enabled';
*/ */
export const TOOLBOX_ALWAYS_VISIBLE = 'toolbox.alwaysVisible'; 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 video share button should be enabled * Flag indicating if the video share button should be enabled
* Default: enabled (true). * Default: enabled (true).

View File

@ -1,5 +1,6 @@
// @flow // @flow
import { getFeatureFlag, FILMSTRIP_ENABLED } from '../base/flags';
import { toState } from '../base/redux'; import { toState } from '../base/redux';
/** /**
@ -14,6 +15,13 @@ import { toState } from '../base/redux';
*/ */
export function isFilmstripVisible(stateful: Object | Function) { export function isFilmstripVisible(stateful: Object | Function) {
const state = toState(stateful); const state = toState(stateful);
const enabled = getFeatureFlag(state, FILMSTRIP_ENABLED, true);
if (!enabled) {
return false;
}
const { length: participantCount } = state['features/base/participants']; const { length: participantCount } = state['features/base/participants'];
return participantCount > 1; return participantCount > 1;

View File

@ -3,6 +3,8 @@
import throttle from 'lodash/throttle'; import throttle from 'lodash/throttle';
import type { Dispatch } from 'redux'; import type { Dispatch } from 'redux';
import { NOTIFICATIONS_ENABLED, getFeatureFlag } from '../base/flags';
import { import {
CLEAR_NOTIFICATIONS, CLEAR_NOTIFICATIONS,
HIDE_NOTIFICATION, HIDE_NOTIFICATION,
@ -81,9 +83,12 @@ export function showErrorNotification(props: Object) {
export function showNotification(props: Object = {}, timeout: ?number) { export function showNotification(props: Object = {}, timeout: ?number) {
return function(dispatch: Function, getState: Function) { return function(dispatch: Function, getState: Function) {
const { notifications } = getState()['features/base/config']; const { notifications } = getState()['features/base/config'];
const shouldDisplay = !notifications const enabledFlag = getFeatureFlag(getState(), NOTIFICATIONS_ENABLED, true);
const shouldDisplay = enabledFlag
&& (!notifications
|| notifications.includes(props.descriptionKey) || notifications.includes(props.descriptionKey)
|| notifications.includes(props.titleKey); || notifications.includes(props.titleKey));
if (shouldDisplay) { if (shouldDisplay) {
return dispatch({ return dispatch({

View File

@ -1,7 +1,7 @@
// @flow // @flow
import { hasAvailableDevices } from '../base/devices'; import { hasAvailableDevices } from '../base/devices';
import { TOOLBOX_ALWAYS_VISIBLE, getFeatureFlag } from '../base/flags'; import { TOOLBOX_ALWAYS_VISIBLE, getFeatureFlag, TOOLBOX_ENABLED } from '../base/flags';
import { toState } from '../base/redux'; import { toState } from '../base/redux';
import { isLocalVideoTrackDesktop } from '../base/tracks'; import { isLocalVideoTrackDesktop } from '../base/tracks';
@ -16,9 +16,10 @@ export function isToolboxVisible(stateful: Object | Function) {
const state = toState(stateful); const state = toState(stateful);
const { alwaysVisible, enabled, visible } = state['features/toolbox']; const { alwaysVisible, enabled, visible } = state['features/toolbox'];
const { length: participantCount } = state['features/base/participants']; const { length: participantCount } = state['features/base/participants'];
const flag = getFeatureFlag(state, TOOLBOX_ALWAYS_VISIBLE, false); const alwaysVisibleFlag = getFeatureFlag(state, TOOLBOX_ALWAYS_VISIBLE, false);
const enabledFlag = getFeatureFlag(state, TOOLBOX_ENABLED, true);
return enabled && (alwaysVisible || visible || participantCount === 1 || flag); return enabledFlag && enabled && (alwaysVisible || visible || participantCount === 1 || alwaysVisibleFlag);
} }
/** /**

View File

@ -1,5 +1,6 @@
// @flow // @flow
import { getFeatureFlag, TILE_VIEW_ENABLED } from '../base/flags';
import { getPinnedParticipant, getParticipantCount } from '../base/participants'; import { getPinnedParticipant, getParticipantCount } from '../base/participants';
import { isYoutubeVideoPlaying } from '../youtube-player/functions'; import { isYoutubeVideoPlaying } from '../youtube-player/functions';
@ -82,9 +83,10 @@ export function shouldDisplayTileView(state: Object = {}) {
return false; return false;
} }
const tileViewEnabledFeatureFlag = getFeatureFlag(state, TILE_VIEW_ENABLED, true);
const { disableTileView } = state['features/base/config']; const { disableTileView } = state['features/base/config'];
if (disableTileView) { if (disableTileView || !tileViewEnabledFeatureFlag) {
return false; return false;
} }