Skip to content

Commit d0743f6

Browse files
committed
Await Http.Download in Update method
1 parent d4f94c6 commit d0743f6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ internal async Task InstallOrUpdate(UserPlugin plugin)
140140
Log.Exception("PluginsManager", "An error occured while downloading plugin", e, "PluginDownload");
141141
}
142142

143-
Application.Current.Dispatcher.Invoke(() =>
144-
{
145-
Install(plugin, filePath);
146-
Context.API.RestartApp();
147-
});
143+
Install(plugin, filePath);
144+
Context.API.RestartApp();
148145
}
149146

150147
internal List<Result> RequestUpdate(string search)
@@ -211,10 +208,14 @@ on existingPlugin.Metadata.ID equals pluginFromManifest.ID
211208

212209
var downloadToFilePath = Path.Combine(DataLocation.PluginsDirectory,
213210
$"{x.Name}-{x.NewVersion}.zip");
214-
Http.Download(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath);
215-
Install(x.PluginNewUserPlugin, downloadToFilePath);
216211

217-
Context.API.RestartApp();
212+
Task.Run(async delegate
213+
{
214+
await Http.Download(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath).ConfigureAwait(false);
215+
Install(x.PluginNewUserPlugin, downloadToFilePath);
216+
217+
Context.API.RestartApp();
218+
});
218219

219220
return true;
220221
}

0 commit comments

Comments
 (0)