Skip to content

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

[RN] Report loadConfigError with locationURL to the SDK consumers

Lyubo Marinovfce0e4c22c63
diff --git a/android/README.md b/android/README.md
index 6e3522760a..9cb8e6e396 100644
--- a/android/README.md
+++ b/android/README.md
@@ -244,6 +244,8 @@ The `data` `Map` contains a "url" key with the conference URL.
#### onLoadConfigError
-Called when loading the main configuration fails.
+Called when loading the main configuration file from the Jitsi Meet deployment
+fails.
-The `data` `Map` contains an "error" key with the error.
+The `data` `Map` contains an "error" key with the error and a "url" key with the
+conference URL which necessitated the loading of the configuration file.
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java
index 5a2041064e..b48b597182 100644
--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java
+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java
@@ -60,9 +60,12 @@ public interface JitsiMeetViewListener {
void onConferenceWillLeave(Map<String, Object> data);
/**
- * Called when loading the main configuration fails.
+ * Called when loading the main configuration file from the Jitsi Meet
+ * deployment fails.
*
- * @param data - Map with an "error" key with the error.
+ * @param data - Map with an "error" key with the error and a "url" key with
+ * the conference URL which necessitated the loading of the configuration
+ * file.
*/
void onLoadConfigError(Map<String, Object> data);
}
diff --git a/ios/README.md b/ios/README.md
index 328657398a..3adfd9afd2 100644
--- a/ios/README.md
+++ b/ios/README.md
@@ -153,6 +153,9 @@ The `data` dictionary contains a "url" key with the conference URL.
#### loadConfigError
-Called when loading the main configuration fails.
+Called when loading the main configuration file from the Jitsi Meet deployment
+fails.
-The `data` dictionary contains an "error" key with the error.
+The `data` dictionary contains an "error" key with the error and a "url" key
+with the conference URL which necessitated the loading of the configuration
+file.
diff --git a/ios/sdk/src/JitsiMeetViewDelegate.h b/ios/sdk/src/JitsiMeetViewDelegate.h
index ea2dc5b7fd..3374f9f98c 100644
--- a/ios/sdk/src/JitsiMeetViewDelegate.h
+++ b/ios/sdk/src/JitsiMeetViewDelegate.h
@@ -60,9 +60,12 @@
- (void)conferenceWillLeave:(NSDictionary *)data;
/**
- * Called when loading the main configuration file fails.
+ * Called when loading the main configuration file from the Jitsi Meet
+ * deployment file.
*
- * The {@code data} dictionary contains an {@code error} key with the error.
+ * The {@code data} dictionary contains an {@code error} key with the error and
+ * a {@code url} key with the conference URL which necessitated the loading of
+ * the configuration file.
*/
- (void)loadConfigError:(NSDictionary *)data;
diff --git a/react/features/app/actions.js b/react/features/app/actions.js
index 612e514196..5cb474d8fa 100644
--- a/react/features/app/actions.js
+++ b/react/features/app/actions.js
@@ -1,6 +1,6 @@
import { setRoom } from '../base/conference';
-import { setLocationURL } from '../base/connection';
import { loadConfigError, setConfig } from '../base/config';
+import { setLocationURL } from '../base/connection';
import { loadConfig } from '../base/lib-jitsi-meet';
import { parseURIString } from '../base/util';
@@ -39,11 +39,14 @@ export function appNavigate(uri: ?string) {
function _appNavigateToMandatoryLocation(
dispatch: Dispatch<*>, getState: Function,
newLocation: Object) {
- _loadConfig(newLocation)
- .then(
- config => configLoaded(/* err */ undefined, config),
- err => configLoaded(err, /* config */ undefined))
- .then(() => dispatch(setRoom(newLocation.room)));
+ const { room } = newLocation;
+
+ return (
+ _loadConfig(newLocation)
+ .then(
+ config => loadConfigSettled(/* error */ undefined, config),
+ error => loadConfigSettled(error, /* config */ undefined))
+ .then(() => dispatch(setRoom(room))));
/**
* Notifies that an attempt to load a configuration has completed. Due to
@@ -56,7 +59,7 @@ function _appNavigateToMandatoryLocation(
* loaded configuration.
* @returns {void}
*/
- function configLoaded(error, config) {
+ function loadConfigSettled(error, config) {
// FIXME Due to the asynchronous nature of the loading, the specified
// config may or may not be required by the time the notification
// arrives.
@@ -64,15 +67,15 @@ function _appNavigateToMandatoryLocation(
if (error) {
// XXX The failure could be, for example, because of a
// certificate-related error. In which case the connection will
- // fail later in Strophe anyway even if we use the default
- // config here.
- dispatch(loadConfigError(error));
+ // fail later in Strophe anyway.
+ dispatch(loadConfigError(error, newLocation));
- // We cannot go to the requested room if we weren't able to load
- // the configuration. Go back to the entryway.
- newLocation.room = undefined;
+ // Cannot go to a room if its configuration failed to load.
+ if (room) {
+ dispatch(appNavigate(undefined));
- return;
+ throw error;
+ }
}
return (
@@ -117,7 +120,7 @@ function _appNavigateToOptionalLocation(
location.protocol || (location.protocol = 'https:');
- _appNavigateToMandatoryLocation(dispatch, getState, location);
+ return _appNavigateToMandatoryLocation(dispatch, getState, location);
}
/**
diff --git a/react/features/base/config/actionTypes.js b/react/features/base/config/actionTypes.js
index 681057ed26..4be2581b0b 100644
--- a/react/features/base/config/actionTypes.js
+++ b/react/features/base/config/actionTypes.js
@@ -1,10 +1,11 @@
/**
- * The redux action which signals the configuration couldn't be loaded due to an
- * error.
+ * The redux action which signals that a configuration could not be loaded due
+ * to a specific error.
*
* {
* type: LOAD_CONFIG_ERROR,
- * error: Error
+ * error: Error,
+ * locationURL: string | URL
* }
*/
export const LOAD_CONFIG_ERROR = Symbol('LOAD_CONFIG_ERROR');
diff --git a/react/features/base/config/actions.js b/react/features/base/config/actions.js
index ac8439c320..8e1814c93d 100644
--- a/react/features/base/config/actions.js
+++ b/react/features/base/config/actions.js
@@ -3,18 +3,23 @@
import { LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes';
/**
- * Signals an error when loading the configuration.
+ * Signals that a configuration could not be loaded due to a specific error.
*
- * @param {Error} error - The error which caused the config to not be loaded.
+ * @param {Error} error - The {@code Error} which prevented the successful
+ * loading of a configuration.
+ * @param {string|URL} locationURL - The URL of the location which necessitated
+ * the loading of a configuration.
* @returns {{
- * type: LOAD_CONFIG_ERROR,
- * error: Error
+ * type: LOAD_CONFIG_ERROR,
+ * error: Error,
+ * locationURL
* }}
*/
-export function loadConfigError(error: Error) {
+export function loadConfigError(error: Error, locationURL: string | URL) {
return {
type: LOAD_CONFIG_ERROR,
- error
+ error,
+ locationURL
};
}
diff --git a/react/features/base/util/uri.js b/react/features/base/util/uri.js
index 6957a88252..9a10a100d1 100644
--- a/react/features/base/util/uri.js
+++ b/react/features/base/util/uri.js
@@ -382,7 +382,12 @@ export function urlObjectToString(o: Object): ?string {
if (domain) {
const { host, hostname, pathname: contextRoot, port }
- = parseStandardURIString(domain);
+ = parseStandardURIString(
+
+ // 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}`));
// authority
if (host) {
diff --git a/react/features/mobile/external-api/middleware.js b/react/features/mobile/external-api/middleware.js
index 8f727497a1..d6768dee28 100644
--- a/react/features/mobile/external-api/middleware.js
+++ b/react/features/mobile/external-api/middleware.js
@@ -39,21 +39,17 @@ MiddlewareRegistry.register(store => next => action => {
data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
}
- // The (externa API) event's name is the string representation of the
- // (redux) action's type.
- const name = _getSymbolDescription(type);
-
- _sendEvent(store, name, data);
+ _sendEvent(store, _getSymbolDescription(type), data);
break;
}
case LOAD_CONFIG_ERROR: {
- const { type, error } = action;
+ const { error, locationURL, type } = action;
- _sendEvent(
- store,
- _getSymbolDescription(type),
- { error: String(error) });
+ _sendEvent(store, _getSymbolDescription(type), {
+ error: String(error),
+ url: toURLString(locationURL)
+ });
break;
}
}