diff --git a/Flow.Launcher.Core/Updater.cs b/Flow.Launcher.Core/Updater.cs index 3036055ba..99d48275a 100644 --- a/Flow.Launcher.Core/Updater.cs +++ b/Flow.Launcher.Core/Updater.cs @@ -16,6 +16,7 @@ using Flow.Launcher.Infrastructure.Http; using Flow.Launcher.Infrastructure.Logger; using System.IO; using Flow.Launcher.Infrastructure.UserSettings; +using Flow.Launcher.Plugin; namespace Flow.Launcher.Core { @@ -28,11 +29,14 @@ namespace Flow.Launcher.Core GitHubRepository = gitHubRepository; } - public async Task UpdateApp(bool silentIfLatestVersion = true) + public async Task UpdateApp(IPublicAPI api , bool silentUpdate = true) { UpdateManager updateManager; UpdateInfo newUpdateInfo; + if (!silentUpdate) + api.ShowMsg("Please wait...", "Checking for new update"); + try { updateManager = await GitHubUpdateManager(GitHubRepository); @@ -62,12 +66,15 @@ namespace Flow.Launcher.Core if (newReleaseVersion <= currentVersion) { - if (!silentIfLatestVersion) + if (!silentUpdate) MessageBox.Show("You already have the latest Flow Launcher version"); updateManager.Dispose(); return; } - + + if (!silentUpdate) + api.ShowMsg("Update found", "Updating..."); + try { await updateManager.DownloadReleases(newUpdateInfo.ReleasesToApply); @@ -96,11 +103,15 @@ namespace Flow.Launcher.Core var newVersionTips = NewVersinoTips(newReleaseVersion.ToString()); - MessageBox.Show(newVersionTips); Log.Info($"|Updater.UpdateApp|Update success:{newVersionTips}"); // always dispose UpdateManager updateManager.Dispose(); + + if (MessageBox.Show(newVersionTips, "New Update", MessageBoxButton.YesNo) == MessageBoxResult.Yes) + { + UpdateManager.RestartApp(Constant.ApplicationFileName); + } } [UsedImplicitly] diff --git a/Flow.Launcher.Infrastructure/Storage/WoxJsonStorage.cs b/Flow.Launcher.Infrastructure/Storage/FlowLauncherJsonStorage.cs similarity index 100% rename from Flow.Launcher.Infrastructure/Storage/WoxJsonStorage.cs rename to Flow.Launcher.Infrastructure/Storage/FlowLauncherJsonStorage.cs diff --git a/Flow.Launcher/App.xaml.cs b/Flow.Launcher/App.xaml.cs index 43316cc5b..985d4da87 100644 --- a/Flow.Launcher/App.xaml.cs +++ b/Flow.Launcher/App.xaml.cs @@ -118,12 +118,12 @@ namespace Flow.Launcher var timer = new Timer(1000 * 60 * 60 * 5); timer.Elapsed += async (s, e) => { - await _updater.UpdateApp(); + await _updater.UpdateApp(API); }; timer.Start(); // check updates on startup - await _updater.UpdateApp(); + await _updater.UpdateApp(API); } }); } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 0bf211bd9..069071f39 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -96,7 +96,7 @@ Version You have activated Flow Launcher {0} times Check for Updates - New version {0} is available, please restart Flow Launcher. + New version {0} is available, would you like to restart Flow Launcher to use the update? Check updates failed, please check your connection and proxy settings to api.github.com. Download updates failed, please check your connection and proxy settings to github-cloud.s3.amazonaws.com, diff --git a/Flow.Launcher/Themes/BlurWhite.xaml b/Flow.Launcher/Themes/BlurWhite.xaml index 07dd1d81a..1c1f2f9ec 100644 --- a/Flow.Launcher/Themes/BlurWhite.xaml +++ b/Flow.Launcher/Themes/BlurWhite.xaml @@ -9,13 +9,10 @@ - +