feat(api): add notifications for kicked participants

This commit is contained in:
Leonard Kim 2019-06-28 15:22:43 -07:00 committed by virtuacoplenny
parent 2dc06c28e3
commit 0734ce7ae3
6 changed files with 76 additions and 1 deletions

View File

@ -387,6 +387,19 @@ changes. The listener will receive an object with the following structure:
}
```
* **participantKickedOut** - event notifications about a participants being removed from the room. The listener will receive an object with the following structure:
```javascript
{
kicked: {
id: string, // the id of the participant removed from the room
local: boolean // whether or not the participant is the local particiapnt
},
kicker: {
id: string // the id of the participant who kicked out the other participant
}
}
```
* **participantLeft** - event notifications about participants that leave the room. The listener will receive an object with the following structure:
```javascript
{

View File

@ -658,6 +658,24 @@ class API {
});
}
/**
* Notify external application of a participant, remote or local, being
* removed from the conference by another participant.
*
* @param {string} kicked - The ID of the participant removed from the
* conference.
* @param {string} kicker - The ID of the participant that removed the
* other participant.
* @returns {void}
*/
notifyKickedOut(kicked: Object, kicker: Object) {
this._sendEvent({
name: 'participant-kicked-out',
kicked,
kicker
});
}
/**
* Notify external application of the current meeting requiring a password
* to join.

View File

@ -63,6 +63,7 @@ const events = {
'mic-error': 'micError',
'outgoing-message': 'outgoingMessage',
'participant-joined': 'participantJoined',
'participant-kicked-out': 'participantKickedOut',
'participant-left': 'participantLeft',
'password-required': 'passwordRequired',
'proxy-connection-event': 'proxyConnectionEvent',

View File

@ -65,6 +65,18 @@ export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
*/
export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
/**
* Action to signal that a participant has been removed from a conference by
* another participant.
*
* {
* type: PARTICIPANT_KICKED,
* kicked: Object,
* kicker: Object
* }
*/
export const PARTICIPANT_KICKED = 'PARTICIPANT_KICKED';
/**
* Action to handle case when participant lefts.
*

View File

@ -9,6 +9,7 @@ import {
MUTE_REMOTE_PARTICIPANT,
PARTICIPANT_ID_CHANGED,
PARTICIPANT_JOINED,
PARTICIPANT_KICKED,
PARTICIPANT_LEFT,
PARTICIPANT_UPDATED,
PIN_PARTICIPANT
@ -415,6 +416,12 @@ export function participantMutedUs(participant) {
export function participantKicked(kicker, kicked) {
return (dispatch, getState) => {
dispatch({
type: PARTICIPANT_KICKED,
kicked: kicked.getId(),
kicker: kicker.getId()
});
dispatch(showNotification({
titleArguments: {
kicked:

View File

@ -1,9 +1,14 @@
// @flow
import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference';
import {
CONFERENCE_FAILED,
CONFERENCE_JOINED,
KICKED_OUT
} from '../base/conference';
import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';
import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';
import {
PARTICIPANT_KICKED,
getAvatarURLByParticipantId,
getLocalParticipant
} from '../base/participants';
@ -53,6 +58,16 @@ MiddlewareRegistry.register(store => next => action => {
break;
}
case KICKED_OUT:
APP.API.notifyKickedOut(
{
id: getLocalParticipant(store.getState()).id,
local: true
},
{ id: action.participant.getId() }
);
break;
case NOTIFY_CAMERA_ERROR:
if (action.error) {
APP.API.notifyOnCameraError(
@ -66,6 +81,15 @@ MiddlewareRegistry.register(store => next => action => {
}
break;
case PARTICIPANT_KICKED:
APP.API.notifyKickedOut(
{
id: action.kicked,
local: false
},
{ id: action.kicker });
break;
case SET_FILMSTRIP_VISIBLE:
APP.API.notifyFilmstripDisplayChanged(action.visible);
break;