From d95d52843f789c5de66407bc27bcb23806575b0f Mon Sep 17 00:00:00 2001 From: "Tudor D. Pop" Date: Thu, 9 Sep 2021 15:50:22 +0300 Subject: [PATCH] feat(config) add connection indicators flags --- config.js | 8 +++++ interface_config.js | 36 +++++-------------- react/features/base/config/configWhitelist.js | 1 + react/features/base/config/reducer.js | 12 +++++++ .../components/AbstractConnectionIndicator.js | 29 ++++++++++++--- .../components/web/ConnectionIndicator.js | 14 ++++++-- .../filmstrip/components/web/Thumbnail.js | 6 ++-- 7 files changed, 70 insertions(+), 36 deletions(-) diff --git a/config.js b/config.js index 250e4affa5..ffaedce602 100644 --- a/config.js +++ b/config.js @@ -253,6 +253,14 @@ var config = { // Default value for the channel "last N" attribute. -1 for unlimited. channelLastN: -1, + // Connection indicators + // connectionIndicators: { + // autoHide: true, + // autoHideTimeout: 5000, + // disabled: false, + // inactiveDisabled: false + // }, + // Provides a way for the lastN value to be controlled through the UI. // When startLastN is present, conference starts with a last-n value of startLastN and channelLastN // value will be used when the quality level is selected using "Manage Video Quality" slider. diff --git a/interface_config.js b/interface_config.js index fb8dd48569..021dc83980 100644 --- a/interface_config.js +++ b/interface_config.js @@ -25,31 +25,11 @@ var interfaceConfig = { BRAND_WATERMARK_LINK: '', CLOSE_PAGE_GUEST_HINT: false, // A html text to be shown to guests on the close page, false disables it - /** - * Whether the connection indicator icon should hide itself based on - * connection strength. If true, the connection indicator will remain - * displayed while the participant has a weak connection and will hide - * itself after the CONNECTION_INDICATOR_HIDE_TIMEOUT when the connection is - * strong. - * - * @type {boolean} - */ - CONNECTION_INDICATOR_AUTO_HIDE_ENABLED: true, - /** - * How long the connection indicator should remain displayed before hiding. - * Used in conjunction with CONNECTION_INDICATOR_AUTOHIDE_ENABLED. - * - * @type {number} - */ - CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT: 5000, - - /** - * If true, hides the connection indicators completely. - * - * @type {boolean} - */ - CONNECTION_INDICATOR_DISABLED: false, + // Connection indicators ( + // CONNECTION_INDICATOR_AUTO_HIDE_ENABLED, + // CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT, + // CONNECTION_INDICATOR_DISABLED) got moved to config.js. DEFAULT_BACKGROUND: '#474747', DEFAULT_LOCAL_DISPLAY_NAME: 'me', @@ -185,10 +165,10 @@ var interfaceConfig = { SHOW_BRAND_WATERMARK: false, /** - * Decides whether the chrome extension banner should be rendered on the landing page and during the meeting. - * If this is set to false, the banner will not be rendered at all. If set to true, the check for extension(s) - * being already installed is done before rendering. - */ + * Decides whether the chrome extension banner should be rendered on the landing page and during the meeting. + * If this is set to false, the banner will not be rendered at all. If set to true, the check for extension(s) + * being already installed is done before rendering. + */ SHOW_CHROME_EXTENSION_BANNER: false, SHOW_DEEP_LINKING_IMAGE: false, diff --git a/react/features/base/config/configWhitelist.js b/react/features/base/config/configWhitelist.js index 3cd893df2e..60604acfc4 100644 --- a/react/features/base/config/configWhitelist.js +++ b/react/features/base/config/configWhitelist.js @@ -70,6 +70,7 @@ export default [ 'callUUID', 'channelLastN', + 'connectionIndicators', 'constraints', 'brandingRoomAlias', 'debug', diff --git a/react/features/base/config/reducer.js b/react/features/base/config/reducer.js index 3df447e7ea..a7a77960c5 100644 --- a/react/features/base/config/reducer.js +++ b/react/features/base/config/reducer.js @@ -194,6 +194,18 @@ function _translateLegacyConfig(oldValue: Object) { newValue.toolbarButtons = interfaceConfig.TOOLBAR_BUTTONS; } + if (!oldValue.connectionIndicators + && typeof interfaceConfig === 'object' + && (interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_DISABLED') + || interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_AUTO_HIDE_ENABLED') + || interfaceConfig.hasOwnProperty('CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT'))) { + newValue.connectionIndicators = { + disabled: interfaceConfig.CONNECTION_INDICATOR_DISABLED, + autoHide: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_ENABLED, + autoHideTimeout: interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT + }; + } + if (oldValue.stereo || oldValue.opusMaxAverageBitrate) { newValue.audioQuality = { opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate, diff --git a/react/features/connection-indicator/components/AbstractConnectionIndicator.js b/react/features/connection-indicator/components/AbstractConnectionIndicator.js index 515a9ee34b..1d36ce3984 100644 --- a/react/features/connection-indicator/components/AbstractConnectionIndicator.js +++ b/react/features/connection-indicator/components/AbstractConnectionIndicator.js @@ -6,6 +6,8 @@ import statsEmitter from '../statsEmitter'; declare var interfaceConfig: Object; +const defaultAutoHideTimeout = 5000; + /** * The connection quality percentage that must be reached to be considered of * good quality and can result in the connection indicator being hidden. @@ -19,6 +21,11 @@ export const INDICATOR_DISPLAY_THRESHOLD = 30; */ export type Props = { + /** + * How long the connection indicator should remain displayed before hiding. + */ + _autoHideTimeout: number, + /** * The ID of the participant associated with the displayed connection indication and * stats. @@ -52,7 +59,7 @@ export type State = { * * @extends {Component} */ -export default class AbstractConnectionIndicator extends Component { +class AbstractConnectionIndicator extends Component { /** * The timeout for automatically hiding the indicator. */ @@ -165,9 +172,23 @@ export default class AbstractConnectionIndicator extends Com this.setState({ showIndicator: false }); - }, typeof interfaceConfig === 'undefined' - ? 5000 - : interfaceConfig.CONNECTION_INDICATOR_AUTO_HIDE_TIMEOUT); + }, this.props._autoHideTimeout); } } } + +/** + * Maps (parts of) the Redux state to the associated props for the + * {@code ConnectorIndicator} component. + * + * @param {Object} state - The Redux state. + * @private + * @returns {Props} + */ +export function mapStateToProps(state: Object) { + return { + _autoHideTimeout: state['features/base/config'].connectionIndicators.autoHideTimeout ?? defaultAutoHideTimeout + }; +} + +export default AbstractConnectionIndicator; diff --git a/react/features/connection-indicator/components/web/ConnectionIndicator.js b/react/features/connection-indicator/components/web/ConnectionIndicator.js index c8d10955ea..94cfec0271 100644 --- a/react/features/connection-indicator/components/web/ConnectionIndicator.js +++ b/react/features/connection-indicator/components/web/ConnectionIndicator.js @@ -64,6 +64,11 @@ type Props = AbstractProps & { */ _connectionStatus: string, + /** + * Disable/enable inactive indicator. + */ + _connectionIndicatorInactiveDisabled: boolean, + /** * Whether or not the component should ignore setting a visibility class for * hiding the component when the connection quality is not strong. @@ -224,8 +229,11 @@ class ConnectionIndicator extends AbstractConnectionIndicator