walletSyncBarVisible function

bool walletSyncBarVisible({
  1. required SyncStatus status,
  2. required bool stale,
  3. required bool driving,
  4. required bool startFailed,
  5. required bool syncDisabled,
  6. required TransportTone transportTone,
  7. required bool hostDeclaredTransport,
  8. bool followingTip = false,
})

Whether the wallet tab shows its sync bar (FR-49 S12, C2). HIDDEN only when every one of these holds, so nothing a user must know hides with it:

  • the status is a plain, fresh UpToDate at badge level ok (every qualified reached-tip variant — limited, degraded, unverified, endpoint behind — is caution and keeps the bar, as do a stale snapshot, a failed start and a host-off policy, via walletBadgeLevel);
  • the sync loop is running;
  • the transport claim cannot go stale while the tab is open (rev.2 R6): neutral (Tor off / a direct connection — static for the session), or protected ONLY when the HOST declared it (hostDeclaredTransport). An SDK-derived protected comes from the cold snapshot, which is not re-read on a mid-session Tor fallback, so it keeps the bar (with its filled shield) until the UI can watch Tor state live. caution, danger and progress always keep the bar. Relim accepted hiding on neutral over "show whenever not protected", which would never hide for a host without Tor.

A Scanning sample with followingTip (the walletTipFollowProvider rule: the wallet catching up to kWalletTipFollowBlocks new blocks after a healthy UpToDate, usually one) counts as that UpToDate, judged at the tip it scans to — else the bar would slide in and out on every block (the S12 security review's MEDIUM).

Implementation

bool walletSyncBarVisible({
  required SyncStatus status,
  required bool stale,
  required bool driving,
  required bool startFailed,
  required bool syncDisabled,
  required TransportTone transportTone,
  required bool hostDeclaredTransport,
  bool followingTip = false,
}) {
  final steadyTransport =
      transportTone == TransportTone.neutral ||
      (transportTone == TransportTone.protected && hostDeclaredTransport);
  final settled = switch (status) {
    SyncStatus_UpToDate() => status,
    SyncStatus_Scanning(:final to) when followingTip => SyncStatus.upToDate(
      tip: to,
    ),
    _ => null,
  };
  final healthy =
      settled != null &&
      driving &&
      walletBadgeLevel(
            status: settled,
            stale: stale,
            startFailed: startFailed,
            syncDisabled: syncDisabled,
          ) ==
          WalletBadgeLevel.ok &&
      steadyTransport;
  return !healthy;
}