fix(conference.js): Add message listeners only when chat is enabled

This commit is contained in:
yanas 2017-09-18 15:37:58 -05:00
parent 088fe87e31
commit 984085ac54
1 changed files with 22 additions and 15 deletions

View File

@ -72,7 +72,10 @@ import {
mediaPermissionPromptVisibilityChanged, mediaPermissionPromptVisibilityChanged,
suspendDetected suspendDetected
} from './react/features/overlay'; } from './react/features/overlay';
import { showDesktopSharingButton } from './react/features/toolbox'; import {
isButtonEnabled,
showDesktopSharingButton
} from './react/features/toolbox';
const { participantConnectionStatus } = JitsiMeetJS.constants; const { participantConnectionStatus } = JitsiMeetJS.constants;
@ -366,7 +369,8 @@ class ConferenceConnector {
logger.error('CONFERENCE Error:', err, params); logger.error('CONFERENCE Error:', err, params);
switch (err) { switch (err) {
case ConferenceErrors.CHAT_ERROR: case ConferenceErrors.CHAT_ERROR:
{ logger.error("Chat error.", err);
if (isButtonEnabled('chat')) {
let [code, msg] = params; let [code, msg] = params;
APP.UI.showChatError(code, msg); APP.UI.showChatError(code, msg);
} }
@ -1737,6 +1741,8 @@ export default {
room.on(ConferenceEvents.CONNECTION_RESTORED, () => { room.on(ConferenceEvents.CONNECTION_RESTORED, () => {
APP.UI.markVideoInterrupted(false); APP.UI.markVideoInterrupted(false);
}); });
if (isButtonEnabled('chat')) {
room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => { room.on(ConferenceEvents.MESSAGE_RECEIVED, (id, body, ts) => {
let nick = getDisplayName(id); let nick = getDisplayName(id);
APP.API.notifyReceivedChatMessage({ APP.API.notifyReceivedChatMessage({
@ -1751,6 +1757,7 @@ export default {
APP.API.notifySendingChatMessage(message); APP.API.notifySendingChatMessage(message);
room.sendTextMessage(message); room.sendTextMessage(message);
}); });
}
APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, (id) => { APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, (id) => {
try { try {