Browse Source

Prevent chrome extension banner from spanning the console when disabled

master
Horatiu Muresan 5 years ago
parent
commit
5d96a226ed

+ 24
- 6
react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js View File

6
 import { getCurrentConference } from '../../base/conference/functions';
6
 import { getCurrentConference } from '../../base/conference/functions';
7
 import { browser } from '../../base/lib-jitsi-meet';
7
 import { browser } from '../../base/lib-jitsi-meet';
8
 import { isMobileBrowser } from '../../base/environment/utils';
8
 import { isMobileBrowser } from '../../base/environment/utils';
9
+import logger from '../logger';
9
 
10
 
10
 declare var interfaceConfig: Object;
11
 declare var interfaceConfig: Object;
11
 
12
 
102
      * @inheritdoc
103
      * @inheritdoc
103
      */
104
      */
104
     async componentDidUpdate() {
105
     async componentDidUpdate() {
106
+        if (!this._isSupportedEnvironment()) {
107
+            return;
108
+        }
109
+
105
         const hasExtensions = await this._checkExtensionsInstalled();
110
         const hasExtensions = await this._checkExtensionsInstalled();
106
 
111
 
107
         if (
112
         if (
114
         }
119
         }
115
     }
120
     }
116
 
121
 
122
+    /**
123
+     * Checks whether the feature is enabled and whether the environment(browser/os)
124
+     * supports it.
125
+     *
126
+     * @returns {boolean}
127
+     */
128
+    _isSupportedEnvironment() {
129
+        return interfaceConfig.SHOW_CHROME_EXTENSION_BANNER
130
+            && browser.isChrome()
131
+            && !isMobileBrowser();
132
+    }
133
+
117
     _onClosePressed: () => void;
134
     _onClosePressed: () => void;
118
 
135
 
119
     /**
136
     /**
159
         const extensionInstalledFunction = info => isExtensionInstalled(info);
176
         const extensionInstalledFunction = info => isExtensionInstalled(info);
160
 
177
 
161
         if (!this.props.chromeExtensionsInfo.length) {
178
         if (!this.props.chromeExtensionsInfo.length) {
162
-            console.warn('Further configuration needed, missing chrome extension(s) info');
179
+            logger.warn('Further configuration needed, missing chrome extension(s) info');
163
         }
180
         }
164
 
181
 
165
         return Promise.all(
182
         return Promise.all(
175
      * @returns {boolean} Whether to show the banner or not.
192
      * @returns {boolean} Whether to show the banner or not.
176
      */
193
      */
177
     _shouldNotRender() {
194
     _shouldNotRender() {
195
+        if (!this._isSupportedEnvironment()) {
196
+            return true;
197
+        }
198
+
178
         if (!this.props.chromeExtensionUrl) {
199
         if (!this.props.chromeExtensionUrl) {
179
-            console.warn('Further configuration needed, missing chrome extension URL');
200
+            logger.warn('Further configuration needed, missing chrome extension URL');
180
 
201
 
181
             return true;
202
             return true;
182
         }
203
         }
183
 
204
 
184
         const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true';
205
         const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true';
185
 
206
 
186
-        return !interfaceConfig.SHOW_CHROME_EXTENSION_BANNER
187
-            || !browser.isChrome()
188
-            || isMobileBrowser()
189
-            || dontShowAgain
207
+        return dontShowAgain
190
             || this.state.closePressed
208
             || this.state.closePressed
191
             || !this.state.shouldShow
209
             || !this.state.shouldShow
192
             || this.props.iAmRecorder;
210
             || this.props.iAmRecorder;

+ 5
- 0
react/features/chrome-extension-banner/logger.js View File

1
+// @flow
2
+
3
+import { getLogger } from '../base/logging/functions';
4
+
5
+export default getLogger('features/chrome-banner');

Loading…
Cancel
Save