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 1002B

123456789101112131415161718192021222324252627282930313233343536
  1. import { SET_ROOM } from '../base/conference';
  2. import { SET_CONFIG } from '../base/config';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { initAnalytics, resetAnalytics } from './functions';
  5. /**
  6. * Middleware which intercepts config actions to handle evaluating analytics
  7. * config based on the config stored in the store.
  8. *
  9. * @param {Store} store - The redux store.
  10. * @returns {Function}
  11. */
  12. MiddlewareRegistry.register(store => next => action => {
  13. switch (action.type) {
  14. case SET_CONFIG: {
  15. if (navigator.product === 'ReactNative') {
  16. // Reseting the analytics is currently not needed for web because
  17. // the user will be redirected to another page and new instance of
  18. // Analytics will be created and initialized.
  19. resetAnalytics();
  20. }
  21. break;
  22. }
  23. case SET_ROOM: {
  24. const result = next(action);
  25. initAnalytics(store);
  26. return result;
  27. }
  28. }
  29. return next(action);
  30. });