Tester feedback: offline mode, pt-PT, menus, layout and translations

Offline (read-only) mode
- The last connected radio is remembered; with no radio the app opens on
  its saved contacts, channels, messages and unread counts.
- Main screens stay open on disconnect. A Connect button replaces the
  battery and signal indicators, with a sheet to reconnect, choose a
  radio or stop a pending reconnect.
- While disconnected everything is read-only: the composer becomes a
  "connect to send" bar (drafts kept) and controls that change the radio
  or stored history are disabled or hidden.
- Resending while disconnected no longer deletes the message; a
  different radio no longer shows the previous radio's channels.
- Notification taps open the saved chat while offline.

Chats and menus
- Channel chat menu: notifications, edit channel, delete channel; the
  filter row lines up with the others; bell moved out of the app bar.
- DM and room menus: remove from contacts; rooms get room management.
- Search field uses the full app bar; long-press a result to copy.
- Hashtag channel titles no longer read "# #name"; more room around the
  radio activity dot.
- Repeat filter: short messages from one sender are caught at the same
  count as long ones.

Layout
- Shared menu row (wraps to two lines) and segment label (never splits
  a word) used across the app.
- One Scan button on the scanner; consistent settings tile titles;
  contact "last seen" wraps instead of truncating; unfetched repeater
  settings are dimmed.

Localization
- New European Portuguese locale (pt_PT); regional locales are handled
  by the language picker, notifications and the background service.
- Fill 67 missing strings per locale, including backup and restore.
- Keep "Flood" and "Zero Hop" untranslated, shorten "last seen" and
  routing labels, and fix mistranslated scan, theme and hop strings.
- Received-image strings, badge and caption come from translations.
- Regenerate the Czech localizations, which were missing strings.

Docs
- Add documentation/design.md (UI reference) and offline-mode.md;
  update channel, chat, navigation and scanner docs.
This commit is contained in:
zjs81 committed 2026-11-09 21:18:29 -07:00
1 parent 47f2293a5c
commit 462159e803
108 files changed
+17435 -4536

No files matched your search

+104
View File
@@ -0,0 +1,104 @@
import 'dart:convert';
import '../utils/app_logger.dart';
import 'prefs_manager.dart';
/// The radio that last completed a handshake, so its saved data can be shown
/// while no radio is connected.
class LastRadio {
static const String transportBle = 'ble';
static const String transportUsb = 'usb';
static const String transportTcp = 'tcp';
/// Full public key hex of the radio.
final String publicKeyHex;
final String name;
/// One of [transportBle], [transportUsb] or [transportTcp].
final String transport;
final String? bleRemoteId;
final String? bleDisplayName;
final String? tcpHost;
final int? tcpPort;
final DateTime savedAt;
const LastRadio({
required this.publicKeyHex,
required this.name,
required this.transport,
this.bleRemoteId,
this.bleDisplayName,
this.tcpHost,
this.tcpPort,
required this.savedAt,
});
bool get canReconnectBle =>
transport == transportBle && (bleRemoteId?.isNotEmpty ?? false);
bool get canReconnectTcp =>
transport == transportTcp &&
(tcpHost?.isNotEmpty ?? false) &&
tcpPort != null;
Map<String, dynamic> toJson() => {
'publicKeyHex': publicKeyHex,
'name': name,
'transport': transport,
if (bleRemoteId != null) 'bleRemoteId': bleRemoteId,
if (bleDisplayName != null) 'bleDisplayName': bleDisplayName,
if (tcpHost != null) 'tcpHost': tcpHost,
if (tcpPort != null) 'tcpPort': tcpPort,
'savedAt': savedAt.millisecondsSinceEpoch,
};
/// Returns null when [json] does not hold a usable record.
static LastRadio? fromJson(Object? json) {
if (json is! Map) return null;
final key = json['publicKeyHex'];
if (key is! String || key.length < 10) return null;
String? optString(String field) {
final value = json[field];
return value is String && value.isNotEmpty ? value : null;
}
final port = json['tcpPort'];
final savedAt = json['savedAt'];
final transport = optString('transport');
return LastRadio(
publicKeyHex: key,
name: optString('name') ?? '',
transport: transport == transportUsb || transport == transportTcp
? transport!
: transportBle,
bleRemoteId: optString('bleRemoteId'),
bleDisplayName: optString('bleDisplayName'),
tcpHost: optString('tcpHost'),
tcpPort: port is num ? port.toInt() : null,
savedAt: savedAt is num
? DateTime.fromMillisecondsSinceEpoch(savedAt.toInt())
: DateTime.fromMillisecondsSinceEpoch(0),
);
}
}
/// App-wide (not per-radio) record of the last connected radio.
class LastRadioStore {
static const String prefsKey = 'last_radio';
LastRadio? load() {
final raw = PrefsManager.instance.getString(prefsKey);
if (raw == null || raw.isEmpty) return null;
try {
return LastRadio.fromJson(jsonDecode(raw));
} catch (e) {
appLogger.warn('Stored last radio is unreadable: $e');
return null;
}
}
Future<void> save(LastRadio radio) =>
PrefsManager.instance.setString(prefsKey, jsonEncode(radio.toJson()));
Future<void> clear() => PrefsManager.instance.remove(prefsKey);
}