From 2e8a635373dc2c794c09cce55355abb70ae38235 Mon Sep 17 00:00:00 2001 From: Mihaela Dumitru Date: Tue, 1 Feb 2022 12:45:54 +0200 Subject: [PATCH] feat(external-api) add commands to open/close the participants pane --- modules/API/API.js | 16 +++++++++++++++- modules/API/external/external_api.js | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/API/API.js b/modules/API/API.js index 2d2ebd7ed..d7669cf4a 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -73,7 +73,11 @@ import { resizeLargeVideo } from '../../react/features/large-video/actions.web'; import { toggleLobbyMode, setKnockingParticipantApproval } from '../../react/features/lobby/actions'; -import { isForceMuted } from '../../react/features/participants-pane/functions'; +import { + close as closeParticipantsPane, + open as openParticipantsPane +} from '../../react/features/participants-pane/actions'; +import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions'; import { RECORDING_TYPES } from '../../react/features/recording/constants'; import { getActiveSession } from '../../react/features/recording/functions'; import { isScreenAudioSupported } from '../../react/features/screen-share'; @@ -317,6 +321,12 @@ function initCommands() { APP.store.dispatch(disable()); } }, + 'toggle-participants-pane': enabled => { + const toggleParticipantsPane = enabled + ? openParticipantsPane : closeParticipantsPane; + + APP.store.dispatch(toggleParticipantsPane()); + }, 'toggle-raise-hand': () => { const localParticipant = getLocalParticipant(APP.store.getState()); @@ -690,6 +700,10 @@ function initCommands() { callback(isForceMuted(participant, type, state)); break; } + case 'is-participants-pane-open': { + callback(getParticipantsPaneOpen(APP.store.getState())); + break; + } case 'is-video-muted': callback(APP.conference.isLocalVideoMuted()); break; diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index 4714dafd1..46a62368d 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -74,6 +74,7 @@ const commands = { toggleE2EE: 'toggle-e2ee', toggleFilmStrip: 'toggle-film-strip', toggleModeration: 'toggle-moderation', + toggleParticipantsPane: 'toggle-participants-pane', toggleRaiseHand: 'toggle-raise-hand', toggleShareAudio: 'toggle-share-audio', toggleShareScreen: 'toggle-share-screen', @@ -946,6 +947,18 @@ export default class JitsiMeetExternalAPI extends EventEmitter { }); } + /** + * Returns whether the participants pane is open. + * + * @returns {Promise} - Resolves with true if the participants pane is open + * and with false if not. + */ + isParticipantsPaneOpen() { + return this._transport.sendRequest({ + name: 'is-participants-pane-open' + }); + } + /** * Returns screen sharing status. *