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.

middleware.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // @flow
  2. import { CONFERENCE_FAILED } from '../base/conference';
  3. import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
  4. import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
  5. import { MiddlewareRegistry } from '../base/redux';
  6. import { SUBMIT_FEEDBACK } from '../feedback';
  7. import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
  8. declare var APP: Object;
  9. /**
  10. * The middleware of the feature {@code external-api}.
  11. *
  12. * @returns {Function}
  13. */
  14. MiddlewareRegistry.register((/* store */) => next => action => {
  15. switch (action.type) {
  16. case CONFERENCE_FAILED: {
  17. if (action.conference
  18. && action.error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
  19. APP.API.notifyOnPasswordRequired();
  20. }
  21. break;
  22. }
  23. case NOTIFY_CAMERA_ERROR:
  24. if (action.error) {
  25. APP.API.notifyOnCameraError(
  26. action.error.name, action.error.message);
  27. }
  28. break;
  29. case NOTIFY_MIC_ERROR:
  30. if (action.error) {
  31. APP.API.notifyOnMicError(action.error.name, action.error.message);
  32. }
  33. break;
  34. case SET_FILMSTRIP_VISIBLE:
  35. APP.API.notifyFilmstripDisplayChanged(action.visible);
  36. break;
  37. case SUBMIT_FEEDBACK:
  38. APP.API.notifyFeedbackSubmitted();
  39. break;
  40. }
  41. return next(action);
  42. });