2022-01-20 14:26:03 +00:00
|
|
|
import i18n from 'i18next';
|
2021-08-24 09:02:29 +00:00
|
|
|
import { batch } from 'react-redux';
|
2022-11-23 09:12:26 +00:00
|
|
|
import { AnyAction } from 'redux';
|
2021-08-24 09:02:29 +00:00
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
import { IStore } from '../app/types';
|
|
|
|
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app/actionTypes';
|
|
|
|
import { CONFERENCE_FAILED, CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
|
|
|
import { conferenceWillJoin } from '../base/conference/actions';
|
2020-04-15 13:13:43 +00:00
|
|
|
import { JitsiConferenceErrors, JitsiConferenceEvents } from '../base/lib-jitsi-meet';
|
2022-11-23 09:12:26 +00:00
|
|
|
import { getFirstLoadableAvatarUrl, getParticipantDisplayName } from '../base/participants/functions';
|
|
|
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
|
|
|
import StateListenerRegistry from '../base/redux/StateListenerRegistry';
|
|
|
|
import { playSound, registerSound, unregisterSound } from '../base/sounds/actions';
|
|
|
|
import { isTestModeEnabled } from '../base/testing/functions';
|
2022-03-03 17:29:38 +00:00
|
|
|
import { handleLobbyChatInitialized, removeLobbyChatParticipant } from '../chat/actions.any';
|
2022-11-23 09:12:26 +00:00
|
|
|
import {
|
|
|
|
hideNotification,
|
|
|
|
showNotification
|
|
|
|
} from '../notifications/actions';
|
2021-11-24 11:05:27 +00:00
|
|
|
import {
|
2022-01-20 14:26:03 +00:00
|
|
|
LOBBY_NOTIFICATION_ID,
|
|
|
|
NOTIFICATION_ICON,
|
2021-11-24 11:05:27 +00:00
|
|
|
NOTIFICATION_TIMEOUT_TYPE,
|
2022-11-23 09:12:26 +00:00
|
|
|
NOTIFICATION_TYPE
|
|
|
|
} from '../notifications/constants';
|
|
|
|
import { INotificationProps } from '../notifications/types';
|
2022-01-20 14:26:03 +00:00
|
|
|
import { open as openParticipantsPane } from '../participants-pane/actions';
|
|
|
|
import { getParticipantsPaneOpen } from '../participants-pane/functions';
|
2021-02-24 09:35:32 +00:00
|
|
|
import { shouldAutoKnock } from '../prejoin/functions';
|
2020-04-15 13:13:43 +00:00
|
|
|
|
2022-03-01 19:48:05 +00:00
|
|
|
import { KNOCKING_PARTICIPANT_ARRIVED_OR_UPDATED, KNOCKING_PARTICIPANT_LEFT } from './actionTypes';
|
2020-04-15 13:13:43 +00:00
|
|
|
import {
|
2022-11-23 09:12:26 +00:00
|
|
|
approveKnockingParticipant,
|
2020-05-20 08:25:31 +00:00
|
|
|
hideLobbyScreen,
|
2020-04-15 13:13:43 +00:00
|
|
|
knockingParticipantLeft,
|
|
|
|
openLobbyScreen,
|
|
|
|
participantIsKnockingOrUpdated,
|
2022-11-23 09:12:26 +00:00
|
|
|
rejectKnockingParticipant,
|
2022-09-27 07:10:28 +00:00
|
|
|
setLobbyMessageListener,
|
2020-05-20 08:25:31 +00:00
|
|
|
setLobbyModeEnabled,
|
2022-03-03 17:29:38 +00:00
|
|
|
setPasswordJoinFailed,
|
2022-09-27 07:10:28 +00:00
|
|
|
startKnocking
|
2020-04-15 13:13:43 +00:00
|
|
|
} from './actions';
|
2022-03-03 17:29:38 +00:00
|
|
|
import { updateLobbyParticipantOnLeave } from './actions.any';
|
2021-08-24 09:02:29 +00:00
|
|
|
import { KNOCKING_PARTICIPANT_SOUND_ID } from './constants';
|
2022-03-03 17:29:38 +00:00
|
|
|
import { getKnockingParticipants, showLobbyChatButton } from './functions';
|
2021-08-24 09:02:29 +00:00
|
|
|
import { KNOCKING_PARTICIPANT_FILE } from './sounds';
|
2022-11-23 09:12:26 +00:00
|
|
|
import { IKnockingParticipant } from './types';
|
2021-10-21 07:39:13 +00:00
|
|
|
|
2020-04-15 13:13:43 +00:00
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
switch (action.type) {
|
2021-08-24 09:02:29 +00:00
|
|
|
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;
|
2020-04-15 13:13:43 +00:00
|
|
|
case CONFERENCE_FAILED:
|
|
|
|
return _conferenceFailed(store, next, action);
|
|
|
|
case CONFERENCE_JOINED:
|
|
|
|
return _conferenceJoined(store, next, action);
|
|
|
|
case KNOCKING_PARTICIPANT_ARRIVED_OR_UPDATED: {
|
|
|
|
// We need the full update result to be in the store already
|
|
|
|
const result = next(action);
|
|
|
|
|
|
|
|
_findLoadableAvatarForKnockingParticipant(store, action.participant);
|
2022-03-01 19:48:05 +00:00
|
|
|
_handleLobbyNotification(store);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
case KNOCKING_PARTICIPANT_LEFT: {
|
|
|
|
// We need the full update result to be in the store already
|
|
|
|
const result = next(action);
|
|
|
|
|
|
|
|
_handleLobbyNotification(store);
|
2020-04-15 13:13:43 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a change handler for state['features/base/conference'].conference to
|
|
|
|
* set the event listeners needed for the lobby feature to operate.
|
|
|
|
*/
|
|
|
|
StateListenerRegistry.register(
|
|
|
|
state => state['features/base/conference'].conference,
|
2020-07-06 14:54:33 +00:00
|
|
|
(conference, { dispatch, getState }, previousConference) => {
|
2020-04-15 13:13:43 +00:00
|
|
|
if (conference && !previousConference) {
|
2022-11-23 09:12:26 +00:00
|
|
|
conference.on(JitsiConferenceEvents.MEMBERS_ONLY_CHANGED, (enabled: boolean) => {
|
2020-04-15 13:13:43 +00:00
|
|
|
dispatch(setLobbyModeEnabled(enabled));
|
2022-03-03 17:29:38 +00:00
|
|
|
if (enabled) {
|
|
|
|
dispatch(setLobbyMessageListener());
|
|
|
|
}
|
2020-04-15 13:13:43 +00:00
|
|
|
});
|
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
conference.on(JitsiConferenceEvents.LOBBY_USER_JOINED, (id: string, name: string) => {
|
2022-06-15 18:36:26 +00:00
|
|
|
const { soundsParticipantKnocking } = getState()['features/base/settings'];
|
|
|
|
|
2021-08-24 09:02:29 +00:00
|
|
|
batch(() => {
|
2021-11-24 11:05:27 +00:00
|
|
|
dispatch(
|
|
|
|
participantIsKnockingOrUpdated({
|
|
|
|
id,
|
|
|
|
name
|
|
|
|
})
|
|
|
|
);
|
2022-06-15 18:36:26 +00:00
|
|
|
if (soundsParticipantKnocking) {
|
|
|
|
dispatch(playSound(KNOCKING_PARTICIPANT_SOUND_ID));
|
|
|
|
}
|
2022-01-20 14:26:03 +00:00
|
|
|
|
|
|
|
const isParticipantsPaneVisible = getParticipantsPaneOpen(getState());
|
|
|
|
|
|
|
|
if (navigator.product === 'ReactNative' || isParticipantsPaneVisible) {
|
|
|
|
return;
|
|
|
|
}
|
2022-03-01 19:48:05 +00:00
|
|
|
|
|
|
|
_handleLobbyNotification({
|
|
|
|
dispatch,
|
|
|
|
getState
|
|
|
|
});
|
2022-01-20 14:26:03 +00:00
|
|
|
|
2022-03-03 17:29:38 +00:00
|
|
|
let notificationTitle;
|
|
|
|
let customActionNameKey;
|
|
|
|
let customActionHandler;
|
|
|
|
let descriptionKey;
|
|
|
|
let icon;
|
|
|
|
|
|
|
|
const knockingParticipants = getKnockingParticipants(getState());
|
|
|
|
const firstParticipant = knockingParticipants[0];
|
|
|
|
const showChat = showLobbyChatButton(firstParticipant)(getState());
|
|
|
|
|
|
|
|
if (knockingParticipants.length > 1) {
|
|
|
|
descriptionKey = 'notify.participantsWantToJoin';
|
|
|
|
notificationTitle = i18n.t('notify.waitingParticipants', {
|
|
|
|
waitingParticipants: knockingParticipants.length
|
|
|
|
});
|
|
|
|
icon = NOTIFICATION_ICON.PARTICIPANTS;
|
|
|
|
customActionNameKey = [ 'notify.viewLobby' ];
|
|
|
|
customActionHandler = [ () => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(openParticipantsPane());
|
|
|
|
}) ];
|
|
|
|
} else {
|
|
|
|
descriptionKey = 'notify.participantWantsToJoin';
|
|
|
|
notificationTitle = firstParticipant.name;
|
|
|
|
icon = NOTIFICATION_ICON.PARTICIPANT;
|
|
|
|
customActionNameKey = [ 'lobby.admit', 'lobby.reject' ];
|
|
|
|
customActionHandler = [ () => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(approveKnockingParticipant(firstParticipant.id));
|
|
|
|
}),
|
|
|
|
() => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(rejectKnockingParticipant(firstParticipant.id));
|
|
|
|
}) ];
|
|
|
|
if (showChat) {
|
|
|
|
customActionNameKey.splice(1, 0, 'lobby.chat');
|
|
|
|
customActionHandler.splice(1, 0, () => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(handleLobbyChatInitialized(firstParticipant.id));
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dispatch(showNotification({
|
|
|
|
title: notificationTitle,
|
|
|
|
descriptionKey,
|
|
|
|
uid: LOBBY_NOTIFICATION_ID,
|
|
|
|
customActionNameKey,
|
|
|
|
customActionHandler,
|
|
|
|
icon
|
|
|
|
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
|
|
|
|
|
2021-10-21 07:39:13 +00:00
|
|
|
if (typeof APP !== 'undefined') {
|
|
|
|
APP.API.notifyKnockingParticipant({
|
|
|
|
id,
|
|
|
|
name
|
|
|
|
});
|
|
|
|
}
|
2021-08-24 09:02:29 +00:00
|
|
|
});
|
2020-04-15 13:13:43 +00:00
|
|
|
});
|
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
conference.on(JitsiConferenceEvents.LOBBY_USER_UPDATED, (id: string, participant: IKnockingParticipant) => {
|
2021-11-24 11:05:27 +00:00
|
|
|
dispatch(
|
|
|
|
participantIsKnockingOrUpdated({
|
|
|
|
...participant,
|
|
|
|
id
|
|
|
|
})
|
|
|
|
);
|
2020-04-15 13:13:43 +00:00
|
|
|
});
|
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
conference.on(JitsiConferenceEvents.LOBBY_USER_LEFT, (id: string) => {
|
2022-03-03 17:29:38 +00:00
|
|
|
batch(() => {
|
|
|
|
dispatch(knockingParticipantLeft(id));
|
|
|
|
dispatch(removeLobbyChatParticipant());
|
|
|
|
dispatch(updateLobbyParticipantOnLeave(id));
|
|
|
|
});
|
2020-04-15 13:13:43 +00:00
|
|
|
});
|
2020-07-06 14:54:33 +00:00
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
conference.on(JitsiConferenceEvents.ENDPOINT_MESSAGE_RECEIVED, (origin: any, sender: any) =>
|
2020-07-06 14:54:33 +00:00
|
|
|
_maybeSendLobbyNotification(origin, sender, {
|
|
|
|
dispatch,
|
|
|
|
getState
|
|
|
|
})
|
|
|
|
);
|
2020-04-15 13:13:43 +00:00
|
|
|
}
|
2021-11-24 11:05:27 +00:00
|
|
|
}
|
|
|
|
);
|
2020-04-15 13:13:43 +00:00
|
|
|
|
2022-03-01 19:48:05 +00:00
|
|
|
/**
|
|
|
|
* Function to handle the lobby notification.
|
|
|
|
*
|
|
|
|
* @param {Object} store - The Redux store.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-11-23 09:12:26 +00:00
|
|
|
function _handleLobbyNotification(store: IStore) {
|
2022-03-01 19:48:05 +00:00
|
|
|
const { dispatch, getState } = store;
|
|
|
|
const knockingParticipants = getKnockingParticipants(getState());
|
|
|
|
|
|
|
|
if (knockingParticipants.length === 0) {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
let notificationTitle;
|
|
|
|
let customActionNameKey;
|
|
|
|
let customActionHandler;
|
|
|
|
let descriptionKey;
|
|
|
|
let icon;
|
|
|
|
|
|
|
|
if (knockingParticipants.length === 1) {
|
|
|
|
const firstParticipant = knockingParticipants[0];
|
|
|
|
|
|
|
|
descriptionKey = 'notify.participantWantsToJoin';
|
|
|
|
notificationTitle = firstParticipant.name;
|
|
|
|
icon = NOTIFICATION_ICON.PARTICIPANT;
|
|
|
|
customActionNameKey = [ 'lobby.admit', 'lobby.reject' ];
|
|
|
|
customActionHandler = [ () => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(approveKnockingParticipant(firstParticipant.id));
|
|
|
|
}),
|
|
|
|
() => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(rejectKnockingParticipant(firstParticipant.id));
|
|
|
|
}) ];
|
|
|
|
} else {
|
|
|
|
descriptionKey = 'notify.participantsWantToJoin';
|
|
|
|
notificationTitle = i18n.t('notify.waitingParticipants', {
|
|
|
|
waitingParticipants: knockingParticipants.length
|
|
|
|
});
|
|
|
|
icon = NOTIFICATION_ICON.PARTICIPANTS;
|
|
|
|
customActionNameKey = [ 'notify.viewLobby' ];
|
|
|
|
customActionHandler = [ () => batch(() => {
|
|
|
|
dispatch(hideNotification(LOBBY_NOTIFICATION_ID));
|
|
|
|
dispatch(openParticipantsPane());
|
|
|
|
}) ];
|
|
|
|
}
|
|
|
|
dispatch(showNotification({
|
|
|
|
title: notificationTitle,
|
|
|
|
descriptionKey,
|
|
|
|
uid: LOBBY_NOTIFICATION_ID,
|
|
|
|
customActionNameKey,
|
|
|
|
customActionHandler,
|
|
|
|
icon
|
|
|
|
}, NOTIFICATION_TIMEOUT_TYPE.STICKY));
|
|
|
|
}
|
|
|
|
|
2020-04-15 13:13:43 +00:00
|
|
|
/**
|
|
|
|
* Function to handle the conference failed event and navigate the user to the lobby screen
|
|
|
|
* based on the failure reason.
|
|
|
|
*
|
|
|
|
* @param {Object} store - The Redux store.
|
|
|
|
* @param {Function} next - The Redux next function.
|
|
|
|
* @param {Object} action - The Redux action.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2022-11-23 09:12:26 +00:00
|
|
|
function _conferenceFailed({ dispatch, getState }: IStore, next: Function, action: AnyAction) {
|
2020-04-15 13:13:43 +00:00
|
|
|
const { error } = action;
|
2020-05-20 08:25:31 +00:00
|
|
|
const state = getState();
|
2021-11-30 16:50:13 +00:00
|
|
|
const { membersOnly } = state['features/base/conference'];
|
|
|
|
const nonFirstFailure = Boolean(membersOnly);
|
2020-04-15 13:13:43 +00:00
|
|
|
|
|
|
|
if (error.name === JitsiConferenceErrors.MEMBERS_ONLY_ERROR) {
|
|
|
|
if (typeof error.recoverable === 'undefined') {
|
|
|
|
error.recoverable = true;
|
|
|
|
}
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
const result = next(action);
|
|
|
|
|
2020-04-15 13:13:43 +00:00
|
|
|
dispatch(openLobbyScreen());
|
2020-05-20 08:25:31 +00:00
|
|
|
|
2021-02-24 09:35:32 +00:00
|
|
|
if (shouldAutoKnock(state)) {
|
2020-05-20 08:25:31 +00:00
|
|
|
dispatch(startKnocking());
|
2020-04-15 13:13:43 +00:00
|
|
|
}
|
2020-05-20 08:25:31 +00:00
|
|
|
|
2021-11-30 16:50:13 +00:00
|
|
|
// In case of wrong password we need to be in the right state if in the meantime someone allows us to join
|
|
|
|
if (nonFirstFailure) {
|
2022-11-23 09:12:26 +00:00
|
|
|
// @ts-ignore
|
2021-11-30 16:50:13 +00:00
|
|
|
dispatch(conferenceWillJoin(membersOnly));
|
|
|
|
}
|
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
dispatch(setPasswordJoinFailed(nonFirstFailure));
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
dispatch(hideLobbyScreen());
|
|
|
|
|
|
|
|
if (error.name === JitsiConferenceErrors.CONFERENCE_ACCESS_DENIED) {
|
2021-11-24 11:05:27 +00:00
|
|
|
dispatch(
|
|
|
|
showNotification({
|
|
|
|
appearance: NOTIFICATION_TYPE.ERROR,
|
|
|
|
hideErrorSupportLink: true,
|
2022-03-24 11:15:30 +00:00
|
|
|
titleKey: 'lobby.joinRejectedTitle',
|
|
|
|
descriptionKey: 'lobby.joinRejectedMessage'
|
2021-11-24 11:05:27 +00:00
|
|
|
}, NOTIFICATION_TIMEOUT_TYPE.LONG)
|
|
|
|
);
|
2020-04-15 13:13:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles cleanup of lobby state when a conference is joined.
|
|
|
|
*
|
|
|
|
* @param {Object} store - The Redux store.
|
|
|
|
* @param {Function} next - The Redux next function.
|
|
|
|
* @param {Object} action - The Redux action.
|
|
|
|
* @returns {Object}
|
|
|
|
*/
|
2022-11-23 09:12:26 +00:00
|
|
|
function _conferenceJoined({ dispatch }: IStore, next: Function, action: AnyAction) {
|
2020-05-20 08:25:31 +00:00
|
|
|
dispatch(hideLobbyScreen());
|
2020-04-15 13:13:43 +00:00
|
|
|
|
|
|
|
return next(action);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finds the loadable avatar URL and updates the participant accordingly.
|
|
|
|
*
|
|
|
|
* @param {Object} store - The Redux store.
|
|
|
|
* @param {Object} participant - The knocking participant.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-11-23 09:12:26 +00:00
|
|
|
function _findLoadableAvatarForKnockingParticipant(store: IStore, { id }: { id: string; }) {
|
2020-11-15 21:33:55 +00:00
|
|
|
const { dispatch, getState } = store;
|
2020-04-15 13:13:43 +00:00
|
|
|
const updatedParticipant = getState()['features/lobby'].knockingParticipants.find(p => p.id === id);
|
2020-05-20 08:25:31 +00:00
|
|
|
const { disableThirdPartyRequests } = getState()['features/base/config'];
|
2020-04-15 13:13:43 +00:00
|
|
|
|
2020-05-20 08:25:31 +00:00
|
|
|
if (!disableThirdPartyRequests && updatedParticipant && !updatedParticipant.loadableAvatarUrl) {
|
2022-11-23 09:12:26 +00:00
|
|
|
getFirstLoadableAvatarUrl(updatedParticipant, store).then((result: { isUsingCORS: boolean; src: string; }) => {
|
2021-12-17 00:16:24 +00:00
|
|
|
if (result) {
|
|
|
|
const { isUsingCORS, src } = result;
|
|
|
|
|
2021-11-24 11:05:27 +00:00
|
|
|
dispatch(
|
|
|
|
participantIsKnockingOrUpdated({
|
2021-12-17 00:16:24 +00:00
|
|
|
loadableAvatarUrl: src,
|
|
|
|
id,
|
|
|
|
isUsingCORS
|
2021-11-24 11:05:27 +00:00
|
|
|
})
|
|
|
|
);
|
2020-04-15 13:13:43 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2020-07-06 14:54:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check the endpoint message that arrived through the conference and
|
|
|
|
* sends a lobby notification, if the message belongs to the feature.
|
|
|
|
*
|
|
|
|
* @param {Object} origin - The origin (initiator) of the message.
|
|
|
|
* @param {Object} message - The actual message.
|
|
|
|
* @param {Object} store - The Redux store.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-11-23 09:12:26 +00:00
|
|
|
function _maybeSendLobbyNotification(origin: any, message: any, { dispatch, getState }: IStore) {
|
2020-07-06 14:54:33 +00:00
|
|
|
if (!origin?._id || message?.type !== 'lobby-notify') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-11-23 09:12:26 +00:00
|
|
|
const notificationProps: INotificationProps = {
|
2020-07-06 14:54:33 +00:00
|
|
|
descriptionArguments: {
|
2020-07-20 16:32:51 +00:00
|
|
|
originParticipantName: getParticipantDisplayName(getState, origin._id),
|
|
|
|
targetParticipantName: message.name
|
2020-07-06 14:54:33 +00:00
|
|
|
},
|
|
|
|
titleKey: 'lobby.notificationTitle'
|
|
|
|
};
|
|
|
|
|
|
|
|
switch (message.event) {
|
|
|
|
case 'LOBBY-ENABLED':
|
|
|
|
notificationProps.descriptionKey = `lobby.notificationLobby${message.value ? 'En' : 'Dis'}abled`;
|
|
|
|
break;
|
|
|
|
case 'LOBBY-ACCESS-GRANTED':
|
|
|
|
notificationProps.descriptionKey = 'lobby.notificationLobbyAccessGranted';
|
|
|
|
break;
|
|
|
|
case 'LOBBY-ACCESS-DENIED':
|
|
|
|
notificationProps.descriptionKey = 'lobby.notificationLobbyAccessDenied';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-11-24 11:05:27 +00:00
|
|
|
dispatch(
|
|
|
|
showNotification(
|
|
|
|
notificationProps,
|
|
|
|
isTestModeEnabled(getState()) ? NOTIFICATION_TIMEOUT_TYPE.STICKY : NOTIFICATION_TIMEOUT_TYPE.MEDIUM
|
|
|
|
)
|
|
|
|
);
|
2020-07-06 14:54:33 +00:00
|
|
|
}
|