Browse Source

ref(mobile/external-api): skip event if conference exists

The change to mobile/external-api is required to not emit
CONFERENCE_FAILED for CONNECTION_FAILED if the conference has been
started, because base/conference state will still hold conference
instances which are to be ended by other means and result in the
appropriate event (which will adjust the base/conference state).
j8
paweldomas 7 years ago
parent
commit
b2f76f3ed6
1 changed files with 12 additions and 4 deletions
  1. 12
    4
      react/features/mobile/external-api/middleware.js

+ 12
- 4
react/features/mobile/external-api/middleware.js View File

189
 
189
 
190
 /**
190
 /**
191
  * Sends {@link CONFERENCE_FAILED} event when the {@link CONNECTION_FAILED}
191
  * Sends {@link CONFERENCE_FAILED} event when the {@link CONNECTION_FAILED}
192
- * occurs. Otherwise the external API will not emit such event, because at this
193
- * point conference has not been created yet and the base/conference feature
194
- * will not emit it.
192
+ * occurs. It should be done only if the connection fails before the conference
193
+ * instance is created. Otherwise the eventual failure event is supposed to be
194
+ * emitted by the base/conference feature.
195
  *
195
  *
196
  * @param {Store} store - The redux store.
196
  * @param {Store} store - The redux store.
197
  * @param {Action} action - The redux action.
197
  * @param {Action} action - The redux action.
199
  */
199
  */
200
 function _sendConferenceFailedOnConnectionError(store, action) {
200
 function _sendConferenceFailedOnConnectionError(store, action) {
201
     const { locationURL } = store.getState()['features/base/connection'];
201
     const { locationURL } = store.getState()['features/base/connection'];
202
+    const { connection } = action;
202
 
203
 
203
-    locationURL && _sendEvent(
204
+    locationURL
205
+        && forEachConference(
206
+            store,
207
+
208
+            // If there's any conference in the  base/conference state then the
209
+            // base/conference feature is supposed to emit a failure.
210
+            conference => conference.getConnection() !== connection)
211
+        && _sendEvent(
204
         store,
212
         store,
205
         _getSymbolDescription(CONFERENCE_FAILED),
213
         _getSymbolDescription(CONFERENCE_FAILED),
206
         /* data */ {
214
         /* data */ {

Loading…
Cancel
Save