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/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/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
index 634c05d37..61c1c9ebe 100644
--- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
+++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs
@@ -45,7 +45,7 @@ namespace Flow.Launcher.ViewModel
public async void UpdateApp()
{
- await _updater.UpdateApp(false);
+ await _updater.UpdateApp(App.API, false);
}
public bool AutoUpdates
diff --git a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
index 0b57608c3..5642b62ed 100644
--- a/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Sys/Main.cs
@@ -244,8 +244,6 @@ namespace Flow.Launcher.Plugin.Sys
{
Application.Current.MainWindow.Hide();
context.API.CheckForNewUpdate();
- context.API.ShowMsg("Please wait...",
- "Checking for new update");
return true;
}
}