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:
paweldomas
2018-05-04 13:02:19 +02:00
committed by Saúl Ibarra Corretgé
parent 82f5eb894b
commit 36ecc99b5b
5 changed files with 50 additions and 15 deletions
+22 -4
View File
@@ -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));
};
}
+6 -3
View File
@@ -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;
}