瀏覽代碼

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,6 +2,7 @@
2 2
 
3 3
 import { appNavigate } from '../app';
4 4
 import { checkIfCanJoin, conferenceLeft } from '../base/conference';
5
+import { connectionFailed } from '../base/connection';
5 6
 import { openDialog } from '../base/dialog';
6 7
 
7 8
 import {
@@ -71,11 +72,28 @@ export function authenticateAndUpgradeRole(
71 72
  * }}
72 73
  */
73 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,9 +108,12 @@ MiddlewareRegistry.register(store => next => action => {
108 108
     case CONNECTION_FAILED: {
109 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 117
         break;
115 118
     }
116 119
 

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

@@ -178,6 +178,8 @@ export function connectionEstablished(connection: Object) {
178 178
  * @param {Object} [credentials] - The invalid credentials that failed
179 179
  * the authentication.
180 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 183
  * @public
182 184
  * @returns {{
183 185
  *     type: CONNECTION_FAILED,
@@ -190,7 +192,8 @@ export function connectionFailed(
190 192
         error: string,
191 193
         message: ?string,
192 194
         credentials: ?Object,
193
-        details: ?Object) {
195
+        details: ?Object,
196
+        recoverable: ?boolean) {
194 197
     return {
195 198
         type: CONNECTION_FAILED,
196 199
         connection,
@@ -204,7 +207,8 @@ export function connectionFailed(
204 207
                     : undefined,
205 208
             message,
206 209
             name: error,
207
-            details
210
+            details,
211
+            recoverable
208 212
         }
209 213
     };
210 214
 }

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

@@ -1,7 +1,8 @@
1 1
 /* @flow */
2 2
 
3 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 6
 import { parseURIString } from '../util';
6 7
 
7 8
 import {
@@ -80,7 +81,8 @@ function _connectionEstablished(
80 81
     return assign(state, {
81 82
         connecting: undefined,
82 83
         connection,
83
-        error: undefined
84
+        error: undefined,
85
+        passwordRequired: undefined
84 86
     });
85 87
 }
86 88
 
@@ -113,7 +115,10 @@ function _connectionFailed(
113 115
     return assign(state, {
114 116
         connecting: undefined,
115 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,7 +137,8 @@ function _connectionWillConnect(
132 137
         { connection }: { connection: Object }) {
133 138
     return assign(state, {
134 139
         connecting: connection,
135
-        error: undefined
140
+        error: undefined,
141
+        passwordRequired: undefined
136 142
     });
137 143
 }
138 144
 
@@ -209,5 +215,8 @@ function _setLocationURL(
209 215
  * reduction of the specified action.
210 216
  */
211 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,7 +58,8 @@ MiddlewareRegistry.register(store => next => action => {
58 58
         break;
59 59
 
60 60
     case CONNECTION_FAILED:
61
-        _sendConferenceFailedOnConnectionError(store, action);
61
+        !action.error.recoverable
62
+            && _sendConferenceFailedOnConnectionError(store, action);
62 63
         break;
63 64
 
64 65
     case ENTER_PICTURE_IN_PICTURE:

Loading…
取消
儲存