mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-04 12:38:31 -04:00
launcher: dispatch plugin-category items as plugin, not app
fixes #2988
port 1.5
(cherry picked from commit 365474b0d9)
This commit is contained in:
@@ -749,16 +749,24 @@ Singleton {
|
||||
if (category === I18n.tr("All"))
|
||||
return visibleApps;
|
||||
|
||||
const pluginItems = getPluginItems(category, "");
|
||||
if (pluginItems.length > 0)
|
||||
return pluginItems;
|
||||
|
||||
return visibleApps.filter(app => {
|
||||
const appCategories = getCategoriesForApp(app);
|
||||
return appCategories.includes(category);
|
||||
});
|
||||
}
|
||||
|
||||
function getPluginIdForCategory(category) {
|
||||
if (typeof PluginService === "undefined")
|
||||
return null;
|
||||
|
||||
const launchers = PluginService.getLauncherPlugins();
|
||||
for (const pluginId in launchers) {
|
||||
if ((launchers[pluginId].name || pluginId) === category)
|
||||
return pluginId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Plugin launcher support functions
|
||||
function getPluginCategories() {
|
||||
if (typeof PluginService === "undefined") {
|
||||
@@ -778,17 +786,11 @@ Singleton {
|
||||
}
|
||||
|
||||
function getPluginCategoryIcon(category) {
|
||||
if (typeof PluginService === "undefined")
|
||||
const pluginId = getPluginIdForCategory(category);
|
||||
if (!pluginId)
|
||||
return null;
|
||||
|
||||
const launchers = PluginService.getLauncherPlugins();
|
||||
for (const pluginId in launchers) {
|
||||
const plugin = launchers[pluginId];
|
||||
if ((plugin.name || pluginId) === category) {
|
||||
return plugin.icon || "extension";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return PluginService.getLauncherPlugins()[pluginId].icon || "extension";
|
||||
}
|
||||
|
||||
function getAllPluginItems() {
|
||||
@@ -809,17 +811,11 @@ Singleton {
|
||||
}
|
||||
|
||||
function getPluginItems(category, query) {
|
||||
if (typeof PluginService === "undefined")
|
||||
const pluginId = getPluginIdForCategory(category);
|
||||
if (!pluginId)
|
||||
return [];
|
||||
|
||||
const launchers = PluginService.getLauncherPlugins();
|
||||
for (const pluginId in launchers) {
|
||||
const plugin = launchers[pluginId];
|
||||
if ((plugin.name || pluginId) === category) {
|
||||
return getPluginItemsForPlugin(pluginId, query);
|
||||
}
|
||||
}
|
||||
return [];
|
||||
return getPluginItemsForPlugin(pluginId, query);
|
||||
}
|
||||
|
||||
function getPluginItemsForPlugin(pluginId, query) {
|
||||
|
||||
Reference in New Issue
Block a user