Skip to content

clipboard prompt racing a scan drops the usdt payment and blocks sheets #959

Closed

Description

@jvsena42

Found while driving the USDT journeys for #948 at ab313b1, in code that PR did not touch.

Observed

With Settings › Security › Read clipboard on, pasting a USDT payment link in the Scanner closes the scanner and nothing opens. 5 of 5 attempts each logged Hiding sheet scanner reason: Scanner routed USDT payment. The scene went inactive and came back ~400 ms later. After that, Scan and Send do nothing until Back or a relaunch: Showing sheet scanner is logged but no sheet appears. With Read clipboard off, the same link opens the USDT review.

[11:15:03.635 UTC] DEBUG: Hiding sheet scanner reason: Scanner routed USDT payment - SheetViewModel
[11:15:04.200 UTC] DEBUG: hideSheetIfActive skipped for scanner (active: none) reason: Scanner sheet dismissed
[11:01:11.878 UTC] DEBUG: Showing sheet scanner - SheetViewModel   <- sheet never appears

Expected

The scanned link opens the USDT review. No clipboard prompt competes with a scan that is already being handled.

Steps to reproduce

  1. Turn on Settings › Security › Read clipboard and open the USDT wallet.
  2. Put a USDT payment link on the clipboard while Bitkit is in the foreground (Universal Clipboard, or xcrun simctl pbcopy on a simulator).
  3. Tap Scan › Paste and allow paste.
  4. Nothing opens. Tapping Send afterwards also shows nothing.

Root cause

  • The iOS "Allow Paste" prompt (ScannerManager.swift:290) makes the scene inactive, then active again.
  • On becoming active, MainNavView.swift:369-372 runs handleClipboardIfEnabled(). That raises the clipboard alert (:759-791, alert at :458-470) without checking for an open or replacing sheet.
  • At the same moment, hideSheetBeforePerforming (SheetViewModel.swift:104-118) pushes .usdtPayment (ScannerManager.swift:94-101), and that screen opens its send sheet on appear (UsdtWalletScreen.swift:17, :75).
  • The presentations collide and are dropped, leaving showClipboardAlert and showSend stuck at true.
  • handlePaste (ScannerManager.swift:287-300) does not record the pasted value in ClipboardPromptHistory (ClipboardPrompt.swift:22-37), so the same link is offered again.
  • Bitcoin and Lightning scans use the same 0.7 s replace window (SheetViewModel.swift:51-68) and are probably affected too. That was not observed.

Suggested fix

  • Return early from handleClipboardIfEnabled while sheets.isAnySheetOpen || sheets.isReplacingSheet, or while a scan is being handled.
  • Record the value used by paste and scan in ClipboardPromptHistory.

Platform parity

Android is not affected: its prompt is a Compose dialog (AutoReadClipboardHandler.kt:58-86) that does not block sheets or navigation.

Activity

  1. added this to the 3.0.5 milestone on Oct 16, 2026
  2. ovitrif commented on Oct 19, 2026

    @ovitrif
    Collaborator

    Fixed by #973.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions