You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat: notify new payment requests while bitkit is in the background #1350
Bitkit finds Paykit payment requests only while it is open: requests are discovered by polling the contact's homeserver, and no push exists for them. An allower who is not in the app never learns that a request is waiting, whether an allowance covers it or not.
Proposed solution
First version of background support for allowances: poll for new Paykit requests in the background and notify. No payment happens in the background.
One local notification per new request, such as "{contact} requests $2 · Open Bitkit to pay it". For a request an allowance covers, the text says it is paid automatically when Bitkit opens.
Each request notifies once. Tapping the notification opens Bitkit on that request's Payment Request sheet.
Nothing is posted when notifications are not allowed.
Platform details (Android):
A periodic CoroutineWorker on WorkManager with a connected-network constraint, scheduled like AppWidgetRefreshScheduler. WorkManager runs it at most every 15 minutes, and Doze can defer it further.
The worker refreshes Paykit only: it does not start the Lightning node, so it needs no foreground service.
It uses the same Hilt singletons as the app, so PaykitSdkService's mutexes serialize it against a refresh from the foreground app.
The allowance coverage check moves out of AppViewModel, where it only runs while the UI is alive, into a repository the worker can call.
Notifications go through the existing pushNotification helper, only when POST_NOTIFICATIONS is granted. The IDs of notified requests are persisted so a request notifies once, including across process death.
Done when:
A request sent while Bitkit is backgrounded or closed produces exactly one notification within the platform's polling window.
Opening Bitkit from that notification shows the request, or pays it when an allowance covers it.
A request that was already notified, or already handled in the app, does not notify again.
Alternatives considered
A server-side push when a request lands, for example from Paykit Server or the Blocktank notifier watching the homeserver. It would notify within seconds, but it needs backend and protocol work; tracked separately.
Paying covered requests in the background. Left for a follow-up.
Activity