unknownBranchGraceText function

String unknownBranchGraceText(
  1. WalletLocalizations l10n,
  2. UnknownBranchGrace grace
)

The one sentence for where the grace for a server that does not report its network stands (GRACE-1, §4p Q-G2) — the detail line under SyncStatus.upToDateUnverified, and, for an ended grace, the body of the send fault (SendServerSilentFault) and the parked row's reason, so the three surfaces can never say different things about the same state.

Running: the time left is whichever rule expires first (the SDK converted the blocks through the network's block spacing); when the device clock cannot be trusted for it the SDK hands no time, and the blocks show alone (§4p G-4 — no separate string for that case). Ended: the reason names the rule — blocks ("for N blocks"), the clock ("for a day" — a wrong device time is the one benign cause, so the copy says to fix it FIRST and then switch: a precondition of the next step, never an alternative to it, because a corrected clock alone re-permits nothing — §4p-run fold review row 6, §4r U-5), or never confirmed. NEVER "upgraded" and NEVER "update the app": nothing is known to have changed, and an update fixes nothing — a server that reports the network version is the next step on every branch.

Implementation

String unknownBranchGraceText(
  WalletLocalizations l10n,
  UnknownBranchGrace grace,
) {
  return switch (grace) {
    UnknownBranchGrace_Running(:final blocksLeft, :final secsLeft) =>
      secsLeft == null
          ? l10n.walletSyncGraceLeftBlocks(
              compactBlockCount(blocksLeft, l10n.localeName),
            )
          : l10n.walletSyncGraceLeftHours(secsLeft ~/ 3600),
    UnknownBranchGrace_Ended(:final by, :final blocksSinceLastCurrent) =>
      graceEndedText(l10n, by, blocksSinceLastCurrent),
    // Forward-compat: a shape this UI does not know is rendered as the ended
    // state's generic sentence — never as a running grace.
    UnknownBranchGrace_Unknown() => l10n.walletSyncGraceNeverConfirmed,
  };
}