SEBWIN-448: Fixed mapping error for proctoring settings.

This commit is contained in:
Damian Büchel 2021-03-26 15:55:13 +01:00
parent 28ee48f433
commit d4f9a9cc17
2 changed files with 20 additions and 13 deletions

View file

@ -6,8 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
using System;
using System.Collections.Generic;
using SafeExamBrowser.Settings;
using SafeExamBrowser.Settings.Proctoring;
@ -19,6 +17,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
{
switch (key)
{
case Keys.Proctoring.JitsiMeet.Enabled:
MapJitsiMeetEnabled(settings, value);
break;
case Keys.Proctoring.JitsiMeet.RoomName:
MapJitsiMeetRoomName(settings, value);
break;
@ -37,20 +38,18 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
case Keys.Proctoring.WindowVisibility:
MapWindowVisibility(settings, value);
break;
case Keys.Proctoring.Zoom.Enabled:
MapZoomEnabled(settings, value);
break;
}
}
internal override void MapGlobal(IDictionary<string, object> rawData, AppSettings settings)
private void MapJitsiMeetEnabled(AppSettings settings, object value)
{
MapProctoringEnabled(rawData, settings);
}
private void MapProctoringEnabled(IDictionary<string, object> rawData, AppSettings settings)
{
var jitsiEnabled = rawData.TryGetValue(Keys.Proctoring.JitsiMeet.Enabled, out var v) && v is bool b && b;
var zoomEnabled = rawData.TryGetValue(Keys.Proctoring.Zoom.Enabled, out v) && v is bool b2 && b2;
settings.Proctoring.Enabled = jitsiEnabled || zoomEnabled;
if (value is bool enabled)
{
settings.Proctoring.JitsiMeet.Enabled = enabled;
}
}
private void MapJitsiMeetRoomName(AppSettings settings, object value)
@ -119,5 +118,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
}
}
}
private void MapZoomEnabled(AppSettings settings, object value)
{
if (value is bool enabled)
{
settings.Proctoring.Zoom.Enabled = enabled;
}
}
}
}

View file

@ -61,7 +61,7 @@ namespace SafeExamBrowser.UserInterface.Desktop.Windows
public void SetTitle(string title)
{
Dispatcher.Invoke(() => Title = title);
Dispatcher.Invoke(() => Title = title ?? "");
}
public new void Show()