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.ts 1.4KB

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