|
|
@@ -125,11 +125,13 @@ function _getSymbolDescription(symbol: Symbol) {
|
|
125
|
125
|
*/
|
|
126
|
126
|
function _sendConferenceEvent(
|
|
127
|
127
|
store: Object,
|
|
128
|
|
- { conference, type, ...data }: {
|
|
|
128
|
+ action: {
|
|
129
|
129
|
conference: Object,
|
|
130
|
130
|
type: Symbol,
|
|
131
|
131
|
url: ?string
|
|
132
|
132
|
}) {
|
|
|
133
|
+ const { conference, type, ...data } = action;
|
|
|
134
|
+
|
|
133
|
135
|
// For these (redux) actions, conference identifies a JitsiConference
|
|
134
|
136
|
// instance. The external API cannot transport such an object so we have to
|
|
135
|
137
|
// transport an "equivalent".
|
|
|
@@ -137,7 +139,8 @@ function _sendConferenceEvent(
|
|
137
|
139
|
data.url = toURLString(conference[JITSI_CONFERENCE_URL_KEY]);
|
|
138
|
140
|
}
|
|
139
|
141
|
|
|
140
|
|
- _sendEvent(store, _getSymbolDescription(type), data);
|
|
|
142
|
+ _swallowEvent(store, action, data)
|
|
|
143
|
+ || _sendEvent(store, _getSymbolDescription(type), data);
|
|
141
|
144
|
}
|
|
142
|
145
|
|
|
143
|
146
|
/**
|
|
|
@@ -169,3 +172,68 @@ function _sendEvent(
|
|
169
|
172
|
}
|
|
170
|
173
|
}
|
|
171
|
174
|
}
|
|
|
175
|
+
|
|
|
176
|
+/**
|
|
|
177
|
+ * Determines whether to not send a {@code CONFERENCE_LEFT} event to the native
|
|
|
178
|
+ * counterpart of the External API.
|
|
|
179
|
+ *
|
|
|
180
|
+ * @param {Object} store - The redux store.
|
|
|
181
|
+ * @param {Action} action - The redux action which is causing the sending of the
|
|
|
182
|
+ * event.
|
|
|
183
|
+ * @param {Object} data - The details/specifics of the event to send determined
|
|
|
184
|
+ * by/associated with the specified {@code action}.
|
|
|
185
|
+ * @returns {boolean} If the specified event is to not be sent, {@code true};
|
|
|
186
|
+ * otherwise, {@code false}.
|
|
|
187
|
+ */
|
|
|
188
|
+function _swallowConferenceLeft({ getState }, action, { url }) {
|
|
|
189
|
+ // XXX Internally, we work with JitsiConference instances. Externally
|
|
|
190
|
+ // though, we deal with URL strings. The relation between the two is many to
|
|
|
191
|
+ // one so it's technically and practically possible (by externally loading
|
|
|
192
|
+ // the same URL string multiple times) to try to send CONFERENCE_LEFT
|
|
|
193
|
+ // externally for a URL string which identifies a JitsiConference that the
|
|
|
194
|
+ // app is internally legitimately working with.
|
|
|
195
|
+
|
|
|
196
|
+ if (url) {
|
|
|
197
|
+ const stateFeaturesBaseConference
|
|
|
198
|
+ = getState()['features/base/conference'];
|
|
|
199
|
+
|
|
|
200
|
+ // eslint-disable-next-line guard-for-in
|
|
|
201
|
+ for (const p in stateFeaturesBaseConference) {
|
|
|
202
|
+ const v = stateFeaturesBaseConference[p];
|
|
|
203
|
+
|
|
|
204
|
+ // Does the value of the base/conference's property look like a
|
|
|
205
|
+ // JitsiConference?
|
|
|
206
|
+ if (v && typeof v === 'object') {
|
|
|
207
|
+ const vURL = v[JITSI_CONFERENCE_URL_KEY];
|
|
|
208
|
+
|
|
|
209
|
+ if (vURL && vURL.toString() === url) {
|
|
|
210
|
+ return true;
|
|
|
211
|
+ }
|
|
|
212
|
+ }
|
|
|
213
|
+ }
|
|
|
214
|
+ }
|
|
|
215
|
+
|
|
|
216
|
+ return false;
|
|
|
217
|
+}
|
|
|
218
|
+
|
|
|
219
|
+/**
|
|
|
220
|
+ * Determines whether to not send a specific event to the native counterpart of
|
|
|
221
|
+ * the External API.
|
|
|
222
|
+ *
|
|
|
223
|
+ * @param {Object} store - The redux store.
|
|
|
224
|
+ * @param {Action} action - The redux action which is causing the sending of the
|
|
|
225
|
+ * event.
|
|
|
226
|
+ * @param {Object} data - The details/specifics of the event to send determined
|
|
|
227
|
+ * by/associated with the specified {@code action}.
|
|
|
228
|
+ * @returns {boolean} If the specified event is to not be sent, {@code true};
|
|
|
229
|
+ * otherwise, {@code false}.
|
|
|
230
|
+ */
|
|
|
231
|
+function _swallowEvent(store, action, data) {
|
|
|
232
|
+ switch (action.type) {
|
|
|
233
|
+ case CONFERENCE_LEFT:
|
|
|
234
|
+ return _swallowConferenceLeft(store, action, data);
|
|
|
235
|
+
|
|
|
236
|
+ default:
|
|
|
237
|
+ return false;
|
|
|
238
|
+ }
|
|
|
239
|
+}
|