瀏覽代碼

fix(auth/external API): CONFERENCE_FAILED with login dialog

Delay the CONFERENCE_FAILED event until the user cancels the login
dialog using the 'recoverable' event flag.
master
paweldomas 7 年之前
父節點
當前提交
36ecc99b5b

+ 22
- 4
react/features/authentication/actions.js 查看文件

2
 
2
 
3
 import { appNavigate } from '../app';
3
 import { appNavigate } from '../app';
4
 import { checkIfCanJoin, conferenceLeft } from '../base/conference';
4
 import { checkIfCanJoin, conferenceLeft } from '../base/conference';
5
+import { connectionFailed } from '../base/connection';
5
 import { openDialog } from '../base/dialog';
6
 import { openDialog } from '../base/dialog';
6
 
7
 
7
 import {
8
 import {
71
  * }}
72
  * }}
72
  */
73
  */
73
 export function cancelLogin() {
74
 export function cancelLogin() {
74
-    // FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify the
75
-    // external-api.
75
+    return (dispatch: Dispatch<*>, getState: Function) => {
76
+        dispatch({ type: CANCEL_LOGIN });
76
 
77
 
77
-    return {
78
-        type: CANCEL_LOGIN
78
+        // XXX The error associated with CONNECTION_FAILED was marked as
79
+        // recoverable by the authentication feature  and, consequently,
80
+        // recoverable-aware features such as mobile's external-api did not
81
+        // deliver the CONFERENCE_FAILED to the SDK clients/consumers (as
82
+        // a reaction to CONNECTION_FAILED). Since the
83
+        // app/user is going to navigate to WelcomePage, the SDK
84
+        // clients/consumers need an event.
85
+        const { error, passwordRequired }
86
+            = getState()['features/base/connection'];
87
+
88
+        passwordRequired
89
+            && dispatch(
90
+                connectionFailed(
91
+                    passwordRequired,
92
+                    error && error.name,
93
+                    error && error.message,
94
+                    error && error.credentials,
95
+                    error && error.details,
96
+                    /* recoverable */ false));
79
     };
97
     };
80
 }
98
 }
81
 
99
 

+ 6
- 3
react/features/authentication/middleware.js 查看文件

108
     case CONNECTION_FAILED: {
108
     case CONNECTION_FAILED: {
109
         const { error } = action;
109
         const { error } = action;
110
 
110
 
111
-        error
112
-            && error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
113
-            && store.dispatch(_openLoginDialog());
111
+        if (error
112
+                && error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
113
+                && typeof error.recoverable === 'undefined') {
114
+            error.recoverable = true;
115
+            store.dispatch(_openLoginDialog());
116
+        }
114
         break;
117
         break;
115
     }
118
     }
116
 
119
 

+ 6
- 2
react/features/base/connection/actions.native.js 查看文件

178
  * @param {Object} [credentials] - The invalid credentials that failed
178
  * @param {Object} [credentials] - The invalid credentials that failed
179
  * the authentication.
179
  * the authentication.
180
  * @param {Object} [details] - The details about the connection failed event.
180
  * @param {Object} [details] - The details about the connection failed event.
181
+ * @param {boolean} [recoverable] - Indicates whether this event is recoverable
182
+ * or not.
181
  * @public
183
  * @public
182
  * @returns {{
184
  * @returns {{
183
  *     type: CONNECTION_FAILED,
185
  *     type: CONNECTION_FAILED,
190
         error: string,
192
         error: string,
191
         message: ?string,
193
         message: ?string,
192
         credentials: ?Object,
194
         credentials: ?Object,
193
-        details: ?Object) {
195
+        details: ?Object,
196
+        recoverable: ?boolean) {
194
     return {
197
     return {
195
         type: CONNECTION_FAILED,
198
         type: CONNECTION_FAILED,
196
         connection,
199
         connection,
204
                     : undefined,
207
                     : undefined,
205
             message,
208
             message,
206
             name: error,
209
             name: error,
207
-            details
210
+            details,
211
+            recoverable
208
         }
212
         }
209
     };
213
     };
210
 }
214
 }

+ 14
- 5
react/features/base/connection/reducer.js 查看文件

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
 import { SET_ROOM } from '../conference';
3
 import { SET_ROOM } from '../conference';
4
-import { assign, set, ReducerRegistry } from '../redux';
4
+import { JitsiConnectionErrors } from '../lib-jitsi-meet';
5
+import { assign, ReducerRegistry } from '../redux';
5
 import { parseURIString } from '../util';
6
 import { parseURIString } from '../util';
6
 
7
 
7
 import {
8
 import {
80
     return assign(state, {
81
     return assign(state, {
81
         connecting: undefined,
82
         connecting: undefined,
82
         connection,
83
         connection,
83
-        error: undefined
84
+        error: undefined,
85
+        passwordRequired: undefined
84
     });
86
     });
85
 }
87
 }
86
 
88
 
113
     return assign(state, {
115
     return assign(state, {
114
         connecting: undefined,
116
         connecting: undefined,
115
         connection: undefined,
117
         connection: undefined,
116
-        error
118
+        error,
119
+        passwordRequired:
120
+            error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
121
+                ? connection : undefined
117
     });
122
     });
118
 }
123
 }
119
 
124
 
132
         { connection }: { connection: Object }) {
137
         { connection }: { connection: Object }) {
133
     return assign(state, {
138
     return assign(state, {
134
         connecting: connection,
139
         connecting: connection,
135
-        error: undefined
140
+        error: undefined,
141
+        passwordRequired: undefined
136
     });
142
     });
137
 }
143
 }
138
 
144
 
209
  * reduction of the specified action.
215
  * reduction of the specified action.
210
  */
216
  */
211
 function _setRoom(state: Object) {
217
 function _setRoom(state: Object) {
212
-    return set(state, 'error', undefined);
218
+    return assign(state, {
219
+        error: undefined,
220
+        passwordRequired: undefined
221
+    });
213
 }
222
 }

+ 2
- 1
react/features/mobile/external-api/middleware.js 查看文件

58
         break;
58
         break;
59
 
59
 
60
     case CONNECTION_FAILED:
60
     case CONNECTION_FAILED:
61
-        _sendConferenceFailedOnConnectionError(store, action);
61
+        !action.error.recoverable
62
+            && _sendConferenceFailedOnConnectionError(store, action);
62
         break;
63
         break;
63
 
64
 
64
     case ENTER_PICTURE_IN_PICTURE:
65
     case ENTER_PICTURE_IN_PICTURE:

Loading…
取消
儲存