Selaa lähdekoodia

Fix chrome extension banner (#5011)

* Fix chrome extension banner

* Address reviews
master
horymury 5 vuotta sitten
vanhempi
commit
a9767eda72
No account linked to committer's email address

+ 2
- 0
react/features/app/components/App.web.js Näytä tiedosto

4
 import React from 'react';
4
 import React from 'react';
5
 
5
 
6
 import { DialogContainer } from '../../base/dialog';
6
 import { DialogContainer } from '../../base/dialog';
7
+import { ChromeExtensionBanner } from '../../chrome-extension-banner';
7
 import '../../base/user-interaction';
8
 import '../../base/user-interaction';
8
 import '../../chat';
9
 import '../../chat';
9
 import '../../external-api';
10
 import '../../external-api';
31
     _createMainElement(component, props) {
32
     _createMainElement(component, props) {
32
         return (
33
         return (
33
             <AtlasKitThemeProvider mode = 'dark'>
34
             <AtlasKitThemeProvider mode = 'dark'>
35
+                <ChromeExtensionBanner />
34
                 { super._createMainElement(component, props) }
36
                 { super._createMainElement(component, props) }
35
             </AtlasKitThemeProvider>
37
             </AtlasKitThemeProvider>
36
         );
38
         );

+ 0
- 7
react/features/base/app/components/BaseApp.js Näytä tiedosto

18
 
18
 
19
 import { appWillMount, appWillUnmount } from '../actions';
19
 import { appWillMount, appWillUnmount } from '../actions';
20
 import logger from '../logger';
20
 import logger from '../logger';
21
-import { ChromeExtensionBanner } from '../../../chrome-extension-banner';
22
 
21
 
23
-declare var interfaceConfig: Object;
24
 declare var APP: Object;
22
 declare var APP: Object;
25
 
23
 
26
 /**
24
 /**
131
                 <I18nextProvider i18n = { i18next }>
129
                 <I18nextProvider i18n = { i18next }>
132
                     <Provider store = { store }>
130
                     <Provider store = { store }>
133
                         <Fragment>
131
                         <Fragment>
134
-                            {
135
-                                typeof interfaceConfig !== 'undefined'
136
-                                && interfaceConfig.SHOW_CHROME_EXTENSION_BANNER
137
-                                && <ChromeExtensionBanner />
138
-                            }
139
                             { this._createMainElement(component) }
132
                             { this._createMainElement(component) }
140
                             <SoundCollection />
133
                             <SoundCollection />
141
                             { this._createExtraElement() }
134
                             { this._createExtraElement() }

+ 3
- 13
react/features/base/environment/environment.js Näytä tiedosto

1
 // @flow
1
 // @flow
2
 
2
 
3
 import JitsiMeetJS from '../lib-jitsi-meet';
3
 import JitsiMeetJS from '../lib-jitsi-meet';
4
-import { Platform } from '../react';
4
+import { isMobileBrowser } from './utils';
5
 
5
 
6
 const { browser } = JitsiMeetJS.util;
6
 const { browser } = JitsiMeetJS.util;
7
 
7
 
67
     }
67
     }
68
 
68
 
69
     // Blacklists apply to desktop browsers only right now.
69
     // Blacklists apply to desktop browsers only right now.
70
-    if (!_isMobileBrowser() && _isCurrentBrowserInList(
70
+    if (!isMobileBrowser() && _isCurrentBrowserInList(
71
         interfaceConfig.UNSUPPORTED_BROWSERS || DEFAULT_UNSUPPORTED_BROWSERS
71
         interfaceConfig.UNSUPPORTED_BROWSERS || DEFAULT_UNSUPPORTED_BROWSERS
72
     )) {
72
     )) {
73
         return false;
73
         return false;
77
     // - the WelcomePage is mobile ready;
77
     // - the WelcomePage is mobile ready;
78
     // - if the URL points to a conference then deep-linking will take
78
     // - if the URL points to a conference then deep-linking will take
79
     //   care of it.
79
     //   care of it.
80
-    return _isMobileBrowser() || JitsiMeetJS.isWebRtcSupported();
80
+    return isMobileBrowser() || JitsiMeetJS.isWebRtcSupported();
81
 }
81
 }
82
 
82
 
83
 /**
83
 /**
96
         return checkFunction ? checkFunction.call(browser) : false;
96
         return checkFunction ? checkFunction.call(browser) : false;
97
     }));
97
     }));
98
 }
98
 }
99
-
100
-/**
101
- * Returns whether or not the current environment is a mobile device.
102
- *
103
- * @private
104
- * @returns {boolean}
105
- */
106
-function _isMobileBrowser() {
107
-    return Platform.OS === 'android' || Platform.OS === 'ios';
108
-}

+ 10
- 0
react/features/base/environment/utils.js Näytä tiedosto

1
+import Platform from '../react/Platform';
2
+
3
+/**
4
+ * Returns whether or not the current environment is a mobile device.
5
+ *
6
+ * @returns {boolean}
7
+ */
8
+export function isMobileBrowser() {
9
+    return Platform.OS === 'android' || Platform.OS === 'ios';
10
+}

+ 19
- 9
react/features/chrome-extension-banner/components/ChromeExtensionBanner.web.js Näytä tiedosto

4
 import { Icon, IconClose } from '../../base/icons';
4
 import { Icon, IconClose } from '../../base/icons';
5
 import { translate } from '../../base/i18n';
5
 import { translate } from '../../base/i18n';
6
 import { getCurrentConference } from '../../base/conference/functions';
6
 import { getCurrentConference } from '../../base/conference/functions';
7
+import { browser } from '../../base/lib-jitsi-meet';
8
+import { isMobileBrowser } from '../../base/environment/utils';
9
+
10
+declare var interfaceConfig: Object;
7
 
11
 
8
 /**
12
 /**
9
  * Local storage key name for flag telling if user checked 'Don't show again' checkbox on the banner
13
  * Local storage key name for flag telling if user checked 'Don't show again' checkbox on the banner
32
      */
36
      */
33
     chromeExtensionsInfo: Array<Object>,
37
     chromeExtensionsInfo: Array<Object>,
34
 
38
 
39
+    /**
40
+     * Whether I am the current recorder.
41
+     */
42
+    iAmRecorder: boolean,
43
+
35
     /**
44
     /**
36
      * Invoked to obtain translated strings.
45
      * Invoked to obtain translated strings.
37
      */
46
      */
161
     _shouldNotRender: () => boolean;
170
     _shouldNotRender: () => boolean;
162
 
171
 
163
     /**
172
     /**
164
-     * Checks whether the banner should be displayed based on:
165
-     * Whether there is a configuration issue with the chrome extensions data.
166
-     * Whether the user checked don't show again checkbox in a previous session.
167
-     * Whether the user closed the banner.
168
-     * Whether the extension is already installed.
173
+     * Checks whether the banner should not be rendered.
169
      *
174
      *
170
      * @returns {boolean} Whether to show the banner or not.
175
      * @returns {boolean} Whether to show the banner or not.
171
      */
176
      */
178
 
183
 
179
         const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true';
184
         const dontShowAgain = localStorage.getItem(DONT_SHOW_AGAIN_CHECKED) === 'true';
180
 
185
 
181
-        return dontShowAgain
182
-        || this.state.closePressed
183
-        || !this.state.shouldShow;
186
+        return !interfaceConfig.SHOW_CHROME_EXTENSION_BANNER
187
+            || !browser.isChrome()
188
+            || isMobileBrowser()
189
+            || dontShowAgain
190
+            || this.state.closePressed
191
+            || !this.state.shouldShow
192
+            || this.props.iAmRecorder;
184
     }
193
     }
185
 
194
 
186
     _onDontShowAgainChange: (object: Object) => void;
195
     _onDontShowAgainChange: (object: Object) => void;
269
     return {
278
     return {
270
         chromeExtensionUrl: bannerCfg.url,
279
         chromeExtensionUrl: bannerCfg.url,
271
         chromeExtensionsInfo: bannerCfg.chromeExtensionsInfo || [],
280
         chromeExtensionsInfo: bannerCfg.chromeExtensionsInfo || [],
272
-        conference: getCurrentConference(state)
281
+        conference: getCurrentConference(state),
282
+        iAmRecorder: state['features/base/config'].iAmRecorder
273
     };
283
     };
274
 };
