Add support for app link scheme
This commit is contained in:
parent
4b17c6f015
commit
c84abd543e
|
@ -1,5 +1,11 @@
|
|||
// @flow
|
||||
|
||||
/**
|
||||
* The app linking scheme.
|
||||
* TODO: This should be read from the manifest files later.
|
||||
*/
|
||||
export const APP_LINK_SCHEME = 'org.jitsi.meet:';
|
||||
|
||||
/**
|
||||
* The {@link RegExp} pattern of the authority of a URI.
|
||||
*
|
||||
|
@ -395,7 +401,7 @@ export function urlObjectToString(o: Object): ?string {
|
|||
// XXX The value of domain in supposed to be host/hostname
|
||||
// and, optionally, pathname. Make sure it is not taken for
|
||||
// a pathname only.
|
||||
_fixURIStringScheme(`org.jitsi.meet://${domain}`));
|
||||
_fixURIStringScheme(`${APP_LINK_SCHEME}//${domain}`));
|
||||
|
||||
// authority
|
||||
if (host) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import RNCalendarEvents from 'react-native-calendar-events';
|
|||
|
||||
import { SET_ROOM } from '../base/conference';
|
||||
import { MiddlewareRegistry } from '../base/redux';
|
||||
import { parseURIString } from '../base/util';
|
||||
import { APP_LINK_SCHEME, parseURIString } from '../base/util';
|
||||
|
||||
import { APP_WILL_MOUNT } from '../app';
|
||||
|
||||
|
@ -161,8 +161,13 @@ function _fetchCalendarEntries(store) {
|
|||
*
|
||||
*/
|
||||
function _getURLFromEvent(event, knownDomains) {
|
||||
const linkTerminatorPattern = '[^\\s<>$]';
|
||||
/* eslint-disable max-len */
|
||||
const urlRegExp
|
||||
= new RegExp(`http(s)?://(${knownDomains.join('|')})/[^\\s<>$]+`, 'gi');
|
||||
= new RegExp(`http(s)?://(${knownDomains.join('|')})/${linkTerminatorPattern}+`, 'gi');
|
||||
/* eslint-enable max-len */
|
||||
const schemeRegExp
|
||||
= new RegExp(`${APP_LINK_SCHEME}${linkTerminatorPattern}+`, 'gi');
|
||||
const fieldsToSearch = [
|
||||
event.title,
|
||||
event.url,
|
||||
|
@ -175,7 +180,9 @@ function _getURLFromEvent(event, knownDomains) {
|
|||
for (const field of fieldsToSearch) {
|
||||
if (typeof field === 'string') {
|
||||
if (
|
||||
(matchArray = urlRegExp.exec(field)) !== null
|
||||
(matchArray
|
||||
= urlRegExp.exec(field) || schemeRegExp.exec(field))
|
||||
!== null
|
||||
) {
|
||||
return matchArray[0];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue