mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve code quality
This commit is contained in:
parent
4ebc19a82d
commit
5d67eef57b
1 changed files with 2 additions and 21 deletions
|
|
@ -42,8 +42,8 @@ namespace Flow.Launcher
|
|||
newActionKeywords = newActionKeywords.Distinct().ToList();
|
||||
|
||||
newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign };
|
||||
|
||||
if (!ActionKeywordRegistered(newActionKeywords, oldActionKeywords))
|
||||
|
||||
if (!newActionKeywords.Except(oldActionKeywords).Any(PluginManager.ActionKeywordRegistered))
|
||||
{
|
||||
pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords);
|
||||
Close();
|
||||
|
|
@ -54,24 +54,5 @@ namespace Flow.Launcher
|
|||
MessageBoxEx.Show(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private static bool ActionKeywordRegistered(IReadOnlyList<string> newActionKeywords, IReadOnlyList<string> oldActionKeywords)
|
||||
{
|
||||
foreach (var actionKeyword in newActionKeywords)
|
||||
{
|
||||
// We need to check if this new action keyword is from the old action keywords because
|
||||
// we have not changed action keyword yet so PluginManager still has the old action keywords
|
||||
if (oldActionKeywords.Contains(actionKeyword))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (PluginManager.ActionKeywordRegistered(actionKeyword))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue