Skip to content

iOS: Simplify wallet detail screens - #83

Merged
bhandras merged 2 commits into
mainfrom
ios/payment-detail-labels-20261126
Nov 27, 2026
Merged

bhandras merged 2 commits into
mainfrom
ios/payment-detail-labels-20261126

Conversation

@bhandras

@bhandras bhandras commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Payment details

  • Use the same wording for Phase as the activity list.
  • Remove the internal reference and surface the copyable vHTLC outpoint in Diagnostics → Transfers & credit.
  • Keep Network on the payment details screen.

Refresh

  • Group the previewed funds by estimated expiry and show the soonest group first.
  • Pin the estimated fee and Start refresh below the scrolling list. Keep the expiry list visible during the refresh and update it in place after confirmation.
  • Keep the current receipt in Activity. When the wallet confirms that some of its funds can be retried, show a new estimate for those funds with the same Start refresh action.

Testing

  • iOS simulator unit suite passed (171 passed, 7 skipped).

  • A local 20-group simulator fixture verified that the fee and action stay pinned while scrolling, progress is visible immediately after tapping, and confirmed expiry updates on the same screen.

  • A second simulator fixture verified that a retry is quoted only for funds still available after one of the released inputs was spent.

Use the activity status text for Phase and remove the internal reference
and outpoint from payment details. Keep the Lightning outpoint copyable
in Diagnostics and give it a specific label.
@bhandras
bhandras force-pushed the ios/payment-detail-labels-20261126 branch from 111ed32 to 9b7f67c Compare November 26, 2026 14:22

@bhandras bhandras left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Claude: READY at 9b7f67c80b5c19ee1e36f739c5af1f7cb4cc9c13

This verdict comes from reading the diff against the code traced at 111ed32. I did not run tests. Your reported run: 171 unit tests passed, 7 skipped, and both simulator UI fixture scenarios passed.

Fixed

Previous finding Status How
Blocker: a released refresh turns back into "In progress" Fixed checkRefreshStatus now skips any operation where isResolved is true. A later spend or expiry of a released input can't reopen the old attempt. The test covers this: a second read still gives reads == 1, status stays "Partially refreshed", and networkSwitchBlockedReason == nil.
Follow-up: retry screen showed the whole wallet Fixed .review and .retry now both set funds = selectedFunds. Tracking keeps those funds, so the headline and expiry groups match the set that was submitted.

Invariants checked

  • Only the quoted selection can be submitted. The footer shows only when preview.screen == screen. Start sends preview.outpoints exactly. Before sending, the store checks the generation, a non-empty selection, and that any existing operation is nil or isResolved.
  • An ambiguous attempt can't be sent twice.
    • While a submission is in flight, the operation is "Checking status" with canRetry == nil, so isResolved is false.
    • If the native call throws, the operation becomes "Action needed", also not resolved.
    • In both cases startRefresh refuses any new selection until an observation resolves it.
  • Released means final. Native sets RetryAllowed only when every input is confirmed or still live and no round is live. Nothing from that attempt can still settle, so dropping it from status checks is safe. The network-switch guard clears on the same isResolved condition.
  • Each entry point opens the right screen.
    • Settings and the home Recovery row: if the operation is resolved, they open a new review of all eligible funds, regardless of the old receipt.
    • Activity (showsRefreshReceipt): reopens .complete or .retry.
    • An unresolved operation always opens the tracking screen.
  • Retry quotes only inputs that are still available.
    • Released inputs are filtered against a fresh live/expired inventory before the preview.
    • If none are left, there is no preview and the screen says "Nothing to refresh right now".
    • If an input is spent between the inventory read and the preview, the preview fails and the user sees an error with "Try again". It does not show a wrong quote.
  • The retry screen id stays stable. remainingOutpoints no longer changes after release, so .task(id: screen) won't reload the screen on its own.
  • Stale loads after cancellation. Every state write after an await still checks cancellation, the screen and the network. Moving the inventory read before the preview adds no write that skips those checks.

No new findings.

@bhandras
bhandras marked this pull request as ready for review November 26, 2026 16:26
@bhandras

Copy link
Copy Markdown
Member Author

/gateway review

