diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/en.xaml index 3017f39c3bf..c36a1dcaac2 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Languages/en.xaml @@ -19,6 +19,8 @@ Plugin Update This plugin has an update, would you like to see it? This plugin is already installed + Plugin Manifest Download Failed + Please check if you can connect to github.com. This error means you may not be able to install or update plugins. diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs index f0ef89c8261..5f200aa217a 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs @@ -38,7 +38,7 @@ public Task InitAsync(PluginInitContext context) viewModel = new SettingsViewModel(context, Settings); contextMenu = new ContextMenu(Context); pluginManager = new PluginsManager(Context, Settings); - _ = pluginManager.UpdateManifest().ContinueWith(_ => + _manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(_ => { lastUpdateTime = DateTime.Now; }, TaskContinuationOptions.OnlyOnRanToCompletion); @@ -50,6 +50,8 @@ public List LoadContextMenus(Result selectedResult) { return contextMenu.LoadContextMenus(selectedResult); } + + private Task _manifestUpdateTask = Task.CompletedTask; public async Task> QueryAsync(Query query, CancellationToken token) { @@ -58,9 +60,9 @@ public async Task> QueryAsync(Query query, CancellationToken token) if (string.IsNullOrWhiteSpace(search)) return pluginManager.GetDefaultHotKeys(); - if ((DateTime.Now - lastUpdateTime).TotalHours > 12) // 12 hours + if ((DateTime.Now - lastUpdateTime).TotalHours > 12 && _manifestUpdateTask.IsCompleted) // 12 hours { - _ = pluginManager.UpdateManifest().ContinueWith(t => + _manifestUpdateTask = pluginManager.UpdateManifest().ContinueWith(t => { lastUpdateTime = DateTime.Now; }, TaskContinuationOptions.OnlyOnRanToCompletion); diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index ebb76a838d3..1aa39469b11 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -59,11 +59,12 @@ internal Task UpdateManifest() } else { - return _downloadManifestTask = pluginsManifest.DownloadManifest().ContinueWith(t => - Context.API.ShowMsg("Plugin Manifest Download Fail.", - "Please check if you can connect to github.com. " + - "This error means you may not be able to Install and Update Plugin.", icoPath, false), + _downloadManifestTask = pluginsManifest.DownloadManifest(); + _downloadManifestTask.ContinueWith(_ => + Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_failed_title"), + Context.API.GetTranslation("plugin_pluginsmanager_update_failed_subtitle"), icoPath, false), TaskContinuationOptions.OnlyOnFaulted); + return _downloadManifestTask; } } diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json index 0a28d8acd0f..a0b84ac9a30 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/plugin.json @@ -6,7 +6,7 @@ "Name": "Plugins Manager", "Description": "Management of installing, uninstalling or updating Flow Launcher plugins", "Author": "Jeremy Wu", - "Version": "1.8.1", + "Version": "1.8.2", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.PluginsManager.dll",