Browse Source

feat(UnsupportedMobileBrowser): do not include protocol in the intent

Do not include the protocol part in the intent URL.
master
paweldomas 7 years ago
parent
commit
40d7d0c9cb

+ 10
- 6
react/features/base/util/uri.js View File

@@ -25,10 +25,14 @@ const _URI_PATH_PATTERN = '([^?#]*)';
25 25
 /**
26 26
  * The {@link RegExp} pattern of the protocol of a URI.
27 27
  *
28
- * @private
28
+ * FIXME: The URL class exposed by JavaScript will not include the colon in
29
+ * the protocol field. Also in other places (at the time of this writing:
30
+ * the UnsupportedMobileBrowser.js) the APP_LINK_SCHEME does not include
31
+ * the double dots, so things are inconsistent.
32
+ *
29 33
  * @type {string}
30 34
  */
31
-const _URI_PROTOCOL_PATTERN = '([a-z][a-z0-9\\.\\+-]*:)';
35
+export const URI_PROTOCOL_PATTERN = '([a-z][a-z0-9\\.\\+-]*:)';
32 36
 
33 37
 /**
34 38
  * Fixes the hier-part of a specific URI (string) so that the URI is well-known.
@@ -47,7 +51,7 @@ function _fixURIStringHierPart(uri) {
47 51
     // hipchat.com
48 52
     let regex
49 53
         = new RegExp(
50
-            `^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
54
+            `^${URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
51 55
             'gi');
52 56
     let match: Array<string> | null = regex.exec(uri);
53 57
 
@@ -55,7 +59,7 @@ function _fixURIStringHierPart(uri) {
55 59
         // enso.me
56 60
         regex
57 61
             = new RegExp(
58
-                `^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
62
+                `^${URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
59 63
                 'gi');
60 64
         match = regex.exec(uri);
61 65
     }
@@ -87,7 +91,7 @@ function _fixURIStringHierPart(uri) {
87 91
  * @returns {string}
88 92
  */
89 93
 function _fixURIStringScheme(uri: string) {
90
-    const regex = new RegExp(`^${_URI_PROTOCOL_PATTERN}+`, 'gi');
94
+    const regex = new RegExp(`^${URI_PROTOCOL_PATTERN}+`, 'gi');
91 95
     const match: Array<string> | null = regex.exec(uri);
92 96
 
93 97
     if (match) {
@@ -191,7 +195,7 @@ export function parseStandardURIString(str: string) {
191 195
     str = str.replace(/\s/g, '');
192 196
 
193 197
     // protocol
194
-    regex = new RegExp(`^${_URI_PROTOCOL_PATTERN}`, 'gi');
198
+    regex = new RegExp(`^${URI_PROTOCOL_PATTERN}`, 'gi');
195 199
     match = regex.exec(str);
196 200
     if (match) {
197 201
         obj.protocol = match[1].toLowerCase();

+ 6
- 1
react/features/unsupported-browser/components/UnsupportedMobileBrowser.js View File

@@ -6,6 +6,7 @@ import { connect } from 'react-redux';
6 6
 
7 7
 import { translate, translateToHTML } from '../../base/i18n';
8 8
 import { Platform } from '../../base/react';
9
+import { URI_PROTOCOL_PATTERN } from '../../base/util';
9 10
 import { DialInSummary } from '../../invite';
10 11
 import HideNotificationBarStyle from './HideNotificationBarStyle';
11 12
 
@@ -82,7 +83,11 @@ class UnsupportedMobileBrowser extends Component<*, *> {
82 83
         // appears to be a link with an app-specific scheme, not a Universal
83 84
         // Link.
84 85
         const appScheme = interfaceConfig.MOBILE_APP_SCHEME || 'org.jitsi.meet';
85
-        const joinURL = `${appScheme}:${window.location.href}`;
86
+
87
+        // Replace the protocol part with the app scheme.
88
+        const joinURL
89
+            = window.location.href.replace(
90
+                new RegExp(`^${URI_PROTOCOL_PATTERN}`), `${appScheme}:`);
86 91
 
87 92
         this.setState({
88 93
             joinURL

Loading…
Cancel
Save