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

feat(connection-indicator): Add config option to disable indicator popover

master
Vlad Piersec 3 роки тому
джерело
коміт
3c5017a66a

+ 3
- 0
config.js Переглянути файл

@@ -648,6 +648,9 @@ var config = {
648 648
     // Enables sending participants' emails (if available) to callstats and other analytics
649 649
     // enableEmailInStats: false,
650 650
 
651
+    // When true, disables the connection indicator popover.
652
+    // disableConnectionIndicatorDetails: false,
653
+
651 654
     // Controls the percentage of automatic feedback shown to participants when callstats is enabled.
652 655
     // The default value is 100%. If set to 0, no automatic feedback will be requested
653 656
     // feedbackPercentage: 100,

+ 40
- 18
react/features/connection-indicator/components/web/ConnectionIndicator.js Переглянути файл

@@ -69,6 +69,11 @@ type Props = AbstractProps & {
69 69
      */
70 70
     _connectionIndicatorInactiveDisabled: boolean,
71 71
 
72
+    /**
73
+     * Wether the indicator popover is disabled.
74
+     */
75
+    _popoverDisabled: boolean,
76
+
72 77
     /**
73 78
      * Whether or not the component should ignore setting a visibility class for
74 79
      * hiding the component when the connection quality is not strong.
@@ -149,13 +154,13 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
149 154
      * @returns {ReactElement}
150 155
      */
151 156
     render() {
152
-        const { iconSize, enableStatsDisplay, participantId, statsPopoverPosition } = this.props;
157
+        const { enableStatsDisplay, participantId, statsPopoverPosition } = this.props;
153 158
         const visibilityClass = this._getVisibilityClass();
154 159
         const rootClassNames = `indicator-container ${visibilityClass}`;
155 160
 
156
-        const colorClass = this._getConnectionColorClass();
157
-        const indicatorContainerClassNames
158
-            = `connection-indicator indicator ${colorClass}`;
161
+        if (this.props._popoverDisabled) {
162
+            return this._renderIndicator();
163
+        }
159 164
 
160 165
         return (
161 166
             <Popover
@@ -171,15 +176,7 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
171 176
                 paddedContent = { true }
172 177
                 position = { statsPopoverPosition }
173 178
                 visible = { this.state.popoverVisible }>
174
-                <div className = 'popover-trigger'>
175
-                    <div
176
-                        className = { indicatorContainerClassNames }
177
-                        style = {{ fontSize: iconSize }}>
178
-                        <div className = 'connection indicatoricon'>
179
-                            { this._renderIcon() }
180
-                        </div>
181
-                    </div>
182
-                </div>
179
+                { this._renderIndicator() }
183 180
             </Popover>
184 181
         );
185 182
     }
@@ -316,17 +313,41 @@ class ConnectionIndicator extends AbstractConnectionIndicator<Props, State> {
316 313
         ];
317 314
     }
318 315
 
319
-    _onShowPopover: () => void;
316
+  _onShowPopover: () => void;
320 317
 
321
-    /**
318
+  /**
322 319
      * Shows popover.
323 320
      *
324 321
      * @private
325 322
      * @returns {void}
326 323
      */
327
-    _onShowPopover() {
328
-        this.setState({ popoverVisible: true });
329
-    }
324
+  _onShowPopover() {
325
+      this.setState({ popoverVisible: true });
326
+  }
327
+
328
+
329
+  /**
330
+     * Creates a ReactElement for displaying the indicator (GSM bar).
331
+     *
332
+     * @returns {ReactElement}
333
+     */
334
+  _renderIndicator() {
335
+      const colorClass = this._getConnectionColorClass();
336
+      const indicatorContainerClassNames
337
+              = `connection-indicator indicator ${colorClass}`;
338
+
339
+      return (
340
+          <div className = 'popover-trigger'>
341
+              <div
342
+                  className = { indicatorContainerClassNames }
343
+                  style = {{ fontSize: this.props.iconSize }}>
344
+                  <div className = 'connection indicatoricon'>
345
+                      { this._renderIcon() }
346
+                  </div>
347
+              </div>
348
+          </div>
349
+      );
350
+  }
330 351
 }
331 352
 
332 353
 /**
@@ -344,6 +365,7 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
344 365
     return {
345 366
         _connectionIndicatorInactiveDisabled:
346 367
         Boolean(state['features/base/config'].connectionIndicators?.inactiveDisabled),
368
+        _popoverDisabled: state['features/base/config'].disableConnectionIndicatorDetails,
347 369
         _connectionStatus: participant?.connectionStatus
348 370
     };
349 371
 }

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