* move dark/light mode toggle to ui settings page * separate current culture (formatting) and ui culture (language) * add some more sample translations * update changelog * fix cancellation token
26 lines
907 B
C#
26 lines
907 B
C#
using ErsatzTV.Core.Domain;
|
|
using ErsatzTV.Core.Interfaces.Repositories;
|
|
|
|
namespace ErsatzTV.Application.Configuration;
|
|
|
|
public class GetUiSettingsHandler(IConfigElementRepository configElementRepository)
|
|
: IRequestHandler<GetUiSettings, UiSettingsViewModel>
|
|
{
|
|
public async Task<UiSettingsViewModel> Handle(GetUiSettings request, CancellationToken cancellationToken)
|
|
{
|
|
Option<bool> pagesIsDarkMode = await configElementRepository.GetValue<bool>(
|
|
ConfigElementKey.PagesIsDarkMode,
|
|
cancellationToken);
|
|
|
|
Option<string> pagesLanguage = await configElementRepository.GetValue<string>(
|
|
ConfigElementKey.PagesLanguage,
|
|
cancellationToken);
|
|
|
|
return new UiSettingsViewModel
|
|
{
|
|
IsDarkMode = await pagesIsDarkMode.IfNoneAsync(true),
|
|
Language = await pagesLanguage.IfNoneAsync("en")
|
|
};
|
|
}
|
|
}
|