Sfoglia il codice sorgente

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

master
tmoldovan8x8 3 anni fa
parent
commit
243aa20912
Nessun account collegato all'indirizzo email del committer

+ 16
- 52
react/features/mobile/external-api/middleware.js Vedi File

17
     getCurrentConference,
17
     getCurrentConference,
18
     isRoomValid
18
     isRoomValid
19
 } from '../../base/conference';
19
 } from '../../base/conference';
20
-import { LOAD_CONFIG_ERROR } from '../../base/config';
21
 import {
20
 import {
22
     CONNECTION_DISCONNECTED,
21
     CONNECTION_DISCONNECTED,
23
-    CONNECTION_FAILED,
24
     JITSI_CONNECTION_CONFERENCE_KEY,
22
     JITSI_CONNECTION_CONFERENCE_KEY,
25
     JITSI_CONNECTION_URL_KEY,
23
     JITSI_CONNECTION_URL_KEY,
26
     getURLWithoutParams
24
     getURLWithoutParams
27
 } from '../../base/connection';
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
 import { MEDIA_TYPE } from '../../base/media';
30
 import { MEDIA_TYPE } from '../../base/media';
30
 import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
31
 import { SET_AUDIO_MUTED, SET_VIDEO_MUTED } from '../../base/media/actionTypes';
31
 import {
32
 import {
40
 import { OPEN_CHAT, CLOSE_CHAT } from '../../chat';
41
 import { OPEN_CHAT, CLOSE_CHAT } from '../../chat';
41
 import { openChat } from '../../chat/actions';
42
 import { openChat } from '../../chat/actions';
42
 import { sendMessage, setPrivateMessageRecipient, closeChat } from '../../chat/actions.any';
43
 import { sendMessage, setPrivateMessageRecipient, closeChat } from '../../chat/actions.any';
44
+import { SET_PAGE_RELOAD_OVERLAY_CANCELED } from '../../overlay/actionTypes';
43
 import { muteLocal } from '../../video-menu/actions';
45
 import { muteLocal } from '../../video-menu/actions';
44
 import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
46
 import { ENTER_PICTURE_IN_PICTURE } from '../picture-in-picture';
45
 
47
 
114
         // counterpart of the External API (or at least not in the
116
         // counterpart of the External API (or at least not in the
115
         // fatality/finality semantics attributed to
117
         // fatality/finality semantics attributed to
116
         // conferenceFailed:/onConferenceFailed).
118
         // conferenceFailed:/onConferenceFailed).
117
-        if (!error.recoverable) {
119
+        if (!error.recoverable && !isFatalJitsiConnectionError(error) && !isFatalJitsiConferenceError(error)) {
118
             _sendConferenceEvent(store, /* action */ {
120
             _sendConferenceEvent(store, /* action */ {
119
                 error: _toErrorString(error),
121
                 error: _toErrorString(error),
120
                 ...data
122
                 ...data
154
         break;
156
         break;
155
     }
157
     }
156
 
158
 
157
-    case CONNECTION_FAILED:
158
-        !action.error.recoverable
159
-            && _sendConferenceFailedOnConnectionError(store, action);
160
-        break;
161
-
162
     case ENTER_PICTURE_IN_PICTURE:
159
     case ENTER_PICTURE_IN_PICTURE:
163
         sendEvent(store, type, /* data */ {});
160
         sendEvent(store, type, /* data */ {});
164
         break;
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
     case OPEN_CHAT:
163
     case OPEN_CHAT:
180
     case CLOSE_CHAT: {
164
     case CLOSE_CHAT: {
181
         sendEvent(
165
         sendEvent(
219
             });
203
             });
220
         break;
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
     case SET_VIDEO_MUTED:
216
     case SET_VIDEO_MUTED:
223
         sendEvent(
217
         sendEvent(
224
             store,
218
             store,
551
     sendEvent(store, type_, data);
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
  * Determines whether to not send a {@code CONFERENCE_LEFT} event to the native
549
  * Determines whether to not send a {@code CONFERENCE_LEFT} event to the native
586
  * counterpart of the External API.
550
  * counterpart of the External API.

+ 11
- 0
react/features/overlay/actionTypes.js Vedi File

36
  * @public
36
  * @public
37
  */
37
  */
38
 export const SET_FATAL_ERROR = 'SET_FATAL_ERROR';
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 Vedi File

3
 import {
3
 import {
4
     MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
4
     MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
5
     SET_FATAL_ERROR,
5
     SET_FATAL_ERROR,
6
+    SET_PAGE_RELOAD_OVERLAY_CANCELED,
6
     TOGGLE_SLOW_GUM_OVERLAY
7
     TOGGLE_SLOW_GUM_OVERLAY
7
 } from './actionTypes';
8
 } from './actionTypes';
8
 
9
 
63
         fatalError
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 Vedi File

33
 
33
 
34
     dispatch: Dispatch<any>,
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
      * The indicator which determines whether the reload was caused by network
42
      * The indicator which determines whether the reload was caused by network
38
      * failure.
43
      * failure.
273
  * @protected
278
  * @protected
274
  * @returns {{
279
  * @returns {{
275
  *     details: Object,
280
  *     details: Object,
281
+ *     error: ?Error,
276
  *     isNetworkFailure: boolean,
282
  *     isNetworkFailure: boolean,
277
  *     reason: string
283
  *     reason: string
278
  * }}
284
  * }}
284
 
290
 
285
     return {
291
     return {
286
         details: fatalError && fatalError.details,
292
         details: fatalError && fatalError.details,
293
+        error: fatalError,
287
         isNetworkFailure:
294
         isNetworkFailure:
288
             fatalError === configError || fatalError === connectionError,
295
             fatalError === configError || fatalError === connectionError,
289
         reason: fatalError && (fatalError.message || fatalError.name)
296
         reason: fatalError && (fatalError.message || fatalError.name)

+ 2
- 1
react/features/overlay/components/native/PageReloadOverlay.js Vedi File

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

Loading…
Annulla
Salva