Skip to content

fix(send): dismiss payment completed screen when app is backgrounded#3712

Open
designsats wants to merge 1 commit into
blinkbitcoin:mainfrom
designsats:fix/dismiss-payment-screen-on-background-v2
Open

fix(send): dismiss payment completed screen when app is backgrounded#3712
designsats wants to merge 1 commit into
blinkbitcoin:mainfrom
designsats:fix/dismiss-payment-screen-on-background-v2

Conversation

@designsats

@designsats designsats commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Problem

When a user pays in-store and then leaves the app, the SendBitcoinCompletedScreen persists indefinitely. Returning to the app later shows a stale confirmation screen with no way to know it's from a previous session.

Closes https://github.com/blinkbitcoin/blink-wip/issues/554

Solution

Added an AppState listener inside SendBitcoinCompletedScreen that navigates the user home whenever the app transitions to the background. The screen is dismissed automatically — so when the user returns, they land on the home screen rather than a stale payment receipt.

Implementation

  • send-bitcoin-completed-screen.tsx: the listener change
  • Follows the same pattern as the global AppStateWrapper in app/navigation/app-state.tsx: a useRef tracks the previous app state so only the explicit active → background transition triggers the dismiss (not spurious events)
  • handleNavigateHome is wrapped in useCallback to keep the effect dependency stable

Tests

Added automated coverage in __tests__/screens/send-bitcoin-completed-screen.spec.tsx:

  • Navigates home (navigate("Primary")) on the active → background transition
  • Does not navigate for other transitions (e.g. active → inactive, inactive → background), guarding against spurious events

Manual test plan

  • Complete a payment and confirm the success screen appears
  • Press home / switch apps (background the app)
  • Return to Blink — verify you land on the home screen, not the payment screen
  • Verify the close button on the payment screen still navigates home normally

🤖 Generated with Claude Code

@designsats designsats force-pushed the fix/dismiss-payment-screen-on-background-v2 branch 2 times, most recently from ad054f4 to f7d7318 Compare March 15, 2026 14:56
@designsats

Copy link
Copy Markdown
Contributor Author

Got this response from Claude to failing checks @grimen @blink-claw-bot
"Those branches passed before the schema drift happened. The codegen check pulls from a live schema URL — at some point after those PRs merged, the upstream schema was updated but generated.ts on main was never re-synced. Any branch created after that point will fail.

The options are:

Include generated.ts in this PR — it's technically a separate concern but it unblocks the check

Open a separate PR first that syncs generated.ts on main, then rebase ours on top of it

Leave it — the upstream maintainers may notice and fix main themselves, then our PR would pass on rebase"

@designsats

Copy link
Copy Markdown
Contributor Author

@grimen review required

@grimen grimen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test coverage to cover the change.

The SendBitcoinCompletedScreen had no awareness of app lifecycle events,
so it would persist indefinitely if the user paid in-store, left the app,
and returned later — showing a stale confirmation screen.

Added an AppState listener that tracks the active → background transition
and navigates home when the app is backgrounded. Follows the same pattern
as AppStateWrapper (useRef for previous state, explicit transition check).

Added tests covering the active → background dismiss and that other
transitions (e.g. active → inactive) do not navigate home.

Closes blinkbitcoin/blink-wip#554

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@designsats designsats force-pushed the fix/dismiss-payment-screen-on-background-v2 branch from f7d7318 to cd1bccf Compare June 18, 2026 19:02
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.

2 participants