You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.native.ts 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { appNavigate } from '../app/actions';
  2. import { IStore } from '../app/types';
  3. import { conferenceLeft } from '../base/conference/actions';
  4. import { connectionFailed } from '../base/connection/actions.native';
  5. import { set } from '../base/redux/functions';
  6. import { CANCEL_LOGIN } from './actionTypes';
  7. import { stopWaitForOwner } from './actions.any';
  8. export * from './actions.any';
  9. /**
  10. * Cancels {@ink LoginDialog}.
  11. *
  12. * @returns {{
  13. * type: CANCEL_LOGIN
  14. * }}
  15. */
  16. export function cancelLogin() {
  17. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  18. dispatch({ type: CANCEL_LOGIN });
  19. // XXX The error associated with CONNECTION_FAILED was marked as
  20. // recoverable by the authentication feature and, consequently,
  21. // recoverable-aware features such as mobile's external-api did not
  22. // deliver the CONFERENCE_FAILED to the SDK clients/consumers (as
  23. // a reaction to CONNECTION_FAILED). Since the
  24. // app/user is going to navigate to WelcomePage, the SDK
  25. // clients/consumers need an event.
  26. const { error, passwordRequired }
  27. = getState()['features/base/connection'];
  28. passwordRequired
  29. && dispatch(
  30. connectionFailed(
  31. passwordRequired, // @ts-ignore
  32. set(error, 'recoverable', false) as any));
  33. };
  34. }
  35. /**
  36. * Cancels {@link WaitForOwnerDialog}. Will navigate back to the welcome page.
  37. *
  38. * @returns {Function}
  39. */
  40. export function cancelWaitForOwner() {
  41. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  42. dispatch(stopWaitForOwner());
  43. // XXX The error associated with CONFERENCE_FAILED was marked as
  44. // recoverable by the feature room-lock and, consequently,
  45. // recoverable-aware features such as mobile's external-api did not
  46. // deliver the CONFERENCE_FAILED to the SDK clients/consumers. Since the
  47. // app/user is going to nativate to WelcomePage, the SDK
  48. // clients/consumers need an event.
  49. const { authRequired } = getState()['features/base/conference'];
  50. authRequired && dispatch(conferenceLeft(authRequired));
  51. dispatch(appNavigate(undefined));
  52. };
  53. }