jiti-meet/react/features/authentication/actions.native.ts

65 lines
2.2 KiB
TypeScript
Raw Normal View History

import { appNavigate } from '../app/actions';
import { IStore } from '../app/types';
import { conferenceLeft } from '../base/conference/actions';
import { connectionFailed } from '../base/connection/actions.native';
import { set } from '../base/redux/functions';
2017-09-18 07:09:43 +00:00
import { CANCEL_LOGIN } from './actionTypes';
import { stopWaitForOwner } from './actions.any';
2017-09-18 07:09:43 +00:00
export * from './actions.any';
2017-09-08 13:36:42 +00:00
/**
* Cancels {@ink LoginDialog}.
*
* @returns {{
2017-09-18 07:09:43 +00:00
* type: CANCEL_LOGIN
2017-09-08 13:36:42 +00:00
* }}
*/
export function cancelLogin() {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
dispatch({ 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, // @ts-ignore
set(error, 'recoverable', false) as any));
2017-09-08 13:36:42 +00:00
};
}
/**
* Cancels {@link WaitForOwnerDialog}. Will navigate back to the welcome page.
*
2017-10-06 20:15:51 +00:00
* @returns {Function}
2017-09-08 13:36:42 +00:00
*/
export function cancelWaitForOwner() {
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
2017-10-06 20:15:51 +00:00
dispatch(stopWaitForOwner());
// XXX The error associated with CONFERENCE_FAILED was marked as
// recoverable by the feature room-lock and, consequently,
// recoverable-aware features such as mobile's external-api did not
// deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since the
// app/user is going to nativate to WelcomePage, the SDK
// clients/consumers need an event.
const { authRequired } = getState()['features/base/conference'];
authRequired && dispatch(conferenceLeft(authRequired));
2017-10-06 20:15:51 +00:00
dispatch(appNavigate(undefined));
2017-09-08 13:36:42 +00:00
};
}