284
 };
275
 
285
 

+ 2
- 4
react/features/deep-linking/functions.js Näytä tiedosto

1
 /* global interfaceConfig */
1
 /* global interfaceConfig */
2
 
2
 
3
 import { URI_PROTOCOL_PATTERN } from '../base/util';
3
 import { URI_PROTOCOL_PATTERN } from '../base/util';
4
+import { isMobileBrowser } from '../base/environment/utils';
4
 import { Platform } from '../base/react';
5
 import { Platform } from '../base/react';
5
 
6
 
6
 import {
7
 import {
55
         return Promise.resolve();
56
         return Promise.resolve();
56
     }
57
     }
57
 
58
 
58
-    const OS = Platform.OS;
59
-    const isUsingMobileBrowser = OS === 'android' || OS === 'ios';
60
-
61
-    if (isUsingMobileBrowser) { // mobile
59
+    if (isMobileBrowser()) { // mobile
62
         const mobileAppPromo
60
         const mobileAppPromo
63
             = typeof interfaceConfig === 'object'
61
             = typeof interfaceConfig === 'object'
64
                 && interfaceConfig.MOBILE_APP_PROMO;
62
                 && interfaceConfig.MOBILE_APP_PROMO;

+ 2
- 5
react/features/invite/components/dial-in-info-page/DialInInfoApp.web.js Näytä tiedosto

4
 
4
 
5
 import parseURLParams from '../../../base/config/parseURLParams';
5
 import parseURLParams from '../../../base/config/parseURLParams';
6
 import { i18next } from '../../../base/i18n';
6
 import { i18next } from '../../../base/i18n';
7
-
7
+import { isMobileBrowser } from '../../../base/environment/utils';
8
 import { DialInSummary } from '../dial-in-summary';
8
 import { DialInSummary } from '../dial-in-summary';
9
 
9
 
10
 import NoRoomError from './NoRoomError';
10
 import NoRoomError from './NoRoomError';
11
-import Platform from '../../../base/react/Platform.web';
12
 
11
 
13
 document.addEventListener('DOMContentLoaded', () => {
12
 document.addEventListener('DOMContentLoaded', () => {
14
     const { room } = parseURLParams(window.location, true, 'search');
13
     const { room } = parseURLParams(window.location, true, 'search');
15
-    const OS = Platform.OS;
16
-    const isUsingMobileBrowser = OS === 'android' || OS === 'ios';
17
 
14
 
18
     ReactDOM.render(
15
     ReactDOM.render(
19
         <I18nextProvider i18n = { i18next }>
16
         <I18nextProvider i18n = { i18next }>
20
             { room
17
             { room
21
                 ? <DialInSummary
18
                 ? <DialInSummary
22
                     className = 'dial-in-page'
19
                     className = 'dial-in-page'
23
-                    clickableNumbers = { isUsingMobileBrowser }
20
+                    clickableNumbers = { isMobileBrowser() }
24
                     room = { decodeURIComponent(room) } />
21
                     room = { decodeURIComponent(room) } />
25
                 : <NoRoomError className = 'dial-in-page' /> }
22
                 : <NoRoomError className = 'dial-in-page' /> }
26
         </I18nextProvider>,
23
         </I18nextProvider>,

+ 3
- 5
react/features/welcome/components/WelcomePage.web.js Näytä tiedosto

3
 import React from 'react';
3
 import React from 'react';
4
 
4
 
5
 import { translate } from '../../base/i18n';
5
 import { translate } from '../../base/i18n';
6
-import { Platform, Watermarks } from '../../base/react';
6
+import { Watermarks } from '../../base/react';
7
 import { connect } from '../../base/redux';
7
 import { connect } from '../../base/redux';
8
+import { isMobileBrowser } from '../../base/environment/utils';
8
 import { CalendarList } from '../../calendar-sync';
9
 import { CalendarList } from '../../calendar-sync';
9
 import { RecentList } from '../../recent-list';
10
 import { RecentList } from '../../recent-list';
10
 import { SettingsButton, SETTINGS_TABS } from '../../settings';
11
 import { SettingsButton, SETTINGS_TABS } from '../../settings';
280
      * @returns {ReactElement|null}
281
      * @returns {ReactElement|null}
281
      */
282
      */
282
     _renderTabs() {
283
     _renderTabs() {
283
-        const isMobileBrowser
284
-            = Platform.OS === 'android' || Platform.OS === 'ios';
285
-
286
-        if (isMobileBrowser) {
284
+        if (isMobileBrowser()) {
287
             return null;
285
             return null;
288
         }
286
         }
289
 
287
 

Loading…
Peruuta
Tallenna