mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-06-01 03:28:27 +01:00
fix: include count
This commit is contained in:
@@ -10,7 +10,7 @@ import { ListItem } from "../list/ListItem";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { storage } from "@/utils/mmkv";
|
import { storage } from "@/utils/mmkv";
|
||||||
import { RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY } from "@/utils/recently-added-notifications";
|
import { RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY } from "@/utils/recently-added-notifications";
|
||||||
import { useCallback } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
|
|
||||||
export const StorageSettings = () => {
|
export const StorageSettings = () => {
|
||||||
const { deleteAllFiles, appSizeUsage } = useDownload();
|
const { deleteAllFiles, appSizeUsage } = useDownload();
|
||||||
@@ -48,6 +48,17 @@ export const StorageSettings = () => {
|
|||||||
storage.delete(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY);
|
storage.delete(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const recentlyAddedNotificationsItemIds = useMemo(() => {
|
||||||
|
const s = storage.getString(RECENTLY_ADDED_SENT_NOTIFICATIONS_ITEM_IDS_KEY);
|
||||||
|
if (!s) return [] as string[];
|
||||||
|
try {
|
||||||
|
const t: string[] = JSON.parse(s);
|
||||||
|
return t;
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error("Failed to parse recently added notifications item ids");
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<View className="flex flex-col gap-y-1">
|
<View className="flex flex-col gap-y-1">
|
||||||
@@ -120,7 +131,7 @@ export const StorageSettings = () => {
|
|||||||
<ListItem
|
<ListItem
|
||||||
textColor="red"
|
textColor="red"
|
||||||
onPress={clearRecentlyAddedNotifications}
|
onPress={clearRecentlyAddedNotifications}
|
||||||
title={"Reset recently added notifications"}
|
title={`Reset recently added notifications (${recentlyAddedNotificationsItemIds.length})`}
|
||||||
/>
|
/>
|
||||||
</ListGroup>
|
</ListGroup>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
Reference in New Issue
Block a user