diff --git a/app/(auth)/(tabs)/(home)/index.tsx b/app/(auth)/(tabs)/(home)/index.tsx index 72688d26..e9a47e9f 100644 --- a/app/(auth)/(tabs)/(home)/index.tsx +++ b/app/(auth)/(tabs)/(home)/index.tsx @@ -1,3 +1,4 @@ +import { Button } from "@/components/Button"; import { Text } from "@/components/common/Text"; import { LargeMovieCarousel } from "@/components/home/LargeMovieCarousel"; import { ScrollingCollectionList } from "@/components/home/ScrollingCollectionList"; @@ -5,6 +6,7 @@ import { Loader } from "@/components/Loader"; import { MediaListSection } from "@/components/medialists/MediaListSection"; import { apiAtom, userAtom } from "@/providers/JellyfinProvider"; import { useSettings } from "@/utils/atoms/settings"; +import { Ionicons } from "@expo/vector-icons"; import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models"; import { getItemsApi, @@ -18,7 +20,13 @@ import { useQuery, useQueryClient } from "@tanstack/react-query"; import { useRouter } from "expo-router"; import { useAtom } from "jotai"; import { useCallback, useEffect, useMemo, useState } from "react"; -import { RefreshControl, SafeAreaView, ScrollView, View } from "react-native"; +import { + ActivityIndicator, + RefreshControl, + SafeAreaView, + ScrollView, + View, +} from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; type BaseSection = { @@ -41,6 +49,7 @@ type Section = ScrollingCollectionListSection | MediaListSection; export default function index() { const queryClient = useQueryClient(); + const router = useRouter(); const [api] = useAtom(apiAtom); const [user] = useAtom(userAtom); @@ -49,6 +58,14 @@ export default function index() { const [settings, _] = useSettings(); const [isConnected, setIsConnected] = useState(null); + const [loadingRetry, setLoadingRetry] = useState(false); + + const checkConnection = useCallback(async () => { + setLoadingRetry(true); + const state = await NetInfo.fetch(); + setIsConnected(state.isConnected); + setLoadingRetry(false); + }, []); useEffect(() => { const unsubscribe = NetInfo.addEventListener((state) => { @@ -248,28 +265,47 @@ export default function index() { mediaListCollections, ]); - // if (isConnected === false) { - // return ( - // - // No Internet - // - // No worries, you can still watch{"\n"}downloaded content. - // - // - // - // - // - // ); - // } + if (isConnected === false) { + return ( + + No Internet + + No worries, you can still watch{"\n"}downloaded content. + + + + + + + ); + } const insets = useSafeAreaInsets();