Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

middleware.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // @flow
  2. import React from 'react';
  3. import { APP_WILL_MOUNT } from '../base/app';
  4. import { MiddlewareRegistry } from '../base/redux';
  5. import { showErrorNotification } from '../notifications';
  6. import { OldElectronAPPNotificationDescription } from './components';
  7. import { isOldJitsiMeetElectronApp } from './functions';
  8. declare var interfaceConfig: Object;
  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, next, action) {
  26. if (isOldJitsiMeetElectronApp()) {
  27. const { dispatch } = store;
  28. dispatch(showErrorNotification({
  29. titleKey: 'notify.OldElectronAPPTitle',
  30. description: <OldElectronAPPNotificationDescription />
  31. }));
  32. }
  33. return next(action);
  34. }