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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { IStore } from '../../app/types';
  2. import { configureInitialDevices } from '../devices/actions';
  3. import { getBackendSafeRoomName } from '../util/uri';
  4. declare const APP: any;
  5. export {
  6. connectionDisconnected,
  7. connectionEstablished,
  8. connectionFailed,
  9. setLocationURL
  10. } from './actions.native';
  11. import logger from './logger';
  12. export * from './actions.any';
  13. /**
  14. * Opens new connection.
  15. *
  16. * @returns {Promise<JitsiConnection>}
  17. */
  18. export function connect() {
  19. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  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: 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 = 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. }