From 3f9d3ceffac206645ff9e5b66e68bf2e7b9cd0e2 Mon Sep 17 00:00:00 2001 From: Aman Harwara Date: Wed, 28 Sep 2022 21:26:20 +0530 Subject: [PATCH] fix: improve biometrics input on mobile webview (#1658) --- .../ChallengeModal/BiometricsPrompt.tsx | 44 +++++++++++++++++++ .../ChallengeModal/ChallengePrompt.tsx | 30 ++++--------- 2 files changed, 52 insertions(+), 22 deletions(-) create mode 100644 packages/web/src/javascripts/Components/ChallengeModal/BiometricsPrompt.tsx diff --git a/packages/web/src/javascripts/Components/ChallengeModal/BiometricsPrompt.tsx b/packages/web/src/javascripts/Components/ChallengeModal/BiometricsPrompt.tsx new file mode 100644 index 000000000..b0be14112 --- /dev/null +++ b/packages/web/src/javascripts/Components/ChallengeModal/BiometricsPrompt.tsx @@ -0,0 +1,44 @@ +import { WebApplication } from '@/Application/Application' +import { ChallengePrompt } from '@standardnotes/services' +import { RefObject, useState } from 'react' +import Button from '../Button/Button' +import Icon from '../Icon/Icon' +import { InputValue } from './InputValue' + +type Props = { + application: WebApplication + onValueChange: (value: InputValue['value'], prompt: ChallengePrompt) => void + prompt: ChallengePrompt + buttonRef: RefObject +} + +const BiometricsPrompt = ({ application, onValueChange, prompt, buttonRef }: Props) => { + const [authenticated, setAuthenticated] = useState(false) + + return ( +
+ +
+ ) +} + +export default BiometricsPrompt diff --git a/packages/web/src/javascripts/Components/ChallengeModal/ChallengePrompt.tsx b/packages/web/src/javascripts/Components/ChallengeModal/ChallengePrompt.tsx index df1955725..0e9c09e0f 100644 --- a/packages/web/src/javascripts/Components/ChallengeModal/ChallengePrompt.tsx +++ b/packages/web/src/javascripts/Components/ChallengeModal/ChallengePrompt.tsx @@ -1,16 +1,11 @@ -import { - ChallengePrompt, - ChallengeValidation, - MobileDeviceInterface, - ProtectionSessionDurations, -} from '@standardnotes/snjs' +import { ChallengePrompt, ChallengeValidation, ProtectionSessionDurations } from '@standardnotes/snjs' import { FunctionComponent, useEffect, useRef } from 'react' import DecoratedInput from '@/Components/Input/DecoratedInput' import DecoratedPasswordInput from '@/Components/Input/DecoratedPasswordInput' import { ChallengeModalValues } from './ChallengeModalValues' -import Button from '../Button/Button' import { WebApplication } from '@/Application/Application' import { InputValue } from './InputValue' +import BiometricsPrompt from './BiometricsPrompt' type Props = { application: WebApplication @@ -87,21 +82,12 @@ const ChallengeModalPrompt: FunctionComponent = ({ ) : prompt.validation === ChallengeValidation.Biometric ? ( -
- -
+ ) : prompt.secureTextEntry ? (