diff --git a/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js b/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js index 75bf5a969..35e2e491b 100644 --- a/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js +++ b/react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js @@ -6,6 +6,7 @@ import { translate } from '../../base/i18n'; import { getCurrentConference } from '../../base/conference/functions'; import { browser } from '../../base/lib-jitsi-meet'; import { isMobileBrowser } from '../../base/environment/utils'; +import logger from '../logger'; declare var interfaceConfig: Object; @@ -102,6 +103,10 @@ class ChromeExtensionBanner extends PureComponent { * @inheritdoc */ async componentDidUpdate() { + if (!this._isSupportedEnvironment()) { + return; + } + const hasExtensions = await this._checkExtensionsInstalled(); if ( @@ -114,6 +119,18 @@ class ChromeExtensionBanner extends PureComponent { } } + /** + * Checks whether the feature is enabled and whether the environment(browser/os) + * supports it. + * + * @returns {boolean} + */ + _isSupportedEnvironment() { + return interfaceConfig.SHOW_CHROME_EXTENSION_BANNER + && browser.isChrome() + && !isMobileBrowser(); + } + _onClosePressed: () => void; /** @@ -159,7 +176,7 @@ class ChromeExtensionBanner extends PureComponent { const extensionInstalledFunction = info => isExtensionInstalled(info); if (!this.props.chromeExtensionsInfo.length) { - console.warn('Further configuration needed, missing chrome extension(s) info'); + logger.warn('Further configuration needed, missing chrome extension(s) info'); } return Promise.all( @@ -175,18 +192,19 @@ class ChromeExtensionBanner extends PureComponent { * @returns {boolean} Whether to show the banner or not. */ _shouldNotRender() { + if (!this._isSupportedEnvironment()) { + return true; + } + if (!this.props.chromeExtensionUrl) { - console.warn('Further configuration needed, missing chrome extension URL'); + logger.warn('Further configuration needed, missing chrome extension URL'); return true; } const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true'; - return !interfaceConfig.SHOW_CHROME_EXTENSION_BANNER - || !browser.isChrome() - || isMobileBrowser() - || dontShowAgain + return dontShowAgain || this.state.closePressed || !this.state.shouldShow || this.props.iAmRecorder; diff --git a/react/features/chrome-extension-banner/logger.js b/react/features/chrome-extension-banner/logger.js new file mode 100644 index 000000000..10f7142e6 --- /dev/null +++ b/react/features/chrome-extension-banner/logger.js @@ -0,0 +1,5 @@ +// @flow + +import { getLogger } from '../base/logging/functions'; + +export default getLogger('features/chrome-banner');