Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(tile-view): disable tile view on pin, unpin all on view enter

Leonard Kim29bc18df01c8
diff --git a/react/features/video-layout/middleware.any.js b/react/features/video-layout/middleware.any.js
new file mode 100644
index 0000000000..5c6689b968
--- /dev/null
+++ b/react/features/video-layout/middleware.any.js
@@ -0,0 +1,39 @@
+import {
+ PIN_PARTICIPANT,
+ getPinnedParticipant,
+ pinParticipant
+} from '../base/participants';
+import { MiddlewareRegistry } from '../base/redux';
+
+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_TILE_VIEW:
+ if (getPinnedParticipant(store.getState()) && action.enabled) {
+ store.dispatch(pinParticipant(null));
+ }
+
+ break;
+ }
+
+ return next(action);
+});
diff --git a/react/features/video-layout/middleware.native.js b/react/features/video-layout/middleware.native.js
index e69de29bb2..fefd329e8a 100644
--- a/react/features/video-layout/middleware.native.js
+++ b/react/features/video-layout/middleware.native.js
@@ -0,0 +1 @@
+import './middleware.any';
diff --git a/react/features/video-layout/middleware.web.js b/react/features/video-layout/middleware.web.js
index a6002fab33..3cec16f59b 100644
--- a/react/features/video-layout/middleware.web.js
+++ b/react/features/video-layout/middleware.web.js
@@ -17,6 +17,7 @@ import { TRACK_ADDED } from '../base/tracks';
import { SET_FILMSTRIP_VISIBLE } from '../filmstrip';
import { SET_TILE_VIEW } from './actionTypes';
+import './middleware.any';
declare var APP: Object;