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.web.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. declare var APP: Object;
  4. declare var config: Object;
  5. import { configureInitialDevices } from '../devices';
  6. import { getBackendSafeRoomName } from '../util';
  7. export {
  8. connectionDisconnected,
  9. connectionEstablished,
  10. connectionFailed,
  11. setLocationURL
  12. } from './actions.native';
  13. import logger from './logger';
  14. export * from './actions.any';
  15. /**
  16. * Opens new connection.
  17. *
  18. * @returns {Promise<JitsiConnection>}
  19. */
  20. export function connect() {
  21. return (dispatch: Dispatch<any>, getState: Function) => {
  22. const room = getBackendSafeRoomName(getState()['features/base/conference'].room);
  23. // XXX For web based version we use conference initialization logic
  24. // from the old app (at the moment of writing).
  25. return dispatch(configureInitialDevices()).then(
  26. () => APP.conference.init({
  27. roomName: room
  28. }).catch(error => {
  29. APP.API.notifyConferenceLeft(APP.conference.roomName);
  30. logger.error(error);
  31. }));
  32. };
  33. }
  34. /**
  35. * Closes connection.
  36. *
  37. * @param {boolean} [requestFeedback] - Whether or not to attempt showing a
  38. * request for call feedback.
  39. * @returns {Function}
  40. */
  41. export function disconnect(requestFeedback: boolean = false) {
  42. // XXX For web based version we use conference hanging up logic from the old
  43. // app.
  44. return () => APP.conference.hangup(requestFeedback);
  45. }