Merge pull request #3636 from virtuacoplenny/lenny/tile-view-toggles-some-features
Tile view toggles some features and some features toggle tile view
This commit is contained in:
commit
05b7e6facc
|
@ -0,0 +1,56 @@
|
||||||
|
import {
|
||||||
|
PIN_PARTICIPANT,
|
||||||
|
getPinnedParticipant,
|
||||||
|
pinParticipant
|
||||||
|
} from '../base/participants';
|
||||||
|
import { MiddlewareRegistry } from '../base/redux';
|
||||||
|
import { SET_DOCUMENT_EDITING_STATUS, toggleDocument } from '../etherpad';
|
||||||
|
|
||||||
|
import { SET_TILE_VIEW } from './actionTypes';
|
||||||
|
import { setTileView } from './actions';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Middleware which intercepts actions and updates tile view related state.
|
||||||
|
*
|
||||||
|
* @param {Store} store - The redux store.
|
||||||
|
* @returns {Function}
|
||||||
|
*/
|
||||||
|
MiddlewareRegistry.register(store => next => action => {
|
||||||
|
switch (action.type) {
|
||||||
|
case PIN_PARTICIPANT: {
|
||||||
|
const isPinning = Boolean(action.participant.id);
|
||||||
|
const { tileViewEnabled } = store.getState()['features/video-layout'];
|
||||||
|
|
||||||
|
if (isPinning && tileViewEnabled) {
|
||||||
|
store.dispatch(setTileView(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case SET_DOCUMENT_EDITING_STATUS:
|
||||||
|
if (action.editing) {
|
||||||
|
store.dispatch(setTileView(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SET_TILE_VIEW: {
|
||||||
|
const state = store.getState();
|
||||||
|
|
||||||
|
if (action.enabled) {
|
||||||
|
if (getPinnedParticipant(state)) {
|
||||||
|
store.dispatch(pinParticipant(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state['features/etherpad'].editing) {
|
||||||
|
store.dispatch(toggleDocument());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return next(action);
|
||||||
|
});
|
|
@ -0,0 +1 @@
|
||||||
|
import './middleware.any';
|
|
@ -17,6 +17,7 @@ import { TRACK_ADDED } from '../base/tracks';
|
||||||
import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
|
import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
|
||||||
|
|
||||||
import { SET_TILE_VIEW } from './actionTypes';
|
import { SET_TILE_VIEW } from './actionTypes';
|
||||||
|
import './middleware.any';
|
||||||
|
|
||||||
declare var APP: Object;
|
declare var APP: Object;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue