Переглянути джерело

Add support for app link scheme

j8
zbettenbuk 7 роки тому
джерело
коміт
c84abd543e

+ 7
- 1
react/features/base/util/uri.js Переглянути файл

1
 // @flow
1
 // @flow
2
 
2
 
3
+/**
4
+ * The app linking scheme.
5
+ * TODO: This should be read from the manifest files later.
6
+ */
7
+export const APP_LINK_SCHEME = 'org.jitsi.meet:';
8
+
3
 /**
9
 /**
4
  * The {@link RegExp} pattern of the authority of a URI.
10
  * The {@link RegExp} pattern of the authority of a URI.
5
  *
11
  *
395
                     // XXX The value of domain in supposed to be host/hostname
401
                     // XXX The value of domain in supposed to be host/hostname
396
                     // and, optionally, pathname. Make sure it is not taken for
402
                     // and, optionally, pathname. Make sure it is not taken for
397
                     // a pathname only.
403
                     // a pathname only.
398
-                    _fixURIStringScheme(`org.jitsi.meet://${domain}`));
404
+                    _fixURIStringScheme(`${APP_LINK_SCHEME}//${domain}`));
399
 
405
 
400
             // authority
406
             // authority
401
             if (host) {
407
             if (host) {

+ 10
- 3
react/features/calendar-sync/middleware.js Переглянути файл

4
 
4
 
5
 import { SET_ROOM } from '../base/conference';
5
 import { SET_ROOM } from '../base/conference';
6
 import { MiddlewareRegistry } from '../base/redux';
6
 import { MiddlewareRegistry } from '../base/redux';
7
-import { parseURIString } from '../base/util';
7
+import { APP_LINK_SCHEME, parseURIString } from '../base/util';
8
 
8
 
9
 import { APP_WILL_MOUNT } from '../app';
9
 import { APP_WILL_MOUNT } from '../app';
10
 
10
 
161
  *
161
  *
162
  */
162
  */
163
 function _getURLFromEvent(event, knownDomains) {
163
 function _getURLFromEvent(event, knownDomains) {
164
+    const linkTerminatorPattern = '[^\\s<>$]';
165
+    /* eslint-disable max-len */
164
     const urlRegExp
166
     const urlRegExp
165
-        = new RegExp(`http(s)?://(${knownDomains.join('|')})/[^\\s<>$]+`, 'gi');
167
+        = new RegExp(`http(s)?://(${knownDomains.join('|')})/${linkTerminatorPattern}+`, 'gi');
168
+    /* eslint-enable max-len */
169
+    const schemeRegExp
170
+        = new RegExp(`${APP_LINK_SCHEME}${linkTerminatorPattern}+`, 'gi');
166
     const fieldsToSearch = [
171
     const fieldsToSearch = [
167
         event.title,
172
         event.title,
168
         event.url,
173
         event.url,
175
     for (const field of fieldsToSearch) {
180
     for (const field of fieldsToSearch) {
176
         if (typeof field === 'string') {
181
         if (typeof field === 'string') {
177
             if (
182
             if (
178
-                (matchArray = urlRegExp.exec(field)) !== null
183
+                (matchArray
184
+                    = urlRegExp.exec(field) || schemeRegExp.exec(field))
185
+                        !== null
179
             ) {
186
             ) {
180
                 return matchArray[0];
187
                 return matchArray[0];
181
             }
188
             }

Завантаження…
Відмінити
Зберегти