From 681782ed205b2da7a88ac1e08654ed74d3b53fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Tue, 2 Jul 2019 12:59:25 +0100 Subject: [PATCH] Adds back talk while muted notification. (#4392) * Adds back talk while muted notification. * Adds unmute button to the notification. --- conference.js | 24 +++++++++++++++++++++--- lang/main.json | 1 + 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/conference.js b/conference.js index b06a798a3..eabbaf451 100644 --- a/conference.js +++ b/conference.js @@ -78,7 +78,10 @@ import { setVideoAvailable, setVideoMuted } from './react/features/base/media'; -import { showNotification } from './react/features/notifications'; +import { + hideNotification, + showNotification +} from './react/features/notifications'; import { dominantSpeakerChanged, getLocalParticipant, @@ -1776,14 +1779,29 @@ export default { APP.UI.setAudioLevel(id, newLvl); }); - room.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED, (_, participantThatMutedUs) => { + // we store the last start muted notification id that we showed, + // so we can hide it when unmuted mic is detected + let lastNotificationId; + + room.on(JitsiConferenceEvents.TRACK_MUTE_CHANGED, (track, participantThatMutedUs) => { if (participantThatMutedUs) { APP.store.dispatch(participantMutedUs(participantThatMutedUs)); } + + if (lastNotificationId && track.isAudioTrack() && track.isLocal() && !track.isMuted()) { + APP.store.dispatch(hideNotification(lastNotificationId)); + lastNotificationId = undefined; + } }); room.on(JitsiConferenceEvents.TALK_WHILE_MUTED, () => { - APP.UI.showToolbar(6000); + const action = APP.store.dispatch(showNotification({ + titleKey: 'toolbar.talkWhileMutedPopup', + customActionNameKey: 'notify.unmute', + customActionHandler: muteLocalAudio.bind(this, false) + })); + + lastNotificationId = action.uid; }); room.on(JitsiConferenceEvents.SUBJECT_CHANGED, subject => APP.store.dispatch(conferenceSubjectChanged(subject))); diff --git a/lang/main.json b/lang/main.json index 9f88e7875..db11f654f 100644 --- a/lang/main.json +++ b/lang/main.json @@ -488,6 +488,7 @@ "startSilentDescription": "Rejoin the meeting to enable audio", "suboptimalExperienceDescription": "Eer... we are afraid your experience with __appName__ isn't going to be that great here. We are looking for ways to improve this but, until then, please try using one of the fully supported browsers.", "suboptimalExperienceTitle": "Browser Warning", + "unmute": "Unmute", "newDeviceCameraTitle": "New camera detected", "newDeviceAudioTitle": "New audio device detected", "newDeviceAction": "Use"