refactor(tcp): promote MeshCoreTcpConnector, fix translations, harden UI

- Replace thin MeshCoreTcpManager facade with a proper MeshCoreTcpConnector
  that owns TcpTransportService and the frame subscription, mirroring
  MeshCoreUsbManager. The connector no longer holds a raw TcpTransportService
  or a _tcpFrameSubscription field.
- Remove hardcoded default host IP from TcpScreen (keep port 5000 hint).
- Disable connect button during scanning state, not just connecting state.
- Fix tcpPortLabel mistranslated as nautical "port/harbor" in de, it, pt,
  nl, sv, sk, sl, zh; fix corrupted Slovak tcpPortHint ("5 000" → "5000").
- Remove unused tcpStatus_connecting string from all 15 locale arb files
  and all generated app_localizations_*.dart files.
- Add extendedPadding to TCP screen FABs to match USB screen.
- Add Key to connect button; update tests to use byKey and assert
  onPressed == null when button is disabled during scanning.
This commit is contained in:
Zach
2026-03-13 10:58:52 -07:00
parent 1ad5db27ca
commit db935a7454
35 changed files with 91 additions and 123 deletions
+8 -2
View File
@@ -27,7 +27,7 @@ class _TcpScreenState extends State<TcpScreen> {
@override
void initState() {
super.initState();
_hostController = TextEditingController(text: '192.168.40.10');
_hostController = TextEditingController();
_portController = TextEditingController(text: '5000');
_connector = context.read<MeshCoreConnector>();
@@ -81,6 +81,9 @@ class _TcpScreenState extends State<TcpScreen> {
final isConnecting =
connector.state == MeshCoreConnectionState.connecting &&
connector.activeTransport == MeshCoreTransportType.tcp;
final isButtonDisabled =
isConnecting ||
connector.state == MeshCoreConnectionState.scanning;
return Column(
children: [
_buildStatusBar(context, connector),
@@ -112,7 +115,8 @@ class _TcpScreenState extends State<TcpScreen> {
),
const SizedBox(height: 16),
FilledButton.icon(
onPressed: isConnecting ? null : _connectTcp,
key: const Key('tcp_connect_button'),
onPressed: isButtonDisabled ? null : _connectTcp,
icon: isConnecting
? const SizedBox(
width: 18,
@@ -153,6 +157,7 @@ class _TcpScreenState extends State<TcpScreen> {
);
},
heroTag: 'tcp_usb_action',
extendedPadding: const EdgeInsets.symmetric(horizontal: 12),
icon: const Icon(Icons.usb),
label: Text(context.l10n.connectionChoiceUsbLabel),
),
@@ -162,6 +167,7 @@ class _TcpScreenState extends State<TcpScreen> {
Navigator.of(context).maybePop();
},
heroTag: 'tcp_ble_action',
extendedPadding: const EdgeInsets.symmetric(horizontal: 12),
icon: const Icon(Icons.bluetooth),
label: Text(context.l10n.connectionChoiceBluetoothLabel),
),