diff --git a/android/README.md b/android/README.md index 27eec01fdb..d70219fca2 100644 --- a/android/README.md +++ b/android/README.md @@ -241,3 +241,9 @@ The `data` HashMap contains a "url" key with the conference URL. Called before a conference is left. The `data` HashMap contains a "url" key with the conference URL. + +#### onLoadConfigError + +Called when loading the main configuration fails. + +The `data` HashMap contains a "error" key with the error. diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java index 0ae42232f6..bf8d7f8e39 100644 --- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java +++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewAdapter.java @@ -57,4 +57,11 @@ public abstract class JitsiMeetViewAdapter implements JitsiMeetViewListener { @Override public void onConferenceWillLeave(Map data) { } + + /** + * {@inheritDoc} + */ + @Override + public void onLoadConfigError(Map data) { + } } 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 a7bb03ca1c..29098626d6 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 @@ -58,4 +58,11 @@ public interface JitsiMeetViewListener { * @param data - Map with a "url" key with the conference URL. */ void onConferenceWillLeave(Map data); + + /** + * Called when loading the main configuration fails. + * + * @param data - Map with a "error" key with the error. + */ + void onLoadConfigError(Map data); } diff --git a/ios/README.md b/ios/README.md index 147970c6c5..fa8ce78917 100644 --- a/ios/README.md +++ b/ios/README.md @@ -150,3 +150,9 @@ The `data` dictionary contains a "url" key with the conference URL. Called before a conference is left. The `data` dictionary contains a "url" key with the conference URL. + +#### loadConfigError + +Called when loading the main configuration fails. + +The `data` dictionary contains a "error" key with the error. diff --git a/ios/sdk/src/JitsiMeetViewDelegate.h b/ios/sdk/src/JitsiMeetViewDelegate.h index 66748e57bd..18332c1340 100644 --- a/ios/sdk/src/JitsiMeetViewDelegate.h +++ b/ios/sdk/src/JitsiMeetViewDelegate.h @@ -59,4 +59,11 @@ */ - (void) conferenceWillLeave:(NSDictionary *)data; +/** + * Called when loading the main configuration file fails. + * + * The {@code data} dictionary contains a {@code error} key with the error. + */ +- (void) loadConfigError:(NSDictionary *)data; + @end diff --git a/react/features/app/actions.js b/react/features/app/actions.js index d763833d7f..612e514196 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 { setConfig } from '../base/config'; +import { loadConfigError, setConfig } from '../base/config'; import { loadConfig } from '../base/lib-jitsi-meet'; import { parseURIString } from '../base/util'; @@ -66,8 +66,12 @@ function _appNavigateToMandatoryLocation( // 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)); + + // We cannot go to the requested room if we weren't able to load + // the configuration. Go back to the entryway. + newLocation.room = undefined; - // The function loadConfig will log the err. return; } diff --git a/react/features/base/config/actionTypes.js b/react/features/base/config/actionTypes.js index 46d115ebf4..681057ed26 100644 --- a/react/features/base/config/actionTypes.js +++ b/react/features/base/config/actionTypes.js @@ -1,3 +1,14 @@ +/** + * The redux action which signals the configuration couldn't be loaded due to an + * error. + * + * { + * type: LOAD_CONFIG_ERROR, + * error: Error + * } + */ +export const LOAD_CONFIG_ERROR = Symbol('LOAD_CONFIG_ERROR'); + /** * The redux action which sets the configuration represented by the feature * base/config. The configuration is defined and consumed by the library diff --git a/react/features/base/config/actions.js b/react/features/base/config/actions.js index 086d4f663e..ac8439c320 100644 --- a/react/features/base/config/actions.js +++ b/react/features/base/config/actions.js @@ -1,6 +1,22 @@ /* @flow */ -import { SET_CONFIG } from './actionTypes'; +import { LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes'; + +/** + * Signals an error when loading the configuration. + * + * @param {Error} error - The error which caused the config to not be loaded. + * @returns {{ + * type: LOAD_CONFIG_ERROR, + * error: Error + * }} + */ +export function loadConfigError(error: Error) { + return { + type: LOAD_CONFIG_ERROR, + error + }; +} /** * Sets the configuration represented by the feature base/config. The diff --git a/react/features/mobile/external-api/middleware.js b/react/features/mobile/external-api/middleware.js index 5078379f9f..8f727497a1 100644 --- a/react/features/mobile/external-api/middleware.js +++ b/react/features/mobile/external-api/middleware.js @@ -10,6 +10,7 @@ import { CONFERENCE_WILL_LEAVE, JITSI_CONFERENCE_URL_KEY } from '../../base/conference'; +import { LOAD_CONFIG_ERROR } from '../../base/config'; import { MiddlewareRegistry } from '../../base/redux'; import { toURLString } from '../../base/util'; @@ -45,6 +46,16 @@ MiddlewareRegistry.register(store => next => action => { _sendEvent(store, name, data); break; } + + case LOAD_CONFIG_ERROR: { + const { type, error } = action; + + _sendEvent( + store, + _getSymbolDescription(type), + { error: String(error) }); + break; + } } return result;