Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feature-flags: add flag for enabling chat

Saúl Ibarra Corretgé35ffbe17200c
diff --git a/react/features/base/flags/constants.js b/react/features/base/flags/constants.js
index 28bc00a005..4f04a2d656 100644
--- a/react/features/base/flags/constants.js
+++ b/react/features/base/flags/constants.js
@@ -1,5 +1,16 @@
// @flow
+/**
+ * Flag indicating if calendar integration should be disabled.
+ */
+export const CALENDAR_DISABLED = 'calendar.disabled';
+
+/**
+ * Flag indicating if chat should be enabled.
+ * Default: enabled (true).
+ */
+export const CHAT_ENABLED = 'chat.enabled';
+
/**
* Flag indicating if recording should be enabled in iOS.
* Default: disabled (false).
diff --git a/react/features/toolbox/components/native/OverflowMenu.js b/react/features/toolbox/components/native/OverflowMenu.js
index 0b71aa97ea..2043390dfa 100644
--- a/react/features/toolbox/components/native/OverflowMenu.js
+++ b/react/features/toolbox/components/native/OverflowMenu.js
@@ -5,7 +5,7 @@ import { Platform } from 'react-native';
import { ColorSchemeRegistry } from '../../../base/color-scheme';
import { BottomSheet, hideDialog } from '../../../base/dialog';
-import { IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
+import { CHAT_ENABLED, IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
import { connect } from '../../../base/redux';
import { StyleType } from '../../../base/styles';
import { InfoDialogButton, InviteButton } from '../../../invite';
@@ -29,6 +29,11 @@ type Props = {
*/
_bottomSheetStyles: StyleType,
+ /**
+ * Whether the chat feature has been enabled. The meeting info button will be displayed in its place when disabled.
+ */
+ _chatEnabled: boolean,
+
/**
* Whether the recoding button should be enabled or not.
*/
@@ -93,7 +98,10 @@ class OverflowMenu extends Component<Props> {
<LiveStreamButton { ...buttonProps } />
<TileViewButton { ...buttonProps } />
<InviteButton { ...buttonProps } />
- <InfoDialogButton { ...buttonProps } />
+ {
+ this.props._chatEnabled
+ && <InfoDialogButton { ...buttonProps } />
+ }
<RaiseHandButton { ...buttonProps } />
</BottomSheet>
);
@@ -119,6 +127,7 @@ class OverflowMenu extends Component<Props> {
* @private
* @returns {{
* _bottomSheetStyles: StyleType,
+ * _chatEnabled: boolean,
* _recordingEnabled: boolean
* }}
*/
@@ -126,6 +135,7 @@ function _mapStateToProps(state) {
return {
_bottomSheetStyles:
ColorSchemeRegistry.get(state, 'BottomSheet'),
+ _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
_recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
};
}
diff --git a/react/features/toolbox/components/native/Toolbox.js b/react/features/toolbox/components/native/Toolbox.js
index 4c70f17a3e..85ecd9ac73 100644
--- a/react/features/toolbox/components/native/Toolbox.js
+++ b/react/features/toolbox/components/native/Toolbox.js
@@ -3,11 +3,13 @@
import React, { Component } from 'react';
import { View } from 'react-native';
-import { Container } from '../../../base/react';
import { ColorSchemeRegistry } from '../../../base/color-scheme';
+import { CHAT_ENABLED, getFeatureFlag } from '../../../base/flags';
+import { Container } from '../../../base/react';
import { connect } from '../../../base/redux';
import { StyleType } from '../../../base/styles';
import { ChatButton } from '../../../chat';
+import { InfoDialogButton } from '../../../invite';
import { isToolboxVisible } from '../../functions';
import { HANGUP_BUTTON_SIZE } from '../../constants';
@@ -41,6 +43,11 @@ const _BUTTON_SIZE_FACTOR = 0.85;
*/
type Props = {
+ /**
+ * Whether the chat feature has been enabled. The meeting info button will be displayed in its place when disabled.
+ */
+ _chatEnabled: boolean,
+
/**
* The color-schemed stylesheet of the feature.
*/
@@ -202,7 +209,7 @@ class Toolbox extends Component<Props, State> {
* @returns {React$Node}
*/
_renderToolbar() {
- const { _styles } = this.props;
+ const { _chatEnabled, _styles } = this.props;
const buttonSize = this._calculateButtonSize();
let { buttonStyles, toggledButtonStyles } = _styles;
@@ -239,11 +246,20 @@ class Toolbox extends Component<Props, State> {
<View
pointerEvents = 'box-none'
style = { styles.toolbar }>
- <ChatButton
- styles = { buttonStyles }
- toggledStyles = {
- this._getChatButtonToggledStyle(toggledButtonStyles)
- } />
+ {
+ _chatEnabled
+ && <ChatButton
+ styles = { buttonStyles }
+ toggledStyles = {
+ this._getChatButtonToggledStyle(toggledButtonStyles)
+ } />
+ }
+ {
+ !_chatEnabled
+ && <InfoDialogButton
+ styles = { buttonStyles }
+ toggledStyles = { toggledButtonStyles } />
+ }
<AudioMuteButton
styles = { buttonStyles }
toggledStyles = { toggledButtonStyles } />
@@ -268,12 +284,14 @@ class Toolbox extends Component<Props, State> {
* {@code Toolbox} props.
* @private
* @returns {{
+ * _chatEnabled: boolean,
* _styles: StyleType,
* _visible: boolean
* }}
*/
function _mapStateToProps(state: Object): Object {
return {
+ _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
_styles: ColorSchemeRegistry.get(state, 'Toolbox'),
_visible: isToolboxVisible(state)
};