import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; import { useSettings } from "@/utils/atoms/settings"; import { getItemsApi } from "@jellyfin/sdk/lib/utils/api"; import { useQuery } from "@tanstack/react-query"; import { useAtom } from "jotai"; import { Linking, Switch, TouchableOpacity, View } from "react-native"; import { Text } from "../common/Text"; import { Loader } from "../Loader"; export const SettingToggles: React.FC = () => { const [settings, updateSettings] = useSettings(); const [api] = useAtom(apiAtom); const [user] = useAtom(userAtom); const { data: mediaListCollections, isLoading: isLoadingMediaListCollections, } = useQuery({ queryKey: ["mediaListCollections", user?.Id], queryFn: async () => { if (!api || !user?.Id) return []; const response = await getItemsApi(api).getItems({ userId: user.Id, tags: ["medialist", "promoted"], recursive: true, fields: ["Tags"], includeItemTypes: ["BoxSet"], }); const ids = response.data.Items?.filter((c) => c.Name !== "sf_carousel") ?? []; return ids; }, enabled: !!api && !!user?.Id && settings?.usePopularPlugin === true, staleTime: 0, }); return ( Auto rotate Important on android since the video player orientation is locked to the app orientation. updateSettings({ autoRotate: value })} /> Start videos in fullscreen Clicking a video will start it in fullscreen mode, instead of inline. updateSettings({ openFullScreenVideoPlayerByDefault: value }) } /> Use popular lists plugin Made by: lostb1t { Linking.openURL( "https://github.com/lostb1t/jellyfin-plugin-media-lists" ); }} > More info updateSettings({ usePopularPlugin: value }) } /> {settings?.usePopularPlugin && ( {mediaListCollections?.map((mlc) => ( {mlc.Name} { if (!settings.mediaListCollectionIds) { updateSettings({ mediaListCollectionIds: [mlc.Id!], }); return; } updateSettings({ mediaListCollectionIds: settings?.mediaListCollectionIds.includes(mlc.Id!) ? settings?.mediaListCollectionIds.filter( (id) => id !== mlc.Id ) : [...settings?.mediaListCollectionIds, mlc.Id!], }); }} /> ))} {isLoadingMediaListCollections && ( )} {mediaListCollections?.length === 0 && ( No collections found. Add some in Jellyfin. )} )} Force direct play This will always request direct play. This is good if you want to try to stream movies you think the device supports. updateSettings({ forceDirectPlay: value })} /> Device profile A profile used for deciding what audio and video codecs the device supports. ); };