Add Czech, in-chat search, typed-hash path trace and contact sharing

- Czech UI locale (app_cs.arb), selectable in the language picker and as a
  message translation language; language names added to every locale.
- Fix wrong language names: Slovak shown as Slovenian in it/ja/pt/sl,
  garbled Slovak/Bulgarian in pl, Ukrainian in ru, Hungarian in ko/zh.
- Search inside DM and channel chats across the full stored history, with
  highlighted matches; filtered channel messages are excluded.
- Path trace by typed hashes (e.g. A1,B2,C3) from the Contacts and map
  menus, without needing node locations; the map trace panel can hand its
  hops to it.
- Share contacts in chats using the official app's <pubkey:type:name>
  format; received cards have a one-tap Add contact button that reuses the
  QR card import path.
- Translations for all new strings in every locale; docs updated.
This commit is contained in:
zjs81 committed 2026-11-07 22:31:14 -07:00
1 parent e57f97616c
commit c939f7a29c
67 files changed
+17245 -381

No files matched your search

+52
View File
@@ -64,6 +64,8 @@ import '../storage/unread_store.dart';
import '../review_mode/review_mode_storage.dart';
import '../review_mode/review_radio.dart';
import '../utils/app_logger.dart';
import '../utils/contact_qr.dart';
import '../utils/contact_qr_frame.dart';
import '../utils/battery_utils.dart';
import '../utils/platform_info.dart';
import 'meshcore_uuids.dart';
@@ -1018,6 +1020,34 @@ class MeshCoreConnector extends ChangeNotifier {
return olderMessages;
}
/// Full stored history (archived prefix plus the in-memory window) for
/// search. Read-only: nothing is unarchived and listeners are not notified.
Future<List<Message>> allMessagesForSearch(String contactKeyHex) async {
final stored = await _messageStore.loadMessages(contactKeyHex);
final window = _conversations[contactKeyHex] ?? const <Message>[];
final archived =
(_messageStore.archivedCount(contactKeyHex) ??
stored.length - window.length)
.clamp(0, stored.length);
return [...stored.sublist(0, archived), ...window];
}
/// Channel counterpart of [allMessagesForSearch]; read-only.
Future<List<ChannelMessage>> allChannelMessagesForSearch(
int channelIndex,
) async {
final slot = _canonicalSlot(channelIndex);
final window = _channelMessages[slot] ?? const <ChannelMessage>[];
final channelId = _channelIdForSlot(slot);
if (channelId == null) return List.of(window);
final stored = await _channelMessageStore.loadChannelMessages(channelId);
final archived =
(_channelMessageStore.archivedCount(channelId) ??
stored.length - window.length)
.clamp(0, stored.length);
return [..._bindToSlot(stored.sublist(0, archived), slot), ...window];
}
List<ChannelMessage> getChannelMessages(Channel channel) {
return _channelMessages[_canonicalSlot(channel.index)] ?? [];
}
@@ -4675,6 +4705,28 @@ class MeshCoreConnector extends ChangeNotifier {
}
}
/// Adds (or updates) a contact from a scanned/shared card on the radio and
/// refreshes the contact list. Throws when the radio does not acknowledge.
Future<void> addContactFromCard(ScannedContact card) async {
final publicKey = card.publicKey;
// Saved contacts first (their flags matter), then discovery-only records,
// which still carry a known name worth preserving.
final existing = publicKey == null
? null
: allContactsUnfiltered
.where(
(contact) => contact.publicKeyHex == pubKeyToHex(publicKey),
)
.firstOrNull;
final frame = buildContactQrFrame(
card,
existing: existing,
pathHashByteWidth: pathHashByteWidth,
);
await sendFrame(frame, waitForGenericAck: true);
await refreshContacts();
}
Future<void> refreshContacts() async {
await getContacts(preserveExisting: true);
}