From c0643f564db57fa2eb314773cccff7f61407c3fc Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Thu, 20 Feb 2025 21:42:34 +0100 Subject: [PATCH] fix: include count --- components/settings/StorageSettings.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/settings/StorageSettings.tsx b/components/settings/StorageSettings.tsx index 9dbb4bc5..240d4029 100644 --- a/components/settings/StorageSettings.tsx +++ b/components/settings/StorageSettings.tsx @@ -10,7 +10,7 @@ import { ListItem } from "../list/ListItem"; import { useTranslation } from "react-i18next"; import { storage } from "@/utils/mmkv"; 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 = () => { const { deleteAllFiles, appSizeUsage } = useDownload(); @@ -48,6 +48,17 @@ export const StorageSettings = () => { 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 ( @@ -120,7 +131,7 @@ export const StorageSettings = () => {