浏览代码

feat: show option to join via browser on supported mobile browsers

Currently Chromium based browsers and Firefox are supported on Android
Only Safari is supported on iOS
master
Jaya Allamsetty 5 年前
父节点
当前提交
5348fa19c8

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

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/Platform';
4
 
5
 
5
 import { isMobileBrowser } from './utils';
6
 import { isMobileBrowser } from './utils';
6
 
7
 
82
     return isMobileBrowser() || JitsiMeetJS.isWebRtcSupported();
83
     return isMobileBrowser() || JitsiMeetJS.isWebRtcSupported();
83
 }
84
 }
84
 
85
 
86
+/**
87
+ * Returns whether or not the current environment is a supported
88
+ * browser on a mobile device.
89
+ *
90
+ * @returns {boolean}
91
+ */
92
+export function isSupportedMobileBrowser() {
93
+    return (Platform.OS === 'android' && browser.isChromiumBased())
94
+        || (Platform.OS === 'android' && browser.isFirefox())
95
+        || (Platform.OS === 'ios' && browser.isSafari());
96
+}
97
+
85
 /**
98
 /**
86
  * Runs various browser checks to know if the current browser is found within
99
  * Runs various browser checks to know if the current browser is found within
87
  * the list.
100
  * the list.

+ 33
- 0
react/features/deep-linking/components/DeepLinkingMobilePage.web.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
+import type { Dispatch } from 'redux';
4
 
5
 
5
 import { createDeepLinkingPageEvent, sendAnalytics } from '../../analytics';
6
 import { createDeepLinkingPageEvent, sendAnalytics } from '../../analytics';
7
+import { isSupportedMobileBrowser } from '../../base/environment';
6
 import { translate } from '../../base/i18n';
8
 import { translate } from '../../base/i18n';
7
 import { Platform } from '../../base/react';
9
 import { Platform } from '../../base/react';
8
 import { connect } from '../../base/redux';
10
 import { connect } from '../../base/redux';
9
 import { DialInSummary } from '../../invite';
11
 import { DialInSummary } from '../../invite';
12
+import { openWebApp } from '../actions';
10
 import { _TNS } from '../constants';
13
 import { _TNS } from '../constants';
11
 import { generateDeepLinkingURL } from '../functions';
14
 import { generateDeepLinkingURL } from '../functions';
12
 import { renderPromotionalFooter } from '../renderPromotionalFooter';
15
 import { renderPromotionalFooter } from '../renderPromotionalFooter';
37
      */
40
      */
38
     _room: string,
41
     _room: string,
39
 
42
 
43
+    /**
44
+     * Used to dispatch actions from the buttons.
45
+     */
46
+    dispatch: Dispatch<any>,
47
+
40
     /**
48
     /**
41
      * The function to translate human-readable text.
49
      * The function to translate human-readable text.
42
      */
50
      */
60
 
68
 
61
         // Bind event handlers so they are only bound once per instance.
69
         // Bind event handlers so they are only bound once per instance.
62
         this._onDownloadApp = this._onDownloadApp.bind(this);
70
         this._onDownloadApp = this._onDownloadApp.bind(this);
71
+        this._onLaunchWeb = this._onLaunchWeb.bind(this);
63
         this._onOpenApp = this._onOpenApp.bind(this);
72
         this._onOpenApp = this._onOpenApp.bind(this);
64
     }
73
     }
65
 
74
 
146
                             { t(`${_TNS}.downloadApp`) }
155
                             { t(`${_TNS}.downloadApp`) }
147
                         </button>
156
                         </button>
148
                     </a>
157
                     </a>
158
+                    {
159
+                        isSupportedMobileBrowser()
160
+                            && <a
161
+                                onClick = { this._onLaunchWeb }
162
+                                target = '_top'>
163
+                                <button className = { downloadButtonClassName }>
164
+                                    { t(`${_TNS}.launchWebButton`) }
165
+                                </button>
166
+                            </a>
167
+                    }
149
                     { renderPromotionalFooter() }
168
                     { renderPromotionalFooter() }
150
                     <DialInSummary
169
                     <DialInSummary
151
                         className = 'deep-linking-dial-in'
170
                         className = 'deep-linking-dial-in'
205
                 'clicked', 'downloadAppButton', { isMobileBrowser: true }));
224
                 'clicked', 'downloadAppButton', { isMobileBrowser: true }));
206
     }
225
     }
207
 
226
 
227
+    _onLaunchWeb: () => void;
228
+
229
+    /**
230
+     * Handles launch web button clicks.
231
+     *
232
+     * @returns {void}
233
+     */
234
+    _onLaunchWeb() {
235
+        sendAnalytics(
236
+            createDeepLinkingPageEvent(
237
+                'clicked', 'launchWebButton', { isMobileBrowser: true }));
238
+        this.props.dispatch(openWebApp());
239
+    }
240
+
208
     _onOpenApp: () => void;
241
     _onOpenApp: () => void;
209
 
242
 
210
     /**
243
     /**

+ 2
- 8
react/features/deep-linking/functions.js 查看文件

50
  */
50
  */
51
 export function getDeepLinkingPage(state) {
51
 export function getDeepLinkingPage(state) {
52
     const { room } = state['features/base/conference'];
52
     const { room } = state['features/base/conference'];
53
+    const { launchInWeb } = state['features/deep-linking'];
53
 
54
 
54
     // Show only if we are about to join a conference.
55
     // Show only if we are about to join a conference.
55
-    if (!room || state['features/base/config'].disableDeepLinking) {
56
+    if (launchInWeb || !room || state['features/base/config'].disableDeepLinking) {
56
         return Promise.resolve();
57
         return Promise.resolve();
57
     }
58
     }
58
 
59
 
66
                 ? DeepLinkingMobilePage : NoMobileApp);
67
                 ? DeepLinkingMobilePage : NoMobileApp);
67
     }
68
     }
68
 
69
 
69
-    // desktop
70
-    const { launchInWeb } = state['features/deep-linking'];
71
-
72
-    if (launchInWeb) {
73
-        return Promise.resolve();
74
-    }
75
-
76
     return _openDesktopApp(state).then(
70
     return _openDesktopApp(state).then(
77
         // eslint-disable-next-line no-confusing-arrow
71
         // eslint-disable-next-line no-confusing-arrow
78
         result => result ? DeepLinkingDesktopPage : undefined);
72
         result => result ? DeepLinkingDesktopPage : undefined);

正在加载...
取消
保存