Skip to content

feat(qr-scanner): prompt-free iOS clipboard chip; restore Android pre-read - #2521

Merged
innolope-dev merged 1 commit into
fix/qr-scanner-clipboard-prereadfrom
feat/qr-clipboard-detect-chip
Jul 27, 2026
Merged

feat(qr-scanner): prompt-free iOS clipboard chip; restore Android pre-read#2521
innolope-dev merged 1 commit into
fix/qr-scanner-clipboard-prereadfrom
feat/qr-clipboard-detect-chip

Conversation

@innolope-dev

Copy link
Copy Markdown
Collaborator

Stacked on #2520 (base = its branch; retargets to dev automatically when it merges). Reintroduces the clipboard shortcut #2520 removed, redesigned so it cannot race the camera permission dialog — per the discussion there ("needs a design that reads the clipboard only on gesture").

Design (per platform)

Platform At scanner open Chip Actual clipboard read
Android native Clipboard.read() exactly as pre-revert address preview, one-tap pay at open (paste toast only — nothing blocking)
iOS native UIPasteboard.hasStrings via new app-local ClipboardDetect plugin — metadata only, no 'Allow Paste' alert generic "Use copied address" when clipboard non-empty on chip tap (user gesture, camera already live)
Web / PWA nothing "Click to paste" button (unchanged)

iOS chip tap: read → extractPaymentValue(evmAddress)onScan, or an honest toast + chip hides if the copied text isn't an address.

Native plumbing

  • ios/App/App/ClipboardDetectPlugin.swiftCAPBridgedPlugin exposing hasStrings.
  • ios/App/App/AppViewController.swiftCAPBridgeViewController subclass registering the plugin (capacitorDidLoad); Main.storyboard now instantiates it; both files added to project.pbxproj.
  • Graceful degrade: on binaries without the plugin (OTA'd JS), clipboardHasStrings() resolves false → no chip, no error. The iOS chip therefore activates only with the next binary release.

QA

  • clipboard-detect unit tests (off-iOS short-circuit, native answer passthrough, plugin-missing → false); tsc --noEmit, eslint, prettier clean.
  • ⚠️ Swift compiles are not exercised by CI here — needs one native:build / device run to confirm plugin registration before the next iOS release. Manual device matrix: scanner opens straight to camera on iOS with text on the clipboard (no alert), chip appears, tap → prompt → pay; Android chip behavior byte-identical to pre-fix(qr-scanner): stop clipboard paste-prompt racing the camera; platform-gate the copied-address chip #2520.

…-read

Reintroduces the clipboard shortcut removed in #2520 with a platform split
that can't race the camera permission dialog:

- Android native: unchanged from pre-revert — read at open, preview the
  copied EVM address in a one-tap chip (only side effect is the system
  paste toast).
- iOS native: a new app-local ClipboardDetect plugin exposes
  UIPasteboard.hasStrings — metadata only, so no iOS 16+ 'Allow Paste'
  alert. When true, a generic 'Use copied address' chip appears; the real
  Clipboard.read() runs on the chip tap, a user gesture, with the camera
  already live. Older binaries (OTA'd JS) resolve hasStrings to false and
  simply show no chip.
- Web/PWA: no pre-read; the explicit 'Click to paste' stays the fallback.

Needs an iOS binary release to activate the chip (new native plugin,
registered via AppViewController per Capacitor's app-local plugin flow).
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Jul 27, 2026 2:30pm

Request Review

@innolope-dev innolope-dev self-assigned this Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 963f0913-4d7e-4c25-9e87-2c059cea2baa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/qr-clipboard-detect-chip

Comment @coderabbitai help to get the list of available commands.

@innolope-dev
innolope-dev merged commit 9c78dc2 into fix/qr-scanner-clipboard-preread Jul 27, 2026
8 of 10 checks passed
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