mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #114 from Flow-Launcher/add_update_progress_msg
Add update messages to indicate progress
This commit is contained in:
commit
0c7298c72c
5 changed files with 19 additions and 10 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
<system:String x:Key="version">Version</system:String>
|
||||
<system:String x:Key="about_activate_times">You have activated Flow Launcher {0} times</system:String>
|
||||
<system:String x:Key="checkUpdates">Check for Updates</system:String>
|
||||
<system:String x:Key="newVersionTips">New version {0} is available, please restart Flow Launcher.</system:String>
|
||||
<system:String x:Key="newVersionTips">New version {0} is available, would you like to restart Flow Launcher to use the update?</system:String>
|
||||
<system:String x:Key="checkUpdatesFailed">Check updates failed, please check your connection and proxy settings to api.github.com.</system:String>
|
||||
<system:String x:Key="downloadUpdatesFailed">
|
||||
Download updates failed, please check your connection and proxy settings to github-cloud.s3.amazonaws.com,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue