Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Add support for app link scheme

zbettenbukc84abd543ec4
diff --git a/react/features/base/util/uri.js b/react/features/base/util/uri.js
index 59d7278907..672f945d12 100644
--- a/react/features/base/util/uri.js
+++ b/react/features/base/util/uri.js
@@ -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) {
diff --git a/react/features/calendar-sync/middleware.js b/react/features/calendar-sync/middleware.js
index 5528c236c0..bf601ca219 100644
--- a/react/features/calendar-sync/middleware.js
+++ b/react/features/calendar-sync/middleware.js
@@ -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];
}