Skip to content

Commit 5d67eef

Browse files
committed
Improve code quality
1 parent 4ebc19a commit 5d67eef

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

Flow.Launcher/ActionKeywords.xaml.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
4242
newActionKeywords = newActionKeywords.Distinct().ToList();
4343

4444
newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign };
45-
46-
if (!ActionKeywordRegistered(newActionKeywords, oldActionKeywords))
45+
46+
if (!newActionKeywords.Except(oldActionKeywords).Any(PluginManager.ActionKeywordRegistered))
4747
{
4848
pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords);
4949
Close();
@@ -54,24 +54,5 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
5454
MessageBoxEx.Show(msg);
5555
}
5656
}
57-
58-
private static bool ActionKeywordRegistered(IReadOnlyList<string> newActionKeywords, IReadOnlyList<string> oldActionKeywords)
59-
{
60-
foreach (var actionKeyword in newActionKeywords)
61-
{
62-
// We need to check if this new action keyword is from the old action keywords because
63-
// we have not changed action keyword yet so PluginManager still has the old action keywords
64-
if (oldActionKeywords.Contains(actionKeyword))
65-
{
66-
continue;
67-
}
68-
69-
if (PluginManager.ActionKeywordRegistered(actionKeyword))
70-
{
71-
return true;
72-
}
73-
}
74-
return false;
75-
}
7657
}
7758
}

0 commit comments

Comments
 (0)