From 5d894ec154dca7949cb0d9cb8c67c22d9e667519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Mon, 25 Jan 2021 17:18:48 +0800 Subject: [PATCH] Don't await download manifest when it is unavaliable, but only await when calling install method to allow user using uninstall when manifest is not ready. --- .../Flow.Launcher.Plugin.PluginsManager/Main.cs | 15 +++++++++++++-- .../PluginsManager.cs | 4 ++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs index 66bfd2ab5..7836f1441 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs @@ -69,8 +69,19 @@ namespace Flow.Launcher.Plugin.PluginsManager if ((DateTime.Now - lastUpdateTime).TotalHours > 12) // 12 hours { - await pluginManager.UpdateManifest(); - lastUpdateTime = DateTime.Now; + _ = pluginManager.UpdateManifest().ContinueWith(t => + { + if (t.IsCompletedSuccessfully) + { + lastUpdateTime = DateTime.Now; + } + else + { + 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.", pluginManager.icoPath, false); + } + }); } return search switch diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index 0f5e6d9e8..e25d97b36 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -46,9 +46,9 @@ namespace Flow.Launcher.Plugin.PluginsManager Settings = settings; } - internal async Task UpdateManifest() + internal Task UpdateManifest() { - await pluginsManifest.DownloadManifest(); + return _downloadManifestTask = pluginsManifest.DownloadManifest(); } internal List GetDefaultHotKeys()