Add a back-office setup dialog, and clear the last lints

Settings > Connectivity > Configure now points a terminal at a back office.
Until this existed a store was wired up by editing syncConfigProvider and
rebuilding, which made every terminal in a fleet its own build.

- Transport picker (offline demo / HTTP / MQTT) with only the relevant fields
  shown, validated: an MQTT route with no host is refused rather than silently
  saved, because a terminal pointed at nothing looks exactly like one that is
  merely offline.
- Terminal name and store id are editable and persist to the database. The
  device id and terminal code are shown but not editable, with a copy button —
  they are what a support call needs, and re-coding a till must not orphan the
  bills already written under the old code.
- TLS defaults on, with a note that bills carry customer names and numbers.
- About card now shows the real terminal, device id and store instead of the
  literal TERM-01, and the dead "Check for updates" button is now the entry
  point to this dialog.

Lints cleared, analyzer now reports zero issues:
- SoundService wrapped a plain bool in a getter and setter that did nothing.
- Two post-await guards used context.mounted inside a State, which the
  analyzer cannot relate to the State's own lifetime. Both are now `mounted`.

Tests: 140 -> 141. The new widget test drives the dialog end to end and asserts
that saving an MQTT route with no host keeps the dialog open with the error
visible. Suite run three times clean.

Known gap, documented in docs/sync-contract.md: broker credentials live in
memory and must be re-entered after a restart. Persisting them means
encrypting at rest.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Suriya
2026-08-01 11:47:11 +05:30
parent 30d6d1080f
commit 33467e6963
6 changed files with 440 additions and 17 deletions

View File

@@ -173,9 +173,11 @@ overstate the day.
- **Downlink beyond catalogue-changed and sync-requested.** The plumbing routes
unknown commands to the events log rather than dropping them, so adding one
is a server change plus a case arm.
- **Broker credentials in Settings.** `SyncConfig` carries them and Settings
displays the route, but there is no editor yet — a store is pointed at a
broker in code or by overriding `syncConfigProvider`.
- **Credentials survive a restart.** The back-office dialog writes the broker
host, port, TLS flag and credentials into `syncConfigProvider`, which is
in-memory. Terminal name and store id persist (they live in the database);
the credentials do not, and must be re-entered after a restart. Persisting
them means encrypting them at rest, which is the next piece of work.
- **Historical correction.** Bills already synced by an older build went up
with an overstated total. Nothing here fixes that; it needs a server-side
reconciliation against `bill_discount`.