diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 3f64b273e4c..28232dc6581 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -22,18 +22,20 @@ namespace Flow.Launcher.Core { public class Updater { - public string GitHubRepository { get; } + public bool UpdateToPrerelease { get; set; } + + public const string ReleaseRepository = "https://github.com/Flow-Launcher/Flow.Launcher"; + public const string PrereleaseRepository = "https://github.com/Flow-Launcher/Prereleases"; + + public string GitHubRepository => UpdateToPrerelease ? PrereleaseRepository : ReleaseRepository; - public Updater(string gitHubRepository) - { - GitHubRepository = gitHubRepository; - } private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1); public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) { await UpdateLock.WaitAsync().ConfigureAwait(false); + try { if (!silentUpdate) @@ -54,6 +56,7 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) { if (!silentUpdate) MessageBox.Show(api.GetTranslation("update_flowlauncher_already_on_latest")); + return; } @@ -94,7 +97,7 @@ public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true) Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e); else Log.Exception($"|Updater.UpdateApp|Error Occurred", e); - + if (!silentUpdate) api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"), api.GetTranslation("update_flowlauncher_check_connection")); @@ -134,6 +137,7 @@ private async Task GitHubUpdateManagerAsync(string repository) { Proxy = Http.WebProxy }; + var downloader = new FileDownloader(client); var manager = new UpdateManager(latestUrl, urlDownloader: downloader); diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 7f62d82c8ef..85c1c3c8659 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -64,8 +64,10 @@ public string Theme public double SettingWindowHeight { get; set; } = 700; public double SettingWindowTop { get; set; } public double SettingWindowLeft { get; set; } - public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal; + public WindowState SettingWindowState { get; set; } = WindowState.Normal; + public bool PrereleaseUpdateSource { get; set; } + public int CustomExplorerIndex { get; set; } = 0; [JsonIgnore] @@ -253,8 +255,8 @@ public bool HideNotifyIcon [JsonConverter(typeof(JsonStringEnumConverter))] public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected; - - + + // This needs to be loaded last by staying at the bottom public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); } diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 1d398276d3c..838eead1cda 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -29,7 +29,7 @@ public partial class App : IDisposable, ISingleInstanceApp private Settings _settings; private MainViewModel _mainVM; private SettingWindowViewModel _settingsVM; - private readonly Updater _updater = new Updater(Flow.Launcher.Properties.Settings.Default.GithubRepo); + private readonly Updater _updater = new(); private readonly Portable _portable = new Portable(); private readonly PinyinAlphabet _alphabet = new PinyinAlphabet(); private StringMatcher _stringMatcher; @@ -59,7 +59,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () => RegisterDispatcherUnhandledException(); ImageLoader.Initialize(); - + _settingsVM = new SettingWindowViewModel(_updater, _portable); _settings = _settingsVM.Settings; diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 103d523a798..f2dea3597d8 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -234,6 +234,9 @@ Clear Logs Are you sure you want to delete all logs? Wizard + Release Channel + Stable + Pre-release Select File Manager 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/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 665d16b8f8e..9107fdc8cfc 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -693,7 +693,7 @@ - @@ -720,7 +720,7 @@ -  +  - +