Skip to content

Commit

Permalink
feat(mobile): handle kicked out of the conference
Browse files Browse the repository at this point in the history
Being kicked out of the conference will result with a conference failed
event with 'conference.kicked' reason and take the user back to
the welcome page by navigating to 'undefined'.
  • Loading branch information
paweldomas authored and lyubomir committed Apr 3, 2018
1 parent 7c08116 commit 6f11bbc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
11 changes: 11 additions & 0 deletions react/features/base/conference/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ export const CONFERENCE_WILL_LEAVE = Symbol('CONFERENCE_WILL_LEAVE');
*/
export const DATA_CHANNEL_OPENED = Symbol('DATA_CHANNEL_OPENED');

/**
* The type of action which signals that the user has been kicked out from
* the conference.
*
* {
* type: KICKED_OUT,
* conference: JitsiConference
* }
*/
export const KICKED_OUT = Symbol('KICKED_OUT');

/**
* The type of (redux) action which signals that the lock state of a specific
* {@code JitsiConference} changed.
Expand Down
22 changes: 22 additions & 0 deletions react/features/base/conference/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
CONFERENCE_WILL_JOIN,
CONFERENCE_WILL_LEAVE,
DATA_CHANNEL_OPENED,
KICKED_OUT,
LOCK_STATE_CHANGED,
P2P_STATUS_CHANGED,
SET_AUDIO_ONLY,
Expand Down Expand Up @@ -78,6 +79,10 @@ function _addConferenceListeners(conference, dispatch) {
JitsiConferenceEvents.CONFERENCE_LEFT,
(...args) => dispatch(conferenceLeft(conference, ...args)));

conference.on(
JitsiConferenceEvents.KICKED,
() => dispatch(kickedOut(conference)));

conference.on(
JitsiConferenceEvents.LOCK_STATE_CHANGED,
(...args) => dispatch(lockStateChanged(conference, ...args)));
Expand Down Expand Up @@ -358,6 +363,23 @@ export function dataChannelOpened() {
};
}

/**
* Signals that we've been kicked out of the conference.
*
* @param {JitsiConference} conference - The {@link JitsiConference} instance
* for which the event is being signaled.
* @returns {{
* type: KICKED_OUT,
* conference: JitsiConference
* }}
*/
export function kickedOut(conference: Object) {
return {
type: KICKED_OUT,
conference
};
}

/**
* Signals that the lock state of a specific JitsiConference changed.
*
Expand Down
13 changes: 13 additions & 0 deletions react/features/conference/middleware.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// @flow

import { appNavigate } from '../app';
import {
CONFERENCE_JOINED,
KICKED_OUT,
VIDEO_QUALITY_LEVELS,
conferenceFailed,
setReceiveVideoQuality
} from '../base/conference';
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
import { SET_REDUCED_UI } from '../base/responsive-ui';
import { MiddlewareRegistry } from '../base/redux';
import { setFilmstripEnabled } from '../filmstrip';
Expand Down Expand Up @@ -35,6 +39,15 @@ MiddlewareRegistry.register(store => next => action => {

break;
}

case KICKED_OUT: {
const { dispatch } = store;

dispatch(
conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));
dispatch(appNavigate(undefined));
break;
}
}

return result;
Expand Down

0 comments on commit 6f11bbc

Please sign in to comment.