From ec55cf2f113797d2958d5cad01e5f6adc705cda7 Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Thu, 31 Jul 2025 03:28:08 -0500 Subject: [PATCH] Added AppSettings Added AppSettings for FreeTubeSyncer. --- FreeTubeSyncer/Models/AppSetting.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 FreeTubeSyncer/Models/AppSetting.cs diff --git a/FreeTubeSyncer/Models/AppSetting.cs b/FreeTubeSyncer/Models/AppSetting.cs new file mode 100644 index 0000000..220dbbc --- /dev/null +++ b/FreeTubeSyncer/Models/AppSetting.cs @@ -0,0 +1,27 @@ +using System.Text.Json.Serialization; +using CommunityToolkit.Mvvm.ComponentModel; + +namespace FreeTubeSyncer.Models; + +public partial class AppSettings : ObservableObject +{ + [ObservableProperty] [property: JsonInclude] private string _restBaseUrl = "http://127.0.0.1:8080"; + [ObservableProperty] [property: JsonInclude] private int _checkInterval = 30; + [ObservableProperty] [property: JsonInclude] private bool _syncHistory = true; + [ObservableProperty] [property: JsonInclude] private bool _syncPlaylist = true; + [ObservableProperty] [property: JsonInclude] private bool _syncProfile = true; + [ObservableProperty] [property: JsonInclude] private bool _syncSearchHistory = true; + [ObservableProperty] [property: JsonInclude] private bool _syncSettings = true; + [ObservableProperty] [property: JsonIgnore] private bool _settingsDirty = false; + + public AppSettings() + { + PropertyChanged += (sender, args) => + { + if (args.PropertyName == nameof(SettingsDirty)) + return; + + SettingsDirty = true; + }; + } +} \ No newline at end of file