Skip to content

Commit d4f94c6

Browse files
committed
Make InstallOrUpdate to async
1 parent efa4908 commit d4f94c6

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

Flow.Launcher.Core/Updater.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Windows;
99
using JetBrains.Annotations;
1010
using Squirrel;
11-
using Newtonsoft.Json;
1211
using Flow.Launcher.Core.Resource;
1312
using Flow.Launcher.Plugin.SharedCommands;
1413
using Flow.Launcher.Infrastructure;
@@ -17,6 +16,7 @@
1716
using System.IO;
1817
using Flow.Launcher.Infrastructure.UserSettings;
1918
using Flow.Launcher.Plugin;
19+
using System.Text.Json.Serialization;
2020

2121
namespace Flow.Launcher.Core
2222
{
@@ -117,13 +117,13 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
117117
[UsedImplicitly]
118118
private class GithubRelease
119119
{
120-
[JsonProperty("prerelease")]
120+
[JsonPropertyName("prerelease")]
121121
public bool Prerelease { get; [UsedImplicitly] set; }
122122

123-
[JsonProperty("published_at")]
123+
[JsonPropertyName("published_at")]
124124
public DateTime PublishedAt { get; [UsedImplicitly] set; }
125125

126-
[JsonProperty("html_url")]
126+
[JsonPropertyName("html_url")]
127127
public string HtmlUrl { get; [UsedImplicitly] set; }
128128
}
129129

Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class Main : ISettingProvider, IPlugin, ISavable, IContextMenu, IPluginI1
2222

2323
internal PluginsManager pluginManager;
2424

25-
private DateTime lastUpdateTime;
25+
private DateTime lastUpdateTime = DateTime.MinValue;
2626

2727
public Control CreateSettingPanel()
2828
{

Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ internal List<Result> GetDefaultHotKeys()
8787
};
8888
}
8989

90-
internal void InstallOrUpdate(UserPlugin plugin)
90+
internal async Task InstallOrUpdate(UserPlugin plugin)
9191
{
9292
if (PluginExists(plugin.ID))
9393
{
@@ -127,7 +127,7 @@ internal void InstallOrUpdate(UserPlugin plugin)
127127
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_downloading_plugin"),
128128
Context.API.GetTranslation("plugin_pluginsmanager_please_wait"));
129129

130-
Http.Download(plugin.UrlDownload, filePath);
130+
await Http.Download(plugin.UrlDownload, filePath).ConfigureAwait(false);
131131

132132
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_downloading_plugin"),
133133
Context.API.GetTranslation("plugin_pluginsmanager_download_success"));
@@ -264,8 +264,7 @@ internal List<Result> RequestInstallOrUpdate(string searchName)
264264
Action = e =>
265265
{
266266
Application.Current.MainWindow.Hide();
267-
InstallOrUpdate(x);
268-
267+
_ = InstallOrUpdate(x); // No need to wait
269268
return ShouldHideWindow;
270269
},
271270
ContextData = x

0 commit comments

Comments
 (0)