Skip to content

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

[RN] Unpin participant and set last N to 1 if the filmstrip is disabled

Saúl Ibarra Corretgé417e1e83e7bc
diff --git a/react/features/filmstrip/middleware.js b/react/features/filmstrip/middleware.js
index df29c82c9b..0c2c85cca9 100644
--- a/react/features/filmstrip/middleware.js
+++ b/react/features/filmstrip/middleware.js
@@ -1,14 +1,17 @@
-/* @flow */
+// @flow
-import { MiddlewareRegistry } from '../base/redux';
+import { setLastN } from '../base/conference';
import { SET_CALLEE_INFO_VISIBLE } from '../base/jwt';
+import { pinParticipant } from '../base/participants';
+import { MiddlewareRegistry } from '../base/redux';
import Filmstrip from '../../../modules/UI/videolayout/Filmstrip';
+import { SET_FILMSTRIP_ENABLED } from './actionTypes';
+
declare var APP: Object;
-// eslint-disable-next-line no-unused-vars
-MiddlewareRegistry.register(({ getState }) => next => action => {
+MiddlewareRegistry.register(({ dispatch, getState }) => next => action => {
switch (action.type) {
case SET_CALLEE_INFO_VISIBLE:
if (typeof APP !== 'undefined') {
@@ -31,6 +34,20 @@ MiddlewareRegistry.register(({ getState }) => next => action => {
return result;
}
break;
+
+ case SET_FILMSTRIP_ENABLED:
+ // FIXME: Only do this on mobile for now. The logic for participant
+ // pinning / unpinning is not on React yet so dispatching the action
+ // is not enough.
+ if (typeof APP === 'undefined') {
+ const { audioOnly } = getState()['features/base/conference'];
+ const { enabled } = action;
+
+ !enabled && dispatch(pinParticipant(null));
+ !audioOnly && dispatch(setLastN(enabled ? undefined : 1));
+ }
+ break;
+
}
return next(action);