From 8accd9e433abaa4b19e78a9061d54a2456ac32f6 Mon Sep 17 00:00:00 2001 From: patidars Date: Wed, 6 May 2020 17:52:59 +0530 Subject: [PATCH] rn,flags: feature flag to show/hide 'Tile View' button --- react/features/base/flags/constants.js | 6 ++++++ .../video-layout/components/TileViewButton.js | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/react/features/base/flags/constants.js b/react/features/base/flags/constants.js index 7621476c7..114bf57a6 100644 --- a/react/features/base/flags/constants.js +++ b/react/features/base/flags/constants.js @@ -81,6 +81,12 @@ export const RAISE_HAND_ENABLED = 'raise-hand.enabled'; */ export const RECORDING_ENABLED = 'recording.enabled'; +/** + * Flag indicating if tile view feature should be enabled. + * Default: enabled. + */ +export const TILE_VIEW_ENABLED = 'tile-view.enabled'; + /** * Flag indicating if the welcome page should be enabled. * Default: disabled (false). diff --git a/react/features/video-layout/components/TileViewButton.js b/react/features/video-layout/components/TileViewButton.js index 66827b5fd..2246c3ce0 100644 --- a/react/features/video-layout/components/TileViewButton.js +++ b/react/features/video-layout/components/TileViewButton.js @@ -16,6 +16,7 @@ import { import { setTileView } from '../actions'; import logger from '../logger'; +import { TILE_VIEW_ENABLED, getFeatureFlag } from '../../base/flags'; /** * The type of the React {@code Component} props of {@link TileViewButton}. @@ -83,13 +84,16 @@ class TileViewButton extends AbstractButton { * {@code TileViewButton} component. * * @param {Object} state - The Redux state. - * @returns {{ - * _tileViewEnabled: boolean - * }} + * @param {Object} ownProps - The properties explicitly passed to the component instance. + * @returns {Props} */ -function _mapStateToProps(state) { +function _mapStateToProps(state, ownProps) { + const enabled = getFeatureFlag(state, TILE_VIEW_ENABLED, true); + const { visible = enabled } = ownProps; + return { - _tileViewEnabled: state['features/video-layout'].tileViewEnabled + _tileViewEnabled: state['features/video-layout'].tileViewEnabled, + visible }; }