Skip to content

fix: polish trezor send loading states - #708

Open
ben-kaufman wants to merge 3 commits into
feat/trezor-sendfrom
fix/trezor-send-ui-polish
Open

fix: polish trezor send loading states#708
ben-kaufman wants to merge 3 commits into
feat/trezor-sendfrom
fix/trezor-send-ui-polish

Conversation

@ben-kaufman

@ben-kaufman ben-kaufman commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #696

Description

This PR polishes the transient loading states in the Trezor send flow:

  • shows blue hardware-wallet loading feedback while the selected source refreshes or a transaction preview is prepared
  • prevents repeated source, Continue, fee, and swipe actions while their required hardware-wallet state is unavailable
  • keeps the previous fee visible while a replacement preview loads, with the spinner on the speed icon
  • separates a temporarily disabled swipe from the post-swipe submission spinner, matching the intended Figma behavior

This is stacked on #688. Review this PR against feat/trezor-send; it contains only the loading-state polish for that flow.

Linked Issues/Tasks

Screenshot / Video

N/A — the resting screens are unchanged; this PR refines the transient loading and disabled states described in the QA steps below.

QA Notes

Manual Tests

  • 1. Send → Amount → switch the funding source to Trezor: the source chip shows a blue spinner, and the source control and Continue cannot be triggered again until the available amount finishes refreshing.
  • 2. Send → Confirm → switch to Trezor or change the fee speed: the previous fee stays visible, the speed icon shows a blue spinner, and the confirmation swipe remains disabled until a valid preview is ready.
  • 3. Send → Confirm → swipe after the fee is ready: the knob reaches the right side and shows the submission spinner while the flow proceeds to Sign With Device.
  • 4. regression: switch back to Spending or Savings: the normal source, fee, Continue, and swipe behavior remains available.

Automated Checks

  • HwFundingSignerTests: 25 tests passed, including source-refresh, unavailable-fee, and preview-loading coverage.
  • SwiftFormat lint passed for the changed files.
  • git diff --check passed.
@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR separates disabled and submitting states in the swipe control and adds explicit hardware-wallet funding-source and preview loading state across the send flow.

  • Adds tintable activity indicators and loading support to shared controls.
  • Tracks hardware funding-source and transaction-preview preparation in HwSendCoordinator.
  • Disables repeated source, fee, Continue, and swipe actions while required hardware state is unavailable.
  • Adds coordinator tests for source refresh and preview preparation.

Confidence Score: 4/5

The hardware-source loading failure path should be fixed before merging because a fee-estimation failure can trap the send screen with no usable source-selection or Continue action.

Hardware selection now starts an externally visible loading state that is cleared only after a refresh or preview, but the amount view can return before starting either operation when its fee rate is unavailable.

Files Needing Attention: Bitkit/Views/Wallets/Send/SendAmountView.swift; Bitkit/ViewModels/HwFundingSigner.swift

Important Files Changed

Filename Overview
Bitkit/ViewModels/HwFundingSigner.swift Adds request-scoped funding-source and preview loading flags, including stale-request invalidation and cancellation cleanup.
Bitkit/Views/Wallets/Send/SendAmountView.swift Connects hardware loading to source and Continue controls, but can leave both unavailable when fee resolution fails before balance refresh.
Bitkit/Views/Wallets/Send/SendConfirmationView.swift Presents hardware preview loading on the fee icon and disables source, fee, and swipe actions until preview readiness.
Bitkit/Components/SwipeButton.swift Separates temporarily disabled presentation from the post-swipe spinner while retaining unified interaction blocking.
BitkitTests/HwFundingSignerTests.swift Covers successful funding-source refresh and preview-loading transitions but not unavailable fee-rate or refresh-failure recovery.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant V as SendAmountView
    participant C as HwSendCoordinator
    participant F as Fee estimation
    U->>V: Select Trezor
    V->>C: selectWallet(showsLoading: true)
    C-->>V: "isFundingSourceLoading = true"
    V->>F: Resolve selected fee rate
    alt Fee rate available
        V->>C: refreshAvailable(...)
        C-->>V: "Balance and loading=false"
    else Fee estimation fails
        V-->>V: Refresh guard returns
        Note over V,C: Loading remains true and source control stays disabled
    end
Loading

Reviews (1): Last reviewed commit: "fix: polish trezor send loading states" | Re-trigger Greptile

Comment thread Bitkit/Views/Wallets/Send/SendAmountView.swift
@ovitrif ovitrif linked an issue Aug 31, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant