瀏覽代碼

Fix chrome extension banner (#5011)

* Fix chrome extension banner

* Address reviews
master
horymury 5 年之前
父節點
當前提交
a9767eda72
沒有連結到貢獻者的電子郵件帳戶。

+ 2
- 0
react/features/app/components/App.web.js 查看文件

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

+ 0
- 7
react/features/base/app/components/BaseApp.js 查看文件

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

+ 3
- 13
react/features/base/environment/environment.js 查看文件

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import JitsiMeetJS from '../lib-jitsi-meet';
4
-import { Platform } from '../react';
4
+import { isMobileBrowser } from './utils';
5 5
 
6 6
 const { browser } = JitsiMeetJS.util;
7 7
 
@@ -67,7 +67,7 @@ export function isSupportedBrowser() {
67 67
     }
68 68
 
69 69
     // Blacklists apply to desktop browsers only right now.
70
-    if (!_isMobileBrowser() && _isCurrentBrowserInList(
70
+    if (!isMobileBrowser() && _isCurrentBrowserInList(
71 71
         interfaceConfig.UNSUPPORTED_BROWSERS || DEFAULT_UNSUPPORTED_BROWSERS
72 72
     )) {
73 73
         return false;
@@ -77,7 +77,7 @@ export function isSupportedBrowser() {
77 77
     // - the WelcomePage is mobile ready;
78 78
     // - if the URL points to a conference then deep-linking will take
79 79
     //   care of it.
80
-    return _isMobileBrowser() || JitsiMeetJS.isWebRtcSupported();
80
+    return isMobileBrowser() || JitsiMeetJS.isWebRtcSupported();
81 81
 }
82 82
 
83 83
 /**
@@ -96,13 +96,3 @@ function _isCurrentBrowserInList(list) {
96 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 查看文件

@@ -0,0 +1,10 @@
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 查看文件

@@ -4,6 +4,10 @@ import { connect } from '../../base/redux';
4 4
 import { Icon, IconClose } from '../../base/icons';
5 5
 import { translate } from '../../base/i18n';
6 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 13
  * Local storage key name for flag telling if user checked 'Don't show again' checkbox on the banner
@@ -32,6 +36,11 @@ type Props = {
32 36
      */
33 37
     chromeExtensionsInfo: Array<Object>,
34 38
 
39
+    /**
40
+     * Whether I am the current recorder.
41
+     */
42
+    iAmRecorder: boolean,
43
+
35 44
     /**
36 45
      * Invoked to obtain translated strings.
37 46
      */
@@ -161,11 +170,7 @@ class ChromeExtensionBanner extends PureComponent<Props, State> {
161 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 175
      * @returns {boolean} Whether to show the banner or not.
171 176
      */
@@ -178,9 +183,13 @@ class ChromeExtensionBanner extends PureComponent<Props, State> {
178 183
 
179 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 195
     _onDontShowAgainChange: (object: Object) => void;
@@ -269,7 +278,8 @@ const _mapStateToProps = state => {
269 278
     return {
270 279
         chromeExtensionUrl: bannerCfg.url,
271 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 查看文件

@@ -1,6 +1,7 @@
1 1
 /* global interfaceConfig */
2 2
 
3 3
 import { URI_PROTOCOL_PATTERN } from '../base/util';
4
+import { isMobileBrowser } from '../base/environment/utils';
4 5
 import { Platform } from '../base/react';
5 6
 
6 7
 import {
@@ -55,10 +56,7 @@ export function getDeepLinkingPage(state) {
55 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 60
         const mobileAppPromo
63 61
             = typeof interfaceConfig === 'object'
64 62
                 && interfaceConfig.MOBILE_APP_PROMO;

+ 2
- 5
react/features/invite/components/dial-in-info-page/DialInInfoApp.web.js 查看文件

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

+ 3
- 5
react/features/welcome/components/WelcomePage.web.js 查看文件

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

Loading…
取消
儲存