feat(external-api) Add participants pane toggled event (#11718)

This commit is contained in:
Robert Pintilii 2022-06-21 14:23:33 +01:00 committed by GitHub
parent 0308ba71b1
commit d0790736db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 0 deletions

View File

@ -1695,6 +1695,19 @@ class API {
});
}
/**
* Notify the external application that the state of the participants pane changed.
*
* @param {boolean} open - Wether the panel is open or not.
* @returns {void}
*/
notifyParticipantsPaneToggled(open) {
this._sendEvent({
name: 'participants-pane-toggled',
open
});
}
/**
* Disposes the allocated resources.
*

View File

@ -126,6 +126,7 @@ const events = {
'participant-kicked-out': 'participantKickedOut',
'participant-left': 'participantLeft',
'participant-role-changed': 'participantRoleChanged',
'participants-pane-toggled': 'participantsPaneToggled',
'password-required': 'passwordRequired',
'proxy-connection-event': 'proxyConnectionEvent',
'raise-hand-updated': 'raiseHandUpdated',

View File

@ -36,6 +36,7 @@ import '../large-video/middleware';
import '../lobby/middleware';
import '../notifications/middleware';
import '../overlay/middleware';
import '../participants-pane/middleware';
import '../polls/middleware';
import '../reactions/middleware';
import '../recent-list/middleware';

View File

@ -0,0 +1,30 @@
// @ts-ignore
import { IStore } from '../app/types';
// @ts-ignore
import { MiddlewareRegistry } from '../base/redux';
import { PARTICIPANTS_PANE_CLOSE, PARTICIPANTS_PANE_OPEN } from './actionTypes';
declare var APP: any;
/**
* Middleware which intercepts participants pane actions.
*
* @param {IStore} store - The redux store.
* @returns {Function}
*/
MiddlewareRegistry.register((store: IStore) => (next:Function) => (action:any) => {
switch(action.type) {
case PARTICIPANTS_PANE_OPEN:
if (typeof APP !== 'undefined') {
APP.API.notifyParticipantsPaneToggled(true);
}
break;
case PARTICIPANTS_PANE_CLOSE:
if (typeof APP !== 'undefined') {
APP.API.notifyParticipantsPaneToggled(false);
}
break;
}
return next(action);
});