mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
plugins: ensure daemon plugins not instantiated twice
This commit is contained in:
@@ -287,11 +287,14 @@ Singleton {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MODIFICATION: Treat Launchers as persistent instances like Daemons
|
if (isDaemon) {
|
||||||
if (isDaemon || isLauncher) {
|
const newDaemons = Object.assign({}, pluginDaemonComponents);
|
||||||
|
newDaemons[pluginId] = comp;
|
||||||
|
pluginDaemonComponents = newDaemons;
|
||||||
|
} else if (isLauncher) {
|
||||||
const instance = comp.createObject(root, {
|
const instance = comp.createObject(root, {
|
||||||
"pluginId": pluginId,
|
"pluginId": pluginId,
|
||||||
"pluginService": root // Inject PluginService
|
"pluginService": root
|
||||||
});
|
});
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
console.error("PluginService: failed to instantiate plugin:", pluginId, comp.errorString());
|
console.error("PluginService: failed to instantiate plugin:", pluginId, comp.errorString());
|
||||||
@@ -302,15 +305,9 @@ Singleton {
|
|||||||
newInstances[pluginId] = instance;
|
newInstances[pluginId] = instance;
|
||||||
pluginInstances = newInstances;
|
pluginInstances = newInstances;
|
||||||
|
|
||||||
if (isDaemon) {
|
const newLaunchers = Object.assign({}, pluginLauncherComponents);
|
||||||
const newDaemons = Object.assign({}, pluginDaemonComponents);
|
newLaunchers[pluginId] = comp;
|
||||||
newDaemons[pluginId] = comp;
|
pluginLauncherComponents = newLaunchers;
|
||||||
pluginDaemonComponents = newDaemons;
|
|
||||||
} else {
|
|
||||||
const newLaunchers = Object.assign({}, pluginLauncherComponents);
|
|
||||||
newLaunchers[pluginId] = comp;
|
|
||||||
pluginLauncherComponents = newLaunchers;
|
|
||||||
}
|
|
||||||
} else if (isDesktop) {
|
} else if (isDesktop) {
|
||||||
const newDesktop = Object.assign({}, pluginDesktopComponents);
|
const newDesktop = Object.assign({}, pluginDesktopComponents);
|
||||||
newDesktop[pluginId] = comp;
|
newDesktop[pluginId] = comp;
|
||||||
|
|||||||
Reference in New Issue
Block a user