Procházet zdrojové kódy

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

Do not include the protocol part in the intent URL.
j8
paweldomas před 7 roky
rodič
revize
40d7d0c9cb

+ 10
- 6
react/features/base/util/uri.js Zobrazit soubor

25
 /**
25
 /**
26
  * The {@link RegExp} pattern of the protocol of a URI.
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
  * @type {string}
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
  * Fixes the hier-part of a specific URI (string) so that the URI is well-known.
38
  * Fixes the hier-part of a specific URI (string) so that the URI is well-known.
47
     // hipchat.com
51
     // hipchat.com
48
     let regex
52
     let regex
49
         = new RegExp(
53
         = new RegExp(
50
-            `^${_URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
54
+            `^${URI_PROTOCOL_PATTERN}//hipchat\\.com/video/call/`,
51
             'gi');
55
             'gi');
52
     let match: Array<string> | null = regex.exec(uri);
56
     let match: Array<string> | null = regex.exec(uri);
53
 
57
 
55
         // enso.me
59
         // enso.me
56
         regex
60
         regex
57
             = new RegExp(
61
             = new RegExp(
58
-                `^${_URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
62
+                `^${URI_PROTOCOL_PATTERN}//enso\\.me/(?:call|meeting)/`,
59
                 'gi');
63
                 'gi');
60
         match = regex.exec(uri);
64
         match = regex.exec(uri);
61
     }
65
     }
87
  * @returns {string}
91
  * @returns {string}
88
  */
92
  */
89
 function _fixURIStringScheme(uri: string) {
93
 function _fixURIStringScheme(uri: string) {
90
-    const regex = new RegExp(`^${_URI_PROTOCOL_PATTERN}+`, 'gi');
94
+    const regex = new RegExp(`^${URI_PROTOCOL_PATTERN}+`, 'gi');
91
     const match: Array<string> | null = regex.exec(uri);
95
     const match: Array<string> | null = regex.exec(uri);
92
 
96
 
93
     if (match) {
97
     if (match) {
191
     str = str.replace(/\s/g, '');
195
     str = str.replace(/\s/g, '');
192
 
196
 
193
     // protocol
197
     // protocol
194
-    regex = new RegExp(`^${_URI_PROTOCOL_PATTERN}`, 'gi');
198
+    regex = new RegExp(`^${URI_PROTOCOL_PATTERN}`, 'gi');
195
     match = regex.exec(str);
199
     match = regex.exec(str);
196
     if (match) {
200
     if (match) {
197
         obj.protocol = match[1].toLowerCase();
201
         obj.protocol = match[1].toLowerCase();

+ 6
- 1
react/features/unsupported-browser/components/UnsupportedMobileBrowser.js Zobrazit soubor

6
 
6
 
7
 import { translate, translateToHTML } from '../../base/i18n';
7
 import { translate, translateToHTML } from '../../base/i18n';
8
 import { Platform } from '../../base/react';
8
 import { Platform } from '../../base/react';
9
+import { URI_PROTOCOL_PATTERN } from '../../base/util';
9
 import { DialInSummary } from '../../invite';
10
 import { DialInSummary } from '../../invite';
10
 import HideNotificationBarStyle from './HideNotificationBarStyle';
11
 import HideNotificationBarStyle from './HideNotificationBarStyle';
11
 
12
 
82
         // appears to be a link with an app-specific scheme, not a Universal
83
         // appears to be a link with an app-specific scheme, not a Universal
83
         // Link.
84
         // Link.
84
         const appScheme = interfaceConfig.MOBILE_APP_SCHEME || 'org.jitsi.meet';
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
         this.setState({
92
         this.setState({
88
             joinURL
93
             joinURL

Načítá se…
Zrušit
Uložit