refactor: extract UIConfigService and ProxyConfigService (#142)

Continue ConfigService split with UI and proxy-related settings.
Uses delegation pattern for backward compatibility.

Co-authored-by: admin <admin@ardentleatherworks.com>
This commit is contained in:
Cody Kickertz 2025-12-23 11:40:18 -06:00 committed by GitHub
parent 7fd12125ed
commit a567eb870d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,16 @@
using NzbDrone.Common.Http.Proxy;
namespace NzbDrone.Core.Configuration
{
public interface IProxyConfigService
{
bool ProxyEnabled { get; }
ProxyType ProxyType { get; }
string ProxyHostname { get; }
int ProxyPort { get; }
string ProxyUsername { get; }
string ProxyPassword { get; }
string ProxyBypassFilter { get; }
bool ProxyBypassLocalAddresses { get; }
}
}

View file

@ -0,0 +1,16 @@
namespace NzbDrone.Core.Configuration
{
public interface IUIConfigService
{
int FirstDayOfWeek { get; set; }
string CalendarWeekColumnHeader { get; set; }
MovieRuntimeFormatType MovieRuntimeFormat { get; set; }
string ShortDateFormat { get; set; }
string LongDateFormat { get; set; }
string TimeFormat { get; set; }
bool ShowRelativeDates { get; set; }
bool EnableColorImpairedMode { get; set; }
int MovieInfoLanguage { get; set; }
int UILanguage { get; set; }
}
}

View file

@ -0,0 +1,30 @@
using NzbDrone.Common.Http.Proxy;
namespace NzbDrone.Core.Configuration
{
public class ProxyConfigService : IProxyConfigService
{
private readonly IConfigService _configService;
public ProxyConfigService(IConfigService configService)
{
_configService = configService;
}
public bool ProxyEnabled => _configService.ProxyEnabled;
public ProxyType ProxyType => _configService.ProxyType;
public string ProxyHostname => _configService.ProxyHostname;
public int ProxyPort => _configService.ProxyPort;
public string ProxyUsername => _configService.ProxyUsername;
public string ProxyPassword => _configService.ProxyPassword;
public string ProxyBypassFilter => _configService.ProxyBypassFilter;
public bool ProxyBypassLocalAddresses => _configService.ProxyBypassLocalAddresses;
}
}

View file

@ -0,0 +1,72 @@
namespace NzbDrone.Core.Configuration
{
public class UIConfigService : IUIConfigService
{
private readonly IConfigService _configService;
public UIConfigService(IConfigService configService)
{
_configService = configService;
}
public int FirstDayOfWeek
{
get => _configService.FirstDayOfWeek;
set => _configService.FirstDayOfWeek = value;
}
public string CalendarWeekColumnHeader
{
get => _configService.CalendarWeekColumnHeader;
set => _configService.CalendarWeekColumnHeader = value;
}
public MovieRuntimeFormatType MovieRuntimeFormat
{
get => _configService.MovieRuntimeFormat;
set => _configService.MovieRuntimeFormat = value;
}
public string ShortDateFormat
{
get => _configService.ShortDateFormat;
set => _configService.ShortDateFormat = value;
}
public string LongDateFormat
{
get => _configService.LongDateFormat;
set => _configService.LongDateFormat = value;
}
public string TimeFormat
{
get => _configService.TimeFormat;
set => _configService.TimeFormat = value;
}
public bool ShowRelativeDates
{
get => _configService.ShowRelativeDates;
set => _configService.ShowRelativeDates = value;
}
public bool EnableColorImpairedMode
{
get => _configService.EnableColorImpairedMode;
set => _configService.EnableColorImpairedMode = value;
}
public int MovieInfoLanguage
{
get => _configService.MovieInfoLanguage;
set => _configService.MovieInfoLanguage = value;
}
public int UILanguage
{
get => _configService.UILanguage;
set => _configService.UILanguage = value;
}
}
}