mobile: fix crash on moving notebook when no notebooks selected

This commit is contained in:
Ammar Ahmed
2025-07-12 14:31:00 +05:00
parent 867af58695
commit 82de9b9b94
5 changed files with 30 additions and 11 deletions

View File

@@ -197,16 +197,6 @@ export const SelectionHeader = React.memo(
}
]
: [
{
title: strings.move(),
onPress: async () => {
const ids = selectedItemsList;
const notebooks = await db.notebooks.all.items(ids);
MoveNotebook.present(notebooks);
},
visible: renderedInRoute === "Notebooks",
icon: "arrow-right-bold-box-outline"
},
{
title: strings.manageTags(),
onPress: async () => {

View File

@@ -211,6 +211,14 @@ const TabBar = (
const ids = useSideMenuNotebookSelectionStore
.getState()
.getSelectedItemIds();
if (!ids.length) {
ToastManager.show({
context: "local",
type: "error",
message: strings.noNotebooksSelectedToMove()
});
return;
}
const notebooks = await db.notebooks.all.items(ids);
Navigation.navigate("MoveNotebook", {
selectedNotebooks: notebooks

View File

@@ -6,6 +6,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: en\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Plural-Forms: \n"
#: src/strings.ts:2410
msgid " \"Notebook > Notes\""
@@ -3946,6 +3952,10 @@ msgstr "No links found"
msgid "No note history available for this device."
msgstr "No note history available for this device."
#: src/strings.ts:2489
msgid "No notebooks selected to move"
msgstr "No notebooks selected to move"
#: src/strings.ts:202
msgid "No one can view this {type} except you."
msgstr "No one can view this {type} except you."

View File

@@ -6,6 +6,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: @lingui/cli\n"
"Language: pseudo-LOCALE\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Plural-Forms: \n"
#: src/strings.ts:2410
msgid " \"Notebook > Notes\""
@@ -3926,6 +3932,10 @@ msgstr ""
msgid "No note history available for this device."
msgstr ""
#: src/strings.ts:2489
msgid "No notebooks selected to move"
msgstr ""
#: src/strings.ts:202
msgid "No one can view this {type} except you."
msgstr ""

View File

@@ -2485,5 +2485,6 @@ Use this if changes from other devices are not appearing on this device. This wi
yourArchiveIsEmpty: () => t`Your archive is empty`,
unarchive: () => t`Unarchive`,
moveNotebookDesc: () =>
t`Select a notebook to move this notebook into, or unselect to move it to the root level.`
t`Select a notebook to move this notebook into, or unselect to move it to the root level.`,
noNotebooksSelectedToMove: () => t`No notebooks selected to move`
};