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

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