Use a 3-way theme switcher instead of a 2-way switcher (#1233)

This commit is contained in:
Oleksii Holub
2024-05-13 23:56:21 +03:00
committed by GitHub
parent 9e7ad4d85c
commit 7a69c87b56
12 changed files with 106 additions and 116 deletions

View File

@@ -1,12 +1,10 @@
using System;
using System.IO;
using Avalonia;
using Avalonia.Platform;
using Cogwheel;
using CommunityToolkit.Mvvm.ComponentModel;
using DiscordChatExporter.Core.Exporting;
using DiscordChatExporter.Gui.Framework;
using DiscordChatExporter.Gui.Models;
using Microsoft.Win32;
namespace DiscordChatExporter.Gui.Services;
@@ -18,10 +16,10 @@ public partial class SettingsService()
private bool _isUkraineSupportMessageEnabled = true;
[ObservableProperty]
private bool _isAutoUpdateEnabled = true;
private ThemeVariant _theme;
[ObservableProperty]
private bool _isDarkModeEnabled;
private bool _isAutoUpdateEnabled = true;
[ObservableProperty]
private bool _isTokenPersisted = true;
@@ -62,17 +60,6 @@ public partial class SettingsService()
[ObservableProperty]
private string? _lastAssetsDirPath;
public override void Reset()
{
base.Reset();
// Reset the dark mode setting separately because its default value is evaluated dynamically
// and cannot be set by the field initializer.
IsDarkModeEnabled =
Application.Current?.PlatformSettings?.GetColorValues().ThemeVariant
== PlatformThemeVariant.Dark;
}
public override void Save()
{
// Clear the token if it's not supposed to be persisted