Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mobile: fix ts errors #7557

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/mobile/app/components/list-items/note/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions apps/mobile/app/navigation/tabs-holder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions apps/mobile/app/screens/editor/tiptap/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Attachment>,
tabId: number
tabId: string
) => {
await this.sendCommand("setAttachmentProgress", attachmentProgress, tabId);
};
Expand All @@ -191,7 +191,7 @@ class Commands {
image: Omit<ImageAttributes, "bloburl"> & {
dataurl: string;
},
tabId: number
tabId: string
) => {
await this.sendCommand("insertImage", image, tabId);
};
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/app/screens/editor/tiptap/picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const santizeUri = (uri: string) => {

type PickerOptions = {
noteId?: string;
tabId?: number;
tabId?: string;
type: "image" | "camera" | "file";
reupload: boolean;
hash?: string;
Expand Down
3 changes: 2 additions & 1 deletion apps/mobile/app/screens/editor/tiptap/use-tab-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class TabSessionStorage {
}

static update(id: string, session: Partial<TabSessionItem>) {
if (!id) throw new Error("Session ID is required");
if (!id) return;
const currentSession = TabSessionStorage.get(id);
const newSession = {
...currentSession,
Expand Down Expand Up @@ -267,6 +267,7 @@ export const useTabStore = create<TabStore>(
TabSessionStorage.set(sessionId, session as TabSessionItem);
} else {
session = {
id: sessionId,
...TabSessionStorage.get(oldSessionId),
...options
};
Expand Down
10 changes: 7 additions & 3 deletions apps/mobile/app/services/backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -179,7 +183,7 @@ async function run(
canHideProgress: true
});
}
return;
return {};
}
backupRunning = true;
const androidBackupDirectory = (await checkBackupDirExists(
Expand Down Expand Up @@ -343,7 +347,7 @@ async function run(
endProgress();
}
return {
error: e,
error: e as Error,
report: true
};
}
Expand Down
Loading