fix(modal) remove dead code

This commit is contained in:
Saúl Ibarra Corretgé 2021-12-01 14:04:13 +01:00 committed by Saúl Ibarra Corretgé
parent 0be0d6a76e
commit 7a479b967c
7 changed files with 2 additions and 68 deletions

View File

@ -16,7 +16,6 @@ import '../base/lastn/reducer';
import '../base/lib-jitsi-meet/reducer'; import '../base/lib-jitsi-meet/reducer';
import '../base/logging/reducer'; import '../base/logging/reducer';
import '../base/media/reducer'; import '../base/media/reducer';
import '../base/modal/reducer';
import '../base/net-info/reducer'; import '../base/net-info/reducer';
import '../base/participants/reducer'; import '../base/participants/reducer';
import '../base/responsive-ui/reducer'; import '../base/responsive-ui/reducer';

View File

@ -1,6 +0,0 @@
// @flow
/**
* Action type to set the ID of the active modal (or undefined if needs to be hidden).
*/
export const SET_ACTIVE_MODAL_ID = 'SET_ACTIVE_MODAL_ID';

View File

@ -1,21 +0,0 @@
// @flow
import { SET_ACTIVE_MODAL_ID } from './actionTypes';
/**
* Action to set the ID of the active modal (or undefined if needs to be hidden).
*
* @param {string} activeModalId - The new modal ID or undefined.
* @param {Object} modalProps - The props to pass to the modal.
* @returns {{
* activeModalId: string,
* type: SET_ACTIVE_MODAL_ID
* }}
*/
export function setActiveModalId(activeModalId: ?string, modalProps: Object = {}) {
return {
activeModalId,
modalProps,
type: SET_ACTIVE_MODAL_ID
};
}

View File

@ -1,4 +0,0 @@
// @flow
export * from './actions';
export * from './actionTypes';

View File

@ -1,18 +0,0 @@
// @flow
import { ReducerRegistry } from '../redux';
import { SET_ACTIVE_MODAL_ID } from './actionTypes';
ReducerRegistry.register('features/base/modal', (state = {}, action) => {
switch (action.type) {
case SET_ACTIVE_MODAL_ID:
return {
...state,
activeModalId: action.activeModalId,
modalProps: action.modalProps
};
}
return state;
});

View File

@ -7,7 +7,6 @@ import {
getCurrentConference getCurrentConference
} from '../base/conference'; } from '../base/conference';
import { hideDialog, isDialogOpen } from '../base/dialog'; import { hideDialog, isDialogOpen } from '../base/dialog';
import { setActiveModalId } from '../base/modal';
import { pinParticipant } from '../base/participants'; import { pinParticipant } from '../base/participants';
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux'; import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
import { SET_REDUCED_UI } from '../base/responsive-ui'; import { SET_REDUCED_UI } from '../base/responsive-ui';
@ -79,8 +78,5 @@ StateListenerRegistry.register(
// dialog we might have open. // dialog we might have open.
dispatch(hideDialog()); dispatch(hideDialog());
} }
// We want to close all modals.
dispatch(setActiveModalId());
} }
}); });

View File

@ -2,12 +2,10 @@
import UIEvents from '../../../service/UI/UIEvents'; import UIEvents from '../../../service/UI/UIEvents';
import { getCurrentConference } from '../base/conference'; import { getCurrentConference } from '../base/conference';
import { setActiveModalId } from '../base/modal';
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux'; import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
import { TOGGLE_DOCUMENT_EDITING } from './actionTypes'; import { TOGGLE_DOCUMENT_EDITING } from './actionTypes';
import { setDocumentEditingState, setDocumentUrl } from './actions'; import { setDocumentUrl } from './actions';
import { SHARE_DOCUMENT_VIEW_ID } from './constants';
declare var APP: Object; declare var APP: Object;
@ -24,17 +22,7 @@ const ETHERPAD_COMMAND = 'etherpad';
MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
switch (action.type) { switch (action.type) {
case TOGGLE_DOCUMENT_EDITING: { case TOGGLE_DOCUMENT_EDITING: {
if (typeof APP === 'undefined') { if (typeof APP !== 'undefined') {
const editing = !getState()['features/etherpad'].editing;
dispatch(setDocumentEditingState(editing));
if (editing) {
dispatch(setActiveModalId(SHARE_DOCUMENT_VIEW_ID));
} else if (getState()['features/base/modal'].activeModalId === SHARE_DOCUMENT_VIEW_ID) {
dispatch(setActiveModalId(undefined));
}
} else {
APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED); APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED);
} }
break; break;