diff --git a/apps/mobile/app/components/side-menu/menu-item.tsx b/apps/mobile/app/components/side-menu/menu-item.tsx index dd86a188d..a6ded5693 100644 --- a/apps/mobile/app/components/side-menu/menu-item.tsx +++ b/apps/mobile/app/components/side-menu/menu-item.tsx @@ -36,6 +36,7 @@ import { DefaultAppStyles } from "../../utils/styles"; import { Pressable } from "../ui/pressable"; import Paragraph from "../ui/typography/paragraph"; import { useMonographStore } from "../../stores/use-monograph-store"; +import { useReminderStore } from "../../stores/use-reminder-store"; function _MenuItem({ item, @@ -86,11 +87,11 @@ function _MenuItem({ ); break; case "Reminders": - unsub = useFavoriteStore.subscribe((state) => { + unsub = useReminderStore.subscribe((state) => { setItemCount(state.items?.placeholders.length || 0); }); setItemCount( - useFavoriteStore.getState().items?.placeholders?.length || 0 + useReminderStore.getState().items?.placeholders?.length || 0 ); break; case "Monographs": diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx index a42ef1af0..9f5dfc77e 100644 --- a/apps/mobile/app/hooks/use-app-events.tsx +++ b/apps/mobile/app/hooks/use-app-events.tsx @@ -82,7 +82,7 @@ import Notifications from "../services/notifications"; import PremiumService from "../services/premium"; import SettingsService from "../services/settings"; import Sync from "../services/sync"; -import { clearAllStores, initAfterSync } from "../stores"; +import { clearAllStores, initAfterSync, initialize } from "../stores"; import { refreshAllStores } from "../stores/create-db-collection-store"; import { useAttachmentStore } from "../stores/use-attachment-store"; import { useMessageStore } from "../stores/use-message-store"; @@ -393,6 +393,7 @@ const initializeDatabase = async (password?: string) => { try { await setupDatabase(password); await db.init(); + initialize(); Sync.run(); } catch (e) { DatabaseLogger.error(e as Error); diff --git a/apps/mobile/app/stores/index.ts b/apps/mobile/app/stores/index.ts index 0909ea480..6b6f3d9d6 100644 --- a/apps/mobile/app/stores/index.ts +++ b/apps/mobile/app/stores/index.ts @@ -36,20 +36,27 @@ export function initAfterSync() { Navigation.queueRoutesForUpdate(); // Whenever sync completes, try to reschedule // any new/updated reminders. + useUserStore.setState({ + profile: db.settings.getProfile() + }); + initialize(); + NotePreviewWidget.updateNotes(); +} + +export async function initialize() { Notifications.setupReminders(true); useRelationStore.getState().update(); useMenuStore.getState().setColorNotes(); useMenuStore.getState().setMenuPins(); useMonographStore.getState().refresh(); - useUserStore.setState({ - profile: db.settings.getProfile() - }); - - NotePreviewWidget.updateNotes(); + useTrashStore.getState().refresh(); + useNotebookStore.getState().refresh(); + useNoteStore.getState().refresh(); + useTagStore.getState().refresh(); + useFavoriteStore.getState().refresh(); + useReminderStore.getState().refresh(); } -export async function initialize() {} - export function clearAllStores() { useNotebookStore.getState().clear(); useTagStore.getState().clear();