Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
[RN] Fix the conference URL delivered to JitsiMeetView's listeners
Lyubo Marinov377be4272a15
diff --git a/react/features/base/conference/actions.js b/react/features/base/conference/actions.jsindex 4c3eb92dad..12633ca9de 100644--- a/react/features/base/conference/actions.js+++ b/react/features/base/conference/actions.js@@ -29,7 +29,8 @@ import {import {AVATAR_ID_COMMAND,AVATAR_URL_COMMAND,- EMAIL_COMMAND+ EMAIL_COMMAND,+ JITSI_CONFERENCE_URL_KEY} from './constants';import { _addLocalTracksToConference } from './functions';@@ -239,7 +240,7 @@ export function conferenceWillLeave(conference) {export function createConference() {return (dispatch, getState) => {const state = getState();- const connection = state['features/base/connection'].connection;+ const { connection, locationURL } = state['features/base/connection'];if (!connection) {throw new Error('Cannot create a conference without a connection!');@@ -258,6 +259,7 @@ export function createConference() {room.toLowerCase(),state['features/base/config']);+ conference[JITSI_CONFERENCE_URL_KEY] = locationURL;dispatch(_conferenceWillJoin(conference));_addConferenceListeners(conference, dispatch);diff --git a/react/features/base/conference/constants.js b/react/features/base/conference/constants.jsindex 035a99cd98..fcb13302f7 100644--- a/react/features/base/conference/constants.js+++ b/react/features/base/conference/constants.js@@ -18,3 +18,19 @@ export const AVATAR_URL_COMMAND = 'avatar-url';* @type {string}*/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');diff --git a/react/features/base/connection/functions.js b/react/features/base/connection/functions.jsindex a6805651f2..d6eb7db36b 100644--- a/react/features/base/connection/functions.js+++ b/react/features/base/connection/functions.js@@ -13,7 +13,10 @@ export function getInviteURL(stateOrGetState: Function | Object): ?string {= typeof stateOrGetState === 'function'? stateOrGetState(): stateOrGetState;- const { locationURL } = state['features/base/connection'];+ const locationURL+ = state instanceof URL+ ? state+ : state['features/base/connection'].locationURL;let inviteURL;if (locationURL) {diff --git a/react/features/mobile/external-api/middleware.js b/react/features/mobile/external-api/middleware.jsindex bd1e461ab9..485f2d916b 100644--- a/react/features/mobile/external-api/middleware.js+++ b/react/features/mobile/external-api/middleware.js@@ -7,9 +7,11 @@ import {CONFERENCE_JOINED,CONFERENCE_LEFT,CONFERENCE_WILL_JOIN,- CONFERENCE_WILL_LEAVE+ CONFERENCE_WILL_LEAVE,+ JITSI_CONFERENCE_URL_KEY} from '../../base/conference';import { MiddlewareRegistry } from '../../base/redux';+import { toURLString } from '../../base/util';/*** 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_WILL_JOIN: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// object so we have to transport an "equivalent".- if (conference || room) {- // We have chosen to identify the object in question by the- // (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;+ if (conference) {+ data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);}// The (externa API) event's name is the string representation of the