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

+109
View File
@@ -0,0 +1,109 @@
import 'dart:convert';
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/storage/last_radio_store.dart';
import 'package:meshcore_open/storage/prefs_manager.dart';
import 'package:shared_preferences/shared_preferences.dart';
Future<void> _init([Map<String, Object> values = const {}]) async {
SharedPreferences.setMockInitialValues(values);
PrefsManager.reset();
await PrefsManager.initialize();
}
const _key = 'aabbccddeeff00112233445566778899aabbccddeeff00112233445566778899';
void main() {
test('save and load round-trip a BLE radio', () async {
await _init();
final store = LastRadioStore();
final saved = LastRadio(
publicKeyHex: _key,
name: 'Base',
transport: LastRadio.transportBle,
bleRemoteId: 'AA:BB:CC:DD:EE:FF',
bleDisplayName: 'MeshCore-Base',
savedAt: DateTime.fromMillisecondsSinceEpoch(1234),
);
await store.save(saved);
final loaded = store.load()!;
expect(loaded.publicKeyHex, _key);
expect(loaded.name, 'Base');
expect(loaded.transport, LastRadio.transportBle);
expect(loaded.bleRemoteId, 'AA:BB:CC:DD:EE:FF');
expect(loaded.bleDisplayName, 'MeshCore-Base');
expect(loaded.tcpHost, isNull);
expect(loaded.savedAt.millisecondsSinceEpoch, 1234);
expect(loaded.canReconnectBle, isTrue);
expect(loaded.canReconnectTcp, isFalse);
});
test('TCP radio keeps host and port', () async {
await _init();
final store = LastRadioStore();
await store.save(
LastRadio(
publicKeyHex: _key,
name: 'Roof',
transport: LastRadio.transportTcp,
tcpHost: '192.168.1.5',
tcpPort: 5000,
savedAt: DateTime.now(),
),
);
final loaded = store.load()!;
expect(loaded.tcpHost, '192.168.1.5');
expect(loaded.tcpPort, 5000);
expect(loaded.canReconnectTcp, isTrue);
expect(loaded.canReconnectBle, isFalse);
});
test('clear removes the record', () async {
await _init();
final store = LastRadioStore();
await store.save(
LastRadio(
publicKeyHex: _key,
name: 'x',
transport: LastRadio.transportUsb,
savedAt: DateTime.now(),
),
);
await store.clear();
expect(store.load(), isNull);
});
test('tolerates missing, corrupt and partial records', () async {
await _init();
expect(LastRadioStore().load(), isNull);
await _init({LastRadioStore.prefsKey: '{not json'});
expect(LastRadioStore().load(), isNull);
await _init({
LastRadioStore.prefsKey: jsonEncode([1, 2, 3]),
});
expect(LastRadioStore().load(), isNull);
await _init({
LastRadioStore.prefsKey: jsonEncode({'publicKeyHex': 'abc'}),
});
expect(LastRadioStore().load(), isNull);
await _init({
LastRadioStore.prefsKey: jsonEncode({
'publicKeyHex': _key,
'transport': 'carrier-pigeon',
'tcpPort': '80',
'savedAt': 'yesterday',
}),
});
final loaded = LastRadioStore().load()!;
expect(loaded.publicKeyHex, _key);
expect(loaded.name, '');
expect(loaded.transport, LastRadio.transportBle);
expect(loaded.tcpPort, isNull);
expect(loaded.canReconnectBle, isFalse);
});
}