From 5c9d1e996ad6dbfff111e6860aa9cbd72fd38194 Mon Sep 17 00:00:00 2001 From: kmmiio99o <164557248+kmmiio99o@users.noreply.github.com> Date: Fri, 19 Sep 2025 22:02:51 +0200 Subject: [PATCH] factor V6 --- plugins/Last.fm/src/index.tsx | 55 +++++------------------------------ 1 file changed, 7 insertions(+), 48 deletions(-) diff --git a/plugins/Last.fm/src/index.tsx b/plugins/Last.fm/src/index.tsx index 819c427..499d8ac 100644 --- a/plugins/Last.fm/src/index.tsx +++ b/plugins/Last.fm/src/index.tsx @@ -3,15 +3,17 @@ import { FluxDispatcher } from "@vendetta/metro/common"; import { getAssetIDByName } from "@vendetta/ui/assets"; import { showToast } from "@vendetta/ui/toasts"; import { React } from "@vendetta/metro/common"; -import { ScrollView, View } from "react-native"; +import { View } from "react-native"; import { Forms } from "@vendetta/ui/components"; -import { lazy } from "react"; import { LFMSettings } from "../../defs"; import Constants from "./constants"; import { initialize, stop } from "./manager"; import { UserStore } from "./modules"; +// Import Settings component directly +import Settings from "./ui/pages/Settings"; + const { FormText } = Forms; export const pluginState = { @@ -43,29 +45,6 @@ export const currentSettings = new Proxy(plugin.storage, { }, }); -// Simple Settings component for fallback -function FallbackSettings() { - return ( - - - Failed to load Last.fm settings. Please check your connection and reload - Discord. - - - ); -} - -// Settings component with error handling -const Settings = lazy(async () => { - try { - const module = await import("./ui/pages/Settings"); - return { default: module.default || FallbackSettings }; - } catch (err) { - console.error("[Last.fm] Failed to load settings:", err); - return { default: FallbackSettings }; - } -}); - // Connection status tracking let connectionAttempts = 0; const MAX_CONNECTION_ATTEMPTS = 3; @@ -88,8 +67,7 @@ async function tryInitialize() { } } -// Create the plugin object -const pluginObj = { +export default { onLoad() { pluginState.pluginStopped = false; @@ -129,25 +107,6 @@ const pluginObj = { tryInitialize(); } }, + // Settings component + settings: Settings, }; - -// Add settings property to the plugin object -Object.defineProperty(pluginObj, "settings", { - get: () => ( - - Loading Last.fm settings... - - } - > - - - ), - enumerable: true, - configurable: true, -}); - -export default pluginObj;