From 417e1e83e7bc1566795da3a21ab618eac6b3712a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 1 Feb 2018 15:22:27 +0100 Subject: [PATCH] [RN] Unpin participant and set last N to 1 if the filmstrip is disabled --- react/features/filmstrip/middleware.js | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/react/features/filmstrip/middleware.js b/react/features/filmstrip/middleware.js index df29c82c9..0c2c85cca 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);