You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pedrouid
changed the title
add tap-to-pay support for both android and ios via HCE and VAS respe…
add tap-to-pay support for both android and ios via HCE and VAS
Jan 22, 2026
This PR adds NFC tap-to-pay functionality to the POS app using HCE (Android) and VAS (iOS). The implementation is well-structured with platform-specific abstractions and graceful fallbacks.
What's Good
Clean architecture: Separation of concerns with useNfcCapabilities (detection) and useNfcPayment (transmission) hooks
Graceful degradation: Falls back gracefully when native modules aren't available or NFC is unsupported
User control: Settings toggle allows users to enable/disable NFC, with proper validation
State management: Store migration is properly versioned (v6 → v7) with backwards compatibility
Clear UI feedback: NFC status indicator shows HCE/VAS mode when active
Good documentation: Comprehensive roadmap.md explaining the three-tier fallback strategy
Concerns
No tests for new hooks - The new useNfcCapabilities and useNfcPayment hooks have no test coverage. These contain complex platform-specific logic and state management that would benefit from unit tests.
Potential stale closure in onNfcReady callback (scan.tsx:48-56) - The nfcMode used inside onNfcReady may be stale when the callback fires:
onNfcReady: ()=>{constmodeLabel=nfcMode==="hce" ? "HCE" : nfcMode==="vas" ? "VAS" : "NFC";// nfcMode comes from hook destructuring, may be stale}
Consider passing the mode through the callback parameter or using a ref.
Effect cleanup race condition (use-nfc-payment.ts:639-641) - The cleanup function calls stopNfc() but this is also called conditionally in the main effect body. This could lead to double-stopping.
Missing native module implementations - The hooks reference HceModule and VasModule from NativeModules, but the PR doesn't include the actual native Android/iOS implementations. Are these expected to exist already or be added in a follow-up PR?
Hardcoded color (scan.tsx:95) - The NFC indicator uses a hardcoded green color #4CAF50 instead of using the theme system.
Suggestions (non-blocking)
Consider adding a brief loading state or animation when NFC is initializing
The showNfcToggle variable in settings.tsx is always true for iOS/Android - the check Platform.OS === "android" || Platform.OS === "ios" is redundant in a React Native context
Consider debouncing the updateUrl calls in use-nfc-payment.ts to avoid rapid re-broadcasts if URL changes quickly
Risk Assessment: LOW-MEDIUM
Low risk to existing functionality (NFC is additive, QR code remains primary)
Medium risk of runtime errors if native modules aren't properly linked
The lack of tests makes regression risk higher for future changes
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
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.
Add NFC tap-to-pay functionality to the POS app, enabling customers to receive payment URLs by tapping their phone on the merchant device.
Includes NFC toggle in settings, status indicator on scan screen, and QR code fallback when NFC is unavailable.