diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 1f138e843e8..895a8292d57 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 f70c4559b38..370662adb17 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -174,6 +174,8 @@ public string SettingWindowFont 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 1ca3ce2c637..09f9b9fba86 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -70,7 +70,11 @@ public App() .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 8c7670426bb..3d27986773a 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 a51782f4040..d64357ff15b 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -460,6 +460,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 da47c9cbe07..191755050c7 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 @@ public string GithubRepo { 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 800c3cf639f..59f626477e2 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 302987e6ddf..494646dfc20 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs @@ -52,6 +52,16 @@ public string CacheFolderSize }; 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 4801caa365c..337d4ce8178 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -36,10 +36,6 @@ -