Skip to content

Commit 37058f7

Browse files
committed
Improve code quality.
1 parent a34136f commit 37058f7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
5151
return query.FirstSearch.ToLower() switch
5252
{
5353
//search could be url, no need ToLower() when passed in
54-
Settings.InstallCommand => await pluginManager.RequestInstallOrUpdate(query.SecondToEndSearch, token, query.IsReQuery),
54+
Settings.InstallCommand => await pluginManager.RequestInstallOrUpdateAsync(query.SecondToEndSearch, token, query.IsReQuery),
5555
Settings.UninstallCommand => pluginManager.RequestUninstall(query.SecondToEndSearch),
5656
Settings.UpdateCommand => await pluginManager.RequestUpdateAsync(query.SecondToEndSearch, token, query.IsReQuery),
5757
_ => pluginManager.GetDefaultHotKeys().Where(hotkey =>

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
324324
string.Format(
325325
Context.API.GetTranslation("plugin_pluginsmanager_install_error_subtitle"),
326326
x.Name));
327-
}, TaskContinuationOptions.OnlyOnFaulted);
327+
}, token, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);
328328

329329
return true;
330330
},
@@ -337,7 +337,7 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
337337
});
338338

339339
// Update all result
340-
if (resultsForUpdate.Count() > 1)
340+
if (resultsForUpdate.Count > 1)
341341
{
342342
var updateAllResult = new Result
343343
{
@@ -351,13 +351,13 @@ await Http.DownloadAsync(x.PluginNewUserPlugin.UrlDownload, downloadToFilePath)
351351
{
352352
message = string.Format(
353353
Context.API.GetTranslation("plugin_pluginsmanager_update_all_prompt"),
354-
resultsForUpdate.Count(), Environment.NewLine);
354+
resultsForUpdate.Count, Environment.NewLine);
355355
}
356356
else
357357
{
358358
message = string.Format(
359359
Context.API.GetTranslation("plugin_pluginsmanager_update_all_prompt_no_restart"),
360-
resultsForUpdate.Count());
360+
resultsForUpdate.Count);
361361
}
362362

363363
if (Context.API.ShowMsgBox(message,
@@ -401,15 +401,15 @@ await Http.DownloadAsync(plugin.PluginNewUserPlugin.UrlDownload, downloadToFileP
401401
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
402402
string.Format(
403403
Context.API.GetTranslation("plugin_pluginsmanager_update_all_success_restart"),
404-
resultsForUpdate.Count()));
404+
resultsForUpdate.Count));
405405
Context.API.RestartApp();
406406
}
407407
else
408408
{
409409
Context.API.ShowMsg(Context.API.GetTranslation("plugin_pluginsmanager_update_title"),
410410
string.Format(
411411
Context.API.GetTranslation("plugin_pluginsmanager_update_all_success_no_restart"),
412-
resultsForUpdate.Count()));
412+
resultsForUpdate.Count));
413413
}
414414

415415
return true;
@@ -545,7 +545,7 @@ private bool InstallSourceKnown(string url)
545545
Context.API.GetAllPlugins().Any(x => x.Metadata.Website.StartsWith(constructedUrlPart));
546546
}
547547

548-
internal async ValueTask<List<Result>> RequestInstallOrUpdate(string search, CancellationToken token,
548+
internal async ValueTask<List<Result>> RequestInstallOrUpdateAsync(string search, CancellationToken token,
549549
bool usePrimaryUrlOnly = false)
550550
{
551551
await PluginsManifest.UpdateManifestAsync(token, usePrimaryUrlOnly);

0 commit comments

Comments
 (0)