Quellcode durchsuchen

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 vor 5 Jahren
Ursprung
Commit
5348fa19c8

+ 13
- 0
react/features/base/environment/environment.js Datei anzeigen

@@ -1,6 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import JitsiMeetJS from '../lib-jitsi-meet';
4
+import Platform from '../react/Platform';
4 5
 
5 6
 import { isMobileBrowser } from './utils';
6 7
 
@@ -82,6 +83,18 @@ export function isSupportedBrowser() {
82 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 99
  * Runs various browser checks to know if the current browser is found within
87 100
  * the list.

+ 33
- 0
react/features/deep-linking/components/DeepLinkingMobilePage.web.js Datei anzeigen

@@ -1,12 +1,15 @@
1 1
 // @flow
2 2
 
3 3
 import React, { Component } from 'react';
4
+import type { Dispatch } from 'redux';
4 5
 
5 6
 import { createDeepLinkingPageEvent, sendAnalytics } from '../../analytics';
7
+import { isSupportedMobileBrowser } from '../../base/environment';
6 8
 import { translate } from '../../base/i18n';
7 9
 import { Platform } from '../../base/react';
8 10
 import { connect } from '../../base/redux';
9 11
 import { DialInSummary } from '../../invite';
12
+import { openWebApp } from '../actions';
10 13
 import { _TNS } from '../constants';
11 14
 import { generateDeepLinkingURL } from '../functions';
12 15
 import { renderPromotionalFooter } from '../renderPromotionalFooter';
@@ -37,6 +40,11 @@ type Props = {
37 40
      */
38 41
     _room: string,
39 42
 
43
+    /**
44
+     * Used to dispatch actions from the buttons.
45
+     */
46
+    dispatch: Dispatch<any>,
47
+
40 48
     /**
41 49
      * The function to translate human-readable text.
42 50
      */
@@ -60,6 +68,7 @@ class DeepLinkingMobilePage extends Component<Props> {
60 68
 
61 69
         // Bind event handlers so they are only bound once per instance.
62 70
         this._onDownloadApp = this._onDownloadApp.bind(this);
71
+        this._onLaunchWeb = this._onLaunchWeb.bind(this);
63 72
         this._onOpenApp = this._onOpenApp.bind(this);
64 73
     }
65 74
 
@@ -146,6 +155,16 @@ class DeepLinkingMobilePage extends Component<Props> {
146 155
                             { t(`${_TNS}.downloadApp`) }
147 156
                         </button>
148 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 168
                     { renderPromotionalFooter() }
150 169
                     <DialInSummary
151 170
                         className = 'deep-linking-dial-in'
@@ -205,6 +224,20 @@ class DeepLinkingMobilePage extends Component<Props> {
205 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 241
     _onOpenApp: () => void;
209 242
 
210 243
     /**

+ 2
- 8
react/features/deep-linking/functions.js Datei anzeigen

@@ -50,9 +50,10 @@ export function generateDeepLinkingURL() {
50 50
  */
51 51
 export function getDeepLinkingPage(state) {
52 52
     const { room } = state['features/base/conference'];
53
+    const { launchInWeb } = state['features/deep-linking'];
53 54
 
54 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 57
         return Promise.resolve();
57 58
     }
58 59
 
@@ -66,13 +67,6 @@ export function getDeepLinkingPage(state) {
66 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 70
     return _openDesktopApp(state).then(
77 71
         // eslint-disable-next-line no-confusing-arrow
78 72
         result => result ? DeepLinkingDesktopPage : undefined);

Laden…
Abbrechen
Speichern