diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 258a5951d..5db2c2d14 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -25,14 +25,16 @@ namespace Flow.Launcher.Core public string GitHubReleaseRepository { get; } public string GitHubPrereleaseRepository { get; } - public bool UpdateToPrerelease { get; set; } + public bool UpdateToPrerelease => _settings.PrereleaseUpdateSource; public string GitHubRepository => UpdateToPrerelease ? GitHubPrereleaseRepository : GitHubReleaseRepository; + private readonly Settings _settings; private readonly IPublicAPI _api; - public Updater(IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository) + public Updater(Settings settings, IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository) { + _settings = settings; _api = publicAPI; GitHubReleaseRepository = gitHubReleaseRepository; GitHubPrereleaseRepository = gitHubPrereleaseRepository; diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 058a00662..c77463dd2 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -55,7 +55,11 @@ namespace Flow.Launcher .UseContentRoot(AppContext.BaseDirectory) .ConfigureServices(services => services .AddSingleton(_ => _settings) - .AddSingleton(sp => new Updater(sp.GetRequiredService(), Launcher.Properties.Settings.Default.GithubRepo, Launcher.Properties.Settings.Default.PrereleaseRepo)) + .AddSingleton(sp => new Updater( + _settings, + sp.GetRequiredService(), + Launcher.Properties.Settings.Default.GithubRepo, + Launcher.Properties.Settings.Default.PrereleaseRepo)) .AddSingleton() .AddSingleton() .AddSingleton() diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs index ade650284..216035029 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs @@ -45,6 +45,16 @@ public partial class SettingsPaneAboutViewModel : BaseModel _settings.ActivateTimes ); + public int PrereleaseSelectedIndex + { + get => _settings.PrereleaseUpdateSource ? 1 : 0; + set + { + _settings.PrereleaseUpdateSource = value == 1; + OnPropertyChanged(); + } + } + public SettingsPaneAboutViewModel(Settings settings, Updater updater) { _settings = settings; diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml index e33fee02b..a3b3cf533 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -31,10 +31,6 @@ Icon="" Sub="{DynamicResource version}"> -