Show usermenu biometrics item also when not enrolled - #558
Open
WouterAms wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the User settings menu to display the biometrics navigation item whenever biometrics are supported on the device, even if the user has not enrolled biometrics yet.
Changes:
- Stop using
isEnrolledto decide whether to render the biometrics menu item. - Render the biometrics menu item as long as
biometricsLabelis available.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (4)
src/modules/user/screens/UserBiometrics.screen.tsx:36
- The nested
if (!isEnrolled)insideif (!useBiometrics && !isEnrolled)is redundant; the outer condition already guarantees!isEnrolled. This adds unnecessary branching and makes the intent harder to read.
const onChange = useCallback(() => {
if (!useBiometrics && !isEnrolled) {
if (!isEnrolled) {
navigateToInstructionsScreen()
}
return
}
src/modules/user/components/UserMenu.tsx:80
isBiometricsSupportedis currently derived frombiometricsLabel(!!biometricsLabelinuseAccessCodeBiometrics), so checking both!biometricsLabel || !isBiometricsSupportedis redundant and can hide the actual gating condition.
{navigationItems.map(({icon, ...item}) =>
item.route === UserRouteName.userBiometrics &&
(!biometricsLabel || !isBiometricsSupported) ? null : (
<NavigationButton
src/modules/access-code/hooks/useAccessCodeBiometrics.ts:84
updateUseBiometricsrequests iOS Face ID permission and toggles the setting off when permission is denied, but it no longer provides a way for the UI to react (e.g., navigate to the biometrics instructions/settings screen). Previously the screen handled!grantedby navigating; now the toggle can silently revert with no guidance for the user.
if (
Platform.OS === 'ios' &&
biometricsAuthenticationType?.includes(
AuthenticationType.FACIAL_RECOGNITION,
)
) {
const granted = await requestPermission()
setUseBiometrics(granted)
return
}
src/hooks/useBiometrics.test.tsx:16
- The test uses
SecurityLevel.BIOMETRIC_STRONG, but the mockedSecurityLevelobject does not defineBIOMETRIC_STRONG. This makes the test run againstundefinedand can mask real behavior differences.
jest.mock('expo-local-authentication', () => ({
authenticateAsync: jest.fn(),
getEnrolledLevelAsync: jest.fn(),
SecurityLevel: {
NONE: 0,
BIOMETRIC: 1,
},
}))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Test instructions
Other notes
GitHub Copilot was used in writing the code