1
0
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:
bbedward
2026-08-03 20:05:23 -04:00
committed by dms-ci[bot]
parent 1db6381c78
commit 0e8a4c0cc1
2 changed files with 37 additions and 33 deletions
+18 -22
View File
@@ -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) {