Skip to content

Commit 37ad5aa

Browse files
committed
Fix issue that ActionKeywordRegistered will not exclude old action key
1 parent f999b97 commit 37ad5aa

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

Flow.Launcher.Core/Plugin/PluginManager.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,18 +340,24 @@ public static List<Result> GetContextMenusForPlugin(Result result)
340340
return results;
341341
}
342342

343-
public static bool ActionKeywordRegistered(IReadOnlyList<string> actionKeywords)
343+
public static bool ActionKeywordRegistered(IReadOnlyList<string> newActionKeywords, IReadOnlyList<string> oldActionKeywords)
344344
{
345-
foreach (var actionKeyword in actionKeywords)
345+
foreach (var actionKeyword in newActionKeywords)
346346
{
347-
if (ActionKeywordRegistered(actionKeyword))
347+
if (ActionKeywordRegistered(actionKeyword, oldActionKeywords))
348348
{
349349
return true;
350350
}
351351
}
352352
return false;
353353
}
354354

355+
private static bool ActionKeywordRegistered(string actionKeyword, IReadOnlyList<string> oldActionKeywords)
356+
{
357+
if (oldActionKeywords.Contains(actionKeyword)) return false;
358+
return ActionKeywordRegistered(actionKeyword);
359+
}
360+
355361
public static bool ActionKeywordRegistered(string actionKeyword)
356362
{
357363
// this method is only checking for action keywords (defined as not '*') registration

Flow.Launcher/ActionKeywords.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Flow.Launcher.ViewModel;
55
using Flow.Launcher.Core;
66
using System.Linq;
7+
using Flow.Launcher.Core.Plugin;
78

89
namespace Flow.Launcher
910
{
@@ -41,7 +42,7 @@ private void btnDone_OnClick(object sender, RoutedEventArgs _)
4142

4243
newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign };
4344

44-
if (!PluginViewModel.IsActionKeywordRegistered(newActionKeywords))
45+
if (!PluginManager.ActionKeywordRegistered(newActionKeywords, oldActionKeywords))
4546
{
4647
pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords);
4748
Close();

Flow.Launcher/ViewModel/PluginViewModel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ private void OpenDeletePluginWindow()
151151
PluginManager.API.ShowMainWindow();
152152
}
153153

154-
public static bool IsActionKeywordRegistered(IReadOnlyList<string> newActionKeywords) => PluginManager.ActionKeywordRegistered(newActionKeywords);
155-
156154
[RelayCommand]
157155
private void SetActionKeywords()
158156
{

0 commit comments

Comments
 (0)