diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index 18519c85d..9a37f6fe5 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -340,24 +340,6 @@ namespace Flow.Launcher.Core.Plugin return results; } - public static bool ActionKeywordRegistered(IReadOnlyList newActionKeywords, IReadOnlyList oldActionKeywords) - { - foreach (var actionKeyword in newActionKeywords) - { - if (ActionKeywordRegistered(actionKeyword, oldActionKeywords)) - { - return true; - } - } - return false; - } - - private static bool ActionKeywordRegistered(string actionKeyword, IReadOnlyList oldActionKeywords) - { - if (oldActionKeywords.Contains(actionKeyword)) return false; - return ActionKeywordRegistered(actionKeyword); - } - public static bool ActionKeywordRegistered(string actionKeyword) { // this method is only checking for action keywords (defined as not '*') registration diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index af6dcfe90..b0e4edbc1 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -5,6 +5,7 @@ using Flow.Launcher.ViewModel; using Flow.Launcher.Core; using System.Linq; using Flow.Launcher.Core.Plugin; +using System.Collections.Generic; namespace Flow.Launcher { @@ -42,7 +43,7 @@ namespace Flow.Launcher newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign }; - if (!PluginManager.ActionKeywordRegistered(newActionKeywords, oldActionKeywords)) + if (!ActionKeywordRegistered(newActionKeywords, oldActionKeywords)) { pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords); Close(); @@ -53,5 +54,24 @@ namespace Flow.Launcher MessageBoxEx.Show(msg); } } + + private static bool ActionKeywordRegistered(IReadOnlyList newActionKeywords, IReadOnlyList 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; + } } }