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.js 2.2KB

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