Skip to content

fix: keep the returned-payment toast until it is closed - #2031

Open
ovitrif wants to merge 2 commits into
masterfrom
fix/keep-returned-payment-toast
Open

ovitrif wants to merge 2 commits into
masterfrom
fix/keep-returned-payment-toast

Conversation

@ovitrif

@ovitrif ovitrif commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #2030

Description

  • Fixes "Payment returned to Savings" disappearing before the user closes it: a later toast, such as a connection warning or the address-type progress toast, replaced it on screen. It now holds later toasts behind it until it is closed.
  • A second identical notice from another restored swap is not queued again, so closing it once clears it.
  • Drops the "Internet Connectivity Issues" warning while it waits behind another toast once a newer toast arrives, so closing the notice after a reconnect shows "Internet Connection Restored", not the outdated warning.

Out of Scope

  • ToastQueueManager: a full queue still drops its oldest item, whatever its kind; unchanged from master.

Design

N/A — no UI changes.

Preview

N/A

QA Notes

Setup

Local regtest with a swaps-enabled build, as in #2030: fund Spending through a Lightning channel, pay an on-chain-only Paykit contact with Pubky Swaps, force-stop Bitkit before the claim, then restore the wallet in a clean install.

Journeys

N/A — not drivable; see Manual Tests.

Manual Tests

  • 1. Restore the wallet with the interrupted swap claim, let the claim finish, then turn Wi-Fi off and on → "Payment returned to Savings" stays until closed; after closing it, "Internet Connection Restored" shows and "Internet Connectivity Issues" does not — needs a restored in-flight swap, not in Capabilities
  • 2. With "Payment returned to Savings" on screen, change the address type → the notice stays; after closing it, the address-type result shows and "Applying changes" does not remain — same capability

Automated Checks

  • added ToastQueueManagerTest.kt — later toasts wait until a shown toast that is not interruptible is dismissed, and a waiting offline warning is replaced by the newer toast; one that is sent twice shows once
  • updated WalletViewModelTest.kt — the restored-swap notice is sent sticky and not interruptible

Evidence

just compile, just test and just lint pass at this head. Device cases not run.

Gaps

  • 1 and 2 not run: they need a restored wallet with an in-flight swap claim and a swap provider on local regtest.

Models used

  • Planning/scoping: Claude Opus 5.5 (reasoning: medium)
  • Implementation: Claude Opus 5.5 (reasoning: medium)
  • Review: gemini-4-neon-high (reasoning: high)

Later toasts wait behind it instead of replacing it while it shows, and a second identical one from another restored swap is not queued again.

Verified: just compile, just test, just lint
@ovitrif ovitrif self-assigned this Nov 25, 2026
@ovitrif
ovitrif requested review from a team, jvsena42 and piotr-iohk and removed request for a team November 25, 2026 11:46
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T11:47:57.578472Z e216d9e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The returned-payment notice now stays until the user closes it. Later toasts wait behind it.

  • Returned-payment notices stay visible until the user closes them.

No actionable issues found. Review was based on source inspection; automated tests and Android device cases were not run.

Queue overflow was explicitly acknowledged as out of scope by ovitrif: a full queue still drops its oldest item, unchanged from master.

Reviews (1) · Last reviewed commit: "fix: keep the returned-payment toast unt..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Regtest APK

