diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 3f64b273e..28232dc65 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 @@ namespace Flow.Launcher.Core { if (!silentUpdate) MessageBox.Show(api.GetTranslation("update_flowlauncher_already_on_latest")); + return; } @@ -94,7 +97,7 @@ namespace Flow.Launcher.Core 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 @@ namespace Flow.Launcher.Core { 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 7f62d82c8..85c1c3c86 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -64,8 +64,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings 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 @@ namespace Flow.Launcher.Infrastructure.UserSettings [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 1d398276d..838eead1c 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -29,7 +29,7 @@ namespace Flow.Launcher 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 @@ namespace Flow.Launcher 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 103d523a7..90f55ef41 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 + Update Source + Release + Prerelease Select File Manager 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/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 50fbbd61a..1afe2ad00 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -3058,12 +3058,13 @@ Grid.Column="1" VerticalAlignment="Center" Style="{DynamicResource SettingTitleLabel}" - Text="Update Source" /> + Text="{DynamicResource updateSource}" /> - Release - Preview + +