feat: implement biometric app lock with settings and session state ma… - #38
Open
Aswin2702 wants to merge 2 commits into
Open
feat: implement biometric app lock with settings and session state ma…#38Aswin2702 wants to merge 2 commits into
Aswin2702 wants to merge 2 commits into
Conversation
Aswin2702
commented
Jul 12, 2026
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.
🔒 Feat: Biometric App Lock (FaceID / Fingerprint)
📝 Description
This PR introduces an opt-in Biometric App Lock to enhance the privacy of the user's financial data. It allows users to lock the app behind FaceID (iOS) or Fingerprint/Biometrics (Android). The implementation is non-breaking, privacy-first, and relies on secure OS-level biometric prompts.
🚀 Key Features & Changes
New AppLockContext (src/context/AppLockContext.tsx):
Listens to AppState to instantly lock the app when returning from the background.
Automatically triggers the native biometric prompt.
Secures the user preference locally via MMKV (StorageService).
Includes a Graceful Fallback: If the user removes their fingerprint at the OS level while the lock is enabled, the app detects the sensor is no longer available and safely disables the lock to prevent permanent lockouts.
Lock Overlay (src/components/atoms/LockScreen.tsx):
A clean, full-screen lock overlay that perfectly matches the app's dark/light theme.
Smooth fade-in animation to obscure the dashboard immediately.
Settings Integration (src/screens/SettingsScreen/index.tsx):
Added a new toggle under the "PERSONALIZATION" section.
Automatically hides the option if the device does not have biometrics enrolled (to prevent a confusing user experience).
iOS Compliance: Added the mandatory NSFaceIDUsageDescription to ios/zero/Info.plist.
🛠 Testing Instructions
Prerequisites: Since a new native dependency (react-native-biometrics) was added, please ensure you do a clean build:
Run npm install
For iOS: cd ios && pod install, then rebuild from Xcode.
For Android: Clean and rebuild from Android Studio.
Enable the Lock:
Navigate to Settings -> Personalization.
Tap App Lock. Authenticate via the native prompt to enable the feature.
Test the Lock:
Minimize the app (send it to the background).
Reopen the app. You should immediately see the zero lock screen and be prompted to authenticate.
Test Graceful Fallback (Optional):
With the app lock enabled, go to your phone's OS Settings and remove your fingerprint/FaceID.
Reopen the app. It should skip the lock screen and automatically disable the setting in the app.
The react-native-biometrics package was chosen for its stability and lightweight footprint compared to heavy keychain libraries.
The LockScreen component utilizes a React Native Modal placed directly above the NavigationContainer in App.tsx so it doesn't disrupt any active navigation stacks or Redux state.