From 92b147bd4920a5ab187ec970e29ee1e09833c65b Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 20:57:30 -0700 Subject: [PATCH 01/11] Format tcp_transport_service_native_test --- .../tcp_transport_service_native_test.dart | 52 ++++++++++--------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/test/services/tcp_transport_service_native_test.dart b/test/services/tcp_transport_service_native_test.dart index 72edf22e..3cb9629c 100644 --- a/test/services/tcp_transport_service_native_test.dart +++ b/test/services/tcp_transport_service_native_test.dart @@ -61,30 +61,34 @@ int _readIntOption(Socket socket, int level, int option) { } void main() { - test('connect enables TCP keepalive with short probe timings', () async { - final server = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); - final overrides = _CapturingConnectOverrides(); - final service = TcpTransportService(); - try { - await IOOverrides.runZoned( - () => service.connect( - host: InternetAddress.loopbackIPv4.address, - port: server.port, - ), - socketConnect: overrides.socketConnect, - ); - final socket = overrides.socket!; - // Linux values: SO_KEEPALIVE 9, TCP_KEEPIDLE 4, TCP_KEEPINTVL 5, - // TCP_KEEPCNT 6. - expect(_readIntOption(socket, RawSocketOption.levelSocket, 9), 1); - expect(_readIntOption(socket, RawSocketOption.levelTcp, 4), 30); - expect(_readIntOption(socket, RawSocketOption.levelTcp, 5), 10); - expect(_readIntOption(socket, RawSocketOption.levelTcp, 6), 3); - } finally { - await service.disconnect(); - await server.close(); - } - }, skip: Platform.isLinux ? false : 'Option numbers checked are Linux ones'); + test( + 'connect enables TCP keepalive with short probe timings', + () async { + final server = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); + final overrides = _CapturingConnectOverrides(); + final service = TcpTransportService(); + try { + await IOOverrides.runZoned( + () => service.connect( + host: InternetAddress.loopbackIPv4.address, + port: server.port, + ), + socketConnect: overrides.socketConnect, + ); + final socket = overrides.socket!; + // Linux values: SO_KEEPALIVE 9, TCP_KEEPIDLE 4, TCP_KEEPINTVL 5, + // TCP_KEEPCNT 6. + expect(_readIntOption(socket, RawSocketOption.levelSocket, 9), 1); + expect(_readIntOption(socket, RawSocketOption.levelTcp, 4), 30); + expect(_readIntOption(socket, RawSocketOption.levelTcp, 5), 10); + expect(_readIntOption(socket, RawSocketOption.levelTcp, 6), 3); + } finally { + await service.disconnect(); + await server.close(); + } + }, + skip: Platform.isLinux ? false : 'Option numbers checked are Linux ones', + ); test('connect/disconnect updates TCP transport state', () async { final server = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0); From 918ab7f5a0e8fddbee167e0d45e6b54a909a89be Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 20:58:49 -0700 Subject: [PATCH 02/11] Keep the reaction picker above the system navigation bar Open the emoji picker through showMeshSheet, which pads the sheet by the navigation bar or keyboard, instead of a bare modal bottom sheet. --- lib/screens/channel_chat_screen.dart | 5 ++--- lib/screens/chat_screen.dart | 5 ++--- lib/widgets/emoji_picker.dart | 6 +----- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index 358ea298..7aa0cd15 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -2307,9 +2307,8 @@ class _ChannelChatScreenState extends State { } void _showEmojiPicker(ChannelMessage message) { - showModalBottomSheet( - context: context, - isScrollControlled: true, + showMeshSheet( + context, builder: (context) => EmojiPicker( onEmojiSelected: (emoji) { _sendReaction(message, emoji); diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index c0c503b4..4f60fd79 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -1161,9 +1161,8 @@ class _ChatScreenState extends State { } void _showEmojiPicker(Message message, Contact senderContact) { - showModalBottomSheet( - context: context, - isScrollControlled: true, + showMeshSheet( + context, builder: (context) => EmojiPicker( onEmojiSelected: (emoji) { _sendReaction(message, senderContact, emoji); diff --git a/lib/widgets/emoji_picker.dart b/lib/widgets/emoji_picker.dart index ab5c4edd..a6ef87e1 100644 --- a/lib/widgets/emoji_picker.dart +++ b/lib/widgets/emoji_picker.dart @@ -210,12 +210,8 @@ class EmojiPicker extends StatelessWidget { Widget build(BuildContext context) { final l10n = context.l10n; final emojiCategories = _emojiCategories(l10n); - return Container( + return SizedBox( height: MediaQuery.of(context).size.height * 0.5, - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - borderRadius: const BorderRadius.vertical(top: Radius.circular(20)), - ), child: Column( children: [ Padding( From 4c9705b3cb15cca3dbf106793a3ebeb61fe355fe Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 20:59:49 -0700 Subject: [PATCH 03/11] Keep the GIF picker above the system navigation bar Open the GIF picker through showMeshSheet so it is padded by the navigation bar or keyboard, and cap its height instead of fixing it so it shrinks when the keyboard is up. --- lib/widgets/chat_composer.dart | 6 +++--- lib/widgets/gif_picker.dart | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/widgets/chat_composer.dart b/lib/widgets/chat_composer.dart index 28cbf961..428381aa 100644 --- a/lib/widgets/chat_composer.dart +++ b/lib/widgets/chat_composer.dart @@ -9,6 +9,7 @@ import '../theme/mesh_theme.dart'; import 'byte_count_input.dart'; import 'gif_message.dart'; import 'gif_picker.dart'; +import 'mesh_ui.dart'; import 'message_translation_button.dart'; /// One entry of the composer's "+" menu. @@ -27,9 +28,8 @@ class ChatComposerAction { /// Opens the GIF picker and puts the chosen GIF into [controller]. void showChatGifPicker(BuildContext context, TextEditingController controller) { - showModalBottomSheet( - context: context, - isScrollControlled: true, + showMeshSheet( + context, builder: (context) => GifPicker( onGifSelected: (gifId) { controller.text = GifHelper.encodeGif(gifId); diff --git a/lib/widgets/gif_picker.dart b/lib/widgets/gif_picker.dart index e86ead15..dcd53c78 100644 --- a/lib/widgets/gif_picker.dart +++ b/lib/widgets/gif_picker.dart @@ -117,7 +117,9 @@ class _GifPickerState extends State { @override Widget build(BuildContext context) { return Container( - height: MediaQuery.of(context).size.height * 0.7, + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height * 0.7, + ), padding: const EdgeInsets.all(16), child: Column( children: [ From c296597a2dd9ce9b335058a152e4732e5026d649 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 20:59:59 -0700 Subject: [PATCH 04/11] Show the routing key prefix on each contact Contacts now show the first path-hash-width bytes of their public key as a monospace badge before the path label, so they can be matched to hops in routing paths and told apart. The width follows the radio's path hash size setting. --- lib/l10n/app_en.arb | 2 + lib/l10n/app_localizations.dart | 6 ++ lib/l10n/app_localizations_bg.dart | 5 ++ lib/l10n/app_localizations_de.dart | 5 ++ lib/l10n/app_localizations_en.dart | 5 ++ lib/l10n/app_localizations_es.dart | 5 ++ lib/l10n/app_localizations_fr.dart | 5 ++ lib/l10n/app_localizations_hu.dart | 5 ++ lib/l10n/app_localizations_it.dart | 5 ++ lib/l10n/app_localizations_ja.dart | 5 ++ lib/l10n/app_localizations_ko.dart | 5 ++ lib/l10n/app_localizations_nl.dart | 5 ++ lib/l10n/app_localizations_pl.dart | 5 ++ lib/l10n/app_localizations_pt.dart | 5 ++ lib/l10n/app_localizations_ru.dart | 5 ++ lib/l10n/app_localizations_sk.dart | 5 ++ lib/l10n/app_localizations_sl.dart | 5 ++ lib/l10n/app_localizations_sv.dart | 5 ++ lib/l10n/app_localizations_uk.dart | 5 ++ lib/l10n/app_localizations_zh.dart | 5 ++ lib/models/contact.dart | 11 ++++ lib/screens/contacts_screen.dart | 43 ++++++++++++++- test/models/contact_key_prefix_test.dart | 33 +++++++++++ untranslated.json | 70 +++++++++++++++++++++++- 24 files changed, 253 insertions(+), 2 deletions(-) create mode 100644 test/models/contact_key_prefix_test.dart diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index f62a038b..713faace 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -3437,6 +3437,8 @@ "@repeater_prvKeyLengthError": {"placeholders": {"length": {"type": "int"}}}, "contacts_advertFailed": "Couldn't send advertisement", "contacts_manageGroups": "Manage groups", + "contacts_keyPrefixSemantics": "Key prefix {prefix}", + "@contacts_keyPrefixSemantics": {"placeholders": {"prefix": {"type": "String"}}}, "community_shortId": "ID: {id}…", "@community_shortId": {"placeholders": {"id": {"type": "String"}}}, "tcpSectionTitle": "TCP / IP", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index b5e7efc5..0e518f54 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -10333,6 +10333,12 @@ abstract class AppLocalizations { /// **'Manage groups'** String get contacts_manageGroups; + /// No description provided for @contacts_keyPrefixSemantics. + /// + /// In en, this message translates to: + /// **'Key prefix {prefix}'** + String contacts_keyPrefixSemantics(String prefix); + /// No description provided for @community_shortId. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index b9f79a6f..c6415622 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -6166,6 +6166,11 @@ class AppLocalizationsBg extends AppLocalizations { @override String get contacts_manageGroups => 'Управление на групи'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index d7893ccf..c676dd50 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -6181,6 +6181,11 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contacts_manageGroups => 'Gruppen verwalten'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 0265ac8b..21530f6e 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -6080,6 +6080,11 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contacts_manageGroups => 'Manage groups'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 75c2ab0e..8359564b 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -6169,6 +6169,11 @@ class AppLocalizationsEs extends AppLocalizations { @override String get contacts_manageGroups => 'Gestionar grupos'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 85de8bbb..38d3d2f1 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -6194,6 +6194,11 @@ class AppLocalizationsFr extends AppLocalizations { @override String get contacts_manageGroups => 'Gérer les groupes'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID : $id…'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index ef4b3d9b..49926094 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -6157,6 +6157,11 @@ class AppLocalizationsHu extends AppLocalizations { @override String get contacts_manageGroups => 'Csoportok kezelése'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 50bb49d9..131ceb14 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -6176,6 +6176,11 @@ class AppLocalizationsIt extends AppLocalizations { @override String get contacts_manageGroups => 'Gestisci gruppi'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 2aabf56e..1f80c37d 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -5878,6 +5878,11 @@ class AppLocalizationsJa extends AppLocalizations { @override String get contacts_manageGroups => 'グループを管理'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 98a81ac1..23d8c73b 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -5888,6 +5888,11 @@ class AppLocalizationsKo extends AppLocalizations { @override String get contacts_manageGroups => '그룹 관리'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 082f2a18..219a69b4 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -6136,6 +6136,11 @@ class AppLocalizationsNl extends AppLocalizations { @override String get contacts_manageGroups => 'Groepen beheren'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 3db02722..c6364e22 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -6200,6 +6200,11 @@ class AppLocalizationsPl extends AppLocalizations { @override String get contacts_manageGroups => 'Zarządzaj grupami'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 9b89ff31..65fe9656 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -6165,6 +6165,11 @@ class AppLocalizationsPt extends AppLocalizations { @override String get contacts_manageGroups => 'Gerenciar grupos'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index a1686804..2111d3e1 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -6186,6 +6186,11 @@ class AppLocalizationsRu extends AppLocalizations { @override String get contacts_manageGroups => 'Управление группами'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 9cd7cc6d..0e06e5b0 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -6148,6 +6148,11 @@ class AppLocalizationsSk extends AppLocalizations { @override String get contacts_manageGroups => 'Spravovať skupiny'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 8602eb0d..5ff3571c 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -6150,6 +6150,11 @@ class AppLocalizationsSl extends AppLocalizations { @override String get contacts_manageGroups => 'Upravljaj skupine'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 1d87483d..f3b28979 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -6116,6 +6116,11 @@ class AppLocalizationsSv extends AppLocalizations { @override String get contacts_manageGroups => 'Hantera grupper'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index ebd6d5eb..8e658ffd 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -6188,6 +6188,11 @@ class AppLocalizationsUk extends AppLocalizations { @override String get contacts_manageGroups => 'Керування групами'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID: $id…'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 703a27fe..31d2b20f 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -5744,6 +5744,11 @@ class AppLocalizationsZh extends AppLocalizations { @override String get contacts_manageGroups => '管理分组'; + @override + String contacts_keyPrefixSemantics(String prefix) { + return 'Key prefix $prefix'; + } + @override String community_shortId(String id) { return 'ID:$id…'; diff --git a/lib/models/contact.dart b/lib/models/contact.dart index f079e028..a14d91b1 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -43,6 +43,17 @@ class Contact { String get publicKeyHex => pubKeyToHex(publicKey); + /// Uppercase hex of the first [byteWidth] public-key bytes: the hash this + /// node appears as in routing paths. + String publicKeyPrefixHex(int byteWidth) { + final width = byteWidth.clamp(1, 3).toInt(); + return publicKey + .take(width) + .map((b) => b.toRadixString(16).padLeft(2, '0')) + .join() + .toUpperCase(); + } + /// Non-localized type label, intended for logs and non-UI exports /// (e.g. GPX). For UI use the `typeLabel(l10n)` extension in /// `lib/l10n/contact_localization.dart`. diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index e7f8f4b0..9e25fa19 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -1884,9 +1884,13 @@ class _ContactTile extends StatelessWidget { ], ), const SizedBox(height: 3), - // Path / subtitle row + // Key prefix + path / subtitle row Row( children: [ + _KeyPrefixBadge( + prefix: contact.publicKeyPrefixHex(pathHashByteWidth), + ), + const SizedBox(width: 8), Expanded( child: Text( contact.pathLabel( @@ -1953,6 +1957,43 @@ class _ContactTile extends StatelessWidget { } } +/// Mono pill showing the contact's routing hash (public-key prefix), so it can +/// be matched against hops in paths. +class _KeyPrefixBadge extends StatelessWidget { + final String prefix; + + const _KeyPrefixBadge({required this.prefix}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Semantics( + label: context.l10n.contacts_keyPrefixSemantics( + prefix.split('').join(' '), + ), + excludeSemantics: true, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 1), + decoration: BoxDecoration( + color: scheme.surfaceContainerHighest, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: scheme.outline), + ), + child: Text( + prefix, + maxLines: 1, + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w700, + color: scheme.onSurface, + letterSpacing: 0.6, + ), + ), + ), + ); + } +} + /// Disposes [controller] when the dialog content unmounts, i.e. after the /// route's exit animation, so the TextField never sees a disposed controller. class _DisposeControllerOnUnmount extends StatefulWidget { diff --git a/test/models/contact_key_prefix_test.dart b/test/models/contact_key_prefix_test.dart new file mode 100644 index 00000000..6698398c --- /dev/null +++ b/test/models/contact_key_prefix_test.dart @@ -0,0 +1,33 @@ +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/models/contact.dart'; + +Contact _contact(List key) => Contact( + publicKey: Uint8List.fromList(key), + name: 'Node', + type: advTypeChat, + pathLength: -1, + path: Uint8List(0), + lastSeen: DateTime.fromMillisecondsSinceEpoch(0), +); + +void main() { + final contact = _contact([0xA3, 0x0F, 0xB2, 0x44]); + + test('formats the first pathHashByteWidth bytes as uppercase hex', () { + expect(contact.publicKeyPrefixHex(1), 'A3'); + expect(contact.publicKeyPrefixHex(2), 'A30F'); + expect(contact.publicKeyPrefixHex(3), 'A30FB2'); + }); + + test('clamps width to the supported 1-3 range', () { + expect(contact.publicKeyPrefixHex(0), 'A3'); + expect(contact.publicKeyPrefixHex(4), 'A30FB2'); + }); + + test('handles keys shorter than the width', () { + expect(_contact([0x01]).publicKeyPrefixHex(3), '01'); + }); +} diff --git a/untranslated.json b/untranslated.json index 9e26dfee..f9d91c98 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,69 @@ -{} \ No newline at end of file +{ + "bg": [ + "contacts_keyPrefixSemantics" + ], + + "de": [ + "contacts_keyPrefixSemantics" + ], + + "es": [ + "contacts_keyPrefixSemantics" + ], + + "fr": [ + "contacts_keyPrefixSemantics" + ], + + "hu": [ + "contacts_keyPrefixSemantics" + ], + + "it": [ + "contacts_keyPrefixSemantics" + ], + + "ja": [ + "contacts_keyPrefixSemantics" + ], + + "ko": [ + "contacts_keyPrefixSemantics" + ], + + "nl": [ + "contacts_keyPrefixSemantics" + ], + + "pl": [ + "contacts_keyPrefixSemantics" + ], + + "pt": [ + "contacts_keyPrefixSemantics" + ], + + "ru": [ + "contacts_keyPrefixSemantics" + ], + + "sk": [ + "contacts_keyPrefixSemantics" + ], + + "sl": [ + "contacts_keyPrefixSemantics" + ], + + "sv": [ + "contacts_keyPrefixSemantics" + ], + + "uk": [ + "contacts_keyPrefixSemantics" + ], + + "zh": [ + "contacts_keyPrefixSemantics" + ] +} From 00756ef05efdd88a1749232af175477e10629810 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 21:00:06 -0700 Subject: [PATCH 05/11] Set my location by long-pressing the path maps Move the map's confirm-and-set-location flow into a shared helper and call it on long-press and right-click in the path trace and channel message path maps, so the self position can be set while viewing a path. --- lib/screens/channel_message_path_screen.dart | 5 ++ lib/screens/map_screen.dart | 69 +---------------- lib/screens/path_trace_map.dart | 13 ++++ lib/widgets/set_my_location_dialog.dart | 79 ++++++++++++++++++++ 4 files changed, 99 insertions(+), 67 deletions(-) create mode 100644 lib/widgets/set_my_location_dialog.dart diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index 092e296a..218fe78f 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -24,6 +24,7 @@ import '../widgets/adaptive_app_bar_title.dart'; import '../widgets/mesh_ui.dart'; import '../widgets/path_map_scaffold.dart'; import '../widgets/path_map_ui.dart'; +import '../widgets/set_my_location_dialog.dart'; class ChannelMessagePathScreen extends StatelessWidget { final ChannelMessage message; @@ -911,6 +912,10 @@ class _ChannelMessagePathMapScreenState initialCenter: model.initialCenter, initialZoom: model.initialZoom, bounds: model.bounds, + onLongPress: (_, point) => + confirmAndSetMyLocation(context, connector, point), + onSecondaryTap: (_, point) => + confirmAndSetMyLocation(context, connector, point), onPositionChanged: (camera, hasGesture) { if (!mounted) return; // A manual pan/zoom releases the follow lock. diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index d2d74bb9..5dbd4f7a 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -43,6 +43,7 @@ import '../theme/mesh_theme.dart'; import '../widgets/mesh_ui.dart'; import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; +import '../widgets/set_my_location_dialog.dart'; import '../helpers/guessed_location_estimator.dart'; import '../helpers/snack_bar_builder.dart'; import '../helpers/utf8_length_limiter.dart'; @@ -3498,7 +3499,7 @@ class _MapScreenState extends State with DisconnectNavigationMixin { title: Text(context.l10n.map_setAsMyLocation), onTap: () { Navigator.pop(sheetContext); - _confirmAndSetMyLocation(connector, position); + confirmAndSetMyLocation(this.context, connector, position); }, ), ListTile( @@ -3512,72 +3513,6 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ); } - Future _confirmAndSetMyLocation( - MeshCoreConnector connector, - LatLng position, - ) async { - if (!connector.isConnected) return; - final l10n = context.l10n; - final latText = position.latitude.toStringAsFixed(6); - final lonText = position.longitude.toStringAsFixed(6); - final confirmed = await showDialog( - context: context, - builder: (dialogContext) => AlertDialog( - title: Text(l10n.map_setLocationConfirmTitle), - content: Text(l10n.map_setLocationConfirmBody(latText, lonText)), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext, false), - child: Text(l10n.common_cancel), - ), - FilledButton( - onPressed: () => Navigator.pop(dialogContext, true), - child: Text(l10n.map_setLocationAction), - ), - ], - ), - ); - if (confirmed != true || !mounted || !connector.isConnected) return; - - // The firmware stores coordinates as int32 micro-degrees. - bool matches() { - final lat = connector.selfLatitude; - final lon = connector.selfLongitude; - return lat != null && - lon != null && - (lat - position.latitude).abs() < 2e-6 && - (lon - position.longitude).abs() < 2e-6; - } - - var ok = false; - try { - await connector.setNodeLocation( - lat: position.latitude, - lon: position.longitude, - ); - await connector.refreshDeviceInfo(); - // Self info arrives asynchronously after the query; wait for it. - final deadline = DateTime.now().add(const Duration(seconds: 6)); - while (mounted && connector.isConnected) { - if (matches()) { - ok = true; - break; - } - if (DateTime.now().isAfter(deadline)) break; - await Future.delayed(const Duration(milliseconds: 250)); - } - } catch (e) { - debugPrint('Set node location failed: $e'); - } - if (!mounted) return; - showDismissibleSnackBar( - context, - content: Text( - ok ? l10n.map_locationSetSuccess : l10n.map_locationSetFailed, - ), - ); - } - Future _shareMarker({ required BuildContext context, required MeshCoreConnector connector, diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index f0bee80e..43d21d70 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -22,6 +22,7 @@ import 'package:meshcore_open/helpers/snack_bar_builder.dart'; import 'package:meshcore_open/widgets/path_map_scaffold.dart'; import 'package:meshcore_open/widgets/path_map_ui.dart'; import 'package:meshcore_open/widgets/snr_indicator.dart'; +import 'package:meshcore_open/widgets/set_my_location_dialog.dart'; import 'package:provider/provider.dart'; import '../theme/mesh_theme.dart'; @@ -239,6 +240,16 @@ class _PathTraceMapScreenState extends State }); } + Future _setMyLocation(LatLng point) async { + final connector = context.read(); + final ok = await confirmAndSetMyLocation(context, connector, point); + if (!ok || !mounted || !_hasData) return; + // Display paths start at the self position, so redraw them from it. + setState(() { + _rebuildDisplayPaths(connector); + }); + } + /// Keeps the camera centered on the packet while the follow lock is on. void _followPacketCamera() { if (!mounted) return; @@ -1497,6 +1508,8 @@ class _PathTraceMapScreenState extends State initialCenter: _initialCenter!, initialZoom: _initialZoom, bounds: _bounds, + onLongPress: (_, point) => _setMyLocation(point), + onSecondaryTap: (_, point) => _setMyLocation(point), onPositionChanged: (camera, hasGesture) { if (!mounted) return; // A manual pan/zoom releases the follow lock. diff --git a/lib/widgets/set_my_location_dialog.dart b/lib/widgets/set_my_location_dialog.dart new file mode 100644 index 00000000..5c611ff0 --- /dev/null +++ b/lib/widgets/set_my_location_dialog.dart @@ -0,0 +1,79 @@ +import 'package:flutter/material.dart'; +import 'package:latlong2/latlong.dart'; + +import '../connector/meshcore_connector.dart'; +import '../helpers/snack_bar_builder.dart'; +import '../l10n/l10n.dart'; + +/// Asks the user to confirm, then sets the radio's advertised location to +/// [position] and waits for SELF_INFO to report it. Shows a success or +/// failure snackbar and returns whether the radio confirmed the new location. +Future confirmAndSetMyLocation( + BuildContext context, + MeshCoreConnector connector, + LatLng position, +) async { + if (!connector.isConnected) return false; + final l10n = context.l10n; + final latText = position.latitude.toStringAsFixed(6); + final lonText = position.longitude.toStringAsFixed(6); + final confirmed = await showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(l10n.map_setLocationConfirmTitle), + content: Text(l10n.map_setLocationConfirmBody(latText, lonText)), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(l10n.common_cancel), + ), + FilledButton( + onPressed: () => Navigator.pop(dialogContext, true), + child: Text(l10n.map_setLocationAction), + ), + ], + ), + ); + if (confirmed != true || !context.mounted || !connector.isConnected) { + return false; + } + + // The firmware stores coordinates as int32 micro-degrees. + bool matches() { + final lat = connector.selfLatitude; + final lon = connector.selfLongitude; + return lat != null && + lon != null && + (lat - position.latitude).abs() < 2e-6 && + (lon - position.longitude).abs() < 2e-6; + } + + var ok = false; + try { + await connector.setNodeLocation( + lat: position.latitude, + lon: position.longitude, + ); + await connector.refreshDeviceInfo(); + // Self info arrives asynchronously after the query; wait for it. + final deadline = DateTime.now().add(const Duration(seconds: 6)); + while (context.mounted && connector.isConnected) { + if (matches()) { + ok = true; + break; + } + if (DateTime.now().isAfter(deadline)) break; + await Future.delayed(const Duration(milliseconds: 250)); + } + } catch (e) { + debugPrint('Set node location failed: $e'); + } + if (!context.mounted) return ok; + showDismissibleSnackBar( + context, + content: Text( + ok ? l10n.map_locationSetSuccess : l10n.map_locationSetFailed, + ), + ); + return ok; +} From ed5884e2526d94735b6fffd6158791d51478b0d6 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 21:00:24 -0700 Subject: [PATCH 06/11] Declutter the map overlay Drop the row of activity/type/group chips under the Local/Online/Both switch; every option is already in the filter sheet, whose button now shows a badge with the number of active filters. Add a one-line hint to each map source segment. --- lib/l10n/app_en.arb | 3 + lib/l10n/app_localizations.dart | 18 ++++ lib/l10n/app_localizations_bg.dart | 11 +++ lib/l10n/app_localizations_de.dart | 11 +++ lib/l10n/app_localizations_en.dart | 11 +++ lib/l10n/app_localizations_es.dart | 11 +++ lib/l10n/app_localizations_fr.dart | 11 +++ lib/l10n/app_localizations_hu.dart | 11 +++ lib/l10n/app_localizations_it.dart | 11 +++ lib/l10n/app_localizations_ja.dart | 11 +++ lib/l10n/app_localizations_ko.dart | 11 +++ lib/l10n/app_localizations_nl.dart | 11 +++ lib/l10n/app_localizations_pl.dart | 11 +++ lib/l10n/app_localizations_pt.dart | 11 +++ lib/l10n/app_localizations_ru.dart | 11 +++ lib/l10n/app_localizations_sk.dart | 11 +++ lib/l10n/app_localizations_sl.dart | 11 +++ lib/l10n/app_localizations_sv.dart | 11 +++ lib/l10n/app_localizations_uk.dart | 11 +++ lib/l10n/app_localizations_zh.dart | 11 +++ lib/screens/map_screen.dart | 144 ++++------------------------- untranslated.json | 85 +++++++++++++---- 22 files changed, 303 insertions(+), 145 deletions(-) diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 713faace..6396ba8a 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -3467,6 +3467,9 @@ "networkMap_sourceLocal": "Local", "networkMap_sourceOnline": "Online", "networkMap_sourceBoth": "Both", + "networkMap_sourceLocalHint": "Nodes your radio has heard", + "networkMap_sourceOnlineHint": "Repeaters from the online network map", + "networkMap_sourceBothHint": "Your radio's nodes plus the online network map", "networkMap_zoomInHint": "Zoom in to see the online network map", "networkMap_loadFailed": "Couldn't load the online network map", "networkMap_inYourContacts": "In your contacts", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 0e518f54..e2ddefb1 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -10477,6 +10477,24 @@ abstract class AppLocalizations { /// **'Both'** String get networkMap_sourceBoth; + /// No description provided for @networkMap_sourceLocalHint. + /// + /// In en, this message translates to: + /// **'Nodes your radio has heard'** + String get networkMap_sourceLocalHint; + + /// No description provided for @networkMap_sourceOnlineHint. + /// + /// In en, this message translates to: + /// **'Repeaters from the online network map'** + String get networkMap_sourceOnlineHint; + + /// No description provided for @networkMap_sourceBothHint. + /// + /// In en, this message translates to: + /// **'Your radio\'s nodes plus the online network map'** + String get networkMap_sourceBothHint; + /// No description provided for @networkMap_zoomInHint. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index c6415622..20e5ed39 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -6256,6 +6256,17 @@ class AppLocalizationsBg extends AppLocalizations { @override String get networkMap_sourceBoth => 'И двете'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Увеличете, за да видите онлайн мрежовата карта'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index c676dd50..e2b6ecc7 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -6269,6 +6269,17 @@ class AppLocalizationsDe extends AppLocalizations { @override String get networkMap_sourceBoth => 'Beides'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Zoome hinein, um die Online-Netzwerkkarte zu sehen'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 21530f6e..aafe85b9 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -6167,6 +6167,17 @@ class AppLocalizationsEn extends AppLocalizations { @override String get networkMap_sourceBoth => 'Both'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Zoom in to see the online network map'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 8359564b..3ff40ed9 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -6258,6 +6258,17 @@ class AppLocalizationsEs extends AppLocalizations { @override String get networkMap_sourceBoth => 'Ambos'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Acerca el zoom para ver el mapa de la red en línea'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 38d3d2f1..e7195127 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -6284,6 +6284,17 @@ class AppLocalizationsFr extends AppLocalizations { @override String get networkMap_sourceBoth => 'Les deux'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Zoomez pour voir la carte du réseau en ligne'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 49926094..d9d39273 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -6246,6 +6246,17 @@ class AppLocalizationsHu extends AppLocalizations { @override String get networkMap_sourceBoth => 'Mindkettő'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Nagyíts rá az online hálózati térkép megtekintéséhez'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 131ceb14..59d513e2 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -6265,6 +6265,17 @@ class AppLocalizationsIt extends AppLocalizations { @override String get networkMap_sourceBoth => 'Entrambi'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Ingrandisci per vedere la mappa della rete online'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 1f80c37d..1a71023f 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -5965,6 +5965,17 @@ class AppLocalizationsJa extends AppLocalizations { @override String get networkMap_sourceBoth => '両方'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'ズームインするとオンラインのネットワークマップが表示されます'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 23d8c73b..a8b0e72e 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -5975,6 +5975,17 @@ class AppLocalizationsKo extends AppLocalizations { @override String get networkMap_sourceBoth => '모두'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => '온라인 네트워크 지도를 보려면 확대하세요'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 219a69b4..49d228c4 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -6223,6 +6223,17 @@ class AppLocalizationsNl extends AppLocalizations { @override String get networkMap_sourceBoth => 'Beide'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Zoom in om de online netwerkkaart te zien'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index c6364e22..7465e3d9 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -6289,6 +6289,17 @@ class AppLocalizationsPl extends AppLocalizations { @override String get networkMap_sourceBoth => 'Obie'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Przybliż, aby zobaczyć mapę sieci online'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 65fe9656..e1587a43 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -6253,6 +6253,17 @@ class AppLocalizationsPt extends AppLocalizations { @override String get networkMap_sourceBoth => 'Ambos'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Aproxime o zoom para ver o mapa da rede online'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 2111d3e1..6b279c00 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -6276,6 +6276,17 @@ class AppLocalizationsRu extends AppLocalizations { @override String get networkMap_sourceBoth => 'Обе'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Приблизьте, чтобы увидеть онлайн-карту сети'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 0e06e5b0..a06dc817 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -6236,6 +6236,17 @@ class AppLocalizationsSk extends AppLocalizations { @override String get networkMap_sourceBoth => 'Obe'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Priblížte, aby ste videli online sieťovú mapu'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 5ff3571c..48bc7a49 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -6238,6 +6238,17 @@ class AppLocalizationsSl extends AppLocalizations { @override String get networkMap_sourceBoth => 'Oboje'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Povečajte, da vidite spletni omrežni zemljevid'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index f3b28979..efd22e6d 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -6203,6 +6203,17 @@ class AppLocalizationsSv extends AppLocalizations { @override String get networkMap_sourceBoth => 'Båda'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Zooma in för att se nätverkskartan online'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 8e658ffd..9e033ec4 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -6277,6 +6277,17 @@ class AppLocalizationsUk extends AppLocalizations { @override String get networkMap_sourceBoth => 'Обидві'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => 'Наблизьте, щоб побачити онлайн-карту мережі'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 31d2b20f..f80452cc 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -5830,6 +5830,17 @@ class AppLocalizationsZh extends AppLocalizations { @override String get networkMap_sourceBoth => '两者'; + @override + String get networkMap_sourceLocalHint => 'Nodes your radio has heard'; + + @override + String get networkMap_sourceOnlineHint => + 'Repeaters from the online network map'; + + @override + String get networkMap_sourceBothHint => + 'Your radio\'s nodes plus the online network map'; + @override String get networkMap_zoomInHint => '放大以查看在线网络地图'; diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 5dbd4f7a..aa28a882 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -1080,7 +1080,11 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ? FloatingActionButton( onPressed: () => _showFilterSheet(context, settingsService), tooltip: context.l10n.map_filterNodes, - child: const Icon(Icons.filter_list), + child: Badge.count( + count: _activeFilterCount(settings), + isLabelVisible: _activeFilterCount(settings) > 0, + child: const Icon(Icons.filter_list), + ), ) : null, ), @@ -2023,69 +2027,6 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ), const SizedBox(height: 6), _buildMapSourceSwitch(context, mapSource), - const SizedBox(height: 6), - LayoutBuilder( - builder: (context, constraints) { - final chips = [ - _mapChip( - label: context.l10n.time_allTime, - selected: _freshness == _Freshness.all, - onTap: () => setState(() => _freshness = _Freshness.all), - ), - _mapChip( - label: context.l10n.map_online, - selected: _freshness == _Freshness.online, - color: MapPalette.online, - onTap: () => setState(() => _freshness = _Freshness.online), - ), - _mapChip( - label: context.l10n.map_recent, - selected: _freshness == _Freshness.recent, - color: MapPalette.stale, - onTap: () => setState(() => _freshness = _Freshness.recent), - ), - _mapChip( - label: context.l10n.map_stale, - selected: _freshness == _Freshness.stale, - color: MapPalette.offline, - onTap: () => setState(() => _freshness = _Freshness.stale), - ), - _mapChip( - label: context.l10n.map_repeaters, - selected: settings.mapShowRepeaters, - color: MapPalette.repeater, - onTap: () => settingsService.setMapShowRepeaters( - !settings.mapShowRepeaters, - ), - ), - _mapChip( - label: context.l10n.map_chatNodes, - selected: settings.mapShowChatNodes, - color: MapPalette.selected, - onTap: () => settingsService.setMapShowChatNodes( - !settings.mapShowChatNodes, - ), - ), - _mapChip( - label: context.l10n.map_groupChip, - selected: settings.mapClusterNodes, - color: MapPalette.cluster, - onTap: () => settingsService.setMapClusterNodes( - !settings.mapClusterNodes, - ), - ), - ]; - - if (constraints.maxWidth < 600) { - return Wrap(runSpacing: 6, children: chips); - } - - return SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row(children: chips), - ); - }, - ), if (hasQuery) _buildSearchResults(context, allContacts, guessedLocations) else if (_statsExpanded) @@ -2107,6 +2048,14 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ); } + int _activeFilterCount(AppSettings settings) => [ + _freshness != _Freshness.all, + !settings.mapShowChatNodes, + !settings.mapShowRepeaters, + !settings.mapShowOtherNodes, + settings.mapKeyPrefixEnabled, + ].where((active) => active).length; + Widget _buildMapSourceSwitch(BuildContext context, MapSourceOption source) { final l10n = context.l10n; return Material( @@ -2128,16 +2077,19 @@ class _MapScreenState extends State with DisconnectNavigationMixin { value: MapSourceOption.local, icon: const Icon(Icons.radio, size: 20), label: Text(l10n.networkMap_sourceLocal), + tooltip: l10n.networkMap_sourceLocalHint, ), ButtonSegment( value: MapSourceOption.online, icon: const Icon(Icons.public, size: 20), label: Text(l10n.networkMap_sourceOnline), + tooltip: l10n.networkMap_sourceOnlineHint, ), ButtonSegment( value: MapSourceOption.both, icon: const Icon(Icons.layers, size: 20), label: Text(l10n.networkMap_sourceBoth), + tooltip: l10n.networkMap_sourceBothHint, ), ], selected: {source}, @@ -2177,70 +2129,6 @@ class _MapScreenState extends State with DisconnectNavigationMixin { ); } - Widget _mapChip({ - required String label, - required bool selected, - required VoidCallback onTap, - Color? color, - }) { - final accent = color ?? MapPalette.selected; - return Padding( - padding: const EdgeInsets.only(right: 6), - child: Semantics( - button: true, - selected: selected, - child: Material( - color: selected - ? Color.alphaBlend( - accent.withValues(alpha: 0.34), - _overlayPanelColor, - ) - : _overlayPanelColor, - shape: StadiumBorder( - side: BorderSide( - color: selected ? accent : _overlayBorderColor, - width: selected ? 1.5 : 1, - ), - ), - clipBehavior: Clip.antiAlias, - child: InkWell( - onTap: () { - HapticFeedback.selectionClick(); - onTap(); - }, - child: Container( - constraints: const BoxConstraints(minHeight: 44), - padding: const EdgeInsets.symmetric(horizontal: 14), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (selected) ...[ - Icon( - Icons.check, - size: 16, - color: _overlayPrimaryTextColor, - ), - const SizedBox(width: 4), - ], - Text( - label, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - color: selected - ? _overlayPrimaryTextColor - : _overlaySecondaryTextColor, - ), - ), - ], - ), - ), - ), - ), - ), - ); - } - Widget _buildSearchResults( BuildContext context, List allContacts, diff --git a/untranslated.json b/untranslated.json index f9d91c98..1027242f 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1,69 +1,120 @@ { "bg": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "de": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "es": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "fr": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "hu": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "it": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "ja": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "ko": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "nl": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "pl": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "pt": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "ru": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "sk": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "sl": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "sv": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "uk": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ], "zh": [ - "contacts_keyPrefixSemantics" + "contacts_keyPrefixSemantics", + "networkMap_sourceLocalHint", + "networkMap_sourceOnlineHint", + "networkMap_sourceBothHint" ] } From caf20b44158dd09ad95498a534844ca57640a896 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 24 Oct 2026 21:00:53 -0700 Subject: [PATCH 07/11] Summarize location, image and GIF messages in notifications Notification bodies now use the chat's parsers to show a localized summary for shared locations (m: markers), channel images, GIFs and reactions instead of the raw payload. The marker parser moves out of the map screen into helpers/marker_message.dart so the service can use it. --- lib/helpers/marker_message.dart | 30 ++++++++ lib/l10n/app_en.arb | 19 +++++ lib/l10n/app_localizations.dart | 30 ++++++++ lib/l10n/app_localizations_bg.dart | 19 +++++ lib/l10n/app_localizations_de.dart | 19 +++++ lib/l10n/app_localizations_en.dart | 19 +++++ lib/l10n/app_localizations_es.dart | 19 +++++ lib/l10n/app_localizations_fr.dart | 19 +++++ lib/l10n/app_localizations_hu.dart | 19 +++++ lib/l10n/app_localizations_it.dart | 19 +++++ lib/l10n/app_localizations_ja.dart | 19 +++++ lib/l10n/app_localizations_ko.dart | 19 +++++ lib/l10n/app_localizations_nl.dart | 19 +++++ lib/l10n/app_localizations_pl.dart | 19 +++++ lib/l10n/app_localizations_pt.dart | 19 +++++ lib/l10n/app_localizations_ru.dart | 19 +++++ lib/l10n/app_localizations_sk.dart | 19 +++++ lib/l10n/app_localizations_sl.dart | 19 +++++ lib/l10n/app_localizations_sv.dart | 19 +++++ lib/l10n/app_localizations_uk.dart | 19 +++++ lib/l10n/app_localizations_zh.dart | 19 +++++ lib/screens/channel_chat_screen.dart | 1 + lib/screens/chat_screen.dart | 1 + lib/screens/map_screen.dart | 30 +------- lib/services/notification_service.dart | 26 +++++-- test/screens/map_marker_parse_test.dart | 2 +- test/services/notification_text_test.dart | 45 ++++++++++++ untranslated.json | 85 +++++++++++++++++++++++ 28 files changed, 575 insertions(+), 36 deletions(-) create mode 100644 lib/helpers/marker_message.dart create mode 100644 test/services/notification_text_test.dart diff --git a/lib/helpers/marker_message.dart b/lib/helpers/marker_message.dart new file mode 100644 index 00000000..52f251c6 --- /dev/null +++ b/lib/helpers/marker_message.dart @@ -0,0 +1,30 @@ +import 'package:latlong2/latlong.dart'; + +class MarkerPayload { + final LatLng position; + final String label; + final String flags; + + MarkerPayload({ + required this.position, + required this.label, + required this.flags, + }); +} + +/// Parse a shared marker text message of the form +/// `m:,|