feature: Phase 18.6 Track A — public Settings menu + streaming-quality toggle
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using DeepDrftPublic.Client.Common;
|
||||
using DeepDrftPublic.Client.Services;
|
||||
|
||||
namespace DeepDrftPublic.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Server-side prerender reader for public-site listener settings (Phase 18 wave 18.6), the sibling of
|
||||
/// <see cref="DarkModeService"/>. Reads each preference's cookie via <see cref="IHttpContextAccessor"/>
|
||||
/// during prerender and seeds the scoped <see cref="PublicSiteSettings"/>, which <c>MainLayout</c> then
|
||||
/// rounds through <c>PersistentComponentState</c> into WASM — so the first paint already reflects the
|
||||
/// listener's choice with no wrong-default flash (the streaming-quality analogue of the wrong-theme fix).
|
||||
/// Inherits the shared cookie names + parsers from <see cref="SettingsServiceBase"/> so the server read and
|
||||
/// the client write agree on one wire format.
|
||||
/// </summary>
|
||||
public class SettingsService(PublicSiteSettings settings, IHttpContextAccessor httpAccessor) : SettingsServiceBase
|
||||
{
|
||||
public void CheckSettings()
|
||||
{
|
||||
var cookies = httpAccessor.HttpContext?.Request.Cookies;
|
||||
if (cookies is null) return;
|
||||
|
||||
cookies.TryGetValue(StreamQualityCookieName, out var streamQuality);
|
||||
settings.StreamQuality = ParseStreamQuality(streamQuality);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user