From 0a2b1670d4a3fffd0f9486718edb30c64bb92e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Wed, 7 Jul 2021 11:31:55 +0200 Subject: [PATCH] SEBWIN-475: Moved leave instruction to window close event. --- SafeExamBrowser.Proctoring/JitsiMeet/index.html | 4 ++++ SafeExamBrowser.Proctoring/ProctoringController.cs | 12 ------------ SafeExamBrowser.Proctoring/Zoom/index.html | 7 ++++--- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/SafeExamBrowser.Proctoring/JitsiMeet/index.html b/SafeExamBrowser.Proctoring/JitsiMeet/index.html index 7b59f836..8c8da4da 100644 --- a/SafeExamBrowser.Proctoring/JitsiMeet/index.html +++ b/SafeExamBrowser.Proctoring/JitsiMeet/index.html @@ -57,6 +57,10 @@ } } + window.addEventListener('unload', () => { + api.executeCommand('hangup'); + api.dispose(); + }); window.chrome.webview.addEventListener('message', webMessageReceived); window.chrome.webview.postMessage('credentials'); diff --git a/SafeExamBrowser.Proctoring/ProctoringController.cs b/SafeExamBrowser.Proctoring/ProctoringController.cs index 1842cf47..86c98873 100644 --- a/SafeExamBrowser.Proctoring/ProctoringController.cs +++ b/SafeExamBrowser.Proctoring/ProctoringController.cs @@ -9,7 +9,6 @@ using System; using System.IO; using System.Reflection; -using System.Threading; using System.Windows; using Microsoft.Web.WebView2.Wpf; using SafeExamBrowser.Configuration.Contracts; @@ -215,17 +214,6 @@ namespace SafeExamBrowser.Proctoring { control.Dispatcher.Invoke(() => { - if (settings.JitsiMeet.Enabled) - { - control.ExecuteScriptAsync("api.executeCommand('hangup'); api.dispose();"); - } - else if (settings.Zoom.Enabled) - { - control.ExecuteScriptAsync("ZoomMtg.leaveMeeting({});"); - } - - Thread.Sleep(2000); - window.Close(); control = default(ProctoringControl); window = default(IProctoringWindow); diff --git a/SafeExamBrowser.Proctoring/Zoom/index.html b/SafeExamBrowser.Proctoring/Zoom/index.html index 091b200a..1ebd950c 100644 --- a/SafeExamBrowser.Proctoring/Zoom/index.html +++ b/SafeExamBrowser.Proctoring/Zoom/index.html @@ -17,7 +17,7 @@ var audioJoin = 0; var videoJoin = 0; - function initializeUserInterface(_) { + function controlUserInterface(_) { var audioButton = document.getElementsByClassName('join-audio-by-voip__join-btn')[0]; var audioContainer = document.getElementsByClassName('join-audio-container')[0]; var leave = document.getElementsByClassName('footer__leave-btn-container')[0]; @@ -61,7 +61,7 @@ videoContainer.style.visibility = 'hidden'; } - requestAnimationFrame(initializeUserInterface); + requestAnimationFrame(controlUserInterface); } function startMeeting(credentials) { @@ -136,7 +136,7 @@ alert(`Failed to join meeting: ${JSON.stringify(res)}`); }, success: function (res) { - requestAnimationFrame(initializeUserInterface); + requestAnimationFrame(controlUserInterface); } }); } @@ -149,6 +149,7 @@ } } + window.addEventListener('unload', () => ZoomMtg.leaveMeeting({})); window.chrome.webview.addEventListener('message', webMessageReceived); window.chrome.webview.postMessage('credentials');