Prevent chrome extension banner from spanning the console when disabled
This commit is contained in:
parent
9855fac805
commit
5d96a226ed
|
@ -6,6 +6,7 @@ import { translate } from '../../base/i18n';
|
||||||
import { getCurrentConference } from '../../base/conference/functions';
|
import { getCurrentConference } from '../../base/conference/functions';
|
||||||
import { browser } from '../../base/lib-jitsi-meet';
|
import { browser } from '../../base/lib-jitsi-meet';
|
||||||
import { isMobileBrowser } from '../../base/environment/utils';
|
import { isMobileBrowser } from '../../base/environment/utils';
|
||||||
|
import logger from '../logger';
|
||||||
|
|
||||||
declare var interfaceConfig: Object;
|
declare var interfaceConfig: Object;
|
||||||
|
|
||||||
|
@ -102,6 +103,10 @@ class ChromeExtensionBanner extends PureComponent<Props, State> {
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
async componentDidUpdate() {
|
async componentDidUpdate() {
|
||||||
|
if (!this._isSupportedEnvironment()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const hasExtensions = await this._checkExtensionsInstalled();
|
const hasExtensions = await this._checkExtensionsInstalled();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -114,6 +119,18 @@ class ChromeExtensionBanner extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
_onClosePressed: () => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -159,7 +176,7 @@ class ChromeExtensionBanner extends PureComponent<Props, State> {
|
||||||
const extensionInstalledFunction = info => isExtensionInstalled(info);
|
const extensionInstalledFunction = info => isExtensionInstalled(info);
|
||||||
|
|
||||||
if (!this.props.chromeExtensionsInfo.length) {
|
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(
|
return Promise.all(
|
||||||
|
@ -175,18 +192,19 @@ class ChromeExtensionBanner extends PureComponent<Props, State> {
|
||||||
* @returns {boolean} Whether to show the banner or not.
|
* @returns {boolean} Whether to show the banner or not.
|
||||||
*/
|
*/
|
||||||
_shouldNotRender() {
|
_shouldNotRender() {
|
||||||
|
if (!this._isSupportedEnvironment()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.props.chromeExtensionUrl) {
|
if (!this.props.chromeExtensionUrl) {
|
||||||
console.warn('Further configuration needed, missing chrome extension URL');
|
logger.warn('Further configuration needed, missing chrome extension URL');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true';
|
const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true';
|
||||||
|
|
||||||
return !interfaceConfig.SHOW_CHROME_EXTENSION_BANNER
|
return dontShowAgain
|
||||||
|| !browser.isChrome()
|
|
||||||
|| isMobileBrowser()
|
|
||||||
|| dontShowAgain
|
|
||||||
|| this.state.closePressed
|
|| this.state.closePressed
|
||||||
|| !this.state.shouldShow
|
|| !this.state.shouldShow
|
||||||
|| this.props.iAmRecorder;
|
|| this.props.iAmRecorder;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
|
import { getLogger } from '../base/logging/functions';
|
||||||
|
|
||||||
|
export default getLogger('features/chrome-banner');
|
Loading…
Reference in New Issue