diff --git a/app/(auth)/(tabs)/index.tsx b/app/(auth)/(tabs)/index.tsx
index 7ce65e50..b19d9995 100644
--- a/app/(auth)/(tabs)/index.tsx
+++ b/app/(auth)/(tabs)/index.tsx
@@ -85,6 +85,16 @@ export default function index() {
staleTime: 60,
});
+ if (isError)
+ return (
+
+ Oops!
+
+ Something went wrong.{"\n"}Please log out and in again.
+
+
+ );
+
if (isLoading)
return (
@@ -92,8 +102,6 @@ export default function index() {
);
- if (isError) return Error loading items;
-
if (!data || data.length === 0) return No data...;
return (
diff --git a/app/(auth)/settings.tsx b/app/(auth)/settings.tsx
index 9776fa53..6db4dc87 100644
--- a/app/(auth)/settings.tsx
+++ b/app/(auth)/settings.tsx
@@ -1,9 +1,9 @@
import { Button } from "@/components/Button";
import { Text } from "@/components/common/Text";
-import { runningProcesses } from "@/components/DownloadItem";
import { ListItem } from "@/components/ListItem";
import ProgressCircle from "@/components/ProgressCircle";
import { apiAtom, useJellyfin, userAtom } from "@/providers/JellyfinProvider";
+import { runningProcesses } from "@/utils/atoms/downloads";
import { readFromLog } from "@/utils/log";
import { Ionicons } from "@expo/vector-icons";
import { BaseItemDto } from "@jellyfin/sdk/lib/generated-client/models";
@@ -38,14 +38,11 @@ const deleteFile = async (id: string | null | undefined) => {
(err) => console.error(err)
);
- AsyncStorage.setItem(
- "downloaded_files",
- JSON.stringify([
- JSON.parse(
- (await AsyncStorage.getItem("downloaded_files")) || "[]"
- ).filter((f: string) => f !== id),
- ])
+ const currentFiles = JSON.parse(
+ (await AsyncStorage.getItem("downloaded_files")) ?? "[]"
);
+ const updatedFiles = currentFiles.filter((f: string) => f !== id);
+ await AsyncStorage.setItem("downloaded_files", JSON.stringify(updatedFiles));
};
const listDownloadedFiles = async () => {
@@ -81,6 +78,11 @@ export default function settings() {
(await AsyncStorage.getItem("downloaded_files")) || "[]"
) as BaseItemDto[];
+ console.log(
+ "Files",
+ data.map((i) => i.Name)
+ );
+
setFiles(data);
})();
}, [key]);
@@ -160,8 +162,8 @@ export default function settings() {