diff --git a/apps/mobile/app/components/list-items/note/index.tsx b/apps/mobile/app/components/list-items/note/index.tsx index 4ea00e6f1f..60cb08205e 100644 --- a/apps/mobile/app/components/list-items/note/index.tsx +++ b/apps/mobile/app/components/list-items/note/index.tsx @@ -76,7 +76,8 @@ const NoteItem = ({ }: NoteItemProps) => { const isEditingNote = useTabStore( (state) => - state.tabs.find((t) => t.id === state.currentTab)?.noteId === item.id + state.tabs.find((t) => t.id === state.currentTab)?.session?.noteId === + item.id ); const { colors } = useThemeColors(); const compactMode = useIsCompactModeEnabled( diff --git a/apps/mobile/app/components/list-items/selection-wrapper/back-fill.tsx b/apps/mobile/app/components/list-items/selection-wrapper/back-fill.tsx index 5a1d3bc316..c926d5151d 100644 --- a/apps/mobile/app/components/list-items/selection-wrapper/back-fill.tsx +++ b/apps/mobile/app/components/list-items/selection-wrapper/back-fill.tsx @@ -28,7 +28,8 @@ export const Filler = ({ item, color }: { item: Item; color?: string }) => { const { colors } = useThemeColors(); const isEditingNote = useTabStore( (state) => - state.tabs.find((t) => t.id === state.currentTab)?.noteId === item.id + state.tabs.find((t) => t.id === state.currentTab)?.session?.noteId === + item.id ); const [selected] = useIsSelected(item); diff --git a/apps/mobile/app/navigation/tabs-holder.js b/apps/mobile/app/navigation/tabs-holder.js index 158a51688e..c00e54d7f2 100644 --- a/apps/mobile/app/navigation/tabs-holder.js +++ b/apps/mobile/app/navigation/tabs-holder.js @@ -509,7 +509,8 @@ const onChangeTab = async (event) => { }); } else { if ( - useTabStore.getState().getTab(useTabStore.getState().currentTab).locked + useTabStore.getState().getTab(useTabStore.getState().currentTab).session + ?.locked ) { eSendEvent(eUnlockNote); } @@ -523,7 +524,7 @@ const onChangeTab = async (event) => { // Lock all tabs with locked notes... for (const tab of useTabStore.getState().tabs) { - const noteId = useTabStore.getState().getTab(tab.id)?.noteId; + const noteId = useTabStore.getState().getTab(tab.id)?.session?.noteId; if (!noteId) continue; const note = await db.notes.note(noteId); const locked = note && (await db.vaults.itemExists(note)); diff --git a/apps/mobile/app/screens/editor/tiptap/commands.ts b/apps/mobile/app/screens/editor/tiptap/commands.ts index 5119c8232c..ae5eada472 100644 --- a/apps/mobile/app/screens/editor/tiptap/commands.ts +++ b/apps/mobile/app/screens/editor/tiptap/commands.ts @@ -176,13 +176,13 @@ class Commands { await this.sendCommand("clearTags", tabId); }; - insertAttachment = async (attachment: Attachment, tabId: number) => { + insertAttachment = async (attachment: Attachment, tabId: string) => { await this.sendCommand("insertAttachment", attachment, tabId); }; setAttachmentProgress = async ( attachmentProgress: Partial, - tabId: number + tabId: string ) => { await this.sendCommand("setAttachmentProgress", attachmentProgress, tabId); }; @@ -191,7 +191,7 @@ class Commands { image: Omit & { dataurl: string; }, - tabId: number + tabId: string ) => { await this.sendCommand("insertImage", image, tabId); }; diff --git a/apps/mobile/app/screens/editor/tiptap/picker.ts b/apps/mobile/app/screens/editor/tiptap/picker.ts index c1dfce4bd1..e1436aa9b1 100644 --- a/apps/mobile/app/screens/editor/tiptap/picker.ts +++ b/apps/mobile/app/screens/editor/tiptap/picker.ts @@ -61,7 +61,7 @@ const santizeUri = (uri: string) => { type PickerOptions = { noteId?: string; - tabId?: number; + tabId?: string; type: "image" | "camera" | "file"; reupload: boolean; hash?: string; diff --git a/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts b/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts index 3166eedbad..2ee363cc60 100644 --- a/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts +++ b/apps/mobile/app/screens/editor/tiptap/use-tab-store.ts @@ -105,7 +105,7 @@ class TabSessionStorage { } static update(id: string, session: Partial) { - if (!id) throw new Error("Session ID is required"); + if (!id) return; const currentSession = TabSessionStorage.get(id); const newSession = { ...currentSession, @@ -267,6 +267,7 @@ export const useTabStore = create( TabSessionStorage.set(sessionId, session as TabSessionItem); } else { session = { + id: sessionId, ...TabSessionStorage.get(oldSessionId), ...options }; diff --git a/apps/mobile/app/services/backup.ts b/apps/mobile/app/services/backup.ts index 2a0e356929..5153834f68 100644 --- a/apps/mobile/app/services/backup.ts +++ b/apps/mobile/app/services/backup.ts @@ -169,7 +169,11 @@ async function run( progress = false, context?: string, backupType: "full" | "partial" = "partial" -) { +): Promise<{ + path?: string; + error?: Error; + report?: boolean; +}> { if (backupRunning) { if (progress) { startProgress({ @@ -179,7 +183,7 @@ async function run( canHideProgress: true }); } - return; + return {}; } backupRunning = true; const androidBackupDirectory = (await checkBackupDirExists( @@ -343,7 +347,7 @@ async function run( endProgress(); } return { - error: e, + error: e as Error, report: true }; }