diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 1f138e843..895a8292d 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -21,16 +21,24 @@ namespace Flow.Launcher.Core { public class Updater { - public string GitHubRepository { get; init; } + public string GitHubReleaseRepository { get; } + public string GitHubPrereleaseRepository { get; } private static readonly string ClassName = nameof(Updater); + public bool UpdateToPrerelease => _settings.PrereleaseUpdateSource; + + public string GitHubRepository => UpdateToPrerelease ? GitHubPrereleaseRepository : GitHubReleaseRepository; + + private readonly Settings _settings; private readonly IPublicAPI _api; - public Updater(IPublicAPI publicAPI, string gitHubRepository) + public Updater(Settings settings, IPublicAPI publicAPI, string gitHubReleaseRepository, string gitHubPrereleaseRepository) { + _settings = settings; _api = publicAPI; - GitHubRepository = gitHubRepository; + GitHubReleaseRepository = gitHubReleaseRepository; + GitHubPrereleaseRepository = gitHubPrereleaseRepository; } private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1); diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 7524d6c1a..43bffe80c 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -175,6 +175,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings public double? SettingWindowLeft { get; set; } = null; public WindowState SettingWindowState { get; set; } = WindowState.Normal; + public bool PrereleaseUpdateSource { get; set; } + private bool _showPlaceholder { get; set; } = true; public bool ShowPlaceholder { diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index da11380b8..5a0ad8090 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -70,7 +70,11 @@ namespace Flow.Launcher .UseContentRoot(AppContext.BaseDirectory) .ConfigureServices(services => services .AddSingleton(_ => _settings) - .AddSingleton(sp => new Updater(sp.GetRequiredService(), Launcher.Properties.Settings.Default.GithubRepo)) + .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/Flow.Launcher.csproj b/Flow.Launcher/Flow.Launcher.csproj index 576bf6f2f..30d122be5 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -171,6 +171,18 @@ + + + True + True + Settings.settings + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + PreserveNewest diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1b2b01ef8..0bf017e17 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -473,6 +473,9 @@ Are you sure you want to delete all caches? Failed to clear part of folders and files. Please see log file for more information Wizard + Release Channel + Stable + Pre-release User Data Location User settings and installed plugins are saved in the user data folder. This location may vary depending on whether it's in portable mode or not. Open Folder diff --git a/Flow.Launcher/Properties/Settings.Designer.cs b/Flow.Launcher/Properties/Settings.Designer.cs index da47c9cbe..191755050 100644 --- a/Flow.Launcher/Properties/Settings.Designer.cs +++ b/Flow.Launcher/Properties/Settings.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -12,7 +12,7 @@ namespace Flow.Launcher.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -31,5 +31,14 @@ namespace Flow.Launcher.Properties { return ((string)(this["GithubRepo"])); } } + + [global::System.Configuration.ApplicationScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("https://github.com/Flow-Launcher/Prereleases")] + public string PrereleaseRepo { + get { + return ((string)(this["PrereleaseRepo"])); + } + } } } diff --git a/Flow.Launcher/Properties/Settings.settings b/Flow.Launcher/Properties/Settings.settings index 800c3cf63..59f626477 100644 --- a/Flow.Launcher/Properties/Settings.settings +++ b/Flow.Launcher/Properties/Settings.settings @@ -5,5 +5,8 @@ https://github.com/Flow-Launcher/Flow.Launcher + + https://github.com/Flow-Launcher/Prereleases + \ No newline at end of file diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs index 302987e6d..494646dfc 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs @@ -52,6 +52,16 @@ public partial class SettingsPaneAboutViewModel : BaseModel }; public string ActivatedTimes => Localize.about_activate_times(_settings.ActivateTimes); + + public int PrereleaseSelectedIndex + { + get => _settings.PrereleaseUpdateSource ? 1 : 0; + set + { + _settings.PrereleaseUpdateSource = value == 1; + OnPropertyChanged(); + } + } public class LogLevelData : DropdownDataGeneric { } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml index 4801caa36..337d4ce81 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -36,10 +36,6 @@ -