diff --git a/.gitignore b/.gitignore index e79b70d..3492e0a 100755 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ coverage/ .tmp/ *.tmp nul + +# Opencode +.opencode/ diff --git a/apps/mobile/src/features/profile/hooks/useProfileSettings.ts b/apps/mobile/src/features/profile/hooks/useProfileSettings.ts index 2cc9ec5..3a6beee 100644 --- a/apps/mobile/src/features/profile/hooks/useProfileSettings.ts +++ b/apps/mobile/src/features/profile/hooks/useProfileSettings.ts @@ -277,11 +277,27 @@ export function useProfileSettings() { }; const handleBiometricToggle = async (value: boolean) => { - setBiometricEnabledState(value); setIsUpdatingBiometric(true); try { - await setBiometricEnabled(value); + if (value) { + const { authenticateWithBiometric } = await import('../../../lib/biometricAuth'); + const success = await authenticateWithBiometric(); + + if (!success) { + Alert.alert( + "Authentication Failed", + `Could not verify your ${biometricType}. Please try again.` + ); + return; + } + + await setBiometricEnabled(true); + setBiometricEnabledState(true); + } else { + await setBiometricEnabled(false); + setBiometricEnabledState(false); + } } catch (error) { setBiometricEnabledState(!value); Alert.alert("Error", `Failed to ${value ? "enable" : "disable"} ${biometricType}. Please try again.`);