mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Update RemoveActionKeyword method
Update the method to handle removal when a plugin has multiple ActionKeywords ie. mix of global and non-global ActionKeywords
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -289,14 +289,20 @@ namespace Wox.Core.Plugin
|
|||||||
public static void RemoveActionKeyword(string id, string oldActionkeyword)
|
public static void RemoveActionKeyword(string id, string oldActionkeyword)
|
||||||
{
|
{
|
||||||
var plugin = GetPluginForId(id);
|
var plugin = GetPluginForId(id);
|
||||||
if (oldActionkeyword == Query.GlobalPluginWildcardSign)
|
if (oldActionkeyword == Query.GlobalPluginWildcardSign
|
||||||
|
&& // Plugins may have multiple ActionKeywords that are global, eg. WebSearch
|
||||||
|
plugin.Metadata.ActionKeywords
|
||||||
|
.Where(x => x == Query.GlobalPluginWildcardSign)
|
||||||
|
.ToList()
|
||||||
|
.Count == 1)
|
||||||
{
|
{
|
||||||
GlobalPlugins.Remove(plugin);
|
GlobalPlugins.Remove(plugin);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
if(oldActionkeyword != Query.GlobalPluginWildcardSign)
|
||||||
NonGlobalPlugins.Remove(oldActionkeyword);
|
NonGlobalPlugins.Remove(oldActionkeyword);
|
||||||
}
|
|
||||||
|
|
||||||
plugin.Metadata.ActionKeywords.Remove(oldActionkeyword);
|
plugin.Metadata.ActionKeywords.Remove(oldActionkeyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user