Built from 93a062a (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

@talosmachina talosmachina 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.

No findings. The restored-swap "Payment returned to Savings" toast is sent with interruptible = false, so later toasts wait behind it, and ToastQueueManager.enqueue drops a non-interruptible toast that is already on screen or queued. Reviewed e216d9e, full tier, static: per the repository's Android review practice the branch was not built here, so this rests on the code and on CI.

What I checked, and 4 candidates I ruled out

Read in full: ToastQueueManager.kt, ToastEventBus.kt, Toast.kt, the swap-restore block in WalletViewModel.kt, both test files; traced every toastManager.enqueue, dismiss and hideToast caller in AppViewModel.kt and MainActivity.kt.
CI: build-and-test, build-local, lint and detekt green; the e2e-tests-local jobs and compose-ui were still running when I read them.

Ruled out

  • Manual test 2's progress toast stays: with the notice shown, "Applying changes" (replacedByNext) is queued, then the result toast removes it from the queue in enqueue, so closing the notice shows the result and no stale progress toast.
  • The Pubky auth wait toast gets stuck: it is a loading toast, kept at the queue's tail while the notice is shown, and dismiss(waitToast) removes it from the queue by identity, so it never surfaces after the wait ends.
  • The dedupe swallows a different toast: it compares by data-class equality and only for non-interruptible toasts, so it only applies to an identical copy. The one other non-interruptible sender, showPaykitUpdatePrompt, now shows once instead of twice when sent while it is on screen, which is harmless.
  • The flow test sees other toasts: the WalletViewModelTest case subscribes before restoreWallet and Turbine fails on any unconsumed event, so a passing run means the restore emits exactly this one toast.

Merge confidence: 4/5, reviewed without a build, device cases 1 and 2 not run, and the e2e jobs had not finished.

Reviewer model: Claude Opus 5.5
Reasoning effort: low

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: full PR diff against its merge base, at e216d9e.

1 actionable finding — resolve or provide an evidence-backed rebuttal.

The restored-swap notice now stays up until it is closed. If Wi-Fi is turned off and back on while it is open, closing it still plays the queued "Internet Connectivity Issues" toast before "Internet Connection Restored", so the next status is not the current one from #2030 and manual case 4 of #2023. The address-type result still replaces its queued "Applying changes" toast behind the notice.

Compared with bitkit-ios at 325b4099: a non-interruptible toast keeps only the latest queued toast. The iOS restored-swap notice itself still auto-hides and remains interruptible.

Device testing was not performed. The unit tests were read and not executed. The author reports just compile, just test, and just lint passed at this head; manual cases 1 and 2 were not run.

Suggested additional test cases

Android, same regtest restore as manual case 1. With "Payment returned to Savings" visible, turn Wi-Fi off and back on, then close the notice. "Internet Connection Restored" shows, and "Internet Connectivity Issues" does not.

Findings

  • [MEDIUM] Show the restored connection after the payment notice — inline at app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt:609.

Reviewer model: grok-4.7
Reasoning effort: xhigh

Verified: just compile, just test, just lint
@ovitrif
ovitrif requested a review from piotr-iohk November 25, 2026 12:36

@piotr-iohk piotr-iohk left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QA review

Scope: changes since e216d9e, including the connectivity toasts queued behind the payment notice, at 93a062a. Baseline: previous review.

1 actionable finding — resolve or provide an evidence-backed rebuttal.

A single disconnect followed by a reconnect, while "Payment returned to Savings" stays open, still surfaces "Internet Connection Restored". The waiting disconnect warning is also removed when any later toast arrives, so the status after the notice can be that restored toast while the device is offline again, or no connectivity warning while it is still offline.

Device testing: not performed in this review. ToastQueueManagerTest was inspected and not run.

The iOS connection-toast queue was not compared. Code search on synonymdev/bitkit-ios at 325b4099d1b1ad8025cfbfd03a5908fb5a99399f returned the localized connection strings only.

Suggested additional test cases

  • Android unit (ToastQueueManagerTest): with a non-interruptible toast showing, enqueue the disconnect warning (replacedByNext), the restored toast, then a second disconnect warning, and dismiss the current toast. The warning is the toast that appears.
  • Android, restored in-flight swap from manual test 1: leave the payment notice open, turn Wi-Fi off, change the address type, leave Wi-Fi off, and close the notice. The offline warning appears for that disconnect.
  • Android, same setup: turn Wi-Fi off, on, and off again, then close the payment notice. "Internet Connectivity Issues" is the connectivity toast that appears.

Earlier findings reconciled at this revision: 1 verified fixed.

Findings

  • [MEDIUM] Show the current connection status after the payment notice — inline at app/src/main/java/to/bitkit/ui/components/IsOnlineTracker.kt:46.

Reviewer model: grok-4.7
Reasoning effort: xhigh

title = resources.getString(R.string.other__connection_issue),
description = resources.getString(R.string.other__connection_issue_explain),
// A warning still waiting behind another toast is out of date once the connection is back.
replacedByNext = true,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[MEDIUM] Show the current connection status after the payment notice

With "Payment returned to Savings" still open, the device goes offline and "Internet Connectivity Issues" waits behind that notice. Before the notice is closed, either another toast is enqueued while the device stays offline (for example the address-type result) or the device reconnects and then disconnects again.

The disconnect toast is sent with replacedByNext = true (IsOnlineTracker.kt line 46), and AppViewModel.toast copies that onto the queued toast (line 9368). ToastQueueManager.enqueue removes every queued non-loading toast with that flag when any later toast arrives (ToastQueueManager.kt line 52). The reconnect toast does not set the flag (IsOnlineTracker.kt lines 33–37), so a later disconnect is queued behind "Internet Connection Restored". After disconnect, reconnect, and disconnect, that restored toast is first. After disconnect and then a non-connectivity toast, the warning is gone.

Closing the payment notice then shows "Internet Connection Restored" ("Bitkit successfully reconnected to the Internet.") for the default 3 seconds while the device is offline, or it skips the connectivity warning while the device is still offline. Issue #2030 asks for the current connection status after the notice is closed. One disconnect followed by one reconnect still shows the restored toast, which is manual test 1.

Replace a queued connectivity toast when a newer connectivity status arrives, and show that latest status after the payment notice.

Source analysis at 93a062a82cef8927c8a7dc3241da94724c2c0269. This sequence was not executed. ToastQueueManagerTest covers the warning followed by one successor, and that successor is what remains. No separate issue matches this mechanism.

This branch has not been deployed

No deployments
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.

[Bug]: Reconnecting dismisses “Payment returned to Savings” before the user closes it

3 participants