From fb8f11460b7d5275329e1038b33239a71c0e0357 Mon Sep 17 00:00:00 2001 From: Gauvain Date: Tue, 16 Jun 2026 23:42:12 +0200 Subject: [PATCH] refactor(settings): move "refresh from server" to the plugins index The button pulls the centralised Streamyfin plugin settings for every plugin, so it belongs on the plugins list page rather than buried inside the Streamystats screen. --- .../(tabs)/(home)/settings/plugins/page.tsx | 25 ++++++++++++++++- .../settings/plugins/streamystats/page.tsx | 27 +------------------ 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/(auth)/(tabs)/(home)/settings/plugins/page.tsx b/app/(auth)/(tabs)/(home)/settings/plugins/page.tsx index a06ab6cff..441588c0e 100644 --- a/app/(auth)/(tabs)/(home)/settings/plugins/page.tsx +++ b/app/(auth)/(tabs)/(home)/settings/plugins/page.tsx @@ -1,9 +1,21 @@ -import { Platform, ScrollView, View } from "react-native"; +import { useCallback } from "react"; +import { useTranslation } from "react-i18next"; +import { Platform, ScrollView, TouchableOpacity, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; +import { toast } from "sonner-native"; +import { Text } from "@/components/common/Text"; import { PluginSettings } from "@/components/settings/PluginSettings"; +import { useSettings } from "@/utils/atoms/settings"; export default function PluginsPage() { const insets = useSafeAreaInsets(); + const { t } = useTranslation(); + const { refreshStreamyfinPluginSettings } = useSettings(); + + const handleRefreshFromServer = useCallback(async () => { + await refreshStreamyfinPluginSettings(); + toast.success(t("home.settings.plugins.streamystats.toasts.refreshed")); + }, [refreshStreamyfinPluginSettings, t]); return ( + + {/* Pulls the centralised Streamyfin plugin settings for every plugin, + so it lives on the plugins index rather than inside Streamystats. */} + + + {t("home.settings.plugins.streamystats.refresh_from_server")} + + ); diff --git a/app/(auth)/(tabs)/(home)/settings/plugins/streamystats/page.tsx b/app/(auth)/(tabs)/(home)/settings/plugins/streamystats/page.tsx index b03834688..e4db9b302 100644 --- a/app/(auth)/(tabs)/(home)/settings/plugins/streamystats/page.tsx +++ b/app/(auth)/(tabs)/(home)/settings/plugins/streamystats/page.tsx @@ -22,12 +22,7 @@ export default function StreamystatsPage() { const navigation = useNavigation(); const insets = useSafeAreaInsets(); - const { - settings, - updateSettings, - pluginSettings, - refreshStreamyfinPluginSettings, - } = useSettings(); + const { settings, updateSettings, pluginSettings } = useSettings(); const queryClient = useNetworkAwareQueryClient(); // Local state for all editable fields @@ -122,17 +117,6 @@ export default function StreamystatsPage() { Linking.openURL("https://github.com/fredrikburmester/streamystats"); }; - const handleRefreshFromServer = useCallback(async () => { - const newPluginSettings = await refreshStreamyfinPluginSettings(); - // Update local state with new values - const newUrl = newPluginSettings?.streamyStatsServerUrl?.value || ""; - setUrl(newUrl); - if (newUrl) { - setUseForSearch(true); - } - toast.success(t("home.settings.plugins.streamystats.toasts.refreshed")); - }, [refreshStreamyfinPluginSettings, t]); - if (!settings) return null; return ( @@ -264,15 +248,6 @@ export default function StreamystatsPage() { {t("home.settings.plugins.streamystats.home_sections_hint")} - - - {t("home.settings.plugins.streamystats.refresh_from_server")} - - - {/* Disable button - only show if URL is not locked and Streamystats is enabled */} {!isUrlLocked && isStreamystatsEnabled && (