Skip to content

Commit 96609f7

Browse files
committed
Change the place of Wait in PluginManifest to make code more elegent
1 parent 85f5766 commit 96609f7

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,19 @@ namespace Flow.Launcher.Plugin.PluginsManager.Models
1010
internal class PluginsManifest
1111
{
1212
internal List<UserPlugin> UserPlugins { get; private set; }
13+
1314
internal PluginsManifest()
1415
{
15-
DownloadManifest();
16+
DownloadManifest().Wait();
1617
}
1718

18-
private void DownloadManifest()
19+
private async Task DownloadManifest()
1920
{
2021
var json = string.Empty;
2122
try
2223
{
23-
var t = Task.Run(
24-
async () =>
25-
json = await Http.Get("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json"));
26-
27-
t.Wait();
24+
json = await Http.Get(
25+
"https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json");
2826

2927
UserPlugins = JsonConvert.DeserializeObject<List<UserPlugin>>(json);
3028
}
@@ -34,7 +32,6 @@ private void DownloadManifest()
3432

3533
UserPlugins = new List<UserPlugin>();
3634
}
37-
3835
}
3936
}
40-
}
37+
}

0 commit comments

Comments
 (0)