mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-24 04:00:59 +01:00
mobile: fix unlocking note with biometrics
This commit is contained in:
@@ -248,14 +248,13 @@ const useLockedNoteHandler = () => {
|
||||
);
|
||||
|
||||
eSendEvent(eOnLoadNote, {
|
||||
item: note
|
||||
});
|
||||
|
||||
useTabStore.getState().updateTab(tabRef.current.id, {
|
||||
session: {
|
||||
locked: false
|
||||
}
|
||||
item: note,
|
||||
refresh: true
|
||||
});
|
||||
} else {
|
||||
if (tabRef.current && tabRef.current.session?.locked) {
|
||||
editorController.current?.commands.focusPassInput();
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -310,12 +309,8 @@ const useLockedNoteHandler = () => {
|
||||
}
|
||||
}
|
||||
eSendEvent(eOnLoadNote, {
|
||||
item: note
|
||||
});
|
||||
useTabStore.getState().updateTab(tabRef.current.id, {
|
||||
session: {
|
||||
locked: false
|
||||
}
|
||||
item: note,
|
||||
refresh: true
|
||||
});
|
||||
} catch (e) {
|
||||
ToastManager.show({
|
||||
|
||||
@@ -90,8 +90,14 @@ class Commands {
|
||||
|
||||
const locked = useTabStore.getState().getTab(tabId)?.session?.locked;
|
||||
if (Platform.OS === "android") {
|
||||
//this.ref.current?.requestFocus();
|
||||
setTimeout(async () => {
|
||||
if (
|
||||
locked &&
|
||||
useTabStore.getState().biometryAvailable &&
|
||||
useTabStore.getState().biometryEnrolled
|
||||
)
|
||||
return;
|
||||
|
||||
if (!this.ref) return;
|
||||
textInput.current?.focus();
|
||||
await this.sendCommand("focus", tabId, locked);
|
||||
|
||||
@@ -501,6 +501,7 @@ export const useEditor = (
|
||||
blockId?: string;
|
||||
session?: TabSessionItem;
|
||||
newTab?: boolean;
|
||||
refresh?: boolean;
|
||||
}) => {
|
||||
loadNoteMutex.runExclusive(async () => {
|
||||
if (!event) return;
|
||||
@@ -574,11 +575,10 @@ export const useEditor = (
|
||||
? event.tabId
|
||||
: useTabStore.getState().currentTab;
|
||||
|
||||
console.log(tabId === useTabStore.getState().currentTab);
|
||||
|
||||
// Check if tab needs to be refreshed.
|
||||
if (!event.newTab) {
|
||||
if (
|
||||
!event.refresh &&
|
||||
tabId &&
|
||||
event.item.id === useTabStore.getState().getNoteIdForTab(tabId) &&
|
||||
!localTabState.current?.needsRefresh(
|
||||
|
||||
@@ -358,8 +358,8 @@ export const useTabStore = create<TabStore>(
|
||||
|
||||
if (note) {
|
||||
const isLocked = await db.vaults.itemExists(note);
|
||||
session.noteLocked = isLocked;
|
||||
session.locked = isLocked;
|
||||
session.noteLocked = isLocked && !session?.noteLocked;
|
||||
|
||||
session.readonly = note.readonly;
|
||||
} else if (session.noteId) {
|
||||
|
||||
@@ -556,7 +556,7 @@ const Tiptap = ({
|
||||
</>
|
||||
)}
|
||||
|
||||
{controller.loading || tab.session?.noteLocked ? (
|
||||
{controller.loading || tab.session?.locked ? (
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
@@ -568,10 +568,8 @@ const Tiptap = ({
|
||||
paddingLeft: 12,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: tab.session?.noteLocked ? "center" : "flex-start",
|
||||
justifyContent: tab.session?.noteLocked
|
||||
? "center"
|
||||
: "flex-start",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
boxSizing: "border-box",
|
||||
rowGap: 10
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user