@lightninglabs-gateway lightninglabs-gateway Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gateway review — 1 finding

🔴 0 Blocker · 🟠 0 Major · 🟡 1 Minor · 🔵 0 Nit

Summary

The PR moves RefreshWalletView into its own file. The new version is a state-driven screen: review, tracking, retry and complete. It adds expiry grouping with a pinned fee/Start footer and keeps the resolved receipt in Activity. A new RefreshOperation.isResolved predicate now drives the network-switch guard, the start-refresh admission check and the status-check short-circuit. The payment details screen drops the internal Reference and Outpoint rows and labels the diagnostics vhtlc_outpoint field.

The safety-relevant store changes hold up:

  • startRefresh checks generation, a non-empty selection and isResolved != false after beginStateCreatingCall. A second tap therefore can't send twice.
  • An ambiguous failure ("Action needed", canRetry == nil) still blocks a new submission and blocks network switching.
  • In the view, every state write after an await re-checks cancellation, the current screen and the network.
  • The retry path filters released inputs against a fresh live/expired inventory before quoting. A quote whose inputs don't match the inventory becomes an error instead of a wrong amount.
  • The expiry bucketing math and sort order match the new test cases.

The one issue left is presentational: the Complete receipt's headline amount and expiry list come from the whole wallet, not from the refresh it describes.

Lower-severity findings (1)

🟡 F1 (Minor) — Complete receipt shows whole-wallet amount, not the refresh · ios/Sample/Sources/RefreshWalletView.swift:231

On .complete, load sets funds = available, meaning every live or expired VTXO. summary then shows groups.reduce(0) { $0 + $1.amountSat } as the headline next to "Refreshed". So the receipt opened from the Activity row (which shows refresh.amountSat) can show a much larger figure that includes funds received later or never submitted. During tracking, the headline was the submitted set. After confirmation it jumps to the wallet total. Show store.refreshOperation?.amountSat (or confirmedAmountSat) as the headline on .complete. Then label the expiry list as covering all spendable funds rather than implying it is this refresh's output.

Reviewed at medium effort.

Bot commands
  • /gateway re-review — re-run after pushing changes (maintainers)
  • /gateway dismiss <id> — silence a finding (maintainers)
  • /gateway explain <id> — elaborate on a finding (maintainers or PR author)

@lightninglabs-gateway

lightninglabs-gateway Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

🤖 gateway audit metadata for this PR — auto-generated, please don't edit.

Group the reviewed funds by estimated expiry and keep the fee and
confirmation in a fixed footer. Show the refreshed inventory in place
once the wallet confirms completion.

Keep the refresh receipt until a new request starts. Preview a retry
only for funds the wallet confirms are available again.
@bhandras
bhandras force-pushed the ios/payment-detail-labels-20261126 branch from 9b7f67c to ca7a86b Compare November 26, 2026 17:02
@bhandras

Copy link
Copy Markdown
Member Author

/gateway re-review

F1 is fixed in ca7a86b. The completed receipt shows the confirmed refresh amount, or the original submitted amount if needed. The updated list is labeled Wallet fund expiries because it includes the rest of the wallet. Please verify that the receipt headline can no longer include those unrelated funds and re-check the current head.

@lightninglabs-gateway lightninglabs-gateway Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gateway review

No findings.


Status of prior findings

  • F1 addressed: Fixed at ios/Sample/Sources/RefreshWalletView.swift:69-73. When screen == .complete, the summary takes its headline from operation.confirmedAmountSat ?? operation.amountSat and never reaches the groups.reduce branch. So the receipt figure is limited to the funds that were submitted or confirmed, and it matches the refresh.amountSat shown on the Activity row. expiryList(groups, showsWalletInventory: screen == .complete) at line 56 changes the heading to "Wallet fund expiries" (line 126), which says plainly that the list covers the whole wallet. Resolved.

Reviewed at medium effort.

Bot commands
  • /gateway re-review — re-run after pushing changes (maintainers)
  • /gateway dismiss <id> — silence a finding (maintainers)
  • /gateway explain <id> — elaborate on a finding (maintainers or PR author)

@bhandras
bhandras merged commit 4e81db2 into main Nov 27, 2026
7 of 9 checks passed
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