|
|
|
@ -1,9 +1,13 @@ |
|
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
|
import { batch } from 'react-redux'; |
|
|
|
|
|
|
|
|
|
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app'; |
|
|
|
|
import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference'; |
|
|
|
|
import { JitsiConferenceErrors, JitsiConferenceEvents } from '../base/lib-jitsi-meet'; |
|
|
|
|
import { getFirstLoadableAvatarUrl, getParticipantDisplayName } from '../base/participants'; |
|
|
|
|
import { MiddlewareRegistry, StateListenerRegistry } from '../base/redux'; |
|
|
|
|
import { playSound, registerSound, unregisterSound } from '../base/sounds'; |
|
|
|
|
import { isTestModeEnabled } from '../base/testing'; |
|
|
|
|
import { NOTIFICATION_TYPE, showNotification } from '../notifications'; |
|
|
|
|
import { shouldAutoKnock } from '../prejoin/functions'; |
|
|
|
@ -18,9 +22,17 @@ import { |
|
|
|
|
startKnocking, |
|
|
|
|
setPasswordJoinFailed |
|
|
|
|
} from './actions'; |
|
|
|
|
import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants'; |
|
|
|
|
import { KNOCKING_PARTICIPANT_FILE } from './sounds'; |
|
|
|
|
|
|
|
|
|
MiddlewareRegistry.register(store => next => action => { |
|
|
|
|
switch (action.type) { |
|
|
|
|
case APP_WILL_MOUNT: |
|
|
|
|
store.dispatch(registerSound(KNOCKING_PARTICIPANT_SOUND_ID, KNOCKING_PARTICIPANT_FILE)); |
|
|
|
|
break; |
|
|
|
|
case APP_WILL_UNMOUNT: |
|
|
|
|
store.dispatch(unregisterSound(KNOCKING_PARTICIPANT_SOUND_ID)); |
|
|
|
|
break; |
|
|
|
|
case CONFERENCE_FAILED: |
|
|
|
|
return _conferenceFailed(store, next, action); |
|
|
|
|
case CONFERENCE_JOINED: |
|
|
|
@ -51,10 +63,13 @@ StateListenerRegistry.register( |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
conference.on(JitsiConferenceEvents.LOBBY_USER_JOINED, (id, name) => { |
|
|
|
|
dispatch(participantIsKnockingOrUpdated({ |
|
|
|
|
id, |
|
|
|
|
name |
|
|
|
|
})); |
|
|
|
|
batch(() => { |
|
|
|
|
dispatch(participantIsKnockingOrUpdated({ |
|
|
|
|
id, |
|
|
|
|
name |
|
|
|
|
})); |
|
|
|
|
dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID)); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
conference.on(JitsiConferenceEvents.LOBBY_USER_UPDATED, (id, participant) => { |
|
|
|
|