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