[RN] Fix the conference URL delivered to JitsiMeetView's listeners
This commit is contained in:
parent
737419dbe8
commit
377be4272a
|
@ -29,7 +29,8 @@ import {
|
||||||
import {
|
import {
|
||||||
AVATAR_ID_COMMAND,
|
AVATAR_ID_COMMAND,
|
||||||
AVATAR_URL_COMMAND,
|
AVATAR_URL_COMMAND,
|
||||||
EMAIL_COMMAND
|
EMAIL_COMMAND,
|
||||||
|
JITSI_CONFERENCE_URL_KEY
|
||||||
} from './constants';
|
} from './constants';
|
||||||
import { _addLocalTracksToConference } from './functions';
|
import { _addLocalTracksToConference } from './functions';
|
||||||
|
|
||||||
|
@ -239,7 +240,7 @@ export function conferenceWillLeave(conference) {
|
||||||
export function createConference() {
|
export function createConference() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const connection = state['features/base/connection'].connection;
|
const { connection, locationURL } = state['features/base/connection'];
|
||||||
|
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
throw new Error('Cannot create a conference without a connection!');
|
throw new Error('Cannot create a conference without a connection!');
|
||||||
|
@ -258,6 +259,7 @@ export function createConference() {
|
||||||
room.toLowerCase(),
|
room.toLowerCase(),
|
||||||
state['features/base/config']);
|
state['features/base/config']);
|
||||||
|
|
||||||
|
conference[JITSI_CONFERENCE_URL_KEY] = locationURL;
|
||||||
dispatch(_conferenceWillJoin(conference));
|
dispatch(_conferenceWillJoin(conference));
|
||||||
|
|
||||||
_addConferenceListeners(conference, dispatch);
|
_addConferenceListeners(conference, dispatch);
|
||||||
|
|
|
@ -18,3 +18,19 @@ export const AVATAR_URL_COMMAND = 'avatar-url';
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
export const EMAIL_COMMAND = 'email';
|
export const EMAIL_COMMAND = 'email';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the {@code JitsiConference} property which identifies the URL of
|
||||||
|
* the conference represented by the {@code JitsiConference} instance.
|
||||||
|
*
|
||||||
|
* TODO It was introduced in a moment of desperation. Jitsi Meet SDK for Android
|
||||||
|
* and iOS needs to deliver events from the JavaScript side where they originate
|
||||||
|
* to the Java and Objective-C sides, respectively, where they are to be
|
||||||
|
* handled. The URL of the {@code JitsiConference} was chosen as the identifier
|
||||||
|
* because the Java and Objective-C sides join by URL through their respective
|
||||||
|
* loadURL methods. But features/base/connection's {@code locationURL} is not
|
||||||
|
* guaranteed at the time of this writing to match the {@code JitsiConference}
|
||||||
|
* instance when the events are to be fired. Patching {@code JitsiConference}
|
||||||
|
* from the outside is not cool but it should suffice for now.
|
||||||
|
*/
|
||||||
|
export const JITSI_CONFERENCE_URL_KEY = Symbol('url');
|
||||||
|
|
|
@ -13,7 +13,10 @@ export function getInviteURL(stateOrGetState: Function | Object): ?string {
|
||||||
= typeof stateOrGetState === 'function'
|
= typeof stateOrGetState === 'function'
|
||||||
? stateOrGetState()
|
? stateOrGetState()
|
||||||
: stateOrGetState;
|
: stateOrGetState;
|
||||||
const { locationURL } = state['features/base/connection'];
|
const locationURL
|
||||||
|
= state instanceof URL
|
||||||
|
? state
|
||||||
|
: state['features/base/connection'].locationURL;
|
||||||
let inviteURL;
|
let inviteURL;
|
||||||
|
|
||||||
if (locationURL) {
|
if (locationURL) {
|
||||||
|
|
|
@ -7,9 +7,11 @@ import {
|
||||||
CONFERENCE_JOINED,
|
CONFERENCE_JOINED,
|
||||||
CONFERENCE_LEFT,
|
CONFERENCE_LEFT,
|
||||||
CONFERENCE_WILL_JOIN,
|
CONFERENCE_WILL_JOIN,
|
||||||
CONFERENCE_WILL_LEAVE
|
CONFERENCE_WILL_LEAVE,
|
||||||
|
JITSI_CONFERENCE_URL_KEY
|
||||||
} from '../../base/conference';
|
} from '../../base/conference';
|
||||||
import { MiddlewareRegistry } from '../../base/redux';
|
import { MiddlewareRegistry } from '../../base/redux';
|
||||||
|
import { toURLString } from '../../base/util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Middleware that captures Redux actions and uses the ExternalAPI module to
|
* Middleware that captures Redux actions and uses the ExternalAPI module to
|
||||||
|
@ -27,30 +29,13 @@ MiddlewareRegistry.register(store => next => action => {
|
||||||
case CONFERENCE_LEFT:
|
case CONFERENCE_LEFT:
|
||||||
case CONFERENCE_WILL_JOIN:
|
case CONFERENCE_WILL_JOIN:
|
||||||
case CONFERENCE_WILL_LEAVE: {
|
case CONFERENCE_WILL_LEAVE: {
|
||||||
const { conference, room, type, ...data } = action;
|
const { conference, type, ...data } = action;
|
||||||
|
|
||||||
// For the above (redux) actions, conference and/or room identify a
|
// For the above (redux) actions, conference identifies a
|
||||||
// JitsiConference instance. The external API cannot transport such an
|
// JitsiConference instance. The external API cannot transport such an
|
||||||
// object so we have to transport an "equivalent".
|
// object so we have to transport an "equivalent".
|
||||||
if (conference || room) {
|
if (conference) {
|
||||||
// We have chosen to identify the object in question by the
|
data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
|
||||||
// (supposedly) associated location URL. (FIXME Actually, the redux
|
|
||||||
// state locationURL is not really asssociated with the
|
|
||||||
// JitsiConference instance. The value of localtionURL is utilized
|
|
||||||
// in order to initialize the JitsiConference instance but the value
|
|
||||||
// of locationURL at the time of CONFERENCE_WILL_LEAVE and
|
|
||||||
// CONFERENCE_LEFT will not be the value with which the
|
|
||||||
// JitsiConference instance being left.)
|
|
||||||
const state = store.getState();
|
|
||||||
const { locationURL } = state['features/base/connection'];
|
|
||||||
|
|
||||||
if (!locationURL) {
|
|
||||||
// The (redux) action cannot be fully converted to an (external
|
|
||||||
// API) event.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
data.url = locationURL.href;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The (externa API) event's name is the string representation of the
|
// The (externa API) event's name is the string representation of the
|
||||||
|
|
Loading…
Reference in New Issue