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

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