|
|
|
@ -125,11 +125,13 @@ function _getSymbolDescription(symbol: Symbol) { |
|
|
|
|
*/ |
|
|
|
|
function _sendConferenceEvent( |
|
|
|
|
store: Object, |
|
|
|
|
{ conference, type, ...data }: { |
|
|
|
|
action: { |
|
|
|
|
conference: Object, |
|
|
|
|
type: Symbol, |
|
|
|
|
url: ?string |
|
|
|
|
}) { |
|
|
|
|
const { conference, type, ...data } = action; |
|
|
|
|
|
|
|
|
|
// For these (redux) actions, conference identifies a JitsiConference
|
|
|
|
|
// instance. The external API cannot transport such an object so we have to
|
|
|
|
|
// transport an "equivalent".
|
|
|
|
@ -137,7 +139,8 @@ function _sendConferenceEvent( |
|
|
|
|
data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_sendEvent(store, _getSymbolDescription(type), data); |
|
|
|
|
_swallowEvent(store, action, data) |
|
|
|
|
|| _sendEvent(store, _getSymbolDescription(type), data); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -169,3 +172,68 @@ function _sendEvent( |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Determines whether to not send a {@code CONFERENCE_LEFT} event to the native |
|
|
|
|
* counterpart of the External API. |
|
|
|
|
* |
|
|
|
|
* @param {Object} store - The redux store. |
|
|
|
|
* @param {Action} action - The redux action which is causing the sending of the |
|
|
|
|
* event. |
|
|
|
|
* @param {Object} data - The details/specifics of the event to send determined |
|
|
|
|
* by/associated with the specified {@code action}. |
|
|
|
|
* @returns {boolean} If the specified event is to not be sent, {@code true}; |
|
|
|
|
* otherwise, {@code false}. |
|
|
|
|
*/ |
|
|
|
|
function _swallowConferenceLeft({ getState }, action, { url }) { |
|
|
|
|
// XXX Internally, we work with JitsiConference instances. Externally
|
|
|
|
|
// though, we deal with URL strings. The relation between the two is many to
|
|
|
|
|
// one so it's technically and practically possible (by externally loading
|
|
|
|
|
// the same URL string multiple times) to try to send CONFERENCE_LEFT
|
|
|
|
|
// externally for a URL string which identifies a JitsiConference that the
|
|
|
|
|
// app is internally legitimately working with.
|
|
|
|
|
|
|
|
|
|
if (url) { |
|
|
|
|
const stateFeaturesBaseConference |
|
|
|
|
= getState()['features/base/conference']; |
|
|
|
|
|
|
|
|
|
// eslint-disable-next-line guard-for-in
|
|
|
|
|
for (const p in stateFeaturesBaseConference) { |
|
|
|
|
const v = stateFeaturesBaseConference[p]; |
|
|
|
|
|
|
|
|
|
// Does the value of the base/conference's property look like a
|
|
|
|
|
// JitsiConference?
|
|
|
|
|
if (v && typeof v === 'object') { |
|
|
|
|
const vURL = v[JITSI_CONFERENCE_URL_KEY]; |
|
|
|
|
|
|
|
|
|
if (vURL && vURL.toString() === url) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Determines whether to not send a specific event to the native counterpart of |
|
|
|
|
* the External API. |
|
|
|
|
* |
|
|
|
|
* @param {Object} store - The redux store. |
|
|
|
|
* @param {Action} action - The redux action which is causing the sending of the |
|
|
|
|
* event. |
|
|
|
|
* @param {Object} data - The details/specifics of the event to send determined |
|
|
|
|
* by/associated with the specified {@code action}. |
|
|
|
|
* @returns {boolean} If the specified event is to not be sent, {@code true}; |
|
|
|
|
* otherwise, {@code false}. |
|
|
|
|
*/ |
|
|
|
|
function _swallowEvent(store, action, data) { |
|
|
|
|
switch (action.type) { |
|
|
|
|
case CONFERENCE_LEFT: |
|
|
|
|
return _swallowConferenceLeft(store, action, data); |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|