mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
mobile: fix ts errors
This commit is contained in:
@@ -76,7 +76,8 @@ const NoteItem = ({
|
|||||||
}: NoteItemProps) => {
|
}: NoteItemProps) => {
|
||||||
const isEditingNote = useTabStore(
|
const isEditingNote = useTabStore(
|
||||||
(state) =>
|
(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 { colors } = useThemeColors();
|
||||||
const compactMode = useIsCompactModeEnabled(
|
const compactMode = useIsCompactModeEnabled(
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export const Filler = ({ item, color }: { item: Item; color?: string }) => {
|
|||||||
const { colors } = useThemeColors();
|
const { colors } = useThemeColors();
|
||||||
const isEditingNote = useTabStore(
|
const isEditingNote = useTabStore(
|
||||||
(state) =>
|
(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);
|
const [selected] = useIsSelected(item);
|
||||||
|
|||||||
@@ -509,7 +509,8 @@ const onChangeTab = async (event) => {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (
|
if (
|
||||||
useTabStore.getState().getTab(useTabStore.getState().currentTab).locked
|
useTabStore.getState().getTab(useTabStore.getState().currentTab).session
|
||||||
|
?.locked
|
||||||
) {
|
) {
|
||||||
eSendEvent(eUnlockNote);
|
eSendEvent(eUnlockNote);
|
||||||
}
|
}
|
||||||
@@ -523,7 +524,7 @@ const onChangeTab = async (event) => {
|
|||||||
|
|
||||||
// Lock all tabs with locked notes...
|
// Lock all tabs with locked notes...
|
||||||
for (const tab of useTabStore.getState().tabs) {
|
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;
|
if (!noteId) continue;
|
||||||
const note = await db.notes.note(noteId);
|
const note = await db.notes.note(noteId);
|
||||||
const locked = note && (await db.vaults.itemExists(note));
|
const locked = note && (await db.vaults.itemExists(note));
|
||||||
|
|||||||
@@ -176,13 +176,13 @@ class Commands {
|
|||||||
await this.sendCommand("clearTags", tabId);
|
await this.sendCommand("clearTags", tabId);
|
||||||
};
|
};
|
||||||
|
|
||||||
insertAttachment = async (attachment: Attachment, tabId: number) => {
|
insertAttachment = async (attachment: Attachment, tabId: string) => {
|
||||||
await this.sendCommand("insertAttachment", attachment, tabId);
|
await this.sendCommand("insertAttachment", attachment, tabId);
|
||||||
};
|
};
|
||||||
|
|
||||||
setAttachmentProgress = async (
|
setAttachmentProgress = async (
|
||||||
attachmentProgress: Partial<Attachment>,
|
attachmentProgress: Partial<Attachment>,
|
||||||
tabId: number
|
tabId: string
|
||||||
) => {
|
) => {
|
||||||
await this.sendCommand("setAttachmentProgress", attachmentProgress, tabId);
|
await this.sendCommand("setAttachmentProgress", attachmentProgress, tabId);
|
||||||
};
|
};
|
||||||
@@ -191,7 +191,7 @@ class Commands {
|
|||||||
image: Omit<ImageAttributes, "bloburl"> & {
|
image: Omit<ImageAttributes, "bloburl"> & {
|
||||||
dataurl: string;
|
dataurl: string;
|
||||||
},
|
},
|
||||||
tabId: number
|
tabId: string
|
||||||
) => {
|
) => {
|
||||||
await this.sendCommand("insertImage", image, tabId);
|
await this.sendCommand("insertImage", image, tabId);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const santizeUri = (uri: string) => {
|
|||||||
|
|
||||||
type PickerOptions = {
|
type PickerOptions = {
|
||||||
noteId?: string;
|
noteId?: string;
|
||||||
tabId?: number;
|
tabId?: string;
|
||||||
type: "image" | "camera" | "file";
|
type: "image" | "camera" | "file";
|
||||||
reupload: boolean;
|
reupload: boolean;
|
||||||
hash?: string;
|
hash?: string;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class TabSessionStorage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static update(id: string, session: Partial<TabSessionItem>) {
|
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 currentSession = TabSessionStorage.get(id);
|
||||||
const newSession = {
|
const newSession = {
|
||||||
...currentSession,
|
...currentSession,
|
||||||
@@ -267,6 +267,7 @@ export const useTabStore = create<TabStore>(
|
|||||||
TabSessionStorage.set(sessionId, session as TabSessionItem);
|
TabSessionStorage.set(sessionId, session as TabSessionItem);
|
||||||
} else {
|
} else {
|
||||||
session = {
|
session = {
|
||||||
|
id: sessionId,
|
||||||
...TabSessionStorage.get(oldSessionId),
|
...TabSessionStorage.get(oldSessionId),
|
||||||
...options
|
...options
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -169,7 +169,11 @@ async function run(
|
|||||||
progress = false,
|
progress = false,
|
||||||
context?: string,
|
context?: string,
|
||||||
backupType: "full" | "partial" = "partial"
|
backupType: "full" | "partial" = "partial"
|
||||||
) {
|
): Promise<{
|
||||||
|
path?: string;
|
||||||
|
error?: Error;
|
||||||
|
report?: boolean;
|
||||||
|
}> {
|
||||||
if (backupRunning) {
|
if (backupRunning) {
|
||||||
if (progress) {
|
if (progress) {
|
||||||
startProgress({
|
startProgress({
|
||||||
@@ -179,7 +183,7 @@ async function run(
|
|||||||
canHideProgress: true
|
canHideProgress: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return;
|
return {};
|
||||||
}
|
}
|
||||||
backupRunning = true;
|
backupRunning = true;
|
||||||
const androidBackupDirectory = (await checkBackupDirExists(
|
const androidBackupDirectory = (await checkBackupDirExists(
|
||||||
@@ -343,7 +347,7 @@ async function run(
|
|||||||
endProgress();
|
endProgress();
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
error: e,
|
error: e as Error,
|
||||||
report: true
|
report: true
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user