diff --git a/apps/mobile/app/components/dialogs/vault/index.tsx b/apps/mobile/app/components/dialogs/vault/index.tsx index d5b24c06c..5157cb82a 100644 --- a/apps/mobile/app/components/dialogs/vault/index.tsx +++ b/apps/mobile/app/components/dialogs/vault/index.tsx @@ -67,9 +67,6 @@ import { } from "@notesnook/core"; import { useThemeColors } from "@notesnook/theme"; import { useUserStore } from "../../../stores/use-user-store"; -import { AppFontSize } from "../../../utils/size"; -import { Pressable } from "../../ui/pressable"; -import AppIcon from "../../ui/AppIcon"; export const VaultDialog: React.FC = () => { const { colors } = useThemeColors(); @@ -78,7 +75,6 @@ export const VaultDialog: React.FC = () => { const [visible, setVisible] = useState(false); const isUserLoggedIn = useUserStore((state) => !!state.user); const [loading, setLoading] = useState(false); - const [deleteAll, setDeleteAll] = useState(false); const [biometricUnlock, setBiometricUnlock] = useState(false); const [isBiometryAvailable, setIsBiometryAvailable] = useState(false); const [isBiometryEnrolled, setIsBiometryEnrolled] = useState(false); @@ -155,7 +151,6 @@ export const VaultDialog: React.FC = () => { // Reset UI state setVisible(false); setLoading(false); - setDeleteAll(false); setBiometricUnlock(false); setIsBiometryAvailable(false); setIsBiometryEnrolled(false); @@ -171,34 +166,30 @@ export const VaultDialog: React.FC = () => { } if (verified) { let noteIds: string[] = []; - if (deleteAll) { - const vault = await db.vaults.default(); - const relations = await db.relations - .from( - { - type: "vault", - id: vault!.id - }, - "note" - ) - .get(); - noteIds = relations.map((item) => item.toId); - } - await db.vault.delete(deleteAll); + const vault = await db.vaults.default(); + const relations = await db.relations + .from( + { + type: "vault", + id: vault!.id + }, + "note" + ) + .get(); + noteIds = relations.map((item) => item.toId); + await db.vault.delete(); await BiometricService.resetCredentials(); - if (deleteAll) { - noteIds.forEach((id) => { - eSendEvent( - eUpdateNoteInEditor, - { - id: id, - deleted: true - }, - true - ); - }); - } + noteIds.forEach((id) => { + eSendEvent( + eUpdateNoteInEditor, + { + id: id, + deleted: true + }, + true + ); + }); eSendEvent("vaultUpdated"); setLoading(false); close(); @@ -214,7 +205,7 @@ export const VaultDialog: React.FC = () => { } catch (e) { console.error(e); } - }, [deleteAll, close]); + }, [close]); const clearVault = useCallback(async () => { setLoading(true); @@ -638,7 +629,6 @@ export const VaultDialog: React.FC = () => { setIsBiometryAvailable(available); setIsBiometryEnrolled(fingerprint); setBiometricUnlock(fingerprint); - setDeleteAll(false); setLoading(false); // Auto-unlock with fingerprint if applicable @@ -797,35 +787,6 @@ export const VaultDialog: React.FC = () => { ) : null} - {isDeleteVault && ( - setDeleteAll(!deleteAll)} - style={{ - paddingVertical: 0, - flexDirection: "row", - gap: DefaultAppStyles.GAP_SMALL, - marginTop: isUserLoggedIn - ? DefaultAppStyles.GAP_VERTICAL_SMALL - : 0, - justifyContent: "flex-start" - }} - > - - - - {strings.deleteAllNotes()} - - - )} - {isChangePassword ? ( <> diff --git a/apps/mobile/e2e/tests/vault.e2e.ts b/apps/mobile/e2e/tests/vault.e2e.ts index fe72ad460..a821a7882 100644 --- a/apps/mobile/e2e/tests/vault.e2e.ts +++ b/apps/mobile/e2e/tests/vault.e2e.ts @@ -115,22 +115,6 @@ describe("VAULT", () => { .waitAndTapByText("Delete") .isVisibleByText("Create vault") .pressBack(3) - .isVisibleById(notesnook.listitem.menu) - .run(); - }); - - it("Delete vault with locked notes", async () => { - await TestBuilder.create() - .prepare() - .createNote() - .addStep(lockNote) - .addStep(goToPrivacySecuritySettings) - .waitAndTapByText("Delete vault") - .typeTextById(notesnook.ids.dialogs.vault.pwd, "1234") - .waitAndTapByText("Delete notes in this vault") - .waitAndTapByText("Delete") - .isVisibleByText("Create vault") - .pressBack(3) .isNotVisibleById(notesnook.listitem.menu) .run(); });