Skip to content

feat: add pending payment notifications#828

Open
ovitrif wants to merge 19 commits intofeat/send-pending-uifrom
feat/send-pending-ui-notif
Open

feat: add pending payment notifications#828
ovitrif wants to merge 19 commits intofeat/send-pending-uifrom
feat/send-pending-ui-notif

Conversation

@ovitrif
Copy link
Collaborator

@ovitrif ovitrif commented Mar 7, 2026

This PR:

  1. Adds push notifications for pending payment resolution when the app is backgrounded
  2. Extracts PendingPaymentRepo from LightningRepo to manage pending payment state independently
  3. Simplifies SendPendingViewModel by using resolution events directly from the repo
  4. Fixes non-service notification icon to use the outlined Bitkit icon

Description

When a Lightning payment is pending (e.g. hold invoices) and the user backgrounds the app, payment resolution events (success/failure) were silently ignored. This adds a CQRS command+handler (NotifyPendingPaymentResolved) that checks whether a resolved payment was pending, and if the app is in the background, posts a system notification.

The pending payment tracking logic has been extracted from LightningRepo into a dedicated PendingPaymentRepo with proper StateFlow-based state management. The SendPendingViewModel and QuickPayViewModel now consume resolution events directly without mapping to intermediate types.

Also:

  • Removes the error message from the sheet screen for pending payment error.
  • Fixes the notification icon for non-service notifications.
  • Added unit tests for business logic.

Preview

bgnotifs_1.75x.mp4

Note

The regression issue with the error toast showing for the same cancelled pending payment handled by the sheet, as seen in the recording has been fixed in 27a378b

QA Notes

Setup

  1. Startup bitkit-docker: docker compose up -d
  2. Start emulator via Android Studio
  3. Apply port forwarding:
    adb reverse tcp:9735 tcp:9735 && \
    adb reverse tcp:3000 tcp:3000 && \
    adb reverse tcp:60001 tcp:60001
  4. Apply local-electrum.patch to connect to local Electrum, then build and run on emulator:
    curl -sL https://gist.githubusercontent.com/ovitrif/ac13a7ba09efd4c12bee0a1b4cc27f4a/raw/local-electrum.patch | git apply
  5. Open a channel, skip first 4 steps

Use ./bitcoin-cli in bitkit-docker for hold invoices:

./bitcoin-cli holdinvoice 42 -m 'test'
./bitcoin-cli settleinvoice __preimage__
./bitcoin-cli cancelinvoice __hash__

Tests

  • App in BG + settle/cancel → success/error notification
  • Regression Checks
    • Pending sheet + settle/cancel → success/error screen
    • Close button + settle/cancel → success/error toast
    • Scanner (QuickPay on/off), paste, cancel invoice, tap 'Try Again' → expect Send Recipient screen
    • Send a regular Lightning payment (non-hold invoice)

@claude

This comment has been minimized.

@claude

This comment has been minimized.

@ovitrif ovitrif force-pushed the feat/send-pending-ui-notif branch 2 times, most recently from 9ed2ec3 to 5a3caa1 Compare March 7, 2026 12:19
@claude

This comment has been minimized.

@ovitrif ovitrif force-pushed the feat/send-pending-ui-notif branch 2 times, most recently from 906e9b9 to cbd8273 Compare March 7, 2026 13:54
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ovitrif ovitrif force-pushed the feat/send-pending-ui-notif branch from cbd8273 to be29098 Compare March 7, 2026 14:25
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