Pārlūkot izejas kodu

bugfix(rn) sends CONFERENCE_TERMINATED to native after dismissing the ReloadOverlay

master
tmoldovan8x8 3 gadus atpakaļ
vecāks
revīzija
243aa20912
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam

+ 16
- 52
react/features/mobile/external-api/middleware.js Parādīt failu

@@ -17,15 +17,16 @@ import {
17 17
     getCurrentConference,
18 18
     isRoomValid
19 19
 } from '../../base/conference';
20
-import { LOAD_CONFIG_ERROR } from '../../base/config';
21 20
 import {
22 21
     CONNECTION_DISCONNECTED,
23
-    CONNECTION_FAILED,
24 22
     JITSI_CONNECTION_CONFERENCE_KEY,
25 23
     JITSI_CONNECTION_URL_KEY,
26 24
     getURLWithoutParams
27 25
 } from '../../base/connection';
28
-import { JitsiConferenceEvents } from '../../base/lib-jitsi-meet';
26
+import {
27
+    isFatalJitsiConferenceError,
28
+    isFatalJitsiConnectionError,
29
+    JitsiConferenceEvents } from '../../base/lib-jitsi-meet';
29 30
 import { MEDIA_TYPE } from '../../base/media';
30 31
 import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
31 32
 import {
@@ -40,6 +41,7 @@ import { toggleScreensharing } from '../../base/tracks';
40 41
 import { OPEN_CHAT, CLOSE_CHAT } from '../../chat';
41 42
 import { openChat } from '../../chat/actions';
42 43
 import { sendMessage, setPrivateMessageRecipient, closeChat } from '../../chat/actions.any';
44
+import { SET_PAGE_RELOAD_OVERLAY_CANCELED } from '../../overlay/actionTypes';
43 45
 import { muteLocal } from '../../video-menu/actions';
44 46
 import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
45 47
 
@@ -114,7 +116,7 @@ MiddlewareRegistry.register(store => next => action => {
114 116
         // counterpart of the External API (or at least not in the
115 117
         // fatality/finality semantics attributed to
116 118
         // conferenceFailed:/onConferenceFailed).
117
-        if (!error.recoverable) {
119
+        if (!error.recoverable && !isFatalJitsiConnectionError(error) && !isFatalJitsiConferenceError(error)) {
118 120
             _sendConferenceEvent(store, /* action */ {
119 121
                 error: _toErrorString(error),
120 122
                 ...data
@@ -154,28 +156,10 @@ MiddlewareRegistry.register(store => next => action => {
154 156
         break;
155 157
     }
156 158
 
157
-    case CONNECTION_FAILED:
158
-        !action.error.recoverable
159
-            && _sendConferenceFailedOnConnectionError(store, action);
160
-        break;
161
-
162 159
     case ENTER_PICTURE_IN_PICTURE:
163 160
         sendEvent(store, type, /* data */ {});
164 161
         break;
165 162
 
166
-    case LOAD_CONFIG_ERROR: {
167
-        const { error, locationURL } = action;
168
-
169
-        sendEvent(
170
-            store,
171
-            CONFERENCE_TERMINATED,
172
-            /* data */ {
173
-                error: _toErrorString(error),
174
-                url: _normalizeUrl(locationURL)
175
-            });
176
-        break;
177
-    }
178
-
179 163
     case OPEN_CHAT:
180 164
     case CLOSE_CHAT: {
181 165
         sendEvent(
@@ -219,6 +203,16 @@ MiddlewareRegistry.register(store => next => action => {
219 203
             });
220 204
         break;
221 205
 
206
+    case SET_PAGE_RELOAD_OVERLAY_CANCELED:
207
+        sendEvent(
208
+            store,
209
+            CONFERENCE_TERMINATED,
210
+            /* data */ {
211
+                error: _toErrorString(action.error),
212
+                url: _normalizeUrl(store.getState()['features/base/connection'].locationURL)
213
+            });
214
+
215
+        break;
222 216
     case SET_VIDEO_MUTED:
223 217
         sendEvent(
224 218
             store,
@@ -551,36 +545,6 @@ function _sendConferenceEvent(
551 545
     sendEvent(store, type_, data);
552 546
 }
553 547
 
554
-/**
555
- * Sends {@link CONFERENCE_TERMINATED} event when the {@link CONNECTION_FAILED}
556
- * occurs. It should be done only if the connection fails before the conference
557
- * instance is created. Otherwise the eventual failure event is supposed to be
558
- * emitted by the base/conference feature.
559
- *
560
- * @param {Store} store - The redux store.
561
- * @param {Action} action - The redux action.
562
- * @returns {void}
563
- */
564
-function _sendConferenceFailedOnConnectionError(store, action) {
565
-    const { locationURL } = store.getState()['features/base/connection'];
566
-    const { connection } = action;
567
-
568
-    locationURL
569
-        && forEachConference(
570
-            store,
571
-
572
-            // If there's any conference in the  base/conference state then the
573
-            // base/conference feature is supposed to emit a failure.
574
-            conference => conference.getConnection() !== connection)
575
-        && sendEvent(
576
-        store,
577
-        CONFERENCE_TERMINATED,
578
-        /* data */ {
579
-            url: _normalizeUrl(locationURL),
580
-            error: action.error.name
581
-        });
582
-}
583
-
584 548
 /**
585 549
  * Determines whether to not send a {@code CONFERENCE_LEFT} event to the native
586 550
  * counterpart of the External API.

+ 11
- 0
react/features/overlay/actionTypes.js Parādīt failu

@@ -36,3 +36,14 @@ export const TOGGLE_SLOW_GUM_OVERLAY = 'TOGGLE_SLOW_GUM_OVERLAY';
36 36
  * @public
37 37
  */
38 38
 export const SET_FATAL_ERROR = 'SET_FATAL_ERROR';
39
+
40
+/**
41
+ * The type of the Redux action which signals that the overlay was canceled.
42
+ *
43
+ * {
44
+ *     type: export const SET_PAGE_RELOAD_OVERLAY_CANCELED
45
+ * }
46
+ * @public
47
+ */
48
+export const SET_PAGE_RELOAD_OVERLAY_CANCELED
49
+    = 'SET_PAGE_RELOAD_OVERLAY_CANCELED';

+ 18
- 0
react/features/overlay/actions.js Parādīt failu

@@ -3,6 +3,7 @@
3 3
 import {
4 4
     MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
5 5
     SET_FATAL_ERROR,
6
+    SET_PAGE_RELOAD_OVERLAY_CANCELED,
6 7
     TOGGLE_SLOW_GUM_OVERLAY
7 8
 } from './actionTypes';
8 9
 
@@ -63,3 +64,20 @@ export function setFatalError(fatalError: Object) {
63 64
         fatalError
64 65
     };
65 66
 }
67
+
68
+/**
69
+ * The action indicates that the overlay was canceled.
70
+ *
71
+ * @param {Object} error - The error that caused the display of the overlay.
72
+ *
73
+ * @returns {{
74
+    *     type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
75
+    *     error: ?Error
76
+    * }}
77
+    */
78
+export function setPageReloadOverlayCanceled(error: Object) {
79
+    return {
80
+        type: SET_PAGE_RELOAD_OVERLAY_CANCELED,
81
+        error
82
+    };
83
+}

+ 7
- 0
react/features/overlay/components/AbstractPageReloadOverlay.js Parādīt failu

@@ -33,6 +33,11 @@ export type Props = {
33 33
 
34 34
     dispatch: Dispatch<any>,
35 35
 
36
+    /**
37
+     * The error that caused the display of the overlay.
38
+     */
39
+    error: Error,
40
+
36 41
     /**
37 42
      * The indicator which determines whether the reload was caused by network
38 43
      * failure.
@@ -273,6 +278,7 @@ export default class AbstractPageReloadOverlay<P: Props>
273 278
  * @protected
274 279
  * @returns {{
275 280
  *     details: Object,
281
+ *     error: ?Error,
276 282
  *     isNetworkFailure: boolean,
277 283
  *     reason: string
278 284
  * }}
@@ -284,6 +290,7 @@ export function abstractMapStateToProps(state: Object) {
284 290
 
285 291
     return {
286 292
         details: fatalError && fatalError.details,
293
+        error: fatalError,
287 294
         isNetworkFailure:
288 295
             fatalError === configError || fatalError === connectionError,
289 296
         reason: fatalError && (fatalError.message || fatalError.name)

+ 2
- 1
react/features/overlay/components/native/PageReloadOverlay.js Parādīt failu

@@ -9,7 +9,7 @@ import { ConfirmDialog } from '../../../base/dialog';
9 9
 import { translate } from '../../../base/i18n';
10 10
 import { connect } from '../../../base/redux';
11 11
 import { StyleType } from '../../../base/styles';
12
-import { setFatalError } from '../../actions';
12
+import { setFatalError, setPageReloadOverlayCanceled } from '../../actions';
13 13
 import AbstractPageReloadOverlay, {
14 14
     abstractMapStateToProps,
15 15
     type Props as AbstractProps
@@ -58,6 +58,7 @@ class PageReloadOverlay extends AbstractPageReloadOverlay<Props> {
58 58
      */
59 59
     _onCancel() {
60 60
         clearInterval(this._interval);
61
+        this.props.dispatch(setPageReloadOverlayCanceled(this.props.error));
61 62
         this.props.dispatch(setFatalError(undefined));
62 63
         this.props.dispatch(appNavigate(undefined));
63 64
     }

Notiek ielāde…
Atcelt
Saglabāt