From c288bc735e5d08288505d850ceb39b6ce3acc347 Mon Sep 17 00:00:00 2001 From: kmmiio99o <164557248+kmmiio99o@users.noreply.github.com> Date: Sat, 13 Sep 2025 22:16:11 +0200 Subject: [PATCH] fix reanimated --- base_manifest.json | 18 +++++++----- plugins/Last.fm/src/index.tsx | 36 +++++++++++++++++++++-- plugins/Last.fm/src/ui/pages/Settings.tsx | 24 ++++++++------- 3 files changed, 58 insertions(+), 20 deletions(-) diff --git a/base_manifest.json b/base_manifest.json index e947e4a..59ba9e7 100644 --- a/base_manifest.json +++ b/base_manifest.json @@ -1,9 +1,13 @@ { - "authors": [ - { - "name": "pylix", - "id": "492949202121261067" - } - ], - "main": "src/index.ts" + "authors": [ + { + "name": "pylix", + "id": "492949202121261067" + }, + { + "name": "forked by kmmiio99o", + "id": "879393496627306587" + } + ], + "main": "src/index.ts" } diff --git a/plugins/Last.fm/src/index.tsx b/plugins/Last.fm/src/index.tsx index b92f2b0..deb5d45 100644 --- a/plugins/Last.fm/src/index.tsx +++ b/plugins/Last.fm/src/index.tsx @@ -2,6 +2,9 @@ import { plugin } from "@vendetta"; 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 { View } from "react-native"; +import { Forms } from "@vendetta/ui/components"; import { lazy } from "react"; import { LFMSettings } from "../../defs"; @@ -9,6 +12,8 @@ import Constants from "./constants"; import { initialize, stop } from "./manager"; import { UserStore } from "./modules"; +const { FormText } = Forms; + export const pluginState = { pluginStopped: false, lastActivity: undefined, @@ -38,7 +43,22 @@ export const currentSettings = new Proxy(plugin.storage, { }, }); -const LazySettings = lazy(() => import("./ui/pages/Settings")); +// Wrap Settings component in error boundary +const Settings = lazy(() => + import("./ui/pages/Settings").catch((err) => { + console.error("[Last.fm] Failed to load settings:", err); + return { + default: () => ( + + + Failed to load Last.fm settings. Please check your connection and + reload Discord. + + + ), + }; + }), +); // Connection status tracking let connectionAttempts = 0; @@ -63,7 +83,19 @@ async function tryInitialize() { } export default { - settings: LazySettings, + settings: () => ( + + + Loading Last.fm settings... + + } + > + + + + ), onLoad() { pluginState.pluginStopped = false; diff --git a/plugins/Last.fm/src/ui/pages/Settings.tsx b/plugins/Last.fm/src/ui/pages/Settings.tsx index e67ed9b..843358f 100644 --- a/plugins/Last.fm/src/ui/pages/Settings.tsx +++ b/plugins/Last.fm/src/ui/pages/Settings.tsx @@ -4,7 +4,7 @@ import { useProxy } from "@vendetta/storage"; import { getAssetIDByName } from "@vendetta/ui/assets"; import { showToast } from "@vendetta/ui/toasts"; import { React } from "@vendetta/metro/common"; -import { ScrollView } from "react-native"; +import { View } from "react-native"; import { currentSettings, pluginState } from "../.."; import Constants from "../../constants"; @@ -37,8 +37,6 @@ export default function Settings() { try { await lastfmClient.fetchLatestScrobble(); showToast("Connection successful!", getAssetIDByName("Check")); - - // Reinitialize the plugin with new settings await initialize(); } catch (error) { showToast( @@ -51,7 +49,7 @@ export default function Settings() { }; return ( - + saveSettings("apiKey", value)} secureTextEntry={true} /> - + Get your API key at: https://www.last.fm/api/account/create - - Status: {pluginState.pluginStopped ? "Stopped" : "Running"} - {"\n"} - Last Update: {pluginState.lastTrackUrl ? "Success" : "No track data"} - + + + Status: {pluginState.pluginStopped ? "Stopped" : "Running"} + + + Last Update:{" "} + {pluginState.lastTrackUrl ? "Success" : "No track data"} + + Version 2.0.0 - + ); }