diff --git a/app/_layout.tsx b/app/_layout.tsx index 695d468..4d5301a 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -81,8 +81,8 @@ export default function RootLayout() { async function checkBiometricStatus() { const compatible = await LocalAuthentication.hasHardwareAsync(); - const enrolled = await LocalAuthentication.isEnrolledAsync(); - if (compatible && enrolled) { + const securityLevel = await LocalAuthentication.getEnrolledLevelAsync(); + if (compatible && securityLevel > 0) { useAppStore.getState().setBiometricSupported(true); } else { useAppStore.getState().setBiometricSupported(false); diff --git a/components/Icons.tsx b/components/Icons.tsx index 8c0cf55..51d14a2 100644 --- a/components/Icons.tsx +++ b/components/Icons.tsx @@ -37,6 +37,7 @@ import { Fingerprint, HelpCircle, CircleCheck, + TriangleAlert, } from "lucide-react-native"; import { cssInterop } from "nativewind"; @@ -89,6 +90,7 @@ interopIcon(Egg); interopIcon(Fingerprint); interopIcon(HelpCircle); interopIcon(CircleCheck); +interopIcon(TriangleAlert); export { AlertCircle, @@ -128,4 +130,5 @@ export { Fingerprint, HelpCircle, CircleCheck, + TriangleAlert, }; diff --git a/pages/settings/Security.tsx b/pages/settings/Security.tsx index 2d76e12..b15372a 100644 --- a/pages/settings/Security.tsx +++ b/pages/settings/Security.tsx @@ -4,22 +4,37 @@ import { Label } from "~/components/ui/label"; import { Switch } from "~/components/ui/switch"; import Screen from "~/components/Screen"; import { useAppStore } from "~/lib/state/appStore"; +import { TriangleAlert } from "~/components/Icons"; +import { cn } from "~/lib/utils"; export function Security() { const isEnabled = useAppStore((store) => store.isSecurityEnabled); + const isSupported = useAppStore((store) => store.isBiometricSupported); return ( + {!isSupported && ( + + + + Can't add security + + Add phone lock in device settings to secure access + + + + )} { useAppStore.getState().setSecurityEnabled(!isEnabled); }} diff --git a/pages/settings/Settings.tsx b/pages/settings/Settings.tsx index a3bfb0d..6825aaf 100644 --- a/pages/settings/Settings.tsx +++ b/pages/settings/Settings.tsx @@ -44,16 +44,14 @@ export function Settings() { - {isBiometricSupported && ( - - - - - Security - - - - )} + + + + + Security + + +