77c6c42c94
Both SettingsCookieService and DarkModeCookieService now call window.DeepDrftSettings.setCookie (new Interop/settings/settings.ts) instead of eval. New tests cover SettingsServiceBase parse/format round-trip and the PreferenceAwareStreamingPlayerService invariant (Lossless skips probe; LowData inherits base).
20 lines
592 B
C#
20 lines
592 B
C#
using DeepDrftPublic.Client.Common;
|
|
using Microsoft.JSInterop;
|
|
|
|
namespace DeepDrftPublic.Client.Services;
|
|
|
|
public class DarkModeCookieService(DarkModeSettings darkModeSetting, IJSRuntime js) : DarkModeServiceBase
|
|
{
|
|
private const int EXPIRY_DAYS = 365;
|
|
|
|
public bool GetDarkMode()
|
|
{
|
|
return darkModeSetting.IsDarkMode;
|
|
}
|
|
|
|
public async ValueTask SetDarkModeAsync(bool isDarkMode)
|
|
{
|
|
await js.InvokeVoidAsync("DeepDrftSettings.setCookie", COOKIE_NAME, isDarkMode.ToString().ToLower(), EXPIRY_DAYS);
|
|
darkModeSetting.IsDarkMode = isDarkMode;
|
|
}
|
|
} |