diff --git a/plugins/Commands/index.ts b/plugins/Commands/index.ts index 632a60c..05d58d0 100644 --- a/plugins/Commands/index.ts +++ b/plugins/Commands/index.ts @@ -113,7 +113,16 @@ export default { onLoad: () => { console.log("[Commands Plugin] Loading..."); -<<<<<<< HEAD + // Patch sidebar if enabled + if (storage.sidebarEnabled !== false) { + try { + sidebarUnpatch = patchSidebar(); + console.log("[Commands Plugin] Sidebar patched successfully"); + } catch (error) { + console.error("[Commands Plugin] Failed to patch sidebar:", error); + } + } + // Register commands for (const [key, command] of Object.entries(commandMap)) { if (storage.enabledCommands[key]) { @@ -127,35 +136,11 @@ export default { ); } } -======= - // Patch sidebar if enabled - if (storage.sidebarEnabled !== false) { - try { - sidebarUnpatch = patchSidebar(); - console.log("[Commands Plugin] Sidebar patched successfully"); - } catch (error) { - console.error("[Commands Plugin] Failed to patch sidebar:", error); - } - } - - // Register commands - for (const [key, command] of Object.entries(commandMap)) { - if (storage.enabledCommands[key]) { - try { - commands.push(registerCommand(command as any)); - console.log(`[Commands Plugin] Registered command: ${key}`); - } catch (error) { - console.error( - `[Commands Plugin] Failed to register command ${key}:`, - error, - ); ->>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they) } }, onUnload: () => { console.log("[Commands Plugin] Unloading..."); -<<<<<<< HEAD // Unregister commands commands.forEach((unregister) => { try { @@ -165,30 +150,17 @@ export default { } }); commands = []; + + // Unpatch sidebar + if (sidebarUnpatch) { + try { + sidebarUnpatch(); + sidebarUnpatch = undefined; + console.log("[Commands Plugin] Sidebar unpatched"); + } catch (error) { + console.error("[Commands Plugin] Failed to unpatch sidebar:", error); + } + } }, settings, -======= - // Unregister commands - commands.forEach((unregister) => { - try { - unregister(); - } catch (error) { - // Ignore errors during cleanup - } - }); - commands = []; - - // Unpatch sidebar - if (sidebarUnpatch) { - try { - sidebarUnpatch(); - sidebarUnpatch = undefined; - console.log("[Commands Plugin] Sidebar unpatched"); - } catch (error) { - console.error("[Commands Plugin] Failed to unpatch sidebar:", error); - } - } - }, - settings, ->>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they) }; diff --git a/plugins/multi-scrobbler/src/index.tsx b/plugins/multi-scrobbler/src/index.tsx index 7ec92d6..ce31c9e 100644 --- a/plugins/multi-scrobbler/src/index.tsx +++ b/plugins/multi-scrobbler/src/index.tsx @@ -124,97 +124,67 @@ export default { console.log("[Multi-Scrobbler] Loading..."); pluginState.pluginStopped = false; -<<<<<<< HEAD + // Patch sidebar if enabled + if (currentSettings.addToSidebar !== false) { + try { + sidebarUnpatch = patchSidebar(); + console.log("[Multi-Scrobbler] Sidebar patched successfully"); + } catch (error) { + console.error("[Multi-Scrobbler] Failed to patch sidebar:", error); + } + } + validateAndInitialize(); }, -======= - // Patch sidebar if enabled - if (currentSettings.addToSidebar !== false) { - try { - sidebarUnpatch = patchSidebar(); - console.log("[Multi-Scrobbler] Sidebar patched successfully"); - } catch (error) { - console.error("[Multi-Scrobbler] Failed to patch sidebar:", error); - } - } - - validateAndInitialize(); - }, ->>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they) onUnload() { console.log("[Multi-Scrobbler] Unloading..."); pluginState.pluginStopped = true; -<<<<<<< HEAD -======= - // Unpatch sidebar - if (sidebarUnpatch) { - try { - sidebarUnpatch(); - sidebarUnpatch = undefined; - console.log("[Multi-Scrobbler] Sidebar unpatched"); - } catch (error) { - console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", error); - } - } - - stop(); - }, - - async onSettingsUpdate(newSettings: any) { - const oldService = currentSettings.service; - const newService = newSettings.service; - const oldSidebar = currentSettings.addToSidebar; - const newSidebar = newSettings.addToSidebar; - - Object.assign(currentSettings, newSettings); - - // Check if sidebar setting changed - if (oldSidebar !== newSidebar) { - if (newSidebar) { - try { - sidebarUnpatch = patchSidebar(); - console.log("[Multi-Scrobbler] Sidebar enabled"); - } catch (error) { - console.error("[Multi-Scrobbler] Failed to enable sidebar:", error); - } - } else { + // Unpatch sidebar if (sidebarUnpatch) { - try { - sidebarUnpatch(); - } catch (e) { - console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", e); - } - sidebarUnpatch = undefined; - console.log("[Multi-Scrobbler] Sidebar disabled"); + try { + sidebarUnpatch(); + sidebarUnpatch = undefined; + console.log("[Multi-Scrobbler] Sidebar unpatched"); + } catch (error) { + console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", error); + } } - } - } - if (oldService !== newService && newService) { - console.log(`[Multi-Scrobbler] Service changed from ${oldService || "none"} to ${newService}`); - try { - await switchService(newService); - } catch (e) { - console.error("[Multi-Scrobbler] Failed to switch service:", e); - } - } else if (!pluginState.pluginStopped && currentSettings.service) { - tryInitialize(); - } else if (!currentSettings.service) { - console.log("[Multi-Scrobbler] Service unselected, stopping plugin..."); - try { ->>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they) stop(); }, async onSettingsUpdate(newSettings: any) { const oldService = currentSettings.service; const newService = newSettings.service; + const oldSidebar = currentSettings.addToSidebar; + const newSidebar = newSettings.addToSidebar; -<<<<<<< HEAD Object.assign(currentSettings, newSettings); + // Check if sidebar setting changed + if (oldSidebar !== newSidebar) { + if (newSidebar) { + try { + sidebarUnpatch = patchSidebar(); + console.log("[Multi-Scrobbler] Sidebar enabled"); + } catch (error) { + console.error("[Multi-Scrobbler] Failed to enable sidebar:", error); + } + } else { + if (sidebarUnpatch) { + try { + sidebarUnpatch(); + } catch (e) { + console.error("[Multi-Scrobbler] Failed to unpatch sidebar:", e); + } + sidebarUnpatch = undefined; + console.log("[Multi-Scrobbler] Sidebar disabled"); + } + } + } + if (oldService !== newService && newService) { console.log(`[Multi-Scrobbler] Service changed from ${oldService || "none"} to ${newService}`); try { @@ -243,7 +213,3 @@ export default { settings: Settings, }; -======= - settings: Settings, -}; ->>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they) diff --git a/plugins/multi-scrobbler/src/ui/pages/Settings.tsx b/plugins/multi-scrobbler/src/ui/pages/Settings.tsx index 02e9879..0aec44e 100644 --- a/plugins/multi-scrobbler/src/ui/pages/Settings.tsx +++ b/plugins/multi-scrobbler/src/ui/pages/Settings.tsx @@ -229,7 +229,6 @@ export default function Settings() { /> -<<<<<<< HEAD {/* Plugin Configuration */} -======= - {/* Plugin Configuration */} - - } - onPress={() => - navigation.push("VendettaCustomPage", { - title: "Display Settings", - render: DisplaySettingsPage, - }) - } - /> - } - onPress={() => - navigation.push("VendettaCustomPage", { - title: "RPC Customization", - render: RPCCustomizationSettingsPage, - }) - } - /> - } - onPress={() => - navigation.push("VendettaCustomPage", { - title: "Ignore List Settings", - render: IgnoreListSettingsPage, - }) - } - /> - } - onPress={() => - navigation.push("VendettaCustomPage", { - title: "Logging Settings", - render: LoggingSettingsPage, - }) - } - /> - { - setStorage("addToSidebar", value); - forceUpdate(); - }} - /> - ->>>>>>> parent of ecd97c7 (feat: detach Sidebar patches as they) {/* About */}