rn,flags: add flag to show/hide video share button

This commit is contained in:
utkarshmarwaha 2020-07-15 14:18:56 +05:30 committed by GitHub
parent fc6bd3667c
commit 7f5751b918
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -112,6 +112,12 @@ export const TILE_VIEW_ENABLED = 'tile-view.enabled';
*/
export const TOOLBOX_ALWAYS_VISIBLE = 'toolbox.alwaysVisible';
/**
* 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).

View File

@ -2,6 +2,7 @@
import type { Dispatch } from 'redux';
import { getFeatureFlag, VIDEO_SHARE_BUTTON_ENABLED } from '../../base/flags';
import { translate } from '../../base/i18n';
import { IconShareVideo } from '../../base/icons';
import { getLocalParticipant } from '../../base/participants';
@ -90,21 +91,26 @@ class VideoShareButton extends AbstractButton<Props, *> {
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
* @param {Object} ownProps - The properties explicitly passed to the component instance.
* @private
* @returns {Props}
*/
function _mapStateToProps(state): Object {
function _mapStateToProps(state, ownProps): Object {
const { ownerId, status: sharedVideoStatus } = state['features/youtube-player'];
const localParticipantId = getLocalParticipant(state).id;
const enabled = getFeatureFlag(state, VIDEO_SHARE_BUTTON_ENABLED, true);
const { visible = enabled } = ownProps;
if (ownerId !== localParticipantId) {
return {
_isDisabled: isSharingStatus(sharedVideoStatus),
_sharingVideo: false };
_sharingVideo: false,
visible };
}
return {
_sharingVideo: isSharingStatus(sharedVideoStatus)
_sharingVideo: isSharingStatus(sharedVideoStatus),
visible
};
}