Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: fix crash on moving notebook when no notebooks selected

Ammar Ahmed82de9b9b94bb
diff --git a/apps/mobile/app/components/selection-header/index.tsx b/apps/mobile/app/components/selection-header/index.tsx
index 7233a3536..493b94131 100644
--- a/apps/mobile/app/components/selection-header/index.tsx
+++ b/apps/mobile/app/components/selection-header/index.tsx
@@ -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 () => {
diff --git a/apps/mobile/app/components/side-menu/index.tsx b/apps/mobile/app/components/side-menu/index.tsx
index 2ac6a0174..3642d7ed1 100644
--- a/apps/mobile/app/components/side-menu/index.tsx
+++ b/apps/mobile/app/components/side-menu/index.tsx
@@ -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
diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po
index ae567805a..13886bc7d 100644
--- a/packages/intl/locale/en.po
+++ b/packages/intl/locale/en.po
@@ -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."
diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po
index e464c9dfb..e96a41c06 100644
--- a/packages/intl/locale/pseudo-LOCALE.po
+++ b/packages/intl/locale/pseudo-LOCALE.po
@@ -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 ""
diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts
index 427301eb9..e650d1503 100644
--- a/packages/intl/src/strings.ts
+++ b/packages/intl/src/strings.ts
@@ -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`
};