Skip to content

feat(pos-app): scan Customer API key via QR code - #626

Draft
ignaciosantise wants to merge 2 commits into
mainfrom
feat/qr-scan-api-key
Draft

ignaciosantise wants to merge 2 commits into
mainfrom
feat/qr-scan-api-key

Conversation

@ignaciosantise

Copy link
Copy Markdown
Collaborator

What

Adds a camera-based QR scanner for entering the Customer API key in pos-app Settings, so merchants don't have to type a long secret on a POS device.

Tapping the scan icon (right of the API-key input) opens a full-screen camera; on a successful scan the value auto-saves through the existing PIN/biometric gate.

How

  • app/scan-api-key.tsx — full-screen expo-router route using expo-camera (one library across iOS/Android/web). Camera is bound to useIsFocused so it releases when the screen pops; permission request + denied ("Open settings") states handled; a ref guards against double-fires.
  • components/scan-corners.tsx — viewfinder overlay (dimmed mask + transparent square + corner brackets) built from plain Views, since pos-app has no react-native-svg.
  • Scan button in the Customer API key sheet uses a tint-able assets/images/scan.png icon (matches the app's icon pattern). Hidden on camera-less hardware via hooks/use-has-camera.ts (web: CameraView.isAvailableAsync; android: react-native-device-info isCameraPresent; iOS: assume present).
  • Auto-save: the scan route writes the decoded value to a transient store (store/usePendingApiKeyScanStore.ts), pops back, and settings.tsx runs it through handleScannedCustomerApiKey → the existing initiateSave PIN/biometric flow in hooks/use-merchant-flow.ts.
  • QR payload is treated as a plain key string, isolated in utils/parse-api-key-qr.ts so the format is trivial to adjust later.
  • Adds expo-camera + its config plugin (camera permission → iOS NSCameraUsageDescription, Android CAMERA). pos-app is pure CNG, so it applies at prebuild.

Notes

  • Chose expo-camera over vision-camera to keep a single cross-platform library (incl. web). No-GMS is a non-issue: expo-camera's live scanner uses the bundled standalone MLKit, not the GMS code scanner. Verified scanning on target POS hardware.

Testing

  • Typecheck + expo lint clean; existing jest suite unaffected.
  • Manually verified the scan → auto-save flow on device.
  • Verify points for reviewers: scan on a target Android POS unit, web scanning in Chromium, and the camera-less-device path (scan icon hidden).

🤖 Generated with Claude Code

Add a camera-based QR scanner for entering the Customer API key in
Settings, so merchants don't have to type long secrets on a POS device.

- New full-screen expo-router route `app/scan-api-key.tsx` using
  expo-camera (one lib across iOS/Android/web); camera bound to
  `useIsFocused` so it releases on leave; permission + denied states
  handled.
- Viewfinder overlay (dimmed mask + square + corner brackets) built from
  plain Views via `components/scan-corners.tsx` (pos-app has no
  react-native-svg).
- Scan button (tint-able `scan.png` icon) added to the Customer API key
  sheet; hidden on camera-less hardware via `hooks/use-has-camera.ts`
  (web: CameraView.isAvailableAsync; android: device-info
  isCameraPresent; ios: assume present).
- On a successful scan, auto-save through the existing PIN/biometric
  gate: the value is handed back via a transient store
  (`store/usePendingApiKeyScanStore.ts`) and run through
  `handleScannedCustomerApiKey` in `hooks/use-merchant-flow.ts`. QR
  payload is treated as a plain key string, isolated in
  `utils/parse-api-key-qr.ts`.
- Add expo-camera dep + config plugin (camera permission).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-native-walletkit Ready Ready Preview Sep 22, 2026 12:47pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
pos-demo Ignored Ignored Preview Sep 22, 2026 12:47pm UTC
react-native-appkit Ignored Ignored Preview Sep 22, 2026 12:47pm UTC

Request Review

@claude

claude Bot commented Sep 17, 2026

Copy link
Copy Markdown

Claude finished @ignaciosantise's task in 2m 4s —— View job


Code Review in Progress

  • Gather context and read changed files
  • Analyze code for issues
  • Run license compliance subagent
  • Run breaking changes subagent
  • Run data classification subagent
  • Post final review

This branch was successfully deployed

2 active (1 outdated) deployments
Preview – react-native-walletkit cb4bb2ee Deployed Sep 22, 2026 by vercel[bot]
Preview – pos-demo 1168f452 Deployed Sep 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant