diff --git a/components/auth/key-exchange-qr.tsx b/components/auth/key-exchange-qr.tsx index 807e8d5f..1b54287b 100644 --- a/components/auth/key-exchange-qr.tsx +++ b/components/auth/key-exchange-qr.tsx @@ -19,9 +19,15 @@ interface KeyExchangeQRProps { * QR code component for key exchange URI. * * Displays a dash-key:/dash-st: URI as a QR code that can be scanned by a - * wallet app. On touch devices (where scanning your own screen is impossible) - * it also offers an "Open in wallet app" deep link into a wallet registered - * for the URI scheme. Includes copy-to-clipboard functionality for manual entry. + * wallet app, and offers an "Open Dash Wallet" deep link into whichever wallet + * is registered for the URI scheme on this device. The deep link matters on + * desktop too — Dash Evo Tool runs on the same machine as the browser, so + * scanning is a detour — but the browser gives no signal when no handler is + * registered, so a fallback hint appears once the link has been clicked. + * + * Copy-to-clipboard is offered on desktop only: on a touch device the deep + * link already hands the URI to the wallet, and pasting it by hand is the + * path the deep link exists to avoid. */ export function KeyExchangeQR({ uri, @@ -30,13 +36,19 @@ export function KeyExchangeQR({ }: KeyExchangeQRProps) { const [copied, setCopied] = useState(false) const [isTouchDevice, setIsTouchDevice] = useState(false) + const [launchAttempted, setLaunchAttempted] = useState(false) // Coarse-pointer detection has to run client-side; the static export renders - // the desktop (QR-first) layout until hydration. + // the desktop variant until hydration. useEffect(() => { setIsTouchDevice(window.matchMedia('(pointer: coarse)').matches) }, []) + // A new request (retry, or expiry-driven regeneration) starts a fresh attempt + useEffect(() => { + setLaunchAttempted(false) + }, [uri]) + const handleCopy = async () => { try { await navigator.clipboard.writeText(uri) @@ -56,16 +68,15 @@ export function KeyExchangeQR({ return (
{isTouchDevice - ? 'Open in a wallet app on this device, or scan the QR code with a wallet on another device' - : 'Scan with a compatible Dash wallet, such as Dash Evo Tool'} + ? 'Open a wallet app on this device, or scan the QR code with a wallet on another device' + : 'Open a wallet on this computer, such as Dash Evo Tool, or scan the QR code with a wallet on your phone'}
{remainingTime !== null && remainingTime !== undefined && (@@ -93,23 +104,34 @@ export function KeyExchangeQR({ )}
+ {isTouchDevice + ? 'Nothing opened? No wallet app on this device is registered to handle Dash login links. Scan the QR code with a wallet on another device instead.' + : 'Nothing opened? No wallet on this device is registered to handle Dash login links. Scan the QR code with a wallet on another device, or copy the URI and paste it into your wallet.'} +
+ )}