• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thorstenalpers / CleanMyPosts / 15141113493

20 May 2025 03:04PM UTC coverage: 0.0% (-11.5%) from 11.466%
15141113493

push

github

thorstenalpers
Change test framework

0 of 278 branches covered (0.0%)

Branch coverage included in aggregate %.

0 of 882 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/UI/ViewModels/SettingsViewModel.cs
1
using CleanMyPosts.UI.Contracts.Services;
2
using CleanMyPosts.UI.Contracts.ViewModels;
3
using CleanMyPosts.UI.Models;
4
using CommunityToolkit.Mvvm.ComponentModel;
5
using CommunityToolkit.Mvvm.Input;
6
using Microsoft.Extensions.Logging;
7

8
namespace CleanMyPosts.UI.ViewModels;
9

10
public partial class SettingsViewModel(IThemeSelectorService themeSelectorService,
×
11
    ILogger<SettingsViewModel> logger,
×
12
    IApplicationInfoService applicationInfoService,
×
13
    IAppSettingsService appSettingsService,
×
14
    IUpdateService updateService) : ObservableObject, INavigationAware
×
15
{
16
    private readonly ILogger<SettingsViewModel> _logger = logger ?? throw new ArgumentNullException(nameof(logger));
×
17
    private readonly IThemeSelectorService _themeSelectorService = themeSelectorService ?? throw new ArgumentNullException(nameof(themeSelectorService));
×
18
    private readonly IApplicationInfoService _applicationInfoService = applicationInfoService ?? throw new ArgumentNullException(nameof(applicationInfoService));
×
19
    private readonly IAppSettingsService _appSettingsService = appSettingsService ?? throw new ArgumentNullException(nameof(appSettingsService));
×
20
    private readonly IUpdateService _updateService = updateService ?? throw new ArgumentNullException(nameof(updateService));
×
21

22
    [ObservableProperty]
23
    private AppTheme _theme;
24

25
    [ObservableProperty]
26
    private string _versionDescription;
27

28
    [ObservableProperty]
29
    private bool _showLogs = false;
30

31
    [RelayCommand]
32
    private void SetTheme(string themeName)
33
    {
34
        if (Enum.TryParse<AppTheme>(themeName, out var theme))
×
35
        {
36
            _themeSelectorService.SetTheme(theme);
×
37
        }
38
    }
×
39

40
    [RelayCommand]
41
    private async Task CheckUpdatesAsync()
42
    {
43
        try
44
        {
45
            await _updateService.CheckForUpdatesAsync();
×
46
        }
×
47
        catch (Exception ex)
×
48
        {
49
            _logger.LogError(ex, "Check for updates failed.");
×
50
        }
×
51
    }
×
52

53
    partial void OnShowLogsChanged(bool value)
54
    {
55
        _appSettingsService.SetShowLogs(value);
×
56
    }
×
57

58
    public void OnNavigatedTo(object parameter)
59
    {
60
        VersionDescription = $"{Properties.Resources.AppDisplayName} - {_applicationInfoService.GetVersion()}";
×
61
        Theme = _themeSelectorService.GetCurrentTheme();
×
62
        ShowLogs = _appSettingsService.GetShowLogs();
×
63
    }
×
64
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc