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.tsx 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import React from 'react';
  2. import { AnyAction } from 'redux';
  3. import { IStore } from '../app/types';
  4. import { APP_WILL_MOUNT } from '../base/app/actionTypes';
  5. import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
  6. import { showErrorNotification } from '../notifications/actions';
  7. import OldElectronAPPNotificationDescription from './components/OldElectronAPPNotificationDescription';
  8. import { isOldJitsiMeetElectronApp } from './functions';
  9. MiddlewareRegistry.register(store => next => action => {
  10. switch (action.type) {
  11. case APP_WILL_MOUNT:
  12. return _appWillMount(store, next, action);
  13. }
  14. return next(action);
  15. });
  16. /**
  17. * Notifies the feature that the action {@link APP_WILL_MOUNT} has being dispatched.
  18. *
  19. * @param {Store} store - The redux store in which the specified {@code action} is being dispatched.
  20. * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the specified {@code action}.
  21. * @param {Action} action - The redux action {@code APP_WILL_MOUNT} which is being dispatched.
  22. * @private
  23. * @returns {Object} The new state that is the result of the reduction of the specified {@code action}.
  24. */
  25. function _appWillMount(store: IStore, next: Function, action: AnyAction) {
  26. if (isOldJitsiMeetElectronApp()) {
  27. const { dispatch } = store;
  28. dispatch(showErrorNotification({
  29. titleKey: 'notify.OldElectronAPPTitle',
  30. description: <OldElectronAPPNotificationDescription />
  31. }));
  32. }
  33. return next(action);
  34. }