feat(Mute_Participant): Implement warning dialog for muting remote participant
This commit is contained in:
parent
0bb772d242
commit
09c8e14465
|
@ -283,6 +283,7 @@
|
||||||
"stopLiveStreaming": "Stop live streaming",
|
"stopLiveStreaming": "Stop live streaming",
|
||||||
"stopRecording": "Stop recording",
|
"stopRecording": "Stop recording",
|
||||||
"doNotShowWarningAgain": "Don't show this warning again",
|
"doNotShowWarningAgain": "Don't show this warning again",
|
||||||
|
"doNotShowMessageAgain": "Don't show this message again",
|
||||||
"permissionDenied": "Permission Denied",
|
"permissionDenied": "Permission Denied",
|
||||||
"screenSharingPermissionDeniedError": "You have not granted permission to share your screen.",
|
"screenSharingPermissionDeniedError": "You have not granted permission to share your screen.",
|
||||||
"micErrorPresent": "There was an error connecting to your microphone.",
|
"micErrorPresent": "There was an error connecting to your microphone.",
|
||||||
|
@ -300,7 +301,10 @@
|
||||||
"cameraNotSendingData": "We are unable to access your camera. Please check if another application is using this device, select another device from the settings menu or try to restart the application.",
|
"cameraNotSendingData": "We are unable to access your camera. Please check if another application is using this device, select another device from the settings menu or try to restart the application.",
|
||||||
"goToStore": "Go to the webstore",
|
"goToStore": "Go to the webstore",
|
||||||
"externalInstallationTitle": "Extension required",
|
"externalInstallationTitle": "Extension required",
|
||||||
"externalInstallationMsg": "You need to install our desktop sharing extension."
|
"externalInstallationMsg": "You need to install our desktop sharing extension.",
|
||||||
|
"muteParticipantTitle": "Mute this participant?",
|
||||||
|
"muteParticipantBody": "You won't be able to unmute them, but they can unmute themselves at any time.",
|
||||||
|
"muteParticipantButton": "Mute"
|
||||||
},
|
},
|
||||||
"email":
|
"email":
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,11 @@ import UIUtils from "../util/UIUtil";
|
||||||
import UIEvents from '../../../service/UI/UIEvents';
|
import UIEvents from '../../../service/UI/UIEvents';
|
||||||
import JitsiPopover from "../util/JitsiPopover";
|
import JitsiPopover from "../util/JitsiPopover";
|
||||||
|
|
||||||
|
const MUTED_DIALOG_BUTTON_VALUES = {
|
||||||
|
cancel: 0,
|
||||||
|
muted: 1
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new instance of the <tt>RemoteVideo</tt>.
|
* Creates new instance of the <tt>RemoteVideo</tt>.
|
||||||
* @param user {JitsiParticipant} the user for whom remote video instance will
|
* @param user {JitsiParticipant} the user for whom remote video instance will
|
||||||
|
@ -130,15 +135,21 @@ RemoteVideo.prototype._generatePopupContent = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delegate event to the document.
|
// Delegate event to the document.
|
||||||
$(document).on("click", "#mutelink_" + this.id, function(){
|
$(document).on("click", "#mutelink_" + this.id, () => {
|
||||||
|
|
||||||
if (this.isAudioMuted)
|
if (this.isAudioMuted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.emitter.emit(UIEvents.REMOTE_AUDIO_MUTED, this.id);
|
RemoteVideo.showMuteParticipantDialog().then(reason => {
|
||||||
|
if(reason === MUTED_DIALOG_BUTTON_VALUES.muted) {
|
||||||
|
this.emitter.emit(UIEvents.REMOTE_AUDIO_MUTED, this.id);
|
||||||
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
//currently shouldn't be called
|
||||||
|
console.error(e);
|
||||||
|
});
|
||||||
|
|
||||||
this.popover.forceHide();
|
this.popover.forceHide();
|
||||||
}.bind(this));
|
});
|
||||||
|
|
||||||
muteMenuItem.appendChild(muteLinkItem);
|
muteMenuItem.appendChild(muteLinkItem);
|
||||||
popupmenuElement.appendChild(muteMenuItem);
|
popupmenuElement.appendChild(muteMenuItem);
|
||||||
|
@ -570,4 +581,47 @@ RemoteVideo.createContainer = function (spanId) {
|
||||||
return remotes.appendChild(container);
|
return remotes.appendChild(container);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows 2 button dialog for confirmation from the user for muting remote
|
||||||
|
* participant.
|
||||||
|
*/
|
||||||
|
RemoteVideo.showMuteParticipantDialog = function () {
|
||||||
|
//FIXME: don't show again checkbox is implemented very dirty. we should add
|
||||||
|
// this functionality to MessageHandler class.
|
||||||
|
if (window.localStorage
|
||||||
|
&& window.localStorage.getItem(
|
||||||
|
"dontShowMuteParticipantDialog") === "true") {
|
||||||
|
return Promise.resolve(MUTED_DIALOG_BUTTON_VALUES.muted);
|
||||||
|
}
|
||||||
|
let msgString =
|
||||||
|
`<div data-i18n="dialog.muteParticipantBody"></div>
|
||||||
|
<br />
|
||||||
|
<label>
|
||||||
|
<input type='checkbox' checked id='doNotShowMessageAgain' />
|
||||||
|
<span data-i18n='dialog.doNotShowMessageAgain'></span>
|
||||||
|
</label>`;
|
||||||
|
return new Promise(resolve => {
|
||||||
|
APP.UI.messageHandler.openTwoButtonDialog({
|
||||||
|
titleKey : "dialog.muteParticipantTitle",
|
||||||
|
msgString,
|
||||||
|
leftButtonKey: 'dialog.muteParticipantButton',
|
||||||
|
submitFunction: () => {
|
||||||
|
if(window.localStorage) {
|
||||||
|
let form = $.prompt.getPrompt();
|
||||||
|
if (form) {
|
||||||
|
let input = form.find("#doNotShowMessageAgain");
|
||||||
|
if (input.length) {
|
||||||
|
window.localStorage.setItem(
|
||||||
|
"dontShowMuteParticipantDialog",
|
||||||
|
input.prop("checked"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resolve(MUTED_DIALOG_BUTTON_VALUES.muted);
|
||||||
|
},
|
||||||
|
closeFunction: () => resolve(MUTED_DIALOG_BUTTON_VALUES.cancel)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
export default RemoteVideo;
|
export default RemoteVideo;
|
||||||
|
|
Loading…
Reference in New Issue