Browse Source

feat(mobile): handle kicked out of the conference

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'.
master
paweldomas 7 years ago
parent
commit
6f11bbc400

+ 11
- 0
react/features/base/conference/actionTypes.js View File

@@ -62,6 +62,17 @@ export const CONFERENCE_WILL_LEAVE = Symbol('CONFERENCE_WILL_LEAVE');
62 62
  */
63 63
 export const DATA_CHANNEL_OPENED = Symbol('DATA_CHANNEL_OPENED');
64 64
 
65
+/**
66
+ * The type of action which signals that the user has been kicked out from
67
+ * the conference.
68
+ *
69
+ * {
70
+ *     type: KICKED_OUT,
71
+ *     conference: JitsiConference
72
+ * }
73
+ */
74
+export const KICKED_OUT = Symbol('KICKED_OUT');
75
+
65 76
 /**
66 77
  * The type of (redux) action which signals that the lock state of a specific
67 78
  * {@code JitsiConference} changed.

+ 22
- 0
react/features/base/conference/actions.js View File

@@ -28,6 +28,7 @@ import {
28 28
     CONFERENCE_WILL_JOIN,
29 29
     CONFERENCE_WILL_LEAVE,
30 30
     DATA_CHANNEL_OPENED,
31
+    KICKED_OUT,
31 32
     LOCK_STATE_CHANGED,
32 33
     P2P_STATUS_CHANGED,
33 34
     SET_AUDIO_ONLY,
@@ -78,6 +79,10 @@ function _addConferenceListeners(conference, dispatch) {
78 79
         JitsiConferenceEvents.CONFERENCE_LEFT,
79 80
         (...args) => dispatch(conferenceLeft(conference, ...args)));
80 81
 
82
+    conference.on(
83
+        JitsiConferenceEvents.KICKED,
84
+        () => dispatch(kickedOut(conference)));
85
+
81 86
     conference.on(
82 87
         JitsiConferenceEvents.LOCK_STATE_CHANGED,
83 88
         (...args) => dispatch(lockStateChanged(conference, ...args)));
@@ -358,6 +363,23 @@ export function dataChannelOpened() {
358 363
     };
359 364
 }
360 365
 
366
+/**
367
+ * Signals that we've been kicked out of the conference.
368
+ *
369
+ * @param {JitsiConference} conference - The {@link JitsiConference} instance
370
+ * for which the event is being signaled.
371
+ * @returns {{
372
+ *     type: KICKED_OUT,
373
+ *     conference: JitsiConference
374
+ * }}
375
+ */
376
+export function kickedOut(conference: Object) {
377
+    return {
378
+        type: KICKED_OUT,
379
+        conference
380
+    };
381
+}
382
+
361 383
 /**
362 384
  * Signals that the lock state of a specific JitsiConference changed.
363 385
  *

+ 13
- 0
react/features/conference/middleware.js View File

@@ -1,10 +1,14 @@
1 1
 // @flow
2 2
 
3
+import { appNavigate } from '../app';
3 4
 import {
4 5
     CONFERENCE_JOINED,
6
+    KICKED_OUT,
5 7
     VIDEO_QUALITY_LEVELS,
8
+    conferenceFailed,
6 9
     setReceiveVideoQuality
7 10
 } from '../base/conference';
11
+import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
8 12
 import { SET_REDUCED_UI } from '../base/responsive-ui';
9 13
 import { MiddlewareRegistry } from '../base/redux';
10 14
 import { setFilmstripEnabled } from '../filmstrip';
@@ -35,6 +39,15 @@ MiddlewareRegistry.register(store => next => action => {
35 39
 
36 40
         break;
37 41
     }
42
+
43
+    case KICKED_OUT: {
44
+        const { dispatch } = store;
45
+
46
+        dispatch(
47
+            conferenceFailed(action.conference, JitsiConferenceEvents.KICKED));
48
+        dispatch(appNavigate(undefined));
49
+        break;
50
+    }
38 51
     }
39 52
 
40 53
     return result;

Loading…
Cancel
Save