diff --git a/Flow.Launcher.Core/Plugin/PluginInstaller.cs b/Flow.Launcher.Core/Plugin/PluginInstaller.cs
index a79f4b47c..22aeef224 100644
--- a/Flow.Launcher.Core/Plugin/PluginInstaller.cs
+++ b/Flow.Launcher.Core/Plugin/PluginInstaller.cs
@@ -281,11 +281,12 @@ public static class PluginInstaller
///
/// Updates the plugin to the latest version available from its source.
///
+ /// Action to execute when the user chooses to update all plugins.
/// If true, do not show any messages when there is no update available.
/// If true, only use the primary URL for updates.
/// Cancellation token to cancel the update operation.
///
- public static async Task CheckForPluginUpdatesAsync(bool silentUpdate = true, bool usePrimaryUrlOnly = false, CancellationToken token = default)
+ public static async Task CheckForPluginUpdatesAsync(Action> updateAllPlugins, bool silentUpdate = true, bool usePrimaryUrlOnly = false, CancellationToken token = default)
{
// Update the plugin manifest
await API.UpdatePluginManifestAsync(usePrimaryUrlOnly, token);
@@ -334,14 +335,20 @@ public static class PluginInstaller
API.GetTranslation("updateAllPluginsButtonContent"),
() =>
{
- UpdateAllPlugins(resultsForUpdate);
+ updateAllPlugins(resultsForUpdate);
},
string.Join(", ", resultsForUpdate.Select(x => x.PluginExistingMetadata.Name)));
}
- private static void UpdateAllPlugins(IEnumerable resultsForUpdate)
+ ///
+ /// Updates all plugins that have available updates.
+ ///
+ ///
+ ///
+ public static async Task UpdateAllPluginsAsync(IEnumerable resultsForUpdate, bool restart)
{
- _ = Task.WhenAll(resultsForUpdate.Select(async plugin =>
+ var anyPluginSuccess = false;
+ await Task.WhenAll(resultsForUpdate.Select(async plugin =>
{
var downloadToFilePath = Path.Combine(Path.GetTempPath(), $"{plugin.Name}-{plugin.NewVersion}.zip");
@@ -363,6 +370,8 @@ public static class PluginInstaller
{
return;
}
+
+ anyPluginSuccess = true;
}
catch (Exception e)
{
@@ -370,6 +379,19 @@ public static class PluginInstaller
API.ShowMsgError(API.GetTranslation("ErrorUpdatingPlugin"));
}
}));
+
+ if (!anyPluginSuccess) return;
+
+ if (restart)
+ {
+ API.RestartApp();
+ }
+ else
+ {
+ API.ShowMsg(
+ API.GetTranslation("updatebtn"),
+ API.GetTranslation("PluginsUpdateSuccessNoRestart"));
+ }
}
///
@@ -445,16 +467,16 @@ public static class PluginInstaller
x.Metadata.Website.StartsWith(constructedUrlPart)
);
}
-
- private record PluginUpdateInfo
- {
- public string ID { get; init; }
- public string Name { get; init; }
- public string Author { get; init; }
- public string CurrentVersion { get; init; }
- public string NewVersion { get; init; }
- public string IcoPath { get; init; }
- public PluginMetadata PluginExistingMetadata { get; init; }
- public UserPlugin PluginNewUserPlugin { get; init; }
- }
+}
+
+public record PluginUpdateInfo
+{
+ public string ID { get; init; }
+ public string Name { get; init; }
+ public string Author { get; init; }
+ public string CurrentVersion { get; init; }
+ public string NewVersion { get; init; }
+ public string IcoPath { get; init; }
+ public PluginMetadata PluginExistingMetadata { get; init; }
+ public UserPlugin PluginNewUserPlugin { get; init; }
}
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 374917c74..406ef5c07 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -239,6 +239,7 @@
Plugin updates available
Update all plugins
Check plugin updates
+ Plugins are successfully updated. Please restart Flow.
Theme