diff --git a/app/(auth)/(tabs)/(home)/settings/plugins/page.tsx b/app/(auth)/(tabs)/(home)/settings/plugins/page.tsx index a06ab6cf..441588c0 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 e78c3781..a5a45519 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 @@ -127,17 +122,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 ( @@ -267,15 +251,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 && (