Переглянути джерело

feature-flags: add flag for enabling chat

master
Saúl Ibarra Corretgé 6 роки тому
джерело
коміт
35ffbe1720

+ 11
- 0
react/features/base/flags/constants.js Переглянути файл

@@ -1,5 +1,16 @@
1 1
 // @flow
2 2
 
3
+/**
4
+ * Flag indicating if calendar integration should be disabled.
5
+ */
6
+export const CALENDAR_DISABLED = 'calendar.disabled';
7
+
8
+/**
9
+ * Flag indicating if chat should be enabled.
10
+ * Default: enabled (true).
11
+ */
12
+export const CHAT_ENABLED = 'chat.enabled';
13
+
3 14
 /**
4 15
  * Flag indicating if recording should be enabled in iOS.
5 16
  * Default: disabled (false).

+ 12
- 2
react/features/toolbox/components/native/OverflowMenu.js Переглянути файл

@@ -5,7 +5,7 @@ import { Platform } from 'react-native';
5 5
 
6 6
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
7 7
 import { BottomSheet, hideDialog } from '../../../base/dialog';
8
-import { IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
8
+import { CHAT_ENABLED, IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
9 9
 import { connect } from '../../../base/redux';
10 10
 import { StyleType } from '../../../base/styles';
11 11
 import { InfoDialogButton, InviteButton } from '../../../invite';
@@ -29,6 +29,11 @@ type Props = {
29 29
      */
30 30
     _bottomSheetStyles: StyleType,
31 31
 
32
+    /**
33
+     * Whether the chat feature has been enabled. The meeting info button will be displayed in its place when disabled.
34
+     */
35
+    _chatEnabled: boolean,
36
+
32 37
     /**
33 38
      * Whether the recoding button should be enabled or not.
34 39
      */
@@ -93,7 +98,10 @@ class OverflowMenu extends Component<Props> {
93 98
                 <LiveStreamButton { ...buttonProps } />
94 99
                 <TileViewButton { ...buttonProps } />
95 100
                 <InviteButton { ...buttonProps } />
96
-                <InfoDialogButton { ...buttonProps } />
101
+                {
102
+                    this.props._chatEnabled
103
+                        && <InfoDialogButton { ...buttonProps } />
104
+                }
97 105
                 <RaiseHandButton { ...buttonProps } />
98 106
             </BottomSheet>
99 107
         );
@@ -119,6 +127,7 @@ class OverflowMenu extends Component<Props> {
119 127
  * @private
120 128
  * @returns {{
121 129
  *      _bottomSheetStyles: StyleType,
130
+ *      _chatEnabled: boolean,
122 131
  *      _recordingEnabled: boolean
123 132
  *  }}
124 133
  */
@@ -126,6 +135,7 @@ function _mapStateToProps(state) {
126 135
     return {
127 136
         _bottomSheetStyles:
128 137
             ColorSchemeRegistry.get(state, 'BottomSheet'),
138
+        _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
129 139
         _recordingEnabled: Platform.OS !== 'ios' || getFeatureFlag(state, IOS_RECORDING_ENABLED)
130 140
     };
131 141
 }

+ 25
- 7
react/features/toolbox/components/native/Toolbox.js Переглянути файл

@@ -3,11 +3,13 @@
3 3
 import React, { Component } from 'react';
4 4
 import { View } from 'react-native';
5 5
 
6
-import { Container } from '../../../base/react';
7 6
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
7
+import { CHAT_ENABLED, getFeatureFlag } from '../../../base/flags';
8
+import { Container } from '../../../base/react';
8 9
 import { connect } from '../../../base/redux';
9 10
 import { StyleType } from '../../../base/styles';
10 11
 import { ChatButton } from '../../../chat';
12
+import { InfoDialogButton } from '../../../invite';
11 13
 
12 14
 import { isToolboxVisible } from '../../functions';
13 15
 import { HANGUP_BUTTON_SIZE } from '../../constants';
@@ -41,6 +43,11 @@ const _BUTTON_SIZE_FACTOR = 0.85;
41 43
  */
42 44
 type Props = {
43 45
 
46
+    /**
47
+     * Whether the chat feature has been enabled. The meeting info button will be displayed in its place when disabled.
48
+     */
49
+    _chatEnabled: boolean,
50
+
44 51
     /**
45 52
      * The color-schemed stylesheet of the feature.
46 53
      */
@@ -202,7 +209,7 @@ class Toolbox extends Component<Props, State> {
202 209
      * @returns {React$Node}
203 210
      */
204 211
     _renderToolbar() {
205
-        const { _styles } = this.props;
212
+        const { _chatEnabled, _styles } = this.props;
206 213
         const buttonSize = this._calculateButtonSize();
207 214
         let { buttonStyles, toggledButtonStyles } = _styles;
208 215
 
@@ -239,11 +246,20 @@ class Toolbox extends Component<Props, State> {
239 246
             <View
240 247
                 pointerEvents = 'box-none'
241 248
                 style = { styles.toolbar }>
242
-                <ChatButton
243
-                    styles = { buttonStyles }
244
-                    toggledStyles = {
245
-                        this._getChatButtonToggledStyle(toggledButtonStyles)
246
-                    } />
249
+                {
250
+                    _chatEnabled
251
+                        && <ChatButton
252
+                            styles = { buttonStyles }
253
+                            toggledStyles = {
254
+                                this._getChatButtonToggledStyle(toggledButtonStyles)
255
+                            } />
256
+                }
257
+                {
258
+                    !_chatEnabled
259
+                        && <InfoDialogButton
260
+                            styles = { buttonStyles }
261
+                            toggledStyles = { toggledButtonStyles } />
262
+                }
247 263
                 <AudioMuteButton
248 264
                     styles = { buttonStyles }
249 265
                     toggledStyles = { toggledButtonStyles } />
@@ -268,12 +284,14 @@ class Toolbox extends Component<Props, State> {
268 284
  * {@code Toolbox} props.
269 285
  * @private
270 286
  * @returns {{
287
+ *     _chatEnabled: boolean,
271 288
  *     _styles: StyleType,
272 289
  *     _visible: boolean
273 290
  * }}
274 291
  */
275 292
 function _mapStateToProps(state: Object): Object {
276 293
     return {
294
+        _chatEnabled: getFeatureFlag(state, CHAT_ENABLED, true),
277 295
         _styles: ColorSchemeRegistry.get(state, 'Toolbox'),
278 296
         _visible: isToolboxVisible(state)
279 297
     };

Завантаження…
Відмінити
Зберегти