|
@@ -1,9 +1,13 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
|
3
|
+import { batch } from 'react-redux';
|
|
4
|
+
|
|
5
|
+import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
|
3
|
6
|
import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference';
|
4
|
7
|
import { JitsiConferenceErrors, JitsiConferenceEvents } from '../base/lib-jitsi-meet';
|
5
|
8
|
import { getFirstLoadableAvatarUrl, getParticipantDisplayName } from '../base/participants';
|
6
|
9
|
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux';
|
|
10
|
+import { playSound, registerSound, unregisterSound } from '../base/sounds';
|
7
|
11
|
import { isTestModeEnabled } from '../base/testing';
|
8
|
12
|
import { NOTIFICATION_TYPE, showNotification } from '../notifications';
|
9
|
13
|
import { shouldAutoKnock } from '../prejoin/functions';
|
|
@@ -18,9 +22,17 @@ import {
|
18
|
22
|
startKnocking,
|
19
|
23
|
setPasswordJoinFailed
|
20
|
24
|
} from './actions';
|
|
25
|
+import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
|
|
26
|
+import { KNOCKING_PARTICIPANT_FILE } from './sounds';
|
21
|
27
|
|
22
|
28
|
MiddlewareRegistry.register(store => next => action => {
|
23
|
29
|
switch (action.type) {
|
|
30
|
+ case APP_WILL_MOUNT:
|
|
31
|
+ store.dispatch(registerSound(KNOCKING_PARTICIPANT_SOUND_ID, KNOCKING_PARTICIPANT_FILE));
|
|
32
|
+ break;
|
|
33
|
+ case APP_WILL_UNMOUNT:
|
|
34
|
+ store.dispatch(unregisterSound(KNOCKING_PARTICIPANT_SOUND_ID));
|
|
35
|
+ break;
|
24
|
36
|
case CONFERENCE_FAILED:
|
25
|
37
|
return _conferenceFailed(store, next, action);
|
26
|
38
|
case CONFERENCE_JOINED:
|
|
@@ -51,10 +63,13 @@ StateListenerRegistry.register(
|
51
|
63
|
});
|
52
|
64
|
|
53
|
65
|
conference.on(JitsiConferenceEvents.LOBBY_USER_JOINED, (id, name) => {
|
54
|
|
- dispatch(participantIsKnockingOrUpdated({
|
55
|
|
- id,
|
56
|
|
- name
|
57
|
|
- }));
|
|
66
|
+ batch(() => {
|
|
67
|
+ dispatch(participantIsKnockingOrUpdated({
|
|
68
|
+ id,
|
|
69
|
+ name
|
|
70
|
+ }));
|
|
71
|
+ dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
|
|
72
|
+ });
|
58
|
73
|
});
|
59
|
74
|
|
60
|
75
|
conference.on(JitsiConferenceEvents.LOBBY_USER_UPDATED, (id, participant) => {
|