|
@@ -6,11 +6,15 @@ import {
|
6
|
6
|
KICKED_OUT,
|
7
|
7
|
VIDEO_QUALITY_LEVELS,
|
8
|
8
|
conferenceFailed,
|
|
9
|
+ getCurrentConference,
|
9
|
10
|
setPreferredReceiverVideoQuality
|
10
|
11
|
} from '../base/conference';
|
|
12
|
+import { hideDialog, isDialogOpen } from '../base/dialog';
|
11
|
13
|
import { JitsiConferenceEvents } from '../base/lib-jitsi-meet';
|
|
14
|
+import { pinParticipant } from '../base/participants';
|
12
|
15
|
import { SET_REDUCED_UI } from '../base/responsive-ui';
|
13
|
|
-import { MiddlewareRegistry } from '../base/redux';
|
|
16
|
+import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
|
17
|
+import { FeedbackDialog } from '../feedback';
|
14
|
18
|
import { setFilmstripEnabled } from '../filmstrip';
|
15
|
19
|
import { setToolboxEnabled } from '../toolbox';
|
16
|
20
|
|
|
@@ -48,3 +52,33 @@ MiddlewareRegistry.register(store => next => action => {
|
48
|
52
|
|
49
|
53
|
return result;
|
50
|
54
|
});
|
|
55
|
+
|
|
56
|
+/**
|
|
57
|
+ * Set up state change listener to perform maintenance tasks when the conference
|
|
58
|
+ * is left or failed, close all dialogs and unpin any pinned participants.
|
|
59
|
+ */
|
|
60
|
+StateListenerRegistry.register(
|
|
61
|
+ state => getCurrentConference(state),
|
|
62
|
+ (conference, { dispatch, getState }, prevConference) => {
|
|
63
|
+ const { authRequired, passwordRequired }
|
|
64
|
+ = getState()['features/base/conference'];
|
|
65
|
+
|
|
66
|
+ if (conference !== prevConference) {
|
|
67
|
+ // Unpin participant, in order to avoid the local participant
|
|
68
|
+ // remaining pinned, since it's not destroyed across runs.
|
|
69
|
+ dispatch(pinParticipant(null));
|
|
70
|
+
|
|
71
|
+ // XXX I wonder if there is a better way to do this. At this stage
|
|
72
|
+ // we do know what dialogs we want to keep but the list of those
|
|
73
|
+ // we want to hide is a lot longer. Thus we take a bit of a shortcut
|
|
74
|
+ // and explicitly check.
|
|
75
|
+ if (typeof authRequired === 'undefined'
|
|
76
|
+ && typeof passwordRequired === 'undefined'
|
|
77
|
+ && !isDialogOpen(getState(), FeedbackDialog)) {
|
|
78
|
+ // Conference changed, left or failed... and there is no
|
|
79
|
+ // pending authentication, nor feedback request, so close any
|
|
80
|
+ // dialog we might have open.
|
|
81
|
+ dispatch(hideDialog());
|
|
82
|
+ }
|
|
83
|
+ }
|
|
84
|
+ });
|