2020-04-09 00:41:32 +00:00
|
|
|
import React from 'react';
|
2022-11-23 09:12:26 +00:00
|
|
|
import { AnyAction } from 'redux';
|
2020-04-09 00:41:32 +00:00
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
import { IStore } from '../app/types';
|
|
|
|
import { APP_WILL_MOUNT } from '../base/app/actionTypes';
|
|
|
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
|
|
|
import { showErrorNotification } from '../notifications/actions';
|
|
|
|
import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';
|
2020-04-09 00:41:32 +00:00
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
// @ts-ignore
|
2020-04-09 00:41:32 +00:00
|
|
|
import { OldElectronAPPNotificationDescription } from './components';
|
2020-05-20 10:57:03 +00:00
|
|
|
import { isOldJitsiMeetElectronApp } from './functions';
|
2020-04-09 00:41:32 +00:00
|
|
|
|
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
switch (action.type) {
|
|
|
|
case APP_WILL_MOUNT:
|
|
|
|
return _appWillMount(store, next, action);
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Notifies the feature that the action {@link APP_WILL_MOUNT} has being dispatched.
|
|
|
|
*
|
|
|
|
* @param {Store} store - The redux store in which the specified {@code action} is being dispatched.
|
|
|
|
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the specified {@code action}.
|
|
|
|
* @param {Action} action - The redux action {@code APP_WILL_MOUNT} which is being dispatched.
|
|
|
|
* @private
|
|
|
|
* @returns {Object} The new state that is the result of the reduction of the specified {@code action}.
|
|
|
|
*/
|
2022-11-23 09:12:26 +00:00
|
|
|
function _appWillMount(store: IStore, next: Function, action: AnyAction) {
|
2020-04-09 00:41:32 +00:00
|
|
|
if (isOldJitsiMeetElectronApp()) {
|
|
|
|
const { dispatch } = store;
|
|
|
|
|
|
|
|
dispatch(showErrorNotification({
|
|
|
|
titleKey: 'notify.OldElectronAPPTitle',
|
|
|
|
description: <OldElectronAPPNotificationDescription />
|
2021-11-24 11:05:27 +00:00
|
|
|
}, NOTIFICATION_TIMEOUT_TYPE.LONG));
|
2020-04-09 00:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|