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.
This commit is contained in:
parent
82f5eb894b
commit
36ecc99b5b
|
@ -2,6 +2,7 @@
|
|||
|
||||
import { appNavigate } from '../app';
|
||||
import { checkIfCanJoin, conferenceLeft } from '../base/conference';
|
||||
import { connectionFailed } from '../base/connection';
|
||||
import { openDialog } from '../base/dialog';
|
||||
|
||||
import {
|
||||
|
@ -71,11 +72,28 @@ export function authenticateAndUpgradeRole(
|
|||
* }}
|
||||
*/
|
||||
export function cancelLogin() {
|
||||
// FIXME Like cancelWaitForOwner, dispatch conferenceLeft to notify the
|
||||
// external-api.
|
||||
return (dispatch: Dispatch<*>, getState: Function) => {
|
||||
dispatch({ type: CANCEL_LOGIN });
|
||||
|
||||
return {
|
||||
type: CANCEL_LOGIN
|
||||
// XXX The error associated with CONNECTION_FAILED was marked as
|
||||
// recoverable by the authentication feature and, consequently,
|
||||
// recoverable-aware features such as mobile's external-api did not
|
||||
// deliver the CONFERENCE_FAILED to the SDK clients/consumers (as
|
||||
// a reaction to CONNECTION_FAILED). Since the
|
||||
// app/user is going to navigate to WelcomePage, the SDK
|
||||
// clients/consumers need an event.
|
||||
const { error, passwordRequired }
|
||||
= getState()['features/base/connection'];
|
||||
|
||||
passwordRequired
|
||||
&& dispatch(
|
||||
connectionFailed(
|
||||
passwordRequired,
|
||||
error && error.name,
|
||||
error && error.message,
|
||||
error && error.credentials,
|
||||
error && error.details,
|
||||
/* recoverable */ false));
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -108,9 +108,12 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
case CONNECTION_FAILED: {
|
||||
const { error } = action;
|
||||
|
||||
error
|
||||
&& error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
|
||||
&& store.dispatch(_openLoginDialog());
|
||||
if (error
|
||||
&& error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
|
||||
&& typeof error.recoverable === 'undefined') {
|
||||
error.recoverable = true;
|
||||
store.dispatch(_openLoginDialog());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,6 +178,8 @@ export function connectionEstablished(connection: Object) {
|
|||
* @param {Object} [credentials] - The invalid credentials that failed
|
||||
* the authentication.
|
||||
* @param {Object} [details] - The details about the connection failed event.
|
||||
* @param {boolean} [recoverable] - Indicates whether this event is recoverable
|
||||
* or not.
|
||||
* @public
|
||||
* @returns {{
|
||||
* type: CONNECTION_FAILED,
|
||||
|
@ -190,7 +192,8 @@ export function connectionFailed(
|
|||
error: string,
|
||||
message: ?string,
|
||||
credentials: ?Object,
|
||||
details: ?Object) {
|
||||
details: ?Object,
|
||||
recoverable: ?boolean) {
|
||||
return {
|
||||
type: CONNECTION_FAILED,
|
||||
connection,
|
||||
|
@ -204,7 +207,8 @@ export function connectionFailed(
|
|||
: undefined,
|
||||
message,
|
||||
name: error,
|
||||
details
|
||||
details,
|
||||
recoverable
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/* @flow */
|
||||
|
||||
import { SET_ROOM } from '../conference';
|
||||
import { assign, set, ReducerRegistry } from '../redux';
|
||||
import { JitsiConnectionErrors } from '../lib-jitsi-meet';
|
||||
import { assign, ReducerRegistry } from '../redux';
|
||||
import { parseURIString } from '../util';
|
||||
|
||||
import {
|
||||
|
@ -80,7 +81,8 @@ function _connectionEstablished(
|
|||
return assign(state, {
|
||||
connecting: undefined,
|
||||
connection,
|
||||
error: undefined
|
||||
error: undefined,
|
||||
passwordRequired: undefined
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -113,7 +115,10 @@ function _connectionFailed(
|
|||
return assign(state, {
|
||||
connecting: undefined,
|
||||
connection: undefined,
|
||||
error
|
||||
error,
|
||||
passwordRequired:
|
||||
error.name === JitsiConnectionErrors.PASSWORD_REQUIRED
|
||||
? connection : undefined
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -132,7 +137,8 @@ function _connectionWillConnect(
|
|||
{ connection }: { connection: Object }) {
|
||||
return assign(state, {
|
||||
connecting: connection,
|
||||
error: undefined
|
||||
error: undefined,
|
||||
passwordRequired: undefined
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -209,5 +215,8 @@ function _setLocationURL(
|
|||
* reduction of the specified action.
|
||||
*/
|
||||
function _setRoom(state: Object) {
|
||||
return set(state, 'error', undefined);
|
||||
return assign(state, {
|
||||
error: undefined,
|
||||
passwordRequired: undefined
|
||||
});
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ MiddlewareRegistry.register(store => next => action => {
|
|||
break;
|
||||
|
||||
case CONNECTION_FAILED:
|
||||
_sendConferenceFailedOnConnectionError(store, action);
|
||||
!action.error.recoverable
|
||||
&& _sendConferenceFailedOnConnectionError(store, action);
|
||||
break;
|
||||
|
||||
case ENTER_PICTURE_IN_PICTURE:
|
||||
|
|
Loading…
Reference in New Issue