From e4e1eb0ced503d233386b74e9f33430361c85b0e Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Fri, 22 Mar 2024 08:35:35 +0500 Subject: [PATCH] mobile: fix tag delete in bulk --- apps/mobile/app/utils/functions.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/apps/mobile/app/utils/functions.js b/apps/mobile/app/utils/functions.js index 0f0d0d3bc..77997f291 100644 --- a/apps/mobile/app/utils/functions.js +++ b/apps/mobile/app/utils/functions.js @@ -27,6 +27,7 @@ import { useRelationStore } from "../stores/use-relation-store"; import { useSelectionStore } from "../stores/use-selection-store"; import { eOnNotebookUpdated, eUpdateNoteInEditor } from "./events"; import { getParentNotebookId } from "./notebooks"; +import { useTagStore } from "../stores/use-tag-store"; function confirmDeleteAllNotes(items, type, context) { return new Promise((resolve) => { @@ -110,6 +111,20 @@ export const deleteItems = async (items, type, context) => { await deleteNotebook(id, result.deleteNotes); eSendEvent(eOnNotebookUpdated, await getParentNotebookId(id)); } + } else if (type === "tag") { + presentDialog({ + title: `Delete ${ids.length} ${ids.length > 1 ? "tags" : "tag"}?`, + positiveText: "Delete", + negativeText: "Cancel", + paragraph: "Are you sure you want to delete these tags?", + positivePress: async () => { + await db.tags.remove(...ids); + useTagStore.getState().refresh(); + useRelationStore.getState().update(); + }, + context: context + }); + return; } let message = `${ids.length} ${