From 6dd16f6791d2abb6d12ce1e47295781d5b742f34 Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Wed, 12 Nov 2025 12:19:57 +0500 Subject: [PATCH] mobile: fix biometric unlock not working on iPad and tablet devices --- apps/mobile/app/screens/editor/index.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/mobile/app/screens/editor/index.tsx b/apps/mobile/app/screens/editor/index.tsx index 8733a4838..621dedda3 100755 --- a/apps/mobile/app/screens/editor/index.tsx +++ b/apps/mobile/app/screens/editor/index.tsx @@ -62,6 +62,7 @@ import { fluidTabsRef } from "../../utils/global-refs"; import { strings } from "@notesnook/intl"; import { i18n } from "@lingui/core"; import { useVaultStatus } from "../../hooks/use-vault-status"; +import { useSettingStore } from "../../stores/use-setting-store"; const style: ViewStyle = { height: "100%", @@ -231,7 +232,6 @@ const useLockedNoteHandler = () => { const unlockWithBiometrics = async () => { try { if (!tabRef.current?.session?.noteLocked || !tabRef.current) return; - console.log("Trying to unlock with biometrics..."); const credentials = await BiometricService.getCredentials( "Unlock note", "Unlock note to open it in editor." @@ -320,12 +320,16 @@ const useLockedNoteHandler = () => { } }; - const unlock = () => { + const unlock = (forced?: boolean) => { + const isMovedAway = + useSettingStore.getState().deviceMode !== "mobile" + ? false + : editorState().movedAway; if ( - (tabRef.current?.session?.locked, + tabRef.current?.session?.locked && useTabStore.getState().biometryAvailable && - useTabStore.getState().biometryEnrolled && - !editorState().movedAway) + useTabStore.getState().biometryEnrolled && + (!isMovedAway || forced) ) { setTimeout(() => { unlockWithBiometrics(); @@ -344,13 +348,15 @@ const useLockedNoteHandler = () => { const subs = [ eSubscribeEvent(eUnlockNote, unlock), eSubscribeEvent(eUnlockWithBiometrics, () => { - unlock(); + unlock(true); }), eSubscribeEvent(eUnlockWithPassword, onSubmit) ]; + if ( tabRef.current?.session?.locked && - fluidTabsRef.current?.page() === "editor" + (fluidTabsRef.current?.page() === "editor" || + useSettingStore.getState().deviceMode !== "mobile") ) { unlock(); }