diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index bc3655f69e7..700b1efbc43 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); @@ -102,7 +110,7 @@ public async Task UpdateAppAsync(bool silentUpdate = true) { _api.LogException(ClassName, $"Error Occurred", e); } - + if (!silentUpdate) _api.ShowMsg(_api.GetTranslation("update_flowlauncher_fail"), _api.GetTranslation("update_flowlauncher_check_connection")); diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 0a6429e07d8..887da29f53f 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -134,6 +134,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 59e8cac202c..05c5723f379 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -75,7 +75,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 d75d15a217e..f46a595ed64 100644 --- a/Flow.Launcher/Flow.Launcher.csproj +++ b/Flow.Launcher/Flow.Launcher.csproj @@ -123,6 +123,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 f22afb20775..446d176c5e8 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -356,6 +356,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 1efc8997204..c3c6b4a7282 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneAboutViewModel.cs @@ -55,7 +55,17 @@ public string CacheFolderSize App.API.GetTranslation("about_activate_times"), _settings.ActivateTimes ); - + + public int PrereleaseSelectedIndex + { + get => _settings.PrereleaseUpdateSource ? 1 : 0; + set + { + _settings.PrereleaseUpdateSource = value == 1; + OnPropertyChanged(); + } + } + public class LogLevelData : DropdownDataGeneric { } public List LogLevels { get; } = diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml index 5710138c0f5..b9b8c7bffc8 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml @@ -36,10 +36,6 @@ Icon="" Sub="{DynamicResource version}"> -