[RN] Report loadConfigError with locationURL to the SDK consumers

pull/1936/head jitsi-meet_2435
Lyubo Marinov 8 years ago
parent 4dc78ce458
commit fce0e4c22c
  1. 6
      android/README.md
  2. 7
      android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetViewListener.java
  3. 7
      ios/README.md
  4. 7
      ios/sdk/src/JitsiMeetViewDelegate.h
  5. 33
      react/features/app/actions.js
  6. 7
      react/features/base/config/actionTypes.js
  7. 17
      react/features/base/config/actions.js
  8. 7
      react/features/base/util/uri.js
  9. 16
      react/features/mobile/external-api/middleware.js

@ -244,6 +244,8 @@ The `data` `Map` contains a "url" key with the conference URL.
#### onLoadConfigError #### 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.

@ -60,9 +60,12 @@ public interface JitsiMeetViewListener {
void onConferenceWillLeave(Map<String, Object> data); 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); void onLoadConfigError(Map<String, Object> data);
} }

@ -153,6 +153,9 @@ The `data` dictionary contains a "url" key with the conference URL.
#### loadConfigError #### 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.

@ -60,9 +60,12 @@
- (void)conferenceWillLeave:(NSDictionary *)data; - (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; - (void)loadConfigError:(NSDictionary *)data;

@ -1,6 +1,6 @@
import { setRoom } from '../base/conference'; import { setRoom } from '../base/conference';
import { setLocationURL } from '../base/connection';
import { loadConfigError, setConfig } from '../base/config'; import { loadConfigError, setConfig } from '../base/config';
import { setLocationURL } from '../base/connection';
import { loadConfig } from '../base/lib-jitsi-meet'; import { loadConfig } from '../base/lib-jitsi-meet';
import { parseURIString } from '../base/util'; import { parseURIString } from '../base/util';
@ -39,11 +39,14 @@ export function appNavigate(uri: ?string) {
function _appNavigateToMandatoryLocation( function _appNavigateToMandatoryLocation(
dispatch: Dispatch<*>, getState: Function, dispatch: Dispatch<*>, getState: Function,
newLocation: Object) { newLocation: Object) {
_loadConfig(newLocation) const { room } = newLocation;
.then(
config => configLoaded(/* err */ undefined, config), return (
err => configLoaded(err, /* config */ undefined)) _loadConfig(newLocation)
.then(() => dispatch(setRoom(newLocation.room))); .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 * Notifies that an attempt to load a configuration has completed. Due to
@ -56,7 +59,7 @@ function _appNavigateToMandatoryLocation(
* loaded configuration. * loaded configuration.
* @returns {void} * @returns {void}
*/ */
function configLoaded(error, config) { function loadConfigSettled(error, config) {
// FIXME Due to the asynchronous nature of the loading, the specified // FIXME Due to the asynchronous nature of the loading, the specified
// config may or may not be required by the time the notification // config may or may not be required by the time the notification
// arrives. // arrives.
@ -64,15 +67,15 @@ function _appNavigateToMandatoryLocation(
if (error) { if (error) {
// XXX The failure could be, for example, because of a // XXX The failure could be, for example, because of a
// certificate-related error. In which case the connection will // certificate-related error. In which case the connection will
// fail later in Strophe anyway even if we use the default // fail later in Strophe anyway.
// config here. dispatch(loadConfigError(error, newLocation));
dispatch(loadConfigError(error));
// We cannot go to the requested room if we weren't able to load // Cannot go to a room if its configuration failed to load.
// the configuration. Go back to the entryway. if (room) {
newLocation.room = undefined; dispatch(appNavigate(undefined));
return; throw error;
}
} }
return ( return (
@ -117,7 +120,7 @@ function _appNavigateToOptionalLocation(
location.protocol || (location.protocol = 'https:'); location.protocol || (location.protocol = 'https:');
_appNavigateToMandatoryLocation(dispatch, getState, location); return _appNavigateToMandatoryLocation(dispatch, getState, location);
} }
/** /**

@ -1,10 +1,11 @@
/** /**
* The redux action which signals the configuration couldn't be loaded due to an * The redux action which signals that a configuration could not be loaded due
* error. * to a specific error.
* *
* { * {
* type: LOAD_CONFIG_ERROR, * type: LOAD_CONFIG_ERROR,
* error: Error * error: Error,
* locationURL: string | URL
* } * }
*/ */
export const LOAD_CONFIG_ERROR = Symbol('LOAD_CONFIG_ERROR'); export const LOAD_CONFIG_ERROR = Symbol('LOAD_CONFIG_ERROR');

@ -3,18 +3,23 @@
import { LOAD_CONFIG_ERROR, SET_CONFIG } from './actionTypes'; 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 {{ * @returns {{
* type: LOAD_CONFIG_ERROR, * type: LOAD_CONFIG_ERROR,
* error: Error * error: Error,
* locationURL
* }} * }}
*/ */
export function loadConfigError(error: Error) { export function loadConfigError(error: Error, locationURL: string | URL) {
return { return {
type: LOAD_CONFIG_ERROR, type: LOAD_CONFIG_ERROR,
error error,
locationURL
}; };
} }

@ -382,7 +382,12 @@ export function urlObjectToString(o: Object): ?string {
if (domain) { if (domain) {
const { host, hostname, pathname: contextRoot, port } 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 // authority
if (host) { if (host) {

@ -39,21 +39,17 @@ MiddlewareRegistry.register(store => next => action => {
data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]); data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
} }
// The (externa API) event's name is the string representation of the _sendEvent(store, _getSymbolDescription(type), data);
// (redux) action's type.
const name = _getSymbolDescription(type);
_sendEvent(store, name, data);
break; break;
} }
case LOAD_CONFIG_ERROR: { case LOAD_CONFIG_ERROR: {
const { type, error } = action; const { error, locationURL, type } = action;
_sendEvent( _sendEvent(store, _getSymbolDescription(type), {
store, error: String(error),
_getSymbolDescription(type), url: toURLString(locationURL)
{ error: String(error) }); });
break; break;
} }
} }

Loading…
Cancel
Save