From d2a6fbe1821e0e80837799a62386c2fbd1b1c6ac Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 10 May 2026 11:09:25 +0200 Subject: [PATCH 01/36] translate notifications. --- lib/connector/meshcore_connector.dart | 99 +++++++++++++++++++++------ lib/services/translation_service.dart | 2 +- 2 files changed, 79 insertions(+), 22 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 538ee38a..ba18d3b1 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -4408,22 +4408,38 @@ class MeshCoreConnector extends ChangeNotifier { _appSettingsService != null) { final settings = _appSettingsService!.settings; if (settings.notificationsEnabled && settings.notifyOnNewMessage) { + // Capture non-null local for async closure type promotion + final msg = message; if (contact?.type == advTypeChat) { - _notificationService.showMessageNotification( - contactName: contact?.name ?? 'Unknown', - message: message.text, - contactId: message.senderKeyHex, - badgeCount: getTotalUnreadCount(), - ); + unawaited(() async { + final resolvedText = await _maybeTranslateForNotification( + msg.text, + isCli: msg.isCli, + ); + await _notificationService.showMessageNotification( + contactName: contact?.name ?? 'Unknown', + message: resolvedText, + contactId: msg.senderKeyHex, + badgeCount: getTotalUnreadCount(), + ); + }()); } else if (contact?.type == advTypeRoom) { - _notificationService.showMessageNotification( - contactName: contact?.name ?? 'Unknown Room', - message: message.text.length > 4 - ? message.text.substring(4) - : message.text, - contactId: message.senderKeyHex, - badgeCount: getTotalUnreadCount(), - ); + // Room server messages include a 4-char prefix; strip it for notifications + final bodyText = msg.text.length > 4 + ? msg.text.substring(4) + : msg.text; + unawaited(() async { + final resolvedText = await _maybeTranslateForNotification( + bodyText, + isCli: msg.isCli, + ); + await _notificationService.showMessageNotification( + contactName: contact?.name ?? 'Unknown Room', + message: resolvedText, + contactId: msg.senderKeyHex, + badgeCount: getTotalUnreadCount(), + ); + }()); } } } @@ -4705,13 +4721,54 @@ class MeshCoreConnector extends ChangeNotifier { final label = channelName ?? _channelDisplayName(channelIndex); if (_appSettingsService!.isChannelMuted(label)) return; - _notificationService.showChannelMessageNotification( - channelName: label, - senderName: message.senderName, - message: message.text, - channelIndex: channelIndex, - badgeCount: getTotalUnreadCount(), - ); + // Translate channel notification text if enabled + unawaited(() async { + final resolvedText = await _maybeTranslateForNotification( + message.text, + isCli: false, + ); + await _notificationService.showChannelMessageNotification( + channelName: label, + senderName: message.senderName, + message: resolvedText, + channelIndex: message.channelIndex, + badgeCount: getTotalUnreadCount(), + ); + }()); + } + + Future _maybeTranslateForNotification( + String text, { + required bool isCli, + }) async { + final service = _translationService; + if (service == null) return text; + try { + if (!service.shouldTranslateIncoming( + text: text, + isCli: isCli, + isOutgoing: false, + )) { + return text; + } + final targetLanguageCode = service.resolvedIncomingLanguageCode( + _appSettingsService?.settings.languageOverride, + ); + if (targetLanguageCode == null || targetLanguageCode.isEmpty) { + return text; + } + final result = await service.translateIncomingText( + text: text, + targetLanguageCode: targetLanguageCode, + ); + final translated = result?.translatedText.trim(); + if (translated != null && translated.isNotEmpty) { + return translated; + } + } catch (_) { + // Fallback to original text on any error + } + return text; } void _handleIncomingChannelMessage(Uint8List frame) { diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 294a7848..7f2d4495 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -454,7 +454,7 @@ class TranslationService extends ChangeNotifier { final targetLabel = _languageLabel(targetLanguageCode); final instruction = targetLanguageCode == 'zh' ? '将以下文本翻译为中文,注意只需要输出翻译后的结果,不要额外解释:\n\n$text' - : 'Translate the following segment into $targetLabel, without additional explanation.\n\n$text'; + : 'Translate the following segment into $targetLabel, without additional explanation. If it is already in $targetLabel, then return the exact same String.\n\n$text'; try { return await _runExclusive(() async { final engine = await _ensureContext(model.localPath); From 703d5a1ec460e272b91178e4cf04ad7c33378fb5 Mon Sep 17 00:00:00 2001 From: Max Cooley Date: Sun, 10 May 2026 17:12:48 -0700 Subject: [PATCH 02/36] Add "NRF52" as a device name prefix --- lib/connector/meshcore_uuids.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/connector/meshcore_uuids.dart b/lib/connector/meshcore_uuids.dart index ae6697b6..084cc424 100644 --- a/lib/connector/meshcore_uuids.dart +++ b/lib/connector/meshcore_uuids.dart @@ -11,5 +11,6 @@ class MeshCoreUuids { "Lilygo", "HT-", "LowMesh_MC_", + "NRF52", ]; } From 3af97ff6dd2035cc1b7e89ea5a2df90bd17b916c Mon Sep 17 00:00:00 2001 From: Max Cooley Date: Sun, 10 May 2026 17:16:38 -0700 Subject: [PATCH 03/36] Accidentally wrote quotes instead of backticks...oops --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 94d54bac..041ea6e9 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ Devices are discovered by scanning for BLE advertisements with known MeshCore de - `WisCore-` - `HT-` - `LowMesh_MC_` + - `NRF52` New device prefixes can be added in `lib/connector/meshcore_uuids.dart`. From 1f6b2dacf95a8727b87f5ad60f4f402467a7508b Mon Sep 17 00:00:00 2001 From: ericz Date: Mon, 11 May 2026 07:15:39 +0200 Subject: [PATCH 04/36] changed translation prompt back to specific input. --- lib/services/translation_service.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 7f2d4495..294a7848 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -454,7 +454,7 @@ class TranslationService extends ChangeNotifier { final targetLabel = _languageLabel(targetLanguageCode); final instruction = targetLanguageCode == 'zh' ? '将以下文本翻译为中文,注意只需要输出翻译后的结果,不要额外解释:\n\n$text' - : 'Translate the following segment into $targetLabel, without additional explanation. If it is already in $targetLabel, then return the exact same String.\n\n$text'; + : 'Translate the following segment into $targetLabel, without additional explanation.\n\n$text'; try { return await _runExclusive(() async { final engine = await _ensureContext(model.localPath); From 2763d83fe41ab42890e6ac43005693c35ca828fa Mon Sep 17 00:00:00 2001 From: Seth Golub Date: Mon, 11 May 2026 21:13:50 -0700 Subject: [PATCH 05/36] Use correct channel icons in channel chat screen At the top of the channel chat screen is an icon, indicating the channel type. Previously, the public icon was used correctly, but the hashtag icon was used for all other types. Now, consistent with the channels screen, we use the lock icon for private channels, and the composite icons for community public & community hashtag types. The fix for private channels was trivial, as we can identify hashtag channels by their name. Finding out whether a channel belongs to a community is much more involved. All the hard-working code was copied from channels_screen.dart. (I tried refactoring to reduce duplication, but my results were complex and not worth it.) Closes #432 --- lib/models/channel.dart | 34 ++++++++++++ lib/models/community.dart | 33 +++++++++++ lib/screens/channel_chat_screen.dart | 74 +++++++++++++++++++++++-- lib/screens/channels_screen.dart | 82 +++++++++------------------- 4 files changed, 164 insertions(+), 59 deletions(-) diff --git a/lib/models/channel.dart b/lib/models/channel.dart index 4fdd6270..9baf6302 100644 --- a/lib/models/channel.dart +++ b/lib/models/channel.dart @@ -4,6 +4,9 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; import '../connector/meshcore_protocol.dart'; +import 'community.dart'; + +enum ChannelType { public, private, hashtag, communityPublic, communityHashtag } class Channel { final int index; @@ -111,5 +114,36 @@ class Channel { return bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(); } + static bool isCommunityChannel(ChannelType channelType) { + switch (channelType) { + case ChannelType.communityPublic: + case ChannelType.communityHashtag: + return true; + case ChannelType.public: + case ChannelType.private: + case ChannelType.hashtag: + return false; + } + } + + static ChannelType getChannelType( + Channel channel, + CommunityPskIndex communityIndex, + ) { + Community? community = communityIndex.getCommunityForChannel(channel); + if (community != null) { + if (Community.isCommunityPublicChannel(channel, community)) { + return ChannelType.communityPublic; + } + return ChannelType.communityHashtag; + } + if (channel.isPublicChannel) { + return ChannelType.public; + } else if (channel.name.startsWith('#')) { + return ChannelType.hashtag; + } + return ChannelType.private; + } + static const String publicChannelPsk = '8b3387e9c5cdea6ac9e5edbaa115cd72'; } diff --git a/lib/models/community.dart b/lib/models/community.dart index c829f3d1..7261ddf9 100644 --- a/lib/models/community.dart +++ b/lib/models/community.dart @@ -4,6 +4,8 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; +import 'channel.dart'; + /// Represents a community with a shared secret for deriving channel PSKs. /// /// A Community is a namespace with a shared secret K (32 random bytes), @@ -162,6 +164,12 @@ class Community { return hashtag.replaceFirst(RegExp(r'^#'), '').toLowerCase().trim(); } + /// Returns true if this is the community's public channel + static bool isCommunityPublicChannel(Channel channel, Community community) { + final publicPsk = community.deriveCommunityPublicPsk(); + return channel.pskHex == Channel.formatPskHex(publicPsk); + } + /// Add a hashtag channel to this community's list Community addHashtagChannel(String hashtag) { final normalized = _normalizeCommunityHashtag(hashtag); @@ -237,3 +245,28 @@ class Community { @override int get hashCode => id.hashCode; } + +class CommunityPskIndex { + // Cache of PSK hex -> Community for quick lookup + final Map _pskToCommunity = {}; + + void initialize(List communities) { + _pskToCommunity.clear(); + for (final community in communities) { + // Map the community public channel PSK + final publicPsk = community.deriveCommunityPublicPsk(); + _pskToCommunity[Channel.formatPskHex(publicPsk)] = community; + + // Map all known hashtag channel PSKs + for (final hashtag in community.hashtagChannels) { + final hashtagPsk = community.deriveCommunityHashtagPsk(hashtag); + _pskToCommunity[Channel.formatPskHex(hashtagPsk)] = community; + } + } + } + + /// Returns the community this channel belongs to, or null if not a community channel + Community? getCommunityForChannel(Channel channel) { + return _pskToCommunity[channel.pskHex]; + } +} diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index fcd50861..be72eaa8 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -8,6 +8,8 @@ import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; +import '../models/community.dart'; +import '../storage/community_store.dart'; import '../utils/platform_info.dart'; import '../helpers/chat_scroll_controller.dart'; import '../connector/meshcore_protocol.dart'; @@ -56,8 +58,11 @@ class _ChannelChatScreenState extends State { final ChatScrollController _scrollController = ChatScrollController(); final FocusNode _textFieldFocusNode = FocusNode(); ChannelMessage? _replyingToMessage; + final CommunityStore _communityStore = CommunityStore(); + final CommunityPskIndex _communityIndex = CommunityPskIndex(); final Map _messageKeys = {}; bool _isLoadingOlder = false; + bool _communitiesLoaded = false; MeshCoreConnector? _connector; DateTime? _lastChannelSendAt; @@ -81,6 +86,7 @@ class _ChannelChatScreenState extends State { final idx = widget.channel.index; final unread = widget.initialUnreadCount; final messages = connector.getChannelMessages(widget.channel); + _loadCommunities(); ChannelMessage? anchor; if (unread > 0) { anchor = _findOldestUnreadChannelAnchor(messages, unread); @@ -107,6 +113,19 @@ class _ChannelChatScreenState extends State { }); } + // TODO: Reload communities when returning from another screen + Future _loadCommunities() async { + final connector = context.read(); + _communityStore.setPublicKeyHex = connector.selfPublicKeyHex; + final communities = await _communityStore.loadCommunities(); + if (mounted) { + setState(() { + _communityIndex.initialize(communities); + _communitiesLoaded = true; + }); + } + } + ChannelMessage? _findOldestUnreadChannelAnchor( List messages, int unreadCount, @@ -193,16 +212,63 @@ class _ChannelChatScreenState extends State { ); } + Widget _channelIcon(Channel channel) { + // Determine icon based on channel type + final ChannelType channelType = Channel.getChannelType( + channel, + _communityIndex, + ); + final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + IconData icon; + switch (channelType) { + case ChannelType.communityPublic: + icon = Icons.groups; + case ChannelType.communityHashtag: + icon = Icons.tag; + case ChannelType.public: + icon = Icons.public; + case ChannelType.hashtag: + icon = Icons.tag; + case ChannelType.private: + icon = Icons.lock; + } + return Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 3), + child: _communitiesLoaded + ? Icon(icon, size: 20) + : SizedBox.square(dimension: 20), + ), + if (isCommunityChannel) + Positioned( + right: 0, + bottom: 0, + child: Container( + width: 12, + height: 12, + decoration: BoxDecoration( + color: Colors.purple, + shape: BoxShape.circle, + border: Border.all( + color: Theme.of(context).cardColor, + width: 2, + ), + ), + child: const Icon(Icons.people, size: 8, color: Colors.white), + ), + ), + ], + ); + } + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Row( children: [ - Icon( - widget.channel.isPublicChannel ? Icons.public : Icons.tag, - size: 20, - ), + _channelIcon(widget.channel), const SizedBox(width: 8), Expanded( child: Column( diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 4613a8ee..e97705fc 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -44,11 +44,9 @@ class _ChannelsScreenState extends State with DisconnectNavigationMixin { final TextEditingController _searchController = TextEditingController(); final CommunityStore _communityStore = CommunityStore(); - Timer? _searchDebounce; + final CommunityPskIndex _communityIndex = CommunityPskIndex(); List _communities = []; - - // Cache of PSK hex -> Community for quick lookup - final Map _pskToCommunity = {}; + Timer? _searchDebounce; ChannelMessageStore get _channelMessageStore => ChannelMessageStore(); @@ -71,37 +69,11 @@ class _ChannelsScreenState extends State if (mounted) { setState(() { _communities = communities; - _buildPskCommunityMap(); + _communityIndex.initialize(communities); }); } } - void _buildPskCommunityMap() { - _pskToCommunity.clear(); - for (final community in _communities) { - // Map the community public channel PSK - final publicPsk = community.deriveCommunityPublicPsk(); - _pskToCommunity[Channel.formatPskHex(publicPsk)] = community; - - // Map all known hashtag channel PSKs - for (final hashtag in community.hashtagChannels) { - final hashtagPsk = community.deriveCommunityHashtagPsk(hashtag); - _pskToCommunity[Channel.formatPskHex(hashtagPsk)] = community; - } - } - } - - /// Returns the community this channel belongs to, or null if not a community channel - Community? _getCommunityForChannel(Channel channel) { - return _pskToCommunity[channel.pskHex]; - } - - /// Returns true if this is the community's public channel - bool _isCommunityPublicChannel(Channel channel, Community community) { - final publicPsk = community.deriveCommunityPublicPsk(); - return channel.pskHex == Channel.formatPskHex(publicPsk); - } - @override void dispose() { _searchDebounce?.cancel(); @@ -375,37 +347,37 @@ class _ChannelsScreenState extends State int? dragIndex, }) { final unreadCount = connector.getUnreadCountForChannel(channel); - final community = _getCommunityForChannel(channel); - final isCommunityChannel = community != null; - final isCommunityPublic = - isCommunityChannel && _isCommunityPublicChannel(channel, community); // Determine icon and colors based on channel type IconData icon; Color iconColor; Color bgColor; - - if (isCommunityChannel) { - // Community channel styling - iconColor = Colors.purple; - bgColor = Colors.purple.withValues(alpha: 0.2); - if (isCommunityPublic) { + final ChannelType channelType = Channel.getChannelType( + channel, + _communityIndex, + ); + final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + switch (channelType) { + case ChannelType.communityPublic: icon = Icons.groups; - } else { + iconColor = Colors.purple; + bgColor = Colors.purple.withValues(alpha: 0.2); + case ChannelType.communityHashtag: icon = Icons.tag; - } - } else if (channel.isPublicChannel) { - icon = Icons.public; - iconColor = Colors.green; - bgColor = Colors.green.withValues(alpha: 0.2); - } else if (channel.name.startsWith('#')) { - icon = Icons.tag; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); - } else { - icon = Icons.lock; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); + iconColor = Colors.purple; + bgColor = Colors.purple.withValues(alpha: 0.2); + case ChannelType.public: + icon = Icons.public; + iconColor = Colors.green; + bgColor = Colors.green.withValues(alpha: 0.2); + case ChannelType.hashtag: + icon = Icons.tag; + iconColor = Colors.blue; + bgColor = Colors.blue.withValues(alpha: 0.2); + case ChannelType.private: + icon = Icons.lock; + iconColor = Colors.blue; + bgColor = Colors.blue.withValues(alpha: 0.2); } return Card( From 75ae903b99b4f341d5a419ccd4aa813f46e492cf Mon Sep 17 00:00:00 2001 From: ZIER Date: Tue, 12 May 2026 10:24:01 +0200 Subject: [PATCH 06/36] implement flutter_langdetect --- lib/services/translation_service.dart | 86 ++++++--------------------- pubspec.yaml | 1 + 2 files changed, 19 insertions(+), 68 deletions(-) diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 294a7848..148650ca 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart' as http; import 'package:llamadart/llamadart.dart'; +import 'package:flutter_langdetect/flutter_langdetect.dart'; import '../models/app_settings.dart'; import '../models/translation_support.dart'; @@ -41,7 +42,10 @@ class TranslationService extends ChangeNotifier { TranslationService( this._appSettingsService, { TranslationFileStore? fileStore, - }) : _fileStore = fileStore ?? TranslationFileStore(); + }) : _fileStore = fileStore ?? TranslationFileStore() { + // Initialize langdetect once at service construction. + _langDetectInit = initLangDetect(); + } bool _isBusy = false; bool _isDownloading = false; @@ -51,6 +55,7 @@ class TranslationService extends ChangeNotifier { LlamaEngine? _engine; String? _loadedModelPath; String? _failedModelPath; + Future? _langDetectInit; int _downloadedBytes = 0; int? _downloadTotalBytes; String? _downloadFileName; @@ -436,7 +441,18 @@ class TranslationService extends ChangeNotifier { } Future detectLanguage(String text) async { - return _heuristicLanguageCode(text); + try { + // Ensure the detector is initialized (constructor starts init). + await (_langDetectInit ??= initLangDetect()); + final code = detect(text); + if (code.isEmpty) return null; + return code; + } catch (error) { + _lastError = error.toString(); + appLogger.warn('Language detection failed: $error'); + notifyListeners(); + return null; + } } Future _translateText({ @@ -518,72 +534,6 @@ class TranslationService extends ChangeNotifier { trimmed.startsWith('r:')); } - String? _heuristicLanguageCode(String text) { - final trimmed = text.trim(); - if (trimmed.isEmpty) { - return null; - } - - if (RegExp(r'[ぁ-んァ-ン]').hasMatch(text)) { - return 'ja'; - } - if (RegExp(r'[가-힣]').hasMatch(text)) { - return 'ko'; - } - if (RegExp(r'[\u4e00-\u9fff]').hasMatch(text)) { - return 'zh'; - } - - final lower = trimmed.toLowerCase(); - final patterns = { - 'uk': r'\b(привіт|дякую|будь|ласка|як|де|не|так|це|є|най|ще|може|для)\b', - 'ru': - r'\b(что|это|как|не|да|нет|он|она|они|быть|есть|для|сегодня|если|уже|может)\b', - 'bg': r'\b(ще|няма|благодаря|моля|това|какво|тук|ние|вие|не|със|за)\b', - 'de': - r'\b(der|die|das|und|ist|nicht|ein|eine|ich|für|mit|auf|zu|auch|als|an|im|am|es|dem|den|sich|von)\b', - 'en': - r'\b(the|and|is|you|for|with|from|not|that|this|have|be|are|was|were|but|can|will|your|what|when|how|they)\b', - 'es': - r'\b(el|la|los|las|es|que|de|en|con|por|para|no|un|una|se|como|su|al|del|está)\b', - 'fr': - r'\b(le|la|les|un|une|et|est|que|qui|pour|dans|pas|avec|sur|ne|vous|il|elle|des|ce|cette|je|tu|nous|vous)\b', - 'it': - r'\b(il|la|lo|un|una|che|di|da|in|per|con|non|si|mi|ti|noi|voi|lui|lei)\b', - 'pt': - r'\b(os|as|que|de|do|da|em|para|com|por|não|uma|um|se|você|também)\b', - 'nl': - r'\b(de|het|een|en|is|niet|dat|wat|je|ik|op|aan|voor|met|als|nog|zijn)\b', - 'sv': - r'\b(och|är|det|att|som|en|på|inte|har|var|men|du|jag|vi|ni|den|detta)\b', - 'pl': - r'\b(na|się|nie|jest|to|że|do|od|dla|czy|tak|ale|ma|jak|on|ona|my)\b', - 'sk': r'\b(je|na|so|že|do|od|za|si|to|ten|tá|tí|ako|má|nie|som|sa)\b', - 'sl': r'\b(in|je|na|se|da|za|od|ne|to|ta|so|kako|bo|sem|si)\b', - 'hu': - r'\b(az|és|nem|van|volt|hogy|mit|mire|ki|mi|ez|azért|is|de|ha|te|ő|mi|itt)\b', - }; - - final scores = {}; - for (final entry in patterns.entries) { - scores[entry.key] = RegExp( - entry.value, - caseSensitive: false, - ).allMatches(lower).length; - } - - final sorted = scores.entries.toList() - ..sort((a, b) => b.value.compareTo(a.value)); - if (sorted.isEmpty || sorted.first.value == 0) { - return null; - } - if (sorted.length > 1 && sorted.first.value == sorted[1].value) { - return null; - } - - return sorted.first.key; - } - String _languageLabel(String code) { for (final option in supportedTranslationLanguages) { if (option.code == code) { diff --git a/pubspec.yaml b/pubspec.yaml index 7b43dded..72cca35f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -72,6 +72,7 @@ dependencies: ml_algo: ^16.0.0 ml_dataframe: ^1.0.0 llamadart: '>=0.6.8 <0.7.0' + flutter_langdetect: ^0.0.1 hooks: user_defines: From 5f9259e41f457cdc6c0bbb9108b1da23683a8ad8 Mon Sep 17 00:00:00 2001 From: Stempit Date: Wed, 13 May 2026 01:33:05 +0300 Subject: [PATCH 07/36] Add Russian regional presets --- lib/models/radio_settings.dart | 280 +++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) diff --git a/lib/models/radio_settings.dart b/lib/models/radio_settings.dart index 099d9201..81a65cd1 100644 --- a/lib/models/radio_settings.dart +++ b/lib/models/radio_settings.dart @@ -181,6 +181,286 @@ class RadioSettings { txPowerDbm: 14, ), ), + ( + 'Russia Biysk (BSK)', + RadioSettings( + frequencyMHz: 869.000, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Cherepovets (CEE)', + RadioSettings( + frequencyMHz: 868.570, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Chelyabinsk (CEK)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Nizhny Novgorod (GOJ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Saratov (GSV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia St. Petersburg (LED)', + RadioSettings( + frequencyMHz: 868.856, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Izhevsk (IJK)', + RadioSettings( + frequencyMHz: 868.732, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Irkutsk (IKT)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ivanovo (IWA)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Khabarovsk (KHV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tver (KLD)', + RadioSettings( + frequencyMHz: 869.169, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kaluga (KLF)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Samara (KUF)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kirov (KVX)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kazan (KZN)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Lipetsk (LPK)', + RadioSettings( + frequencyMHz: 868.950, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Moscow (MOW)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Novosibirsk (OVB)', + RadioSettings( + frequencyMHz: 869.000, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Rostov-on-Don (ROV)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ryazan (RZN)', + RadioSettings( + frequencyMHz: 868.880, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Yekaterinburg (SVX)', + RadioSettings( + frequencyMHz: 869.046, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tambov (TBW)', + RadioSettings( + frequencyMHz: 868.950, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf10, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tula (TYA)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ufa (UFA)', + RadioSettings( + frequencyMHz: 868.732, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Volgograd (VOG)', + RadioSettings( + frequencyMHz: 869.525, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Voronezh (VOZ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Lugansk (VSG)', + RadioSettings( + frequencyMHz: 868.825, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Artyom (VVO)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), ( 'Switzerland', RadioSettings( From 352a6c427eb3ffff3c8dbfafaafe8b12df6628ab Mon Sep 17 00:00:00 2001 From: Stempit <3481898+Stempit@users.noreply.github.com> Date: Wed, 13 May 2026 01:49:51 +0300 Subject: [PATCH 08/36] Reorder alphabetically --- lib/models/radio_settings.dart | 150 +++++++++++++++------------------ 1 file changed, 70 insertions(+), 80 deletions(-) diff --git a/lib/models/radio_settings.dart b/lib/models/radio_settings.dart index 81a65cd1..e74cf209 100644 --- a/lib/models/radio_settings.dart +++ b/lib/models/radio_settings.dart @@ -181,6 +181,16 @@ class RadioSettings { txPowerDbm: 14, ), ), + ( + 'Russia Artyom (VVO)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), ( 'Russia Biysk (BSK)', RadioSettings( @@ -191,16 +201,6 @@ class RadioSettings { txPowerDbm: 20, ), ), - ( - 'Russia Cherepovets (CEE)', - RadioSettings( - frequencyMHz: 868.570, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf7, - codingRate: LoRaCodingRate.cr4_8, - txPowerDbm: 20, - ), - ), ( 'Russia Chelyabinsk (CEK)', RadioSettings( @@ -212,41 +212,11 @@ class RadioSettings { ), ), ( - 'Russia Nizhny Novgorod (GOJ)', + 'Russia Cherepovets (CEE)', RadioSettings( - frequencyMHz: 868.731, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf8, - codingRate: LoRaCodingRate.cr4_6, - txPowerDbm: 20, - ), - ), - ( - 'Russia Saratov (GSV)', - RadioSettings( - frequencyMHz: 864.281, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf8, - codingRate: LoRaCodingRate.cr4_7, - txPowerDbm: 20, - ), - ), - ( - 'Russia St. Petersburg (LED)', - RadioSettings( - frequencyMHz: 868.856, + frequencyMHz: 868.570, bandwidth: LoRaBandwidth.bw62_5, spreadingFactor: LoRaSpreadingFactor.sf7, - codingRate: LoRaCodingRate.cr4_7, - txPowerDbm: 20, - ), - ), - ( - 'Russia Izhevsk (IJK)', - RadioSettings( - frequencyMHz: 868.732, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf8, codingRate: LoRaCodingRate.cr4_8, txPowerDbm: 20, ), @@ -272,19 +242,9 @@ class RadioSettings { ), ), ( - 'Russia Khabarovsk (KHV)', + 'Russia Izhevsk (IJK)', RadioSettings( - frequencyMHz: 864.281, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf8, - codingRate: LoRaCodingRate.cr4_6, - txPowerDbm: 20, - ), - ), - ( - 'Russia Tver (KLD)', - RadioSettings( - frequencyMHz: 869.169, + frequencyMHz: 868.732, bandwidth: LoRaBandwidth.bw62_5, spreadingFactor: LoRaSpreadingFactor.sf8, codingRate: LoRaCodingRate.cr4_8, @@ -302,12 +262,22 @@ class RadioSettings { ), ), ( - 'Russia Samara (KUF)', + 'Russia Kazan (KZN)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Khabarovsk (KHV)', RadioSettings( frequencyMHz: 864.281, bandwidth: LoRaBandwidth.bw62_5, spreadingFactor: LoRaSpreadingFactor.sf8, - codingRate: LoRaCodingRate.cr4_7, + codingRate: LoRaCodingRate.cr4_6, txPowerDbm: 20, ), ), @@ -321,16 +291,6 @@ class RadioSettings { txPowerDbm: 20, ), ), - ( - 'Russia Kazan (KZN)', - RadioSettings( - frequencyMHz: 868.731, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf8, - codingRate: LoRaCodingRate.cr4_6, - txPowerDbm: 20, - ), - ), ( 'Russia Lipetsk (LPK)', RadioSettings( @@ -351,6 +311,16 @@ class RadioSettings { txPowerDbm: 20, ), ), + ( + 'Russia Nizhny Novgorod (GOJ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), ( 'Russia Novosibirsk (OVB)', RadioSettings( @@ -382,9 +352,29 @@ class RadioSettings { ), ), ( - 'Russia Yekaterinburg (SVX)', + 'Russia Samara (KUF)', RadioSettings( - frequencyMHz: 869.046, + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Saratov (GSV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia St. Petersburg (LED)', + RadioSettings( + frequencyMHz: 868.856, bandwidth: LoRaBandwidth.bw62_5, spreadingFactor: LoRaSpreadingFactor.sf7, codingRate: LoRaCodingRate.cr4_7, @@ -411,6 +401,16 @@ class RadioSettings { txPowerDbm: 20, ), ), + ( + 'Russia Tver (KLD)', + RadioSettings( + frequencyMHz: 869.169, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), ( 'Russia Ufa (UFA)', RadioSettings( @@ -442,25 +442,15 @@ class RadioSettings { ), ), ( - 'Russia Lugansk (VSG)', + 'Russia Yekaterinburg (SVX)', RadioSettings( - frequencyMHz: 868.825, + frequencyMHz: 869.046, bandwidth: LoRaBandwidth.bw62_5, spreadingFactor: LoRaSpreadingFactor.sf7, codingRate: LoRaCodingRate.cr4_7, txPowerDbm: 20, ), ), - ( - 'Russia Artyom (VVO)', - RadioSettings( - frequencyMHz: 864.281, - bandwidth: LoRaBandwidth.bw62_5, - spreadingFactor: LoRaSpreadingFactor.sf8, - codingRate: LoRaCodingRate.cr4_6, - txPowerDbm: 20, - ), - ), ( 'Switzerland', RadioSettings( From f941f0dbfa937417f624d0a51c359f5acee9bebb Mon Sep 17 00:00:00 2001 From: ZIER Date: Wed, 13 May 2026 12:08:41 +0200 Subject: [PATCH 09/36] avoid double translation and strip replyInfo from translated text. --- lib/connector/meshcore_connector.dart | 114 ++++++++++++-------------- 1 file changed, 51 insertions(+), 63 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index ba18d3b1..1f422b88 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -1072,7 +1072,7 @@ class MeshCoreConnector extends ChangeNotifier { } } - Future _translateIncomingContactMessage( + Future _translateIncomingContactMessage( String contactKeyHex, Message message, ) async { @@ -1084,7 +1084,7 @@ class MeshCoreConnector extends ChangeNotifier { isCli: message.isCli, isOutgoing: message.isOutgoing, )) { - return; + return null; } final targetLanguageCode = service.resolvedIncomingLanguageCode( _appSettingsService?.settings.languageOverride, @@ -1094,7 +1094,7 @@ class MeshCoreConnector extends ChangeNotifier { targetLanguageCode: targetLanguageCode, ); if (result == null) { - return; + return null; } final translated = result.status == MessageTranslationStatus.completed ? result.translatedText @@ -1109,12 +1109,14 @@ class MeshCoreConnector extends ChangeNotifier { translationModelId: result.modelId, ), ); + return result; } catch (error) { appLogger.warn('Translation failed for contact message: $error'); + return null; } } - Future _translateIncomingChannelMessage( + Future _translateIncomingChannelMessage( int channelIndex, ChannelMessage message, ) async { @@ -1126,7 +1128,7 @@ class MeshCoreConnector extends ChangeNotifier { isCli: false, isOutgoing: message.isOutgoing, )) { - return; + return null; } final targetLanguageCode = service.resolvedIncomingLanguageCode( _appSettingsService?.settings.languageOverride, @@ -1136,11 +1138,16 @@ class MeshCoreConnector extends ChangeNotifier { targetLanguageCode: targetLanguageCode, ); if (result == null) { - return; + return null; } - final translated = result.status == MessageTranslationStatus.completed + var translated = result.status == MessageTranslationStatus.completed ? result.translatedText : null; + // Strip replyInfo prefix from translated text to match stored message.text + if (translated != null) { + final regex = RegExp(r'^@\[[^\]]+\]\s+', dotAll: true); + translated = translated.replaceFirst(regex, ''); + } _updateStoredChannelMessage( channelIndex, message.messageId, @@ -1151,8 +1158,10 @@ class MeshCoreConnector extends ChangeNotifier { translationModelId: result.modelId, ), ); + return result; } catch (error) { appLogger.warn('Translation failed for channel message: $error'); + return null; } } @@ -4394,9 +4403,11 @@ class MeshCoreConnector extends ChangeNotifier { } } _addMessage(message.senderKeyHex, message); + TranslationResult? translationResult; if (!message.isOutgoing) { - unawaited( - _translateIncomingContactMessage(message.senderKeyHex, message), + translationResult = await _translateIncomingContactMessage( + message.senderKeyHex, + message, ); } _maybeIncrementContactUnread(message); @@ -4412,10 +4423,9 @@ class MeshCoreConnector extends ChangeNotifier { final msg = message; if (contact?.type == advTypeChat) { unawaited(() async { - final resolvedText = await _maybeTranslateForNotification( - msg.text, - isCli: msg.isCli, - ); + final resolvedText = translationResult != null + ? translationResult.translatedText.trim() + : msg.text; await _notificationService.showMessageNotification( contactName: contact?.name ?? 'Unknown', message: resolvedText, @@ -4429,10 +4439,9 @@ class MeshCoreConnector extends ChangeNotifier { ? msg.text.substring(4) : msg.text; unawaited(() async { - final resolvedText = await _maybeTranslateForNotification( - bodyText, - isCli: msg.isCli, - ); + final resolvedText = translationResult != null + ? translationResult.translatedText.trim() + : bodyText; await _notificationService.showMessageNotification( contactName: contact?.name ?? 'Unknown Room', message: resolvedText, @@ -4708,6 +4717,7 @@ class MeshCoreConnector extends ChangeNotifier { void _maybeNotifyChannelMessage( ChannelMessage message, { String? channelName, + TranslationResult? translationResult, }) { if (message.isOutgoing || _appSettingsService == null) return; final channelIndex = message.channelIndex; @@ -4721,12 +4731,11 @@ class MeshCoreConnector extends ChangeNotifier { final label = channelName ?? _channelDisplayName(channelIndex); if (_appSettingsService!.isChannelMuted(label)) return; - // Translate channel notification text if enabled + // Reuse translation result from earlier translation, or use original text + final resolvedText = translationResult != null + ? translationResult.translatedText.trim() + : message.text; unawaited(() async { - final resolvedText = await _maybeTranslateForNotification( - message.text, - isCli: false, - ); await _notificationService.showChannelMessageNotification( channelName: label, senderName: message.senderName, @@ -4737,41 +4746,7 @@ class MeshCoreConnector extends ChangeNotifier { }()); } - Future _maybeTranslateForNotification( - String text, { - required bool isCli, - }) async { - final service = _translationService; - if (service == null) return text; - try { - if (!service.shouldTranslateIncoming( - text: text, - isCli: isCli, - isOutgoing: false, - )) { - return text; - } - final targetLanguageCode = service.resolvedIncomingLanguageCode( - _appSettingsService?.settings.languageOverride, - ); - if (targetLanguageCode == null || targetLanguageCode.isEmpty) { - return text; - } - final result = await service.translateIncomingText( - text: text, - targetLanguageCode: targetLanguageCode, - ); - final translated = result?.translatedText.trim(); - if (translated != null && translated.isNotEmpty) { - return translated; - } - } catch (_) { - // Fallback to original text on any error - } - return text; - } - - void _handleIncomingChannelMessage(Uint8List frame) { + void _handleIncomingChannelMessage(Uint8List frame) async { final parsed = ChannelMessage.fromFrame(frame); if (parsed != null && parsed.channelIndex != null) { if (_shouldDropSelfChannelMessage(parsed.senderName, parsed.pathBytes)) { @@ -4790,15 +4765,20 @@ class MeshCoreConnector extends ChangeNotifier { pathBytes: message.pathBytes, ); final isNew = _addChannelMessage(message.channelIndex!, message); + TranslationResult? translationResult; if (isNew && !message.isOutgoing) { - unawaited( - _translateIncomingChannelMessage(message.channelIndex!, message), + translationResult = await _translateIncomingChannelMessage( + message.channelIndex!, + message, ); } _maybeIncrementChannelUnread(message, isNew: isNew); notifyListeners(); if (isNew) { - _maybeNotifyChannelMessage(message); + _maybeNotifyChannelMessage( + message, + translationResult: translationResult, + ); } _handleQueuedMessageReceived(); } else if (_isSyncingQueuedMessages) { @@ -4806,7 +4786,7 @@ class MeshCoreConnector extends ChangeNotifier { } } - void _handleLogRxData(Uint8List frame) { + void _handleLogRxData(Uint8List frame) async { if (frame.length < 4) return; try { final reader = BufferReader(frame); @@ -4874,8 +4854,12 @@ class MeshCoreConnector extends ChangeNotifier { pathBytes: message.pathBytes, ); final isNew = _addChannelMessage(channel.index, message); + TranslationResult? translationResult; if (isNew && !message.isOutgoing) { - unawaited(_translateIncomingChannelMessage(channel.index, message)); + translationResult = await _translateIncomingChannelMessage( + channel.index, + message, + ); } _maybeIncrementChannelUnread(message, isNew: isNew); notifyListeners(); @@ -4883,7 +4867,11 @@ class MeshCoreConnector extends ChangeNotifier { final label = channel.name.isEmpty ? 'Channel ${channel.index}' : channel.name; - _maybeNotifyChannelMessage(message, channelName: label); + _maybeNotifyChannelMessage( + message, + channelName: label, + translationResult: translationResult, + ); } return; } catch (e) { From 1fbe1823cbb60953a74a37253ecee797db8f2c1c Mon Sep 17 00:00:00 2001 From: ericz Date: Wed, 13 May 2026 18:06:26 +0200 Subject: [PATCH 10/36] only take translated result if status==completed --- lib/connector/meshcore_connector.dart | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 1f422b88..a3dc4650 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -4423,9 +4423,13 @@ class MeshCoreConnector extends ChangeNotifier { final msg = message; if (contact?.type == advTypeChat) { unawaited(() async { - final resolvedText = translationResult != null + final resolvedText = + (translationResult != null && + translationResult.status == + MessageTranslationStatus.completed && + translationResult.translatedText.trim().isNotEmpty) ? translationResult.translatedText.trim() - : msg.text; + : msg.text.trim(); await _notificationService.showMessageNotification( contactName: contact?.name ?? 'Unknown', message: resolvedText, @@ -4439,9 +4443,13 @@ class MeshCoreConnector extends ChangeNotifier { ? msg.text.substring(4) : msg.text; unawaited(() async { - final resolvedText = translationResult != null + final resolvedText = + (translationResult != null && + translationResult.status == + MessageTranslationStatus.completed && + translationResult.translatedText.trim().isNotEmpty) ? translationResult.translatedText.trim() - : bodyText; + : bodyText.trim(); await _notificationService.showMessageNotification( contactName: contact?.name ?? 'Unknown Room', message: resolvedText, @@ -4731,10 +4739,13 @@ class MeshCoreConnector extends ChangeNotifier { final label = channelName ?? _channelDisplayName(channelIndex); if (_appSettingsService!.isChannelMuted(label)) return; - // Reuse translation result from earlier translation, or use original text - final resolvedText = translationResult != null + // Reuse translation result only if completed and non-empty; else use original text + final resolvedText = + (translationResult != null && + translationResult.status == MessageTranslationStatus.completed && + translationResult.translatedText.trim().isNotEmpty) ? translationResult.translatedText.trim() - : message.text; + : message.text.trim(); unawaited(() async { await _notificationService.showChannelMessageNotification( channelName: label, From bc5f2993501d9a5213b8cd813ceed81d3a451422 Mon Sep 17 00:00:00 2001 From: ericz Date: Sun, 17 May 2026 10:47:50 +0200 Subject: [PATCH 11/36] try fix codex sync problem --- lib/connector/meshcore_connector.dart | 109 +++++++++++++------------- 1 file changed, 53 insertions(+), 56 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index a3dc4650..982f7e75 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -4338,6 +4338,12 @@ class MeshCoreConnector extends ChangeNotifier { void _handleIncomingMessage(Uint8List frame) async { if (_selfPublicKey == null) return; + // If we're syncing the queued messages, advance the queue immediately + // before any potentially long async work (like translation/notifications). + if (_isSyncingQueuedMessages) { + _handleQueuedMessageReceived(); + } + var message = _parseContactMessage(frame); // If message parsing failed due to unknown contact, refresh contacts and retry @@ -4403,26 +4409,23 @@ class MeshCoreConnector extends ChangeNotifier { } } _addMessage(message.senderKeyHex, message); - TranslationResult? translationResult; - if (!message.isOutgoing) { - translationResult = await _translateIncomingContactMessage( - message.senderKeyHex, - message, - ); - } _maybeIncrementContactUnread(message); notifyListeners(); - // Show notification for new incoming message + // Show notification for new incoming message (run async with translation) if (!message.isOutgoing && !message.isCli && _appSettingsService != null) { final settings = _appSettingsService!.settings; if (settings.notificationsEnabled && settings.notifyOnNewMessage) { - // Capture non-null local for async closure type promotion - final msg = message; - if (contact?.type == advTypeChat) { - unawaited(() async { + final msg = message; // capture for closure + final c = contact; // capture contact reference + unawaited(() async { + final translationResult = await _translateIncomingContactMessage( + msg.senderKeyHex, + msg, + ); + if (c?.type == advTypeChat) { final resolvedText = (translationResult != null && translationResult.status == @@ -4431,18 +4434,16 @@ class MeshCoreConnector extends ChangeNotifier { ? translationResult.translatedText.trim() : msg.text.trim(); await _notificationService.showMessageNotification( - contactName: contact?.name ?? 'Unknown', + contactName: c?.name ?? 'Unknown', message: resolvedText, contactId: msg.senderKeyHex, badgeCount: getTotalUnreadCount(), ); - }()); - } else if (contact?.type == advTypeRoom) { - // Room server messages include a 4-char prefix; strip it for notifications - final bodyText = msg.text.length > 4 - ? msg.text.substring(4) - : msg.text; - unawaited(() async { + } else if (c?.type == advTypeRoom) { + // Room server messages include a 4-char prefix; strip it for notifications + final bodyText = msg.text.length > 4 + ? msg.text.substring(4) + : msg.text; final resolvedText = (translationResult != null && translationResult.status == @@ -4451,18 +4452,15 @@ class MeshCoreConnector extends ChangeNotifier { ? translationResult.translatedText.trim() : bodyText.trim(); await _notificationService.showMessageNotification( - contactName: contact?.name ?? 'Unknown Room', + contactName: c?.name ?? 'Unknown Room', message: resolvedText, contactId: msg.senderKeyHex, badgeCount: getTotalUnreadCount(), ); - }()); - } + } + }()); } } - _handleQueuedMessageReceived(); - } else if (_isSyncingQueuedMessages) { - _handleQueuedMessageReceived(); } } @@ -4758,6 +4756,11 @@ class MeshCoreConnector extends ChangeNotifier { } void _handleIncomingChannelMessage(Uint8List frame) async { + // If we're syncing the queued messages, advance the queue immediately + // before any potentially long async work (like translation/notifications). + if (_isSyncingQueuedMessages) { + _handleQueuedMessageReceived(); + } final parsed = ChannelMessage.fromFrame(frame); if (parsed != null && parsed.channelIndex != null) { if (_shouldDropSelfChannelMessage(parsed.senderName, parsed.pathBytes)) { @@ -4776,24 +4779,18 @@ class MeshCoreConnector extends ChangeNotifier { pathBytes: message.pathBytes, ); final isNew = _addChannelMessage(message.channelIndex!, message); - TranslationResult? translationResult; - if (isNew && !message.isOutgoing) { - translationResult = await _translateIncomingChannelMessage( - message.channelIndex!, - message, - ); - } _maybeIncrementChannelUnread(message, isNew: isNew); notifyListeners(); - if (isNew) { - _maybeNotifyChannelMessage( - message, - translationResult: translationResult, - ); + if (isNew && !message.isOutgoing) { + final msg = message; // capture for closure + unawaited(() async { + final translationResult = await _translateIncomingChannelMessage( + msg.channelIndex!, + msg, + ); + _maybeNotifyChannelMessage(msg, translationResult: translationResult); + }()); } - _handleQueuedMessageReceived(); - } else if (_isSyncingQueuedMessages) { - _handleQueuedMessageReceived(); } } @@ -4865,24 +4862,24 @@ class MeshCoreConnector extends ChangeNotifier { pathBytes: message.pathBytes, ); final isNew = _addChannelMessage(channel.index, message); - TranslationResult? translationResult; - if (isNew && !message.isOutgoing) { - translationResult = await _translateIncomingChannelMessage( - channel.index, - message, - ); - } _maybeIncrementChannelUnread(message, isNew: isNew); notifyListeners(); if (isNew) { - final label = channel.name.isEmpty - ? 'Channel ${channel.index}' - : channel.name; - _maybeNotifyChannelMessage( - message, - channelName: label, - translationResult: translationResult, - ); + // Run translation + notification asynchronously to avoid blocking + unawaited(() async { + final translationResult = await _translateIncomingChannelMessage( + channel.index, + message, + ); + final label = channel.name.isEmpty + ? 'Channel ${channel.index}' + : channel.name; + _maybeNotifyChannelMessage( + message, + channelName: label, + translationResult: translationResult, + ); + }()); } return; } catch (e) { From 72448f67d0f6210ef04536ef869a39938e0744be Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Sun, 17 May 2026 13:20:49 +0300 Subject: [PATCH 12/36] Room-server: fixed first message letters trim --- lib/connector/meshcore_connector.dart | 28 +++++++++++++++------------ lib/screens/chat_screen.dart | 12 +++++------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 9a316897..7cbc8ff0 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -4462,9 +4462,7 @@ class MeshCoreConnector extends ChangeNotifier { } else if (contact?.type == advTypeRoom) { _notificationService.showMessageNotification( contactName: contact?.name ?? 'Unknown Room', - message: message.text.length > 4 - ? message.text.substring(4) - : message.text, + message: message.text, contactId: message.senderKeyHex, badgeCount: getTotalUnreadCount(), ); @@ -4511,16 +4509,24 @@ class MeshCoreConnector extends ChangeNotifier { timestampRaw * 1000, ); - if (txtType == 2) { - reader.skipBytes(4); // Skip extra 4 bytes for signed/plain variants + final flags = txtType; + final shiftedType = flags >> 2; + final rawType = flags; + final isSigned = shiftedType == txtTypeSigned || rawType == txtTypeSigned; + final Uint8List? roomAuthorPrefix; + if (isSigned) { + // Room-server pushed posts use signed/plain contact messages where this + // 4-byte "signature" field is actually the original author's pubkey + // prefix. Keep it as metadata; the text starts after these bytes. + roomAuthorPrefix = reader.readBytes(4); + } else { + roomAuthorPrefix = null; } final msgText = reader.readCString(); - final flags = txtType; - final shiftedType = flags >> 2; - final rawType = flags; - final isPlain = shiftedType == txtTypePlain || rawType == txtTypePlain; + final isPlain = + shiftedType == txtTypePlain || rawType == txtTypePlain || isSigned; final isCli = shiftedType == txtTypeCliData || rawType == txtTypeCliData; if (!isPlain && !isCli) { appLogger.warn( @@ -4557,9 +4563,7 @@ class MeshCoreConnector extends ChangeNotifier { status: MessageStatus.delivered, pathLength: pathLength == 0xFF ? 0 : pathLength, pathBytes: Uint8List(0), - fourByteRoomContactKey: msgText.length >= 4 - ? Uint8List.fromList(msgText.substring(0, 4).codeUnits) - : null, + fourByteRoomContactKey: roomAuthorPrefix, ); } catch (e) { appLogger.warn('Error parsing contact direct message: $e'); diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 8d3bc66c..1548b44e 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -485,6 +485,8 @@ class _ChatScreenState extends State { final message = reversedMessages[messageIndex]; String fourByteHex = ''; if (contact.type == advTypeRoom) { + // Room-server messages carry the original author's 4-byte prefix + // separately from message.text; use it only for resolving the name. contact = _resolveContactFrom4Bytes( connector, message.fourByteRoomContactKey.isEmpty @@ -509,7 +511,6 @@ class _ChatScreenState extends State { ? "${contact.name} [$fourByteHex]" : contact.name, sourceId: widget.contact.publicKeyHex, - isRoomServer: resolvedContact.type == advTypeRoom, textScale: textScale, onTap: () => _openMessagePath(message, contact), onLongPress: () => _showMessageActions(message, contact), @@ -1721,7 +1722,6 @@ class _ChatScreenState extends State { class _MessageBubble extends StatelessWidget { final Message message; final String senderName; - final bool isRoomServer; final VoidCallback? onTap; final VoidCallback? onLongPress; final void Function(Message message, String emoji)? onRetryReaction; @@ -1732,7 +1732,6 @@ class _MessageBubble extends StatelessWidget { required this.message, required this.senderName, required this.sourceId, - required this.isRoomServer, required this.textScale, this.onTap, this.onLongPress, @@ -1758,10 +1757,9 @@ class _MessageBubble extends StatelessWidget { : (isOutgoing ? colorScheme.onPrimary : colorScheme.onSurface); final metaColor = textColor.withValues(alpha: 0.7); const bodyFontSize = 14.0; - String messageText = message.text; - if (isRoomServer && !isOutgoing) { - messageText = message.text.substring(4.clamp(0, message.text.length)); - } + // Do not strip room-server author bytes here: the parser stores them in + // fourByteRoomContactKey, so message.text is safe to render as-is. + final messageText = message.text; final translatedDisplayText = message.translatedText != null && message.translatedText!.trim().isNotEmpty From c4b3971bdd9950a096207775217c6a8b86172909 Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Tue, 19 May 2026 19:17:13 +0300 Subject: [PATCH 13/36] Squashed commit of the following: commit 83ffe44025206945ca75437c83f7da85e493609a Author: HDDen <62592944+HDDen@users.noreply.github.com> Date: Tue May 19 19:16:48 2026 +0300 fix Flutter SDK update --- lib/screens/channels_screen.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 8b05b8ce..d305a6f3 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -273,8 +273,9 @@ class _ChannelsScreenState extends State ), buildDefaultDragHandles: false, itemCount: filteredChannels.length, - onReorder: (oldIndex, newIndex) { - if (newIndex > oldIndex) newIndex -= 1; + onReorderItem: (oldIndex, newIndex) { + // onReorderItem already adjusts newIndex after the + // removed item, unlike the deprecated onReorder. final reordered = List.from( filteredChannels, ); From 425229fce8b15dc8809a86b74e1cf5fdd1d0459d Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Tue, 19 May 2026 20:37:34 +0300 Subject: [PATCH 14/36] Telemetry request: map and autorefresh --- lib/l10n/app_bg.arb | 4 + lib/l10n/app_de.arb | 4 + lib/l10n/app_en.arb | 4 + lib/l10n/app_es.arb | 4 + lib/l10n/app_fr.arb | 4 + lib/l10n/app_hu.arb | 4 + lib/l10n/app_it.arb | 4 + lib/l10n/app_ja.arb | 4 + lib/l10n/app_ko.arb | 4 + lib/l10n/app_localizations.dart | 24 ++ lib/l10n/app_localizations_bg.dart | 12 + lib/l10n/app_localizations_de.dart | 12 + lib/l10n/app_localizations_en.dart | 12 + lib/l10n/app_localizations_es.dart | 12 + lib/l10n/app_localizations_fr.dart | 12 + lib/l10n/app_localizations_hu.dart | 12 + lib/l10n/app_localizations_it.dart | 12 + lib/l10n/app_localizations_ja.dart | 12 + lib/l10n/app_localizations_ko.dart | 12 + lib/l10n/app_localizations_nl.dart | 12 + lib/l10n/app_localizations_pl.dart | 12 + lib/l10n/app_localizations_pt.dart | 12 + lib/l10n/app_localizations_ru.dart | 12 + lib/l10n/app_localizations_sk.dart | 12 + lib/l10n/app_localizations_sl.dart | 12 + lib/l10n/app_localizations_sv.dart | 12 + lib/l10n/app_localizations_uk.dart | 12 + lib/l10n/app_localizations_zh.dart | 12 + lib/l10n/app_nl.arb | 4 + lib/l10n/app_pl.arb | 4 + lib/l10n/app_pt.arb | 4 + lib/l10n/app_ru.arb | 4 + lib/l10n/app_sk.arb | 4 + lib/l10n/app_sl.arb | 4 + lib/l10n/app_sv.arb | 4 + lib/l10n/app_uk.arb | 4 + lib/l10n/app_zh.arb | 4 + lib/screens/telemetry_screen.dart | 415 ++++++++++++++++++++++- lib/widgets/telemetry_location_map.dart | 422 ++++++++++++++++++++++++ 39 files changed, 1131 insertions(+), 18 deletions(-) create mode 100644 lib/widgets/telemetry_location_map.dart diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index 45536cf6..183c07a9 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -33,6 +33,8 @@ "common_remove": "Изтрий", "common_enable": "Активирай", "common_disable": "Деактивирай", + "common_autoRefresh": "Автоматично обновяване", + "common_interval": "Интервал", "common_reboot": "Рестартирай", "common_loading": "Зареждане...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Брой заявки", + "telemetry_error": "Неуспешно получаване на данни", "telemetry_noData": "Няма налични данни за телеметрията.", "telemetry_channelTitle": "Канал {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 7f491d4f..80a030af 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -33,6 +33,8 @@ "common_remove": "Löschen", "common_enable": "Aktivieren", "common_disable": "Deaktivieren", + "common_autoRefresh": "Automatische Aktualisierung", + "common_interval": "Intervall", "common_reboot": "Neustart", "common_loading": "Laden...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Anzahl der Anfragen", + "telemetry_error": "Daten konnten nicht abgerufen werden", "telemetry_noData": "Keine Telemetriedaten verfügbar.", "telemetry_channelTitle": "Kanal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 456fab56..bc7bec99 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -47,6 +47,8 @@ } } }, + "common_autoRefresh": "Autorefresh", + "common_interval": "Interval", "scanner_title": "MeshCore Open", "connectionChoiceUsbLabel": "USB", "connectionChoiceBluetoothLabel": "Bluetooth", @@ -1661,6 +1663,8 @@ } } }, + "telemetry_autoFetchQuantity": "Requests quantity", + "telemetry_error": "Unable to retrieve data", "neighbors_receivedData": "Received Neighbors Data", "neighbors_requestTimedOut": "Neighbors request timed out.", "neighbors_errorLoading": "Error loading neighbors: {error}", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index d4cf27da..89574799 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -33,6 +33,8 @@ "common_remove": "Eliminar", "common_enable": "Activar", "common_disable": "Desactivar", + "common_autoRefresh": "Actualización automática", + "common_interval": "Intervalo", "common_reboot": "Reiniciar", "common_loading": "Cargando...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Número de solicitudes", + "telemetry_error": "No se pudieron obtener los datos", "telemetry_noData": "No hay datos de telemetría disponibles.", "telemetry_channelTitle": "Canal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 7817c20d..e5c5091a 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -33,6 +33,8 @@ "common_remove": "Supprimer", "common_enable": "Activer", "common_disable": "Désactiver", + "common_autoRefresh": "Actualisation automatique", + "common_interval": "Intervalle", "common_reboot": "Redémarrer", "common_loading": "Chargement...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Nombre de requêtes", + "telemetry_error": "Impossible de récupérer les données", "telemetry_noData": "Aucune donnée de télémétrie disponible.", "telemetry_channelTitle": "Canal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index 97426183..38618779 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -27,6 +27,8 @@ "common_remove": "Eltávolít", "common_enable": "Engedélyezés", "common_disable": "Leteteszt", + "common_autoRefresh": "Automatikus frissítés", + "common_interval": "Intervallum", "common_reboot": "Újraindítás", "common_loading": "Betöltés...", "common_notAvailable": "—", @@ -1466,6 +1468,8 @@ } } }, + "telemetry_autoFetchQuantity": "Kérések száma", + "telemetry_error": "Nem sikerült lekérni az adatokat", "telemetry_noData": "Nincsenek elérhető telemetriadatok.", "telemetry_channelTitle": "{channel} csatorna", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 664bceef..2ee686ec 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -33,6 +33,8 @@ "common_remove": "Elimina", "common_enable": "Abilita", "common_disable": "Disattivare", + "common_autoRefresh": "Aggiornamento automatico", + "common_interval": "Intervallo", "common_reboot": "Riavvia", "common_loading": "Caricamento...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Numero di richieste", + "telemetry_error": "Impossibile recuperare i dati", "telemetry_noData": "Nessun dato di telemetria disponibile.", "telemetry_channelTitle": "Canale {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 9d2cef21..92f2ed65 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -27,6 +27,8 @@ "common_remove": "削除", "common_enable": "有効化する", "common_disable": "無効化する", + "common_autoRefresh": "自動更新", + "common_interval": "間隔", "common_reboot": "再起動", "common_loading": "読み込み中...", "common_notAvailable": "—", @@ -1466,6 +1468,8 @@ } } }, + "telemetry_autoFetchQuantity": "リクエスト数", + "telemetry_error": "データを取得できません", "telemetry_noData": "テレメトリデータは利用できません。", "telemetry_channelTitle": "チャンネル {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index d778429b..ff27b6ad 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -27,6 +27,8 @@ "common_remove": "제거", "common_enable": "활성화", "common_disable": "비활성화", + "common_autoRefresh": "자동 새로고침", + "common_interval": "간격", "common_reboot": "재부팅", "common_loading": "로딩 중...", "common_notAvailable": "—", @@ -1466,6 +1468,8 @@ } } }, + "telemetry_autoFetchQuantity": "요청 수", + "telemetry_error": "데이터를 가져올 수 없습니다", "telemetry_noData": "텔레메트리 데이터는 제공되지 않습니다.", "telemetry_channelTitle": "채널 {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 159d755c..949dd518 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -328,6 +328,18 @@ abstract class AppLocalizations { /// **'{percent}%'** String common_percentValue(int percent); + /// No description provided for @common_autoRefresh. + /// + /// In en, this message translates to: + /// **'Autorefresh'** + String get common_autoRefresh; + + /// No description provided for @common_interval. + /// + /// In en, this message translates to: + /// **'Interval'** + String get common_interval; + /// No description provided for @scanner_title. /// /// In en, this message translates to: @@ -5690,6 +5702,18 @@ abstract class AppLocalizations { /// **'{celsius}°C / {fahrenheit}°F'** String telemetry_temperatureValue(String celsius, String fahrenheit); + /// No description provided for @telemetry_autoFetchQuantity. + /// + /// In en, this message translates to: + /// **'Requests quantity'** + String get telemetry_autoFetchQuantity; + + /// No description provided for @telemetry_error. + /// + /// In en, this message translates to: + /// **'Unable to retrieve data'** + String get telemetry_error; + /// No description provided for @neighbors_receivedData. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 409803b2..89c75f4d 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -111,6 +111,12 @@ class AppLocalizationsBg extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Автоматично обновяване'; + + @override + String get common_interval => 'Интервал'; + @override String get scanner_title => 'MeshCore – Отворена версия'; @@ -3276,6 +3282,12 @@ class AppLocalizationsBg extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Брой заявки'; + + @override + String get telemetry_error => 'Неуспешно получаване на данни'; + @override String get neighbors_receivedData => 'Получени данни за съседи'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 9f06906d..844b6066 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -111,6 +111,12 @@ class AppLocalizationsDe extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatische Aktualisierung'; + + @override + String get common_interval => 'Intervall'; + @override String get scanner_title => 'MeshCore – Open-Version'; @@ -3282,6 +3288,12 @@ class AppLocalizationsDe extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Anzahl der Anfragen'; + + @override + String get telemetry_error => 'Daten konnten nicht abgerufen werden'; + @override String get neighbors_receivedData => 'Empfangene Nachbarsdaten'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 6def06b7..6f9e03c6 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -111,6 +111,12 @@ class AppLocalizationsEn extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Autorefresh'; + + @override + String get common_interval => 'Interval'; + @override String get scanner_title => 'MeshCore Open'; @@ -3213,6 +3219,12 @@ class AppLocalizationsEn extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Requests quantity'; + + @override + String get telemetry_error => 'Unable to retrieve data'; + @override String get neighbors_receivedData => 'Received Neighbors Data'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index bb4f40e8..4c127a23 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -111,6 +111,12 @@ class AppLocalizationsEs extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Actualización automática'; + + @override + String get common_interval => 'Intervalo'; + @override String get scanner_title => 'MeshCore: Versión abierta'; @@ -3270,6 +3276,12 @@ class AppLocalizationsEs extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Número de solicitudes'; + + @override + String get telemetry_error => 'No se pudieron obtener los datos'; + @override String get neighbors_receivedData => 'Recibidas Datos de Vecinos'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 44e40657..b5f1c840 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -111,6 +111,12 @@ class AppLocalizationsFr extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Actualisation automatique'; + + @override + String get common_interval => 'Intervalle'; + @override String get scanner_title => 'MeshCore Open'; @@ -3293,6 +3299,12 @@ class AppLocalizationsFr extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Nombre de requêtes'; + + @override + String get telemetry_error => 'Impossible de récupérer les données'; + @override String get neighbors_receivedData => 'Données des voisins reçues'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 298a6fd6..d4f1b2b7 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -111,6 +111,12 @@ class AppLocalizationsHu extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatikus frissítés'; + + @override + String get common_interval => 'Intervallum'; + @override String get scanner_title => 'MeshCore nyitott'; @@ -3286,6 +3292,12 @@ class AppLocalizationsHu extends AppLocalizations { return '$celsius °C / $fahrenheit °F'; } + @override + String get telemetry_autoFetchQuantity => 'Kérések száma'; + + @override + String get telemetry_error => 'Nem sikerült lekérni az adatokat'; + @override String get neighbors_receivedData => 'Kapott szomszédok adatait'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index e3f7ee58..666d3137 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -111,6 +111,12 @@ class AppLocalizationsIt extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Aggiornamento automatico'; + + @override + String get common_interval => 'Intervallo'; + @override String get scanner_title => 'MeshCore Open'; @@ -3276,6 +3282,12 @@ class AppLocalizationsIt extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Numero di richieste'; + + @override + String get telemetry_error => 'Impossibile recuperare i dati'; + @override String get neighbors_receivedData => 'Ricevute dati vicini'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 263a906e..f2fb24b3 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -111,6 +111,12 @@ class AppLocalizationsJa extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => '自動更新'; + + @override + String get common_interval => '間隔'; + @override String get scanner_title => 'MeshCore オープン'; @@ -3094,6 +3100,12 @@ class AppLocalizationsJa extends AppLocalizations { return '$celsius℃ / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'リクエスト数'; + + @override + String get telemetry_error => 'データを取得できません'; + @override String get neighbors_receivedData => '近隣住民のデータを受信'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index f9c0d760..f35ca675 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -111,6 +111,12 @@ class AppLocalizationsKo extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => '자동 새로고침'; + + @override + String get common_interval => '간격'; + @override String get scanner_title => 'MeshCore 공개'; @@ -3096,6 +3102,12 @@ class AppLocalizationsKo extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => '요청 수'; + + @override + String get telemetry_error => '데이터를 가져올 수 없습니다'; + @override String get neighbors_receivedData => '이웃 정보 수집'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index ad140bf3..6a68bd16 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -111,6 +111,12 @@ class AppLocalizationsNl extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatisch vernieuwen'; + + @override + String get common_interval => 'Tijdsinterval'; + @override String get scanner_title => 'MeshCore Open'; @@ -3256,6 +3262,12 @@ class AppLocalizationsNl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Aantal aanvragen'; + + @override + String get telemetry_error => 'Kan gegevens niet ophalen'; + @override String get neighbors_receivedData => 'Ontvangen Buurdata'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 6c7c3696..aa2c091d 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -111,6 +111,12 @@ class AppLocalizationsPl extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatyczne odświeżanie'; + + @override + String get common_interval => 'Interwał'; + @override String get scanner_title => 'MeshCore – wersja open source'; @@ -3288,6 +3294,12 @@ class AppLocalizationsPl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Liczba żądań'; + + @override + String get telemetry_error => 'Nie udało się pobrać danych'; + @override String get neighbors_receivedData => 'Otrzymano dane sąsiedztwa'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index e6fd49e3..7104c570 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -111,6 +111,12 @@ class AppLocalizationsPt extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Atualização automática'; + + @override + String get common_interval => 'Intervalo'; + @override String get scanner_title => 'MeshCore: Versão aberta'; @@ -3269,6 +3275,12 @@ class AppLocalizationsPt extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Número de solicitações'; + + @override + String get telemetry_error => 'Não foi possível obter os dados'; + @override String get neighbors_receivedData => 'Dados dos Vizinhos Recebidos'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 25452003..adc7f492 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -111,6 +111,12 @@ class AppLocalizationsRu extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Автообновление'; + + @override + String get common_interval => 'Интервал'; + @override String get scanner_title => 'MeshCore Open'; @@ -3277,6 +3283,12 @@ class AppLocalizationsRu extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Количество запросов'; + + @override + String get telemetry_error => 'Не удалось получить данные'; + @override String get neighbors_receivedData => 'Полученные данные о соседях'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 91461385..2ba7d16c 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -111,6 +111,12 @@ class AppLocalizationsSk extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatické obnovenie'; + + @override + String get common_interval => 'Časový interval'; + @override String get scanner_title => 'MeshCore – Verzia pre verejnosť'; @@ -3255,6 +3261,12 @@ class AppLocalizationsSk extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Počet požiadaviek'; + + @override + String get telemetry_error => 'Nepodarilo sa získať údaje'; + @override String get neighbors_receivedData => 'Obdielo dáta suseda'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 48103647..d7a36d54 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -111,6 +111,12 @@ class AppLocalizationsSl extends AppLocalizations { return '$percent %'; } + @override + String get common_autoRefresh => 'Samodejno osveževanje'; + + @override + String get common_interval => 'Časovni interval'; + @override String get scanner_title => 'MeshCore – Odprto'; @@ -3250,6 +3256,12 @@ class AppLocalizationsSl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Število zahtev'; + + @override + String get telemetry_error => 'Podatkov ni bilo mogoče pridobiti'; + @override String get neighbors_receivedData => 'Prejeto podatke o sosedih'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 7453c18f..2dbacd72 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -111,6 +111,12 @@ class AppLocalizationsSv extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Automatisk uppdatering'; + + @override + String get common_interval => 'Intervall'; + @override String get scanner_title => 'MeshCore – Öppen version'; @@ -3231,6 +3237,12 @@ class AppLocalizationsSv extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Antal förfrågningar'; + + @override + String get telemetry_error => 'Det gick inte att hämta data'; + @override String get neighbors_receivedData => 'Mottagna grannars data'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 9c30fd8e..6067b573 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -111,6 +111,12 @@ class AppLocalizationsUk extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => 'Автооновлення'; + + @override + String get common_interval => 'Інтервал'; + @override String get scanner_title => 'MeshCore: Відкритий доступ'; @@ -3274,6 +3280,12 @@ class AppLocalizationsUk extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => 'Кількість запитів'; + + @override + String get telemetry_error => 'Не вдалося отримати дані'; + @override String get neighbors_receivedData => 'Дані сусідів отримано'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index d2304a66..a57f45a7 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -111,6 +111,12 @@ class AppLocalizationsZh extends AppLocalizations { return '$percent%'; } + @override + String get common_autoRefresh => '自动刷新'; + + @override + String get common_interval => '间隔'; + @override String get scanner_title => '连接设备'; @@ -2999,6 +3005,12 @@ class AppLocalizationsZh extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_autoFetchQuantity => '请求次数'; + + @override + String get telemetry_error => '无法获取数据'; + @override String get neighbors_receivedData => '已接收邻居信息'; diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index 7e83215b..151369fe 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -33,6 +33,8 @@ "common_remove": "Verwijderen", "common_enable": "Activeren", "common_disable": "Uitschakelen", + "common_autoRefresh": "Automatisch vernieuwen", + "common_interval": "Tijdsinterval", "common_reboot": "Herstarten", "common_loading": "Laden...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Aantal aanvragen", + "telemetry_error": "Kan gegevens niet ophalen", "telemetry_noData": "Geen telemetriedata beschikbaar.", "telemetry_channelTitle": "Kanaal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 4366e273..524838d2 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -33,6 +33,8 @@ "common_remove": "Usuń", "common_enable": "Włącz", "common_disable": "Wyłącz", + "common_autoRefresh": "Automatyczne odświeżanie", + "common_interval": "Interwał", "common_reboot": "Uruchom ponownie", "common_loading": "Ładowanie...", "common_notAvailable": "—", @@ -1290,6 +1292,8 @@ } } }, + "telemetry_autoFetchQuantity": "Liczba żądań", + "telemetry_error": "Nie udało się pobrać danych", "telemetry_noData": "Brak dostępnych danych telemetrycznych.", "telemetry_channelTitle": "Kanał {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 6b8abbbc..e0f6a0d1 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -33,6 +33,8 @@ "common_remove": "Remover", "common_enable": "Ativar", "common_disable": "Desativar", + "common_autoRefresh": "Atualização automática", + "common_interval": "Intervalo", "common_reboot": "Reiniciar", "common_loading": "Carregando...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Número de solicitações", + "telemetry_error": "Não foi possível obter os dados", "telemetry_noData": "Não estão disponíveis dados de telemetria.", "telemetry_channelTitle": "Canal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 5d5bcfc3..ef5f1c63 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -39,6 +39,8 @@ "common_notAvailable": "—", "common_voltageValue": "{volts} В", "common_percentValue": "{percent}%", + "common_autoRefresh": "Автообновление", + "common_interval": "Интервал", "scanner_title": "MeshCore Open", "scanner_scanning": "Поиск устройств...", "scanner_connecting": "Подключение...", @@ -686,6 +688,8 @@ "telemetry_voltageValue": "{volts}В", "telemetry_currentValue": "{amps}А", "telemetry_temperatureValue": "{celsius}°C / {fahrenheit}°F", + "telemetry_autoFetchQuantity": "Количество запросов", + "telemetry_error": "Не удалось получить данные", "neighbors_receivedData": "Полученные данные о соседях", "neighbors_requestTimedOut": "Время ожидания данных о соседях истекло.", "neighbors_errorLoading": "Ошибка загрузки соседей: {error}", diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index 713c3976..a2b6c2e5 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -33,6 +33,8 @@ "common_remove": "Odstrániť", "common_enable": "Povolit", "common_disable": "Zakázať", + "common_autoRefresh": "Automatické obnovenie", + "common_interval": "Časový interval", "common_reboot": "Restartovať", "common_loading": "Načítavanie...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Počet požiadaviek", + "telemetry_error": "Nepodarilo sa získať údaje", "telemetry_noData": "Nejsú dostupné žiadne údaje z telemetrie.", "telemetry_channelTitle": "Kanál {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index 00930c85..dd61e335 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -33,6 +33,8 @@ "common_remove": "Izbrisati", "common_enable": "Omogoči", "common_disable": "Izklopiti", + "common_autoRefresh": "Samodejno osveževanje", + "common_interval": "Časovni interval", "common_reboot": "Ponoviti", "common_loading": "Naložanje...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Število zahtev", + "telemetry_error": "Podatkov ni bilo mogoče pridobiti", "telemetry_noData": "Niso na voljo podatki o telemetriji.", "telemetry_channelTitle": "Kanal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 00fd3b08..04bdd9cb 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -33,6 +33,8 @@ "common_remove": "Ta bort", "common_enable": "Aktivera", "common_disable": "Inaktivera", + "common_autoRefresh": "Automatisk uppdatering", + "common_interval": "Intervall", "common_reboot": "Start om", "common_loading": "Laddar...", "common_notAvailable": "—", @@ -1280,6 +1282,8 @@ } } }, + "telemetry_autoFetchQuantity": "Antal förfrågningar", + "telemetry_error": "Det gick inte att hämta data", "telemetry_noData": "Inga telemetridata tillgängliga.", "telemetry_channelTitle": "Kanal {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 8330d364..487d4675 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -34,6 +34,8 @@ "common_remove": "Прибрати", "common_enable": "Увімкнути", "common_disable": "Вимкнути", + "common_autoRefresh": "Автооновлення", + "common_interval": "Інтервал", "common_reboot": "Перезавантажити", "common_loading": "Завантаження...", "common_notAvailable": "—", @@ -1291,6 +1293,8 @@ } } }, + "telemetry_autoFetchQuantity": "Кількість запитів", + "telemetry_error": "Не вдалося отримати дані", "telemetry_noData": "Дані телеметрії недоступні.", "telemetry_channelTitle": "Канал {channel}", "@telemetry_channelTitle": { diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 1e289315..8a40bfc0 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -34,6 +34,8 @@ "common_remove": "移除", "common_enable": "启用", "common_disable": "禁用", + "common_autoRefresh": "自动刷新", + "common_interval": "间隔", "common_reboot": "重启", "common_loading": "正在加载...", "common_notAvailable": "—", @@ -1310,6 +1312,8 @@ } } }, + "telemetry_autoFetchQuantity": "请求次数", + "telemetry_error": "无法获取数据", "telemetry_noData": "暂无遥测数据", "telemetry_channelTitle": "频道 {channel}", "@telemetry_channelTitle": { diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index 47593a3f..d28cbcef 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -1,11 +1,13 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../models/path_selection.dart'; import '../models/app_settings.dart'; +import '../storage/prefs_manager.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/app_settings_service.dart'; @@ -15,6 +17,7 @@ import '../widgets/path_management_dialog.dart'; import '../helpers/cayenne_lpp.dart'; import '../utils/battery_utils.dart'; import '../helpers/snack_bar_builder.dart'; +import '../widgets/telemetry_location_map.dart'; class TelemetryScreen extends StatefulWidget { final Contact contact; @@ -26,6 +29,13 @@ class TelemetryScreen extends StatefulWidget { } class _TelemetryScreenState extends State { + static const int _autoRefreshDefaultIntervalSeconds = 20; + static const int _autoRefreshDefaultQuantity = 10; + static const int _autoRefreshMinIntervalSeconds = 10; + static const int _autoRefreshMaxIntervalSeconds = 300; + static const int _autoRefreshMinQuantity = 1; + static const int _autoRefreshMaxQuantity = 10; + int _tagData = 0; bool _isLoading = false; @@ -36,6 +46,17 @@ class _TelemetryScreenState extends State { RepeaterCommandService? _commandService; PathSelection? _pendingStatusSelection; List>? _parsedTelemetry; + final TextEditingController _autoRefreshIntervalController = + TextEditingController(text: '$_autoRefreshDefaultIntervalSeconds'); + final TextEditingController _autoRefreshQuantityController = + TextEditingController(text: '$_autoRefreshDefaultQuantity'); + Timer? _autoRefreshTimer; + bool _isAutoRefreshEnabled = false; + bool _activeTelemetryRequestIsAutoRefresh = false; + bool _autoRefreshLastAttemptFailed = false; + int _autoRefreshCurrentAttempt = 0; + int _autoRefreshTotalAttempts = 0; + int _autoRefreshIntervalSeconds = _autoRefreshDefaultIntervalSeconds; int _tripTime = 0; @@ -62,6 +83,7 @@ class _TelemetryScreenState extends State { super.initState(); final connector = Provider.of(context, listen: false); _commandService = RepeaterCommandService(connector); + _loadAutoRefreshSettings(); _setupMessageListener(); _loadTelemetry(); _hasData = false; @@ -81,17 +103,26 @@ class _TelemetryScreenState extends State { _tagData = reader.readUInt32LE(); _tripTime = reader.readUInt32LE(); _statusTimeout?.cancel(); + final isAutoRefreshRequest = _activeTelemetryRequestIsAutoRefresh; _statusTimeout = Timer(Duration(milliseconds: _tripTime), () { if (!mounted) return; setState(() { _isLoading = false; _isLoaded = false; + if (isAutoRefreshRequest && _isAutoRefreshEnabled) { + _autoRefreshLastAttemptFailed = true; + } }); - showDismissibleSnackBar( - context, - content: Text(context.l10n.telemetry_requestTimeout), - backgroundColor: Colors.red, - ); + if (!isAutoRefreshRequest) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.telemetry_requestTimeout), + backgroundColor: Colors.red, + ); + } + if (isAutoRefreshRequest && _isAutoRefreshEnabled) { + _scheduleNextAutoRefreshAttempt(); + } _recordTelemetryResult(false); }); } @@ -133,15 +164,22 @@ class _TelemetryScreenState extends State { ); } if (!mounted) return; + final isAutoRefreshRequest = _activeTelemetryRequestIsAutoRefresh; setState(() { _parsedTelemetry = parsedTelemetry; + if (isAutoRefreshRequest) { + _autoRefreshLastAttemptFailed = false; + } + _activeTelemetryRequestIsAutoRefresh = false; }); - showDismissibleSnackBar( - context, - content: Text(context.l10n.telemetry_receivedData), - backgroundColor: Colors.green, - ); + if (!isAutoRefreshRequest) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.telemetry_receivedData), + backgroundColor: Colors.green, + ); + } _statusTimeout?.cancel(); if (!mounted) return; setState(() { @@ -149,14 +187,18 @@ class _TelemetryScreenState extends State { _isLoaded = true; _hasData = true; }); + if (isAutoRefreshRequest) { + _scheduleNextAutoRefreshAttempt(); + } } - Future _loadTelemetry() async { + Future _loadTelemetry({bool isAutoRefresh = false}) async { if (_commandService == null) return; setState(() { _isLoading = true; _isLoaded = false; + _activeTelemetryRequestIsAutoRefresh = isAutoRefresh; }); try { final connector = Provider.of(context, listen: false); @@ -179,17 +221,76 @@ class _TelemetryScreenState extends State { setState(() { _isLoading = false; _isLoaded = false; + if (isAutoRefresh) { + _autoRefreshLastAttemptFailed = true; + } + _activeTelemetryRequestIsAutoRefresh = false; }); + if (isAutoRefresh) { + _scheduleNextAutoRefreshAttempt(); + } - showDismissibleSnackBar( - context, - content: Text(context.l10n.telemetry_errorLoading(e.toString())), - backgroundColor: Colors.red, - ); + if (!isAutoRefresh) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.telemetry_errorLoading(e.toString())), + backgroundColor: Colors.red, + ); + } } } } + void _loadAutoRefreshSettings() { + final prefs = PrefsManager.instance; + final contactKey = widget.contact.publicKeyHex; + final interval = + (prefs.getInt(_autoRefreshIntervalKey(contactKey)) ?? + _autoRefreshDefaultIntervalSeconds) + .clamp( + _autoRefreshMinIntervalSeconds, + _autoRefreshMaxIntervalSeconds, + ) + .toInt(); + final quantity = + (prefs.getInt(_autoRefreshQuantityKey(contactKey)) ?? + _autoRefreshDefaultQuantity) + .clamp(_autoRefreshMinQuantity, _autoRefreshMaxQuantity) + .toInt(); + + _autoRefreshIntervalSeconds = interval; + _autoRefreshIntervalController.text = interval.toString(); + _autoRefreshQuantityController.text = quantity.toString(); + } + + Future _saveAutoRefreshSettings() async { + final contactKey = widget.contact.publicKeyHex; + final interval = _clampControllerValue( + controller: _autoRefreshIntervalController, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, + ); + final quantity = _clampControllerValue( + controller: _autoRefreshQuantityController, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ); + + final prefs = PrefsManager.instance; + await prefs.setInt(_autoRefreshIntervalKey(contactKey), interval); + await prefs.setInt(_autoRefreshQuantityKey(contactKey), quantity); + } + + String _autoRefreshIntervalKey(String contactKey) { + return 'telemetry_auto_refresh_interval_$contactKey'; + } + + String _autoRefreshQuantityKey(String contactKey) { + return 'telemetry_auto_refresh_quantity_$contactKey'; + } + void _recordTelemetryResult(bool success) { final selection = _pendingStatusSelection; if (selection == null) return; @@ -205,9 +306,13 @@ class _TelemetryScreenState extends State { @override void dispose() { + unawaited(_saveAutoRefreshSettings()); _frameSubscription?.cancel(); _commandService?.dispose(); _statusTimeout?.cancel(); + _autoRefreshTimer?.cancel(); + _autoRefreshIntervalController.dispose(); + _autoRefreshQuantityController.dispose(); super.dispose(); } @@ -313,7 +418,9 @@ class _TelemetryScreenState extends State { child: CircularProgressIndicator(strokeWidth: 2), ) : const Icon(Icons.refresh), - onPressed: _isLoading ? null : _loadTelemetry, + onPressed: (_isLoading || _isAutoRefreshEnabled) + ? null + : () => _loadTelemetry(), tooltip: l10n.repeater_refresh, ), ], @@ -321,7 +428,8 @@ class _TelemetryScreenState extends State { body: SafeArea( top: false, child: RefreshIndicator( - onRefresh: _loadTelemetry, + onRefresh: () => + _isAutoRefreshEnabled ? Future.value() : _loadTelemetry(), child: ListView( padding: const EdgeInsets.all(16), children: [ @@ -344,6 +452,7 @@ class _TelemetryScreenState extends State { entry['channel'], isImperialUnits, ), + _buildAutoRefreshCard(), ], ), ), @@ -407,6 +516,8 @@ class _TelemetryScreenState extends State { l10n.telemetry_currentLabel, l10n.telemetry_currentValue(entry.value.toString()), ) + else if (entry.key == 'gps') + _buildGpsInfo(entry.value) else _buildInfoRow(entry.key, entry.value.toString()), ], @@ -415,6 +526,274 @@ class _TelemetryScreenState extends State { ); } + Widget _buildAutoRefreshCard() { + final l10n = context.l10n; + final counterText = _autoRefreshCounterText(); + + return Card( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + children: [ + Icon( + Icons.autorenew, + color: Theme.of(context).textTheme.headlineSmall?.color, + ), + const SizedBox(width: 8), + Text( + l10n.common_autoRefresh, + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + const Divider(), + _buildAutoRefreshNumberField( + controller: _autoRefreshIntervalController, + label: l10n.common_interval, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, + ), + const SizedBox(height: 12), + _buildAutoRefreshNumberField( + controller: _autoRefreshQuantityController, + label: l10n.telemetry_autoFetchQuantity, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ), + if (counterText != null) ...[ + const SizedBox(height: 12), + Text( + counterText, + textAlign: TextAlign.center, + style: TextStyle( + color: _autoRefreshLastAttemptFailed + ? Theme.of(context).colorScheme.error + : null, + fontWeight: FontWeight.w600, + ), + ), + ], + const SizedBox(height: 12), + FilledButton( + onPressed: _isLoading && !_isAutoRefreshEnabled + ? null + : _toggleAutoRefresh, + child: _isAutoRefreshEnabled + ? SizedBox( + width: double.infinity, + height: 20, + child: Stack( + alignment: Alignment.center, + children: [ + Center(child: Text(l10n.common_disable)), + const Positioned( + right: 0, + child: SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), + ), + ), + ], + ), + ) + : Text(l10n.common_enable), + ), + ], + ), + ), + ); + } + + Widget _buildAutoRefreshNumberField({ + required TextEditingController controller, + required String label, + required int min, + required int max, + required int fallback, + }) { + return TextField( + controller: controller, + enabled: !_isAutoRefreshEnabled, + keyboardType: TextInputType.number, + inputFormatters: [FilteringTextInputFormatter.digitsOnly], + decoration: InputDecoration( + labelText: label, + border: const OutlineInputBorder(), + isDense: true, + ), + onEditingComplete: () { + _clampControllerValue( + controller: controller, + min: min, + max: max, + fallback: fallback, + ); + unawaited(_saveAutoRefreshSettings()); + FocusScope.of(context).unfocus(); + }, + onSubmitted: (_) => unawaited(_saveAutoRefreshSettings()), + onTapOutside: (_) { + unawaited(_saveAutoRefreshSettings()); + FocusScope.of(context).unfocus(); + }, + ); + } + + String? _autoRefreshCounterText() { + if (!_isAutoRefreshEnabled && _autoRefreshCurrentAttempt == 0) return null; + final counter = '$_autoRefreshCurrentAttempt/$_autoRefreshTotalAttempts'; + if (_autoRefreshLastAttemptFailed) { + return '${context.l10n.telemetry_error}: $counter'; + } + return counter; + } + + void _toggleAutoRefresh() { + if (_isAutoRefreshEnabled) { + _stopAutoRefresh(); + return; + } + _startAutoRefresh(); + } + + void _startAutoRefresh() { + final interval = _clampControllerValue( + controller: _autoRefreshIntervalController, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, + ); + final quantity = _clampControllerValue( + controller: _autoRefreshQuantityController, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ); + unawaited(_saveAutoRefreshSettings()); + + setState(() { + _isAutoRefreshEnabled = true; + _autoRefreshIntervalSeconds = interval; + _autoRefreshTotalAttempts = quantity; + _autoRefreshCurrentAttempt = 0; + _autoRefreshLastAttemptFailed = false; + }); + _runAutoRefreshAttempt(); + } + + void _stopAutoRefresh() { + _autoRefreshTimer?.cancel(); + _autoRefreshTimer = null; + if (!mounted) return; + setState(() { + _isAutoRefreshEnabled = false; + }); + } + + Future _runAutoRefreshAttempt() async { + if (!_isAutoRefreshEnabled || !mounted) return; + if (_autoRefreshCurrentAttempt >= _autoRefreshTotalAttempts) { + _stopAutoRefresh(); + return; + } + + setState(() { + _autoRefreshCurrentAttempt += 1; + }); + await _loadTelemetry(isAutoRefresh: true); + } + + void _scheduleNextAutoRefreshAttempt() { + if (!_isAutoRefreshEnabled || !mounted) return; + _autoRefreshTimer?.cancel(); + if (_autoRefreshCurrentAttempt >= _autoRefreshTotalAttempts) { + _stopAutoRefresh(); + return; + } + // Start the interval only after the current request has finished: after a + // telemetry response, timeout, or send error. This keeps slow replies from + // shortening the intended pause between requests. + _autoRefreshTimer = Timer( + Duration(seconds: _autoRefreshIntervalSeconds), + _runAutoRefreshAttempt, + ); + } + + int _clampControllerValue({ + required TextEditingController controller, + required int min, + required int max, + required int fallback, + }) { + final parsed = int.tryParse(controller.text); + final value = (parsed ?? fallback).clamp(min, max).toInt(); + controller.text = value.toString(); + controller.selection = TextSelection.collapsed( + offset: controller.text.length, + ); + return value; + } + + Widget _buildGpsInfo(dynamic value) { + final latitude = _readGpsValue(value, 'latitude'); + final longitude = _readGpsValue(value, 'longitude'); + final altitude = _readGpsValue(value, 'altitude'); + final isValidPosition = _isValidGpsPosition(latitude, longitude); + final gpsText = isValidPosition + ? [ + latitude!.toStringAsFixed(5), + longitude!.toStringAsFixed(5), + if (altitude != null) '${altitude.toStringAsFixed(1)} m', + ].join(', ') + : value.toString(); + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildInfoRow('gps', gpsText), + if (isValidPosition) + TelemetryLocationMap( + // The map renders only after bounds validation, keeping malformed + // Cayenne payloads from creating an invalid FlutterMap center. + latitude: latitude!, + longitude: longitude!, + label: widget.contact.name, + contactType: widget.contact.type, + contactPublicKeyHex: widget.contact.publicKeyHex, + ), + ], + ); + } + + double? _readGpsValue(dynamic value, String key) { + if (value is! Map) return null; + final rawValue = value[key]; + if (rawValue is num) return rawValue.toDouble(); + return null; + } + + bool _isValidGpsPosition(double? latitude, double? longitude) { + if (latitude == null || longitude == null) return false; + const double epsilon = 1e-6; + return (latitude.abs() > epsilon || longitude.abs() > epsilon) && + latitude >= -90.0 && + latitude <= 90.0 && + longitude >= -180.0 && + longitude <= 180.0; + } + Widget _buildInfoRow(String label, String value) { return Padding( padding: const EdgeInsets.symmetric(vertical: 6), diff --git a/lib/widgets/telemetry_location_map.dart b/lib/widgets/telemetry_location_map.dart new file mode 100644 index 00000000..f6baff71 --- /dev/null +++ b/lib/widgets/telemetry_location_map.dart @@ -0,0 +1,422 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; +import '../connector/meshcore_protocol.dart'; +import '../l10n/l10n.dart'; +import '../models/app_settings.dart'; +import '../models/contact.dart'; +import '../services/app_settings_service.dart'; +import '../services/map_tile_cache_service.dart'; + +class TelemetryLocationMap extends StatefulWidget { + final double latitude; + final double longitude; + final String label; + final int contactType; + final String contactPublicKeyHex; + + const TelemetryLocationMap({ + super.key, + required this.latitude, + required this.longitude, + required this.label, + required this.contactType, + required this.contactPublicKeyHex, + }); + + @override + State createState() => _TelemetryLocationMapState(); +} + +class _TelemetryLocationMapState extends State { + static const double _initialZoom = 14.0; + static const double _minZoom = 2.0; + static const double _maxZoom = 18.0; + + final MapController _mapController = MapController(); + + LatLng get _position => LatLng(widget.latitude, widget.longitude); + + @override + void didUpdateWidget(covariant TelemetryLocationMap oldWidget) { + super.didUpdateWidget(oldWidget); + if (oldWidget.latitude == widget.latitude && + oldWidget.longitude == widget.longitude) { + return; + } + + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + _mapController.move(_position, _initialZoom); + } + }); + } + + @override + Widget build(BuildContext context) { + final connector = context.watch(); + final settingsService = context.watch(); + final settings = settingsService.settings; + final tileCache = context.read(); + final contacts = _filteredContacts(connector, settings); + final isDesktop = _isDesktopPlatform(defaultTargetPlatform); + + return Padding( + padding: const EdgeInsets.only(top: 8, bottom: 4), + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: LayoutBuilder( + builder: (context, constraints) { + final maxHeight = MediaQuery.sizeOf(context).height * 0.75; + final squareHeight = constraints.maxWidth.isFinite + ? constraints.maxWidth + : maxHeight; + // Prefer square sizing by width, but cap only the height so the map + // remains usable on wide screens without growing past the viewport. + final mapHeight = squareHeight > maxHeight + ? maxHeight + : squareHeight; + + return SizedBox( + width: double.infinity, + height: mapHeight, + child: Stack( + children: [ + FlutterMap( + mapController: _mapController, + options: MapOptions( + initialCenter: _position, + initialZoom: _initialZoom, + minZoom: _minZoom, + maxZoom: _maxZoom, + interactionOptions: InteractionOptions( + flags: ~InteractiveFlag.rotate, + scrollWheelVelocity: isDesktop ? 0.012 : 0.005, + cursorKeyboardRotationOptions: + CursorKeyboardRotationOptions.disabled(), + keyboardOptions: isDesktop + ? const KeyboardOptions( + enableArrowKeysPanning: true, + enableWASDPanning: true, + enableRFZooming: true, + ) + : const KeyboardOptions.disabled(), + ), + ), + children: [ + TileLayer( + urlTemplate: kMapTileUrlTemplate, + tileProvider: tileCache.tileProvider, + userAgentPackageName: + MapTileCacheService.userAgentPackageName, + maxZoom: 19, + ), + MarkerLayer( + markers: [ + ...contacts.map(_buildContactMarker), + _buildTelemetryMarker(), + _buildLabelMarker(_position, widget.label), + ], + ), + ], + ), + Positioned( + top: 8, + right: 8, + child: _MapButton( + icon: Icons.filter_list, + tooltip: context.l10n.map_filterNodes, + onPressed: () => + _showFilterDialog(context, settingsService), + ), + ), + Positioned( + left: 8, + top: 8, + child: Column( + children: [ + _MapButton( + icon: Icons.add, + tooltip: 'Zoom in', + onPressed: () => _zoomBy(1), + ), + const SizedBox(height: 6), + _MapButton( + icon: Icons.remove, + tooltip: 'Zoom out', + onPressed: () => _zoomBy(-1), + ), + const SizedBox(height: 6), + _MapButton( + icon: Icons.my_location, + tooltip: 'Center map', + onPressed: () => + _mapController.move(_position, _initialZoom), + ), + ], + ), + ), + ], + ), + ); + }, + ), + ), + ); + } + + List _filteredContacts( + MeshCoreConnector connector, + AppSettings settings, + ) { + final contacts = settings.mapShowDiscoveryContacts + ? connector.allContacts + : connector.allContacts.where((contact) => contact.isActive).toList(); + + return contacts.where((contact) { + if (!contact.hasLocation) return false; + if (contact.publicKeyHex == widget.contactPublicKeyHex) return false; + if (contact.type == advTypeChat) return settings.mapShowChatNodes; + if (contact.type == advTypeRepeater) return settings.mapShowRepeaters; + return settings.mapShowOtherNodes; + }).toList(); + } + + Marker _buildTelemetryMarker() { + return Marker( + point: _position, + width: 44, + height: 44, + child: IgnorePointer( + child: _MarkerBubble( + color: Colors.red, + icon: _getNodeIcon(widget.contactType), + size: 24, + ), + ), + ); + } + + Marker _buildContactMarker(Contact contact) { + return Marker( + point: LatLng(contact.latitude!, contact.longitude!), + width: 34, + height: 34, + child: IgnorePointer( + child: _MarkerBubble( + color: _getNodeColor(contact.type), + icon: _getNodeIcon(contact.type), + size: 18, + ), + ), + ); + } + + Marker _buildLabelMarker(LatLng point, String label) { + return Marker( + point: point, + width: 140, + height: 24, + alignment: Alignment.topCenter, + child: IgnorePointer( + child: Transform.translate( + offset: const Offset(0, -24), + child: FittedBox( + fit: BoxFit.contain, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: Colors.black54, + borderRadius: BorderRadius.circular(8), + ), + alignment: Alignment.center, + child: Text( + label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ), + ), + ); + } + + void _zoomBy(double delta) { + final camera = _mapController.camera; + final nextZoom = (camera.zoom + delta).clamp(_minZoom, _maxZoom).toDouble(); + _mapController.move(camera.center, nextZoom); + } + + bool _isDesktopPlatform(TargetPlatform platform) { + return platform == TargetPlatform.linux || + platform == TargetPlatform.windows || + platform == TargetPlatform.macOS; + } + + Color _getNodeColor(int type) { + switch (type) { + case advTypeChat: + return Colors.blue; + case advTypeRepeater: + return Colors.green; + case advTypeRoom: + return Colors.purple; + case advTypeSensor: + return Colors.orange; + default: + return Colors.grey; + } + } + + IconData _getNodeIcon(int type) { + switch (type) { + case advTypeChat: + return Icons.person; + case advTypeRepeater: + return Icons.router; + case advTypeRoom: + return Icons.meeting_room; + case advTypeSensor: + return Icons.sensors; + default: + return Icons.device_unknown; + } + } + + void _showFilterDialog( + BuildContext context, + AppSettingsService settingsService, + ) { + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.map_filterNodes), + content: SingleChildScrollView( + child: Consumer( + builder: (consumerContext, service, child) { + final settings = service.settings; + // Reuse the global map filters so the telemetry preview and the + // main map stay consistent without another settings model. + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + CheckboxListTile( + title: Text(context.l10n.map_chatNodes), + value: settings.mapShowChatNodes, + onChanged: (value) { + service.setMapShowChatNodes(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + CheckboxListTile( + title: Text(context.l10n.map_repeaters), + value: settings.mapShowRepeaters, + onChanged: (value) { + service.setMapShowRepeaters(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + CheckboxListTile( + title: Text(context.l10n.map_otherNodes), + value: settings.mapShowOtherNodes, + onChanged: (value) { + service.setMapShowOtherNodes(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + CheckboxListTile( + title: Text(context.l10n.map_showDiscoveryContacts), + value: settings.mapShowDiscoveryContacts, + onChanged: (value) { + service.setMapShowDiscoveryContacts(value ?? true); + }, + contentPadding: EdgeInsets.zero, + ), + ], + ); + }, + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(context.l10n.common_close), + ), + ], + ), + ); + } +} + +class _MarkerBubble extends StatelessWidget { + final Color color; + final IconData icon; + final double size; + + const _MarkerBubble({ + required this.color, + required this.icon, + required this.size, + }); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Icon(icon, color: Colors.white, size: size), + ); + } +} + +class _MapButton extends StatelessWidget { + final IconData icon; + final String tooltip; + final VoidCallback onPressed; + + const _MapButton({ + required this.icon, + required this.tooltip, + required this.onPressed, + }); + + @override + Widget build(BuildContext context) { + return Material( + color: Theme.of(context).colorScheme.surface, + elevation: 3, + borderRadius: BorderRadius.circular(8), + clipBehavior: Clip.antiAlias, + child: IconButton( + icon: Icon(icon), + tooltip: tooltip, + onPressed: onPressed, + constraints: const BoxConstraints.tightFor(width: 40, height: 40), + padding: EdgeInsets.zero, + iconSize: 20, + ), + ); + } +} From 7a823654df837d29f0f89bbcd05a00a3e9f0537b Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Tue, 19 May 2026 23:16:37 +0300 Subject: [PATCH 15/36] Telemetry: room-server request fix #2 The telemetry parser has been expanded and should now support significantly more metrics. It has been ported from the Python implementation of meshcore_py. --- lib/connector/meshcore_protocol.dart | 6 + lib/helpers/cayenne_lpp.dart | 218 +++++++++++++++++++++++- lib/l10n/app_bg.arb | 35 ++++ lib/l10n/app_de.arb | 35 ++++ lib/l10n/app_en.arb | 112 +++++++++++++ lib/l10n/app_es.arb | 35 ++++ lib/l10n/app_fr.arb | 35 ++++ lib/l10n/app_hu.arb | 35 ++++ lib/l10n/app_it.arb | 35 ++++ lib/l10n/app_ja.arb | 35 ++++ lib/l10n/app_ko.arb | 35 ++++ lib/l10n/app_localizations.dart | 210 +++++++++++++++++++++++ lib/l10n/app_localizations_bg.dart | 127 ++++++++++++++ lib/l10n/app_localizations_de.dart | 127 ++++++++++++++ lib/l10n/app_localizations_en.dart | 127 ++++++++++++++ lib/l10n/app_localizations_es.dart | 127 ++++++++++++++ lib/l10n/app_localizations_fr.dart | 127 ++++++++++++++ lib/l10n/app_localizations_hu.dart | 127 ++++++++++++++ lib/l10n/app_localizations_it.dart | 127 ++++++++++++++ lib/l10n/app_localizations_ja.dart | 127 ++++++++++++++ lib/l10n/app_localizations_ko.dart | 127 ++++++++++++++ lib/l10n/app_localizations_nl.dart | 127 ++++++++++++++ lib/l10n/app_localizations_pl.dart | 127 ++++++++++++++ lib/l10n/app_localizations_pt.dart | 127 ++++++++++++++ lib/l10n/app_localizations_ru.dart | 127 ++++++++++++++ lib/l10n/app_localizations_sk.dart | 127 ++++++++++++++ lib/l10n/app_localizations_sl.dart | 127 ++++++++++++++ lib/l10n/app_localizations_sv.dart | 127 ++++++++++++++ lib/l10n/app_localizations_uk.dart | 127 ++++++++++++++ lib/l10n/app_localizations_zh.dart | 127 ++++++++++++++ lib/l10n/app_nl.arb | 35 ++++ lib/l10n/app_pl.arb | 35 ++++ lib/l10n/app_pt.arb | 35 ++++ lib/l10n/app_ru.arb | 35 ++++ lib/l10n/app_sk.arb | 35 ++++ lib/l10n/app_sl.arb | 35 ++++ lib/l10n/app_sv.arb | 35 ++++ lib/l10n/app_uk.arb | 35 ++++ lib/l10n/app_zh.arb | 35 ++++ lib/screens/telemetry_screen.dart | 240 +++++++++++++++++++++++---- 40 files changed, 3626 insertions(+), 41 deletions(-) diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index f55e9687..a056f4ac 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -224,6 +224,12 @@ const int reqTypeGetTelemetry = 0x03; const int reqTypeGetAccessList = 0x05; const int reqTypeGetNeighbors = 0x06; +Uint8List buildTelemetryBinaryPayload() { + // Room servers/repeaters read byte 1 as an inverse telemetry permission mask. + // Zero means "request every telemetry field allowed for this contact". + return Uint8List.fromList([reqTypeGetTelemetry, 0x00, 0x00, 0x00, 0x00]); +} + // Repeater response codes const int respServerLoginOk = 0; diff --git a/lib/helpers/cayenne_lpp.dart b/lib/helpers/cayenne_lpp.dart index 07909e63..021e9cc5 100644 --- a/lib/helpers/cayenne_lpp.dart +++ b/lib/helpers/cayenne_lpp.dart @@ -96,6 +96,34 @@ class CayenneLpp { } switch (type) { + case lppDigitalInput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt8(), + }); + break; + case lppDigitalOutput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt8(), + }); + break; + case lppAnalogInput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readInt16BE() / 100, + }); + break; + case lppAnalogOutput: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readInt16BE() / 100, + }); + break; case lppGenericSensor: telemetry.add({ 'channel': channel, @@ -131,6 +159,17 @@ class CayenneLpp { 'value': buffer.readUInt8() / 2, }); break; + case lppAccelerometer: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'x': buffer.readInt16BE() / 1000, + 'y': buffer.readInt16BE() / 1000, + 'z': buffer.readInt16BE() / 1000, + }, + }); + break; case lppBarometricPressure: telemetry.add({ 'channel': channel, @@ -138,6 +177,13 @@ class CayenneLpp { 'value': buffer.readUInt16BE() / 10, }); break; + case lppAltitude: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readInt16BE(), + }); + break; case lppVoltage: telemetry.add({ 'channel': channel, @@ -152,6 +198,13 @@ class CayenneLpp { 'value': buffer.readInt16BE() / 1000, }); break; + case lppFrequency: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE(), + }); + break; case lppPercentage: telemetry.add({ 'channel': channel, @@ -173,6 +226,56 @@ class CayenneLpp { 'value': buffer.readUInt16BE(), }); break; + case lppDistance: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE() / 1000, + }); + break; + case lppEnergy: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE() / 1000, + }); + break; + case lppDirection: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt16BE(), + }); + break; + case lppUnixTime: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt32BE(), + }); + break; + case lppGyrometer: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'x': buffer.readInt16BE() / 100, + 'y': buffer.readInt16BE() / 100, + 'z': buffer.readInt16BE() / 100, + }, + }); + break; + case lppColour: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'red': buffer.readUInt8(), + 'green': buffer.readUInt8(), + 'blue': buffer.readUInt8(), + }, + }); + break; case lppGps: telemetry.add({ 'channel': channel, @@ -184,6 +287,24 @@ class CayenneLpp { }, }); break; + case lppSwitch: + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': buffer.readUInt8(), + }); + break; + case lppPolyline: + final size = buffer.readUInt8(); + telemetry.add({ + 'channel': channel, + 'type': type, + 'value': { + 'size': size, + 'data': _bytesToHex(_readPolylinePayload(buffer, size)), + }, + }); + break; default: return telemetry; } @@ -216,6 +337,19 @@ class CayenneLpp { ); switch (type) { + case lppDigitalInput: + channelData['values']['digitalInput'] = buffer.readUInt8(); + break; + case lppDigitalOutput: + channelData['values']['digitalOutput'] = buffer.readUInt8(); + break; + case lppAnalogInput: + channelData['values']['analogInput'] = buffer.readInt16BE() / 100.0; + break; + case lppAnalogOutput: + channelData['values']['analogOutput'] = + buffer.readInt16BE() / 100.0; + break; case lppGenericSensor: channelData['values']['generic'] = buffer.readUInt32BE(); break; @@ -231,15 +365,29 @@ class CayenneLpp { case lppRelativeHumidity: channelData['values']['humidity'] = buffer.readUInt8() / 2.0; break; + case lppAccelerometer: + channelData['values']['accelerometer'] = { + 'x': buffer.readInt16BE() / 1000.0, + 'y': buffer.readInt16BE() / 1000.0, + 'z': buffer.readInt16BE() / 1000.0, + }; + break; case lppBarometricPressure: channelData['values']['pressure'] = buffer.readUInt16BE() / 10.0; break; + case lppAltitude: + // MeshCore encodes standalone barometric altitude as LPP type 121. + channelData['values']['altitude'] = buffer.readInt16BE(); + break; case lppVoltage: channelData['values']['voltage'] = buffer.readInt16BE() / 100.0; break; case lppCurrent: channelData['values']['current'] = buffer.readInt16BE() / 1000.0; break; + case lppFrequency: + channelData['values']['frequency'] = buffer.readUInt32BE(); + break; case lppPercentage: channelData['values']['percentage'] = buffer.readUInt8(); break; @@ -249,6 +397,32 @@ class CayenneLpp { case lppPower: channelData['values']['power'] = buffer.readUInt16BE(); break; + case lppDistance: + channelData['values']['distance'] = buffer.readUInt32BE() / 1000.0; + break; + case lppEnergy: + channelData['values']['energy'] = buffer.readUInt32BE() / 1000.0; + break; + case lppDirection: + channelData['values']['direction'] = buffer.readUInt16BE(); + break; + case lppUnixTime: + channelData['values']['time'] = buffer.readUInt32BE(); + break; + case lppGyrometer: + channelData['values']['gyrometer'] = { + 'x': buffer.readInt16BE() / 100.0, + 'y': buffer.readInt16BE() / 100.0, + 'z': buffer.readInt16BE() / 100.0, + }; + break; + case lppColour: + channelData['values']['colour'] = { + 'red': buffer.readUInt8(), + 'green': buffer.readUInt8(), + 'blue': buffer.readUInt8(), + }; + break; case lppGps: channelData['values']['gps'] = { 'latitude': buffer.readInt24BE() / 10000.0, @@ -256,22 +430,48 @@ class CayenneLpp { 'altitude': buffer.readInt24BE() / 100.0, }; break; - // Add more types as needed... + case lppSwitch: + channelData['values']['switch'] = buffer.readUInt8() != 0; + break; + case lppPolyline: + final size = buffer.readUInt8(); + channelData['values']['polyline'] = { + 'size': size, + 'data': _bytesToHex(_readPolylinePayload(buffer, size)), + }; + break; default: - //Stopped parsing to avoid misalignment - return channels.values.toList(); + // Stop parsing to avoid losing alignment on an unknown LPP type. + return _sortedChannelValues(channels); } } - final List> channelsOut = channels.values.toList(); - channelsOut.sort((a, b) => a['channel'].compareTo(b['channel'])); - return channelsOut; + return _sortedChannelValues(channels); } catch (e) { // Handle parsing errors, possibly due to malformed data appLogger.error('Error parsing Cayenne LPP data: $e'); - return < - Map - >[]; // Return an empty list on error to avoid crashing the app + // Preserve any fields parsed before the malformed value. + return _sortedChannelValues(channels); } } + + static Uint8List _readPolylinePayload(BufferReader buffer, int size) { + final declaredPayloadSize = size > 0 ? size - 1 : 0; + final availablePayloadSize = declaredPayloadSize <= buffer.remaining + ? declaredPayloadSize + : buffer.remaining; + return buffer.readBytes(availablePayloadSize); + } + + static List> _sortedChannelValues( + Map> channels, + ) { + final channelsOut = channels.values.toList(); + channelsOut.sort((a, b) => a['channel'].compareTo(b['channel'])); + return channelsOut; + } + + static String _bytesToHex(Uint8List bytes) { + return bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(); + } } diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index 183c07a9..9eac9105 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Цифров вход", + "telemetry_digitalOutputLabel": "Цифров изход", + "telemetry_analogInputLabel": "Аналогов вход", + "telemetry_analogOutputLabel": "Аналогов изход", + "telemetry_genericLabel": "Общ сензор", + "telemetry_luminosityLabel": "Осветеност", + "telemetry_presenceLabel": "Присъствие", + "telemetry_humidityLabel": "Влажност", + "telemetry_accelerometerLabel": "Акселерометър", + "telemetry_pressureLabel": "Налягане", + "telemetry_altitudeLabel": "Надморска височина", + "telemetry_frequencyLabel": "Честота", + "telemetry_percentageLabel": "Процент", + "telemetry_concentrationLabel": "Концентрация", + "telemetry_powerLabel": "Мощност", + "telemetry_distanceLabel": "Разстояние", + "telemetry_energyLabel": "Енергия", + "telemetry_directionLabel": "Посока", + "telemetry_timeLabel": "Време", + "telemetry_gyrometerLabel": "Жироскоп", + "telemetry_colourLabel": "Цвят", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Превключвател", + "telemetry_polylineLabel": "Полилиния", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Брой заявки", "telemetry_error": "Неуспешно получаване на данни", "telemetry_noData": "Няма налични данни за телеметрията.", diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 80a030af..e8aa0a78 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Digitaleingang", + "telemetry_digitalOutputLabel": "Digitalausgang", + "telemetry_analogInputLabel": "Analogeingang", + "telemetry_analogOutputLabel": "Analogausgang", + "telemetry_genericLabel": "Allgemeiner Sensor", + "telemetry_luminosityLabel": "Helligkeit", + "telemetry_presenceLabel": "Anwesenheit", + "telemetry_humidityLabel": "Luftfeuchtigkeit", + "telemetry_accelerometerLabel": "Beschleunigungsmesser", + "telemetry_pressureLabel": "Druck", + "telemetry_altitudeLabel": "Höhe", + "telemetry_frequencyLabel": "Frequenz", + "telemetry_percentageLabel": "Prozentsatz", + "telemetry_concentrationLabel": "Konzentration", + "telemetry_powerLabel": "Leistung", + "telemetry_distanceLabel": "Entfernung", + "telemetry_energyLabel": "Energie", + "telemetry_directionLabel": "Richtung", + "telemetry_timeLabel": "Zeit", + "telemetry_gyrometerLabel": "Gyroskop", + "telemetry_colourLabel": "Farbe", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Schalter", + "telemetry_polylineLabel": "Polylinie", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Anzahl der Anfragen", "telemetry_error": "Daten konnten nicht abgerufen werden", "telemetry_noData": "Keine Telemetriedaten verfügbar.", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index bc7bec99..1567db5b 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -1663,6 +1663,118 @@ } } }, + "telemetry_digitalInputLabel": "Digital Input", + "telemetry_digitalOutputLabel": "Digital Output", + "telemetry_analogInputLabel": "Analog Input", + "telemetry_analogOutputLabel": "Analog Output", + "telemetry_genericLabel": "Generic Sensor", + "telemetry_luminosityLabel": "Luminosity", + "telemetry_presenceLabel": "Presence", + "telemetry_humidityLabel": "Humidity", + "telemetry_accelerometerLabel": "Accelerometer", + "telemetry_pressureLabel": "Pressure", + "telemetry_altitudeLabel": "Altitude", + "telemetry_frequencyLabel": "Frequency", + "telemetry_percentageLabel": "Percentage", + "telemetry_concentrationLabel": "Concentration", + "telemetry_powerLabel": "Power", + "telemetry_distanceLabel": "Distance", + "telemetry_energyLabel": "Energy", + "telemetry_directionLabel": "Direction", + "telemetry_timeLabel": "Time", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Colour", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Switch", + "telemetry_polylineLabel": "Polyline", + "telemetry_altitudeValue": "{meters} m", + "@telemetry_altitudeValue": { + "placeholders": { + "meters": { + "type": "String" + } + } + }, + "telemetry_frequencyValue": "{hertz} Hz", + "@telemetry_frequencyValue": { + "placeholders": { + "hertz": { + "type": "String" + } + } + }, + "telemetry_pressureValue": "{hpa} hPa", + "@telemetry_pressureValue": { + "placeholders": { + "hpa": { + "type": "String" + } + } + }, + "telemetry_luminosityValue": "{lux} lx", + "@telemetry_luminosityValue": { + "placeholders": { + "lux": { + "type": "String" + } + } + }, + "telemetry_powerValue": "{watts} W", + "@telemetry_powerValue": { + "placeholders": { + "watts": { + "type": "String" + } + } + }, + "telemetry_distanceValue": "{meters} m", + "@telemetry_distanceValue": { + "placeholders": { + "meters": { + "type": "String" + } + } + }, + "telemetry_energyValue": "{kilowattHours} kWh", + "@telemetry_energyValue": { + "placeholders": { + "kilowattHours": { + "type": "String" + } + } + }, + "telemetry_directionValue": "{degrees}°", + "@telemetry_directionValue": { + "placeholders": { + "degrees": { + "type": "String" + } + } + }, + "telemetry_concentrationValue": "{ppm} ppm", + "@telemetry_concentrationValue": { + "placeholders": { + "ppm": { + "type": "String" + } + } + }, + "telemetry_percentageValue": "{percent}%", + "@telemetry_percentageValue": { + "placeholders": { + "percent": { + "type": "String" + } + } + }, + "telemetry_analogValue": "{value}", + "@telemetry_analogValue": { + "placeholders": { + "value": { + "type": "String" + } + } + }, "telemetry_autoFetchQuantity": "Requests quantity", "telemetry_error": "Unable to retrieve data", "neighbors_receivedData": "Received Neighbors Data", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index 89574799..088752e7 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Entrada digital", + "telemetry_digitalOutputLabel": "Salida digital", + "telemetry_analogInputLabel": "Entrada analógica", + "telemetry_analogOutputLabel": "Salida analógica", + "telemetry_genericLabel": "Sensor genérico", + "telemetry_luminosityLabel": "Luminosidad", + "telemetry_presenceLabel": "Presencia", + "telemetry_humidityLabel": "Humedad", + "telemetry_accelerometerLabel": "Acelerómetro", + "telemetry_pressureLabel": "Presión", + "telemetry_altitudeLabel": "Altitud", + "telemetry_frequencyLabel": "Frecuencia", + "telemetry_percentageLabel": "Porcentaje", + "telemetry_concentrationLabel": "Concentración", + "telemetry_powerLabel": "Potencia", + "telemetry_distanceLabel": "Distancia", + "telemetry_energyLabel": "Energía", + "telemetry_directionLabel": "Dirección", + "telemetry_timeLabel": "Hora", + "telemetry_gyrometerLabel": "Girómetro", + "telemetry_colourLabel": "Color", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interruptor", + "telemetry_polylineLabel": "Polilínea", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Número de solicitudes", "telemetry_error": "No se pudieron obtener los datos", "telemetry_noData": "No hay datos de telemetría disponibles.", diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index e5c5091a..1c56e59a 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Entrée numérique", + "telemetry_digitalOutputLabel": "Sortie numérique", + "telemetry_analogInputLabel": "Entrée analogique", + "telemetry_analogOutputLabel": "Sortie analogique", + "telemetry_genericLabel": "Capteur générique", + "telemetry_luminosityLabel": "Luminosité", + "telemetry_presenceLabel": "Présence", + "telemetry_humidityLabel": "Humidité", + "telemetry_accelerometerLabel": "Accéléromètre", + "telemetry_pressureLabel": "Pression", + "telemetry_altitudeLabel": "Altitude", + "telemetry_frequencyLabel": "Fréquence", + "telemetry_percentageLabel": "Pourcentage", + "telemetry_concentrationLabel": "Concentration", + "telemetry_powerLabel": "Puissance", + "telemetry_distanceLabel": "Distance", + "telemetry_energyLabel": "Énergie", + "telemetry_directionLabel": "Direction", + "telemetry_timeLabel": "Heure", + "telemetry_gyrometerLabel": "Gyromètre", + "telemetry_colourLabel": "Couleur", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interrupteur", + "telemetry_polylineLabel": "Polyligne", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Nombre de requêtes", "telemetry_error": "Impossible de récupérer les données", "telemetry_noData": "Aucune donnée de télémétrie disponible.", diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index 38618779..4c7dd35a 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -1468,6 +1468,41 @@ } } }, + "telemetry_digitalInputLabel": "Digitális bemenet", + "telemetry_digitalOutputLabel": "Digitális kimenet", + "telemetry_analogInputLabel": "Analóg bemenet", + "telemetry_analogOutputLabel": "Analóg kimenet", + "telemetry_genericLabel": "Általános érzékelő", + "telemetry_luminosityLabel": "Fényerő", + "telemetry_presenceLabel": "Jelenlét", + "telemetry_humidityLabel": "Páratartalom", + "telemetry_accelerometerLabel": "Gyorsulásmérő", + "telemetry_pressureLabel": "Nyomás", + "telemetry_altitudeLabel": "Magasság", + "telemetry_frequencyLabel": "Frekvencia", + "telemetry_percentageLabel": "Százalék", + "telemetry_concentrationLabel": "Koncentráció", + "telemetry_powerLabel": "Teljesítmény", + "telemetry_distanceLabel": "Távolság", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Irány", + "telemetry_timeLabel": "Idő", + "telemetry_gyrometerLabel": "Giroszkóp", + "telemetry_colourLabel": "Szín", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Kapcsoló", + "telemetry_polylineLabel": "Töröttvonal", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Kérések száma", "telemetry_error": "Nem sikerült lekérni az adatokat", "telemetry_noData": "Nincsenek elérhető telemetriadatok.", diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 2ee686ec..43c1b70a 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Ingresso digitale", + "telemetry_digitalOutputLabel": "Uscita digitale", + "telemetry_analogInputLabel": "Ingresso analogico", + "telemetry_analogOutputLabel": "Uscita analogica", + "telemetry_genericLabel": "Sensore generico", + "telemetry_luminosityLabel": "Luminosità", + "telemetry_presenceLabel": "Presenza", + "telemetry_humidityLabel": "Umidità", + "telemetry_accelerometerLabel": "Accelerometro", + "telemetry_pressureLabel": "Pressione", + "telemetry_altitudeLabel": "Altitudine", + "telemetry_frequencyLabel": "Frequenza", + "telemetry_percentageLabel": "Percentuale", + "telemetry_concentrationLabel": "Concentrazione", + "telemetry_powerLabel": "Potenza", + "telemetry_distanceLabel": "Distanza", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Direzione", + "telemetry_timeLabel": "Ora", + "telemetry_gyrometerLabel": "Giroscopio", + "telemetry_colourLabel": "Colore", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interruttore", + "telemetry_polylineLabel": "Polilinea", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Numero di richieste", "telemetry_error": "Impossibile recuperare i dati", "telemetry_noData": "Nessun dato di telemetria disponibile.", diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 92f2ed65..d08861cb 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -1468,6 +1468,41 @@ } } }, + "telemetry_digitalInputLabel": "デジタル入力", + "telemetry_digitalOutputLabel": "デジタル出力", + "telemetry_analogInputLabel": "アナログ入力", + "telemetry_analogOutputLabel": "アナログ出力", + "telemetry_genericLabel": "汎用センサー", + "telemetry_luminosityLabel": "照度", + "telemetry_presenceLabel": "在室", + "telemetry_humidityLabel": "湿度", + "telemetry_accelerometerLabel": "加速度計", + "telemetry_pressureLabel": "気圧", + "telemetry_altitudeLabel": "高度", + "telemetry_frequencyLabel": "周波数", + "telemetry_percentageLabel": "パーセント", + "telemetry_concentrationLabel": "濃度", + "telemetry_powerLabel": "電力", + "telemetry_distanceLabel": "距離", + "telemetry_energyLabel": "エネルギー", + "telemetry_directionLabel": "方向", + "telemetry_timeLabel": "時刻", + "telemetry_gyrometerLabel": "ジャイロメーター", + "telemetry_colourLabel": "色", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "スイッチ", + "telemetry_polylineLabel": "ポリライン", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "リクエスト数", "telemetry_error": "データを取得できません", "telemetry_noData": "テレメトリデータは利用できません。", diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index ff27b6ad..01438cd5 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -1468,6 +1468,41 @@ } } }, + "telemetry_digitalInputLabel": "디지털 입력", + "telemetry_digitalOutputLabel": "디지털 출력", + "telemetry_analogInputLabel": "아날로그 입력", + "telemetry_analogOutputLabel": "아날로그 출력", + "telemetry_genericLabel": "일반 센서", + "telemetry_luminosityLabel": "조도", + "telemetry_presenceLabel": "존재 감지", + "telemetry_humidityLabel": "습도", + "telemetry_accelerometerLabel": "가속도계", + "telemetry_pressureLabel": "압력", + "telemetry_altitudeLabel": "고도", + "telemetry_frequencyLabel": "주파수", + "telemetry_percentageLabel": "백분율", + "telemetry_concentrationLabel": "농도", + "telemetry_powerLabel": "전력", + "telemetry_distanceLabel": "거리", + "telemetry_energyLabel": "에너지", + "telemetry_directionLabel": "방향", + "telemetry_timeLabel": "시간", + "telemetry_gyrometerLabel": "자이로미터", + "telemetry_colourLabel": "색상", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "스위치", + "telemetry_polylineLabel": "폴리라인", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "요청 수", "telemetry_error": "데이터를 가져올 수 없습니다", "telemetry_noData": "텔레메트리 데이터는 제공되지 않습니다.", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 949dd518..300a4d1e 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -5702,6 +5702,216 @@ abstract class AppLocalizations { /// **'{celsius}°C / {fahrenheit}°F'** String telemetry_temperatureValue(String celsius, String fahrenheit); + /// No description provided for @telemetry_digitalInputLabel. + /// + /// In en, this message translates to: + /// **'Digital Input'** + String get telemetry_digitalInputLabel; + + /// No description provided for @telemetry_digitalOutputLabel. + /// + /// In en, this message translates to: + /// **'Digital Output'** + String get telemetry_digitalOutputLabel; + + /// No description provided for @telemetry_analogInputLabel. + /// + /// In en, this message translates to: + /// **'Analog Input'** + String get telemetry_analogInputLabel; + + /// No description provided for @telemetry_analogOutputLabel. + /// + /// In en, this message translates to: + /// **'Analog Output'** + String get telemetry_analogOutputLabel; + + /// No description provided for @telemetry_genericLabel. + /// + /// In en, this message translates to: + /// **'Generic Sensor'** + String get telemetry_genericLabel; + + /// No description provided for @telemetry_luminosityLabel. + /// + /// In en, this message translates to: + /// **'Luminosity'** + String get telemetry_luminosityLabel; + + /// No description provided for @telemetry_presenceLabel. + /// + /// In en, this message translates to: + /// **'Presence'** + String get telemetry_presenceLabel; + + /// No description provided for @telemetry_humidityLabel. + /// + /// In en, this message translates to: + /// **'Humidity'** + String get telemetry_humidityLabel; + + /// No description provided for @telemetry_accelerometerLabel. + /// + /// In en, this message translates to: + /// **'Accelerometer'** + String get telemetry_accelerometerLabel; + + /// No description provided for @telemetry_pressureLabel. + /// + /// In en, this message translates to: + /// **'Pressure'** + String get telemetry_pressureLabel; + + /// No description provided for @telemetry_altitudeLabel. + /// + /// In en, this message translates to: + /// **'Altitude'** + String get telemetry_altitudeLabel; + + /// No description provided for @telemetry_frequencyLabel. + /// + /// In en, this message translates to: + /// **'Frequency'** + String get telemetry_frequencyLabel; + + /// No description provided for @telemetry_percentageLabel. + /// + /// In en, this message translates to: + /// **'Percentage'** + String get telemetry_percentageLabel; + + /// No description provided for @telemetry_concentrationLabel. + /// + /// In en, this message translates to: + /// **'Concentration'** + String get telemetry_concentrationLabel; + + /// No description provided for @telemetry_powerLabel. + /// + /// In en, this message translates to: + /// **'Power'** + String get telemetry_powerLabel; + + /// No description provided for @telemetry_distanceLabel. + /// + /// In en, this message translates to: + /// **'Distance'** + String get telemetry_distanceLabel; + + /// No description provided for @telemetry_energyLabel. + /// + /// In en, this message translates to: + /// **'Energy'** + String get telemetry_energyLabel; + + /// No description provided for @telemetry_directionLabel. + /// + /// In en, this message translates to: + /// **'Direction'** + String get telemetry_directionLabel; + + /// No description provided for @telemetry_timeLabel. + /// + /// In en, this message translates to: + /// **'Time'** + String get telemetry_timeLabel; + + /// No description provided for @telemetry_gyrometerLabel. + /// + /// In en, this message translates to: + /// **'Gyrometer'** + String get telemetry_gyrometerLabel; + + /// No description provided for @telemetry_colourLabel. + /// + /// In en, this message translates to: + /// **'Colour'** + String get telemetry_colourLabel; + + /// No description provided for @telemetry_gpsLabel. + /// + /// In en, this message translates to: + /// **'GPS'** + String get telemetry_gpsLabel; + + /// No description provided for @telemetry_switchLabel. + /// + /// In en, this message translates to: + /// **'Switch'** + String get telemetry_switchLabel; + + /// No description provided for @telemetry_polylineLabel. + /// + /// In en, this message translates to: + /// **'Polyline'** + String get telemetry_polylineLabel; + + /// No description provided for @telemetry_altitudeValue. + /// + /// In en, this message translates to: + /// **'{meters} m'** + String telemetry_altitudeValue(String meters); + + /// No description provided for @telemetry_frequencyValue. + /// + /// In en, this message translates to: + /// **'{hertz} Hz'** + String telemetry_frequencyValue(String hertz); + + /// No description provided for @telemetry_pressureValue. + /// + /// In en, this message translates to: + /// **'{hpa} hPa'** + String telemetry_pressureValue(String hpa); + + /// No description provided for @telemetry_luminosityValue. + /// + /// In en, this message translates to: + /// **'{lux} lx'** + String telemetry_luminosityValue(String lux); + + /// No description provided for @telemetry_powerValue. + /// + /// In en, this message translates to: + /// **'{watts} W'** + String telemetry_powerValue(String watts); + + /// No description provided for @telemetry_distanceValue. + /// + /// In en, this message translates to: + /// **'{meters} m'** + String telemetry_distanceValue(String meters); + + /// No description provided for @telemetry_energyValue. + /// + /// In en, this message translates to: + /// **'{kilowattHours} kWh'** + String telemetry_energyValue(String kilowattHours); + + /// No description provided for @telemetry_directionValue. + /// + /// In en, this message translates to: + /// **'{degrees}°'** + String telemetry_directionValue(String degrees); + + /// No description provided for @telemetry_concentrationValue. + /// + /// In en, this message translates to: + /// **'{ppm} ppm'** + String telemetry_concentrationValue(String ppm); + + /// No description provided for @telemetry_percentageValue. + /// + /// In en, this message translates to: + /// **'{percent}%'** + String telemetry_percentageValue(String percent); + + /// No description provided for @telemetry_analogValue. + /// + /// In en, this message translates to: + /// **'{value}'** + String telemetry_analogValue(String value); + /// No description provided for @telemetry_autoFetchQuantity. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 89c75f4d..079fc21f 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -3282,6 +3282,133 @@ class AppLocalizationsBg extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Цифров вход'; + + @override + String get telemetry_digitalOutputLabel => 'Цифров изход'; + + @override + String get telemetry_analogInputLabel => 'Аналогов вход'; + + @override + String get telemetry_analogOutputLabel => 'Аналогов изход'; + + @override + String get telemetry_genericLabel => 'Общ сензор'; + + @override + String get telemetry_luminosityLabel => 'Осветеност'; + + @override + String get telemetry_presenceLabel => 'Присъствие'; + + @override + String get telemetry_humidityLabel => 'Влажност'; + + @override + String get telemetry_accelerometerLabel => 'Акселерометър'; + + @override + String get telemetry_pressureLabel => 'Налягане'; + + @override + String get telemetry_altitudeLabel => 'Надморска височина'; + + @override + String get telemetry_frequencyLabel => 'Честота'; + + @override + String get telemetry_percentageLabel => 'Процент'; + + @override + String get telemetry_concentrationLabel => 'Концентрация'; + + @override + String get telemetry_powerLabel => 'Мощност'; + + @override + String get telemetry_distanceLabel => 'Разстояние'; + + @override + String get telemetry_energyLabel => 'Енергия'; + + @override + String get telemetry_directionLabel => 'Посока'; + + @override + String get telemetry_timeLabel => 'Време'; + + @override + String get telemetry_gyrometerLabel => 'Жироскоп'; + + @override + String get telemetry_colourLabel => 'Цвят'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Превключвател'; + + @override + String get telemetry_polylineLabel => 'Полилиния'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Брой заявки'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 844b6066..b23a9c29 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -3288,6 +3288,133 @@ class AppLocalizationsDe extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitaleingang'; + + @override + String get telemetry_digitalOutputLabel => 'Digitalausgang'; + + @override + String get telemetry_analogInputLabel => 'Analogeingang'; + + @override + String get telemetry_analogOutputLabel => 'Analogausgang'; + + @override + String get telemetry_genericLabel => 'Allgemeiner Sensor'; + + @override + String get telemetry_luminosityLabel => 'Helligkeit'; + + @override + String get telemetry_presenceLabel => 'Anwesenheit'; + + @override + String get telemetry_humidityLabel => 'Luftfeuchtigkeit'; + + @override + String get telemetry_accelerometerLabel => 'Beschleunigungsmesser'; + + @override + String get telemetry_pressureLabel => 'Druck'; + + @override + String get telemetry_altitudeLabel => 'Höhe'; + + @override + String get telemetry_frequencyLabel => 'Frequenz'; + + @override + String get telemetry_percentageLabel => 'Prozentsatz'; + + @override + String get telemetry_concentrationLabel => 'Konzentration'; + + @override + String get telemetry_powerLabel => 'Leistung'; + + @override + String get telemetry_distanceLabel => 'Entfernung'; + + @override + String get telemetry_energyLabel => 'Energie'; + + @override + String get telemetry_directionLabel => 'Richtung'; + + @override + String get telemetry_timeLabel => 'Zeit'; + + @override + String get telemetry_gyrometerLabel => 'Gyroskop'; + + @override + String get telemetry_colourLabel => 'Farbe'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Schalter'; + + @override + String get telemetry_polylineLabel => 'Polylinie'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Anzahl der Anfragen'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 6f9e03c6..4e4a8607 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -3219,6 +3219,133 @@ class AppLocalizationsEn extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digital Input'; + + @override + String get telemetry_digitalOutputLabel => 'Digital Output'; + + @override + String get telemetry_analogInputLabel => 'Analog Input'; + + @override + String get telemetry_analogOutputLabel => 'Analog Output'; + + @override + String get telemetry_genericLabel => 'Generic Sensor'; + + @override + String get telemetry_luminosityLabel => 'Luminosity'; + + @override + String get telemetry_presenceLabel => 'Presence'; + + @override + String get telemetry_humidityLabel => 'Humidity'; + + @override + String get telemetry_accelerometerLabel => 'Accelerometer'; + + @override + String get telemetry_pressureLabel => 'Pressure'; + + @override + String get telemetry_altitudeLabel => 'Altitude'; + + @override + String get telemetry_frequencyLabel => 'Frequency'; + + @override + String get telemetry_percentageLabel => 'Percentage'; + + @override + String get telemetry_concentrationLabel => 'Concentration'; + + @override + String get telemetry_powerLabel => 'Power'; + + @override + String get telemetry_distanceLabel => 'Distance'; + + @override + String get telemetry_energyLabel => 'Energy'; + + @override + String get telemetry_directionLabel => 'Direction'; + + @override + String get telemetry_timeLabel => 'Time'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Colour'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Switch'; + + @override + String get telemetry_polylineLabel => 'Polyline'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Requests quantity'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 4c127a23..fb4a7148 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -3276,6 +3276,133 @@ class AppLocalizationsEs extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Entrada digital'; + + @override + String get telemetry_digitalOutputLabel => 'Salida digital'; + + @override + String get telemetry_analogInputLabel => 'Entrada analógica'; + + @override + String get telemetry_analogOutputLabel => 'Salida analógica'; + + @override + String get telemetry_genericLabel => 'Sensor genérico'; + + @override + String get telemetry_luminosityLabel => 'Luminosidad'; + + @override + String get telemetry_presenceLabel => 'Presencia'; + + @override + String get telemetry_humidityLabel => 'Humedad'; + + @override + String get telemetry_accelerometerLabel => 'Acelerómetro'; + + @override + String get telemetry_pressureLabel => 'Presión'; + + @override + String get telemetry_altitudeLabel => 'Altitud'; + + @override + String get telemetry_frequencyLabel => 'Frecuencia'; + + @override + String get telemetry_percentageLabel => 'Porcentaje'; + + @override + String get telemetry_concentrationLabel => 'Concentración'; + + @override + String get telemetry_powerLabel => 'Potencia'; + + @override + String get telemetry_distanceLabel => 'Distancia'; + + @override + String get telemetry_energyLabel => 'Energía'; + + @override + String get telemetry_directionLabel => 'Dirección'; + + @override + String get telemetry_timeLabel => 'Hora'; + + @override + String get telemetry_gyrometerLabel => 'Girómetro'; + + @override + String get telemetry_colourLabel => 'Color'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interruptor'; + + @override + String get telemetry_polylineLabel => 'Polilínea'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Número de solicitudes'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index b5f1c840..ac7edb98 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -3299,6 +3299,133 @@ class AppLocalizationsFr extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Entrée numérique'; + + @override + String get telemetry_digitalOutputLabel => 'Sortie numérique'; + + @override + String get telemetry_analogInputLabel => 'Entrée analogique'; + + @override + String get telemetry_analogOutputLabel => 'Sortie analogique'; + + @override + String get telemetry_genericLabel => 'Capteur générique'; + + @override + String get telemetry_luminosityLabel => 'Luminosité'; + + @override + String get telemetry_presenceLabel => 'Présence'; + + @override + String get telemetry_humidityLabel => 'Humidité'; + + @override + String get telemetry_accelerometerLabel => 'Accéléromètre'; + + @override + String get telemetry_pressureLabel => 'Pression'; + + @override + String get telemetry_altitudeLabel => 'Altitude'; + + @override + String get telemetry_frequencyLabel => 'Fréquence'; + + @override + String get telemetry_percentageLabel => 'Pourcentage'; + + @override + String get telemetry_concentrationLabel => 'Concentration'; + + @override + String get telemetry_powerLabel => 'Puissance'; + + @override + String get telemetry_distanceLabel => 'Distance'; + + @override + String get telemetry_energyLabel => 'Énergie'; + + @override + String get telemetry_directionLabel => 'Direction'; + + @override + String get telemetry_timeLabel => 'Heure'; + + @override + String get telemetry_gyrometerLabel => 'Gyromètre'; + + @override + String get telemetry_colourLabel => 'Couleur'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interrupteur'; + + @override + String get telemetry_polylineLabel => 'Polyligne'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Nombre de requêtes'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index d4f1b2b7..24719c4e 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -3292,6 +3292,133 @@ class AppLocalizationsHu extends AppLocalizations { return '$celsius °C / $fahrenheit °F'; } + @override + String get telemetry_digitalInputLabel => 'Digitális bemenet'; + + @override + String get telemetry_digitalOutputLabel => 'Digitális kimenet'; + + @override + String get telemetry_analogInputLabel => 'Analóg bemenet'; + + @override + String get telemetry_analogOutputLabel => 'Analóg kimenet'; + + @override + String get telemetry_genericLabel => 'Általános érzékelő'; + + @override + String get telemetry_luminosityLabel => 'Fényerő'; + + @override + String get telemetry_presenceLabel => 'Jelenlét'; + + @override + String get telemetry_humidityLabel => 'Páratartalom'; + + @override + String get telemetry_accelerometerLabel => 'Gyorsulásmérő'; + + @override + String get telemetry_pressureLabel => 'Nyomás'; + + @override + String get telemetry_altitudeLabel => 'Magasság'; + + @override + String get telemetry_frequencyLabel => 'Frekvencia'; + + @override + String get telemetry_percentageLabel => 'Százalék'; + + @override + String get telemetry_concentrationLabel => 'Koncentráció'; + + @override + String get telemetry_powerLabel => 'Teljesítmény'; + + @override + String get telemetry_distanceLabel => 'Távolság'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Irány'; + + @override + String get telemetry_timeLabel => 'Idő'; + + @override + String get telemetry_gyrometerLabel => 'Giroszkóp'; + + @override + String get telemetry_colourLabel => 'Szín'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Kapcsoló'; + + @override + String get telemetry_polylineLabel => 'Töröttvonal'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Kérések száma'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 666d3137..c97a6515 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -3282,6 +3282,133 @@ class AppLocalizationsIt extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Ingresso digitale'; + + @override + String get telemetry_digitalOutputLabel => 'Uscita digitale'; + + @override + String get telemetry_analogInputLabel => 'Ingresso analogico'; + + @override + String get telemetry_analogOutputLabel => 'Uscita analogica'; + + @override + String get telemetry_genericLabel => 'Sensore generico'; + + @override + String get telemetry_luminosityLabel => 'Luminosità'; + + @override + String get telemetry_presenceLabel => 'Presenza'; + + @override + String get telemetry_humidityLabel => 'Umidità'; + + @override + String get telemetry_accelerometerLabel => 'Accelerometro'; + + @override + String get telemetry_pressureLabel => 'Pressione'; + + @override + String get telemetry_altitudeLabel => 'Altitudine'; + + @override + String get telemetry_frequencyLabel => 'Frequenza'; + + @override + String get telemetry_percentageLabel => 'Percentuale'; + + @override + String get telemetry_concentrationLabel => 'Concentrazione'; + + @override + String get telemetry_powerLabel => 'Potenza'; + + @override + String get telemetry_distanceLabel => 'Distanza'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Direzione'; + + @override + String get telemetry_timeLabel => 'Ora'; + + @override + String get telemetry_gyrometerLabel => 'Giroscopio'; + + @override + String get telemetry_colourLabel => 'Colore'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interruttore'; + + @override + String get telemetry_polylineLabel => 'Polilinea'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Numero di richieste'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index f2fb24b3..0b3683eb 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -3100,6 +3100,133 @@ class AppLocalizationsJa extends AppLocalizations { return '$celsius℃ / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'デジタル入力'; + + @override + String get telemetry_digitalOutputLabel => 'デジタル出力'; + + @override + String get telemetry_analogInputLabel => 'アナログ入力'; + + @override + String get telemetry_analogOutputLabel => 'アナログ出力'; + + @override + String get telemetry_genericLabel => '汎用センサー'; + + @override + String get telemetry_luminosityLabel => '照度'; + + @override + String get telemetry_presenceLabel => '在室'; + + @override + String get telemetry_humidityLabel => '湿度'; + + @override + String get telemetry_accelerometerLabel => '加速度計'; + + @override + String get telemetry_pressureLabel => '気圧'; + + @override + String get telemetry_altitudeLabel => '高度'; + + @override + String get telemetry_frequencyLabel => '周波数'; + + @override + String get telemetry_percentageLabel => 'パーセント'; + + @override + String get telemetry_concentrationLabel => '濃度'; + + @override + String get telemetry_powerLabel => '電力'; + + @override + String get telemetry_distanceLabel => '距離'; + + @override + String get telemetry_energyLabel => 'エネルギー'; + + @override + String get telemetry_directionLabel => '方向'; + + @override + String get telemetry_timeLabel => '時刻'; + + @override + String get telemetry_gyrometerLabel => 'ジャイロメーター'; + + @override + String get telemetry_colourLabel => '色'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'スイッチ'; + + @override + String get telemetry_polylineLabel => 'ポリライン'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'リクエスト数'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index f35ca675..0a667380 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -3102,6 +3102,133 @@ class AppLocalizationsKo extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => '디지털 입력'; + + @override + String get telemetry_digitalOutputLabel => '디지털 출력'; + + @override + String get telemetry_analogInputLabel => '아날로그 입력'; + + @override + String get telemetry_analogOutputLabel => '아날로그 출력'; + + @override + String get telemetry_genericLabel => '일반 센서'; + + @override + String get telemetry_luminosityLabel => '조도'; + + @override + String get telemetry_presenceLabel => '존재 감지'; + + @override + String get telemetry_humidityLabel => '습도'; + + @override + String get telemetry_accelerometerLabel => '가속도계'; + + @override + String get telemetry_pressureLabel => '압력'; + + @override + String get telemetry_altitudeLabel => '고도'; + + @override + String get telemetry_frequencyLabel => '주파수'; + + @override + String get telemetry_percentageLabel => '백분율'; + + @override + String get telemetry_concentrationLabel => '농도'; + + @override + String get telemetry_powerLabel => '전력'; + + @override + String get telemetry_distanceLabel => '거리'; + + @override + String get telemetry_energyLabel => '에너지'; + + @override + String get telemetry_directionLabel => '방향'; + + @override + String get telemetry_timeLabel => '시간'; + + @override + String get telemetry_gyrometerLabel => '자이로미터'; + + @override + String get telemetry_colourLabel => '색상'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => '스위치'; + + @override + String get telemetry_polylineLabel => '폴리라인'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => '요청 수'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 6a68bd16..da915d17 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -3262,6 +3262,133 @@ class AppLocalizationsNl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitale ingang'; + + @override + String get telemetry_digitalOutputLabel => 'Digitale uitgang'; + + @override + String get telemetry_analogInputLabel => 'Analoge ingang'; + + @override + String get telemetry_analogOutputLabel => 'Analoge uitgang'; + + @override + String get telemetry_genericLabel => 'Algemene sensor'; + + @override + String get telemetry_luminosityLabel => 'Lichtsterkte'; + + @override + String get telemetry_presenceLabel => 'Aanwezigheid'; + + @override + String get telemetry_humidityLabel => 'Luchtvochtigheid'; + + @override + String get telemetry_accelerometerLabel => 'Versnellingsmeter'; + + @override + String get telemetry_pressureLabel => 'Druk'; + + @override + String get telemetry_altitudeLabel => 'Hoogte'; + + @override + String get telemetry_frequencyLabel => 'Frequentie'; + + @override + String get telemetry_percentageLabel => 'Percentage'; + + @override + String get telemetry_concentrationLabel => 'Concentratie'; + + @override + String get telemetry_powerLabel => 'Vermogen'; + + @override + String get telemetry_distanceLabel => 'Afstand'; + + @override + String get telemetry_energyLabel => 'Energie'; + + @override + String get telemetry_directionLabel => 'Richting'; + + @override + String get telemetry_timeLabel => 'Tijd'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Kleur'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Schakelaar'; + + @override + String get telemetry_polylineLabel => 'Polylijn'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Aantal aanvragen'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index aa2c091d..daf68008 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -3294,6 +3294,133 @@ class AppLocalizationsPl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Wejście cyfrowe'; + + @override + String get telemetry_digitalOutputLabel => 'Wyjście cyfrowe'; + + @override + String get telemetry_analogInputLabel => 'Wejście analogowe'; + + @override + String get telemetry_analogOutputLabel => 'Wyjście analogowe'; + + @override + String get telemetry_genericLabel => 'Czujnik ogólny'; + + @override + String get telemetry_luminosityLabel => 'Jasność'; + + @override + String get telemetry_presenceLabel => 'Obecność'; + + @override + String get telemetry_humidityLabel => 'Wilgotność'; + + @override + String get telemetry_accelerometerLabel => 'Akcelerometr'; + + @override + String get telemetry_pressureLabel => 'Ciśnienie'; + + @override + String get telemetry_altitudeLabel => 'Wysokość'; + + @override + String get telemetry_frequencyLabel => 'Częstotliwość'; + + @override + String get telemetry_percentageLabel => 'Procent'; + + @override + String get telemetry_concentrationLabel => 'Stężenie'; + + @override + String get telemetry_powerLabel => 'Moc'; + + @override + String get telemetry_distanceLabel => 'Odległość'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Kierunek'; + + @override + String get telemetry_timeLabel => 'Czas'; + + @override + String get telemetry_gyrometerLabel => 'Żyrometr'; + + @override + String get telemetry_colourLabel => 'Kolor'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Przełącznik'; + + @override + String get telemetry_polylineLabel => 'Polilinia'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Liczba żądań'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 7104c570..011a90d1 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -3275,6 +3275,133 @@ class AppLocalizationsPt extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Entrada digital'; + + @override + String get telemetry_digitalOutputLabel => 'Saída digital'; + + @override + String get telemetry_analogInputLabel => 'Entrada analógica'; + + @override + String get telemetry_analogOutputLabel => 'Saída analógica'; + + @override + String get telemetry_genericLabel => 'Sensor genérico'; + + @override + String get telemetry_luminosityLabel => 'Luminosidade'; + + @override + String get telemetry_presenceLabel => 'Presença'; + + @override + String get telemetry_humidityLabel => 'Humidade'; + + @override + String get telemetry_accelerometerLabel => 'Acelerómetro'; + + @override + String get telemetry_pressureLabel => 'Pressão'; + + @override + String get telemetry_altitudeLabel => 'Altitude'; + + @override + String get telemetry_frequencyLabel => 'Frequência'; + + @override + String get telemetry_percentageLabel => 'Percentagem'; + + @override + String get telemetry_concentrationLabel => 'Concentração'; + + @override + String get telemetry_powerLabel => 'Potência'; + + @override + String get telemetry_distanceLabel => 'Distância'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Direção'; + + @override + String get telemetry_timeLabel => 'Hora'; + + @override + String get telemetry_gyrometerLabel => 'Girómetro'; + + @override + String get telemetry_colourLabel => 'Cor'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Interruptor'; + + @override + String get telemetry_polylineLabel => 'Polilinha'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Número de solicitações'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index adc7f492..dae3a784 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -3283,6 +3283,133 @@ class AppLocalizationsRu extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Цифровой вход'; + + @override + String get telemetry_digitalOutputLabel => 'Цифровой выход'; + + @override + String get telemetry_analogInputLabel => 'Аналоговый вход'; + + @override + String get telemetry_analogOutputLabel => 'Аналоговый выход'; + + @override + String get telemetry_genericLabel => 'Общий датчик'; + + @override + String get telemetry_luminosityLabel => 'Освещённость'; + + @override + String get telemetry_presenceLabel => 'Присутствие'; + + @override + String get telemetry_humidityLabel => 'Влажность'; + + @override + String get telemetry_accelerometerLabel => 'Акселерометр'; + + @override + String get telemetry_pressureLabel => 'Давление'; + + @override + String get telemetry_altitudeLabel => 'Высота'; + + @override + String get telemetry_frequencyLabel => 'Частота'; + + @override + String get telemetry_percentageLabel => 'Процент'; + + @override + String get telemetry_concentrationLabel => 'Концентрация'; + + @override + String get telemetry_powerLabel => 'Мощность'; + + @override + String get telemetry_distanceLabel => 'Расстояние'; + + @override + String get telemetry_energyLabel => 'Энергия'; + + @override + String get telemetry_directionLabel => 'Направление'; + + @override + String get telemetry_timeLabel => 'Время'; + + @override + String get telemetry_gyrometerLabel => 'Гирометр'; + + @override + String get telemetry_colourLabel => 'Цвет'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Переключатель'; + + @override + String get telemetry_polylineLabel => 'Полилиния'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Гц'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa гПа'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux лк'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts Вт'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours кВт⋅ч'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Количество запросов'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 2ba7d16c..937a965f 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -3261,6 +3261,133 @@ class AppLocalizationsSk extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitálny vstup'; + + @override + String get telemetry_digitalOutputLabel => 'Digitálny výstup'; + + @override + String get telemetry_analogInputLabel => 'Analógový vstup'; + + @override + String get telemetry_analogOutputLabel => 'Analógový výstup'; + + @override + String get telemetry_genericLabel => 'Všeobecný senzor'; + + @override + String get telemetry_luminosityLabel => 'Osvetlenie'; + + @override + String get telemetry_presenceLabel => 'Prítomnosť'; + + @override + String get telemetry_humidityLabel => 'Vlhkosť'; + + @override + String get telemetry_accelerometerLabel => 'Akcelerometer'; + + @override + String get telemetry_pressureLabel => 'Tlak'; + + @override + String get telemetry_altitudeLabel => 'Nadmorská výška'; + + @override + String get telemetry_frequencyLabel => 'Frekvencia'; + + @override + String get telemetry_percentageLabel => 'Percento'; + + @override + String get telemetry_concentrationLabel => 'Koncentrácia'; + + @override + String get telemetry_powerLabel => 'Výkon'; + + @override + String get telemetry_distanceLabel => 'Vzdialenosť'; + + @override + String get telemetry_energyLabel => 'Energia'; + + @override + String get telemetry_directionLabel => 'Smer'; + + @override + String get telemetry_timeLabel => 'Čas'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Farba'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Prepínač'; + + @override + String get telemetry_polylineLabel => 'Lomená čiara'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Počet požiadaviek'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index d7a36d54..ebd19ede 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -3256,6 +3256,133 @@ class AppLocalizationsSl extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digitalni vhod'; + + @override + String get telemetry_digitalOutputLabel => 'Digitalni izhod'; + + @override + String get telemetry_analogInputLabel => 'Analogni vhod'; + + @override + String get telemetry_analogOutputLabel => 'Analogni izhod'; + + @override + String get telemetry_genericLabel => 'Splošni senzor'; + + @override + String get telemetry_luminosityLabel => 'Osvetljenost'; + + @override + String get telemetry_presenceLabel => 'Prisotnost'; + + @override + String get telemetry_humidityLabel => 'Vlažnost'; + + @override + String get telemetry_accelerometerLabel => 'Merilnik pospeška'; + + @override + String get telemetry_pressureLabel => 'Tlak'; + + @override + String get telemetry_altitudeLabel => 'Nadmorska višina'; + + @override + String get telemetry_frequencyLabel => 'Frekvenca'; + + @override + String get telemetry_percentageLabel => 'Odstotek'; + + @override + String get telemetry_concentrationLabel => 'Koncentracija'; + + @override + String get telemetry_powerLabel => 'Moč'; + + @override + String get telemetry_distanceLabel => 'Razdalja'; + + @override + String get telemetry_energyLabel => 'Energija'; + + @override + String get telemetry_directionLabel => 'Smer'; + + @override + String get telemetry_timeLabel => 'Čas'; + + @override + String get telemetry_gyrometerLabel => 'Žiroskop'; + + @override + String get telemetry_colourLabel => 'Barva'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Stikalo'; + + @override + String get telemetry_polylineLabel => 'Polilinija'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Število zahtev'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 2dbacd72..1a7ea146 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -3237,6 +3237,133 @@ class AppLocalizationsSv extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Digital ingång'; + + @override + String get telemetry_digitalOutputLabel => 'Digital utgång'; + + @override + String get telemetry_analogInputLabel => 'Analog ingång'; + + @override + String get telemetry_analogOutputLabel => 'Analog utgång'; + + @override + String get telemetry_genericLabel => 'Allmän sensor'; + + @override + String get telemetry_luminosityLabel => 'Ljusstyrka'; + + @override + String get telemetry_presenceLabel => 'Närvaro'; + + @override + String get telemetry_humidityLabel => 'Luftfuktighet'; + + @override + String get telemetry_accelerometerLabel => 'Accelerometer'; + + @override + String get telemetry_pressureLabel => 'Tryck'; + + @override + String get telemetry_altitudeLabel => 'Höjd'; + + @override + String get telemetry_frequencyLabel => 'Frekvens'; + + @override + String get telemetry_percentageLabel => 'Procent'; + + @override + String get telemetry_concentrationLabel => 'Koncentration'; + + @override + String get telemetry_powerLabel => 'Effekt'; + + @override + String get telemetry_distanceLabel => 'Avstånd'; + + @override + String get telemetry_energyLabel => 'Energi'; + + @override + String get telemetry_directionLabel => 'Riktning'; + + @override + String get telemetry_timeLabel => 'Tid'; + + @override + String get telemetry_gyrometerLabel => 'Gyrometer'; + + @override + String get telemetry_colourLabel => 'Färg'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Brytare'; + + @override + String get telemetry_polylineLabel => 'Polylinje'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Antal förfrågningar'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 6067b573..91ebe303 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -3280,6 +3280,133 @@ class AppLocalizationsUk extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => 'Цифровий вхід'; + + @override + String get telemetry_digitalOutputLabel => 'Цифровий вихід'; + + @override + String get telemetry_analogInputLabel => 'Аналоговий вхід'; + + @override + String get telemetry_analogOutputLabel => 'Аналоговий вихід'; + + @override + String get telemetry_genericLabel => 'Загальний датчик'; + + @override + String get telemetry_luminosityLabel => 'Освітленість'; + + @override + String get telemetry_presenceLabel => 'Присутність'; + + @override + String get telemetry_humidityLabel => 'Вологість'; + + @override + String get telemetry_accelerometerLabel => 'Акселерометр'; + + @override + String get telemetry_pressureLabel => 'Тиск'; + + @override + String get telemetry_altitudeLabel => 'Висота'; + + @override + String get telemetry_frequencyLabel => 'Частота'; + + @override + String get telemetry_percentageLabel => 'Відсоток'; + + @override + String get telemetry_concentrationLabel => 'Концентрація'; + + @override + String get telemetry_powerLabel => 'Потужність'; + + @override + String get telemetry_distanceLabel => 'Відстань'; + + @override + String get telemetry_energyLabel => 'Енергія'; + + @override + String get telemetry_directionLabel => 'Напрямок'; + + @override + String get telemetry_timeLabel => 'Час'; + + @override + String get telemetry_gyrometerLabel => 'Гірометр'; + + @override + String get telemetry_colourLabel => 'Колір'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => 'Перемикач'; + + @override + String get telemetry_polylineLabel => 'Полілінія'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Гц'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa гПа'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux лк'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts Вт'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters м'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours кВт⋅год'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => 'Кількість запитів'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index a57f45a7..2fabf8b4 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -3005,6 +3005,133 @@ class AppLocalizationsZh extends AppLocalizations { return '$celsius°C / $fahrenheit°F'; } + @override + String get telemetry_digitalInputLabel => '数字输入'; + + @override + String get telemetry_digitalOutputLabel => '数字输出'; + + @override + String get telemetry_analogInputLabel => '模拟输入'; + + @override + String get telemetry_analogOutputLabel => '模拟输出'; + + @override + String get telemetry_genericLabel => '通用传感器'; + + @override + String get telemetry_luminosityLabel => '照度'; + + @override + String get telemetry_presenceLabel => '存在检测'; + + @override + String get telemetry_humidityLabel => '湿度'; + + @override + String get telemetry_accelerometerLabel => '加速度计'; + + @override + String get telemetry_pressureLabel => '气压'; + + @override + String get telemetry_altitudeLabel => '高度'; + + @override + String get telemetry_frequencyLabel => '频率'; + + @override + String get telemetry_percentageLabel => '百分比'; + + @override + String get telemetry_concentrationLabel => '浓度'; + + @override + String get telemetry_powerLabel => '功率'; + + @override + String get telemetry_distanceLabel => '距离'; + + @override + String get telemetry_energyLabel => '能量'; + + @override + String get telemetry_directionLabel => '方向'; + + @override + String get telemetry_timeLabel => '时间'; + + @override + String get telemetry_gyrometerLabel => '陀螺仪'; + + @override + String get telemetry_colourLabel => '颜色'; + + @override + String get telemetry_gpsLabel => 'GPS'; + + @override + String get telemetry_switchLabel => '开关'; + + @override + String get telemetry_polylineLabel => '折线'; + + @override + String telemetry_altitudeValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_frequencyValue(String hertz) { + return '$hertz Hz'; + } + + @override + String telemetry_pressureValue(String hpa) { + return '$hpa hPa'; + } + + @override + String telemetry_luminosityValue(String lux) { + return '$lux lx'; + } + + @override + String telemetry_powerValue(String watts) { + return '$watts W'; + } + + @override + String telemetry_distanceValue(String meters) { + return '$meters m'; + } + + @override + String telemetry_energyValue(String kilowattHours) { + return '$kilowattHours kWh'; + } + + @override + String telemetry_directionValue(String degrees) { + return '$degrees°'; + } + + @override + String telemetry_concentrationValue(String ppm) { + return '$ppm ppm'; + } + + @override + String telemetry_percentageValue(String percent) { + return '$percent%'; + } + + @override + String telemetry_analogValue(String value) { + return '$value'; + } + @override String get telemetry_autoFetchQuantity => '请求次数'; diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index 151369fe..9f6426df 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Digitale ingang", + "telemetry_digitalOutputLabel": "Digitale uitgang", + "telemetry_analogInputLabel": "Analoge ingang", + "telemetry_analogOutputLabel": "Analoge uitgang", + "telemetry_genericLabel": "Algemene sensor", + "telemetry_luminosityLabel": "Lichtsterkte", + "telemetry_presenceLabel": "Aanwezigheid", + "telemetry_humidityLabel": "Luchtvochtigheid", + "telemetry_accelerometerLabel": "Versnellingsmeter", + "telemetry_pressureLabel": "Druk", + "telemetry_altitudeLabel": "Hoogte", + "telemetry_frequencyLabel": "Frequentie", + "telemetry_percentageLabel": "Percentage", + "telemetry_concentrationLabel": "Concentratie", + "telemetry_powerLabel": "Vermogen", + "telemetry_distanceLabel": "Afstand", + "telemetry_energyLabel": "Energie", + "telemetry_directionLabel": "Richting", + "telemetry_timeLabel": "Tijd", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Kleur", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Schakelaar", + "telemetry_polylineLabel": "Polylijn", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Aantal aanvragen", "telemetry_error": "Kan gegevens niet ophalen", "telemetry_noData": "Geen telemetriedata beschikbaar.", diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 524838d2..cc5e056f 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -1292,6 +1292,41 @@ } } }, + "telemetry_digitalInputLabel": "Wejście cyfrowe", + "telemetry_digitalOutputLabel": "Wyjście cyfrowe", + "telemetry_analogInputLabel": "Wejście analogowe", + "telemetry_analogOutputLabel": "Wyjście analogowe", + "telemetry_genericLabel": "Czujnik ogólny", + "telemetry_luminosityLabel": "Jasność", + "telemetry_presenceLabel": "Obecność", + "telemetry_humidityLabel": "Wilgotność", + "telemetry_accelerometerLabel": "Akcelerometr", + "telemetry_pressureLabel": "Ciśnienie", + "telemetry_altitudeLabel": "Wysokość", + "telemetry_frequencyLabel": "Częstotliwość", + "telemetry_percentageLabel": "Procent", + "telemetry_concentrationLabel": "Stężenie", + "telemetry_powerLabel": "Moc", + "telemetry_distanceLabel": "Odległość", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Kierunek", + "telemetry_timeLabel": "Czas", + "telemetry_gyrometerLabel": "Żyrometr", + "telemetry_colourLabel": "Kolor", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Przełącznik", + "telemetry_polylineLabel": "Polilinia", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Liczba żądań", "telemetry_error": "Nie udało się pobrać danych", "telemetry_noData": "Brak dostępnych danych telemetrycznych.", diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index e0f6a0d1..f6c569b1 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Entrada digital", + "telemetry_digitalOutputLabel": "Saída digital", + "telemetry_analogInputLabel": "Entrada analógica", + "telemetry_analogOutputLabel": "Saída analógica", + "telemetry_genericLabel": "Sensor genérico", + "telemetry_luminosityLabel": "Luminosidade", + "telemetry_presenceLabel": "Presença", + "telemetry_humidityLabel": "Humidade", + "telemetry_accelerometerLabel": "Acelerómetro", + "telemetry_pressureLabel": "Pressão", + "telemetry_altitudeLabel": "Altitude", + "telemetry_frequencyLabel": "Frequência", + "telemetry_percentageLabel": "Percentagem", + "telemetry_concentrationLabel": "Concentração", + "telemetry_powerLabel": "Potência", + "telemetry_distanceLabel": "Distância", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Direção", + "telemetry_timeLabel": "Hora", + "telemetry_gyrometerLabel": "Girómetro", + "telemetry_colourLabel": "Cor", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Interruptor", + "telemetry_polylineLabel": "Polilinha", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Número de solicitações", "telemetry_error": "Não foi possível obter os dados", "telemetry_noData": "Não estão disponíveis dados de telemetria.", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index ef5f1c63..e2f69fc7 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -688,6 +688,41 @@ "telemetry_voltageValue": "{volts}В", "telemetry_currentValue": "{amps}А", "telemetry_temperatureValue": "{celsius}°C / {fahrenheit}°F", + "telemetry_digitalInputLabel": "Цифровой вход", + "telemetry_digitalOutputLabel": "Цифровой выход", + "telemetry_analogInputLabel": "Аналоговый вход", + "telemetry_analogOutputLabel": "Аналоговый выход", + "telemetry_genericLabel": "Общий датчик", + "telemetry_luminosityLabel": "Освещённость", + "telemetry_presenceLabel": "Присутствие", + "telemetry_humidityLabel": "Влажность", + "telemetry_accelerometerLabel": "Акселерометр", + "telemetry_pressureLabel": "Давление", + "telemetry_altitudeLabel": "Высота", + "telemetry_frequencyLabel": "Частота", + "telemetry_percentageLabel": "Процент", + "telemetry_concentrationLabel": "Концентрация", + "telemetry_powerLabel": "Мощность", + "telemetry_distanceLabel": "Расстояние", + "telemetry_energyLabel": "Энергия", + "telemetry_directionLabel": "Направление", + "telemetry_timeLabel": "Время", + "telemetry_gyrometerLabel": "Гирометр", + "telemetry_colourLabel": "Цвет", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Переключатель", + "telemetry_polylineLabel": "Полилиния", + "telemetry_altitudeValue": "{meters} м", + "telemetry_frequencyValue": "{hertz} Гц", + "telemetry_pressureValue": "{hpa} гПа", + "telemetry_luminosityValue": "{lux} лк", + "telemetry_powerValue": "{watts} Вт", + "telemetry_distanceValue": "{meters} м", + "telemetry_energyValue": "{kilowattHours} кВт⋅ч", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Количество запросов", "telemetry_error": "Не удалось получить данные", "neighbors_receivedData": "Полученные данные о соседях", diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index a2b6c2e5..60ea5da8 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Digitálny vstup", + "telemetry_digitalOutputLabel": "Digitálny výstup", + "telemetry_analogInputLabel": "Analógový vstup", + "telemetry_analogOutputLabel": "Analógový výstup", + "telemetry_genericLabel": "Všeobecný senzor", + "telemetry_luminosityLabel": "Osvetlenie", + "telemetry_presenceLabel": "Prítomnosť", + "telemetry_humidityLabel": "Vlhkosť", + "telemetry_accelerometerLabel": "Akcelerometer", + "telemetry_pressureLabel": "Tlak", + "telemetry_altitudeLabel": "Nadmorská výška", + "telemetry_frequencyLabel": "Frekvencia", + "telemetry_percentageLabel": "Percento", + "telemetry_concentrationLabel": "Koncentrácia", + "telemetry_powerLabel": "Výkon", + "telemetry_distanceLabel": "Vzdialenosť", + "telemetry_energyLabel": "Energia", + "telemetry_directionLabel": "Smer", + "telemetry_timeLabel": "Čas", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Farba", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Prepínač", + "telemetry_polylineLabel": "Lomená čiara", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Počet požiadaviek", "telemetry_error": "Nepodarilo sa získať údaje", "telemetry_noData": "Nejsú dostupné žiadne údaje z telemetrie.", diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index dd61e335..3827edde 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Digitalni vhod", + "telemetry_digitalOutputLabel": "Digitalni izhod", + "telemetry_analogInputLabel": "Analogni vhod", + "telemetry_analogOutputLabel": "Analogni izhod", + "telemetry_genericLabel": "Splošni senzor", + "telemetry_luminosityLabel": "Osvetljenost", + "telemetry_presenceLabel": "Prisotnost", + "telemetry_humidityLabel": "Vlažnost", + "telemetry_accelerometerLabel": "Merilnik pospeška", + "telemetry_pressureLabel": "Tlak", + "telemetry_altitudeLabel": "Nadmorska višina", + "telemetry_frequencyLabel": "Frekvenca", + "telemetry_percentageLabel": "Odstotek", + "telemetry_concentrationLabel": "Koncentracija", + "telemetry_powerLabel": "Moč", + "telemetry_distanceLabel": "Razdalja", + "telemetry_energyLabel": "Energija", + "telemetry_directionLabel": "Smer", + "telemetry_timeLabel": "Čas", + "telemetry_gyrometerLabel": "Žiroskop", + "telemetry_colourLabel": "Barva", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Stikalo", + "telemetry_polylineLabel": "Polilinija", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Število zahtev", "telemetry_error": "Podatkov ni bilo mogoče pridobiti", "telemetry_noData": "Niso na voljo podatki o telemetriji.", diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 04bdd9cb..a9a4af4c 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -1282,6 +1282,41 @@ } } }, + "telemetry_digitalInputLabel": "Digital ingång", + "telemetry_digitalOutputLabel": "Digital utgång", + "telemetry_analogInputLabel": "Analog ingång", + "telemetry_analogOutputLabel": "Analog utgång", + "telemetry_genericLabel": "Allmän sensor", + "telemetry_luminosityLabel": "Ljusstyrka", + "telemetry_presenceLabel": "Närvaro", + "telemetry_humidityLabel": "Luftfuktighet", + "telemetry_accelerometerLabel": "Accelerometer", + "telemetry_pressureLabel": "Tryck", + "telemetry_altitudeLabel": "Höjd", + "telemetry_frequencyLabel": "Frekvens", + "telemetry_percentageLabel": "Procent", + "telemetry_concentrationLabel": "Koncentration", + "telemetry_powerLabel": "Effekt", + "telemetry_distanceLabel": "Avstånd", + "telemetry_energyLabel": "Energi", + "telemetry_directionLabel": "Riktning", + "telemetry_timeLabel": "Tid", + "telemetry_gyrometerLabel": "Gyrometer", + "telemetry_colourLabel": "Färg", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Brytare", + "telemetry_polylineLabel": "Polylinje", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Antal förfrågningar", "telemetry_error": "Det gick inte att hämta data", "telemetry_noData": "Inga telemetridata tillgängliga.", diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 487d4675..66e558ea 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -1293,6 +1293,41 @@ } } }, + "telemetry_digitalInputLabel": "Цифровий вхід", + "telemetry_digitalOutputLabel": "Цифровий вихід", + "telemetry_analogInputLabel": "Аналоговий вхід", + "telemetry_analogOutputLabel": "Аналоговий вихід", + "telemetry_genericLabel": "Загальний датчик", + "telemetry_luminosityLabel": "Освітленість", + "telemetry_presenceLabel": "Присутність", + "telemetry_humidityLabel": "Вологість", + "telemetry_accelerometerLabel": "Акселерометр", + "telemetry_pressureLabel": "Тиск", + "telemetry_altitudeLabel": "Висота", + "telemetry_frequencyLabel": "Частота", + "telemetry_percentageLabel": "Відсоток", + "telemetry_concentrationLabel": "Концентрація", + "telemetry_powerLabel": "Потужність", + "telemetry_distanceLabel": "Відстань", + "telemetry_energyLabel": "Енергія", + "telemetry_directionLabel": "Напрямок", + "telemetry_timeLabel": "Час", + "telemetry_gyrometerLabel": "Гірометр", + "telemetry_colourLabel": "Колір", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "Перемикач", + "telemetry_polylineLabel": "Полілінія", + "telemetry_altitudeValue": "{meters} м", + "telemetry_frequencyValue": "{hertz} Гц", + "telemetry_pressureValue": "{hpa} гПа", + "telemetry_luminosityValue": "{lux} лк", + "telemetry_powerValue": "{watts} Вт", + "telemetry_distanceValue": "{meters} м", + "telemetry_energyValue": "{kilowattHours} кВт⋅год", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Кількість запитів", "telemetry_error": "Не вдалося отримати дані", "telemetry_noData": "Дані телеметрії недоступні.", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 8a40bfc0..bf928064 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -1312,6 +1312,41 @@ } } }, + "telemetry_digitalInputLabel": "数字输入", + "telemetry_digitalOutputLabel": "数字输出", + "telemetry_analogInputLabel": "模拟输入", + "telemetry_analogOutputLabel": "模拟输出", + "telemetry_genericLabel": "通用传感器", + "telemetry_luminosityLabel": "照度", + "telemetry_presenceLabel": "存在检测", + "telemetry_humidityLabel": "湿度", + "telemetry_accelerometerLabel": "加速度计", + "telemetry_pressureLabel": "气压", + "telemetry_altitudeLabel": "高度", + "telemetry_frequencyLabel": "频率", + "telemetry_percentageLabel": "百分比", + "telemetry_concentrationLabel": "浓度", + "telemetry_powerLabel": "功率", + "telemetry_distanceLabel": "距离", + "telemetry_energyLabel": "能量", + "telemetry_directionLabel": "方向", + "telemetry_timeLabel": "时间", + "telemetry_gyrometerLabel": "陀螺仪", + "telemetry_colourLabel": "颜色", + "telemetry_gpsLabel": "GPS", + "telemetry_switchLabel": "开关", + "telemetry_polylineLabel": "折线", + "telemetry_altitudeValue": "{meters} m", + "telemetry_frequencyValue": "{hertz} Hz", + "telemetry_pressureValue": "{hpa} hPa", + "telemetry_luminosityValue": "{lux} lx", + "telemetry_powerValue": "{watts} W", + "telemetry_distanceValue": "{meters} m", + "telemetry_energyValue": "{kilowattHours} kWh", + "telemetry_directionValue": "{degrees}°", + "telemetry_concentrationValue": "{ppm} ppm", + "telemetry_percentageValue": "{percent}%", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "请求次数", "telemetry_error": "无法获取数据", "telemetry_noData": "暂无遥测数据", diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index d28cbcef..aafa8c51 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -210,7 +210,7 @@ class _TelemetryScreenState extends State { if (widget.contact.type != advTypeChat) { frame = buildSendBinaryReq( widget.contact.publicKey, - payload: Uint8List.fromList([reqTypeGetTelemetry]), + payload: buildTelemetryBinaryPayload(), ); } else { frame = buildSendTelemetryReq(widget.contact.publicKey); @@ -466,7 +466,6 @@ class _TelemetryScreenState extends State { int channel, bool isImperialUnits, ) { - final l10n = context.l10n; return Card( child: Padding( padding: const EdgeInsets.all(16), @@ -491,41 +490,164 @@ class _TelemetryScreenState extends State { ), const Divider(), for (final entry in channelData.entries) - if (entry.key == 'voltage' && channel == 1) - _buildInfoRow( - l10n.telemetry_batteryLabel, - _batteryText(entry.value), - ) - else if (entry.key == 'voltage') - _buildInfoRow( - l10n.telemetry_voltageLabel, - l10n.telemetry_voltageValue(entry.value.toString()), - ) - else if (entry.key == 'temperature' && channel == 1) - _buildInfoRow( - l10n.telemetry_mcuTemperatureLabel, - _temperatureText(entry.value, isImperialUnits), - ) - else if (entry.key == 'temperature') - _buildInfoRow( - l10n.telemetry_temperatureLabel, - _temperatureText(entry.value, isImperialUnits), - ) - else if (entry.key == 'current' && channel == 1) - _buildInfoRow( - l10n.telemetry_currentLabel, - l10n.telemetry_currentValue(entry.value.toString()), - ) - else if (entry.key == 'gps') - _buildGpsInfo(entry.value) - else - _buildInfoRow(entry.key, entry.value.toString()), + _buildTelemetryField(entry, channel, isImperialUnits), ], ), ), ); } + Widget _buildTelemetryField( + MapEntry entry, + int channel, + bool isImperialUnits, + ) { + if (entry.key == 'gps') { + return _buildGpsInfo(entry.value); + } + + final display = _formatTelemetryField( + entry.key, + entry.value, + channel, + isImperialUnits, + ); + return _buildInfoRow(display.label, display.value); + } + + _TelemetryFieldDisplay _formatTelemetryField( + String key, + dynamic value, + int channel, + bool isImperialUnits, + ) { + final l10n = context.l10n; + final text = _telemetryValueText(value); + + switch (key) { + case 'digitalInput': + return _TelemetryFieldDisplay(l10n.telemetry_digitalInputLabel, text); + case 'digitalOutput': + return _TelemetryFieldDisplay(l10n.telemetry_digitalOutputLabel, text); + case 'analogInput': + return _TelemetryFieldDisplay( + l10n.telemetry_analogInputLabel, + l10n.telemetry_analogValue(text), + ); + case 'analogOutput': + return _TelemetryFieldDisplay( + l10n.telemetry_analogOutputLabel, + l10n.telemetry_analogValue(text), + ); + case 'generic': + return _TelemetryFieldDisplay(l10n.telemetry_genericLabel, text); + case 'luminosity': + return _TelemetryFieldDisplay( + l10n.telemetry_luminosityLabel, + l10n.telemetry_luminosityValue(text), + ); + case 'presence': + return _TelemetryFieldDisplay(l10n.telemetry_presenceLabel, text); + case 'temperature': + return _TelemetryFieldDisplay( + channel == 1 + ? l10n.telemetry_mcuTemperatureLabel + : l10n.telemetry_temperatureLabel, + _temperatureText(value, isImperialUnits), + ); + case 'humidity': + return _TelemetryFieldDisplay(l10n.telemetry_humidityLabel, text); + case 'accelerometer': + return _TelemetryFieldDisplay( + l10n.telemetry_accelerometerLabel, + _telemetryAxisText(value), + ); + case 'pressure': + return _TelemetryFieldDisplay( + l10n.telemetry_pressureLabel, + l10n.telemetry_pressureValue(text), + ); + case 'altitude': + return _TelemetryFieldDisplay( + l10n.telemetry_altitudeLabel, + l10n.telemetry_altitudeValue(text), + ); + case 'voltage': + return _TelemetryFieldDisplay( + channel == 1 + ? l10n.telemetry_batteryLabel + : l10n.telemetry_voltageLabel, + channel == 1 + ? _batteryText(value) + : l10n.telemetry_voltageValue(text), + ); + case 'current': + return _TelemetryFieldDisplay( + l10n.telemetry_currentLabel, + l10n.telemetry_currentValue(text), + ); + case 'frequency': + return _TelemetryFieldDisplay( + l10n.telemetry_frequencyLabel, + l10n.telemetry_frequencyValue(text), + ); + case 'percentage': + return _TelemetryFieldDisplay( + l10n.telemetry_percentageLabel, + l10n.telemetry_percentageValue(text), + ); + case 'concentration': + return _TelemetryFieldDisplay( + l10n.telemetry_concentrationLabel, + l10n.telemetry_concentrationValue(text), + ); + case 'power': + return _TelemetryFieldDisplay( + l10n.telemetry_powerLabel, + l10n.telemetry_powerValue(text), + ); + case 'distance': + return _TelemetryFieldDisplay( + l10n.telemetry_distanceLabel, + l10n.telemetry_distanceValue(text), + ); + case 'energy': + return _TelemetryFieldDisplay( + l10n.telemetry_energyLabel, + l10n.telemetry_energyValue(text), + ); + case 'direction': + return _TelemetryFieldDisplay( + l10n.telemetry_directionLabel, + l10n.telemetry_directionValue(text), + ); + case 'time': + return _TelemetryFieldDisplay( + l10n.telemetry_timeLabel, + _telemetryTimeText(value), + ); + case 'gyrometer': + return _TelemetryFieldDisplay( + l10n.telemetry_gyrometerLabel, + _telemetryAxisText(value), + ); + case 'colour': + return _TelemetryFieldDisplay( + l10n.telemetry_colourLabel, + _telemetryColorText(value), + ); + case 'switch': + return _TelemetryFieldDisplay(l10n.telemetry_switchLabel, text); + case 'polyline': + return _TelemetryFieldDisplay( + l10n.telemetry_polylineLabel, + _telemetryMapText(value), + ); + default: + return _TelemetryFieldDisplay(key, text); + } + } + Widget _buildAutoRefreshCard() { final l10n = context.l10n; final counterText = _autoRefreshCounterText(); @@ -762,7 +884,7 @@ class _TelemetryScreenState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildInfoRow('gps', gpsText), + _buildInfoRow(context.l10n.telemetry_gpsLabel, gpsText), if (isValidPosition) TelemetryLocationMap( // The map renders only after bounds validation, keeping malformed @@ -794,6 +916,53 @@ class _TelemetryScreenState extends State { longitude <= 180.0; } + String _telemetryValueText(dynamic value) { + if (value == null) return context.l10n.common_notAvailable; + if (value is double) { + return value.toStringAsFixed(value.truncateToDouble() == value ? 0 : 2); + } + if (value is num) { + return value.toString(); + } + return value.toString(); + } + + String _telemetryAxisText(dynamic value) { + if (value is! Map) return _telemetryValueText(value); + final x = _telemetryValueText(value['x']); + final y = _telemetryValueText(value['y']); + final z = _telemetryValueText(value['z']); + return 'X: $x, Y: $y, Z: $z'; + } + + String _telemetryColorText(dynamic value) { + if (value is! Map) return _telemetryValueText(value); + final red = _telemetryValueText(value['red']); + final green = _telemetryValueText(value['green']); + final blue = _telemetryValueText(value['blue']); + return 'R: $red, G: $green, B: $blue'; + } + + String _telemetryMapText(dynamic value) { + if (value is! Map) return _telemetryValueText(value); + return value.entries + .map((entry) => '${entry.key}: ${entry.value}') + .join(', '); + } + + String _telemetryTimeText(dynamic value) { + if (value is! num || value <= 0) return _telemetryValueText(value); + final dateTime = DateTime.fromMillisecondsSinceEpoch( + value.toInt() * 1000, + isUtc: true, + ).toLocal(); + final localizations = MaterialLocalizations.of(context); + final time = localizations.formatTimeOfDay( + TimeOfDay.fromDateTime(dateTime), + ); + return '${localizations.formatFullDate(dateTime)} $time'; + } + Widget _buildInfoRow(String label, String value) { return Padding( padding: const EdgeInsets.symmetric(vertical: 6), @@ -862,3 +1031,10 @@ class _TelemetryScreenState extends State { return '${tempC.toStringAsFixed(1)}°C'; } } + +class _TelemetryFieldDisplay { + final String label; + final String value; + + const _TelemetryFieldDisplay(this.label, this.value); +} From 9ada4ea601513a4f49d1508a99c7307f08418395 Mon Sep 17 00:00:00 2001 From: ericz Date: Wed, 20 May 2026 21:24:54 +0200 Subject: [PATCH 16/36] add toggle for autmatically translated messages for notification and chat or manual translation on message action. Due to heavy battery usage. --- lib/connector/meshcore_connector.dart | 62 ++++++++++++++++++-------- lib/l10n/app_bg.arb | 3 ++ lib/l10n/app_de.arb | 3 ++ lib/l10n/app_en.arb | 3 ++ lib/l10n/app_es.arb | 3 ++ lib/l10n/app_fr.arb | 3 ++ lib/l10n/app_hu.arb | 3 ++ lib/l10n/app_it.arb | 3 ++ lib/l10n/app_ja.arb | 3 ++ lib/l10n/app_ko.arb | 3 ++ lib/l10n/app_localizations.dart | 18 ++++++++ lib/l10n/app_localizations_bg.dart | 10 +++++ 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 | 10 +++++ lib/l10n/app_localizations_it.dart | 11 +++++ lib/l10n/app_localizations_ja.dart | 10 +++++ lib/l10n/app_localizations_ko.dart | 10 +++++ lib/l10n/app_localizations_nl.dart | 10 +++++ 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 | 10 +++++ lib/l10n/app_localizations_sl.dart | 10 +++++ lib/l10n/app_localizations_sv.dart | 11 +++++ lib/l10n/app_localizations_uk.dart | 11 +++++ lib/l10n/app_localizations_zh.dart | 9 ++++ lib/l10n/app_nl.arb | 3 ++ lib/l10n/app_pl.arb | 3 ++ lib/l10n/app_pt.arb | 3 ++ lib/l10n/app_ru.arb | 3 ++ lib/l10n/app_sk.arb | 3 ++ lib/l10n/app_sl.arb | 3 ++ lib/l10n/app_sv.arb | 3 ++ lib/l10n/app_uk.arb | 3 ++ lib/l10n/app_zh.arb | 3 ++ lib/models/app_settings.dart | 8 ++++ lib/screens/app_settings_screen.dart | 39 ++++++++++++++-- lib/screens/channel_chat_screen.dart | 28 ++++++++++++ lib/screens/chat_screen.dart | 27 +++++++++++ lib/services/app_settings_service.dart | 6 +++ lib/services/translation_service.dart | 17 ++++++- 44 files changed, 424 insertions(+), 24 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 982f7e75..7eca6e88 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -1072,18 +1072,30 @@ class MeshCoreConnector extends ChangeNotifier { } } - Future _translateIncomingContactMessage( + Future translateContactMessage( String contactKeyHex, - Message message, - ) async { + Message message, { + bool manualTranslation = false, + }) async { try { + if (message.translatedText?.trim().isNotEmpty == true || + (!manualTranslation && + message.translationStatus != MessageTranslationStatus.none)) { + return null; + } final service = _translationService; if (service == null || - !service.shouldTranslateIncoming( - text: message.text, - isCli: message.isCli, - isOutgoing: message.isOutgoing, - )) { + !(manualTranslation + ? service.canTranslateIncoming( + text: message.text, + isCli: message.isCli, + isOutgoing: message.isOutgoing, + ) + : service.shouldAutoTranslateIncoming( + text: message.text, + isCli: message.isCli, + isOutgoing: message.isOutgoing, + ))) { return null; } final targetLanguageCode = service.resolvedIncomingLanguageCode( @@ -1116,18 +1128,30 @@ class MeshCoreConnector extends ChangeNotifier { } } - Future _translateIncomingChannelMessage( + Future translateChannelMessage( int channelIndex, - ChannelMessage message, - ) async { + ChannelMessage message, { + bool manualTranslation = false, + }) async { try { + if (message.translatedText?.trim().isNotEmpty == true || + (!manualTranslation && + message.translationStatus != MessageTranslationStatus.none)) { + return null; + } final service = _translationService; if (service == null || - !service.shouldTranslateIncoming( - text: message.text, - isCli: false, - isOutgoing: message.isOutgoing, - )) { + !(manualTranslation + ? service.canTranslateIncoming( + text: message.text, + isCli: false, + isOutgoing: message.isOutgoing, + ) + : service.shouldAutoTranslateIncoming( + text: message.text, + isCli: false, + isOutgoing: message.isOutgoing, + ))) { return null; } final targetLanguageCode = service.resolvedIncomingLanguageCode( @@ -4421,7 +4445,7 @@ class MeshCoreConnector extends ChangeNotifier { final msg = message; // capture for closure final c = contact; // capture contact reference unawaited(() async { - final translationResult = await _translateIncomingContactMessage( + final translationResult = await translateContactMessage( msg.senderKeyHex, msg, ); @@ -4784,7 +4808,7 @@ class MeshCoreConnector extends ChangeNotifier { if (isNew && !message.isOutgoing) { final msg = message; // capture for closure unawaited(() async { - final translationResult = await _translateIncomingChannelMessage( + final translationResult = await translateChannelMessage( msg.channelIndex!, msg, ); @@ -4867,7 +4891,7 @@ class MeshCoreConnector extends ChangeNotifier { if (isNew) { // Run translation + notification asynchronously to avoid blocking unawaited(() async { - final translationResult = await _translateIncomingChannelMessage( + final translationResult = await translateChannelMessage( channel.index, message, ); diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index 45536cf6..c70ca78d 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -2099,6 +2099,9 @@ "translation_composerTitle": "Преведете преди да изпратите", "translation_enableSubtitle": "Превеждайте входящите съобщения и позволявайте предварително превеждане преди изпращане.", "translation_composerSubtitle": "Контролира началния статус на иконата за превод, създадена от композитора.", + "translation_autoIncomingTitle": "Автоматичен превод на съобщения", + "translation_autoIncomingSubtitle": "Превежда автоматично съобщенията за известия, както и за чатове или канали.", + "translation_translateMessage": "Преведи съобщението", "translation_targetLanguage": "Целеви език", "translation_useAppLanguage": "Използвайте езика на приложението", "translation_downloadedModelLabel": "Изтегнат модел", diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 7f491d4f..4a9be70b 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -2127,6 +2127,9 @@ "translation_enableSubtitle": "Nachrichten empfangen und übersetzen sowie die Möglichkeit bieten, Nachrichten vor dem Versenden zu übersetzen.", "translation_enableTitle": "Aktivieren Sie die Übersetzung", "translation_composerSubtitle": "Steuert den Standardzustand des Icons für die Übersetzung des Komponisten.", + "translation_autoIncomingTitle": "Nachrichten automatisch übersetzen", + "translation_autoIncomingSubtitle": "Übersetzt Nachrichten für Benachrichtigungen sowie für Chats oder Kanäle automatisch.", + "translation_translateMessage": "Nachricht übersetzen", "translation_targetLanguage": "Zielsprache", "translation_useAppLanguage": "Verwenden Sie die App-Sprache", "translation_downloadedModelLabel": "Heruntergeladenes Modell", diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 456fab56..b3c5774a 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -2288,6 +2288,9 @@ "translation_enableSubtitle": "Translate incoming messages and allow pre-send translation.", "translation_composerTitle": "Translate before sending", "translation_composerSubtitle": "Controls the default state of the composer translation icon.", + "translation_autoIncomingTitle": "Auto-translate incoming messages", + "translation_autoIncomingSubtitle": "Translates Messages for notification and for chat or channel automatically.", + "translation_translateMessage": "Translate message", "translation_targetLanguage": "Target language", "translation_useAppLanguage": "Use app language", "translation_downloadedModelLabel": "Downloaded model", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index d4cf27da..b85e7652 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -2128,6 +2128,9 @@ "translation_enableTitle": "Habilitar la traducción", "translation_composerTitle": "Traducir antes de enviar", "translation_composerSubtitle": "Controla el estado predeterminado del icono de traducción del compositor.", + "translation_autoIncomingTitle": "Traducir mensajes automáticamente", + "translation_autoIncomingSubtitle": "Traduce mensajes para notificaciones y para chats o canales automáticamente.", + "translation_translateMessage": "Traducir mensaje", "translation_targetLanguage": "Idioma de destino", "translation_useAppLanguage": "Utilizar el idioma de la aplicación", "translation_downloadedModelLabel": "Modelo descargado", diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 7817c20d..fd6b53e0 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -2099,6 +2099,9 @@ "translation_title": "Traduction", "translation_enableSubtitle": "Traduire les messages entrants et permettre la traduction avant l'envoi.", "translation_composerSubtitle": "Contrôle l'état par défaut de l'icône de traduction du composant.", + "translation_autoIncomingTitle": "Traduire automatiquement les messages", + "translation_autoIncomingSubtitle": "Traduit automatiquement les messages pour les notifications et pour les discussions ou les canaux.", + "translation_translateMessage": "Traduire le message", "translation_targetLanguage": "Langue cible", "translation_useAppLanguage": "Utiliser la langue de l'application", "translation_downloadedModelLabel": "Modèle téléchargé", diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index 97426183..d41c62f2 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -2137,6 +2137,9 @@ "translation_enableSubtitle": "Fordítsa az érkező üzeneteket, és lehetővé tegye a küldés előtti fordítást.", "translation_composerTitle": "Fordítsa el, mielőtt elküldi", "translation_composerSubtitle": "Ellenőrzi a zeneszerző fordítási ikon alapértékét.", + "translation_autoIncomingTitle": "Üzenetek automatikus fordítása", + "translation_autoIncomingSubtitle": "Automatikusan lefordítja az üzeneteket az értesítésekhez, valamint a csevegésekhez vagy csatornákhoz.", + "translation_translateMessage": "Üzenet fordítása", "translation_targetLanguage": "Célnyelv", "translation_useAppLanguage": "Használja az alkalmazás nyelvének beállítását.", "translation_downloadedModelLabel": "Letöltött modell", diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index 664bceef..e60cfc4a 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -2100,6 +2100,9 @@ "translation_enableTitle": "Abilitare la traduzione", "translation_title": "Traduzione", "translation_composerSubtitle": "Controlla lo stato predefinito dell'icona di traduzione del compositore.", + "translation_autoIncomingTitle": "Traduci automaticamente i messaggi", + "translation_autoIncomingSubtitle": "Traduce automaticamente i messaggi per le notifiche e per le chat o i canali.", + "translation_translateMessage": "Traduci messaggio", "translation_targetLanguage": "Lingua di destinazione", "translation_useAppLanguage": "Utilizza la lingua dell'app", "translation_downloadedModelLabel": "Modello scaricato", diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 9d2cef21..c68fc98d 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -2137,6 +2137,9 @@ "translation_composerTitle": "送信する前に翻訳する", "translation_enableTitle": "翻訳機能を有効にする", "translation_composerSubtitle": "作曲家翻訳アイコンのデフォルト状態を制御する。", + "translation_autoIncomingTitle": "メッセージを自動翻訳", + "translation_autoIncomingSubtitle": "通知やチャット、チャンネルのメッセージを自動的に翻訳します。", + "translation_translateMessage": "メッセージを翻訳", "translation_targetLanguage": "翻訳対象言語", "translation_useAppLanguage": "アプリの言語設定", "translation_downloadedModelLabel": "ダウンロードしたモデル", diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index d778429b..7418068c 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -2137,6 +2137,9 @@ "translation_enableTitle": "번역 기능 활성화", "translation_composerTitle": "보내기 전에 번역", "translation_composerSubtitle": "컴포저 번역 아이콘의 기본 상태를 제어합니다.", + "translation_autoIncomingTitle": "메시지 자동 번역", + "translation_autoIncomingSubtitle": "알림과 채팅 또는 채널의 메시지를 자동으로 번역합니다.", + "translation_translateMessage": "메시지 번역", "translation_targetLanguage": "목표 언어", "translation_useAppLanguage": "앱 언어 사용", "translation_downloadedModelLabel": "다운로드한 모델", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 159d755c..b8c6558c 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -7114,6 +7114,24 @@ abstract class AppLocalizations { /// **'Controls the default state of the composer translation icon.'** String get translation_composerSubtitle; + /// No description provided for @translation_autoIncomingTitle. + /// + /// In en, this message translates to: + /// **'Auto-translate incoming messages'** + String get translation_autoIncomingTitle; + + /// No description provided for @translation_autoIncomingSubtitle. + /// + /// In en, this message translates to: + /// **'Translates Messages for notification and for chat or channel automatically.'** + String get translation_autoIncomingSubtitle; + + /// No description provided for @translation_translateMessage. + /// + /// In en, this message translates to: + /// **'Translate message'** + String get translation_translateMessage; + /// No description provided for @translation_targetLanguage. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 409803b2..19883f16 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -4161,6 +4161,16 @@ class AppLocalizationsBg extends AppLocalizations { String get translation_composerSubtitle => 'Контролира началния статус на иконата за превод, създадена от композитора.'; + @override + String get translation_autoIncomingTitle => 'Автоматичен превод на съобщения'; + + @override + String get translation_autoIncomingSubtitle => + 'Превежда автоматично съобщенията за известия, както и за чатове или канали.'; + + @override + String get translation_translateMessage => 'Преведи съобщението'; + @override String get translation_targetLanguage => 'Целеви език'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 9f06906d..20d64c39 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -4176,6 +4176,17 @@ class AppLocalizationsDe extends AppLocalizations { String get translation_composerSubtitle => 'Steuert den Standardzustand des Icons für die Übersetzung des Komponisten.'; + @override + String get translation_autoIncomingTitle => + 'Nachrichten automatisch übersetzen'; + + @override + String get translation_autoIncomingSubtitle => + 'Übersetzt Nachrichten für Benachrichtigungen sowie für Chats oder Kanäle automatisch.'; + + @override + String get translation_translateMessage => 'Nachricht übersetzen'; + @override String get translation_targetLanguage => 'Zielsprache'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 6def06b7..5da877e1 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -4085,6 +4085,17 @@ class AppLocalizationsEn extends AppLocalizations { String get translation_composerSubtitle => 'Controls the default state of the composer translation icon.'; + @override + String get translation_autoIncomingTitle => + 'Auto-translate incoming messages'; + + @override + String get translation_autoIncomingSubtitle => + 'Translates Messages for notification and for chat or channel automatically.'; + + @override + String get translation_translateMessage => 'Translate message'; + @override String get translation_targetLanguage => 'Target language'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index bb4f40e8..f55bb1c7 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -4163,6 +4163,17 @@ class AppLocalizationsEs extends AppLocalizations { String get translation_composerSubtitle => 'Controla el estado predeterminado del icono de traducción del compositor.'; + @override + String get translation_autoIncomingTitle => + 'Traducir mensajes automáticamente'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduce mensajes para notificaciones y para chats o canales automáticamente.'; + + @override + String get translation_translateMessage => 'Traducir mensaje'; + @override String get translation_targetLanguage => 'Idioma de destino'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 44e40657..a1770dc3 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -4193,6 +4193,17 @@ class AppLocalizationsFr extends AppLocalizations { String get translation_composerSubtitle => 'Contrôle l\'état par défaut de l\'icône de traduction du composant.'; + @override + String get translation_autoIncomingTitle => + 'Traduire automatiquement les messages'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduit automatiquement les messages pour les notifications et pour les discussions ou les canaux.'; + + @override + String get translation_translateMessage => 'Traduire le message'; + @override String get translation_targetLanguage => 'Langue cible'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 298a6fd6..ee41febf 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -4181,6 +4181,16 @@ class AppLocalizationsHu extends AppLocalizations { String get translation_composerSubtitle => 'Ellenőrzi a zeneszerző fordítási ikon alapértékét.'; + @override + String get translation_autoIncomingTitle => 'Üzenetek automatikus fordítása'; + + @override + String get translation_autoIncomingSubtitle => + 'Automatikusan lefordítja az üzeneteket az értesítésekhez, valamint a csevegésekhez vagy csatornákhoz.'; + + @override + String get translation_translateMessage => 'Üzenet fordítása'; + @override String get translation_targetLanguage => 'Célnyelv'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index e3f7ee58..55804809 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -4169,6 +4169,17 @@ class AppLocalizationsIt extends AppLocalizations { String get translation_composerSubtitle => 'Controlla lo stato predefinito dell\'icona di traduzione del compositore.'; + @override + String get translation_autoIncomingTitle => + 'Traduci automaticamente i messaggi'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduce automaticamente i messaggi per le notifiche e per le chat o i canali.'; + + @override + String get translation_translateMessage => 'Traduci messaggio'; + @override String get translation_targetLanguage => 'Lingua di destinazione'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 263a906e..844f3b66 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -3941,6 +3941,16 @@ class AppLocalizationsJa extends AppLocalizations { @override String get translation_composerSubtitle => '作曲家翻訳アイコンのデフォルト状態を制御する。'; + @override + String get translation_autoIncomingTitle => 'メッセージを自動翻訳'; + + @override + String get translation_autoIncomingSubtitle => + '通知やチャット、チャンネルのメッセージを自動的に翻訳します。'; + + @override + String get translation_translateMessage => 'メッセージを翻訳'; + @override String get translation_targetLanguage => '翻訳対象言語'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index f9c0d760..1bc02940 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -3942,6 +3942,16 @@ class AppLocalizationsKo extends AppLocalizations { @override String get translation_composerSubtitle => '컴포저 번역 아이콘의 기본 상태를 제어합니다.'; + @override + String get translation_autoIncomingTitle => '메시지 자동 번역'; + + @override + String get translation_autoIncomingSubtitle => + '알림과 채팅 또는 채널의 메시지를 자동으로 번역합니다.'; + + @override + String get translation_translateMessage => '메시지 번역'; + @override String get translation_targetLanguage => '목표 언어'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index ad140bf3..cf78b5e7 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -4146,6 +4146,16 @@ class AppLocalizationsNl extends AppLocalizations { String get translation_composerSubtitle => 'Stelt de standaardstatus van het pictogram voor de vertaling van de componist in.'; + @override + String get translation_autoIncomingTitle => 'Berichten automatisch vertalen'; + + @override + String get translation_autoIncomingSubtitle => + 'Vertaalt berichten automatisch voor meldingen en voor chats of kanalen.'; + + @override + String get translation_translateMessage => 'Bericht vertalen'; + @override String get translation_targetLanguage => 'Doeltaal'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 6c7c3696..e4b33f9f 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -4184,6 +4184,17 @@ class AppLocalizationsPl extends AppLocalizations { String get translation_composerSubtitle => 'Kontroluje domyślny stan ikony tłumaczenia w edytorze.'; + @override + String get translation_autoIncomingTitle => + 'Automatycznie tłumacz wiadomości'; + + @override + String get translation_autoIncomingSubtitle => + 'Automatycznie tłumaczy wiadomości do powiadomień oraz do czatów lub kanałów.'; + + @override + String get translation_translateMessage => 'Przetłumacz wiadomość'; + @override String get translation_targetLanguage => 'Język docelowy'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index e6fd49e3..f0ad632b 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -4159,6 +4159,17 @@ class AppLocalizationsPt extends AppLocalizations { String get translation_composerSubtitle => 'Controla o estado padrão do ícone de tradução do compositor.'; + @override + String get translation_autoIncomingTitle => + 'Traduzir mensagens automaticamente'; + + @override + String get translation_autoIncomingSubtitle => + 'Traduz automaticamente mensagens para notificações e para chats ou canais.'; + + @override + String get translation_translateMessage => 'Traduzir mensagem'; + @override String get translation_targetLanguage => 'Língua-alvo'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 25452003..46ef46b6 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -4177,6 +4177,17 @@ class AppLocalizationsRu extends AppLocalizations { String get translation_composerSubtitle => 'Управляет исходным состоянием значка перевода, предоставляемого редактором.'; + @override + String get translation_autoIncomingTitle => + 'Автоматически переводить сообщения'; + + @override + String get translation_autoIncomingSubtitle => + 'Автоматически переводит сообщения для уведомлений, а также для чатов и каналов.'; + + @override + String get translation_translateMessage => 'Перевести сообщение'; + @override String get translation_targetLanguage => 'Целевой язык'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 91461385..29a0b8a9 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -4141,6 +4141,16 @@ class AppLocalizationsSk extends AppLocalizations { String get translation_composerSubtitle => 'Riadi výchoce stav ikony pre preklad, ktorú používa program.'; + @override + String get translation_autoIncomingTitle => 'Automaticky prekladať správy'; + + @override + String get translation_autoIncomingSubtitle => + 'Automaticky prekladá správy pre upozornenia aj pre čet alebo kanál.'; + + @override + String get translation_translateMessage => 'Preložiť správu'; + @override String get translation_targetLanguage => 'Cieľový jazyk'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index 48103647..125aa604 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -4139,6 +4139,16 @@ class AppLocalizationsSl extends AppLocalizations { String get translation_composerSubtitle => 'Ureja privzeto stanje ikone za prevod, ki jo uporablja avtor.'; + @override + String get translation_autoIncomingTitle => 'Samodejno prevajaj sporočila'; + + @override + String get translation_autoIncomingSubtitle => + 'Samodejno prevaja sporočila za obvestila ter za klepete ali kanale.'; + + @override + String get translation_translateMessage => 'Prevedi sporočilo'; + @override String get translation_targetLanguage => 'Ciljna jezika'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 7453c18f..4bf43719 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -4113,6 +4113,17 @@ class AppLocalizationsSv extends AppLocalizations { String get translation_composerSubtitle => 'Styr standardtillståndet för kompositorns översättningsikon.'; + @override + String get translation_autoIncomingTitle => + 'Översätt meddelanden automatiskt'; + + @override + String get translation_autoIncomingSubtitle => + 'Översätter meddelanden automatiskt för aviseringar och för chattar eller kanaler.'; + + @override + String get translation_translateMessage => 'Översätt meddelande'; + @override String get translation_targetLanguage => 'Målmedvetet språk'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 9c30fd8e..58f381cf 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -4176,6 +4176,17 @@ class AppLocalizationsUk extends AppLocalizations { String get translation_composerSubtitle => 'Контролює стан ікон перекладу, який використовується за замовчуванням.'; + @override + String get translation_autoIncomingTitle => + 'Автоматично перекладати повідомлення'; + + @override + String get translation_autoIncomingSubtitle => + 'Автоматично перекладає повідомлення для сповіщень, а також для чатів і каналів.'; + + @override + String get translation_translateMessage => 'Перекласти повідомлення'; + @override String get translation_targetLanguage => 'Цільова мова'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index d2304a66..ec03b8e8 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -3816,6 +3816,15 @@ class AppLocalizationsZh extends AppLocalizations { @override String get translation_composerSubtitle => '控制作曲家翻译图标的默认状态。'; + @override + String get translation_autoIncomingTitle => '自动翻译消息'; + + @override + String get translation_autoIncomingSubtitle => '自动为通知以及聊天或频道翻译消息。'; + + @override + String get translation_translateMessage => '翻译消息'; + @override String get translation_targetLanguage => '目标语言'; diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index 7e83215b..68d53148 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -2101,6 +2101,9 @@ "translation_composerTitle": "Vertaal voor verzending", "translation_composerSubtitle": "Stelt de standaardstatus van het pictogram voor de vertaling van de componist in.", "translation_useAppLanguage": "Gebruik de taal van de app", + "translation_autoIncomingTitle": "Berichten automatisch vertalen", + "translation_autoIncomingSubtitle": "Vertaalt berichten automatisch voor meldingen en voor chats of kanalen.", + "translation_translateMessage": "Bericht vertalen", "translation_targetLanguage": "Doeltaal", "translation_downloadedModelLabel": "Gedownloade model", "translation_presetModelLabel": "Voorgeprogrammeerd Hugging Face-model", diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 4366e273..f79a589a 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -2137,6 +2137,9 @@ "translation_enableTitle": "Włącz tłumaczenie", "translation_enableSubtitle": "Tłumaczenie otrzymywanych wiadomości oraz umożliwienie tłumaczenia przed wysłaniem.", "translation_composerSubtitle": "Kontroluje domyślny stan ikony tłumaczenia w edytorze.", + "translation_autoIncomingTitle": "Automatycznie tłumacz wiadomości", + "translation_autoIncomingSubtitle": "Automatycznie tłumaczy wiadomości do powiadomień oraz do czatów lub kanałów.", + "translation_translateMessage": "Przetłumacz wiadomość", "translation_targetLanguage": "Język docelowy", "translation_useAppLanguage": "Użyj języka aplikacji", "translation_downloadedModelLabel": "Pobudowany model", diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 6b8abbbc..994ff8a2 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -2100,6 +2100,9 @@ "translation_enableTitle": "Ativar a tradução", "translation_title": "Tradução", "translation_composerSubtitle": "Controla o estado padrão do ícone de tradução do compositor.", + "translation_autoIncomingTitle": "Traduzir mensagens automaticamente", + "translation_autoIncomingSubtitle": "Traduz automaticamente mensagens para notificações e para chats ou canais.", + "translation_translateMessage": "Traduzir mensagem", "translation_targetLanguage": "Língua-alvo", "translation_useAppLanguage": "Utilize o idioma da aplicação", "translation_downloadedModelLabel": "Modelo baixado", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 5d5bcfc3..2b0978a6 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -1268,6 +1268,9 @@ "translation_title": "Перевод", "translation_enableTitle": "Включить перевод", "translation_composerSubtitle": "Управляет исходным состоянием значка перевода, предоставляемого редактором.", + "translation_autoIncomingTitle": "Автоматически переводить сообщения", + "translation_autoIncomingSubtitle": "Автоматически переводит сообщения для уведомлений, а также для чатов и каналов.", + "translation_translateMessage": "Перевести сообщение", "translation_targetLanguage": "Целевой язык", "translation_useAppLanguage": "Используйте язык приложения", "translation_downloadedModelLabel": "Загруженная модель", diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index 713c3976..1a65b35f 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -2100,6 +2100,9 @@ "translation_composerTitle": "Preložte pred odeslaním", "translation_title": "Preklad", "translation_composerSubtitle": "Riadi výchoce stav ikony pre preklad, ktorú používa program.", + "translation_autoIncomingTitle": "Automaticky prekladať správy", + "translation_autoIncomingSubtitle": "Automaticky prekladá správy pre upozornenia aj pre čet alebo kanál.", + "translation_translateMessage": "Preložiť správu", "translation_targetLanguage": "Cieľový jazyk", "translation_useAppLanguage": "Použite jazyk aplikácie", "translation_downloadedModelLabel": "Stiahnutý model", diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index 00930c85..eff2db17 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -2099,6 +2099,9 @@ "translation_enableSubtitle": "Prevedite vstopne sporočila in omogočite predhodno prevajanje.", "translation_enableTitle": "Omogočite prevod", "translation_composerSubtitle": "Ureja privzeto stanje ikone za prevod, ki jo uporablja avtor.", + "translation_autoIncomingTitle": "Samodejno prevajaj sporočila", + "translation_autoIncomingSubtitle": "Samodejno prevaja sporočila za obvestila ter za klepete ali kanale.", + "translation_translateMessage": "Prevedi sporočilo", "translation_targetLanguage": "Ciljna jezika", "translation_useAppLanguage": "Uporabite jezik aplikacije", "translation_downloadedModelLabel": "Naložen model", diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 00fd3b08..044abbc7 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -2100,6 +2100,9 @@ "translation_title": "Översättning", "translation_composerTitle": "Översätt innan du skickar", "translation_composerSubtitle": "Styr standardtillståndet för kompositorns översättningsikon.", + "translation_autoIncomingTitle": "Översätt meddelanden automatiskt", + "translation_autoIncomingSubtitle": "Översätter meddelanden automatiskt för aviseringar och för chattar eller kanaler.", + "translation_translateMessage": "Översätt meddelande", "translation_targetLanguage": "Målmedvetet språk", "translation_useAppLanguage": "Använd appens språk", "translation_downloadedModelLabel": "Nedladdad modell", diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 8330d364..37300095 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -2109,6 +2109,9 @@ "translation_enableTitle": "Увімкнути переклад", "translation_enableSubtitle": "Перекладати отримані повідомлення та дозволяти попередній переклад перед відправкою.", "translation_composerSubtitle": "Контролює стан ікон перекладу, який використовується за замовчуванням.", + "translation_autoIncomingTitle": "Автоматично перекладати повідомлення", + "translation_autoIncomingSubtitle": "Автоматично перекладає повідомлення для сповіщень, а також для чатів і каналів.", + "translation_translateMessage": "Перекласти повідомлення", "translation_targetLanguage": "Цільова мова", "translation_useAppLanguage": "Використовувати мову застосунку", "translation_downloadedModelLabel": "Завантажений шаблон", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 1e289315..5603034f 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -2105,6 +2105,9 @@ "translation_composerTitle": "在发送之前进行翻译", "translation_enableTitle": "启用翻译功能", "translation_composerSubtitle": "控制作曲家翻译图标的默认状态。", + "translation_autoIncomingTitle": "自动翻译消息", + "translation_autoIncomingSubtitle": "自动为通知以及聊天或频道翻译消息。", + "translation_translateMessage": "翻译消息", "translation_targetLanguage": "目标语言", "translation_useAppLanguage": "使用应用程序语言", "translation_downloadedModelLabel": "下载的模型", diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index 4e95311f..6995b6ed 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -113,6 +113,7 @@ class AppSettings { final int tcpServerPort; final bool jumpToOldestUnread; final bool translationEnabled; + final bool autoTranslateIncomingMessages; final String? translationTargetLanguageCode; final bool composerTranslationEnabled; final String? translationModelSourceUrl; @@ -166,6 +167,7 @@ class AppSettings { this.tcpServerPort = 0, this.jumpToOldestUnread = false, this.translationEnabled = false, + this.autoTranslateIncomingMessages = true, this.translationTargetLanguageCode, this.composerTranslationEnabled = false, this.translationModelSourceUrl, @@ -226,6 +228,7 @@ class AppSettings { 'tcp_server_port': tcpServerPort, 'jump_to_oldest_unread': jumpToOldestUnread, 'translation_enabled': translationEnabled, + 'auto_translate_incoming_messages': autoTranslateIncomingMessages, 'translation_target_language_code': translationTargetLanguageCode, 'composer_translation_enabled': composerTranslationEnabled, 'translation_model_source_url': translationModelSourceUrl, @@ -307,6 +310,8 @@ class AppSettings { tcpServerPort: json['tcp_server_port'] as int? ?? 0, jumpToOldestUnread: json['jump_to_oldest_unread'] as bool? ?? false, translationEnabled: json['translation_enabled'] as bool? ?? false, + autoTranslateIncomingMessages: + json['auto_translate_incoming_messages'] as bool? ?? true, translationTargetLanguageCode: json['translation_target_language_code'] as String?, composerTranslationEnabled: @@ -396,6 +401,7 @@ class AppSettings { int? tcpServerPort, bool? jumpToOldestUnread, bool? translationEnabled, + bool? autoTranslateIncomingMessages, Object? translationTargetLanguageCode = _unset, bool? composerTranslationEnabled, Object? translationModelSourceUrl = _unset, @@ -453,6 +459,8 @@ class AppSettings { tcpServerPort: tcpServerPort ?? this.tcpServerPort, jumpToOldestUnread: jumpToOldestUnread ?? this.jumpToOldestUnread, translationEnabled: translationEnabled ?? this.translationEnabled, + autoTranslateIncomingMessages: + autoTranslateIncomingMessages ?? this.autoTranslateIncomingMessages, translationTargetLanguageCode: translationTargetLanguageCode == _unset ? this.translationTargetLanguageCode : translationTargetLanguageCode as String?, diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 94b3efe8..4d791381 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -559,6 +559,7 @@ class AppSettingsScreen extends StatelessWidget { TranslationService translationService, ) { final settings = settingsService.settings; + final translationEnabled = settings.translationEnabled; return Card( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -579,11 +580,41 @@ class AppSettingsScreen extends StatelessWidget { ), const Divider(height: 1), SwitchListTile( - secondary: const Icon(Icons.outgoing_mail), - title: Text(context.l10n.translation_composerTitle), - subtitle: Text(context.l10n.translation_composerSubtitle), + secondary: Icon( + Icons.auto_awesome_outlined, + color: translationEnabled ? null : Colors.grey, + ), + title: Text( + context.l10n.translation_autoIncomingTitle, + style: TextStyle(color: translationEnabled ? null : Colors.grey), + ), + subtitle: Text( + context.l10n.translation_autoIncomingSubtitle, + style: TextStyle(color: translationEnabled ? null : Colors.grey), + ), + value: settings.autoTranslateIncomingMessages, + onChanged: translationEnabled + ? settingsService.setAutoTranslateIncomingMessages + : null, + ), + const Divider(height: 1), + SwitchListTile( + secondary: Icon( + Icons.outgoing_mail, + color: translationEnabled ? null : Colors.grey, + ), + title: Text( + context.l10n.translation_composerTitle, + style: TextStyle(color: translationEnabled ? null : Colors.grey), + ), + subtitle: Text( + context.l10n.translation_composerSubtitle, + style: TextStyle(color: translationEnabled ? null : Colors.grey), + ), value: settings.composerTranslationEnabled, - onChanged: settingsService.setComposerTranslationEnabled, + onChanged: translationEnabled + ? settingsService.setComposerTranslationEnabled + : null, ), const Divider(height: 1), ListTile( diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index fcd50861..b57bd235 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:convert'; import 'dart:math' as math; @@ -1320,6 +1321,18 @@ class _ChannelChatScreenState extends State { } void _showMessageActions(ChannelMessage message) { + final settings = context.read().settings; + final translationService = context.read(); + final canTranslateMessage = + settings.translationEnabled && + !settings.autoTranslateIncomingMessages && + translationService.canTranslateIncoming( + text: message.text, + isCli: false, + isOutgoing: message.isOutgoing, + ) && + (message.translatedText?.trim().isEmpty ?? true); + showModalBottomSheet( context: context, builder: (sheetContext) => SafeArea( @@ -1361,6 +1374,21 @@ class _ChannelChatScreenState extends State { _copyMessageText(message.text); }, ), + if (canTranslateMessage) + ListTile( + leading: const Icon(Icons.translate), + title: Text(context.l10n.translation_translateMessage), + onTap: () { + Navigator.pop(sheetContext); + unawaited( + context.read().translateChannelMessage( + widget.channel.index, + message, + manualTranslation: true, + ), + ); + }, + ), if (!message.isOutgoing) ListTile( leading: const Icon(Icons.mark_chat_unread_outlined), diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 8d3bc66c..07884b96 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -1577,6 +1577,18 @@ class _ChatScreenState extends State { } void _showMessageActions(Message message, Contact contact) { + final settings = context.read().settings; + final translationService = context.read(); + final canTranslateMessage = + settings.translationEnabled && + !settings.autoTranslateIncomingMessages && + translationService.canTranslateIncoming( + text: message.text, + isCli: message.isCli, + isOutgoing: message.isOutgoing, + ) && + (message.translatedText?.trim().isEmpty ?? true); + showModalBottomSheet( context: context, builder: (sheetContext) => SafeArea( @@ -1610,6 +1622,21 @@ class _ChatScreenState extends State { _copyMessageText(message.text); }, ), + if (canTranslateMessage) + ListTile( + leading: const Icon(Icons.translate), + title: Text(context.l10n.translation_translateMessage), + onTap: () { + Navigator.pop(sheetContext); + unawaited( + context.read().translateContactMessage( + widget.contact.publicKeyHex, + message, + manualTranslation: true, + ), + ); + }, + ), if (!message.isOutgoing) ListTile( leading: const Icon(Icons.mark_chat_unread_outlined), diff --git a/lib/services/app_settings_service.dart b/lib/services/app_settings_service.dart index 7b3d5848..88ff0f47 100644 --- a/lib/services/app_settings_service.dart +++ b/lib/services/app_settings_service.dart @@ -235,6 +235,12 @@ class AppSettingsService extends ChangeNotifier { await updateSettings(_settings.copyWith(translationEnabled: value)); } + Future setAutoTranslateIncomingMessages(bool value) async { + await updateSettings( + _settings.copyWith(autoTranslateIncomingMessages: value), + ); + } + Future setTranslationTargetLanguageCode(String? value) async { await updateSettings( _settings.copyWith(translationTargetLanguageCode: value), diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 148650ca..4437d1f1 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -89,7 +89,22 @@ class TranslationService extends ChangeNotifier { 'en'; } - bool shouldTranslateIncoming({ + bool shouldAutoTranslateIncoming({ + required String text, + required bool isCli, + required bool isOutgoing, + }) { + if (!_settings.autoTranslateIncomingMessages) { + return false; + } + return canTranslateIncoming( + text: text, + isCli: isCli, + isOutgoing: isOutgoing, + ); + } + + bool canTranslateIncoming({ required String text, required bool isCli, required bool isOutgoing, From 3fe5cdf55d27ee8eb6b41ae1bc8bdb00fa39286a Mon Sep 17 00:00:00 2001 From: ericz Date: Wed, 20 May 2026 23:20:16 +0200 Subject: [PATCH 17/36] update to current dev a50c0d0b2dcfb33cf57b553db6b909802262dfe6 --- README.md | 1 + lib/connector/meshcore_connector.dart | 96 ++++++-- lib/connector/meshcore_uuids.dart | 1 + lib/models/channel.dart | 34 +++ lib/models/community.dart | 33 +++ lib/models/radio_settings.dart | 270 ++++++++++++++++++++++ lib/screens/channel_chat_screen.dart | 77 +++++- lib/screens/channels_screen.dart | 84 +++---- lib/screens/chat_screen.dart | 15 +- lib/screens/contacts_screen.dart | 2 + lib/screens/line_of_sight_map_screen.dart | 6 + lib/screens/map_screen.dart | 2 + lib/services/translation_service.dart | 16 +- lib/widgets/quick_switch_bar.dart | 46 +++- 14 files changed, 583 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index 94d54bac..041ea6e9 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,7 @@ Devices are discovered by scanning for BLE advertisements with known MeshCore de - `WisCore-` - `HT-` - `LowMesh_MC_` + - `NRF52` New device prefixes can be added in `lib/connector/meshcore_uuids.dart`. diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 7eca6e88..0a7056d5 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -302,6 +302,8 @@ class MeshCoreConnector extends ChangeNotifier { final Map _contactUnreadCount = {}; final Map _repeaterBatterySnapshots = {}; bool _unreadStateLoaded = false; + int _cachedContactsUnreadTotal = 0; + int _cachedChannelsUnreadTotal = 0; final Map _pendingRepeaterAcks = {}; String? _activeContactKey; int? _activeChannelIndex; @@ -606,16 +608,42 @@ class MeshCoreConnector extends ChangeNotifier { int getTotalUnreadCount() { if (!_unreadStateLoaded) return 0; - var total = 0; - // Count unread contact messages - for (final contact in _contacts) { - total += getUnreadCountForContact(contact); - } - // Count unread channel messages - for (final channelIndex in _channelMessages.keys) { - total += getUnreadCountForChannelIndex(channelIndex); - } - return total; + return getTotalContactsUnreadCount() + getTotalChannelsUnreadCount(); + } + + int getTotalContactsUnreadCount() { + if (!_unreadStateLoaded) return 0; + return _cachedContactsUnreadTotal; + } + + int getTotalChannelsUnreadCount() { + if (!_unreadStateLoaded) return 0; + return _cachedChannelsUnreadTotal; + } + + /// Recalculates both cached unread totals from scratch. + /// Called when unread state is first loaded. + void _recalculateCachedUnreadTotals() { + _recalculateCachedContactsUnreadTotal(); + _recalculateCachedChannelsUnreadTotal(); + } + + void _recalculateCachedContactsUnreadTotal() { + int total = 0; + _contactUnreadCount.forEach((contactKeyHex, count) { + if (_shouldTrackUnreadForContactKey(contactKeyHex)) { + total += count; + } + }); + _cachedContactsUnreadTotal = total; + } + + void _recalculateCachedChannelsUnreadTotal() { + final allChannels = _channels.isNotEmpty ? _channels : _cachedChannels; + _cachedChannelsUnreadTotal = allChannels.fold( + 0, + (total, ch) => total + ch.unreadCount, + ); } bool isChannelSmazEnabled(int channelIndex) { @@ -649,11 +677,13 @@ class MeshCoreConnector extends ChangeNotifier { ..clear() ..addAll(await _unreadStore.loadContactUnreadCount()); _unreadStateLoaded = true; + _recalculateCachedUnreadTotals(); notifyListeners(); } Future loadCachedChannels() async { _cachedChannels = await _channelStore.loadChannels(); + _recalculateCachedChannelsUnreadTotal(); } void setActiveContact(String? contactKeyHex) { @@ -680,6 +710,8 @@ class MeshCoreConnector extends ChangeNotifier { final previousCount = _contactUnreadCount[contactKeyHex] ?? 0; if (previousCount > 0) { _contactUnreadCount[contactKeyHex] = 0; + _cachedContactsUnreadTotal = (_cachedContactsUnreadTotal - previousCount) + .clamp(0, _cachedContactsUnreadTotal); _appDebugLogService?.info( 'Contact $contactKeyHex marked as read (was $previousCount unread)', tag: 'Unread', @@ -721,6 +753,8 @@ class MeshCoreConnector extends ChangeNotifier { if (channel != null && channel.unreadCount > 0) { final previousCount = channel.unreadCount; channel.unreadCount = 0; + _cachedChannelsUnreadTotal = (_cachedChannelsUnreadTotal - previousCount) + .clamp(0, _cachedChannelsUnreadTotal); _appDebugLogService?.info( 'Channel ${channel.name.isNotEmpty ? channel.name : channelIndex} marked as read (was $previousCount unread)', tag: 'Unread', @@ -3156,6 +3190,9 @@ class MeshCoreConnector extends ChangeNotifier { unawaited(_persistContacts()); _conversations.remove(contact.publicKeyHex); _loadedConversationKeys.remove(contact.publicKeyHex); + final removedCount = _contactUnreadCount[contact.publicKeyHex] ?? 0; + _cachedContactsUnreadTotal = (_cachedContactsUnreadTotal - removedCount) + .clamp(0, _cachedContactsUnreadTotal); _contactUnreadCount.remove(contact.publicKeyHex); _unreadStore.saveContactUnreadCount( Map.from(_contactUnreadCount), @@ -3549,6 +3586,7 @@ class MeshCoreConnector extends ChangeNotifier { // Cache channels for offline use _cachedChannels = List.from(_channels); unawaited(_channelStore.saveChannels(_channels)); + _recalculateCachedChannelsUnreadTotal(); // Apply ordering and notify UI _applyChannelOrder(); @@ -4101,6 +4139,9 @@ class MeshCoreConnector extends ChangeNotifier { _handleDiscovery(contact, frame, noNotify: true, addActive: true); if (contact.type == advTypeRepeater) { + final removedCount = _contactUnreadCount[contact.publicKeyHex] ?? 0; + _cachedContactsUnreadTotal = (_cachedContactsUnreadTotal - removedCount) + .clamp(0, _cachedContactsUnreadTotal); _contactUnreadCount.remove(contact.publicKeyHex); _unreadStore.saveContactUnreadCount( Map.from(_contactUnreadCount), @@ -4191,6 +4232,9 @@ class MeshCoreConnector extends ChangeNotifier { } if (contact.type == advTypeRepeater) { + final removedCount = _contactUnreadCount[contact.publicKeyHex] ?? 0; + _cachedContactsUnreadTotal = (_cachedContactsUnreadTotal - removedCount) + .clamp(0, _cachedContactsUnreadTotal); _contactUnreadCount.remove(contact.publicKeyHex); _unreadStore.saveContactUnreadCount( Map.from(_contactUnreadCount), @@ -4464,17 +4508,13 @@ class MeshCoreConnector extends ChangeNotifier { badgeCount: getTotalUnreadCount(), ); } else if (c?.type == advTypeRoom) { - // Room server messages include a 4-char prefix; strip it for notifications - final bodyText = msg.text.length > 4 - ? msg.text.substring(4) - : msg.text; final resolvedText = (translationResult != null && translationResult.status == MessageTranslationStatus.completed && translationResult.translatedText.trim().isNotEmpty) ? translationResult.translatedText.trim() - : bodyText.trim(); + : msg.text.trim(); await _notificationService.showMessageNotification( contactName: c?.name ?? 'Unknown Room', message: resolvedText, @@ -4522,16 +4562,24 @@ class MeshCoreConnector extends ChangeNotifier { timestampRaw * 1000, ); - if (txtType == 2) { - reader.skipBytes(4); // Skip extra 4 bytes for signed/plain variants + final flags = txtType; + final shiftedType = flags >> 2; + final rawType = flags; + final isSigned = shiftedType == txtTypeSigned || rawType == txtTypeSigned; + final Uint8List? roomAuthorPrefix; + if (isSigned) { + // Room-server pushed posts use signed/plain contact messages where this + // 4-byte "signature" field is actually the original author's pubkey + // prefix. Keep it as metadata; the text starts after these bytes. + roomAuthorPrefix = reader.readBytes(4); + } else { + roomAuthorPrefix = null; } final msgText = reader.readCString(); - final flags = txtType; - final shiftedType = flags >> 2; - final rawType = flags; - final isPlain = shiftedType == txtTypePlain || rawType == txtTypePlain; + final isPlain = + shiftedType == txtTypePlain || rawType == txtTypePlain || isSigned; final isCli = shiftedType == txtTypeCliData || rawType == txtTypeCliData; if (!isPlain && !isCli) { appLogger.warn( @@ -4568,9 +4616,7 @@ class MeshCoreConnector extends ChangeNotifier { status: MessageStatus.delivered, pathLength: pathLength == 0xFF ? 0 : pathLength, pathBytes: Uint8List(0), - fourByteRoomContactKey: msgText.length >= 4 - ? Uint8List.fromList(msgText.substring(0, 4).codeUnits) - : null, + fourByteRoomContactKey: roomAuthorPrefix, ); } catch (e) { appLogger.warn('Error parsing contact direct message: $e'); @@ -5247,6 +5293,7 @@ class MeshCoreConnector extends ChangeNotifier { final channel = _findChannelByIndex(channelIndex); if (channel != null) { channel.unreadCount++; + _cachedChannelsUnreadTotal++; _appDebugLogService?.info( 'Channel ${channel.name.isNotEmpty ? channel.name : channelIndex} unread count incremented to ${channel.unreadCount}', tag: 'Unread', @@ -5291,6 +5338,7 @@ class MeshCoreConnector extends ChangeNotifier { final currentCount = _contactUnreadCount[contactKey] ?? 0; _contactUnreadCount[contactKey] = currentCount + 1; + _cachedContactsUnreadTotal++; _appDebugLogService?.info( 'Contact $contactKey unread count incremented to ${currentCount + 1}', tag: 'Unread', diff --git a/lib/connector/meshcore_uuids.dart b/lib/connector/meshcore_uuids.dart index ae6697b6..084cc424 100644 --- a/lib/connector/meshcore_uuids.dart +++ b/lib/connector/meshcore_uuids.dart @@ -11,5 +11,6 @@ class MeshCoreUuids { "Lilygo", "HT-", "LowMesh_MC_", + "NRF52", ]; } diff --git a/lib/models/channel.dart b/lib/models/channel.dart index 4fdd6270..9baf6302 100644 --- a/lib/models/channel.dart +++ b/lib/models/channel.dart @@ -4,6 +4,9 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; import '../connector/meshcore_protocol.dart'; +import 'community.dart'; + +enum ChannelType { public, private, hashtag, communityPublic, communityHashtag } class Channel { final int index; @@ -111,5 +114,36 @@ class Channel { return bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join(); } + static bool isCommunityChannel(ChannelType channelType) { + switch (channelType) { + case ChannelType.communityPublic: + case ChannelType.communityHashtag: + return true; + case ChannelType.public: + case ChannelType.private: + case ChannelType.hashtag: + return false; + } + } + + static ChannelType getChannelType( + Channel channel, + CommunityPskIndex communityIndex, + ) { + Community? community = communityIndex.getCommunityForChannel(channel); + if (community != null) { + if (Community.isCommunityPublicChannel(channel, community)) { + return ChannelType.communityPublic; + } + return ChannelType.communityHashtag; + } + if (channel.isPublicChannel) { + return ChannelType.public; + } else if (channel.name.startsWith('#')) { + return ChannelType.hashtag; + } + return ChannelType.private; + } + static const String publicChannelPsk = '8b3387e9c5cdea6ac9e5edbaa115cd72'; } diff --git a/lib/models/community.dart b/lib/models/community.dart index c829f3d1..7261ddf9 100644 --- a/lib/models/community.dart +++ b/lib/models/community.dart @@ -4,6 +4,8 @@ import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; +import 'channel.dart'; + /// Represents a community with a shared secret for deriving channel PSKs. /// /// A Community is a namespace with a shared secret K (32 random bytes), @@ -162,6 +164,12 @@ class Community { return hashtag.replaceFirst(RegExp(r'^#'), '').toLowerCase().trim(); } + /// Returns true if this is the community's public channel + static bool isCommunityPublicChannel(Channel channel, Community community) { + final publicPsk = community.deriveCommunityPublicPsk(); + return channel.pskHex == Channel.formatPskHex(publicPsk); + } + /// Add a hashtag channel to this community's list Community addHashtagChannel(String hashtag) { final normalized = _normalizeCommunityHashtag(hashtag); @@ -237,3 +245,28 @@ class Community { @override int get hashCode => id.hashCode; } + +class CommunityPskIndex { + // Cache of PSK hex -> Community for quick lookup + final Map _pskToCommunity = {}; + + void initialize(List communities) { + _pskToCommunity.clear(); + for (final community in communities) { + // Map the community public channel PSK + final publicPsk = community.deriveCommunityPublicPsk(); + _pskToCommunity[Channel.formatPskHex(publicPsk)] = community; + + // Map all known hashtag channel PSKs + for (final hashtag in community.hashtagChannels) { + final hashtagPsk = community.deriveCommunityHashtagPsk(hashtag); + _pskToCommunity[Channel.formatPskHex(hashtagPsk)] = community; + } + } + } + + /// Returns the community this channel belongs to, or null if not a community channel + Community? getCommunityForChannel(Channel channel) { + return _pskToCommunity[channel.pskHex]; + } +} diff --git a/lib/models/radio_settings.dart b/lib/models/radio_settings.dart index 099d9201..e74cf209 100644 --- a/lib/models/radio_settings.dart +++ b/lib/models/radio_settings.dart @@ -181,6 +181,276 @@ class RadioSettings { txPowerDbm: 14, ), ), + ( + 'Russia Artyom (VVO)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Biysk (BSK)', + RadioSettings( + frequencyMHz: 869.000, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Chelyabinsk (CEK)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Cherepovets (CEE)', + RadioSettings( + frequencyMHz: 868.570, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Irkutsk (IKT)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ivanovo (IWA)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Izhevsk (IJK)', + RadioSettings( + frequencyMHz: 868.732, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kaluga (KLF)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kazan (KZN)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Khabarovsk (KHV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Kirov (KVX)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Lipetsk (LPK)', + RadioSettings( + frequencyMHz: 868.950, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Moscow (MOW)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Nizhny Novgorod (GOJ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Novosibirsk (OVB)', + RadioSettings( + frequencyMHz: 869.000, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Rostov-on-Don (ROV)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ryazan (RZN)', + RadioSettings( + frequencyMHz: 868.880, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Samara (KUF)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Saratov (GSV)', + RadioSettings( + frequencyMHz: 864.281, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia St. Petersburg (LED)', + RadioSettings( + frequencyMHz: 868.856, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tambov (TBW)', + RadioSettings( + frequencyMHz: 868.950, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf10, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tula (TYA)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Tver (KLD)', + RadioSettings( + frequencyMHz: 869.169, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Ufa (UFA)', + RadioSettings( + frequencyMHz: 868.732, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_8, + txPowerDbm: 20, + ), + ), + ( + 'Russia Volgograd (VOG)', + RadioSettings( + frequencyMHz: 869.525, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), + ( + 'Russia Voronezh (VOZ)', + RadioSettings( + frequencyMHz: 868.731, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf8, + codingRate: LoRaCodingRate.cr4_6, + txPowerDbm: 20, + ), + ), + ( + 'Russia Yekaterinburg (SVX)', + RadioSettings( + frequencyMHz: 869.046, + bandwidth: LoRaBandwidth.bw62_5, + spreadingFactor: LoRaSpreadingFactor.sf7, + codingRate: LoRaCodingRate.cr4_7, + txPowerDbm: 20, + ), + ), ( 'Switzerland', RadioSettings( diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index b57bd235..f34bab04 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -9,6 +9,8 @@ import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; +import '../models/community.dart'; +import '../storage/community_store.dart'; import '../utils/platform_info.dart'; import '../helpers/chat_scroll_controller.dart'; import '../connector/meshcore_protocol.dart'; @@ -57,8 +59,11 @@ class _ChannelChatScreenState extends State { final ChatScrollController _scrollController = ChatScrollController(); final FocusNode _textFieldFocusNode = FocusNode(); ChannelMessage? _replyingToMessage; + final CommunityStore _communityStore = CommunityStore(); + final CommunityPskIndex _communityIndex = CommunityPskIndex(); final Map _messageKeys = {}; bool _isLoadingOlder = false; + bool _communitiesLoaded = false; MeshCoreConnector? _connector; DateTime? _lastChannelSendAt; @@ -82,6 +87,7 @@ class _ChannelChatScreenState extends State { final idx = widget.channel.index; final unread = widget.initialUnreadCount; final messages = connector.getChannelMessages(widget.channel); + _loadCommunities(); ChannelMessage? anchor; if (unread > 0) { anchor = _findOldestUnreadChannelAnchor(messages, unread); @@ -108,6 +114,19 @@ class _ChannelChatScreenState extends State { }); } + // TODO: Reload communities when returning from another screen + Future _loadCommunities() async { + final connector = context.read(); + _communityStore.setPublicKeyHex = connector.selfPublicKeyHex; + final communities = await _communityStore.loadCommunities(); + if (mounted) { + setState(() { + _communityIndex.initialize(communities); + _communitiesLoaded = true; + }); + } + } + ChannelMessage? _findOldestUnreadChannelAnchor( List messages, int unreadCount, @@ -194,16 +213,63 @@ class _ChannelChatScreenState extends State { ); } + Widget _channelIcon(Channel channel) { + // Determine icon based on channel type + final ChannelType channelType = Channel.getChannelType( + channel, + _communityIndex, + ); + final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + IconData icon; + switch (channelType) { + case ChannelType.communityPublic: + icon = Icons.groups; + case ChannelType.communityHashtag: + icon = Icons.tag; + case ChannelType.public: + icon = Icons.public; + case ChannelType.hashtag: + icon = Icons.tag; + case ChannelType.private: + icon = Icons.lock; + } + return Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 3), + child: _communitiesLoaded + ? Icon(icon, size: 20) + : SizedBox.square(dimension: 20), + ), + if (isCommunityChannel) + Positioned( + right: 0, + bottom: 0, + child: Container( + width: 12, + height: 12, + decoration: BoxDecoration( + color: Colors.purple, + shape: BoxShape.circle, + border: Border.all( + color: Theme.of(context).cardColor, + width: 2, + ), + ), + child: const Icon(Icons.people, size: 8, color: Colors.white), + ), + ), + ], + ); + } + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Row( children: [ - Icon( - widget.channel.isPublicChannel ? Icons.public : Icons.tag, - size: 20, - ), + _channelIcon(widget.channel), const SizedBox(width: 8), Expanded( child: Column( @@ -1321,11 +1387,8 @@ class _ChannelChatScreenState extends State { } void _showMessageActions(ChannelMessage message) { - final settings = context.read().settings; final translationService = context.read(); final canTranslateMessage = - settings.translationEnabled && - !settings.autoTranslateIncomingMessages && translationService.canTranslateIncoming( text: message.text, isCli: false, diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 4613a8ee..8b05b8ce 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -44,11 +44,9 @@ class _ChannelsScreenState extends State with DisconnectNavigationMixin { final TextEditingController _searchController = TextEditingController(); final CommunityStore _communityStore = CommunityStore(); - Timer? _searchDebounce; + final CommunityPskIndex _communityIndex = CommunityPskIndex(); List _communities = []; - - // Cache of PSK hex -> Community for quick lookup - final Map _pskToCommunity = {}; + Timer? _searchDebounce; ChannelMessageStore get _channelMessageStore => ChannelMessageStore(); @@ -71,37 +69,11 @@ class _ChannelsScreenState extends State if (mounted) { setState(() { _communities = communities; - _buildPskCommunityMap(); + _communityIndex.initialize(communities); }); } } - void _buildPskCommunityMap() { - _pskToCommunity.clear(); - for (final community in _communities) { - // Map the community public channel PSK - final publicPsk = community.deriveCommunityPublicPsk(); - _pskToCommunity[Channel.formatPskHex(publicPsk)] = community; - - // Map all known hashtag channel PSKs - for (final hashtag in community.hashtagChannels) { - final hashtagPsk = community.deriveCommunityHashtagPsk(hashtag); - _pskToCommunity[Channel.formatPskHex(hashtagPsk)] = community; - } - } - } - - /// Returns the community this channel belongs to, or null if not a community channel - Community? _getCommunityForChannel(Channel channel) { - return _pskToCommunity[channel.pskHex]; - } - - /// Returns true if this is the community's public channel - bool _isCommunityPublicChannel(Channel channel, Community community) { - final publicPsk = community.deriveCommunityPublicPsk(); - return channel.pskHex == Channel.formatPskHex(publicPsk); - } - @override void dispose() { _searchDebounce?.cancel(); @@ -360,6 +332,8 @@ class _ChannelsScreenState extends State selectedIndex: 1, onDestinationSelected: (index) => _handleQuickSwitch(index, context), + contactsUnreadCount: connector.getTotalContactsUnreadCount(), + channelsUnreadCount: connector.getTotalChannelsUnreadCount(), ), ), ), @@ -375,37 +349,37 @@ class _ChannelsScreenState extends State int? dragIndex, }) { final unreadCount = connector.getUnreadCountForChannel(channel); - final community = _getCommunityForChannel(channel); - final isCommunityChannel = community != null; - final isCommunityPublic = - isCommunityChannel && _isCommunityPublicChannel(channel, community); // Determine icon and colors based on channel type IconData icon; Color iconColor; Color bgColor; - - if (isCommunityChannel) { - // Community channel styling - iconColor = Colors.purple; - bgColor = Colors.purple.withValues(alpha: 0.2); - if (isCommunityPublic) { + final ChannelType channelType = Channel.getChannelType( + channel, + _communityIndex, + ); + final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + switch (channelType) { + case ChannelType.communityPublic: icon = Icons.groups; - } else { + iconColor = Colors.purple; + bgColor = Colors.purple.withValues(alpha: 0.2); + case ChannelType.communityHashtag: icon = Icons.tag; - } - } else if (channel.isPublicChannel) { - icon = Icons.public; - iconColor = Colors.green; - bgColor = Colors.green.withValues(alpha: 0.2); - } else if (channel.name.startsWith('#')) { - icon = Icons.tag; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); - } else { - icon = Icons.lock; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); + iconColor = Colors.purple; + bgColor = Colors.purple.withValues(alpha: 0.2); + case ChannelType.public: + icon = Icons.public; + iconColor = Colors.green; + bgColor = Colors.green.withValues(alpha: 0.2); + case ChannelType.hashtag: + icon = Icons.tag; + iconColor = Colors.blue; + bgColor = Colors.blue.withValues(alpha: 0.2); + case ChannelType.private: + icon = Icons.lock; + iconColor = Colors.blue; + bgColor = Colors.blue.withValues(alpha: 0.2); } return Card( diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 07884b96..7c71d597 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -485,6 +485,8 @@ class _ChatScreenState extends State { final message = reversedMessages[messageIndex]; String fourByteHex = ''; if (contact.type == advTypeRoom) { + // Room-server messages carry the original author's 4-byte prefix + // separately from message.text; use it only for resolving the name. contact = _resolveContactFrom4Bytes( connector, message.fourByteRoomContactKey.isEmpty @@ -509,7 +511,6 @@ class _ChatScreenState extends State { ? "${contact.name} [$fourByteHex]" : contact.name, sourceId: widget.contact.publicKeyHex, - isRoomServer: resolvedContact.type == advTypeRoom, textScale: textScale, onTap: () => _openMessagePath(message, contact), onLongPress: () => _showMessageActions(message, contact), @@ -1577,11 +1578,8 @@ class _ChatScreenState extends State { } void _showMessageActions(Message message, Contact contact) { - final settings = context.read().settings; final translationService = context.read(); final canTranslateMessage = - settings.translationEnabled && - !settings.autoTranslateIncomingMessages && translationService.canTranslateIncoming( text: message.text, isCli: message.isCli, @@ -1748,7 +1746,6 @@ class _ChatScreenState extends State { class _MessageBubble extends StatelessWidget { final Message message; final String senderName; - final bool isRoomServer; final VoidCallback? onTap; final VoidCallback? onLongPress; final void Function(Message message, String emoji)? onRetryReaction; @@ -1759,7 +1756,6 @@ class _MessageBubble extends StatelessWidget { required this.message, required this.senderName, required this.sourceId, - required this.isRoomServer, required this.textScale, this.onTap, this.onLongPress, @@ -1785,10 +1781,9 @@ class _MessageBubble extends StatelessWidget { : (isOutgoing ? colorScheme.onPrimary : colorScheme.onSurface); final metaColor = textColor.withValues(alpha: 0.7); const bodyFontSize = 14.0; - String messageText = message.text; - if (isRoomServer && !isOutgoing) { - messageText = message.text.substring(4.clamp(0, message.text.length)); - } + // Do not strip room-server author bytes here: the parser stores them in + // fourByteRoomContactKey, so message.text is safe to render as-is. + final messageText = message.text; final translatedDisplayText = message.translatedText != null && message.translatedText!.trim().isNotEmpty diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index a4cc35ca..d5e1b79a 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -430,6 +430,8 @@ class _ContactsScreenState extends State selectedIndex: 0, onDestinationSelected: (index) => _handleQuickSwitch(index, context), + contactsUnreadCount: connector.getTotalContactsUnreadCount(), + channelsUnreadCount: connector.getTotalChannelsUnreadCount(), ), ), ), diff --git a/lib/screens/line_of_sight_map_screen.dart b/lib/screens/line_of_sight_map_screen.dart index 3ba79d59..f908f5ea 100644 --- a/lib/screens/line_of_sight_map_screen.dart +++ b/lib/screens/line_of_sight_map_screen.dart @@ -539,6 +539,12 @@ class _LineOfSightMapScreenState extends State { child: QuickSwitchBar( selectedIndex: 2, onDestinationSelected: (index) => _handleQuickSwitch(index, context), + contactsUnreadCount: context + .watch() + .getTotalContactsUnreadCount(), + channelsUnreadCount: context + .watch() + .getTotalChannelsUnreadCount(), ), ), ); diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 4ae2fd43..be133240 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -676,6 +676,8 @@ class _MapScreenState extends State { selectedIndex: 2, onDestinationSelected: (index) => _handleQuickSwitch(index, context), + contactsUnreadCount: connector.getTotalContactsUnreadCount(), + channelsUnreadCount: connector.getTotalChannelsUnreadCount(), ), ), floatingActionButton: FloatingActionButton( diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 4437d1f1..7b1d7f5f 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -388,7 +388,9 @@ class TranslationService extends ChangeNotifier { if (targetLanguageCode == null || !_isPlainTextEligible(text)) { return null; } - final detectedLanguageCode = await detectLanguage(text); + final detectedLanguageCode = await detectLanguage( + _stripReplyInfoForDetection(text), + ); if (detectedLanguageCode != null && detectedLanguageCode == targetLanguageCode) { return const TranslationResult( @@ -429,7 +431,9 @@ class TranslationService extends ChangeNotifier { if (targetLanguageCode == null || !_isPlainTextEligible(text)) { return null; } - final detectedLanguageCode = await detectLanguage(text); + final detectedLanguageCode = await detectLanguage( + _stripReplyInfoForDetection(text), + ); if (detectedLanguageCode != null && detectedLanguageCode == targetLanguageCode) { return const TranslationResult( @@ -470,6 +474,14 @@ class TranslationService extends ChangeNotifier { } } + String _stripReplyInfoForDetection(String text) { + final match = RegExp( + r'@\[([^\]]+)\]\s+(.+)$', + dotAll: true, + ).firstMatch(text); + return match?.group(2) ?? text; + } + Future _translateText({ required String text, required String targetLanguageCode, diff --git a/lib/widgets/quick_switch_bar.dart b/lib/widgets/quick_switch_bar.dart index 134091ff..40dcb59a 100644 --- a/lib/widgets/quick_switch_bar.dart +++ b/lib/widgets/quick_switch_bar.dart @@ -6,11 +6,15 @@ import '../l10n/l10n.dart'; class QuickSwitchBar extends StatelessWidget { final int selectedIndex; final ValueChanged onDestinationSelected; + final int contactsUnreadCount; + final int channelsUnreadCount; const QuickSwitchBar({ super.key, required this.selectedIndex, required this.onDestinationSelected, + this.contactsUnreadCount = 0, + this.channelsUnreadCount = 0, }); @override @@ -62,15 +66,30 @@ class QuickSwitchBar extends StatelessWidget { onDestinationSelected: onDestinationSelected, destinations: [ NavigationDestination( - icon: const Icon(Icons.people_outline), + icon: _buildIconWithBadge( + const Icon(Icons.people_outline), + contactsUnreadCount, + ), + selectedIcon: _buildIconWithBadge( + const Icon(Icons.people), + contactsUnreadCount, + ), label: context.l10n.nav_contacts, ), NavigationDestination( - icon: const Icon(Icons.tag), + icon: _buildIconWithBadge( + const Icon(Icons.tag), + channelsUnreadCount, + ), + selectedIcon: _buildIconWithBadge( + const Icon(Icons.tag), + channelsUnreadCount, + ), label: context.l10n.nav_channels, ), NavigationDestination( icon: const Icon(Icons.map_outlined), + selectedIcon: const Icon(Icons.map), label: context.l10n.nav_map, ), ], @@ -81,4 +100,27 @@ class QuickSwitchBar extends StatelessWidget { ), ); } + + Widget _buildIconWithBadge(Icon icon, int count) { + if (count <= 0) return icon; + + return Stack( + clipBehavior: Clip.none, + children: [ + icon, + Positioned( + right: -2, + top: -2, + child: Container( + width: 8, + height: 8, + decoration: const BoxDecoration( + color: Colors.redAccent, + shape: BoxShape.circle, + ), + ), + ), + ], + ); + } } From 8682e6ea6762c475e6d3750f68103b2e268c0d81 Mon Sep 17 00:00:00 2001 From: ericz Date: Thu, 21 May 2026 00:02:21 +0200 Subject: [PATCH 18/36] fix missing _handleQueuedMessageReceived after merge of dev --- lib/connector/meshcore_connector.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 0a7056d5..bb0def43 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -4525,6 +4525,9 @@ class MeshCoreConnector extends ChangeNotifier { }()); } } + _handleQueuedMessageReceived(); + } else if (_isSyncingQueuedMessages) { + _handleQueuedMessageReceived(); } } @@ -4861,6 +4864,9 @@ class MeshCoreConnector extends ChangeNotifier { _maybeNotifyChannelMessage(msg, translationResult: translationResult); }()); } + _handleQueuedMessageReceived(); + } else if (_isSyncingQueuedMessages) { + _handleQueuedMessageReceived(); } } From bac82dc9e8b1e464613c498ade1b6e5f86f18df9 Mon Sep 17 00:00:00 2001 From: ericz Date: Thu, 21 May 2026 00:11:54 +0200 Subject: [PATCH 19/36] Fix Flutter SDK update --- lib/screens/channels_screen.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 8b05b8ce..0737a7d0 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -273,7 +273,7 @@ class _ChannelsScreenState extends State ), buildDefaultDragHandles: false, itemCount: filteredChannels.length, - onReorder: (oldIndex, newIndex) { + onReorderItem: (oldIndex, newIndex) { if (newIndex > oldIndex) newIndex -= 1; final reordered = List.from( filteredChannels, From 6d258154a02d939473dfac43d0e964841bc659b1 Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Sat, 23 May 2026 18:26:45 +0300 Subject: [PATCH 20/36] fix Flutter SDK update PR #458 included --- lib/main.dart | 24 +++++++++++++++++++++++- lib/screens/channels_screen.dart | 5 +++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index cd622811..37aa29ff 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter/foundation.dart'; +import 'package:flutter/services.dart'; import 'l10n/app_localizations.dart'; import 'package:provider/provider.dart'; @@ -214,7 +215,10 @@ class MeshCoreApp extends StatelessWidget { // Update notification service with resolved locale final locale = Localizations.localeOf(context); NotificationService().setLocale(locale); - return child ?? const SizedBox.shrink(); + return AnnotatedRegion( + value: _systemUiOverlayStyle(context), + child: child ?? const SizedBox.shrink(), + ); }, home: (PlatformInfo.isWeb && !PlatformInfo.isChrome) ? const ChromeRequiredScreen() @@ -236,6 +240,24 @@ class MeshCoreApp extends StatelessWidget { } } + SystemUiOverlayStyle _systemUiOverlayStyle(BuildContext context) { + final theme = Theme.of(context); + final colorScheme = theme.colorScheme; + final isDark = theme.brightness == Brightness.dark; + final iconBrightness = isDark ? Brightness.light : Brightness.dark; + + // Keep Android system bars aligned with the resolved Flutter theme. + return SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + statusBarIconBrightness: iconBrightness, + statusBarBrightness: isDark ? Brightness.dark : Brightness.light, + systemNavigationBarColor: colorScheme.surface, + systemNavigationBarIconBrightness: iconBrightness, + systemNavigationBarDividerColor: colorScheme.surface, + systemNavigationBarContrastEnforced: false, + ); + } + Locale? _localeFromSetting(String? languageCode) { if (languageCode == null) return null; return Locale(languageCode); diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 8b05b8ce..d305a6f3 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -273,8 +273,9 @@ class _ChannelsScreenState extends State ), buildDefaultDragHandles: false, itemCount: filteredChannels.length, - onReorder: (oldIndex, newIndex) { - if (newIndex > oldIndex) newIndex -= 1; + onReorderItem: (oldIndex, newIndex) { + // onReorderItem already adjusts newIndex after the + // removed item, unlike the deprecated onReorder. final reordered = List.from( filteredChannels, ); From ed0e6b6554f16b427498ef85d2baba555b7647fd Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Sat, 23 May 2026 21:06:52 +0300 Subject: [PATCH 21/36] Onstart sync progressbar: init --- lib/connector/meshcore_connector.dart | 263 ++++++++++++++++++------- lib/screens/app_settings_screen.dart | 2 + lib/screens/channel_chat_screen.dart | 2 + lib/screens/channels_screen.dart | 12 +- lib/screens/chat_screen.dart | 2 + lib/screens/contacts_screen.dart | 15 +- lib/screens/map_screen.dart | 2 + lib/screens/settings_screen.dart | 2 + lib/screens/telemetry_screen.dart | 2 + lib/widgets/sync_progress_overlay.dart | 60 ++++++ 10 files changed, 282 insertions(+), 80 deletions(-) create mode 100644 lib/widgets/sync_progress_overlay.dart diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 7cbc8ff0..d1581e44 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -199,6 +199,7 @@ class MeshCoreConnector extends ChangeNotifier { double? _selfLongitude; final List _directRepeaters = List.empty(growable: true); bool _isLoadingContacts = false; + bool _hasLoadedContacts = false; bool _isLoadingChannels = false; bool _hasLoadedChannels = false; TimeoutPredictionService? _timeoutPredictionService; @@ -220,10 +221,13 @@ class MeshCoreConnector extends ChangeNotifier { bool _batteryRequested = false; bool _awaitingSelfInfo = false; bool _hasReceivedDeviceInfo = false; + // Initial sync is serialized for predictable progress. Firmware exposes one + // FIFO queued-message stream, so direct/room frames are buffered until after + // contacts are known. bool _pendingInitialChannelSync = false; bool _pendingInitialContactsSync = false; + bool _pendingInitialQueuedMessageSync = false; bool _bleInitialSyncStarted = false; - bool _pendingDeferredChannelSyncAfterContacts = false; bool _webInitialHandshakeRequestSent = false; bool _preserveContactsOnRefresh = false; bool _autoAddUsers = false; @@ -238,13 +242,18 @@ class MeshCoreConnector extends ChangeNotifier { int _advertLocPolicy = 0; int _multiAcks = 0; - static const int _defaultMaxContacts = 32; - static const int _defaultMaxChannels = 8; + static const int _defaultMaxContacts = 350; + static const int _defaultMaxChannels = 40; int _maxContacts = _defaultMaxContacts; int _maxChannels = _defaultMaxChannels; + int? _contactSyncTotal; + int _contactSyncReceived = 0; + bool _contactSyncUsesSinceFilter = false; bool _isSyncingQueuedMessages = false; + bool _deferQueuedContactMessagesUntilContacts = false; + bool _isProcessingDeferredQueuedContactMessages = false; bool _queuedMessageSyncInFlight = false; - bool _didInitialQueueSync = false; + final List _deferredQueuedContactMessageFrames = []; bool _pendingQueueSync = false; Timer? _queueSyncTimeout; int _queueSyncRetries = 0; @@ -373,7 +382,9 @@ class MeshCoreConnector extends ChangeNotifier { List get channels => List.unmodifiable(_channels); bool get isConnected => _state == MeshCoreConnectionState.connected; bool get isLoadingContacts => _isLoadingContacts; + bool get hasLoadedContacts => _hasLoadedContacts; bool get isLoadingChannels => _isLoadingChannels; + bool get hasLoadedChannels => _hasLoadedChannels; Stream get receivedFrames => _receivedFramesController.stream; Uint8List? get selfPublicKey => _selfPublicKey; String get selfPublicKeyHex => pubKeyToHex(_selfPublicKey ?? Uint8List(0)); @@ -436,7 +447,16 @@ class MeshCoreConnector extends ChangeNotifier { int get maxContacts => _maxContacts; int get maxChannels => _maxChannels; Set get knownContactKeys => Set.unmodifiable(_knownContactKeys); - bool get isSyncingQueuedMessages => _isSyncingQueuedMessages; + double? get contactSyncProgress { + final total = _contactSyncTotal; + if (!_isLoadingContacts || total == null || total <= 0) return null; + return (_contactSyncReceived / total).clamp(0.0, 1.0).toDouble(); + } + + bool get isSyncingQueuedMessages => + _isSyncingQueuedMessages || _isProcessingDeferredQueuedContactMessages; + bool get isShowingQueuedMessageSyncProgress => + _deferQueuedContactMessagesUntilContacts && isSyncingQueuedMessages; bool get isSyncingChannels => _isSyncingChannels; int get channelSyncProgress => _isSyncingChannels && _totalChannelsToRequest > 0 @@ -1515,6 +1535,8 @@ class MeshCoreConnector extends ChangeNotifier { _setState(MeshCoreConnectionState.connected); _pendingInitialChannelSync = true; + _pendingInitialQueuedMessageSync = true; + _pendingInitialContactsSync = true; _appDebugLogService?.info( 'connectUsb: requesting device info…', tag: 'USB', @@ -1625,6 +1647,8 @@ class MeshCoreConnector extends ChangeNotifier { _setState(MeshCoreConnectionState.connected); _pendingInitialChannelSync = true; + _pendingInitialQueuedMessageSync = true; + _pendingInitialContactsSync = true; await _requestDeviceInfo(); _startBatteryPolling(); if (_radioStatsPollRefCount > 0) _startRadioStatsPolling(); @@ -2259,7 +2283,9 @@ class MeshCoreConnector extends ChangeNotifier { return; } _bleInitialSyncStarted = true; + _pendingInitialChannelSync = true; _pendingInitialContactsSync = true; + _pendingInitialQueuedMessageSync = true; await _requestDeviceInfo(); _startBatteryPolling(); @@ -2274,7 +2300,7 @@ class MeshCoreConnector extends ChangeNotifier { } await syncTime(); - unawaited(getChannels()); + _maybeStartInitialChannelSync(); } void _resetConnectionHandshakeState() { @@ -2287,11 +2313,39 @@ class MeshCoreConnector extends ChangeNotifier { _selfInfoRetryTimer?.cancel(); _selfInfoRetryTimer = null; _hasReceivedDeviceInfo = false; + _resetSyncProgressState(); + _bleInitialSyncStarted = false; + _pathHashByteWidth = 1; + } + + void _resetSyncProgressState() { _pendingInitialChannelSync = false; _pendingInitialContactsSync = false; - _bleInitialSyncStarted = false; - _pendingDeferredChannelSyncAfterContacts = false; - _pathHashByteWidth = 1; + _pendingInitialQueuedMessageSync = false; + _contactSyncTotal = null; + _contactSyncReceived = 0; + _contactSyncUsesSinceFilter = false; + _isLoadingContacts = false; + _hasLoadedContacts = false; + _isLoadingChannels = false; + _hasLoadedChannels = false; + _isSyncingQueuedMessages = false; + _deferQueuedContactMessagesUntilContacts = false; + _isProcessingDeferredQueuedContactMessages = false; + _queuedMessageSyncInFlight = false; + _deferredQueuedContactMessageFrames.clear(); + _pendingQueueSync = false; + _queueSyncTimeout?.cancel(); + _queueSyncTimeout = null; + _queueSyncRetries = 0; + _isSyncingChannels = false; + _channelSyncInFlight = false; + _channelSyncTimeout?.cancel(); + _channelSyncTimeout = null; + _channelSyncRetries = 0; + _nextChannelIndexToRequest = 0; + _totalChannelsToRequest = 0; + _previousChannelsCache.clear(); } bool get _shouldAutoReconnect => @@ -2428,17 +2482,9 @@ class MeshCoreConnector extends ChangeNotifier { _batteryRequested = false; _awaitingSelfInfo = false; _hasReceivedDeviceInfo = false; - _pendingInitialChannelSync = false; - _pendingInitialContactsSync = false; _maxContacts = _defaultMaxContacts; _maxChannels = _defaultMaxChannels; - _isSyncingQueuedMessages = false; - _queuedMessageSyncInFlight = false; - _didInitialQueueSync = false; - _pendingQueueSync = false; - _isSyncingChannels = false; - _channelSyncInFlight = false; - _hasLoadedChannels = false; + _resetSyncProgressState(); _pendingChannelSentQueue.clear(); _pendingGenericAckQueue.clear(); _reactionSendQueueSequence = 0; @@ -2691,10 +2737,14 @@ class MeshCoreConnector extends ChangeNotifier { _isLoadingContacts = true; _preserveContactsOnRefresh = preserveExisting; + _contactSyncTotal = null; + _contactSyncReceived = 0; + _contactSyncUsesSinceFilter = since != null; if (!preserveExisting) { + _hasLoadedContacts = false; _contacts.clear(); - notifyListeners(); } + notifyListeners(); await sendFrame(buildGetContactsFrame(since: since)); } @@ -3292,11 +3342,20 @@ class MeshCoreConnector extends ChangeNotifier { Future syncQueuedMessages({bool force = false}) async { if (!isConnected) return; if (!force && _isSyncingQueuedMessages) return; + if (_isProcessingDeferredQueuedContactMessages) { + _pendingQueueSync = true; + return; + } if (_awaitingSelfInfo || _isLoadingContacts) { _pendingQueueSync = true; return; } + if (_isSyncingChannels || _channelSyncInFlight) { + _pendingQueueSync = true; + return; + } _isSyncingQueuedMessages = true; + notifyListeners(); await _requestNextQueuedMessage(); } @@ -3330,6 +3389,8 @@ class MeshCoreConnector extends ChangeNotifier { _isSyncingQueuedMessages = false; _queueSyncTimeout?.cancel(); _queueSyncRetries = 0; + notifyListeners(); + _continueAfterQueuedMessageSync(); } } @@ -3349,6 +3410,8 @@ class MeshCoreConnector extends ChangeNotifier { _queuedMessageSyncInFlight = false; _isSyncingQueuedMessages = false; _queueSyncRetries = 0; + notifyListeners(); + _continueAfterQueuedMessageSync(); } } @@ -3448,6 +3511,7 @@ class MeshCoreConnector extends ChangeNotifier { _isLoadingChannels = true; _isSyncingChannels = true; + _hasLoadedChannels = false; _previousChannelsCache = List.from(_channels); _channels.clear(); _nextChannelIndexToRequest = 0; @@ -3537,6 +3601,7 @@ class MeshCoreConnector extends ChangeNotifier { _nextChannelIndexToRequest++; _channelSyncRetries = 0; _channelSyncInFlight = false; + notifyListeners(); unawaited(_requestNextChannel()); } } @@ -3574,16 +3639,22 @@ class MeshCoreConnector extends ChangeNotifier { _previousChannelsCache.clear(); } - // Fallback: if contact sync was deferred waiting for channel 0 but - // channel sync finished without triggering it, start contacts now. - if (_pendingInitialContactsSync && isConnected) { - _pendingInitialContactsSync = false; - unawaited(getContacts()); + if (isConnected) { + _startPostChannelInitialQueuedMessageSync(); } // Keep cache on failure/disconnection for future attempts } + void _startPostChannelInitialQueuedMessageSync() { + if (_pendingInitialQueuedMessageSync || _pendingQueueSync) { + _deferQueuedContactMessagesUntilContacts = _pendingInitialContactsSync; + _pendingInitialQueuedMessageSync = false; + _pendingQueueSync = false; + unawaited(syncQueuedMessages(force: true)); + } + } + Future setChannel(int index, String name, Uint8List psk) async { if (!isConnected) return; @@ -3633,6 +3704,20 @@ class MeshCoreConnector extends ChangeNotifier { _contacts.clear(); } _isLoadingContacts = true; + _contactSyncReceived = 0; + // Firmware v3+ includes total contacts after CONTACTS_START. + // Incremental sync reports total contacts, not filtered result count. + if (frame.length >= 5 && !_contactSyncUsesSinceFilter) { + final reader = BufferReader(frame); + reader.skipBytes(1); + _contactSyncTotal = reader.readUInt32LE(); + } else if (!_contactSyncUsesSinceFilter) { + // Older firmwares may omit the count; use the nRF node capacity as + // a conservative progress fallback instead of hiding the progress. + _contactSyncTotal = _defaultMaxContacts; + } else { + _contactSyncTotal = null; + } notifyListeners(); break; case pushCodeAdvert: @@ -3650,7 +3735,9 @@ class MeshCoreConnector extends ChangeNotifier { case respCodeEndOfContacts: debugPrint('Got END_OF_CONTACTS'); _isLoadingContacts = false; + _hasLoadedContacts = true; _preserveContactsOnRefresh = false; + _contactSyncUsesSinceFilter = false; unawaited(updateKnownDiscovered()); notifyListeners(); unawaited(_persistContacts()); @@ -3660,23 +3747,21 @@ class MeshCoreConnector extends ChangeNotifier { !_channelSyncInFlight) { unawaited(_requestNextChannel()); } - if (!_didInitialQueueSync || _pendingQueueSync) { - _didInitialQueueSync = true; + if (_deferQueuedContactMessagesUntilContacts) { + unawaited(_processDeferredQueuedContactMessages()); + } else if (_pendingQueueSync) { _pendingQueueSync = false; unawaited(syncQueuedMessages(force: true)); } - if (_pendingDeferredChannelSyncAfterContacts && - (_activeTransport == MeshCoreTransportType.bluetooth || - _activeTransport == MeshCoreTransportType.usb || - _activeTransport == MeshCoreTransportType.tcp)) { - _pendingDeferredChannelSyncAfterContacts = false; - _pendingInitialChannelSync = false; - unawaited(getChannels()); - } break; case respCodeContactMsgRecv: case respCodeContactMsgRecvV3: - _handleIncomingMessage(frame); + if (_shouldDeferQueuedContactMessage(frame)) { + _deferredQueuedContactMessageFrames.add(Uint8List.fromList(frame)); + _handleQueuedMessageReceived(); + } else { + unawaited(_handleIncomingMessage(frame)); + } break; case respCodeChannelMsgRecv: case respCodeChannelMsgRecvV3: @@ -3860,23 +3945,8 @@ class MeshCoreConnector extends ChangeNotifier { _selfInfoRetryTimer = null; notifyListeners(); - // Auto-fetch contacts after getting self info. On web BLE, defer this - // until after channel 0 so startup writes stay serialized. - if (PlatformInfo.isWeb && - _activeTransport == MeshCoreTransportType.bluetooth) { - _pendingInitialContactsSync = true; - } else if (_activeTransport == MeshCoreTransportType.usb || - _activeTransport == MeshCoreTransportType.tcp) { - _pendingDeferredChannelSyncAfterContacts = true; - getContacts(); - } else { - getContacts(); - } - if (_shouldGateInitialChannelSync && - _activeTransport != MeshCoreTransportType.usb && - _activeTransport != MeshCoreTransportType.tcp) { - _maybeStartInitialChannelSync(); - } + // Start the serialized initial sync pipeline after SELF_INFO. + _maybeStartInitialChannelSync(); } void _handleDeviceInfo(Uint8List frame) { @@ -3916,7 +3986,7 @@ class MeshCoreConnector extends ChangeNotifier { unawaited(loadAllChannelMessages(maxChannels: nextMaxChannels)); if (isConnected && _selfPublicKey != null && - (!_shouldGateInitialChannelSync || !_pendingInitialChannelSync)) { + !_pendingInitialChannelSync) { unawaited(getChannels(maxChannels: nextMaxChannels)); } } @@ -3931,12 +4001,13 @@ class MeshCoreConnector extends ChangeNotifier { if (!_pendingInitialChannelSync || !isConnected) { return; } - if (_selfPublicKey == null || !_hasReceivedDeviceInfo) { + if (_selfPublicKey == null || + (_shouldGateInitialChannelSync && !_hasReceivedDeviceInfo)) { return; } _pendingInitialChannelSync = false; - unawaited(getChannels(maxChannels: _maxChannels)); + unawaited(getChannels(maxChannels: _maxChannels, force: true)); } void _handleNoMoreMessages() { @@ -3945,6 +4016,64 @@ class MeshCoreConnector extends ChangeNotifier { _isSyncingQueuedMessages = false; _queuedMessageSyncInFlight = false; _queueSyncRetries = 0; // Reset retry counter on successful completion + notifyListeners(); + _continueAfterQueuedMessageSync(); + } + + bool _shouldDeferQueuedContactMessage(Uint8List frame) { + if (!_deferQueuedContactMessagesUntilContacts || + !_isSyncingQueuedMessages) { + return false; + } + if (frame.isEmpty) return false; + return frame[0] == respCodeContactMsgRecv || + frame[0] == respCodeContactMsgRecvV3; + } + + void _continueAfterQueuedMessageSync() { + if (!_deferQueuedContactMessagesUntilContacts) return; + if (_pendingInitialContactsSync && isConnected) { + _pendingInitialContactsSync = false; + unawaited(getContacts()); + return; + } + unawaited(_processDeferredQueuedContactMessages()); + } + + Future _processDeferredQueuedContactMessages() async { + if (!_deferQueuedContactMessagesUntilContacts || + _isProcessingDeferredQueuedContactMessages) { + return; + } + if (_deferredQueuedContactMessageFrames.isEmpty) { + _deferQueuedContactMessagesUntilContacts = false; + notifyListeners(); + if (_pendingQueueSync && isConnected) { + _pendingQueueSync = false; + unawaited(syncQueuedMessages(force: true)); + } + return; + } + + _isProcessingDeferredQueuedContactMessages = true; + notifyListeners(); + try { + // Replay direct/room queued messages only after contacts are loaded, so + // sender prefixes can be resolved against the current contact list. + while (_deferredQueuedContactMessageFrames.isNotEmpty) { + final frame = _deferredQueuedContactMessageFrames.removeAt(0); + await _handleIncomingMessage(frame); + } + } finally { + _deferQueuedContactMessagesUntilContacts = false; + _isProcessingDeferredQueuedContactMessages = false; + notifyListeners(); + } + + if (_pendingQueueSync && isConnected) { + _pendingQueueSync = false; + unawaited(syncQueuedMessages(force: true)); + } } void _handleQueuedMessageReceived() { @@ -3953,6 +4082,7 @@ class MeshCoreConnector extends ChangeNotifier { _queueSyncTimeout?.cancel(); // Cancel timeout - message arrived _queuedMessageSyncInFlight = false; _queueSyncRetries = 0; // Reset retry counter on successful message + notifyListeners(); unawaited(_requestNextQueuedMessage()); } @@ -4094,11 +4224,15 @@ class MeshCoreConnector extends ChangeNotifier { void _handleContact(Uint8List frame, {bool isContact = true}) { final contactTmp = Contact.fromFrame(frame); if (contactTmp != null) { + if (isContact && _isLoadingContacts) { + _contactSyncReceived++; + } if (listEquals(contactTmp.publicKey, _selfPublicKey)) { appLogger.info( 'Ignoring contact with self public key: ${contactTmp.name}', tag: 'Connector', ); + notifyListeners(); removeContact(contactTmp); return; } @@ -4162,6 +4296,7 @@ class MeshCoreConnector extends ChangeNotifier { "Discovered contact ${contact.name} (type ${contact.typeLabelRaw}) not added due to auto-add settings", tag: 'Connector', ); + notifyListeners(); return; } } @@ -4370,7 +4505,7 @@ class MeshCoreConnector extends ChangeNotifier { return false; } - void _handleIncomingMessage(Uint8List frame) async { + Future _handleIncomingMessage(Uint8List frame) async { if (_selfPublicKey == null) return; var message = _parseContactMessage(frame); @@ -5092,14 +5227,7 @@ class MeshCoreConnector extends ChangeNotifier { // Move to next channel _nextChannelIndexToRequest++; - if (PlatformInfo.isWeb && - _activeTransport == MeshCoreTransportType.bluetooth && - channel.index == 0 && - _pendingInitialContactsSync) { - _pendingInitialContactsSync = false; - unawaited(getContacts()); - return; - } + notifyListeners(); unawaited(_requestNextChannel()); return; } else { @@ -5799,14 +5927,9 @@ class MeshCoreConnector extends ChangeNotifier { // Preserve deviceId and displayName for UI display during reconnection // They're only cleared on manual disconnect via disconnect() method _hasReceivedDeviceInfo = false; - _pendingInitialChannelSync = false; - _pendingInitialContactsSync = false; _maxContacts = _defaultMaxContacts; _maxChannels = _defaultMaxChannels; - _isSyncingQueuedMessages = false; - _queuedMessageSyncInFlight = false; - _isSyncingChannels = false; - _channelSyncInFlight = false; + _resetSyncProgressState(); _pendingChannelSentQueue.clear(); _pendingGenericAckQueue.clear(); _reactionSendQueueSequence = 0; diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 94b3efe8..aaae8011 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -11,6 +11,7 @@ import '../services/app_settings_service.dart'; import '../services/notification_service.dart'; import '../services/translation_service.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../helpers/snack_bar_builder.dart'; import 'map_cache_screen.dart'; @@ -23,6 +24,7 @@ class AppSettingsScreen extends StatelessWidget { appBar: AppBar( title: AdaptiveAppBarTitle(context.l10n.appSettings_title), centerTitle: true, + bottom: const SyncProgressAppBarBottom(), ), body: SafeArea( top: false, diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index be72eaa8..8562f7d1 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -34,6 +34,7 @@ import '../widgets/gif_picker.dart'; import '../widgets/message_translation_button.dart'; import '../widgets/message_status_icon.dart'; import '../widgets/radio_stats_entry.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/translated_message_content.dart'; import '../widgets/unread_divider.dart'; import 'channel_message_path_screen.dart'; @@ -302,6 +303,7 @@ class _ChannelChatScreenState extends State { ], ), centerTitle: false, + bottom: const SyncProgressAppBarBottom(), actions: [ const RadioStatsIconButton(), PopupMenuButton( diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index d305a6f3..1475bdef 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -23,6 +23,7 @@ import '../widgets/list_filter_widget.dart'; import '../widgets/empty_state.dart'; import '../widgets/qr_code_display.dart'; import '../widgets/quick_switch_bar.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/unread_badge.dart'; import '../helpers/snack_bar_builder.dart'; import 'channel_chat_screen.dart'; @@ -103,6 +104,7 @@ class _ChannelsScreenState extends State title: AppBarTitle(context.l10n.channels_title), centerTitle: true, automaticallyImplyLeading: false, + bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( itemBuilder: (context) => [ @@ -152,12 +154,16 @@ class _ChannelsScreenState extends State await context.read().getChannels(force: true); }, child: () { - if (connector.isLoadingChannels) { + final channels = connector.channels; + final waitingForInitialChannels = + !connector.hasLoadedChannels && !connector.isLoadingChannels; + final waitingForFirstChannel = + connector.isLoadingChannels && channels.isEmpty; + + if (waitingForInitialChannels || waitingForFirstChannel) { return const Center(child: CircularProgressIndicator()); } - final channels = connector.channels; - if (channels.isEmpty) { return ListView( children: [ diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 1548b44e..a2747043 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -41,6 +41,7 @@ import '../widgets/gif_picker.dart'; import '../widgets/message_translation_button.dart'; import '../widgets/path_selection_dialog.dart'; import '../widgets/radio_stats_entry.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/translated_message_content.dart'; import '../utils/app_logger.dart'; import '../l10n/l10n.dart'; @@ -216,6 +217,7 @@ class _ChatScreenState extends State { }, ), centerTitle: false, + bottom: const SyncProgressAppBarBottom(), actions: [ Consumer( builder: (context, connector, _) { diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index d5e1b79a..bdadc2b6 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -27,6 +27,7 @@ import '../widgets/empty_state.dart'; import '../widgets/quick_switch_bar.dart'; import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../widgets/unread_badge.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; @@ -318,6 +319,7 @@ class _ContactsScreenState extends State appBar: AppBar( title: AppBarTitle(context.l10n.contacts_title), automaticallyImplyLeading: false, + bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( itemBuilder: (context) => [ @@ -606,15 +608,14 @@ class _ContactsScreenState extends State Widget _buildContactsBody(BuildContext context, MeshCoreConnector connector) { final viewState = context.watch(); final contacts = connector.contacts; - final shouldShowStartupSpinner = - contacts.isEmpty && - _groups.isEmpty && + final waitingForInitialContacts = connector.isConnected && - (connector.isLoadingContacts || - connector.isLoadingChannels || - connector.selfPublicKey == null); + !connector.hasLoadedContacts && + !connector.isLoadingContacts; + final waitingForFirstContact = + connector.isLoadingContacts && contacts.isEmpty; - if (shouldShowStartupSpinner) { + if (waitingForInitialContacts || waitingForFirstContact) { return const Center(child: CircularProgressIndicator()); } diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index be133240..766b1852 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -23,6 +23,7 @@ import '../services/map_tile_cache_service.dart'; import '../utils/contact_search.dart'; import '../utils/route_transitions.dart'; import '../widgets/quick_switch_bar.dart'; +import '../widgets/sync_progress_overlay.dart'; import '../icons/los_icon.dart'; import 'channels_screen.dart'; import 'chat_screen.dart'; @@ -414,6 +415,7 @@ class _MapScreenState extends State { title: AppBarTitle(context.l10n.map_title), centerTitle: true, automaticallyImplyLeading: false, + bottom: const SyncProgressAppBarBottom(), actions: [ if (!_isBuildingPathTrace) IconButton( diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 5679f757..ead36eaf 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -16,6 +16,7 @@ import 'app_settings_screen.dart'; import 'app_debug_log_screen.dart'; import 'ble_debug_log_screen.dart'; import '../widgets/radio_stats_entry.dart'; +import '../widgets/sync_progress_overlay.dart'; /// Convert device coding-rate value (1-4 on some firmware, 5-8 on others) /// to the UI enum range (always 5-8). @@ -67,6 +68,7 @@ class _SettingsScreenState extends State { indicators: false, subtitle: false, ), + bottom: const SyncProgressAppBarBottom(), ), body: SafeArea( top: false, diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index 47593a3f..873ca3b1 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -15,6 +15,7 @@ import '../widgets/path_management_dialog.dart'; import '../helpers/cayenne_lpp.dart'; import '../utils/battery_utils.dart'; import '../helpers/snack_bar_builder.dart'; +import '../widgets/sync_progress_overlay.dart'; class TelemetryScreen extends StatefulWidget { final Contact contact; @@ -239,6 +240,7 @@ class _TelemetryScreenState extends State { ], ), centerTitle: false, + bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), diff --git a/lib/widgets/sync_progress_overlay.dart b/lib/widgets/sync_progress_overlay.dart new file mode 100644 index 00000000..4aef90ea --- /dev/null +++ b/lib/widgets/sync_progress_overlay.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; + +class SyncProgressAppBarBottom extends StatelessWidget + implements PreferredSizeWidget { + static const double height = 3; + + const SyncProgressAppBarBottom({super.key}); + + @override + Size get preferredSize => const Size.fromHeight(height); + + @override + Widget build(BuildContext context) { + return Consumer( + builder: (context, connector, _) { + final state = _SyncProgressState.fromConnector(connector); + if (state == null) return const SizedBox(height: height); + + return SizedBox( + height: height, + child: LinearProgressIndicator( + value: state.value, + minHeight: height, + color: state.color, + backgroundColor: state.color.withValues(alpha: 0.18), + ), + ); + }, + ); + } +} + +class _SyncProgressState { + final double? value; + final Color color; + + const _SyncProgressState({required this.value, required this.color}); + + static _SyncProgressState? fromConnector(MeshCoreConnector connector) { + if (connector.isLoadingContacts) { + return _SyncProgressState( + value: connector.contactSyncProgress, + color: Colors.red, + ); + } + if (connector.isSyncingChannels) { + return _SyncProgressState( + value: connector.channelSyncProgress / 100, + color: Colors.blue, + ); + } + if (connector.isShowingQueuedMessageSyncProgress) { + return const _SyncProgressState(value: null, color: Colors.green); + } + return null; + } +} From 4dd472e3c3a6fe6c4b841c8f722827ba81f8a716 Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Sun, 24 May 2026 15:33:54 +0300 Subject: [PATCH 22/36] Onstart sync progressbar: changed default screen to channels Because it's synchronization is faster and first in line --- lib/screens/scanner_screen.dart | 4 ++-- lib/screens/tcp_screen.dart | 14 +++++++------- lib/screens/usb_screen.dart | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index a503ec0e..ec148c5f 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -11,7 +11,7 @@ import '../utils/app_logger.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../widgets/device_tile.dart'; import '../helpers/snack_bar_builder.dart'; -import 'contacts_screen.dart'; +import 'channels_screen.dart'; import 'tcp_screen.dart'; import 'usb_screen.dart'; @@ -46,7 +46,7 @@ class _ScannerScreenState extends State { _changedNavigation = true; if (mounted) { Navigator.of(context).push( - MaterialPageRoute(builder: (context) => const ContactsScreen()), + MaterialPageRoute(builder: (context) => const ChannelsScreen()), ); } } diff --git a/lib/screens/tcp_screen.dart b/lib/screens/tcp_screen.dart index 3bd1b0bf..a0d71922 100644 --- a/lib/screens/tcp_screen.dart +++ b/lib/screens/tcp_screen.dart @@ -9,7 +9,7 @@ import '../services/app_settings_service.dart'; import '../utils/platform_info.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; -import 'contacts_screen.dart'; +import 'channels_screen.dart'; import 'usb_screen.dart'; class TcpScreen extends StatefulWidget { @@ -24,7 +24,7 @@ class _TcpScreenState extends State { late final TextEditingController _portController; late final MeshCoreConnector _connector; late final VoidCallback _connectionListener; - bool _navigatedToContacts = false; + bool _navigatedToChannels = false; @override void initState() { @@ -42,20 +42,20 @@ class _TcpScreenState extends State { _connectionListener = () { if (!mounted) return; if (_connector.state == MeshCoreConnectionState.disconnected) { - _navigatedToContacts = false; + _navigatedToChannels = false; } if (_connector.state == MeshCoreConnectionState.connected && _connector.isTcpTransportConnected && - !_navigatedToContacts) { + !_navigatedToChannels) { context.read().setTcpServerAddress( _hostController.text, ); context.read().setTcpServerPort( int.tryParse(_portController.text) ?? 0, ); - _navigatedToContacts = true; + _navigatedToChannels = true; Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const ContactsScreen()), + MaterialPageRoute(builder: (_) => const ChannelsScreen()), ); } }; @@ -67,7 +67,7 @@ class _TcpScreenState extends State { _hostController.dispose(); _portController.dispose(); _connector.removeListener(_connectionListener); - if (!_navigatedToContacts && + if (!_navigatedToChannels && _connector.activeTransport == MeshCoreTransportType.tcp && _connector.state != MeshCoreConnectionState.disconnected) { WidgetsBinding.instance.addPostFrameCallback((_) { diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index 6b8fe9d9..25992de8 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -11,7 +11,7 @@ import '../utils/platform_info.dart'; import '../utils/usb_port_labels.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; -import 'contacts_screen.dart'; +import 'channels_screen.dart'; import 'scanner_screen.dart'; import 'tcp_screen.dart'; @@ -25,7 +25,7 @@ class UsbScreen extends StatefulWidget { class _UsbScreenState extends State { final List _ports = []; bool _isLoadingPorts = true; - bool _navigatedToContacts = false; + bool _navigatedToChannels = false; bool _didScheduleInitialLoad = false; Timer? _hotPlugTimer; late final MeshCoreConnector _connector; @@ -41,14 +41,14 @@ class _UsbScreenState extends State { _connectionListener = () { if (!mounted) return; if (_connector.state == MeshCoreConnectionState.disconnected) { - _navigatedToContacts = false; + _navigatedToChannels = false; } if (_connector.state == MeshCoreConnectionState.connected && _connector.isUsbTransportConnected && - !_navigatedToContacts) { - _navigatedToContacts = true; + !_navigatedToChannels) { + _navigatedToChannels = true; Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const ContactsScreen()), + MaterialPageRoute(builder: (_) => const ChannelsScreen()), ); } }; @@ -72,7 +72,7 @@ class _UsbScreenState extends State { _hotPlugTimer?.cancel(); _hotPlugTimer = null; _connector.removeListener(_connectionListener); - if (!_navigatedToContacts && + if (!_navigatedToChannels && _connector.activeTransport == MeshCoreTransportType.usb && _connector.state != MeshCoreConnectionState.disconnected) { WidgetsBinding.instance.addPostFrameCallback((_) { From 2328848400b002e626363eea535c2b42f426504d Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Tue, 26 May 2026 00:37:42 +0300 Subject: [PATCH 23/36] Onstart sync progressbar: fix potential bug with spinner on interrupt synchronization --- lib/connector/meshcore_connector.dart | 9 +++++++++ lib/screens/channels_screen.dart | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index d1581e44..271ea069 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -3637,6 +3637,12 @@ class MeshCoreConnector extends ChangeNotifier { if (completed) { _hasLoadedChannels = true; _previousChannelsCache.clear(); + } else if (_channels.isEmpty && _previousChannelsCache.isNotEmpty) { + // A failed initial sync should not leave the UI empty/spinning forever. + // Restore the pre-sync list so cached channels remain usable. + _channels.addAll(_previousChannelsCache); + _applyChannelOrder(); + _recalculateCachedChannelsUnreadTotal(); } if (isConnected) { @@ -3644,6 +3650,9 @@ class MeshCoreConnector extends ChangeNotifier { } // Keep cache on failure/disconnection for future attempts + if (!completed) { + notifyListeners(); + } } void _startPostChannelInitialQueuedMessageSync() { diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 1475bdef..40726021 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -155,12 +155,13 @@ class _ChannelsScreenState extends State }, child: () { final channels = connector.channels; - final waitingForInitialChannels = - !connector.hasLoadedChannels && !connector.isLoadingChannels; final waitingForFirstChannel = connector.isLoadingChannels && channels.isEmpty; - if (waitingForInitialChannels || waitingForFirstChannel) { + // Only block the list while the first channel is actively loading. + // If the initial sync aborts, show cached/partial channels instead + // of trapping the user behind an idle spinner. + if (waitingForFirstChannel) { return const Center(child: CircularProgressIndicator()); } From 6a7dd981a262ff5bc6e90a3c5e9a6c5d9d46551b Mon Sep 17 00:00:00 2001 From: HDDen <62592944+HDDen@users.noreply.github.com> Date: Tue, 26 May 2026 21:01:18 +0300 Subject: [PATCH 24/36] =?UTF-8?q?Fix=20=C2=ABDispose=20the=20telemetry=20m?= =?UTF-8?q?ap=20controller=20on=20widget=20teardown=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/widgets/telemetry_location_map.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/widgets/telemetry_location_map.dart b/lib/widgets/telemetry_location_map.dart index f6baff71..b47d16d1 100644 --- a/lib/widgets/telemetry_location_map.dart +++ b/lib/widgets/telemetry_location_map.dart @@ -41,6 +41,12 @@ class _TelemetryLocationMapState extends State { LatLng get _position => LatLng(widget.latitude, widget.longitude); + @override + void dispose() { + _mapController.dispose(); + super.dispose(); + } + @override void didUpdateWidget(covariant TelemetryLocationMap oldWidget) { super.didUpdateWidget(oldWidget); From dfdcafb071cab08b6b88c73d263143acd4c5e4b8 Mon Sep 17 00:00:00 2001 From: me Date: Mon, 8 Jun 2026 15:30:43 -0700 Subject: [PATCH 25/36] fix(l10n): correct ja repeater terminology MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace machine-translated repeater terms with consistent Japanese: - 繰り返し送信装置 → リピーター (map, listFilter) - 繰り返し設定 → リピーターを自動追加 (contactsSettings) - ホップの繰り返し → リピーターホップ (channelPath) - 繰り返し送信する、近隣 → 近隣のリピーター (neighbors) - 近くの電波中継局 → 近くのリピーター (snrIndicator) - 送信装置名 → リピーター名 (repeater settings) - オフグリッド...の繰り返し → オフグリッドリピーター (settings) - 中継装置およびルームサーバーの設置場所 → リピーター/ルームサーバーの位置情報 - 繰り返し送信に関する情報 → リピーターに関する情報 (repeater_guest) --- lib/l10n/app_ja.arb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index b525ce41..fe8f6893 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -216,7 +216,7 @@ "settings_txPower": "TX 信号電力 (dBm)", "settings_txPowerHelper": "0 - 22", "settings_txPowerInvalid": "無効な送信電力 (0-22 dBm)", - "settings_clientRepeat": "オフグリッド(電力網から孤立した状態)の繰り返し", + "settings_clientRepeat": "オフグリッドリピーター", "settings_clientRepeatSubtitle": "このデバイスが、他のデバイスに対してメッシュパケットを繰り返し送信できるようにする。", "settings_clientRepeatFreqWarning": "オフグリッドでの再送には、433MHz、869MHz、または918MHzの周波数が必要です。", "settings_error": "エラー:{message}", @@ -834,7 +834,7 @@ } }, "map_chat": "チャット", - "map_repeater": "繰り返し送信装置", + "map_repeater": "リピーター", "map_room": "部屋", "map_sensor": "センサー", "map_pinDm": "ピン(DM)", @@ -866,7 +866,7 @@ "map_filterNodes": "フィルタノード", "map_nodeTypes": "ノードの種類", "map_chatNodes": "チャットノード", - "map_repeaters": "繰り返し送信装置", + "map_repeaters": "リピーター", "map_otherNodes": "その他のノード", "map_keyPrefix": "主要なプレフィックス", "map_filterByKeyPrefix": "主要なプレフィックスでフィルタリングする", @@ -1187,7 +1187,7 @@ }, "repeater_settingsTitle": "リピーター設定", "repeater_basicSettings": "基本設定", - "repeater_repeaterName": "送信装置名", + "repeater_repeaterName": "リピーター名", "repeater_repeaterNameHelper": "このリピーターの名前", "repeater_adminPassword": "管理者パスワード", "repeater_adminPasswordHelper": "完全アクセス権のパスワード", @@ -1567,7 +1567,7 @@ } } }, - "neighbors_repeatersNeighbors": "繰り返し送信する、近隣", + "neighbors_repeatersNeighbors": "近隣のリピーター", "neighbors_noData": "近隣のデータは利用できません。", "neighbors_unknownContact": "不明な {pubkey}", "@neighbors_unknownContact": { @@ -1588,12 +1588,12 @@ "channelPath_title": "パケットパス", "channelPath_viewMap": "地図を表示する", "channelPath_otherObservedPaths": "観察されたその他の経路", - "channelPath_repeaterHops": "ホップの繰り返し", + "channelPath_repeaterHops": "リピーターホップ", "channelPath_noHopDetails": "このパッケージに関する詳細な情報は提供されていません。", "channelPath_messageDetails": "メッセージの詳細", "channelPath_senderLabel": "送信者", "channelPath_timeLabel": "時間", - "channelPath_repeatsLabel": "繰り返し", + "channelPath_repeatsLabel": "リピーター", "channelPath_pathLabel": "{index} 番目の経路", "channelPath_observedLabel": "観察", "channelPath_observedPathTitle": "観察された経路 {index} • {hops}", @@ -1653,7 +1653,7 @@ } }, "channelPath_mapTitle": "経路図", - "channelPath_noRepeaterLocations": "この経路には、中継装置の設置場所がありません。", + "channelPath_noRepeaterLocations": "この経路にリピーターの位置情報はありません。", "channelPath_primaryPath": "{index}番目の経路(主要経路)", "@channelPath_primaryPath": { "placeholders": { @@ -1831,7 +1831,7 @@ "listFilter_addToFavorites": "お気に入りに追加", "listFilter_removeFromFavorites": "お気に入りから削除", "listFilter_users": "利用者", - "listFilter_repeaters": "繰り返し送信装置", + "listFilter_repeaters": "リピーター", "listFilter_roomServers": "ルーム用サーバー", "listFilter_unreadOnly": "未読のみ", "listFilter_newGroup": "新しいグループ", @@ -1977,7 +1977,7 @@ "contacts_pathTrace": "経路追跡", "contacts_ping": "パング", "contacts_repeaterPathTrace": "リピーターまでの経路を追跡する", - "contacts_repeaterPing": "PING 繰り返し", + "contacts_repeaterPing": "リピーターにPING", "contacts_roomPathTrace": "部屋のサーバーへの経路を追跡する", "contacts_roomPing": "ピンルーム用サーバー", "contacts_chatTraceRoute": "経路の追跡ルート", @@ -2047,19 +2047,19 @@ "settings_gpxExportNoContacts": "エクスポートする連絡先は存在しません。", "settings_gpxExportNotAvailable": "このデバイス/OSではサポートされていません", "settings_gpxExportError": "エクスポート時にエラーが発生しました。", - "settings_gpxExportRepeatersRoom": "中継装置およびルームサーバーの設置場所", + "settings_gpxExportRepeatersRoom": "リピーター/ルームサーバーの位置情報", "settings_gpxExportChat": "関連施設", "settings_gpxExportAllContacts": "すべての連絡先場所", "settings_gpxExportShareText": "meshcore-openからエクスポートされた地図データ", "settings_gpxExportShareSubject": "meshcore-open GPX形式の地図データのエクスポート", - "snrIndicator_nearByRepeaters": "近くの電波中継局", + "snrIndicator_nearByRepeaters": "近くのリピーター", "snrIndicator_lastSeen": "最後に確認された場所", "contactsSettings_title": "連絡先設定", "contactsSettings_autoAddTitle": "自動検出", "contactsSettings_otherTitle": "その他の連絡に関する設定", "contactsSettings_autoAddUsersTitle": "自動でユーザーを追加する", "contactsSettings_autoAddUsersSubtitle": "利用者が自動的に発見したユーザーを追加できるようにする。", - "contactsSettings_autoAddRepeatersTitle": "自動で繰り返し設定", + "contactsSettings_autoAddRepeatersTitle": "リピーターを自動追加", "contactsSettings_autoAddRepeatersSubtitle": "発見した中継局を、自動的に追加できるようにする。", "contactsSettings_autoAddRoomServersTitle": "自動でルームサーバーを追加", "contactsSettings_autoAddRoomServersSubtitle": "利用者が、発見した部屋のサーバーを自動的に追加できるようにする。", @@ -2232,7 +2232,7 @@ "repeater_clockSyncAfterLoginSubtitle": "ログインが成功した場合、自動的に「時刻同期」を送信する。", "room_guest": "ルームサーバーに関する情報", "chat_sendMessage": "メッセージを送信する", - "repeater_guest": "繰り返し送信に関する情報", + "repeater_guest": "リピーターに関する情報", "repeater_guestTools": "ゲスト向けツール", "repeater_getCategory": "価値を取得する", "repeater_powerMgmt": "電力管理", From 13d3a107da9089b9a55c8143d74a699cd9cfe3d7 Mon Sep 17 00:00:00 2001 From: me Date: Mon, 8 Jun 2026 16:18:18 -0700 Subject: [PATCH 26/36] fix(l10n): replace flood/repeater machine translations in Japanese MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 洪水 → フラッド (flood routing terminology) - リピーター → リピータ (consistent katakana without long vowel) - 中継局 → リピータ - 繰り返し送信装置 → リピータ - オフグリッド...の繰り返し → オフグリッドリピータ - 最大浸水範囲の回数 → フラッドパケットの最大ホップ数 - インバウンドフラッパケット → インバウンドフラッドパケット (typo fix) - ルーティングループに見えるような、洪水パケットを送信する → ルーティングループを検知する - カスタムパスには、メッセージを中継できる中間地点が必要です → リピータが必要です - ワンホップでの広告放送(中継なし)→(リピータなし) --- lib/l10n/app_ja.arb | 148 ++++++++++++++++++++++---------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index fe8f6893..e000a0d9 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -216,7 +216,7 @@ "settings_txPower": "TX 信号電力 (dBm)", "settings_txPowerHelper": "0 - 22", "settings_txPowerInvalid": "無効な送信電力 (0-22 dBm)", - "settings_clientRepeat": "オフグリッドリピーター", + "settings_clientRepeat": "オフグリッドリピータ", "settings_clientRepeatSubtitle": "このデバイスが、他のデバイスに対してメッシュパケットを繰り返し送信できるようにする。", "settings_clientRepeatFreqWarning": "オフグリッドでの再送には、433MHz、869MHz、または918MHzの周波数が必要です。", "settings_error": "エラー:{message}", @@ -270,7 +270,7 @@ "appSettings_pathsWillBeCleared": "5回失敗した後、経路が再開されます。", "appSettings_pathsWillNotBeCleared": "パスは自動で削除されません。", "appSettings_autoRouteRotation": "自動ルートの切り替え", - "appSettings_autoRouteRotationSubtitle": "最適なルートと、洪水モードを切り替える", + "appSettings_autoRouteRotationSubtitle": "最適なルートと、フラッドモードを切り替える", "appSettings_autoRouteRotationEnabled": "自動ルートの切り替え機能が有効になっています", "appSettings_autoRouteRotationDisabled": "自動ルートの変更機能が無効になっています。", "appSettings_maxRouteWeight": "最大ルート重量", @@ -310,7 +310,7 @@ "appSettings_batteryLipo": "LiPo (3.0-4.2V)", "appSettings_mapDisplay": "地図の表示", "appSettings_showRepeaters": "繰り返し再生機能", - "appSettings_showRepeatersSubtitle": "地図上にリピーターノードを表示する", + "appSettings_showRepeatersSubtitle": "地図上にリピータノードを表示する", "appSettings_showChatNodes": "チャットノードの表示", "appSettings_showChatNodesSubtitle": "地図上にチャットノードを表示する", "appSettings_showOtherNodes": "他のノードを表示する", @@ -424,7 +424,7 @@ } } }, - "contacts_manageRepeater": "リピーターの管理", + "contacts_manageRepeater": "リピータの管理", "contacts_manageRoom": "ルームサーバーの管理", "contacts_roomLogin": "ルームサーバーへのログイン", "contacts_openChat": "自由な会話", @@ -735,7 +735,7 @@ "chat_ShowAllPaths": "すべての経路を表示", "chat_routingMode": "ルーティングモード", "chat_autoUseSavedPath": "自動 (保存されたパスを使用)", - "chat_forceFloodMode": "強制的に洪水モードを起動", + "chat_forceFloodMode": "強制的にフラッドモードを起動", "chat_recentAckPaths": "最近使用したACKパス(タップして使用):", "chat_pathHistoryFull": "パスの履歴は完全です。エントリを削除して、新しいものを追加できます。", "chat_hopSingular": "ジャンプ", @@ -758,7 +758,7 @@ "chat_clearPathSubtitle": "次回送信時に、以前の情報を再取得する", "chat_pathCleared": "経路が確保されました。次のメッセージでルートを再確認します。", "chat_floodModeSubtitle": "アプリのバーにあるルーティング切り替え機能を使用する", - "chat_floodModeEnabled": "洪水モードが有効になっています。アプリのメニューバーにあるルートアイコンを使用して、モードを切り替えることができます。", + "chat_floodModeEnabled": "フラッドモードが有効になっています。アプリのメニューバーにあるルートアイコンを使用して、モードを切り替えることができます。", "chat_fullPath": "フルパス", "chat_pathDetailsNotAvailable": "経路の詳細については、まだ情報がありません。「リフレッシュ」ボタンを押して、再度お試しください。", "chat_pathSetHops": "Path set: {hopCount} {hopCount, plural, =1{hop} other{hops}} - {status}", @@ -779,7 +779,7 @@ "chat_path": "道", "chat_publicKey": "公開鍵", "chat_compressOutgoingMessages": "送信されるメッセージを圧縮する", - "chat_floodForced": "洪水(強制的な)", + "chat_floodForced": "フラッド(強制的な)", "chat_directForced": "直接的な(強制的な)", "chat_hopsForced": "{count} 本のホップ(強制的に採取)", "@chat_hopsForced": { @@ -789,7 +789,7 @@ } } }, - "chat_floodAuto": "洪水 (自動)", + "chat_floodAuto": "フラッド (自動)", "chat_direct": "直接", "chat_poiShared": "共有されたPOI", "chat_unread": "未読: {count}", @@ -834,7 +834,7 @@ } }, "map_chat": "チャット", - "map_repeater": "リピーター", + "map_repeater": "リピータ", "map_room": "部屋", "map_sensor": "センサー", "map_pinDm": "ピン(DM)", @@ -866,7 +866,7 @@ "map_filterNodes": "フィルタノード", "map_nodeTypes": "ノードの種類", "map_chatNodes": "チャットノード", - "map_repeaters": "リピーター", + "map_repeaters": "リピータ", "map_otherNodes": "その他のノード", "map_keyPrefix": "主要なプレフィックス", "map_filterByKeyPrefix": "主要なプレフィックスでフィルタリングする", @@ -879,7 +879,7 @@ "map_lastSeenTime": "最後に確認された時間", "map_sharedPin": "共有パスワード", "map_joinRoom": "部屋に参加する", - "map_manageRepeater": "リピーターの管理", + "map_manageRepeater": "リピータの管理", "map_tapToAdd": "ノードをクリックして、パスに追加します。", "map_runTrace": "パスの追跡を実行", "map_removeLast": "最後のものを削除", @@ -1012,12 +1012,12 @@ "login_enterPassword": "パスワードを入力してください", "login_savePassword": "パスワードを保存する", "login_savePasswordSubtitle": "パスワードは、このデバイスに安全に保存されます。", - "login_repeaterDescription": "設定やステータスにアクセスするために、リピーターのパスワードを入力してください。", + "login_repeaterDescription": "設定やステータスにアクセスするために、リピータのパスワードを入力してください。", "login_roomDescription": "設定やステータスへのアクセスには、部屋のパスワードを入力してください。", "login_routing": "経路設定", "login_routingMode": "ルーティングモード", "login_autoUseSavedPath": "自動 (保存されたパスを使用)", - "login_forceFloodMode": "強制的に洪水モードを起動", + "login_forceFloodMode": "強制的にフラッドモードを起動", "login_managePaths": "パスの管理", "login_login": "ログイン", "login_attempt": "試行回数:{current}/{max}", @@ -1066,7 +1066,7 @@ "path_helperMaxHops": "最大64個のホップ。各プレフィックスは2つの16進数文字(1バイト)で構成されています。", "path_selectFromContacts": "または、連絡先リストから選択してください:", "path_noRepeatersFound": "繰り返し機能やルームサーバーは見つかりませんでした。", - "path_customPathsRequire": "カスタムパスには、メッセージを中継できる中間地点が必要です。", + "path_customPathsRequire": "カスタムパスには、メッセージを中継できるリピータが必要です。", "path_invalidHexPrefixes": "無効な16進数プレフィックス: {prefixes}", "@path_invalidHexPrefixes": { "placeholders": { @@ -1077,23 +1077,23 @@ }, "path_tooLong": "経路が長すぎる。最大64回のジャンプのみ許可。", "path_setPath": "パスを設定", - "repeater_management": "リピーター管理", + "repeater_management": "リピータ管理", "room_management": "ルームサーバーの管理", "repeater_managementTools": "管理ツール", "repeater_status": "ステータス", - "repeater_statusSubtitle": "リピーターの状態、統計情報、および隣接するネットワークの情報を表示する", + "repeater_statusSubtitle": "リピータの状態、統計情報、および隣接するネットワークの情報を表示する", "repeater_telemetry": "テレメトリー", "repeater_telemetrySubtitle": "センサーおよびシステムの状態に関するテレメトリの表示", "repeater_cli": "CLI(コマンドラインインターフェース)", - "repeater_cliSubtitle": "リピーターへのコマンドを送信する", + "repeater_cliSubtitle": "リピータへのコマンドを送信する", "repeater_neighbors": "近隣住民", "repeater_neighborsSubtitle": "ゼロホップの隣接ノードを表示する。", "repeater_settings": "設定", - "repeater_settingsSubtitle": "リピーターのパラメータを設定する", + "repeater_settingsSubtitle": "リピータのパラメータを設定する", "repeater_statusTitle": "再送ステータス", "repeater_routingMode": "ルーティングモード", "repeater_autoUseSavedPath": "自動 (保存されたパスを使用)", - "repeater_forceFloodMode": "強制的に洪水モードを起動", + "repeater_forceFloodMode": "強制的にフラッドモードを起動", "repeater_pathManagement": "経路管理", "repeater_refresh": "リフレッシュ", "repeater_statusRequestTimeout": "ステータス情報の取得に失敗しました。", @@ -1138,7 +1138,7 @@ } } }, - "repeater_packetTxTotal": "合計: {total}, 洪水: {flood}, 直接: {direct}", + "repeater_packetTxTotal": "合計: {total}, フラッド: {flood}, 直接: {direct}", "@repeater_packetTxTotal": { "placeholders": { "total": { @@ -1152,7 +1152,7 @@ } } }, - "repeater_packetRxTotal": "合計: {total}, 洪水: {flood}, 直接: {direct}", + "repeater_packetRxTotal": "合計: {total}, フラッド: {flood}, 直接: {direct}", "@repeater_packetRxTotal": { "placeholders": { "total": { @@ -1185,10 +1185,10 @@ } } }, - "repeater_settingsTitle": "リピーター設定", + "repeater_settingsTitle": "リピータ設定", "repeater_basicSettings": "基本設定", - "repeater_repeaterName": "リピーター名", - "repeater_repeaterNameHelper": "このリピーターの名前", + "repeater_repeaterName": "リピータ名", + "repeater_repeaterNameHelper": "このリピータの名前", "repeater_adminPassword": "管理者パスワード", "repeater_adminPasswordHelper": "完全アクセス権のパスワード", "repeater_guestPassword": "ゲスト用のパスワード", @@ -1208,7 +1208,7 @@ "repeater_longitudeHelper": "度分表記(例:-122.4194)", "repeater_features": "特徴", "repeater_packetForwarding": "パケット転送", - "repeater_packetForwardingSubtitle": "リピーターがパケットを転送できるように設定する", + "repeater_packetForwardingSubtitle": "リピータがパケットを転送できるように設定する", "repeater_guestAccess": "ゲストへのアクセス", "repeater_guestAccessSubtitle": "ゲストへの読み取り専用アクセスを許可する", "repeater_privacyMode": "プライバシーモード", @@ -1223,7 +1223,7 @@ } } }, - "repeater_floodAdvertInterval": "洪水に関する広告の表示間隔", + "repeater_floodAdvertInterval": "フラッドに関する広告の表示間隔", "repeater_floodAdvertIntervalHours": "{hours} 時間", "@repeater_floodAdvertIntervalHours": { "placeholders": { @@ -1234,15 +1234,15 @@ }, "repeater_encryptedAdvertInterval": "暗号化された広告表示間", "repeater_dangerZone": "危険区域", - "repeater_rebootRepeater": "リピーターを再起動する", - "repeater_rebootRepeaterSubtitle": "リピーターデバイスを再起動する", - "repeater_rebootRepeaterConfirm": "本当にこのリピーターを再起動したいですか?", + "repeater_rebootRepeater": "リピータを再起動する", + "repeater_rebootRepeaterSubtitle": "リピータデバイスを再起動する", + "repeater_rebootRepeaterConfirm": "本当にこのリピータを再起動したいですか?", "repeater_regenerateIdentityKey": "IDキーの再生成", "repeater_regenerateIdentityKeySubtitle": "新しい公開鍵/秘密鍵のペアを生成する", - "repeater_regenerateIdentityKeyConfirm": "これにより、リピーターには新しい識別情報が割り当てられます。続行しますか?", + "repeater_regenerateIdentityKeyConfirm": "これにより、リピータには新しい識別情報が割り当てられます。続行しますか?", "repeater_eraseFileSystem": "ファイルシステムを削除する", - "repeater_eraseFileSystemSubtitle": "リピーターファイルシステムをフォーマットする", - "repeater_eraseFileSystemConfirm": "警告:この操作により、リピーター内のすべてのデータが消去されます。この操作は元に戻すことができません!", + "repeater_eraseFileSystemSubtitle": "リピータファイルシステムをフォーマットする", + "repeater_eraseFileSystemConfirm": "警告:この操作により、リピータ内のすべてのデータが消去されます。この操作は元に戻すことができません!", "repeater_eraseSerialOnly": "Erase機能は、シリアルコンソール経由でのみ利用可能です。", "repeater_commandSent": "送信されたコマンド: {command}", "@repeater_commandSent": { @@ -1270,7 +1270,7 @@ "repeater_refreshMultiAcks": "複数のACKをリフレッシュする", "repeater_networkHealth": "ネットワークの状態", "repeater_loopDetect": "ループ検出", - "repeater_loopDetectHelper": "ルーティングループに見えるような、洪水パケットを送信する", + "repeater_loopDetectHelper": "ルーティングループを検知する", "repeater_loopDetectOff": "オフ", "repeater_loopDetectMinimal": "最小限の", "repeater_loopDetectModerate": "適度な", @@ -1286,16 +1286,16 @@ } }, "repeater_ownerInfo": "事業者の情報", - "repeater_ownerInfoHelper": "このリピーターに関する公開メタデータ", + "repeater_ownerInfoHelper": "このリピータに関する公開メタデータ", "repeater_refreshOwnerInfo": "オペレーター情報の更新", "repeater_floodMax": "最大ホップ数", - "repeater_floodMaxHelper": "洪水パケットが移動できる最大ホップ数 (0-64)", + "repeater_floodMaxHelper": "フラッドパケットが移動できる最大ホップ数 (0-64)", "repeater_advancedSettings": "高度な", "repeater_advancedSettingsSubtitle": "経験豊富なオペレーター向けの調整ノブ", "repeater_pathHashMode": "パスハッシュモード", - "repeater_pathHashModeHelper": "このリピーターのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。", + "repeater_pathHashModeHelper": "このリピータのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。", "repeater_txDelay": "フロイド・TXでの遅延", - "repeater_txDelayHelper": "洪水時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。", + "repeater_txDelayHelper": "フラッド時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。", "repeater_directTxDelay": "直接的なTX遅延", "repeater_directTxDelayHelper": "直接(フラッドではない)トラフィックに対する再送信間隔を、パケットの空中時間(0~2、デフォルト0.3)の倍数として設定する。", "repeater_intThresh": "干渉閾値", @@ -1303,10 +1303,10 @@ "repeater_agcResetInterval": "AGCのリセット間隔", "repeater_agcResetIntervalHelper": "ラジオの自動ゲイン制御をリセットする頻度について:ゲインが固定状態になった場合に、回復するために、何度リセットするかを設定します。4の倍数でリセットする場合、0を設定すると、定期的なリセットは停止します。", "repeater_actionsTitle": "行動", - "repeater_sendAdvert": "洪水に関する広告を送信", - "repeater_sendAdvertSubtitle": "ネットワークを通じて、洪水に関する広告を放送する", + "repeater_sendAdvert": "フラッドに関する広告を送信", + "repeater_sendAdvertSubtitle": "ネットワークを通じて、フラッドに関する広告を放送する", "repeater_sendAdvertZeroHop": "ゼロホップ形式の広告を送信する", - "repeater_sendAdvertZeroHopSubtitle": "ワンホップでの広告放送(中継なし)", + "repeater_sendAdvertZeroHopSubtitle": "ワンホップでの広告放送(リピータなし)", "repeater_clockSync": "現在、時刻を同期する", "repeater_clockSyncSubtitle": "スマートフォンの時刻をルーターに設定する", "repeater_actionSucceeded": "{action} が成功しました", @@ -1328,7 +1328,7 @@ } } }, - "repeater_settingsSavedRebootNeeded": "設定を保存しました — リピーターを再起動して適用してください", + "repeater_settingsSavedRebootNeeded": "設定を保存しました — リピータを再起動して適用してください", "repeater_settingsPartialFailure": "設定の一部でエラーが発生しました:{failures}", "@repeater_settingsPartialFailure": { "placeholders": { @@ -1367,7 +1367,7 @@ } } }, - "repeater_cliTitle": "リピーターのコマンドラインインターフェース", + "repeater_cliTitle": "リピータのコマンドラインインターフェース", "repeater_debugNextCommand": "次のコマンドのデバッグ", "repeater_commandHelp": "コマンドヘルプ", "repeater_clearHistory": "明確な歴史", @@ -1401,14 +1401,14 @@ "repeater_cliHelpClearStats": "さまざまな統計カウンターをゼロにリセットする。", "repeater_cliHelpSetAf": "空き時間係数を設定します。", "repeater_cliHelpSetTx": "LoRaの送信電力をdBmで設定します。(設定変更後、再起動が必要です)", - "repeater_cliHelpSetRepeat": "このノードに対するリピーターの役割を有効化または無効化します。", + "repeater_cliHelpSetRepeat": "このノードに対するリピータの役割を有効化または無効化します。", "repeater_cliHelpSetAllowReadOnly": "(ルームサーバー設定)「オン」に設定した場合、空白のパスワードでのログインは可能ですが、ルームへの投稿はできません。(閲覧のみ)", - "repeater_cliHelpSetFloodMax": "インバウンドフラッパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。", + "repeater_cliHelpSetFloodMax": "インバウンドフラッドパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。", "repeater_cliHelpSetIntThresh": "干渉閾値を設定します(dB単位)。デフォルト値は14です。0に設定すると、チャンネル間の干渉を検出する機能を無効にします。", "repeater_cliHelpSetAgcResetInterval": "オートゲインコントローラーのリセット間隔を設定します。 0 に設定すると無効化されます。", "repeater_cliHelpSetMultiAcks": "「ダブルACK」機能の有効化または無効化を可能にします。", "repeater_cliHelpSetAdvertInterval": "ローカル(ホップなし)の広告パケットを送信する間隔を分単位で設定します。 0 に設定すると、機能を無効にします。", - "repeater_cliHelpSetFloodAdvertInterval": "洪水広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。", + "repeater_cliHelpSetFloodAdvertInterval": "フラッド広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。", "repeater_cliHelpSetGuestPassword": "ゲストのパスワードを設定/更新します。(繰り返し利用の場合、ゲストのログインは「統計情報を取得」のリクエストを送信できます)", "repeater_cliHelpSetName": "広告の名前を設定します。", "repeater_cliHelpSetLat": "広告表示の地図の緯度を設定します。(度分秒表記)", @@ -1429,14 +1429,14 @@ "repeater_cliHelpLogStart": "パケットのログ記録を開始し、ファイルシステムに保存する。", "repeater_cliHelpLogStop": "ファイルシステムへのパケットログの記録を停止する。", "repeater_cliHelpLogErase": "ファイルシステムからパケットログを削除する。", - "repeater_cliHelpNeighbors": "ゼロホップ広告を通じて受信した他のリピーターノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。", + "repeater_cliHelpNeighbors": "ゼロホップ広告を通じて受信した他のリピータノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。", "repeater_cliHelpNeighborRemove": "隣接リストから、最初に一致するエントリ(pubkeyプレフィックス(16進数)で特定)を削除します。", - "repeater_cliHelpRegion": "(特定のシリーズのみ)定義されたすべての地域と、現在の洪水許可状況を一覧表示します。", + "repeater_cliHelpRegion": "(特定のシリーズのみ)定義されたすべての地域と、現在のフラッド許可状況を一覧表示します。", "repeater_cliHelpRegionLoad": "注:これは特殊な複数コマンドの呼び出しです。その後の各コマンドは、地域名であり(スペースを使用して親階層を示し、少なくとも1つのスペースが必要です)、空行/コマンドで終了します。", "repeater_cliHelpRegionGet": "指定された名前のプレフィックスを持つ地域を検索します(または、グローバルな範囲の場合は「*」)。結果として、「region-name (parent-name) 'F'」と返答します。", "repeater_cliHelpRegionPut": "指定された名前で、領域の定義を追加または更新します。", "repeater_cliHelpRegionRemove": "指定された名前を持つ領域の定義を削除します。(正確に一致している必要があり、子領域は存在してはなりません)", - "repeater_cliHelpRegionAllowf": "指定された領域に対して、「洪水」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)", + "repeater_cliHelpRegionAllowf": "指定された領域に対して、「フラッド」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)", "repeater_cliHelpRegionDenyf": "指定された領域における「FLOOD」権限を削除します。(注:現時点では、グローバル/従来の範囲での使用は推奨されません!)", "repeater_cliHelpRegionHome": "現在の「ホーム」地域に返信します。(まだ適用されていない、将来利用を予定)", "repeater_cliHelpRegionHomeSet": "「ホーム」地域を設定します。", @@ -1453,7 +1453,7 @@ "repeater_settingsCategory": "設定", "repeater_bridge": "橋", "repeater_logging": "ログ記録", - "repeater_neighborsRepeaterOnly": "近隣住民(リピーターのみ)", + "repeater_neighborsRepeaterOnly": "近隣住民(リピータのみ)", "repeater_regionManagementRepeaterOnly": "地域管理(ブロードキャスト用のみ)", "repeater_regionNote": "地域レベルでの管理のため、地域定義と権限の管理を行うための機能が導入されました。", "repeater_gpsManagement": "GPS管理", @@ -1567,7 +1567,7 @@ } } }, - "neighbors_repeatersNeighbors": "近隣のリピーター", + "neighbors_repeatersNeighbors": "近隣のリピータ", "neighbors_noData": "近隣のデータは利用できません。", "neighbors_unknownContact": "不明な {pubkey}", "@neighbors_unknownContact": { @@ -1588,12 +1588,12 @@ "channelPath_title": "パケットパス", "channelPath_viewMap": "地図を表示する", "channelPath_otherObservedPaths": "観察されたその他の経路", - "channelPath_repeaterHops": "リピーターホップ", + "channelPath_repeaterHops": "リピータホップ", "channelPath_noHopDetails": "このパッケージに関する詳細な情報は提供されていません。", "channelPath_messageDetails": "メッセージの詳細", "channelPath_senderLabel": "送信者", "channelPath_timeLabel": "時間", - "channelPath_repeatsLabel": "リピーター", + "channelPath_repeatsLabel": "リピータ", "channelPath_pathLabel": "{index} 番目の経路", "channelPath_observedLabel": "観察", "channelPath_observedPathTitle": "観察された経路 {index} • {hops}", @@ -1631,7 +1631,7 @@ } }, "channelPath_unknownPath": "不明", - "channelPath_floodPath": "洪水", + "channelPath_floodPath": "フラッド", "channelPath_directPath": "直接", "channelPath_observedZeroOf": "{total}個のホップ", "@channelPath_observedZeroOf": { @@ -1653,7 +1653,7 @@ } }, "channelPath_mapTitle": "経路図", - "channelPath_noRepeaterLocations": "この経路にリピーターの位置情報はありません。", + "channelPath_noRepeaterLocations": "この経路にリピータの位置情報はありません。", "channelPath_primaryPath": "{index}番目の経路(主要経路)", "@channelPath_primaryPath": { "placeholders": { @@ -1831,7 +1831,7 @@ "listFilter_addToFavorites": "お気に入りに追加", "listFilter_removeFromFavorites": "お気に入りから削除", "listFilter_users": "利用者", - "listFilter_repeaters": "リピーター", + "listFilter_repeaters": "リピータ", "listFilter_roomServers": "ルーム用サーバー", "listFilter_unreadOnly": "未読のみ", "listFilter_newGroup": "新しいグループ", @@ -1976,8 +1976,8 @@ }, "contacts_pathTrace": "経路追跡", "contacts_ping": "パング", - "contacts_repeaterPathTrace": "リピーターまでの経路を追跡する", - "contacts_repeaterPing": "リピーターにPING", + "contacts_repeaterPathTrace": "リピータまでの経路を追跡する", + "contacts_repeaterPing": "リピータにPING", "contacts_roomPathTrace": "部屋のサーバーへの経路を追跡する", "contacts_roomPing": "ピンルーム用サーバー", "contacts_chatTraceRoute": "経路の追跡ルート", @@ -1994,7 +1994,7 @@ "contacts_contactImported": "連絡先が登録されました。", "contacts_contactImportFailed": "連絡先のインポートに失敗しました。", "contacts_zeroHopAdvert": "ゼロホップ広告", - "contacts_floodAdvert": "洪水に関する広告", + "contacts_floodAdvert": "フラッドに関する広告", "contacts_copyAdvertToClipboard": "広告をクリップボードにコピー", "contacts_addContactFromClipboard": "クリップボードから連絡先を追加する", "contacts_ShareContact": "連絡先をクリップボードにコピー", @@ -2037,7 +2037,7 @@ } }, "notification_receivedNewMessage": "新しいメッセージを受信", - "settings_gpxExportRepeaters": "GPX へのエクスポート用リピーター/ルームサーバー", + "settings_gpxExportRepeaters": "GPX へのエクスポート用リピータ/ルームサーバー", "settings_gpxExportRepeatersSubtitle": "GPXファイルに場所情報を付加した、レピーター/ルームサーバーのエクスポート", "settings_gpxExportContacts": "GPX 形式へのエクスポート", "settings_gpxExportContactsSubtitle": "GPXファイルに位置情報を保存して、他の人と共有する。", @@ -2047,20 +2047,20 @@ "settings_gpxExportNoContacts": "エクスポートする連絡先は存在しません。", "settings_gpxExportNotAvailable": "このデバイス/OSではサポートされていません", "settings_gpxExportError": "エクスポート時にエラーが発生しました。", - "settings_gpxExportRepeatersRoom": "リピーター/ルームサーバーの位置情報", + "settings_gpxExportRepeatersRoom": "リピータ/ルームサーバーの位置情報", "settings_gpxExportChat": "関連施設", "settings_gpxExportAllContacts": "すべての連絡先場所", "settings_gpxExportShareText": "meshcore-openからエクスポートされた地図データ", "settings_gpxExportShareSubject": "meshcore-open GPX形式の地図データのエクスポート", - "snrIndicator_nearByRepeaters": "近くのリピーター", + "snrIndicator_nearByRepeaters": "近くのリピータ", "snrIndicator_lastSeen": "最後に確認された場所", "contactsSettings_title": "連絡先設定", "contactsSettings_autoAddTitle": "自動検出", "contactsSettings_otherTitle": "その他の連絡に関する設定", "contactsSettings_autoAddUsersTitle": "自動でユーザーを追加する", "contactsSettings_autoAddUsersSubtitle": "利用者が自動的に発見したユーザーを追加できるようにする。", - "contactsSettings_autoAddRepeatersTitle": "リピーターを自動追加", - "contactsSettings_autoAddRepeatersSubtitle": "発見した中継局を、自動的に追加できるようにする。", + "contactsSettings_autoAddRepeatersTitle": "リピータを自動追加", + "contactsSettings_autoAddRepeatersSubtitle": "発見したリピータを、自動的に追加できるようにする。", "contactsSettings_autoAddRoomServersTitle": "自動でルームサーバーを追加", "contactsSettings_autoAddRoomServersSubtitle": "利用者が、発見した部屋のサーバーを自動的に追加できるようにする。", "contactsSettings_autoAddSensorsTitle": "自動でセンサーを追加", @@ -2162,7 +2162,7 @@ "contact_teleLocSubtitle": "位置情報共有を許可する", "contact_teleEnv": "テレメトリ環境", "contact_teleEnvSubtitle": "環境センサーのデータを共有することを許可する", - "map_showOverlaps": "リピーターキーの重複", + "map_showOverlaps": "リピータキーの重複", "map_runTraceWithReturnPath": "元の経路に戻る。", "@translation_downloadFailed": { "placeholders": { @@ -2232,7 +2232,7 @@ "repeater_clockSyncAfterLoginSubtitle": "ログインが成功した場合、自動的に「時刻同期」を送信する。", "room_guest": "ルームサーバーに関する情報", "chat_sendMessage": "メッセージを送信する", - "repeater_guest": "リピーターに関する情報", + "repeater_guest": "リピータに関する情報", "repeater_guestTools": "ゲスト向けツール", "repeater_getCategory": "価値を取得する", "repeater_powerMgmt": "電力管理", @@ -2243,7 +2243,7 @@ "repeater_cliHelpStartOta": "サポートされているボードに対して、無線でファームウェアのアップデートを開始します。", "repeater_cliHelpTime": "デバイスのクロックを、指定されたUnixエポックの秒数に設定します。クロックは逆方向に進むことはできません。", "repeater_cliHelpBoard": "製造元の名前/ハードウェア識別子を表示します。", - "repeater_cliHelpDiscoverNeighbors": "近隣のノードに対して、ノードの探索リクエストを送信します。(中継機能のみ)", + "repeater_cliHelpDiscoverNeighbors": "近隣のノードに対して、ノードの探索リクエストを送信します。(リピータ機能のみ)", "repeater_cliHelpPowersaving": "省電力モードがオンになっているかどうかを表示します。", "repeater_cliHelpPowersavingOnOff": "省電力モード(対応している場合)を有効または無効にします。", "repeater_cliHelpErase": "(シリアルモードのみ)デバイスのファイルシステムをフォーマットします。すべての設定と連絡先を消去します。", @@ -2256,10 +2256,10 @@ "repeater_cliHelpSetFreq": "(シリアル設定のみ)特定の周波数のみを素早く設定できます。再起動が必要です。「ラジオ設定」を使用すると、ラジオのすべてのパラメータを設定できます。", "repeater_cliHelpSetBridgeChannel": "(ESPNowブリッジのみ)ブリッジで使用するWi-Fiチャンネル(1~14)を設定します。", "repeater_cliHelpGetName": "設定されたノードの名前を表示します。", - "repeater_cliHelpGetRole": "ファームウェアの役割(リピーター、ルームサーバーなど)を表示します。", + "repeater_cliHelpGetRole": "ファームウェアの役割(リピータ、ルームサーバーなど)を表示します。", "repeater_cliHelpGetPublicKey": "デバイスの公開鍵を表示します。", "repeater_cliHelpGetPrvKey": "(シリアル番号のみ)デバイスのプライベートキーを表示します。機密情報として扱ってください。", - "repeater_cliHelpGetRepeat": "パケット転送(リピーター機能)が有効になっているかどうかを表示します。", + "repeater_cliHelpGetRepeat": "パケット転送(リピータ機能)が有効になっているかどうかを表示します。", "repeater_cliHelpGetTx": "現在のTX(送信)電力のdBm値を表示します。", "repeater_cliHelpGetFreq": "設定された無線周波数をMHzで表示します。", "repeater_cliHelpGetRadio": "以下のすべての無線パラメータを表示: 周波数、帯域幅、スプレッドファクター、符号化レート。", @@ -2271,18 +2271,18 @@ "repeater_cliHelpGetMultiAcks": "ダブルACKモードが有効 (1) か無効 (0) かを示す。", "repeater_cliHelpGetAllowReadOnly": "ゲストによる読み取り専用アクセスが許可されているかどうかを示す。", "repeater_cliHelpGetAdvertInterval": "ローカル広告の時間を分単位で表示します。", - "repeater_cliHelpGetFloodAdvertInterval": "洪水に関する広告の放送時間を時間単位で表示します。", + "repeater_cliHelpGetFloodAdvertInterval": "フラッドに関する広告の放送時間を時間単位で表示します。", "repeater_cliHelpGetGuestPassword": "設定されたゲストパスワードを表示します。", "repeater_cliHelpGetLat": "設定された緯度を表示します。", "repeater_cliHelpGetLon": "設定された経度を表示します。", "repeater_cliHelpGetRxDelay": "rxdelay の基本値を表示します。", - "repeater_cliHelpGetTxDelay": "洪水モードにおける送信遅延の要因を示します。", + "repeater_cliHelpGetTxDelay": "フラッドモードにおける送信遅延の要因を示します。", "repeater_cliHelpGetDirectTxDelay": "ダイレクトモードの遅延要素を示します。", - "repeater_cliHelpGetFloodMax": "最大浸水範囲の回数を表示します。", + "repeater_cliHelpGetFloodMax": "フラッドパケットの最大ホップ数を表示します。", "repeater_cliHelpGetOwnerInfo": "所有者の連絡先情報を表示します。", "repeater_cliHelpGetPathHashMode": "パスハッシュモード(0/1/2)を表示します。", "repeater_cliHelpGetLoopDetect": "ループ検出の感度を示す。", - "repeater_cliHelpGetAcl": "(シリアルのみ)リピーター上のアクセス制御設定を一覧表示します。", + "repeater_cliHelpGetAcl": "(シリアルのみ)リピータ上のアクセス制御設定を一覧表示します。", "repeater_cliHelpGetBridgeEnabled": "橋が有効になっているかどうかを表示します。", "repeater_cliHelpGetBridgeDelay": "橋の遅延時間をミリ秒(ms)で表示します。", "repeater_cliHelpGetBridgeSource": "RX または TX パケットを橋渡ししているかどうかを示す。", @@ -2300,8 +2300,8 @@ "repeater_cliHelpSensorList": "カスタムセンサーの設定をすべてリスト表示し、オプションで指定できる開始インデックスからページ分割して表示します。", "repeater_cliHelpRegionDefault": "現在のデフォルトの地域範囲を表示します。", "repeater_cliHelpRegionDefaultSet": "デフォルトの地域範囲を設定します。「」を使用すると、設定をリセットできます。", - "repeater_cliHelpRegionListAllowed": "洪水時の通行が許可されている地域の一覧", - "repeater_cliHelpRegionListDenied": "洪水による交通を遮断している地域の一覧", + "repeater_cliHelpRegionListAllowed": "フラッド時の通行が許可されている地域の一覧", + "repeater_cliHelpRegionListDenied": "フラッドによる交通を遮断している地域の一覧", "repeater_cliHelpStatsPackets": "(シリアルのみ)パケットレベルの統計情報を表示します。", "repeater_cliHelpStatsRadio": "(シリーズのみ)ラジオの統計情報を表示します。", "repeater_cliHelpStatsCore": "(シリアルのみ)主要なファームウェアの統計情報を表示します。", From cba1e5950cb6da431aef8859b51a2e972e3e5947 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Thu, 11 Jun 2026 00:07:12 -0700 Subject: [PATCH 27/36] feat: add contact UI helpers and path editor for routing management - Implemented contactTypeIcon and contactTypeColor functions for better UI representation of contact types. - Created colorForName and firstCharacterOrEmoji functions to enhance contact display. - Developed PathEditorSheet widget for managing contact paths with a user-friendly interface. - Introduced RoutingSheet for managing contact routing modes and displaying path history. - Added a script for generating proof of concept (PoC) payloads for clipboard contact import validation. --- .claude/worktrees/agent-a01277dd8cf0dedb6 | 1 + .claude/worktrees/agent-a0c7384491c5fc807 | 1 + .claude/worktrees/agent-a1751d6addbf69e1d | 1 + .claude/worktrees/agent-a2fad933ed81b10e2 | 1 + .claude/worktrees/agent-a4d771c23db919c7f | 1 + .claude/worktrees/agent-a6675128f3ee1d6a6 | 1 + .claude/worktrees/agent-a894f10813e684f84 | 1 + .claude/worktrees/agent-a8ba0537ad42768d7 | 1 + .claude/worktrees/agent-a926d49d72757ce68 | 1 + .claude/worktrees/agent-ad2e38b6608f23ab4 | 1 + .claude/worktrees/agent-ada5836798aea71a1 | 1 + .claude/worktrees/agent-aee10bd582e9e36cf | 1 + lib/connector/meshcore_connector.dart | 266 +++-- lib/connector/meshcore_protocol.dart | 7 +- lib/connector/meshcore_uuids.dart | 4 + lib/helpers/contact_ui.dart | 59 + lib/helpers/path_helper.dart | 31 +- lib/l10n/app_en.arb | 162 +-- lib/l10n/app_localizations.dart | 534 +++++---- lib/l10n/app_localizations_bg.dart | 314 ++--- lib/l10n/app_localizations_de.dart | 313 ++--- lib/l10n/app_localizations_en.dart | 309 ++--- lib/l10n/app_localizations_es.dart | 313 ++--- lib/l10n/app_localizations_fr.dart | 315 ++--- lib/l10n/app_localizations_hu.dart | 316 ++--- lib/l10n/app_localizations_it.dart | 313 ++--- lib/l10n/app_localizations_ja.dart | 446 +++---- lib/l10n/app_localizations_ko.dart | 309 ++--- lib/l10n/app_localizations_nl.dart | 313 ++--- lib/l10n/app_localizations_pl.dart | 316 ++--- lib/l10n/app_localizations_pt.dart | 313 ++--- lib/l10n/app_localizations_ru.dart | 317 ++--- lib/l10n/app_localizations_sk.dart | 314 ++--- lib/l10n/app_localizations_sl.dart | 310 ++--- lib/l10n/app_localizations_sv.dart | 310 ++--- lib/l10n/app_localizations_uk.dart | 317 ++--- lib/l10n/app_localizations_zh.dart | 290 +++-- lib/main.dart | 29 +- lib/screens/app_debug_log_screen.dart | 21 +- lib/screens/app_settings_screen.dart | 153 +-- lib/screens/channel_chat_screen.dart | 447 ++++--- lib/screens/channel_message_path_screen.dart | 140 ++- lib/screens/channels_screen.dart | 183 +-- lib/screens/chat_screen.dart | 1031 ++++------------- lib/screens/chrome_required_screen.dart | 33 +- lib/screens/companion_radio_stats_screen.dart | 6 +- lib/screens/contacts_screen.dart | 414 ++++--- lib/screens/discovery_screen.dart | 72 +- lib/screens/line_of_sight_map_screen.dart | 40 +- lib/screens/map_cache_screen.dart | 8 +- lib/screens/map_screen.dart | 371 +++--- lib/screens/neighbors_screen.dart | 90 +- lib/screens/path_trace_map.dart | 214 ++-- lib/screens/repeater_cli_screen.dart | 121 +- lib/screens/repeater_hub_screen.dart | 28 +- lib/screens/repeater_settings_screen.dart | 125 +- lib/screens/repeater_status_screen.dart | 92 +- lib/screens/scanner_screen.dart | 178 +-- lib/screens/settings_screen.dart | 125 +- lib/screens/tcp_screen.dart | 86 +- lib/screens/telemetry_screen.dart | 97 +- lib/screens/usb_screen.dart | 145 +-- lib/services/message_retry_service.dart | 5 + lib/services/notification_service.dart | 5 +- lib/services/translation_service.dart | 31 +- lib/theme/mesh_theme.dart | 103 +- lib/widgets/byte_count_input.dart | 8 +- lib/widgets/device_tile.dart | 22 +- lib/widgets/empty_state.dart | 10 +- lib/widgets/gif_picker.dart | 10 +- lib/widgets/message_status_icon.dart | 151 ++- lib/widgets/path_editor_sheet.dart | 377 ++++++ lib/widgets/path_management_dialog.dart | 510 -------- lib/widgets/path_selection_dialog.dart | 346 ------ lib/widgets/quick_switch_bar.dart | 27 +- lib/widgets/radio_stats_entry.dart | 14 +- lib/widgets/repeater_login_dialog.dart | 19 +- lib/widgets/room_login_dialog.dart | 16 +- lib/widgets/routing_sheet.dart | 709 ++++++++++++ lib/widgets/snr_indicator.dart | 2 +- lib/widgets/telemetry_location_map.dart | 6 +- pubspec.yaml | 2 +- .../security/contact_import_clipboard_pocs.py | 71 ++ test/screens/tcp_flow_test.dart | 6 +- test/screens/usb_flow_test.dart | 18 +- untranslated.json | 988 +++++++++++++++- 86 files changed, 8149 insertions(+), 6379 deletions(-) create mode 160000 .claude/worktrees/agent-a01277dd8cf0dedb6 create mode 160000 .claude/worktrees/agent-a0c7384491c5fc807 create mode 160000 .claude/worktrees/agent-a1751d6addbf69e1d create mode 160000 .claude/worktrees/agent-a2fad933ed81b10e2 create mode 160000 .claude/worktrees/agent-a4d771c23db919c7f create mode 160000 .claude/worktrees/agent-a6675128f3ee1d6a6 create mode 160000 .claude/worktrees/agent-a894f10813e684f84 create mode 160000 .claude/worktrees/agent-a8ba0537ad42768d7 create mode 160000 .claude/worktrees/agent-a926d49d72757ce68 create mode 160000 .claude/worktrees/agent-ad2e38b6608f23ab4 create mode 160000 .claude/worktrees/agent-ada5836798aea71a1 create mode 160000 .claude/worktrees/agent-aee10bd582e9e36cf create mode 100644 lib/helpers/contact_ui.dart create mode 100644 lib/widgets/path_editor_sheet.dart delete mode 100644 lib/widgets/path_management_dialog.dart delete mode 100644 lib/widgets/path_selection_dialog.dart create mode 100644 lib/widgets/routing_sheet.dart create mode 100644 scripts/security/contact_import_clipboard_pocs.py diff --git a/.claude/worktrees/agent-a01277dd8cf0dedb6 b/.claude/worktrees/agent-a01277dd8cf0dedb6 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a01277dd8cf0dedb6 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a0c7384491c5fc807 b/.claude/worktrees/agent-a0c7384491c5fc807 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a0c7384491c5fc807 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a1751d6addbf69e1d b/.claude/worktrees/agent-a1751d6addbf69e1d new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a1751d6addbf69e1d @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a2fad933ed81b10e2 b/.claude/worktrees/agent-a2fad933ed81b10e2 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a2fad933ed81b10e2 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a4d771c23db919c7f b/.claude/worktrees/agent-a4d771c23db919c7f new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a4d771c23db919c7f @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a6675128f3ee1d6a6 b/.claude/worktrees/agent-a6675128f3ee1d6a6 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a6675128f3ee1d6a6 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a894f10813e684f84 b/.claude/worktrees/agent-a894f10813e684f84 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a894f10813e684f84 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a8ba0537ad42768d7 b/.claude/worktrees/agent-a8ba0537ad42768d7 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a8ba0537ad42768d7 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a926d49d72757ce68 b/.claude/worktrees/agent-a926d49d72757ce68 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-a926d49d72757ce68 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-ad2e38b6608f23ab4 b/.claude/worktrees/agent-ad2e38b6608f23ab4 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-ad2e38b6608f23ab4 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-ada5836798aea71a1 b/.claude/worktrees/agent-ada5836798aea71a1 new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-ada5836798aea71a1 @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-aee10bd582e9e36cf b/.claude/worktrees/agent-aee10bd582e9e36cf new file mode 160000 index 00000000..e37616fa --- /dev/null +++ b/.claude/worktrees/agent-aee10bd582e9e36cf @@ -0,0 +1 @@ +Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 7912962b..dee34fb0 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -160,6 +160,7 @@ class MeshCoreConnector extends ChangeNotifier { {}; // contactPubKeyHex -> Set of "targetHash_emoji" StreamSubscription>? _scanSubscription; + StreamSubscription? _isScanningSubscription; StreamSubscription? _connectionSubscription; StreamSubscription>? _notifySubscription; Timer? _notifyListenersTimer; @@ -507,10 +508,22 @@ class MeshCoreConnector extends ChangeNotifier { if (messages == null) return; final removed = messages.remove(message); if (!removed) return; + _retryService?.untrack(message.messageId); await _messageStore.saveMessages(contactKeyHex, messages); notifyListeners(); } + Future resendMessage(Contact contact, Message message) async { + await deleteMessage(message); + await sendMessage( + contact, + message.text, + originalText: message.originalText, + translatedLanguageCode: message.translatedLanguageCode, + translationModelId: message.translationModelId, + ); + } + Future _loadMessagesForContact(String contactKeyHex) async { if (_loadedConversationKeys.contains(contactKeyHex)) return; _loadedConversationKeys.add(contactKeyHex); @@ -1356,6 +1369,21 @@ class MeshCoreConnector extends ChangeNotifier { }) async { if (_state == MeshCoreConnectionState.scanning) return; + // A BLE scan must never disturb an active (or in-progress) non-BLE + // connection. The connection state enum is shared across transports, so + // entering the `scanning` state while connected over TCP/USB would clobber + // the live `connected` state and later reset it to `disconnected`. + if (_state != MeshCoreConnectionState.disconnected || + _tcpConnector.isConnected || + _usbManager.isConnected) { + _appDebugLogService?.warn( + 'startScan ignored: not idle (state=$_state, ' + 'tcp=${_tcpConnector.isConnected}, usb=${_usbManager.isConnected})', + tag: 'BLE Scan', + ); + return; + } + _scanResults.clear(); _linuxSystemScanResults.clear(); _setState(MeshCoreConnectionState.scanning); @@ -1409,20 +1437,40 @@ class MeshCoreConnector extends ChangeNotifier { }); try { + // Filter by the Nordic UART Service UUID rather than by advertised + // name. All MeshCore-compatible firmware (ESP32 + nRF52) advertises this + // service UUID, so this matches every device regardless of the name it + // chooses to advertise (e.g. community forks like the M5 Cardputer that + // do not use a "MeshCore-" name prefix). This mirrors how the official + // app discovers devices. Note: on Android `withKeywords` cannot be + // combined with any other filter, which is why name keywords are not + // used here. await FlutterBluePlus.startScan( - withKeywords: MeshCoreUuids.deviceNamePrefixes, + withServices: [Guid(MeshCoreUuids.service)], webOptionalServices: [Guid(MeshCoreUuids.service)], timeout: timeout, androidScanMode: AndroidScanMode.lowLatency, ); } catch (error) { _appDebugLogService?.warn('Scan/picker failure: $error', tag: 'BLE Scan'); - _setState(MeshCoreConnectionState.disconnected); + await stopScan(); rethrow; } - await Future.delayed(timeout); - await stopScan(); + // Reset our shared state when the native scan ends — whether it was stopped + // by the user (stopScan), by the platform timeout, or by Bluetooth turning + // off. This replaces a blocking `Future.delayed(timeout)` tail that kept + // startScan() pending for the whole timeout and made Stop appear ineffective. + // `isScanning` is a re-emit stream that replays its latest value on listen, + // so skip(1) to ignore that and only react to a genuine transition to false. + await _isScanningSubscription?.cancel(); + _isScanningSubscription = FlutterBluePlus.isScanning.skip(1).listen(( + scanning, + ) { + if (!scanning && _state == MeshCoreConnectionState.scanning) { + unawaited(stopScan()); + } + }); } Future _loadLinuxSystemDevicesForScan() async { @@ -1430,15 +1478,13 @@ class MeshCoreConnector extends ChangeNotifier { final systemDevices = await FlutterBluePlus.systemDevices([ Guid(MeshCoreUuids.service), ]); + // systemDevices is already filtered by the NUS service UUID above, so no + // additional name-prefix filtering is applied here. This keeps Linux + // discovery name-agnostic and consistent with the main scan path. _linuxSystemScanResults ..clear() ..addAll( systemDevices - .where( - (device) => MeshCoreUuids.deviceNamePrefixes.any( - device.platformName.startsWith, - ), - ) .map( (device) => ScanResult( device: device, @@ -1499,9 +1545,17 @@ class MeshCoreConnector extends ChangeNotifier { } await _scanSubscription?.cancel(); _scanSubscription = null; + await _isScanningSubscription?.cancel(); + _isScanningSubscription = null; if (_state == MeshCoreConnectionState.scanning) { - _setState(MeshCoreConnectionState.disconnected); + // Restore to `connected` if a non-BLE transport is still live, so a stray + // scan can never tear down the reported connection state. Normally there + // is no live transport here and we fall through to `disconnected`. + final restored = (_tcpConnector.isConnected || _usbManager.isConnected) + ? MeshCoreConnectionState.connected + : MeshCoreConnectionState.disconnected; + _setState(restored); } } @@ -1743,6 +1797,17 @@ class MeshCoreConnector extends ChangeNotifier { activeTransport == MeshCoreTransportType.tcp; } + /// Fast (non-timeout) connect failures are usually a stale link left over + /// from a previous session and recover on an immediate retry. Timeouts mean + /// the device is likely off or out of range, so retrying would only delay + /// genuine failure feedback. + @visibleForTesting + static bool shouldRetryBleConnectAfterError(String errorText) { + final lowerErrorText = errorText.toLowerCase(); + return !lowerErrorText.contains('timed out') && + !lowerErrorText.contains('timeout'); + } + Future connect( BluetoothDevice device, { String? displayName, @@ -1911,18 +1976,71 @@ class MeshCoreConnector extends ChangeNotifier { } } } else { - try { - await device.connect( + Future attemptConnect() { + return device.connect( timeout: connectTimeout, mtu: null, license: License.free, ); + } + + // A previous app session (e.g. killed from the iOS app switcher) can + // leave the OS holding a stale link to the peripheral. Clear it before + // connecting so the fresh attempt doesn't race the stale handle. + if (!PlatformInfo.isWeb && device.isConnected) { + _appDebugLogService?.warn( + 'Device reports an existing connection before connect; clearing stale link', + tag: 'BLE Connect', + ); + try { + await device.disconnect(queue: false); + } catch (cleanupError) { + _appDebugLogService?.warn( + 'Stale-link cleanup disconnect failed (continuing): $cleanupError', + tag: 'BLE Connect', + ); + } + } + + try { + await attemptConnect(); } catch (error) { _appDebugLogService?.error( 'device.connect() failure: $error', tag: 'BLE Connect', ); - rethrow; + if (PlatformInfo.isWeb || + !shouldRetryBleConnectAfterError(error.toString())) { + rethrow; + } + // Fast (non-timeout) failures are usually a stale connection left by + // a previous session; clean up and retry once before surfacing. + _appDebugLogService?.warn( + 'Retrying connect once after clearing possible stale connection', + tag: 'BLE Connect', + ); + try { + await device.disconnect(queue: false); + } catch (cleanupError) { + _appDebugLogService?.warn( + 'Pre-retry cleanup disconnect failed (continuing): $cleanupError', + tag: 'BLE Connect', + ); + } + await Future.delayed(const Duration(milliseconds: 500)); + try { + await attemptConnect(); + _appDebugLogService?.info( + 'Retry connect succeeded after stale-connection cleanup', + tag: 'BLE Connect', + ); + } catch (retryError) { + _appDebugLogService?.error( + 'device.connect() retry failure: $retryError', + tag: 'BLE Connect', + ); + rethrow; + } } } @@ -3237,6 +3355,7 @@ class MeshCoreConnector extends ChangeNotifier { await sendFrame(buildRemoveContactFrame(contact.publicKey)); _contacts.removeWhere((c) => c.publicKeyHex == contact.publicKeyHex); _knownContactKeys.remove(contact.publicKeyHex); + unawaited(updateKnownDiscovered()); unawaited(_persistContacts()); _conversations.remove(contact.publicKeyHex); _loadedConversationKeys.remove(contact.publicKeyHex); @@ -3450,12 +3569,10 @@ class MeshCoreConnector extends ChangeNotifier { Future sendCliCommand(String command) async { if (!isConnected) return; - - // CLI commands are sent as UTF-8 text with a special prefix - final commandBytes = utf8.encode(command); - final bytes = Uint8List.fromList([0x01, ...commandBytes, 0x00]); + final selfKey = _selfPublicKey; + if (selfKey == null) return; _lastSentWasCliCommand = true; - await sendFrame(bytes); + await sendFrame(buildSendCliCommandFrame(selfKey, command)); } Future setNodeName(String name) async { @@ -3929,8 +4046,8 @@ class MeshCoreConnector extends ChangeNotifier { _advertLocPolicy = reader.readByte(); final telemetryFlag = reader.readByte(); _telemetryModeBase = telemetryFlag & 0x03; - _telemetryModeEnv = telemetryFlag >> 2 & 0x03; - _telemetryModeLoc = telemetryFlag >> 4 & 0x03; + _telemetryModeLoc = telemetryFlag >> 2 & 0x03; + _telemetryModeEnv = telemetryFlag >> 4 & 0x03; _manualAddContacts = reader.readByte() & 0x01 == 0x00; @@ -4275,7 +4392,14 @@ class MeshCoreConnector extends ChangeNotifier { tag: 'Connector', ); notifyListeners(); - removeContact(contactTmp); + unawaited( + removeContact(contactTmp).catchError( + (e) => appLogger.warn( + 'Failed to remove self contact: $e', + tag: 'Connector', + ), + ), + ); return; } final contact = getFromDiscovered(contactTmp); @@ -5521,6 +5645,9 @@ class MeshCoreConnector extends ChangeNotifier { } messages.add(message); + if (messages.length > _messageWindowSize) { + messages.removeRange(0, messages.length - _messageWindowSize); + } _messageStore.saveMessages(pubKeyHex, messages); notifyListeners(); } @@ -5907,20 +6034,24 @@ class MeshCoreConnector extends ChangeNotifier { bool _isChannelRepeat(ChannelMessage existing, ChannelMessage incoming) { if (existing.text != incoming.text) return false; + // Self-echo: an outgoing message coming back via a repeater. The send is + // delayed by _waitForRadioQuiet (often 10s+) and propagation can add more, + // so the timestamp gap can easily exceed the cross-peer window. + final selfName = _selfName ?? 'Me'; + final isSelfEcho = + existing.isOutgoing && + !incoming.isOutgoing && + (incoming.senderName == selfName || existing.senderName == selfName); + + final windowMs = isSelfEcho ? 10 * 60 * 1000 : 30000; final diffMs = (existing.timestamp.millisecondsSinceEpoch - incoming.timestamp.millisecondsSinceEpoch) .abs(); - if (diffMs > 30000) return false; + if (diffMs > windowMs) return false; if (existing.senderName == incoming.senderName) return true; - - if (existing.isOutgoing && !incoming.isOutgoing) { - final selfName = _selfName ?? 'Me'; - if (incoming.senderName == selfName || existing.senderName == selfName) { - return true; - } - } + if (isSelfEcho) return true; return false; } @@ -6152,6 +6283,7 @@ class MeshCoreConnector extends ChangeNotifier { @override void dispose() { _scanSubscription?.cancel(); + _isScanningSubscription?.cancel(); _connectionSubscription?.cancel(); _usbFrameSubscription?.cancel(); _notifySubscription?.cancel(); @@ -6210,82 +6342,6 @@ class MeshCoreConnector extends ChangeNotifier { } } - void importContact(Uint8List frame) { - final packet = BufferReader(frame); - int payloadType = 0; - Uint8List pathBytes = Uint8List(0); - try { - packet.skipBytes(1); // Skip frame type byte - packet.skipBytes(1); // Skip SNR byte - packet.skipBytes(1); // Skip RSSI byte - final header = packet.readByte(); - final routeType = header & 0x03; - payloadType = (header >> 2) & 0x0F; - if (routeType == _routeTransportFlood || - routeType == _routeTransportDirect) { - packet.skipBytes(4); // Skip transport-specific bytes - } - //final payloadVer = (header >> 6) & 0x03; - final pathLenRaw = packet.readByte(); - final pathByteLen = _decodePathByteLen(pathLenRaw); - pathBytes = packet.readBytes(pathByteLen); - } catch (e) { - appLogger.warn('Malformed RX frame: $e', tag: 'Connector'); - return; - } - double? latitude; - double? longitude; - String name = ''; - Uint8List publicKey = Uint8List(0); - int type = 0; - int timestamp = 0; - bool hasLocation = false; - bool hasName = false; - if (payloadType != payloadTypeADVERT) { - appLogger.warn('Unexpected payload type: $payloadType', tag: 'Connector'); - return; - } - try { - publicKey = packet.readBytes(32); - timestamp = packet.readInt32LE(); - //TODO add signature verification - packet.skipBytes(64); // Skip signature for now - final flags = packet.readByte(); - type = flags & 0x0F; - hasLocation = (flags & 0x10) != 0; - // For future use: - //final hasFeature1 = (flags & 0x20) != 0; - //final hasFeature2 = (flags & 0x40) != 0; - hasName = (flags & 0x80) != 0; - if (hasLocation && packet.remaining >= 8) { - latitude = packet.readInt32LE() / 1e6; - longitude = packet.readInt32LE() / 1e6; - } - if (hasName && packet.remaining > 0) { - name = packet.readCString(); - } - } catch (e) { - appLogger.warn('Malformed advert frame: $e', tag: 'Connector'); - return; - } - - importDiscoveredContact( - Contact( - rawPacket: frame, - publicKey: publicKey, - name: name, - type: type, - pathLength: pathBytes.isEmpty ? -1 : pathBytes.length, - path: Uint8List.fromList( - pathBytes.reversed.toList(), - ), // Store path in reverse for easier use in outgoing messages - latitude: latitude, - longitude: longitude, - lastSeen: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000), - ), - ); - } - bool hasValidLocation(double? latitude, double? longitude) { const double epsilon = 1e-6; final lat = latitude ?? 0.0; diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index a056f4ac..7213b753 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -457,8 +457,13 @@ String pubKeyToHex(Uint8List pubKey) { // Helper to convert hex string to public key Uint8List hexToPubKey(String hex) { + if (hex.length != pubKeySize * 2) { + throw FormatException( + 'Public key hex must be ${pubKeySize * 2} chars, got ${hex.length}', + ); + } final result = Uint8List(pubKeySize); - for (int i = 0; i < pubKeySize && i * 2 + 1 < hex.length; i++) { + for (int i = 0; i < pubKeySize; i++) { result[i] = int.parse(hex.substring(i * 2, i * 2 + 2), radix: 16); } return result; diff --git a/lib/connector/meshcore_uuids.dart b/lib/connector/meshcore_uuids.dart index 084cc424..0a32b2a6 100644 --- a/lib/connector/meshcore_uuids.dart +++ b/lib/connector/meshcore_uuids.dart @@ -3,6 +3,10 @@ class MeshCoreUuids { static const String rxCharacteristic = "6e400002-b5a3-f393-e0a9-e50e24dcca9e"; static const String txCharacteristic = "6e400003-b5a3-f393-e0a9-e50e24dcca9e"; + /// Known advertised-name prefixes used by stock MeshCore firmware builds. + /// Discovery no longer filters on these (it filters on the [service] UUID so + /// that community forks with custom names are still found); kept for + /// reference and possible future display heuristics. static const List deviceNamePrefixes = [ "MeshCore-", "Whisper-", diff --git a/lib/helpers/contact_ui.dart b/lib/helpers/contact_ui.dart new file mode 100644 index 00000000..9e3b31f7 --- /dev/null +++ b/lib/helpers/contact_ui.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; + +import '../connector/meshcore_protocol.dart'; +import '../utils/emoji_utils.dart'; + +IconData contactTypeIcon(int type) { + switch (type) { + case advTypeChat: + return Icons.chat; + case advTypeRepeater: + return Icons.cell_tower; + case advTypeRoom: + return Icons.group; + case advTypeSensor: + return Icons.sensors; + default: + return Icons.device_unknown; + } +} + +Color contactTypeColor(int type) { + switch (type) { + case advTypeChat: + return Colors.blue; + case advTypeRepeater: + return Colors.orange; + case advTypeRoom: + return Colors.purple; + case advTypeSensor: + return Colors.green; + default: + return Colors.grey; + } +} + +Color colorForName(String name) { + const colors = [ + Colors.blue, + Colors.green, + Colors.orange, + Colors.purple, + Colors.pink, + Colors.teal, + Colors.indigo, + Colors.cyan, + Colors.amber, + Colors.deepOrange, + ]; + return colors[name.hashCode.abs() % colors.length]; +} + +String firstCharacterOrEmoji(String name) { + if (name.isEmpty) return '?'; + final emoji = firstEmoji(name); + if (emoji != null) return emoji; + final runes = name.runes.toList(); + if (runes.isEmpty) return '?'; + return String.fromCharCode(runes[0]).toUpperCase(); +} diff --git a/lib/helpers/path_helper.dart b/lib/helpers/path_helper.dart index fe51d636..bd599c00 100644 --- a/lib/helpers/path_helper.dart +++ b/lib/helpers/path_helper.dart @@ -8,24 +8,29 @@ class PathHelper { .join(','); } + static String hopHex(int byte) { + return byte.toRadixString(16).padLeft(2, '0').toUpperCase(); + } + + static String? hopName(int byte, List allContacts) { + final matches = allContacts + .where( + (c) => + c.publicKey.first == byte && + (c.type == advTypeRepeater || c.type == advTypeRoom), + ) + .toList(); + if (matches.isEmpty) return null; + if (matches.length == 1) return matches.first.name; + return matches.map((c) => c.name).join(' | '); + } + static String resolvePathNames( List pathBytes, List allContacts, ) { return pathBytes - .map((b) { - final hex = b.toRadixString(16).padLeft(2, '0').toUpperCase(); - final matches = allContacts - .where( - (c) => - c.publicKey.first == b && - (c.type == advTypeRepeater || c.type == advTypeRoom), - ) - .toList(); - if (matches.isEmpty) return hex; - if (matches.length == 1) return matches.first.name; - return matches.map((c) => c.name).join(' | '); - }) + .map((b) => hopName(b, allContacts) ?? hopHex(b)) .join(' \u2192 '); } } diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 1f05124a..58613d02 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -28,6 +28,12 @@ "common_remove": "Remove", "common_enable": "Enable", "common_disable": "Disable", + "common_undo": "Undo", + "messageStatus_sent": "Sent", + "messageStatus_delivered": "Delivered", + "messageStatus_pending": "Sending", + "messageStatus_failed": "Failed to send", + "messageStatus_repeated": "Heard repeated", "common_reboot": "Reboot", "common_loading": "Loading...", "common_notAvailable": "—", @@ -297,17 +303,6 @@ "appSettings_routeWeightFailureDecrementSubtitle": "Weight removed from a path after failed delivery", "appSettings_maxMessageRetries": "Max Message Retries", "appSettings_maxMessageRetriesSubtitle": "Number of retry attempts before marking a message as failed", - "path_routeWeight": "{weight}/{max}", - "@path_routeWeight": { - "placeholders": { - "weight": { - "type": "String" - }, - "max": { - "type": "String" - } - } - }, "appSettings_battery": "Battery", "appSettings_batteryChemistry": "Battery Chemistry", "appSettings_batteryChemistryPerDevice": "Set per device ({deviceName})", @@ -453,6 +448,9 @@ } }, "contacts_newGroup": "New Group", + "contacts_moreOptions": "More options", + "contacts_searchOpen": "Search contacts", + "contacts_searchClose": "Close search", "contacts_groupName": "Group name", "contacts_groupNameRequired": "Group name is required", "contacts_groupNameReserved": "This group name is reserved", @@ -777,15 +775,6 @@ } }, "debugFrame_hexDump": "Hex Dump:", - "chat_pathManagement": "Path Management", - "chat_ShowAllPaths": "Show all paths", - "chat_routingMode": "Routing mode", - "chat_autoUseSavedPath": "Auto (use saved path)", - "chat_forceFloodMode": "Force Flood Mode", - "chat_recentAckPaths": "Recent ACK Paths (tap to use):", - "chat_pathHistoryFull": "Path history is full. Remove entries to add new ones.", - "chat_hopSingular": "hop", - "chat_hopPlural": "hops", "chat_hopsCount": "{count} {count, plural, =1{hop} other{hops}}", "@chat_hopsCount": { "placeholders": { @@ -794,31 +783,80 @@ } } }, - "chat_successes": "successes", - "chat_score": "Score", "chat_removePath": "Remove path", "chat_noPathHistoryYet": "No path history yet.\nSend a message to discover paths.", - "chat_pathActions": "Path Actions:", - "chat_setCustomPath": "Set Custom Path", - "chat_setCustomPathSubtitle": "Manually specify routing path", - "chat_clearPath": "Clear Path", - "chat_clearPathSubtitle": "Force rediscovery on next send", "chat_pathCleared": "Path cleared. Next message will rediscover route.", - "chat_floodModeSubtitle": "Use routing toggle in app bar", - "chat_floodModeEnabled": "Flood mode enabled. Toggle back via routing icon in app bar.", "chat_fullPath": "Full Path", - "chat_pathDetailsNotAvailable": "Path details not available yet. Try sending a message to refresh.", - "chat_pathSetHops": "Path set: {hopCount} {hopCount, plural, =1{hop} other{hops}} - {status}", - "@chat_pathSetHops": { + "routing_title": "Routing", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Flood", + "routing_modeManual": "Manual", + "routing_modeAutoHint": "Picks the best known path automatically, flooding when none is known.", + "routing_modeFloodHint": "Broadcasts through every repeater. Most reliable, but uses more airtime.", + "routing_modeManualHint": "Always sends along the exact path you set.", + "routing_currentRoute": "Current route", + "routing_directNoHops": "Direct — no repeater hops", + "routing_noPathYet": "No path yet. The next message floods until a route is discovered.", + "routing_floodBroadcast": "Broadcast through every repeater", + "routing_editPath": "Edit path", + "routing_forgetPath": "Forget path", + "routing_knownPaths": "Known paths", + "routing_knownPathsHint": "Tap a path to switch to it.", + "routing_inUse": "In use", + "routing_qualityStrong": "Strong first hop", + "routing_qualityGood": "Good first hop", + "routing_qualityFair": "Fair first hop", + "routing_qualityWorked": "Has delivered", + "routing_qualityFlood": "Heard via flood", + "routing_qualityUntested": "Untested", + "routing_lastWorked": "worked {when}", + "@routing_lastWorked": { "placeholders": { - "hopCount": { - "type": "int" - }, - "status": { + "when": { "type": "String" } } }, + "routing_neverWorked": "never confirmed", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "routing_floodDelivery": "Flood delivery", + "pathEditor_title": "Build Path", + "pathEditor_hopCounter": "{count} of 64 hops", + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathEditor_noHops": "No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.", + "pathEditor_addHops": "Add hops in order", + "pathEditor_searchRepeaters": "Search repeaters", + "pathEditor_advancedHex": "Advanced: raw hex path", + "pathEditor_hexLabel": "Hex prefixes", + "pathEditor_hexHelper": "Two hex characters per hop, separated by commas", + "pathEditor_invalidTokens": "Invalid: {tokens}", + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "pathEditor_tooManyHops": "Maximum 64 hops", + "pathEditor_usePath": "Use this path", + "pathEditor_removeHop": "Remove hop", + "pathEditor_unknownHop": "Unknown repeater", "chat_pathSavedLocally": "Saved locally. Connect to sync.", "chat_pathDeviceConfirmed": "Device confirmed.", "chat_pathDeviceNotConfirmed": "Device not confirmed yet.", @@ -1100,41 +1138,8 @@ "login_failedMessage": "Login failed. Either the password is incorrect or the repeater is unreachable.", "common_reload": "Reload", "common_clear": "Clear", - "path_currentPath": "Current path: {path}", - "@path_currentPath": { - "placeholders": { - "path": { - "type": "String" - } - } - }, - "path_usingHopsPath": "Using {count} {count, plural, =1{hop} other{hops}} path", - "@path_usingHopsPath": { - "placeholders": { - "count": { - "type": "int" - } - } - }, - "path_enterCustomPath": "Enter Custom Path", "path_currentPathLabel": "Current path", - "path_hexPrefixInstructions": "Enter 2-character hex prefixes for each hop, separated by commas.", - "path_hexPrefixExample": "Example: A1,F2,3C (each node uses first byte of its public key)", - "path_labelHexPrefixes": "Path (hex prefixes)", - "path_helperMaxHops": "Max 64 hops. Each prefix is 2 hex characters (1 byte)", - "path_selectFromContacts": "Or select from contacts:", "path_noRepeatersFound": "No repeaters or room servers found.", - "path_customPathsRequire": "Custom paths require intermediate hops that can relay messages.", - "path_invalidHexPrefixes": "Invalid hex prefixes: {prefixes}", - "@path_invalidHexPrefixes": { - "placeholders": { - "prefixes": { - "type": "String" - } - } - }, - "path_tooLong": "Path too long. Maximum 64 hops allowed.", - "path_setPath": "Set Path", "repeater_management": "Repeater Management", "room_management": "Room Server Management", "repeater_guest": "Repeater Information", @@ -1161,9 +1166,6 @@ }, "repeater_statusTitle": "Repeater Status", "repeater_routingMode": "Routing mode", - "repeater_autoUseSavedPath": "Auto (use saved path)", - "repeater_forceFloodMode": "Force Flood Mode", - "repeater_pathManagement": "Path management", "repeater_refresh": "Refresh", "repeater_statusRequestTimeout": "Status request timed out.", "repeater_errorLoadingStatus": "Error loading status: {error}", @@ -2485,5 +2487,19 @@ "contact_typeRepeater": "Repeater", "contact_typeRoom": "Room", "contact_typeSensor": "Sensor", - "contact_typeUnknown": "Unknown" + "contact_typeUnknown": "Unknown", + "map_zoomIn": "Zoom in", + "map_zoomOut": "Zoom out", + "map_centerMap": "Center map", + "chrome_bluetoothRequiresChromium": "Web Bluetooth requires a Chromium browser", + "channels_communityShortId": "ID: {id}...", + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "pathTrace_legendGpsConfirmed": "GPS confirmed", + "pathTrace_legendInferred": "Inferred position" } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index b45facfe..f55fc02c 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -298,6 +298,42 @@ abstract class AppLocalizations { /// **'Disable'** String get common_disable; + /// No description provided for @common_undo. + /// + /// In en, this message translates to: + /// **'Undo'** + String get common_undo; + + /// No description provided for @messageStatus_sent. + /// + /// In en, this message translates to: + /// **'Sent'** + String get messageStatus_sent; + + /// No description provided for @messageStatus_delivered. + /// + /// In en, this message translates to: + /// **'Delivered'** + String get messageStatus_delivered; + + /// No description provided for @messageStatus_pending. + /// + /// In en, this message translates to: + /// **'Sending'** + String get messageStatus_pending; + + /// No description provided for @messageStatus_failed. + /// + /// In en, this message translates to: + /// **'Failed to send'** + String get messageStatus_failed; + + /// No description provided for @messageStatus_repeated. + /// + /// In en, this message translates to: + /// **'Heard repeated'** + String get messageStatus_repeated; + /// No description provided for @common_reboot. /// /// In en, this message translates to: @@ -1534,12 +1570,6 @@ abstract class AppLocalizations { /// **'Number of retry attempts before marking a message as failed'** String get appSettings_maxMessageRetriesSubtitle; - /// No description provided for @path_routeWeight. - /// - /// In en, this message translates to: - /// **'{weight}/{max}'** - String path_routeWeight(String weight, String max); - /// No description provided for @appSettings_battery. /// /// In en, this message translates to: @@ -1882,6 +1912,24 @@ abstract class AppLocalizations { /// **'New Group'** String get contacts_newGroup; + /// No description provided for @contacts_moreOptions. + /// + /// In en, this message translates to: + /// **'More options'** + String get contacts_moreOptions; + + /// No description provided for @contacts_searchOpen. + /// + /// In en, this message translates to: + /// **'Search contacts'** + String get contacts_searchOpen; + + /// No description provided for @contacts_searchClose. + /// + /// In en, this message translates to: + /// **'Close search'** + String get contacts_searchClose; + /// No description provided for @contacts_groupName. /// /// In en, this message translates to: @@ -2710,78 +2758,12 @@ abstract class AppLocalizations { /// **'Hex Dump:'** String get debugFrame_hexDump; - /// No description provided for @chat_pathManagement. - /// - /// In en, this message translates to: - /// **'Path Management'** - String get chat_pathManagement; - - /// No description provided for @chat_ShowAllPaths. - /// - /// In en, this message translates to: - /// **'Show all paths'** - String get chat_ShowAllPaths; - - /// No description provided for @chat_routingMode. - /// - /// In en, this message translates to: - /// **'Routing mode'** - String get chat_routingMode; - - /// No description provided for @chat_autoUseSavedPath. - /// - /// In en, this message translates to: - /// **'Auto (use saved path)'** - String get chat_autoUseSavedPath; - - /// No description provided for @chat_forceFloodMode. - /// - /// In en, this message translates to: - /// **'Force Flood Mode'** - String get chat_forceFloodMode; - - /// No description provided for @chat_recentAckPaths. - /// - /// In en, this message translates to: - /// **'Recent ACK Paths (tap to use):'** - String get chat_recentAckPaths; - - /// No description provided for @chat_pathHistoryFull. - /// - /// In en, this message translates to: - /// **'Path history is full. Remove entries to add new ones.'** - String get chat_pathHistoryFull; - - /// No description provided for @chat_hopSingular. - /// - /// In en, this message translates to: - /// **'hop'** - String get chat_hopSingular; - - /// No description provided for @chat_hopPlural. - /// - /// In en, this message translates to: - /// **'hops'** - String get chat_hopPlural; - /// No description provided for @chat_hopsCount. /// /// In en, this message translates to: /// **'{count} {count, plural, =1{hop} other{hops}}'** String chat_hopsCount(int count); - /// No description provided for @chat_successes. - /// - /// In en, this message translates to: - /// **'successes'** - String get chat_successes; - - /// No description provided for @chat_score. - /// - /// In en, this message translates to: - /// **'Score'** - String get chat_score; - /// No description provided for @chat_removePath. /// /// In en, this message translates to: @@ -2794,71 +2776,251 @@ abstract class AppLocalizations { /// **'No path history yet.\nSend a message to discover paths.'** String get chat_noPathHistoryYet; - /// No description provided for @chat_pathActions. - /// - /// In en, this message translates to: - /// **'Path Actions:'** - String get chat_pathActions; - - /// No description provided for @chat_setCustomPath. - /// - /// In en, this message translates to: - /// **'Set Custom Path'** - String get chat_setCustomPath; - - /// No description provided for @chat_setCustomPathSubtitle. - /// - /// In en, this message translates to: - /// **'Manually specify routing path'** - String get chat_setCustomPathSubtitle; - - /// No description provided for @chat_clearPath. - /// - /// In en, this message translates to: - /// **'Clear Path'** - String get chat_clearPath; - - /// No description provided for @chat_clearPathSubtitle. - /// - /// In en, this message translates to: - /// **'Force rediscovery on next send'** - String get chat_clearPathSubtitle; - /// No description provided for @chat_pathCleared. /// /// In en, this message translates to: /// **'Path cleared. Next message will rediscover route.'** String get chat_pathCleared; - /// No description provided for @chat_floodModeSubtitle. - /// - /// In en, this message translates to: - /// **'Use routing toggle in app bar'** - String get chat_floodModeSubtitle; - - /// No description provided for @chat_floodModeEnabled. - /// - /// In en, this message translates to: - /// **'Flood mode enabled. Toggle back via routing icon in app bar.'** - String get chat_floodModeEnabled; - /// No description provided for @chat_fullPath. /// /// In en, this message translates to: /// **'Full Path'** String get chat_fullPath; - /// No description provided for @chat_pathDetailsNotAvailable. + /// No description provided for @routing_title. /// /// In en, this message translates to: - /// **'Path details not available yet. Try sending a message to refresh.'** - String get chat_pathDetailsNotAvailable; + /// **'Routing'** + String get routing_title; - /// No description provided for @chat_pathSetHops. + /// No description provided for @routing_modeAuto. /// /// In en, this message translates to: - /// **'Path set: {hopCount} {hopCount, plural, =1{hop} other{hops}} - {status}'** - String chat_pathSetHops(int hopCount, String status); + /// **'Auto'** + String get routing_modeAuto; + + /// No description provided for @routing_modeFlood. + /// + /// In en, this message translates to: + /// **'Flood'** + String get routing_modeFlood; + + /// No description provided for @routing_modeManual. + /// + /// In en, this message translates to: + /// **'Manual'** + String get routing_modeManual; + + /// No description provided for @routing_modeAutoHint. + /// + /// In en, this message translates to: + /// **'Picks the best known path automatically, flooding when none is known.'** + String get routing_modeAutoHint; + + /// No description provided for @routing_modeFloodHint. + /// + /// In en, this message translates to: + /// **'Broadcasts through every repeater. Most reliable, but uses more airtime.'** + String get routing_modeFloodHint; + + /// No description provided for @routing_modeManualHint. + /// + /// In en, this message translates to: + /// **'Always sends along the exact path you set.'** + String get routing_modeManualHint; + + /// No description provided for @routing_currentRoute. + /// + /// In en, this message translates to: + /// **'Current route'** + String get routing_currentRoute; + + /// No description provided for @routing_directNoHops. + /// + /// In en, this message translates to: + /// **'Direct — no repeater hops'** + String get routing_directNoHops; + + /// No description provided for @routing_noPathYet. + /// + /// In en, this message translates to: + /// **'No path yet. The next message floods until a route is discovered.'** + String get routing_noPathYet; + + /// No description provided for @routing_floodBroadcast. + /// + /// In en, this message translates to: + /// **'Broadcast through every repeater'** + String get routing_floodBroadcast; + + /// No description provided for @routing_editPath. + /// + /// In en, this message translates to: + /// **'Edit path'** + String get routing_editPath; + + /// No description provided for @routing_forgetPath. + /// + /// In en, this message translates to: + /// **'Forget path'** + String get routing_forgetPath; + + /// No description provided for @routing_knownPaths. + /// + /// In en, this message translates to: + /// **'Known paths'** + String get routing_knownPaths; + + /// No description provided for @routing_knownPathsHint. + /// + /// In en, this message translates to: + /// **'Tap a path to switch to it.'** + String get routing_knownPathsHint; + + /// No description provided for @routing_inUse. + /// + /// In en, this message translates to: + /// **'In use'** + String get routing_inUse; + + /// No description provided for @routing_qualityStrong. + /// + /// In en, this message translates to: + /// **'Strong first hop'** + String get routing_qualityStrong; + + /// No description provided for @routing_qualityGood. + /// + /// In en, this message translates to: + /// **'Good first hop'** + String get routing_qualityGood; + + /// No description provided for @routing_qualityFair. + /// + /// In en, this message translates to: + /// **'Fair first hop'** + String get routing_qualityFair; + + /// No description provided for @routing_qualityWorked. + /// + /// In en, this message translates to: + /// **'Has delivered'** + String get routing_qualityWorked; + + /// No description provided for @routing_qualityFlood. + /// + /// In en, this message translates to: + /// **'Heard via flood'** + String get routing_qualityFlood; + + /// No description provided for @routing_qualityUntested. + /// + /// In en, this message translates to: + /// **'Untested'** + String get routing_qualityUntested; + + /// No description provided for @routing_lastWorked. + /// + /// In en, this message translates to: + /// **'worked {when}'** + String routing_lastWorked(String when); + + /// No description provided for @routing_neverWorked. + /// + /// In en, this message translates to: + /// **'never confirmed'** + String get routing_neverWorked; + + /// No description provided for @routing_deliveryCounts. + /// + /// In en, this message translates to: + /// **'{successes} delivered, {failures} failed'** + String routing_deliveryCounts(int successes, int failures); + + /// No description provided for @routing_floodDelivery. + /// + /// In en, this message translates to: + /// **'Flood delivery'** + String get routing_floodDelivery; + + /// No description provided for @pathEditor_title. + /// + /// In en, this message translates to: + /// **'Build Path'** + String get pathEditor_title; + + /// No description provided for @pathEditor_hopCounter. + /// + /// In en, this message translates to: + /// **'{count} of 64 hops'** + String pathEditor_hopCounter(int count); + + /// No description provided for @pathEditor_noHops. + /// + /// In en, this message translates to: + /// **'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'** + String get pathEditor_noHops; + + /// No description provided for @pathEditor_addHops. + /// + /// In en, this message translates to: + /// **'Add hops in order'** + String get pathEditor_addHops; + + /// No description provided for @pathEditor_searchRepeaters. + /// + /// In en, this message translates to: + /// **'Search repeaters'** + String get pathEditor_searchRepeaters; + + /// No description provided for @pathEditor_advancedHex. + /// + /// In en, this message translates to: + /// **'Advanced: raw hex path'** + String get pathEditor_advancedHex; + + /// No description provided for @pathEditor_hexLabel. + /// + /// In en, this message translates to: + /// **'Hex prefixes'** + String get pathEditor_hexLabel; + + /// No description provided for @pathEditor_hexHelper. + /// + /// In en, this message translates to: + /// **'Two hex characters per hop, separated by commas'** + String get pathEditor_hexHelper; + + /// No description provided for @pathEditor_invalidTokens. + /// + /// In en, this message translates to: + /// **'Invalid: {tokens}'** + String pathEditor_invalidTokens(String tokens); + + /// No description provided for @pathEditor_tooManyHops. + /// + /// In en, this message translates to: + /// **'Maximum 64 hops'** + String get pathEditor_tooManyHops; + + /// No description provided for @pathEditor_usePath. + /// + /// In en, this message translates to: + /// **'Use this path'** + String get pathEditor_usePath; + + /// No description provided for @pathEditor_removeHop. + /// + /// In en, this message translates to: + /// **'Remove hop'** + String get pathEditor_removeHop; + + /// No description provided for @pathEditor_unknownHop. + /// + /// In en, this message translates to: + /// **'Unknown repeater'** + String get pathEditor_unknownHop; /// No description provided for @chat_pathSavedLocally. /// @@ -3687,90 +3849,18 @@ abstract class AppLocalizations { /// **'Clear'** String get common_clear; - /// No description provided for @path_currentPath. - /// - /// In en, this message translates to: - /// **'Current path: {path}'** - String path_currentPath(String path); - - /// No description provided for @path_usingHopsPath. - /// - /// In en, this message translates to: - /// **'Using {count} {count, plural, =1{hop} other{hops}} path'** - String path_usingHopsPath(int count); - - /// No description provided for @path_enterCustomPath. - /// - /// In en, this message translates to: - /// **'Enter Custom Path'** - String get path_enterCustomPath; - /// No description provided for @path_currentPathLabel. /// /// In en, this message translates to: /// **'Current path'** String get path_currentPathLabel; - /// No description provided for @path_hexPrefixInstructions. - /// - /// In en, this message translates to: - /// **'Enter 2-character hex prefixes for each hop, separated by commas.'** - String get path_hexPrefixInstructions; - - /// No description provided for @path_hexPrefixExample. - /// - /// In en, this message translates to: - /// **'Example: A1,F2,3C (each node uses first byte of its public key)'** - String get path_hexPrefixExample; - - /// No description provided for @path_labelHexPrefixes. - /// - /// In en, this message translates to: - /// **'Path (hex prefixes)'** - String get path_labelHexPrefixes; - - /// No description provided for @path_helperMaxHops. - /// - /// In en, this message translates to: - /// **'Max 64 hops. Each prefix is 2 hex characters (1 byte)'** - String get path_helperMaxHops; - - /// No description provided for @path_selectFromContacts. - /// - /// In en, this message translates to: - /// **'Or select from contacts:'** - String get path_selectFromContacts; - /// No description provided for @path_noRepeatersFound. /// /// In en, this message translates to: /// **'No repeaters or room servers found.'** String get path_noRepeatersFound; - /// No description provided for @path_customPathsRequire. - /// - /// In en, this message translates to: - /// **'Custom paths require intermediate hops that can relay messages.'** - String get path_customPathsRequire; - - /// No description provided for @path_invalidHexPrefixes. - /// - /// In en, this message translates to: - /// **'Invalid hex prefixes: {prefixes}'** - String path_invalidHexPrefixes(String prefixes); - - /// No description provided for @path_tooLong. - /// - /// In en, this message translates to: - /// **'Path too long. Maximum 64 hops allowed.'** - String get path_tooLong; - - /// No description provided for @path_setPath. - /// - /// In en, this message translates to: - /// **'Set Path'** - String get path_setPath; - /// No description provided for @repeater_management. /// /// In en, this message translates to: @@ -3891,24 +3981,6 @@ abstract class AppLocalizations { /// **'Routing mode'** String get repeater_routingMode; - /// No description provided for @repeater_autoUseSavedPath. - /// - /// In en, this message translates to: - /// **'Auto (use saved path)'** - String get repeater_autoUseSavedPath; - - /// No description provided for @repeater_forceFloodMode. - /// - /// In en, this message translates to: - /// **'Force Flood Mode'** - String get repeater_forceFloodMode; - - /// No description provided for @repeater_pathManagement. - /// - /// In en, this message translates to: - /// **'Path management'** - String get repeater_pathManagement; - /// No description provided for @repeater_refresh. /// /// In en, this message translates to: @@ -7587,6 +7659,48 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Unknown'** String get contact_typeUnknown; + + /// No description provided for @map_zoomIn. + /// + /// In en, this message translates to: + /// **'Zoom in'** + String get map_zoomIn; + + /// No description provided for @map_zoomOut. + /// + /// In en, this message translates to: + /// **'Zoom out'** + String get map_zoomOut; + + /// No description provided for @map_centerMap. + /// + /// In en, this message translates to: + /// **'Center map'** + String get map_centerMap; + + /// No description provided for @chrome_bluetoothRequiresChromium. + /// + /// In en, this message translates to: + /// **'Web Bluetooth requires a Chromium browser'** + String get chrome_bluetoothRequiresChromium; + + /// No description provided for @channels_communityShortId. + /// + /// In en, this message translates to: + /// **'ID: {id}...'** + String channels_communityShortId(String id); + + /// No description provided for @pathTrace_legendGpsConfirmed. + /// + /// In en, this message translates to: + /// **'GPS confirmed'** + String get pathTrace_legendGpsConfirmed; + + /// No description provided for @pathTrace_legendInferred. + /// + /// In en, this message translates to: + /// **'Inferred position'** + String get pathTrace_legendInferred; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index af9e693d..68742652 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -92,6 +92,24 @@ class AppLocalizationsBg extends AppLocalizations { @override String get common_disable => 'Деактивирай'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Рестартирай'; @@ -796,11 +814,6 @@ class AppLocalizationsBg extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Брой опити за повторно изпращане, преди съобщението да бъде маркирано като неуспешно.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Батерия'; @@ -1002,6 +1015,15 @@ class AppLocalizationsBg extends AppLocalizations { @override String get contacts_newGroup => 'Нова група'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Група'; @@ -1482,35 +1504,6 @@ class AppLocalizationsBg extends AppLocalizations { @override String get debugFrame_hexDump => 'Хексадесетичен Dump:'; - @override - String get chat_pathManagement => 'Управление на пътища'; - - @override - String get chat_ShowAllPaths => 'Покажи всички пътища'; - - @override - String get chat_routingMode => 'Режим на маршрутизиране'; - - @override - String get chat_autoUseSavedPath => 'Автоматично (използвай запазения път)'; - - @override - String get chat_forceFloodMode => 'Принуди режим на наводняване'; - - @override - String get chat_recentAckPaths => - 'Неотдавни ACK пътища (докоснете, за да използвате):'; - - @override - String get chat_pathHistoryFull => - 'Историята на пътя е пълна. Премахнете записи, за да добавите нови.'; - - @override - String get chat_hopSingular => 'скочи'; - - @override - String get chat_hopPlural => 'скоци'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1522,12 +1515,6 @@ class AppLocalizationsBg extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Успехи'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Премахни пътя'; @@ -1535,52 +1522,144 @@ class AppLocalizationsBg extends AppLocalizations { String get chat_noPathHistoryYet => 'Няма история на пътищата още.\nИзпратете съобщение, за да откриете пътища.'; - @override - String get chat_pathActions => 'Действия по пътя:'; - - @override - String get chat_setCustomPath => 'Задайте персонализиран път'; - - @override - String get chat_setCustomPathSubtitle => 'Ръчно укажете маршрутен път'; - - @override - String get chat_clearPath => 'Почисти Път'; - - @override - String get chat_clearPathSubtitle => - 'Принуди преоткриване при следващо изпращане'; - @override String get chat_pathCleared => 'Пътят е почистен. Следващото съобщение ще открие маршрута отново.'; - @override - String get chat_floodModeSubtitle => - 'Използвайте превключвателя за маршрутизиране в лентата на приложението.'; - - @override - String get chat_floodModeEnabled => - 'Режим на наводнение е активиран. Включете го отново чрез иконката за маршрутизиране в лентата на приложението.'; - @override String get chat_fullPath => 'Пълен път'; @override - String get chat_pathDetailsNotAvailable => - 'Детайлите за пътя все още не са налични. Опитайте да изпратите съобщение, за да освежите.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Пътят е зададен: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Запазено локално. Свържете се за синхронизиране.'; @@ -2050,66 +2129,13 @@ class AppLocalizationsBg extends AppLocalizations { @override String get common_clear => 'Изчисти'; - @override - String path_currentPath(String path) { - return 'Текущ път: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Използване на $count $_temp0 път'; - } - - @override - String get path_enterCustomPath => 'Въведете персонализиран път'; - @override String get path_currentPathLabel => 'Текущ път'; - @override - String get path_hexPrefixInstructions => - 'Въведете 2-символни шестнадесетични префикси за всеки хоп, разделени с кама.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (всяка нода използва първия байт от публичния си ключ)'; - - @override - String get path_labelHexPrefixes => 'Пътеки (шестнадесетични префикси)'; - - @override - String get path_helperMaxHops => - 'Максимум 64 скока. Всеки префикс е 2 шестнадесетични знака (1 байт).'; - - @override - String get path_selectFromContacts => 'Изберете от контакти:'; - @override String get path_noRepeatersFound => 'Няма намерени репетитори или сървъри на стаи.'; - @override - String get path_customPathsRequire => - 'Персонализираните пътища изискват междинни скокове, които могат да препращат съобщения.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Невалидни шестнадесетични префикси: $prefixes'; - } - - @override - String get path_tooLong => - 'Пътят е твърде дълъг. Максимум 64 скока са разрешени.'; - - @override - String get path_setPath => 'Задайте път'; - @override String get repeater_management => 'Управление на повторители'; @@ -2176,16 +2202,6 @@ class AppLocalizationsBg extends AppLocalizations { @override String get repeater_routingMode => 'Режим на маршрутизиране'; - @override - String get repeater_autoUseSavedPath => - 'Автоматично (използвай запазения път)'; - - @override - String get repeater_forceFloodMode => 'Принуди режим на наводняване'; - - @override - String get repeater_pathManagement => 'Управление на пътища'; - @override String get repeater_refresh => 'Презареди'; @@ -4437,4 +4453,28 @@ class AppLocalizationsBg extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 3fa9c4a8..62df5bb6 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -92,6 +92,24 @@ class AppLocalizationsDe extends AppLocalizations { @override String get common_disable => 'Deaktivieren'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Neustart'; @@ -792,11 +810,6 @@ class AppLocalizationsDe extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Anzahl der Versuche, eine Nachricht erneut zu senden, bevor sie als fehlgeschlagen markiert wird.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Akku'; @@ -998,6 +1011,15 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contacts_newGroup => 'Neue Gruppe'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Gruppenname'; @@ -1480,36 +1502,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex-Dump:'; - @override - String get chat_pathManagement => 'Pfadverwaltung'; - - @override - String get chat_ShowAllPaths => 'Alle Pfade anzeigen'; - - @override - String get chat_routingMode => 'Routenmodus'; - - @override - String get chat_autoUseSavedPath => - 'Automatisch (gespeicherten Pfad verwenden)'; - - @override - String get chat_forceFloodMode => 'Flut-Modus erzwingen'; - - @override - String get chat_recentAckPaths => - 'Aktuelle ACK-Pfade (antippen, um zu verwenden):'; - - @override - String get chat_pathHistoryFull => - 'Die Pfadhistorie ist voll. Entferne Einträge, um neue hinzuzufügen.'; - - @override - String get chat_hopSingular => 'Sprung'; - - @override - String get chat_hopPlural => 'Sprünge'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1521,12 +1513,6 @@ class AppLocalizationsDe extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Erfolgreich'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Pfad entfernen'; @@ -1534,51 +1520,144 @@ class AppLocalizationsDe extends AppLocalizations { String get chat_noPathHistoryYet => 'Keine Pfadhistorie vorhanden.\nSende eine Nachricht, um Pfade zu entdecken.'; - @override - String get chat_pathActions => 'Pfadaktionen:'; - - @override - String get chat_setCustomPath => 'Lege benutzerdefinierten Pfad fest'; - - @override - String get chat_setCustomPathSubtitle => 'Manuellen Routenpfad festlegen'; - - @override - String get chat_clearPath => 'Pfad zurücksetzen'; - - @override - String get chat_clearPathSubtitle => - 'Setze Pfad zurück, erkenne neuen Pfad bei nächster Sendung.'; - @override String get chat_pathCleared => 'Pfad zurückgesetzt. Nächste Nachricht wird Route neu entdecken.'; - @override - String get chat_floodModeSubtitle => - 'Verwende den Routingschalter in der App-Leiste'; - - @override - String get chat_floodModeEnabled => 'Flutmodus aktiviert.'; - @override String get chat_fullPath => 'Vollständiger Pfad'; @override - String get chat_pathDetailsNotAvailable => - 'Die Pfaddetails sind noch nicht verfügbar. Versuchen Sie, eine Nachricht zu senden, um zu aktualisieren.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Pfad gesetzt: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Lokal Gespeichert. Bitte Verbinden zum Synchronisieren.'; @@ -2049,65 +2128,13 @@ class AppLocalizationsDe extends AppLocalizations { @override String get common_clear => 'Löschen'; - @override - String path_currentPath(String path) { - return 'Aktiver Pfad: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'Hops', - one: 'Hop', - ); - return 'Verwenden Sie $count $_temp0 Pfad'; - } - - @override - String get path_enterCustomPath => 'Gebe Pfad ein'; - @override String get path_currentPathLabel => 'Aktueller Pfad'; - @override - String get path_hexPrefixInstructions => - 'Gebe für jeden Zwischen-Hop das 2-stellige Hex-Präfix ein, getrennt durch Kommas.'; - - @override - String get path_hexPrefixExample => - 'Beispiel: A1,F2,3C (jeder Knoten verwendet den ersten Byte seines öffentlichen Schlüssels)'; - - @override - String get path_labelHexPrefixes => 'Pfad (Hex-Präfixe)'; - - @override - String get path_helperMaxHops => - 'Max 64 Sprünge. Jede Präfixe ist 2 Hexadezimalzeichen (1 Byte)'; - - @override - String get path_selectFromContacts => 'Oder wähle aus Kontakten aus:'; - @override String get path_noRepeatersFound => 'Keine Repeater oder Raumserver gefunden.'; - @override - String get path_customPathsRequire => - 'Benutzerdefinierte Pfade erfordern Zwischen-Hops, die Nachrichten weiterleiten können.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Ungültige Hexadezimal-Präfixe: $prefixes'; - } - - @override - String get path_tooLong => 'Pfad zu lang. Maximal 64 Hops erlaubt.'; - - @override - String get path_setPath => 'Pfad festlegen'; - @override String get repeater_management => 'Repeater-Verwaltung'; @@ -2172,16 +2199,6 @@ class AppLocalizationsDe extends AppLocalizations { @override String get repeater_routingMode => 'Routenmodus'; - @override - String get repeater_autoUseSavedPath => - 'Automatisch (gespeicherten Pfad verwenden)'; - - @override - String get repeater_forceFloodMode => 'Flut-Modus erzwingen'; - - @override - String get repeater_pathManagement => 'Pfadverwaltung'; - @override String get repeater_refresh => 'Aktualisieren'; @@ -4455,4 +4472,28 @@ class AppLocalizationsDe extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 4fbfd5bb..eecfbc41 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -92,6 +92,24 @@ class AppLocalizationsEn extends AppLocalizations { @override String get common_disable => 'Disable'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Reboot'; @@ -777,11 +795,6 @@ class AppLocalizationsEn extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Number of retry attempts before marking a message as failed'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Battery'; @@ -981,6 +994,15 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contacts_newGroup => 'New Group'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Group name'; @@ -1452,34 +1474,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex Dump:'; - @override - String get chat_pathManagement => 'Path Management'; - - @override - String get chat_ShowAllPaths => 'Show all paths'; - - @override - String get chat_routingMode => 'Routing mode'; - - @override - String get chat_autoUseSavedPath => 'Auto (use saved path)'; - - @override - String get chat_forceFloodMode => 'Force Flood Mode'; - - @override - String get chat_recentAckPaths => 'Recent ACK Paths (tap to use):'; - - @override - String get chat_pathHistoryFull => - 'Path history is full. Remove entries to add new ones.'; - - @override - String get chat_hopSingular => 'hop'; - - @override - String get chat_hopPlural => 'hops'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1491,12 +1485,6 @@ class AppLocalizationsEn extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'successes'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Remove path'; @@ -1504,50 +1492,144 @@ class AppLocalizationsEn extends AppLocalizations { String get chat_noPathHistoryYet => 'No path history yet.\nSend a message to discover paths.'; - @override - String get chat_pathActions => 'Path Actions:'; - - @override - String get chat_setCustomPath => 'Set Custom Path'; - - @override - String get chat_setCustomPathSubtitle => 'Manually specify routing path'; - - @override - String get chat_clearPath => 'Clear Path'; - - @override - String get chat_clearPathSubtitle => 'Force rediscovery on next send'; - @override String get chat_pathCleared => 'Path cleared. Next message will rediscover route.'; - @override - String get chat_floodModeSubtitle => 'Use routing toggle in app bar'; - - @override - String get chat_floodModeEnabled => - 'Flood mode enabled. Toggle back via routing icon in app bar.'; - @override String get chat_fullPath => 'Full Path'; @override - String get chat_pathDetailsNotAvailable => - 'Path details not available yet. Try sending a message to refresh.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Saved locally. Connect to sync.'; @@ -2009,64 +2091,12 @@ class AppLocalizationsEn extends AppLocalizations { @override String get common_clear => 'Clear'; - @override - String path_currentPath(String path) { - return 'Current path: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Using $count $_temp0 path'; - } - - @override - String get path_enterCustomPath => 'Enter Custom Path'; - @override String get path_currentPathLabel => 'Current path'; - @override - String get path_hexPrefixInstructions => - 'Enter 2-character hex prefixes for each hop, separated by commas.'; - - @override - String get path_hexPrefixExample => - 'Example: A1,F2,3C (each node uses first byte of its public key)'; - - @override - String get path_labelHexPrefixes => 'Path (hex prefixes)'; - - @override - String get path_helperMaxHops => - 'Max 64 hops. Each prefix is 2 hex characters (1 byte)'; - - @override - String get path_selectFromContacts => 'Or select from contacts:'; - @override String get path_noRepeatersFound => 'No repeaters or room servers found.'; - @override - String get path_customPathsRequire => - 'Custom paths require intermediate hops that can relay messages.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Invalid hex prefixes: $prefixes'; - } - - @override - String get path_tooLong => 'Path too long. Maximum 64 hops allowed.'; - - @override - String get path_setPath => 'Set Path'; - @override String get repeater_management => 'Repeater Management'; @@ -2130,15 +2160,6 @@ class AppLocalizationsEn extends AppLocalizations { @override String get repeater_routingMode => 'Routing mode'; - @override - String get repeater_autoUseSavedPath => 'Auto (use saved path)'; - - @override - String get repeater_forceFloodMode => 'Force Flood Mode'; - - @override - String get repeater_pathManagement => 'Path management'; - @override String get repeater_refresh => 'Refresh'; @@ -4360,4 +4381,28 @@ class AppLocalizationsEn extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 383dd032..aa17930b 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -92,6 +92,24 @@ class AppLocalizationsEs extends AppLocalizations { @override String get common_disable => 'Desactivar'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Reiniciar'; @@ -791,11 +809,6 @@ class AppLocalizationsEs extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Número de intentos de reintento antes de marcar un mensaje como fallido.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batería'; @@ -997,6 +1010,15 @@ class AppLocalizationsEs extends AppLocalizations { @override String get contacts_newGroup => 'Nuevo Grupo'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Nombre del grupo'; @@ -1479,34 +1501,6 @@ class AppLocalizationsEs extends AppLocalizations { @override String get debugFrame_hexDump => 'Mapeo Hexadecimal:'; - @override - String get chat_pathManagement => 'Gestión de Rutas'; - - @override - String get chat_ShowAllPaths => 'Mostrar todos los caminos'; - - @override - String get chat_routingMode => 'Modo de enrutamiento'; - - @override - String get chat_autoUseSavedPath => 'Auto (usar la ruta guardada)'; - - @override - String get chat_forceFloodMode => 'Modo Inundación Forzado'; - - @override - String get chat_recentAckPaths => 'Rutas de ACK Recientes (tocar para usar):'; - - @override - String get chat_pathHistoryFull => - 'El historial de rutas está completo. Eliminar entradas para añadir nuevas.'; - - @override - String get chat_hopSingular => 'salta'; - - @override - String get chat_hopPlural => 'salta'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1518,12 +1512,6 @@ class AppLocalizationsEs extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Éxitos'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Eliminar ruta'; @@ -1531,53 +1519,144 @@ class AppLocalizationsEs extends AppLocalizations { String get chat_noPathHistoryYet => 'Aún no hay historial de rutas.\nEnvía un mensaje para descubrir rutas.'; - @override - String get chat_pathActions => 'Acciones de Ruta:'; - - @override - String get chat_setCustomPath => 'Establecer Ruta Personalizada'; - - @override - String get chat_setCustomPathSubtitle => - 'Especificar manualmente la ruta de enrutamiento'; - - @override - String get chat_clearPath => 'Limpiar Ruta'; - - @override - String get chat_clearPathSubtitle => - 'Forzar redescubrimiento en el próximo envío'; - @override String get chat_pathCleared => 'Ruta eliminada. El siguiente mensaje redescubrirá la ruta.'; - @override - String get chat_floodModeSubtitle => - 'Utilizar el interruptor de enrutamiento en la barra de herramientas'; - - @override - String get chat_floodModeEnabled => - 'El modo de inundación está habilitado. Desactívalo mediante el icono de enrutamiento en la barra de herramientas de la aplicación.'; - @override String get chat_fullPath => 'Ruta completa'; @override - String get chat_pathDetailsNotAvailable => - 'Los detalles de la ruta aún no están disponibles. Intenta enviar un mensaje para refrescar.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Ruta establecida: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Guardado localmente. Conéctate para sincronizar.'; @@ -2045,66 +2124,13 @@ class AppLocalizationsEs extends AppLocalizations { @override String get common_clear => 'Borrar'; - @override - String path_currentPath(String path) { - return 'Ruta actual: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Usando $count $_temp0 ruta'; - } - - @override - String get path_enterCustomPath => 'Introducir Ruta Personalizada'; - @override String get path_currentPathLabel => 'Ruta actual'; - @override - String get path_hexPrefixInstructions => - 'Introduzca los prefijos hexadecimales de 2 caracteres para cada salto, separados por comas.'; - - @override - String get path_hexPrefixExample => - 'Ejemplo: A1,F2,3C (cada nodo utiliza el primer byte de su clave pública).'; - - @override - String get path_labelHexPrefixes => 'Prefijos hexadecimales'; - - @override - String get path_helperMaxHops => - 'Máximo 64 saltos. Cada prefijo tiene 2 caracteres hexadecimales (1 byte).'; - - @override - String get path_selectFromContacts => 'O seleccionar de contactos:'; - @override String get path_noRepeatersFound => 'No se encontraron repetidores ni servidores de sala.'; - @override - String get path_customPathsRequire => - 'Las rutas personalizadas requieren saltos intermedios que pueden transmitir mensajes.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Prefijos hexadecimales inválidos: $prefixes'; - } - - @override - String get path_tooLong => - 'La ruta es demasiado larga. Se permiten un máximo de 64 saltos.'; - - @override - String get path_setPath => 'Establecer Ruta'; - @override String get repeater_management => 'Gestión de Repetidores'; @@ -2169,15 +2195,6 @@ class AppLocalizationsEs extends AppLocalizations { @override String get repeater_routingMode => 'Modo de enrutamiento'; - @override - String get repeater_autoUseSavedPath => 'Auto (usar la ruta guardada)'; - - @override - String get repeater_forceFloodMode => 'Modo Inundación Forzado'; - - @override - String get repeater_pathManagement => 'Gestión de rutas'; - @override String get repeater_refresh => 'Actualizar'; @@ -4442,4 +4459,28 @@ class AppLocalizationsEs extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 990c49c6..69e2af85 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -92,6 +92,24 @@ class AppLocalizationsFr extends AppLocalizations { @override String get common_disable => 'Désactiver'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Redémarrer'; @@ -797,11 +815,6 @@ class AppLocalizationsFr extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Nombre de tentatives de relance avant de marquer un message comme ayant échoué.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batterie'; @@ -1003,6 +1016,15 @@ class AppLocalizationsFr extends AppLocalizations { @override String get contacts_newGroup => 'Nouveau Groupe'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Nom du groupe'; @@ -1485,35 +1507,6 @@ class AppLocalizationsFr extends AppLocalizations { @override String get debugFrame_hexDump => 'Vidéo de Dump Hexadécimal :'; - @override - String get chat_pathManagement => 'Gestion des chemins'; - - @override - String get chat_ShowAllPaths => 'Afficher tous les chemins'; - - @override - String get chat_routingMode => 'Mode de routage'; - - @override - String get chat_autoUseSavedPath => 'Auto (utiliser le chemin sauvegardé)'; - - @override - String get chat_forceFloodMode => 'Mode tout le réseau forcé'; - - @override - String get chat_recentAckPaths => - 'Chemins ACK récents (touchez pour utiliser) :'; - - @override - String get chat_pathHistoryFull => - 'L\'historique du chemin est plein. Supprimez les entrées pour en ajouter de nouvelles.'; - - @override - String get chat_hopSingular => 'saut'; - - @override - String get chat_hopPlural => 'sauts'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1525,12 +1518,6 @@ class AppLocalizationsFr extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Succès'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Supprimer le chemin'; @@ -1538,53 +1525,144 @@ class AppLocalizationsFr extends AppLocalizations { String get chat_noPathHistoryYet => 'Aucune historique de parcours disponible.\nEnvoyez un message pour découvrir les parcours.'; - @override - String get chat_pathActions => 'Actions du chemin :'; - - @override - String get chat_setCustomPath => 'Définir un chemin personnalisé'; - - @override - String get chat_setCustomPathSubtitle => - 'Spécifier manuellement le chemin de routage'; - - @override - String get chat_clearPath => 'Effacer le chemin'; - - @override - String get chat_clearPathSubtitle => - 'Forcer la redécouverte lors de la prochaine envoi'; - @override String get chat_pathCleared => 'Le chemin est dégagé. Le prochain message redécouvrira le tracé.'; - @override - String get chat_floodModeSubtitle => - 'Désactive l\'apprentissage du chemin (à éviter). Utiliser le commutateur de routage dans la barre d\'application pour rebasculer en mode auto par la suite.'; - - @override - String get chat_floodModeEnabled => - 'Le mode envoi à tout le réseau est activé. Changer via l\'icône de routage dans la barre d\'outils.'; - @override String get chat_fullPath => 'Chemin complet'; @override - String get chat_pathDetailsNotAvailable => - 'Les détails du chemin ne sont pas encore disponibles. Essayez d\'envoyer un message pour rafraîchir.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Chemin défini : $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Sauvegardé localement. Connectez-vous pour synchroniser.'; @@ -2056,66 +2134,13 @@ class AppLocalizationsFr extends AppLocalizations { @override String get common_clear => 'Effacer'; - @override - String path_currentPath(String path) { - return 'Chemin actuel : $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Utiliser $count $_temp0 chemin'; - } - - @override - String get path_enterCustomPath => 'Entrer un chemin personnalisé'; - @override String get path_currentPathLabel => 'Chemin actuel'; - @override - String get path_hexPrefixInstructions => - 'Entrez les préfixes hexadécimaux de 2 caractères pour chaque saut, séparés par des virgules.'; - - @override - String get path_hexPrefixExample => - 'Exemple : A1,F2,3C (chaque nœud utilise le premier octet de sa clé publique).'; - - @override - String get path_labelHexPrefixes => 'Préfixes hexadécimaux'; - - @override - String get path_helperMaxHops => - 'Max 64 sauts. Chaque préfixe fait 2 caractères hexadécimaux (1 octet)'; - - @override - String get path_selectFromContacts => 'Sélectionner à partir des contacts :'; - @override String get path_noRepeatersFound => 'Aucun répéteur ou room server n\'a été trouvé.'; - @override - String get path_customPathsRequire => - 'Les chemins personnalisés nécessitent des sauts intermédiaires qui peuvent transmettre des messages.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Préfixes hexadécimaux invalides : $prefixes'; - } - - @override - String get path_tooLong => - 'Le chemin est trop long. Maximum 64 sauts autorisés.'; - - @override - String get path_setPath => 'Définir le chemin'; - @override String get repeater_management => 'Gestion des répéteurs'; @@ -2181,16 +2206,6 @@ class AppLocalizationsFr extends AppLocalizations { @override String get repeater_routingMode => 'Mode de routage'; - @override - String get repeater_autoUseSavedPath => - 'Auto (utiliser le chemin sauvegardé)'; - - @override - String get repeater_forceFloodMode => 'Mode tout le réseau forcé'; - - @override - String get repeater_pathManagement => 'Gestion des chemins'; - @override String get repeater_refresh => 'Rafraîchir'; @@ -4471,4 +4486,28 @@ class AppLocalizationsFr extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 58f263b3..f58b8afc 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -92,6 +92,24 @@ class AppLocalizationsHu extends AppLocalizations { @override String get common_disable => 'Leteteszt'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Újraindítás'; @@ -795,11 +813,6 @@ class AppLocalizationsHu extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'A próbálkozások száma, mielőtt egy üzenetet hibásnak jelölünk.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Akku'; @@ -1003,6 +1016,15 @@ class AppLocalizationsHu extends AppLocalizations { @override String get contacts_newGroup => 'Új csoport'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Csoport neve'; @@ -1488,36 +1510,6 @@ class AppLocalizationsHu extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex-dump:'; - @override - String get chat_pathManagement => 'Útvonal-kezelés'; - - @override - String get chat_ShowAllPaths => 'Mutasson meg minden útvonalat'; - - @override - String get chat_routingMode => 'Útvonal-kezelési mód'; - - @override - String get chat_autoUseSavedPath => - 'Automatikus (az eddigi útvonal használata)'; - - @override - String get chat_forceFloodMode => 'Erőforrás-alapú áramlás mód'; - - @override - String get chat_recentAckPaths => - 'Legutóbbi használt útvonalak (gombra kattintva):'; - - @override - String get chat_pathHistoryFull => - 'Az előző lépések listája teljes. Törölj ki a bejegyzéseket, hogy újokat hozzáadhatsd.'; - - @override - String get chat_hopSingular => 'ugor'; - - @override - String get chat_hopPlural => 'babér'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1529,12 +1521,6 @@ class AppLocalizationsHu extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'sikerek'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Törölje a elérési útvonalat'; @@ -1542,52 +1528,144 @@ class AppLocalizationsHu extends AppLocalizations { String get chat_noPathHistoryYet => 'Még nincs útvonal-történet.\nKüldjön egy üzenetet, hogy megtudja a lehetséges útvonalakat.'; - @override - String get chat_pathActions => 'Céltúrások:'; - - @override - String get chat_setCustomPath => 'Beállítsd a saját útvonalat'; - - @override - String get chat_setCustomPathSubtitle => 'Kézzel megadott útvonal'; - - @override - String get chat_clearPath => 'Egyértelmű út'; - - @override - String get chat_clearPathSubtitle => - 'A parancs új küldéskor újra kell aktivizálnia.'; - @override String get chat_pathCleared => 'Útvonal cleared. A következő üzenet újból feltérképezheti az útvonalat.'; - @override - String get chat_floodModeSubtitle => - 'Használja a \"útvonal\" kapcsolót az alkalmazás sávjában.'; - - @override - String get chat_floodModeEnabled => - 'Árvízvédelmi mód bekapcsolva. A visszaállítás a alkalmazásban található útvonal ikon segítségével.'; - @override String get chat_fullPath => 'Teljes elérési út'; @override - String get chat_pathDetailsNotAvailable => - 'Az útvonal részletei még nem elérhetők. Próbálja meg küldeni egy üzenetet, hogy frissítse az információkat.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Helyileg mentve. Kapcsolódjon a szinkronizáláshoz.'; @@ -2058,67 +2136,13 @@ class AppLocalizationsHu extends AppLocalizations { @override String get common_clear => 'Egyértelmű'; - @override - String path_currentPath(String path) { - return 'Jelenlegi útvonal: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'ugrások', - one: 'ugrás', - ); - return '$count $_temp0 útvonal használata'; - } - - @override - String get path_enterCustomPath => 'Adja meg a saját elérési útvonalat'; - @override String get path_currentPathLabel => 'Jelenlegi útvonal'; - @override - String get path_hexPrefixInstructions => - 'Adja meg a 2 karakteres hexadecimális előtagokat minden lépéshez, tagolva kommával.'; - - @override - String get path_hexPrefixExample => - 'Példa: A1, F2, 3C (minden csomó az első részét használja a nyilvános kulcsából)'; - - @override - String get path_labelHexPrefixes => 'Út (hex-prefixek)'; - - @override - String get path_helperMaxHops => - 'A maximális hossz 64 karakter. Minden előző rész 2 hatos számjegyből áll (1 bájt).'; - - @override - String get path_selectFromContacts => - 'Válasszon a kontaktlista elembek közül:'; - @override String get path_noRepeatersFound => 'Nincs megtalálva semmilyen ismétlődő vagy helyiség-szolgáltató szervert.'; - @override - String get path_customPathsRequire => - 'Az egyedi útvonalaknak szükségük van átjáró pontokra, amelyek képesek üzeneteket továbbítani.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Érvénytelen hexadecimális előtagok: $prefixes'; - } - - @override - String get path_tooLong => - 'Az út túl hosszú. A maximális engedélyezett lépések száma 64.'; - - @override - String get path_setPath => 'Útvonal meghatározása'; - @override String get repeater_management => 'Adatkapcsolás kezelése'; @@ -2184,16 +2208,6 @@ class AppLocalizationsHu extends AppLocalizations { @override String get repeater_routingMode => 'Útvonal-kezelési mód'; - @override - String get repeater_autoUseSavedPath => - 'Automatikus (az eddigi útvonal használata)'; - - @override - String get repeater_forceFloodMode => 'Erőforrás-alapú áramlás mód'; - - @override - String get repeater_pathManagement => 'Útvonal-kezelés'; - @override String get repeater_refresh => 'Újrafriszol'; @@ -4458,4 +4472,28 @@ class AppLocalizationsHu extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index a0149bd0..7a7043bb 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -92,6 +92,24 @@ class AppLocalizationsIt extends AppLocalizations { @override String get common_disable => 'Disattivare'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Riavvia'; @@ -794,11 +812,6 @@ class AppLocalizationsIt extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Numero di tentativi di riprova prima di considerare un messaggio come fallito.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batteria'; @@ -999,6 +1012,15 @@ class AppLocalizationsIt extends AppLocalizations { @override String get contacts_newGroup => 'Nuovo Gruppo'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Nome gruppo'; @@ -1481,34 +1503,6 @@ class AppLocalizationsIt extends AppLocalizations { @override String get debugFrame_hexDump => 'Dumpa Esadecimale:'; - @override - String get chat_pathManagement => 'Gestione Percorsi'; - - @override - String get chat_ShowAllPaths => 'Mostra tutti i percorsi'; - - @override - String get chat_routingMode => 'Modalità di routing'; - - @override - String get chat_autoUseSavedPath => 'Utilizza il percorso salvato'; - - @override - String get chat_forceFloodMode => 'Modalità Inondamento Forzato'; - - @override - String get chat_recentAckPaths => 'Percorsi ACK Recenti (tocca per usare):'; - - @override - String get chat_pathHistoryFull => - 'La cronologia del percorso è piena. Rimuovi gli elementi per aggiungere nuovi.'; - - @override - String get chat_hopSingular => 'salta'; - - @override - String get chat_hopPlural => 'salta'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1520,12 +1514,6 @@ class AppLocalizationsIt extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'successi'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Rimuovi percorso'; @@ -1533,53 +1521,144 @@ class AppLocalizationsIt extends AppLocalizations { String get chat_noPathHistoryYet => 'Non c\'è ancora una cronologia del percorso.\nInvia un messaggio per scoprire i percorsi.'; - @override - String get chat_pathActions => 'Azioni Percorso:'; - - @override - String get chat_setCustomPath => 'Imposta Percorso Personalizzato'; - - @override - String get chat_setCustomPathSubtitle => - 'Specifica manualmente il percorso di routing'; - - @override - String get chat_clearPath => 'Cancella Percorso'; - - @override - String get chat_clearPathSubtitle => - 'Riprova la scoperta alla prossima invio'; - @override String get chat_pathCleared => 'Percorso sgomberato. Il prossimo messaggio riidentifierà il percorso.'; - @override - String get chat_floodModeSubtitle => - 'Utilizza l\'interruttore di routing nella barra delle applicazioni'; - - @override - String get chat_floodModeEnabled => - 'Modalità alluvione abilitata. Disattivala tramite l\'icona di routing nella barra in alto.'; - @override String get chat_fullPath => 'Percorso Completo'; @override - String get chat_pathDetailsNotAvailable => - 'I dettagli del percorso non sono ancora disponibili. Prova a inviare un messaggio per ricaricare.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Percorso impostato: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Salvatato localmente. Connetti per sincronizzare.'; @@ -2047,66 +2126,13 @@ class AppLocalizationsIt extends AppLocalizations { @override String get common_clear => 'Cancella'; - @override - String path_currentPath(String path) { - return 'Percorso corrente: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Utilizzare $count $_temp0 percorso'; - } - - @override - String get path_enterCustomPath => 'Inserisci percorso personalizzato'; - @override String get path_currentPathLabel => 'Percorso corrente'; - @override - String get path_hexPrefixInstructions => - 'Inserire i prefissi esadecimali a 2 caratteri per ogni salto, separati da virgole.'; - - @override - String get path_hexPrefixExample => - 'Esempio: A1,F2,3C (ogni nodo utilizza il primo byte della sua chiave pubblica)'; - - @override - String get path_labelHexPrefixes => 'Prefisso esadecimale (percorso)'; - - @override - String get path_helperMaxHops => - 'Massimo 64 salti. Ogni prefisso è composto da 2 caratteri esadecimali (1 byte)'; - - @override - String get path_selectFromContacts => 'Seleziona da contatti:'; - @override String get path_noRepeatersFound => 'Non sono stati trovati ripetitori o server di stanza.'; - @override - String get path_customPathsRequire => - 'I percorsi personalizzati richiedono salti intermedi che possono inoltrare messaggi.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Prefissi esadecimali non validi: $prefixes'; - } - - @override - String get path_tooLong => - 'Il percorso è troppo lungo. Massimo 64 salti consentiti.'; - - @override - String get path_setPath => 'Imposta Percorso'; - @override String get repeater_management => 'Gestione Ripetitori'; @@ -2173,15 +2199,6 @@ class AppLocalizationsIt extends AppLocalizations { @override String get repeater_routingMode => 'Modalità di routing'; - @override - String get repeater_autoUseSavedPath => 'Percorso salvato automatico'; - - @override - String get repeater_forceFloodMode => 'Modalità Inondamento Forzato'; - - @override - String get repeater_pathManagement => 'Gestione dei percorsi'; - @override String get repeater_refresh => 'Aggiorna'; @@ -4447,4 +4464,28 @@ class AppLocalizationsIt extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 12396086..ee79c6ee 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -92,6 +92,24 @@ class AppLocalizationsJa extends AppLocalizations { @override String get common_disable => '無効化する'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => '再起動'; @@ -559,7 +577,7 @@ class AppLocalizationsJa extends AppLocalizations { String get settings_txPowerInvalid => '無効な送信電力 (0-22 dBm)'; @override - String get settings_clientRepeat => 'オフグリッド(電力網から孤立した状態)の繰り返し'; + String get settings_clientRepeat => 'オフグリッドリピータ'; @override String get settings_clientRepeatSubtitle => @@ -709,7 +727,7 @@ class AppLocalizationsJa extends AppLocalizations { String get appSettings_autoRouteRotation => '自動ルートの切り替え'; @override - String get appSettings_autoRouteRotationSubtitle => '最適なルートと、洪水モードを切り替える'; + String get appSettings_autoRouteRotationSubtitle => '最適なルートと、フラッドモードを切り替える'; @override String get appSettings_autoRouteRotationEnabled => '自動ルートの切り替え機能が有効になっています'; @@ -751,11 +769,6 @@ class AppLocalizationsJa extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'メッセージを「失敗」とマークするまでの、再試行回数'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'バッテリー'; @@ -786,7 +799,7 @@ class AppLocalizationsJa extends AppLocalizations { String get appSettings_showRepeaters => '繰り返し再生機能'; @override - String get appSettings_showRepeatersSubtitle => '地図上にリピーターノードを表示する'; + String get appSettings_showRepeatersSubtitle => '地図上にリピータノードを表示する'; @override String get appSettings_showChatNodes => 'チャットノードの表示'; @@ -925,7 +938,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get contacts_manageRepeater => 'リピーターの管理'; + String get contacts_manageRepeater => 'リピータの管理'; @override String get contacts_manageRoom => 'ルームサーバーの管理'; @@ -950,6 +963,15 @@ class AppLocalizationsJa extends AppLocalizations { @override String get contacts_newGroup => '新しいグループ'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'グループ名'; @@ -1416,33 +1438,6 @@ class AppLocalizationsJa extends AppLocalizations { @override String get debugFrame_hexDump => 'ヘックスダンプ:'; - @override - String get chat_pathManagement => '経路管理'; - - @override - String get chat_ShowAllPaths => 'すべての経路を表示'; - - @override - String get chat_routingMode => 'ルーティングモード'; - - @override - String get chat_autoUseSavedPath => '自動 (保存されたパスを使用)'; - - @override - String get chat_forceFloodMode => '強制的に洪水モードを起動'; - - @override - String get chat_recentAckPaths => '最近使用したACKパス(タップして使用):'; - - @override - String get chat_pathHistoryFull => 'パスの履歴は完全です。エントリを削除して、新しいものを追加できます。'; - - @override - String get chat_hopSingular => 'ジャンプ'; - - @override - String get chat_hopPlural => 'ホップ'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1454,61 +1449,149 @@ class AppLocalizationsJa extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => '成功事例'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'パスを削除する'; @override String get chat_noPathHistoryYet => 'まだ履歴はありません。\nパスを特定するためにメッセージを送信してください。'; - @override - String get chat_pathActions => 'パスの操作:'; - - @override - String get chat_setCustomPath => 'カスタムパスを設定'; - - @override - String get chat_setCustomPathSubtitle => '手動で経路を指定する'; - - @override - String get chat_clearPath => '明確な道'; - - @override - String get chat_clearPathSubtitle => '次回送信時に、以前の情報を再取得する'; - @override String get chat_pathCleared => '経路が確保されました。次のメッセージでルートを再確認します。'; - @override - String get chat_floodModeSubtitle => 'アプリのバーにあるルーティング切り替え機能を使用する'; - - @override - String get chat_floodModeEnabled => - '洪水モードが有効になっています。アプリのメニューバーにあるルートアイコンを使用して、モードを切り替えることができます。'; - @override String get chat_fullPath => 'フルパス'; @override - String get chat_pathDetailsNotAvailable => - '経路の詳細については、まだ情報がありません。「リフレッシュ」ボタンを押して、再度お試しください。'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'ローカルで保存。同期のために接続する。'; @@ -1531,7 +1614,7 @@ class AppLocalizationsJa extends AppLocalizations { String get chat_compressOutgoingMessages => '送信されるメッセージを圧縮する'; @override - String get chat_floodForced => '洪水(強制的な)'; + String get chat_floodForced => 'フラッド(強制的な)'; @override String get chat_directForced => '直接的な(強制的な)'; @@ -1542,7 +1625,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get chat_floodAuto => '洪水 (自動)'; + String get chat_floodAuto => 'フラッド (自動)'; @override String get chat_direct => '直接'; @@ -1607,7 +1690,7 @@ class AppLocalizationsJa extends AppLocalizations { String get map_chat => 'チャット'; @override - String get map_repeater => '繰り返し送信装置'; + String get map_repeater => 'リピータ'; @override String get map_room => '部屋'; @@ -1702,13 +1785,13 @@ class AppLocalizationsJa extends AppLocalizations { String get map_chatNodes => 'チャットノード'; @override - String get map_repeaters => '繰り返し送信装置'; + String get map_repeaters => 'リピータ'; @override String get map_otherNodes => 'その他のノード'; @override - String get map_showOverlaps => 'リピーターキーの重複'; + String get map_showOverlaps => 'リピータキーの重複'; @override String get map_keyPrefix => '主要なプレフィックス'; @@ -1747,7 +1830,7 @@ class AppLocalizationsJa extends AppLocalizations { String get map_joinRoom => '部屋に参加する'; @override - String get map_manageRepeater => 'リピーターの管理'; + String get map_manageRepeater => 'リピータの管理'; @override String get map_tapToAdd => 'ノードをクリックして、パスに追加します。'; @@ -1920,7 +2003,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get login_repeaterDescription => - '設定やステータスにアクセスするために、リピーターのパスワードを入力してください。'; + '設定やステータスにアクセスするために、リピータのパスワードを入力してください。'; @override String get login_roomDescription => '設定やステータスへのアクセスには、部屋のパスワードを入力してください。'; @@ -1935,7 +2018,7 @@ class AppLocalizationsJa extends AppLocalizations { String get login_autoUseSavedPath => '自動 (保存されたパスを使用)'; @override - String get login_forceFloodMode => '強制的に洪水モードを起動'; + String get login_forceFloodMode => '強制的にフラッドモードを起動'; @override String get login_managePaths => 'パスの管理'; @@ -1963,70 +2046,20 @@ class AppLocalizationsJa extends AppLocalizations { @override String get common_clear => '明確'; - @override - String path_currentPath(String path) { - return '現在のパス: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'ホップ', - one: 'ホップ', - ); - return '$count $_temp0のパスを使用'; - } - - @override - String get path_enterCustomPath => 'カスタムパスを入力'; - @override String get path_currentPathLabel => '現在の経路'; - @override - String get path_hexPrefixInstructions => - '各ホップに対して、2文字の16進数プレフィックスをカンマで区切って入力してください。'; - - @override - String get path_hexPrefixExample => '例:A1, F2, 3C (各ノードは、自身の公開鍵の最初のバイトを使用)'; - - @override - String get path_labelHexPrefixes => 'パス (ヘックスプレフィックス)'; - - @override - String get path_helperMaxHops => - '最大64個のホップ。各プレフィックスは2つの16進数文字(1バイト)で構成されています。'; - - @override - String get path_selectFromContacts => 'または、連絡先リストから選択してください:'; - @override String get path_noRepeatersFound => '繰り返し機能やルームサーバーは見つかりませんでした。'; @override - String get path_customPathsRequire => 'カスタムパスには、メッセージを中継できる中間地点が必要です。'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return '無効な16進数プレフィックス: $prefixes'; - } - - @override - String get path_tooLong => '経路が長すぎる。最大64回のジャンプのみ許可。'; - - @override - String get path_setPath => 'パスを設定'; - - @override - String get repeater_management => 'リピーター管理'; + String get repeater_management => 'リピータ管理'; @override String get room_management => 'ルームサーバーの管理'; @override - String get repeater_guest => '繰り返し送信に関する情報'; + String get repeater_guest => 'リピータに関する情報'; @override String get room_guest => 'ルームサーバーに関する情報'; @@ -2041,7 +2074,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_status => 'ステータス'; @override - String get repeater_statusSubtitle => 'リピーターの状態、統計情報、および隣接するネットワークの情報を表示する'; + String get repeater_statusSubtitle => 'リピータの状態、統計情報、および隣接するネットワークの情報を表示する'; @override String get repeater_telemetry => 'テレメトリー'; @@ -2053,7 +2086,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cli => 'CLI(コマンドラインインターフェース)'; @override - String get repeater_cliSubtitle => 'リピーターへのコマンドを送信する'; + String get repeater_cliSubtitle => 'リピータへのコマンドを送信する'; @override String get repeater_neighbors => '近隣住民'; @@ -2065,7 +2098,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_settings => '設定'; @override - String get repeater_settingsSubtitle => 'リピーターのパラメータを設定する'; + String get repeater_settingsSubtitle => 'リピータのパラメータを設定する'; @override String get repeater_clockSyncAfterLogin => 'ログイン後、時計の時刻を同期する'; @@ -2080,15 +2113,6 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_routingMode => 'ルーティングモード'; - @override - String get repeater_autoUseSavedPath => '自動 (保存されたパスを使用)'; - - @override - String get repeater_forceFloodMode => '強制的に洪水モードを起動'; - - @override - String get repeater_pathManagement => '経路管理'; - @override String get repeater_refresh => 'リフレッシュ'; @@ -2163,12 +2187,12 @@ class AppLocalizationsJa extends AppLocalizations { @override String repeater_packetTxTotal(int total, String flood, String direct) { - return '合計: $total, 洪水: $flood, 直接: $direct'; + return '合計: $total, フラッド: $flood, 直接: $direct'; } @override String repeater_packetRxTotal(int total, String flood, String direct) { - return '合計: $total, 洪水: $flood, 直接: $direct'; + return '合計: $total, フラッド: $flood, 直接: $direct'; } @override @@ -2182,16 +2206,16 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get repeater_settingsTitle => 'リピーター設定'; + String get repeater_settingsTitle => 'リピータ設定'; @override String get repeater_basicSettings => '基本設定'; @override - String get repeater_repeaterName => '送信装置名'; + String get repeater_repeaterName => 'リピータ名'; @override - String get repeater_repeaterNameHelper => 'このリピーターの名前'; + String get repeater_repeaterNameHelper => 'このリピータの名前'; @override String get repeater_adminPassword => '管理者パスワード'; @@ -2251,7 +2275,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_packetForwarding => 'パケット転送'; @override - String get repeater_packetForwardingSubtitle => 'リピーターがパケットを転送できるように設定する'; + String get repeater_packetForwardingSubtitle => 'リピータがパケットを転送できるように設定する'; @override String get repeater_guestAccess => 'ゲストへのアクセス'; @@ -2277,7 +2301,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get repeater_floodAdvertInterval => '洪水に関する広告の表示間隔'; + String get repeater_floodAdvertInterval => 'フラッドに関する広告の表示間隔'; @override String repeater_floodAdvertIntervalHours(int hours) { @@ -2291,13 +2315,13 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_dangerZone => '危険区域'; @override - String get repeater_rebootRepeater => 'リピーターを再起動する'; + String get repeater_rebootRepeater => 'リピータを再起動する'; @override - String get repeater_rebootRepeaterSubtitle => 'リピーターデバイスを再起動する'; + String get repeater_rebootRepeaterSubtitle => 'リピータデバイスを再起動する'; @override - String get repeater_rebootRepeaterConfirm => '本当にこのリピーターを再起動したいですか?'; + String get repeater_rebootRepeaterConfirm => '本当にこのリピータを再起動したいですか?'; @override String get repeater_regenerateIdentityKey => 'IDキーの再生成'; @@ -2307,17 +2331,17 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_regenerateIdentityKeyConfirm => - 'これにより、リピーターには新しい識別情報が割り当てられます。続行しますか?'; + 'これにより、リピータには新しい識別情報が割り当てられます。続行しますか?'; @override String get repeater_eraseFileSystem => 'ファイルシステムを削除する'; @override - String get repeater_eraseFileSystemSubtitle => 'リピーターファイルシステムをフォーマットする'; + String get repeater_eraseFileSystemSubtitle => 'リピータファイルシステムをフォーマットする'; @override String get repeater_eraseFileSystemConfirm => - '警告:この操作により、リピーター内のすべてのデータが消去されます。この操作は元に戻すことができません!'; + '警告:この操作により、リピータ内のすべてのデータが消去されます。この操作は元に戻すことができません!'; @override String get repeater_eraseSerialOnly => 'Erase機能は、シリアルコンソール経由でのみ利用可能です。'; @@ -2363,7 +2387,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_loopDetect => 'ループ検出'; @override - String get repeater_loopDetectHelper => 'ルーティングループに見えるような、洪水パケットを送信する'; + String get repeater_loopDetectHelper => 'ルーティングループを検知する'; @override String get repeater_loopDetectOff => 'オフ'; @@ -2392,7 +2416,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_ownerInfo => '事業者の情報'; @override - String get repeater_ownerInfoHelper => 'このリピーターに関する公開メタデータ'; + String get repeater_ownerInfoHelper => 'このリピータに関する公開メタデータ'; @override String get repeater_refreshOwnerInfo => 'オペレーター情報の更新'; @@ -2401,7 +2425,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_floodMax => '最大ホップ数'; @override - String get repeater_floodMaxHelper => '洪水パケットが移動できる最大ホップ数 (0-64)'; + String get repeater_floodMaxHelper => 'フラッドパケットが移動できる最大ホップ数 (0-64)'; @override String get repeater_advancedSettings => '高度な'; @@ -2414,14 +2438,14 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'このリピーターのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。'; + 'このリピータのIDをフローパス/ループ検出タグにエンコードするために使用されるバイト数。 0=1バイト (256個のID、最大64ホップ)、1=2バイト (65,000個のID、最大32ホップ)、2=3バイト (160万個のID、最大21ホップ)。 v1.13およびそれ以前のファームウェアでは、マルチバイトパスがサポートされていません。 v1.14以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。'; @override String get repeater_txDelay => 'フロイド・TXでの遅延'; @override String get repeater_txDelayHelper => - '洪水時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。'; + 'フラッド時の交通量に対応するための再送信間隔を、パケットの通信時間を掛けた値(0~2、デフォルト0.5)で設定します。値を大きくすると衝突が減りますが、通信速度が遅くなります。'; @override String get repeater_directTxDelay => '直接的なTX遅延'; @@ -2448,16 +2472,16 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_actionsTitle => '行動'; @override - String get repeater_sendAdvert => '洪水に関する広告を送信'; + String get repeater_sendAdvert => 'フラッドに関する広告を送信'; @override - String get repeater_sendAdvertSubtitle => 'ネットワークを通じて、洪水に関する広告を放送する'; + String get repeater_sendAdvertSubtitle => 'ネットワークを通じて、フラッドに関する広告を放送する'; @override String get repeater_sendAdvertZeroHop => 'ゼロホップ形式の広告を送信する'; @override - String get repeater_sendAdvertZeroHopSubtitle => 'ワンホップでの広告放送(中継なし)'; + String get repeater_sendAdvertZeroHopSubtitle => 'ワンホップでの広告放送(リピータなし)'; @override String get repeater_clockSync => '現在、時刻を同期する'; @@ -2477,7 +2501,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_settingsSavedRebootNeeded => - '設定を保存しました — リピーターを再起動して適用してください'; + '設定を保存しました — リピータを再起動して適用してください'; @override String repeater_settingsPartialFailure(String failures) { @@ -2518,7 +2542,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get repeater_cliTitle => 'リピーターのコマンドラインインターフェース'; + String get repeater_cliTitle => 'リピータのコマンドラインインターフェース'; @override String get repeater_debugNextCommand => '次のコマンドのデバッグ'; @@ -2609,7 +2633,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpSetTx => 'LoRaの送信電力をdBmで設定します。(設定変更後、再起動が必要です)'; @override - String get repeater_cliHelpSetRepeat => 'このノードに対するリピーターの役割を有効化または無効化します。'; + String get repeater_cliHelpSetRepeat => 'このノードに対するリピータの役割を有効化または無効化します。'; @override String get repeater_cliHelpSetAllowReadOnly => @@ -2617,7 +2641,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpSetFloodMax => - 'インバウンドフラッパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。'; + 'インバウンドフラッドパケットの最大ホップ数を設定します(最大値を超えた場合、パケットは転送されません)。'; @override String get repeater_cliHelpSetIntThresh => @@ -2636,7 +2660,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpSetFloodAdvertInterval => - '洪水広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。'; + 'フラッド広告の送信間隔を時間単位で設定します。0に設定すると、送信を停止します。'; @override String get repeater_cliHelpSetGuestPassword => @@ -2710,7 +2734,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpNeighbors => - 'ゼロホップ広告を通じて受信した他のリピーターノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。'; + 'ゼロホップ広告を通じて受信した他のリピータノードの一覧を表示します。各行は、IDプレフィックス(16進数)、タイムスタンプ、SNR(シグナル強度)の情報を4つ含みます。'; @override String get repeater_cliHelpNeighborRemove => @@ -2718,7 +2742,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpRegion => - '(特定のシリーズのみ)定義されたすべての地域と、現在の洪水許可状況を一覧表示します。'; + '(特定のシリーズのみ)定義されたすべての地域と、現在のフラッド許可状況を一覧表示します。'; @override String get repeater_cliHelpRegionLoad => @@ -2737,7 +2761,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpRegionAllowf => - '指定された領域に対して、「洪水」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)'; + '指定された領域に対して、「フラッド」アクセス許可を設定します。 (グローバル/従来のスコープには「*」を使用)'; @override String get repeater_cliHelpRegionDenyf => @@ -2793,7 +2817,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_logging => 'ログ記録'; @override - String get repeater_neighborsRepeaterOnly => '近隣住民(リピーターのみ)'; + String get repeater_neighborsRepeaterOnly => '近隣住民(リピータのみ)'; @override String get repeater_regionManagementRepeaterOnly => '地域管理(ブロードキャスト用のみ)'; @@ -2838,7 +2862,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpDiscoverNeighbors => - '近隣のノードに対して、ノードの探索リクエストを送信します。(中継機能のみ)'; + '近隣のノードに対して、ノードの探索リクエストを送信します。(リピータ機能のみ)'; @override String get repeater_cliHelpPowersaving => '省電力モードがオンになっているかどうかを表示します。'; @@ -2887,7 +2911,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpGetName => '設定されたノードの名前を表示します。'; @override - String get repeater_cliHelpGetRole => 'ファームウェアの役割(リピーター、ルームサーバーなど)を表示します。'; + String get repeater_cliHelpGetRole => 'ファームウェアの役割(リピータ、ルームサーバーなど)を表示します。'; @override String get repeater_cliHelpGetPublicKey => 'デバイスの公開鍵を表示します。'; @@ -2897,7 +2921,7 @@ class AppLocalizationsJa extends AppLocalizations { '(シリアル番号のみ)デバイスのプライベートキーを表示します。機密情報として扱ってください。'; @override - String get repeater_cliHelpGetRepeat => 'パケット転送(リピーター機能)が有効になっているかどうかを表示します。'; + String get repeater_cliHelpGetRepeat => 'パケット転送(リピータ機能)が有効になっているかどうかを表示します。'; @override String get repeater_cliHelpGetTx => '現在のTX(送信)電力のdBm値を表示します。'; @@ -2936,7 +2960,7 @@ class AppLocalizationsJa extends AppLocalizations { @override String get repeater_cliHelpGetFloodAdvertInterval => - '洪水に関する広告の放送時間を時間単位で表示します。'; + 'フラッドに関する広告の放送時間を時間単位で表示します。'; @override String get repeater_cliHelpGetGuestPassword => '設定されたゲストパスワードを表示します。'; @@ -2951,13 +2975,13 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpGetRxDelay => 'rxdelay の基本値を表示します。'; @override - String get repeater_cliHelpGetTxDelay => '洪水モードにおける送信遅延の要因を示します。'; + String get repeater_cliHelpGetTxDelay => 'フラッドモードにおける送信遅延の要因を示します。'; @override String get repeater_cliHelpGetDirectTxDelay => 'ダイレクトモードの遅延要素を示します。'; @override - String get repeater_cliHelpGetFloodMax => '最大浸水範囲の回数を表示します。'; + String get repeater_cliHelpGetFloodMax => 'フラッドパケットの最大ホップ数を表示します。'; @override String get repeater_cliHelpGetOwnerInfo => '所有者の連絡先情報を表示します。'; @@ -2969,7 +2993,7 @@ class AppLocalizationsJa extends AppLocalizations { String get repeater_cliHelpGetLoopDetect => 'ループ検出の感度を示す。'; @override - String get repeater_cliHelpGetAcl => '(シリアルのみ)リピーター上のアクセス制御設定を一覧表示します。'; + String get repeater_cliHelpGetAcl => '(シリアルのみ)リピータ上のアクセス制御設定を一覧表示します。'; @override String get repeater_cliHelpGetBridgeEnabled => '橋が有効になっているかどうかを表示します。'; @@ -3032,10 +3056,10 @@ class AppLocalizationsJa extends AppLocalizations { 'デフォルトの地域範囲を設定します。「」を使用すると、設定をリセットできます。'; @override - String get repeater_cliHelpRegionListAllowed => '洪水時の通行が許可されている地域の一覧'; + String get repeater_cliHelpRegionListAllowed => 'フラッド時の通行が許可されている地域の一覧'; @override - String get repeater_cliHelpRegionListDenied => '洪水による交通を遮断している地域の一覧'; + String get repeater_cliHelpRegionListDenied => 'フラッドによる交通を遮断している地域の一覧'; @override String get repeater_cliHelpStatsPackets => '(シリアルのみ)パケットレベルの統計情報を表示します。'; @@ -3245,7 +3269,7 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get neighbors_repeatersNeighbors => '繰り返し送信する、近隣'; + String get neighbors_repeatersNeighbors => '近隣のリピータ'; @override String get neighbors_noData => '近隣のデータは利用できません。'; @@ -3270,7 +3294,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_otherObservedPaths => '観察されたその他の経路'; @override - String get channelPath_repeaterHops => 'ホップの繰り返し'; + String get channelPath_repeaterHops => 'リピータホップ'; @override String get channelPath_noHopDetails => 'このパッケージに関する詳細な情報は提供されていません。'; @@ -3285,7 +3309,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_timeLabel => '時間'; @override - String get channelPath_repeatsLabel => '繰り返し'; + String get channelPath_repeatsLabel => 'リピータ'; @override String channelPath_pathLabel(int index) { @@ -3317,7 +3341,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_unknownPath => '不明'; @override - String get channelPath_floodPath => '洪水'; + String get channelPath_floodPath => 'フラッド'; @override String get channelPath_directPath => '直接'; @@ -3336,7 +3360,7 @@ class AppLocalizationsJa extends AppLocalizations { String get channelPath_mapTitle => '経路図'; @override - String get channelPath_noRepeaterLocations => 'この経路には、中継装置の設置場所がありません。'; + String get channelPath_noRepeaterLocations => 'この経路にリピータの位置情報はありません。'; @override String channelPath_primaryPath(int index) { @@ -3556,7 +3580,7 @@ class AppLocalizationsJa extends AppLocalizations { String get listFilter_users => '利用者'; @override - String get listFilter_repeaters => '繰り返し送信装置'; + String get listFilter_repeaters => 'リピータ'; @override String get listFilter_roomServers => 'ルーム用サーバー'; @@ -3756,10 +3780,10 @@ class AppLocalizationsJa extends AppLocalizations { String get contacts_ping => 'パング'; @override - String get contacts_repeaterPathTrace => 'リピーターまでの経路を追跡する'; + String get contacts_repeaterPathTrace => 'リピータまでの経路を追跡する'; @override - String get contacts_repeaterPing => 'PING 繰り返し'; + String get contacts_repeaterPing => 'リピータにPING'; @override String get contacts_roomPathTrace => '部屋のサーバーへの経路を追跡する'; @@ -3791,7 +3815,7 @@ class AppLocalizationsJa extends AppLocalizations { String get contacts_zeroHopAdvert => 'ゼロホップ広告'; @override - String get contacts_floodAdvert => '洪水に関する広告'; + String get contacts_floodAdvert => 'フラッドに関する広告'; @override String get contacts_copyAdvertToClipboard => '広告をクリップボードにコピー'; @@ -3862,7 +3886,7 @@ class AppLocalizationsJa extends AppLocalizations { String get notification_receivedNewMessage => '新しいメッセージを受信'; @override - String get settings_gpxExportRepeaters => 'GPX へのエクスポート用リピーター/ルームサーバー'; + String get settings_gpxExportRepeaters => 'GPX へのエクスポート用リピータ/ルームサーバー'; @override String get settings_gpxExportRepeatersSubtitle => @@ -3895,7 +3919,7 @@ class AppLocalizationsJa extends AppLocalizations { String get settings_gpxExportError => 'エクスポート時にエラーが発生しました。'; @override - String get settings_gpxExportRepeatersRoom => '中継装置およびルームサーバーの設置場所'; + String get settings_gpxExportRepeatersRoom => 'リピータ/ルームサーバーの位置情報'; @override String get settings_gpxExportChat => '関連施設'; @@ -3911,7 +3935,7 @@ class AppLocalizationsJa extends AppLocalizations { 'meshcore-open GPX形式の地図データのエクスポート'; @override - String get snrIndicator_nearByRepeaters => '近くの電波中継局'; + String get snrIndicator_nearByRepeaters => '近くのリピータ'; @override String get snrIndicator_lastSeen => '最後に確認された場所'; @@ -3933,11 +3957,11 @@ class AppLocalizationsJa extends AppLocalizations { '利用者が自動的に発見したユーザーを追加できるようにする。'; @override - String get contactsSettings_autoAddRepeatersTitle => '自動で繰り返し設定'; + String get contactsSettings_autoAddRepeatersTitle => 'リピータを自動追加'; @override String get contactsSettings_autoAddRepeatersSubtitle => - '発見した中継局を、自動的に追加できるようにする。'; + '発見したリピータを、自動的に追加できるようにする。'; @override String get contactsSettings_autoAddRoomServersTitle => '自動でルームサーバーを追加'; @@ -4212,4 +4236,28 @@ class AppLocalizationsJa extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 606a33dc..64c5a6a6 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -92,6 +92,24 @@ class AppLocalizationsKo extends AppLocalizations { @override String get common_disable => '비활성화'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => '재부팅'; @@ -749,11 +767,6 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => '메시지를 실패로 처리하기 전 시도 횟수'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => '배터리'; @@ -945,6 +958,15 @@ class AppLocalizationsKo extends AppLocalizations { @override String get contacts_newGroup => '새로운 그룹'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => '그룹 이름'; @@ -1411,34 +1433,6 @@ class AppLocalizationsKo extends AppLocalizations { @override String get debugFrame_hexDump => '헥스 덤프:'; - @override - String get chat_pathManagement => '경로 관리'; - - @override - String get chat_ShowAllPaths => '모든 경로 표시'; - - @override - String get chat_routingMode => '라우팅 방식'; - - @override - String get chat_autoUseSavedPath => '자동 (저장된 경로 사용)'; - - @override - String get chat_forceFloodMode => '강수 모드 활성화'; - - @override - String get chat_recentAckPaths => '최근 사용한 ACK 경로 (사용하려면 탭):'; - - @override - String get chat_pathHistoryFull => - '이력 기록은 이미 가득 차 있습니다. 항목을 삭제하여 새로운 항목을 추가할 수 있습니다.'; - - @override - String get chat_hopSingular => '점프'; - - @override - String get chat_hopPlural => '홉'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1450,61 +1444,149 @@ class AppLocalizationsKo extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => '성공 사례'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => '경로 제거'; @override String get chat_noPathHistoryYet => '아직 경로 기록이 없습니다.\n경로를 찾기 위해 메시지를 보내세요.'; - @override - String get chat_pathActions => '경로 작업:'; - - @override - String get chat_setCustomPath => '사용자 지정 경로 설정'; - - @override - String get chat_setCustomPathSubtitle => '수동으로 경로를 지정'; - - @override - String get chat_clearPath => '명확한 길'; - - @override - String get chat_clearPathSubtitle => '다음 전송 시, 강제 재전송 설정'; - @override String get chat_pathCleared => '경로가 확보되었습니다. 다음 메시지는 경로를 다시 찾을 것입니다.'; - @override - String get chat_floodModeSubtitle => '앱 바에서 라우팅 스위치를 사용'; - - @override - String get chat_floodModeEnabled => - '홍수 모드 활성화됨. 앱 바의 경로 아이콘을 사용하여 다시 전환할 수 있습니다.'; - @override String get chat_fullPath => '전체 경로'; @override - String get chat_pathDetailsNotAvailable => - '경로 정보는 아직 제공되지 않습니다. 메시지를 보내어 다시 시도해 보세요.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Path set: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => '로컬에 저장. 동기화 연결'; @@ -1958,64 +2040,12 @@ class AppLocalizationsKo extends AppLocalizations { @override String get common_clear => '명확하게'; - @override - String path_currentPath(String path) { - return '현재 경로: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Using $count $_temp0 path'; - } - - @override - String get path_enterCustomPath => '사용자 지정 경로 입력'; - @override String get path_currentPathLabel => '현재 경로'; - @override - String get path_hexPrefixInstructions => - '각 단계에 대한 2자리 헥사데진 접두사를 쉼표로 구분하여 입력하세요.'; - - @override - String get path_hexPrefixExample => - '예시: A1, F2, 3C (각 노드는 자신의 공개 키의 첫 번째 바이트를 사용)'; - - @override - String get path_labelHexPrefixes => '경로 (헥스 접두사)'; - - @override - String get path_helperMaxHops => - '최대 64개의 홉. 각 접두사는 2개의 16진수 문자(1바이트)로 구성됩니다.'; - - @override - String get path_selectFromContacts => '또 연락처 목록에서 선택:'; - @override String get path_noRepeatersFound => '반복 장치 또는 서버는 찾을 수 없습니다.'; - @override - String get path_customPathsRequire => - '사용자 정의 경로에는 메시지를 전달할 수 있는 중간 경로가 필요합니다.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return '유효하지 않은 16진수 접두사: $prefixes'; - } - - @override - String get path_tooLong => '경로가 너무 길어. 최대 64개의 연결만 허용됩니다.'; - - @override - String get path_setPath => '경로 설정'; - @override String get repeater_management => '리피터 관리'; @@ -2077,15 +2107,6 @@ class AppLocalizationsKo extends AppLocalizations { @override String get repeater_routingMode => '라우팅 방식'; - @override - String get repeater_autoUseSavedPath => '자동 (저장된 경로 사용)'; - - @override - String get repeater_forceFloodMode => '강수 모드 활성화'; - - @override - String get repeater_pathManagement => '경로 관리'; - @override String get repeater_refresh => '새롭게'; @@ -4213,4 +4234,28 @@ class AppLocalizationsKo extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 90a446df..6f4d9fbb 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -92,6 +92,24 @@ class AppLocalizationsNl extends AppLocalizations { @override String get common_disable => 'Uitschakelen'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Herstarten'; @@ -786,11 +804,6 @@ class AppLocalizationsNl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Aantal pogingen om een bericht opnieuw te versturen voordat het als mislukt wordt gemarkeerd'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batterij'; @@ -991,6 +1004,15 @@ class AppLocalizationsNl extends AppLocalizations { @override String get contacts_newGroup => 'Nieuwe Groep'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Groepnaam'; @@ -1468,34 +1490,6 @@ class AppLocalizationsNl extends AppLocalizations { @override String get debugFrame_hexDump => 'Hex-dump:'; - @override - String get chat_pathManagement => 'Beheer van Paden'; - - @override - String get chat_ShowAllPaths => 'Toon alle paden'; - - @override - String get chat_routingMode => 'Routeerwijze'; - - @override - String get chat_autoUseSavedPath => 'Automatisch (gebruik opgeslagen pad)'; - - @override - String get chat_forceFloodMode => 'Dwing Floodsmodus'; - - @override - String get chat_recentAckPaths => 'Recente ACK Paden (tik om te gebruiken):'; - - @override - String get chat_pathHistoryFull => - 'De voorgeschiedenis is vol. Verwijder vermeldingen om er nieuwe aan toe te voegen.'; - - @override - String get chat_hopSingular => 'Hop'; - - @override - String get chat_hopPlural => 'hoppen'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1507,12 +1501,6 @@ class AppLocalizationsNl extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Succesvol'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Pad verwijderen'; @@ -1520,52 +1508,144 @@ class AppLocalizationsNl extends AppLocalizations { String get chat_noPathHistoryYet => 'Geen geschiedenis van paden nog beschikbaar.\nVerzend een bericht om paden te ontdekken.'; - @override - String get chat_pathActions => 'Padacties:'; - - @override - String get chat_setCustomPath => 'Stel aangepaste pad in'; - - @override - String get chat_setCustomPathSubtitle => 'Handmatig routepad specificeren'; - - @override - String get chat_clearPath => 'Duidelijke Pad'; - - @override - String get chat_clearPathSubtitle => - 'Dwing herontdekking bij volgende verzending'; - @override String get chat_pathCleared => 'Pad is vrijgegeven. Volgende bericht herontdekt route.'; - @override - String get chat_floodModeSubtitle => - 'Gebruik de route-schakelaar in de app-balk'; - - @override - String get chat_floodModeEnabled => - 'Floodmodus is ingeschakeld. Schakel dit uit via het route-icoon in de app-balk.'; - @override String get chat_fullPath => 'Volledige Pad'; @override - String get chat_pathDetailsNotAvailable => - 'De paddetails zijn nog niet beschikbaar. Probeer een bericht te sturen om te vernieuwen.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Pad ingesteld: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Opgeslagen lokaal. Verbinden om te synchroniseren.'; @@ -2034,65 +2114,12 @@ class AppLocalizationsNl extends AppLocalizations { @override String get common_clear => 'Schoonmaken'; - @override - String path_currentPath(String path) { - return 'Huidige pad: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Gebruik $count $_temp0 pad'; - } - - @override - String get path_enterCustomPath => 'Voer aangepaste pad in'; - @override String get path_currentPathLabel => 'Huidige pad'; - @override - String get path_hexPrefixInstructions => - 'Voer 2-letter hex-voorgiffen voor elke hop in, gescheiden door komma\'s.'; - - @override - String get path_hexPrefixExample => - 'Voorbeeld: A1,F2,3C (elke node gebruikt het eerste byte van zijn openbare sleutel)'; - - @override - String get path_labelHexPrefixes => 'Pad (hex-voorkeursletters)'; - - @override - String get path_helperMaxHops => - 'Maximaal 64 sprongen. Elke prefix is 2 hexadecimale tekens (1 byte)'; - - @override - String get path_selectFromContacts => 'Of select contacten:'; - @override String get path_noRepeatersFound => 'Geen repeaters of roomservers gevonden.'; - @override - String get path_customPathsRequire => - 'Aangepaste paden vereisen tussentse overstappen die berichten kunnen doorgeven.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Ongeldige hex-voorkeursletters: $prefixes'; - } - - @override - String get path_tooLong => - 'Pad is te lang. Maximaal 64 sprongen zijn toegestaan.'; - - @override - String get path_setPath => 'Stel Pad in'; - @override String get repeater_management => 'Beheer Repeaters'; @@ -2157,16 +2184,6 @@ class AppLocalizationsNl extends AppLocalizations { @override String get repeater_routingMode => 'Routeerwijze'; - @override - String get repeater_autoUseSavedPath => - 'Automatisch (gebruik opgeslagen pad)'; - - @override - String get repeater_forceFloodMode => 'Dwing Floodmodus Af'; - - @override - String get repeater_pathManagement => 'Beheer van paden'; - @override String get repeater_refresh => 'Vernieuwen'; @@ -4422,4 +4439,28 @@ class AppLocalizationsNl extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index f30cbb7f..f582d2df 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -92,6 +92,24 @@ class AppLocalizationsPl extends AppLocalizations { @override String get common_disable => 'Wyłącz'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Uruchom ponownie'; @@ -796,11 +814,6 @@ class AppLocalizationsPl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Liczba prób ponownego wysłania wiadomości przed oznaczaniem jej jako nieudanej'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Bateria'; @@ -1009,6 +1022,15 @@ class AppLocalizationsPl extends AppLocalizations { @override String get contacts_newGroup => 'Nowa Grupa'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Nazwa grupy'; @@ -1491,35 +1513,6 @@ class AppLocalizationsPl extends AppLocalizations { @override String get debugFrame_hexDump => 'Zrzut hex:'; - @override - String get chat_pathManagement => 'Zarządzanie ścieżkami'; - - @override - String get chat_ShowAllPaths => 'Pokaż wszystkie ścieżki'; - - @override - String get chat_routingMode => 'Tryb routingu'; - - @override - String get chat_autoUseSavedPath => 'Automatyczne (użyj zapisanej ścieżki)'; - - @override - String get chat_forceFloodMode => 'Wymuś tryb zalewowy'; - - @override - String get chat_recentAckPaths => - 'Ostatnie ścieżki ACK (naciśnij, aby użyć):'; - - @override - String get chat_pathHistoryFull => - 'Historia ścieżek jest pełna. Usuń wpisy, aby dodać nowe.'; - - @override - String get chat_hopSingular => 'skok'; - - @override - String get chat_hopPlural => 'skoki'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1533,12 +1526,6 @@ class AppLocalizationsPl extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Sukcesy'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Usuń ścieżkę'; @@ -1546,52 +1533,144 @@ class AppLocalizationsPl extends AppLocalizations { String get chat_noPathHistoryYet => 'Brak historii ścieżek.\nWyślij wiadomość, aby odkryć ścieżki.'; - @override - String get chat_pathActions => 'Działania ścieżki:'; - - @override - String get chat_setCustomPath => 'Ustaw ścieżkę niestandardową'; - - @override - String get chat_setCustomPathSubtitle => 'Ręcznie określ trasę.'; - - @override - String get chat_clearPath => 'Wyczyść Ścieżkę'; - - @override - String get chat_clearPathSubtitle => - 'Wymuś ponowne wyznaczenie trasy przy następnym wysłaniu'; - @override String get chat_pathCleared => 'Ścieżka wyczyszczona. Następna wiadomość odnajdzie trasę.'; - @override - String get chat_floodModeSubtitle => - 'Użyj przełącznika routingu w pasku narzędzi.'; - - @override - String get chat_floodModeEnabled => - 'Tryb zalewowy włączony. Przełącz z powrotem ikoną routingu w pasku aplikacji.'; - @override String get chat_fullPath => 'Pełna ścieżka'; @override - String get chat_pathDetailsNotAvailable => - 'Szczegóły ścieżki jeszcze niedostępne. Spróbuj wysłać wiadomość, aby odświeżyć.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Ścieżka ustawiona: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Zapisano lokalnie. Połącz się, aby zsynchronizować.'; @@ -2061,68 +2140,13 @@ class AppLocalizationsPl extends AppLocalizations { @override String get common_clear => 'Wyczyść'; - @override - String path_currentPath(String path) { - return 'Aktualna ścieżka: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'skoków', - many: 'skoków', - few: 'skoki', - one: 'skok', - ); - return 'Użyj ścieżki $count $_temp0.'; - } - - @override - String get path_enterCustomPath => 'Wprowadź własną ścieżkę'; - @override String get path_currentPathLabel => 'Aktualna ścieżka'; - @override - String get path_hexPrefixInstructions => - 'Wprowadź 2-znakowe prefiksy szesnastkowe dla każdego skoku, oddzielone przecinkami.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (każdy węzeł używa pierwszego bajtu swojego klucza publicznego)'; - - @override - String get path_labelHexPrefixes => 'Ścieżka (prefiksy hex)'; - - @override - String get path_helperMaxHops => - 'Maksymalnie 64 skoki. Każdy prefiks ma 2 znaki szesnastkowe (1 bajt).'; - - @override - String get path_selectFromContacts => 'Albo wybierz z kontaktów:'; - @override String get path_noRepeatersFound => 'Nie znaleziono przekaźników ani serwerów pokoi.'; - @override - String get path_customPathsRequire => - 'Dostosowane ścieżki wymagają pośrednich skoków, które mogą przekazywać wiadomości.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Nieprawidłowe prefiksy szesnastkowe: $prefixes'; - } - - @override - String get path_tooLong => - 'Ścieżka jest zbyt długa. Dozwolonych skoków wynosi 64.'; - - @override - String get path_setPath => 'Ustaw Ścieżkę'; - @override String get repeater_management => 'Zarządzanie przekaźnikami'; @@ -2187,16 +2211,6 @@ class AppLocalizationsPl extends AppLocalizations { @override String get repeater_routingMode => 'Tryb routingu'; - @override - String get repeater_autoUseSavedPath => - 'Automatycznie (użyj zapisanej ścieżki)'; - - @override - String get repeater_forceFloodMode => 'Wymuś tryb zalewowy'; - - @override - String get repeater_pathManagement => 'Zarządzanie ścieżkami'; - @override String get repeater_refresh => 'Odśwież'; @@ -4459,4 +4473,28 @@ class AppLocalizationsPl extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 5fe15028..23495d55 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -92,6 +92,24 @@ class AppLocalizationsPt extends AppLocalizations { @override String get common_disable => 'Desativar'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Reiniciar'; @@ -793,11 +811,6 @@ class AppLocalizationsPt extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Número de tentativas de reenvio antes de classificar uma mensagem como falha.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Bateria'; @@ -999,6 +1012,15 @@ class AppLocalizationsPt extends AppLocalizations { @override String get contacts_newGroup => 'Novo Grupo'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Nome do grupo'; @@ -1478,34 +1500,6 @@ class AppLocalizationsPt extends AppLocalizations { @override String get debugFrame_hexDump => 'Espaço Hexadecimal:'; - @override - String get chat_pathManagement => 'Gerenciamento de Caminhos'; - - @override - String get chat_ShowAllPaths => 'Mostrar todos os caminhos'; - - @override - String get chat_routingMode => 'Modo de roteamento'; - - @override - String get chat_autoUseSavedPath => 'Auto (usar caminho salvo)'; - - @override - String get chat_forceFloodMode => 'Modo de Inundação Forçado'; - - @override - String get chat_recentAckPaths => 'Rotas de ACK Recentes (toque para usar):'; - - @override - String get chat_pathHistoryFull => - 'O histórico está cheio. Remova entradas para adicionar novas.'; - - @override - String get chat_hopSingular => 'pule'; - - @override - String get chat_hopPlural => 'salta'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1517,12 +1511,6 @@ class AppLocalizationsPt extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Sucessos'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Remover caminho'; @@ -1530,53 +1518,144 @@ class AppLocalizationsPt extends AppLocalizations { String get chat_noPathHistoryYet => 'Ainda não há histórico de caminhos.\nEnvie uma mensagem para descobrir caminhos.'; - @override - String get chat_pathActions => 'Ações do Caminho:'; - - @override - String get chat_setCustomPath => 'Definir Caminho Personalizado'; - - @override - String get chat_setCustomPathSubtitle => - 'Especifique manualmente o caminho de roteamento'; - - @override - String get chat_clearPath => 'Limpar Caminho'; - - @override - String get chat_clearPathSubtitle => - 'Forçar a descoberta na próxima transmissão'; - @override String get chat_pathCleared => 'Caminho limpo. A próxima mensagem redescobrirá a rota.'; - @override - String get chat_floodModeSubtitle => - 'Use a chave de roteamento na barra de ferramentas'; - - @override - String get chat_floodModeEnabled => - 'Modo de inundação ativado. Desative-o novamente através do ícone de roteamento na barra de ferramentas.'; - @override String get chat_fullPath => 'Caminho Completo'; @override - String get chat_pathDetailsNotAvailable => - 'Os detalhes do caminho ainda não estão disponíveis. Tente enviar uma mensagem para atualizar.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Caminho definido: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Salvo localmente. Conectar para sincronizar.'; @@ -2044,66 +2123,13 @@ class AppLocalizationsPt extends AppLocalizations { @override String get common_clear => 'Limpar'; - @override - String path_currentPath(String path) { - return 'Caminho atual: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Usando $count $_temp0 caminho'; - } - - @override - String get path_enterCustomPath => 'Insira Caminho Personalizado'; - @override String get path_currentPathLabel => 'Caminho atual'; - @override - String get path_hexPrefixInstructions => - 'Insira os prefixos hexadecimais de 2 caracteres para cada salto, separados por vírgulas.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (cada nó usa o primeiro byte de sua chave pública)'; - - @override - String get path_labelHexPrefixes => 'Prefixo Hexadecimal'; - - @override - String get path_helperMaxHops => - 'Máximo de 64 saltos. Cada prefixo tem 2 caracteres hexadecimais (1 byte)'; - - @override - String get path_selectFromContacts => 'Ou selecione de contatos:'; - @override String get path_noRepeatersFound => 'Não foram encontrados repetidores ou servidores de sala.'; - @override - String get path_customPathsRequire => - 'Caminhos personalizados exigem saltos intermediários que podem transmitir mensagens.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Prefixos hexadecimais inválidos: $prefixes'; - } - - @override - String get path_tooLong => - 'Caminho muito longo. Máximo de 64 saltos permitidos.'; - - @override - String get path_setPath => 'Definir Caminho'; - @override String get repeater_management => 'Gerenciamento de Repetidor'; @@ -2168,15 +2194,6 @@ class AppLocalizationsPt extends AppLocalizations { @override String get repeater_routingMode => 'Modo de roteamento'; - @override - String get repeater_autoUseSavedPath => 'Auto (usar caminho salvo)'; - - @override - String get repeater_forceFloodMode => 'Modo de Inundação Forçado'; - - @override - String get repeater_pathManagement => 'Gerenciamento de caminhos'; - @override String get repeater_refresh => 'Atualizar'; @@ -4435,4 +4452,28 @@ class AppLocalizationsPt extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 84929424..fe535172 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -92,6 +92,24 @@ class AppLocalizationsRu extends AppLocalizations { @override String get common_disable => 'Выключить'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Перезагрузить'; @@ -795,11 +813,6 @@ class AppLocalizationsRu extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Количество попыток повторной отправки сообщения перед тем, как пометить его как неудачное.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Батарея'; @@ -1000,6 +1013,15 @@ class AppLocalizationsRu extends AppLocalizations { @override String get contacts_newGroup => 'Новая группа'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Имя группы'; @@ -1479,35 +1501,6 @@ class AppLocalizationsRu extends AppLocalizations { @override String get debugFrame_hexDump => 'Шестнадцатеричный дамп:'; - @override - String get chat_pathManagement => 'Управление маршрутами'; - - @override - String get chat_ShowAllPaths => 'Показать все пути'; - - @override - String get chat_routingMode => 'Режим маршрутизации'; - - @override - String get chat_autoUseSavedPath => 'Авто (использовать сохранённый маршрут)'; - - @override - String get chat_forceFloodMode => 'Принудительный режим рассылки'; - - @override - String get chat_recentAckPaths => - 'Недавние подтверждённые маршруты (нажмите, чтобы использовать):'; - - @override - String get chat_pathHistoryFull => - 'История маршрутов заполнена. Удалите записи, чтобы добавить новые.'; - - @override - String get chat_hopSingular => 'хоп'; - - @override - String get chat_hopPlural => 'хопов'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1521,12 +1514,6 @@ class AppLocalizationsRu extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'успешно'; - - @override - String get chat_score => 'Оценка'; - @override String get chat_removePath => 'Удалить маршрут'; @@ -1534,54 +1521,144 @@ class AppLocalizationsRu extends AppLocalizations { String get chat_noPathHistoryYet => 'История маршрутов пока пуста.\nОтправьте сообщение, чтобы обнаружить маршруты.'; - @override - String get chat_pathActions => 'Действия с маршрутом:'; - - @override - String get chat_setCustomPath => 'Указать маршрут вручную'; - - @override - String get chat_setCustomPathSubtitle => 'Вручную задать маршрут передачи'; - - @override - String get chat_clearPath => 'Очистить маршрут'; - - @override - String get chat_clearPathSubtitle => - 'Принудительно обновить маршрут при следующей отправке'; - @override String get chat_pathCleared => 'Маршрут очищен. Следующее сообщение обновит маршрут.'; - @override - String get chat_floodModeSubtitle => - 'Используйте переключатель маршрутизации в панели приложения'; - - @override - String get chat_floodModeEnabled => - 'Режим рассылки включён. Отключите через значок маршрутизации в панели приложения.'; - @override String get chat_fullPath => 'Полный маршрут'; @override - String get chat_pathDetailsNotAvailable => - 'Детали маршрута ещё недоступны. Попробуйте отправить сообщение для обновления.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'хопов', - many: 'хопов', - few: 'хопа', - one: 'хоп', - ); - return 'Маршрут установлен: $hopCount $_temp0 — $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Сохранено локально. Подключитесь для синхронизации.'; @@ -2049,66 +2126,12 @@ class AppLocalizationsRu extends AppLocalizations { @override String get common_clear => 'Очистить'; - @override - String path_currentPath(String path) { - return 'Текущий маршрут: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'хопов', - many: 'хопов', - few: 'хопа', - one: 'хоп', - ); - return 'Используется маршрут из $count $_temp0'; - } - - @override - String get path_enterCustomPath => 'Введите маршрут вручную'; - @override String get path_currentPathLabel => 'Текущий маршрут'; - @override - String get path_hexPrefixInstructions => - 'Введите 2-символьные шестнадцатеричные префиксы для каждого хопа, разделённые запятыми.'; - - @override - String get path_hexPrefixExample => - 'Пример: A1,F2,3C (каждый узел использует первый байт своего публичного ключа)'; - - @override - String get path_labelHexPrefixes => 'Маршрут (шестнадцатеричные префиксы)'; - - @override - String get path_helperMaxHops => - 'Максимум 64 хопа. Каждый префикс — 2 шестнадцатеричных символа (1 байт)'; - - @override - String get path_selectFromContacts => 'Или выберите из контактов:'; - @override String get path_noRepeatersFound => 'Репитеры или серверы комнат не найдены.'; - @override - String get path_customPathsRequire => - 'Пользовательские маршруты требуют промежуточных узлов, способных ретранслировать сообщения.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Недопустимые шестнадцатеричные префиксы: $prefixes'; - } - - @override - String get path_tooLong => 'Маршрут слишком длинный. Максимум 64 хопа.'; - - @override - String get path_setPath => 'Установить маршрут'; - @override String get repeater_management => 'Управление репитером'; @@ -2173,16 +2196,6 @@ class AppLocalizationsRu extends AppLocalizations { @override String get repeater_routingMode => 'Режим маршрутизации'; - @override - String get repeater_autoUseSavedPath => - 'Авто (использовать сохранённый маршрут)'; - - @override - String get repeater_forceFloodMode => 'Принудительный режим рассылки'; - - @override - String get repeater_pathManagement => 'Управление маршрутами'; - @override String get repeater_refresh => 'Обновить'; @@ -4453,4 +4466,28 @@ class AppLocalizationsRu extends AppLocalizations { @override String get contact_typeUnknown => 'Неизвестно'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 2072b634..f15bcfc1 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -92,6 +92,24 @@ class AppLocalizationsSk extends AppLocalizations { @override String get common_disable => 'Zakázať'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Restartovať'; @@ -782,11 +800,6 @@ class AppLocalizationsSk extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Počet pokusov o odošleť pred označením správy ako neúspešnej'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batéria'; @@ -988,6 +1001,15 @@ class AppLocalizationsSk extends AppLocalizations { @override String get contacts_newGroup => 'Nová skupina'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Názov skupiny'; @@ -1469,35 +1491,6 @@ class AppLocalizationsSk extends AppLocalizations { @override String get debugFrame_hexDump => 'Hexová analýza:'; - @override - String get chat_pathManagement => 'Správa ciest'; - - @override - String get chat_ShowAllPaths => 'Zobraziť všetky cesty'; - - @override - String get chat_routingMode => 'Režim trasy'; - - @override - String get chat_autoUseSavedPath => 'Použiť uloženú cestu'; - - @override - String get chat_forceFloodMode => - 'Zavrieť režim núdzového povodňového režimu'; - - @override - String get chat_recentAckPaths => 'Nedávne cesty ACK (klepni na použitie):'; - - @override - String get chat_pathHistoryFull => - 'História ciest je plná. Odstráňte záznamy, aby ste mohli pridať nové.'; - - @override - String get chat_hopSingular => 'Skok'; - - @override - String get chat_hopPlural => 'Skákať'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1509,12 +1502,6 @@ class AppLocalizationsSk extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Úspechy'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Odstrániť cestu'; @@ -1522,52 +1509,144 @@ class AppLocalizationsSk extends AppLocalizations { String get chat_noPathHistoryYet => 'Zatiaľ žiadna história trás.\nPošlite správu a objavte trasy.'; - @override - String get chat_pathActions => 'Cesty:'; - - @override - String get chat_setCustomPath => 'Nastaviť vlastnú cestu'; - - @override - String get chat_setCustomPathSubtitle => 'Ručne zadajte trasu.'; - - @override - String get chat_clearPath => 'Vyčistiš cestu'; - - @override - String get chat_clearPathSubtitle => - 'Znovu nájsť vynútene pri nasledujúcej pošlite'; - @override String get chat_pathCleared => 'Cesta vyčistená. Nasledujúce prepočetné získa trasu znova.'; - @override - String get chat_floodModeSubtitle => - 'Použite prepínanie trasy v navigačnom paneli.'; - - @override - String get chat_floodModeEnabled => - 'Odosporňovacia prevádzka je zapnutá. Vypnite ju znova cez ikonu routovania v navigačnom páse.'; - @override String get chat_fullPath => 'Celá cesta'; @override - String get chat_pathDetailsNotAvailable => - 'Podrobnosti o ceste zatiaľ dostupné nie sú. Skúste poslať správu na obnovenie.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Cesta nastavená: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Uložené lokálne. Spojte sa na synchronizáciu.'; @@ -2035,66 +2114,13 @@ class AppLocalizationsSk extends AppLocalizations { @override String get common_clear => 'Zmazať'; - @override - String path_currentPath(String path) { - return 'Aktívna cesta: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Používa $count $_temp0 cestu'; - } - - @override - String get path_enterCustomPath => 'Zadajte vlastný priebeh'; - @override String get path_currentPathLabel => 'Aktuálny priebeh'; - @override - String get path_hexPrefixInstructions => - 'Zadajte 2-miestne hexové predpony pre každú fázu, oddelené čiarkami.'; - - @override - String get path_hexPrefixExample => - 'A1,F2,3C (každý uzel používa prvý bajt svojho verejného kľúča)'; - - @override - String get path_labelHexPrefixes => 'Cesty (hexové predpony)'; - - @override - String get path_helperMaxHops => - 'Max 64 skokov. Každý prefix je 2 hexadecimálne znaky (1 bajt).'; - - @override - String get path_selectFromContacts => 'Vyberte sa z kontaktov:'; - @override String get path_noRepeatersFound => 'Nenašli sa žiadne opakovače ani serverové miestnosti.'; - @override - String get path_customPathsRequire => - 'Vlastné cesty vyžadujú medziletoch, ktoré môžu prenášať správky.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Neplatné hexové predpony: $prefixes'; - } - - @override - String get path_tooLong => - 'Cesta je príliš dlhá. Umožnené je maximum 64 skokov.'; - - @override - String get path_setPath => 'Nastaviť cestu'; - @override String get repeater_management => 'Správa opakérov'; @@ -2159,16 +2185,6 @@ class AppLocalizationsSk extends AppLocalizations { @override String get repeater_routingMode => 'Režim trasy'; - @override - String get repeater_autoUseSavedPath => 'Použiť uloženú cestu'; - - @override - String get repeater_forceFloodMode => - 'Zavrieť režim núdzového povodňového režimu'; - - @override - String get repeater_pathManagement => 'Správa trás'; - @override String get repeater_refresh => 'Obnoviť'; @@ -4418,4 +4434,28 @@ class AppLocalizationsSk extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index e91086e9..c2dc192b 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -92,6 +92,24 @@ class AppLocalizationsSl extends AppLocalizations { @override String get common_disable => 'Izklopiti'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Ponoviti'; @@ -783,11 +801,6 @@ class AppLocalizationsSl extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Število poskusov ponovnega poslanja, preden se sporočilo označuje kot neuspešno'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Baterija'; @@ -987,6 +1000,15 @@ class AppLocalizationsSl extends AppLocalizations { @override String get contacts_newGroup => 'Nova skupina'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Ime skupine'; @@ -1466,34 +1488,6 @@ class AppLocalizationsSl extends AppLocalizations { @override String get debugFrame_hexDump => 'Izpis heksadecimalnih vrednosti:'; - @override - String get chat_pathManagement => 'Upravljanje poti'; - - @override - String get chat_ShowAllPaths => 'Prikaži vse poti'; - - @override - String get chat_routingMode => 'Navodilo za usmerjevalni način'; - - @override - String get chat_autoUseSavedPath => 'Avto (uporabi shranjeno pot)'; - - @override - String get chat_forceFloodMode => 'Nasilje obvezati v način'; - - @override - String get chat_recentAckPaths => 'Nedavni poti ACK (tap za uporabo):'; - - @override - String get chat_pathHistoryFull => - 'Zapiske o poti so popolni. Izbriši vnose, da dodaš nove.'; - - @override - String get chat_hopSingular => 'skok'; - - @override - String get chat_hopPlural => 'skokov'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1505,12 +1499,6 @@ class AppLocalizationsSl extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Uspešni'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Izbriši pot'; @@ -1518,51 +1506,144 @@ class AppLocalizationsSl extends AppLocalizations { String get chat_noPathHistoryYet => 'Ni shranjenih poti.\nPošlji sporočilo za odkrivanje poti.'; - @override - String get chat_pathActions => 'Potni ukazi:'; - - @override - String get chat_setCustomPath => 'Nastavi Prilozeno Pot'; - - @override - String get chat_setCustomPathSubtitle => 'Ročno določite potniško pot.'; - - @override - String get chat_clearPath => 'Počisti pot'; - - @override - String get chat_clearPathSubtitle => 'Ob naslednji pošiljanju znova zbrati.'; - @override String get chat_pathCleared => 'Pot je očiščena. Naslednje sporočilo bo ponovno odkril pot.'; - @override - String get chat_floodModeSubtitle => - 'Uporabi tipko usmerjevanja v meniju aplikacije.'; - - @override - String get chat_floodModeEnabled => - 'Narejena je bila omrežna modaliteta. Vklopi jo znova preko ikone v meniju aplikacije.'; - @override String get chat_fullPath => 'Polna pot'; @override - String get chat_pathDetailsNotAvailable => - 'Podrobnosti poti zaenkrat niso na voljo. Poskusite poslati sporočilo za osvežitev.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Pot nastavljen: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Shrano lokalno. Povežite se za sinhronizacijo.'; @@ -2032,65 +2113,13 @@ class AppLocalizationsSl extends AppLocalizations { @override String get common_clear => 'Ponoviti'; - @override - String path_currentPath(String path) { - return 'Trenutna pot: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Uporablja $count $_temp0 pot'; - } - - @override - String get path_enterCustomPath => 'Vnesite prilagojeno pot'; - @override String get path_currentPathLabel => 'Trenutna pot'; - @override - String get path_hexPrefixInstructions => - 'Vnesite 2-karakterne heksadecimalne prefixe za vsako skopo, ločeno z zvezekami.'; - - @override - String get path_hexPrefixExample => - 'Primer: A1,F2,3C (vsak notranji element uporablja prvi bajt svojega javnega ključa)'; - - @override - String get path_labelHexPrefixes => 'Pot (heksafixne skrajšave)'; - - @override - String get path_helperMaxHops => - 'Maksimalno 64 skokov. Vsak prefiks je 2 heksadecimalna znamenja (1 bajt).'; - - @override - String get path_selectFromContacts => 'Izberi iz kontaktov:'; - @override String get path_noRepeatersFound => 'Ne najdenih ponoviteljev ali strežnikov sob.'; - @override - String get path_customPathsRequire => - 'Prilojene poti zahtevajo medhodne prenose, ki lahko prenašajo sporočila.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Neveljačni šesteročlenski prefiksi: $prefixes'; - } - - @override - String get path_tooLong => 'Pot je prevelika. Dovoljeno največ 64 skokov.'; - - @override - String get path_setPath => 'Nastavi Pot'; - @override String get repeater_management => 'Upravljanje ponovitve'; @@ -2156,15 +2185,6 @@ class AppLocalizationsSl extends AppLocalizations { @override String get repeater_routingMode => 'Navodilo za usmerjevalni način'; - @override - String get repeater_autoUseSavedPath => 'Avto (uporabi shranjeno pot)'; - - @override - String get repeater_forceFloodMode => 'Nasilje obvezati v način'; - - @override - String get repeater_pathManagement => 'Upravljanje poti'; - @override String get repeater_refresh => 'Ponovno obnavljati'; @@ -4416,4 +4436,28 @@ class AppLocalizationsSl extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 95af0f64..ef0df94c 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -92,6 +92,24 @@ class AppLocalizationsSv extends AppLocalizations { @override String get common_disable => 'Inaktivera'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Start om'; @@ -777,11 +795,6 @@ class AppLocalizationsSv extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Antal försök att skicka om ett meddelande innan det markeras som misslyckat.'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Batteri'; @@ -982,6 +995,15 @@ class AppLocalizationsSv extends AppLocalizations { @override String get contacts_newGroup => 'Ny grupp'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Gruppnamn'; @@ -1460,35 +1482,6 @@ class AppLocalizationsSv extends AppLocalizations { @override String get debugFrame_hexDump => 'Hexdump:'; - @override - String get chat_pathManagement => 'Stigarhantering'; - - @override - String get chat_ShowAllPaths => 'Visa alla vägar'; - - @override - String get chat_routingMode => 'Ruttläge'; - - @override - String get chat_autoUseSavedPath => 'Automatisk (använd sparad sökväg)'; - - @override - String get chat_forceFloodMode => 'Tvinga Översvämningsläge'; - - @override - String get chat_recentAckPaths => - 'Nyligen Ack-vägar (tryck för att använda):'; - - @override - String get chat_pathHistoryFull => - 'Historisk sökväg är full. Ta bort poster för att lägga till nya.'; - - @override - String get chat_hopSingular => 'hoppa'; - - @override - String get chat_hopPlural => 'hoppar'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1500,12 +1493,6 @@ class AppLocalizationsSv extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'framgångar'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => 'Ta bort sökväg'; @@ -1513,50 +1500,144 @@ class AppLocalizationsSv extends AppLocalizations { String get chat_noPathHistoryYet => 'Ingen historik ännu.\nSkicka ett meddelande för att upptäcka spår.'; - @override - String get chat_pathActions => 'Stigar:'; - - @override - String get chat_setCustomPath => 'Ange anpassad sökväg'; - - @override - String get chat_setCustomPathSubtitle => 'Ange ruttväg manuellt'; - - @override - String get chat_clearPath => 'Rensa Vägen'; - - @override - String get chat_clearPathSubtitle => 'Tvinga fram omstart vid nästa sändning'; - @override String get chat_pathCleared => 'Routen är nu fri. Nästa meddelande kommer att upptäcka rutten igen.'; - @override - String get chat_floodModeSubtitle => 'Använd routningsomkopplaren i appraden'; - - @override - String get chat_floodModeEnabled => - 'Översvämningsläge aktiverat. Stäng av via ruttikonen i appraden.'; - @override String get chat_fullPath => 'Fullständig sökväg'; @override - String get chat_pathDetailsNotAvailable => - 'Stigaruppgifterna är ännu inte tillgängliga. Försök att skicka ett meddelande för att uppdatera.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'hoppar', - one: 'hopp', - ); - return 'Sökväg inställd: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Sparat lokalt. Anslut för att synkronisera.'; @@ -2021,65 +2102,13 @@ class AppLocalizationsSv extends AppLocalizations { @override String get common_clear => 'Rensa'; - @override - String path_currentPath(String path) { - return 'Nuvarande sökväg: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'hops', - one: 'hop', - ); - return 'Använda $count $_temp0 sökväg'; - } - - @override - String get path_enterCustomPath => 'Ange anpassad sökväg'; - @override String get path_currentPathLabel => 'Nuvarande sökväg'; - @override - String get path_hexPrefixInstructions => - 'Ange 2-tecknets hex-prefett för varje hopp, åtskilda med komma.'; - - @override - String get path_hexPrefixExample => - 'Exempel: A1,F2,3C (varje nod använder det första bytet av sitt publika nyckel)'; - - @override - String get path_labelHexPrefixes => 'Hexprefixer'; - - @override - String get path_helperMaxHops => - 'Max 64 hopp. Varje prefix är 2 hex-tecken (1 byte)'; - - @override - String get path_selectFromContacts => 'Välj istället från kontakter:'; - @override String get path_noRepeatersFound => 'Inga återuppspelare eller rumsservrar hittades.'; - @override - String get path_customPathsRequire => - 'Anpassade sökvägar kräver mellansteg som kan vidarebefordra meddelanden.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Ogiltiga hex-prefikser: $prefixes'; - } - - @override - String get path_tooLong => 'Sökvägen är för lång. Max 64 hopp tillåtna.'; - - @override - String get path_setPath => 'Ange Sökväg'; - @override String get repeater_management => 'Återuppspelarens Hantering'; @@ -2144,15 +2173,6 @@ class AppLocalizationsSv extends AppLocalizations { @override String get repeater_routingMode => 'Ruttläge'; - @override - String get repeater_autoUseSavedPath => 'Automatisk (använd sparad sökväg)'; - - @override - String get repeater_forceFloodMode => 'Tvinga Översvämningsläge'; - - @override - String get repeater_pathManagement => 'Stigarhantering'; - @override String get repeater_refresh => 'Uppdatera'; @@ -4391,4 +4411,28 @@ class AppLocalizationsSv extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index ae82d64e..beb14024 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -92,6 +92,24 @@ class AppLocalizationsUk extends AppLocalizations { @override String get common_disable => 'Вимкнути'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => 'Перезавантажити'; @@ -789,11 +807,6 @@ class AppLocalizationsUk extends AppLocalizations { String get appSettings_maxMessageRetriesSubtitle => 'Кількість спроб повторного відправлення повідомлення перед тим, як позначити його як невдале'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => 'Батарея'; @@ -995,6 +1008,15 @@ class AppLocalizationsUk extends AppLocalizations { @override String get contacts_newGroup => 'Нова група'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => 'Назва групи'; @@ -1474,35 +1496,6 @@ class AppLocalizationsUk extends AppLocalizations { @override String get debugFrame_hexDump => 'Дамп Hex:'; - @override - String get chat_pathManagement => 'Керування шляхами'; - - @override - String get chat_ShowAllPaths => 'Показати всі шляхи'; - - @override - String get chat_routingMode => 'Режим маршрутизації'; - - @override - String get chat_autoUseSavedPath => 'Авто (використовувати збережений шлях)'; - - @override - String get chat_forceFloodMode => 'Примусово через всю мережу'; - - @override - String get chat_recentAckPaths => - 'Підтверджені шляхи (натисніть, щоб використати):'; - - @override - String get chat_pathHistoryFull => - 'Історія шляхів заповнена. Видаліть записи, щоб додати нові.'; - - @override - String get chat_hopSingular => 'Перехід'; - - @override - String get chat_hopPlural => 'переходів'; - @override String chat_hopsCount(int count) { String _temp0 = intl.Intl.pluralLogic( @@ -1516,12 +1509,6 @@ class AppLocalizationsUk extends AppLocalizations { return '$count $_temp0'; } - @override - String get chat_successes => 'Успішно'; - - @override - String get chat_score => 'Оцінка'; - @override String get chat_removePath => 'Видалити шлях'; @@ -1529,54 +1516,144 @@ class AppLocalizationsUk extends AppLocalizations { String get chat_noPathHistoryYet => 'Історія шляхів недоступна.\nНадішліть повідомлення, щоб виявити шляхи.'; - @override - String get chat_pathActions => 'Дії зі шляхом:'; - - @override - String get chat_setCustomPath => 'Встановити власний шлях'; - - @override - String get chat_setCustomPathSubtitle => 'Вказати шлях маршрутизації вручну'; - - @override - String get chat_clearPath => 'Очистити шлях'; - - @override - String get chat_clearPathSubtitle => - 'Примусово повторити пошук при наступному надсиланні'; - @override String get chat_pathCleared => 'Шлях очищено. Наступне повідомлення оновить маршрут.'; - @override - String get chat_floodModeSubtitle => - 'Використовувати перемикач маршрутизації в панелі застосунку'; - - @override - String get chat_floodModeEnabled => - 'Увімкнено режим «через всю мережу». Перемикайте через іконку маршрутизації на панелі інструментів.'; - @override String get chat_fullPath => 'Повний шлях'; @override - String get chat_pathDetailsNotAvailable => - 'Деталі шляху ще недоступні. Спробуйте надіслати повідомлення для оновлення.'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - String _temp0 = intl.Intl.pluralLogic( - hopCount, - locale: localeName, - other: 'переходів', - many: 'переходів', - few: 'переходи', - one: 'перехід', - ); - return 'Шлях встановлено: $hopCount $_temp0 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => 'Збережено локально. Підключіться для синхронізації.'; @@ -2043,67 +2120,13 @@ class AppLocalizationsUk extends AppLocalizations { @override String get common_clear => 'Очистити'; - @override - String path_currentPath(String path) { - return 'Поточний шлях: $path'; - } - - @override - String path_usingHopsPath(int count) { - String _temp0 = intl.Intl.pluralLogic( - count, - locale: localeName, - other: 'переходами', - many: 'переходами', - few: 'переходами', - one: 'переходом', - ); - return 'Використання шляху з $count $_temp0'; - } - - @override - String get path_enterCustomPath => 'Ввести власний шлях'; - @override String get path_currentPathLabel => 'Поточний шлях'; - @override - String get path_hexPrefixInstructions => - 'Введіть 2-символьні hex-префікси для кожного переходу, розділені комами.'; - - @override - String get path_hexPrefixExample => - 'Приклад: A1,F2,3C (кожен вузол використовує перший байт свого відкритого ключа).'; - - @override - String get path_labelHexPrefixes => 'Hex-префікси'; - - @override - String get path_helperMaxHops => - 'Макс. 64 переходи. Кожен префікс — 2 шістнадцяткові символи (1 байт)'; - - @override - String get path_selectFromContacts => 'Вибрати з контактів:'; - @override String get path_noRepeatersFound => 'Ретрансляторів або серверів кімнат не знайдено.'; - @override - String get path_customPathsRequire => - 'Власні шляхи вимагають проміжних вузлів, які можуть передавати повідомлення.'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return 'Некоректні hex-префікси: $prefixes'; - } - - @override - String get path_tooLong => 'Шлях занадто довгий. Максимум 64 переходи.'; - - @override - String get path_setPath => 'Встановити шлях'; - @override String get repeater_management => 'Керування ретранслятором'; @@ -2168,16 +2191,6 @@ class AppLocalizationsUk extends AppLocalizations { @override String get repeater_routingMode => 'Режим маршрутизації'; - @override - String get repeater_autoUseSavedPath => - 'Авто (використовувати збережений шлях)'; - - @override - String get repeater_forceFloodMode => 'Примусово через всю мережу'; - - @override - String get repeater_pathManagement => 'Керування шляхами'; - @override String get repeater_refresh => 'Оновити'; @@ -4454,4 +4467,28 @@ class AppLocalizationsUk extends AppLocalizations { @override String get contact_typeUnknown => 'Невідомо'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 79e4e22e..41374057 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -92,6 +92,24 @@ class AppLocalizationsZh extends AppLocalizations { @override String get common_disable => '禁用'; + @override + String get common_undo => 'Undo'; + + @override + String get messageStatus_sent => 'Sent'; + + @override + String get messageStatus_delivered => 'Delivered'; + + @override + String get messageStatus_pending => 'Sending'; + + @override + String get messageStatus_failed => 'Failed to send'; + + @override + String get messageStatus_repeated => 'Heard repeated'; + @override String get common_reboot => '重启'; @@ -735,11 +753,6 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_maxMessageRetriesSubtitle => '在将消息标记为失败之前,允许尝试的次数'; - @override - String path_routeWeight(String weight, String max) { - return '$weight/$max'; - } - @override String get appSettings_battery => '电池'; @@ -931,6 +944,15 @@ class AppLocalizationsZh extends AppLocalizations { @override String get contacts_newGroup => '新建群聊'; + @override + String get contacts_moreOptions => 'More options'; + + @override + String get contacts_searchOpen => 'Search contacts'; + + @override + String get contacts_searchClose => 'Close search'; + @override String get contacts_groupName => '群聊名称'; @@ -1397,85 +1419,154 @@ class AppLocalizationsZh extends AppLocalizations { @override String get debugFrame_hexDump => '十六进制数据:'; - @override - String get chat_pathManagement => '路径管理'; - - @override - String get chat_ShowAllPaths => '显示所有路径'; - - @override - String get chat_routingMode => '路由模式'; - - @override - String get chat_autoUseSavedPath => '自动(使用保存的路径)'; - - @override - String get chat_forceFloodMode => '强制泛洪模式'; - - @override - String get chat_recentAckPaths => '最近使用的 ACK 路径(点击使用):'; - - @override - String get chat_pathHistoryFull => '路径历史已满,请删除后再添加。'; - - @override - String get chat_hopSingular => '跳'; - - @override - String get chat_hopPlural => '跳'; - @override String chat_hopsCount(int count) { return '$count 跳'; } - @override - String get chat_successes => '成功'; - - @override - String get chat_score => 'Score'; - @override String get chat_removePath => '移除路径'; @override String get chat_noPathHistoryYet => '暂无路径历史。\n发送消息以探索路径。'; - @override - String get chat_pathActions => '路径操作:'; - - @override - String get chat_setCustomPath => '设置自定义路径'; - - @override - String get chat_setCustomPathSubtitle => '手动指定路由路径'; - - @override - String get chat_clearPath => '清除路径'; - - @override - String get chat_clearPathSubtitle => '清除当前路径,下次发送将重新尝试。'; - @override String get chat_pathCleared => '路径已清除。下一条消息将重新路由。'; - @override - String get chat_floodModeSubtitle => '在应用栏中切换路由模式。'; - - @override - String get chat_floodModeEnabled => '泛洪模式已启用。可通过应用栏的路由图标切换。'; - @override String get chat_fullPath => '完整路径'; @override - String get chat_pathDetailsNotAvailable => '路径信息暂不可用,请尝试发送消息刷新。'; + String get routing_title => 'Routing'; @override - String chat_pathSetHops(int hopCount, String status) { - return '路径设置:$hopCount 跳 - $status'; + String get routing_modeAuto => 'Auto'; + + @override + String get routing_modeFlood => 'Flood'; + + @override + String get routing_modeManual => 'Manual'; + + @override + String get routing_modeAutoHint => + 'Picks the best known path automatically, flooding when none is known.'; + + @override + String get routing_modeFloodHint => + 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + + @override + String get routing_modeManualHint => + 'Always sends along the exact path you set.'; + + @override + String get routing_currentRoute => 'Current route'; + + @override + String get routing_directNoHops => 'Direct — no repeater hops'; + + @override + String get routing_noPathYet => + 'No path yet. The next message floods until a route is discovered.'; + + @override + String get routing_floodBroadcast => 'Broadcast through every repeater'; + + @override + String get routing_editPath => 'Edit path'; + + @override + String get routing_forgetPath => 'Forget path'; + + @override + String get routing_knownPaths => 'Known paths'; + + @override + String get routing_knownPathsHint => 'Tap a path to switch to it.'; + + @override + String get routing_inUse => 'In use'; + + @override + String get routing_qualityStrong => 'Strong first hop'; + + @override + String get routing_qualityGood => 'Good first hop'; + + @override + String get routing_qualityFair => 'Fair first hop'; + + @override + String get routing_qualityWorked => 'Has delivered'; + + @override + String get routing_qualityFlood => 'Heard via flood'; + + @override + String get routing_qualityUntested => 'Untested'; + + @override + String routing_lastWorked(String when) { + return 'worked $when'; } + @override + String get routing_neverWorked => 'never confirmed'; + + @override + String routing_deliveryCounts(int successes, int failures) { + return '$successes delivered, $failures failed'; + } + + @override + String get routing_floodDelivery => 'Flood delivery'; + + @override + String get pathEditor_title => 'Build Path'; + + @override + String pathEditor_hopCounter(int count) { + return '$count of 64 hops'; + } + + @override + String get pathEditor_noHops => + 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + + @override + String get pathEditor_addHops => 'Add hops in order'; + + @override + String get pathEditor_searchRepeaters => 'Search repeaters'; + + @override + String get pathEditor_advancedHex => 'Advanced: raw hex path'; + + @override + String get pathEditor_hexLabel => 'Hex prefixes'; + + @override + String get pathEditor_hexHelper => + 'Two hex characters per hop, separated by commas'; + + @override + String pathEditor_invalidTokens(String tokens) { + return 'Invalid: $tokens'; + } + + @override + String get pathEditor_tooManyHops => 'Maximum 64 hops'; + + @override + String get pathEditor_usePath => 'Use this path'; + + @override + String get pathEditor_removeHop => 'Remove hop'; + + @override + String get pathEditor_unknownHop => 'Unknown repeater'; + @override String get chat_pathSavedLocally => '已本地保存,连接设备后可同步。'; @@ -1928,54 +2019,12 @@ class AppLocalizationsZh extends AppLocalizations { @override String get common_clear => '清除'; - @override - String path_currentPath(String path) { - return '当前路径:$path'; - } - - @override - String path_usingHopsPath(int count) { - return '使用 $count 跳路径'; - } - - @override - String get path_enterCustomPath => '输入自定义路径'; - @override String get path_currentPathLabel => '当前路径'; - @override - String get path_hexPrefixInstructions => '请输入每个中继节点的2字符十六进制前缀,用逗号分隔。'; - - @override - String get path_hexPrefixExample => '例如:A1, F2, 3C(每个节点使用其公钥的第一字节)'; - - @override - String get path_labelHexPrefixes => '路径(十六进制前缀)'; - - @override - String get path_helperMaxHops => '最多 64 跳。每个前缀由 2 个十六进制字符(1 字节)组成。'; - - @override - String get path_selectFromContacts => '或从联系人列表中选择:'; - @override String get path_noRepeatersFound => '未找到任何转发节点或房间服务器。'; - @override - String get path_customPathsRequire => '自定义路径需要中间节点转发消息。'; - - @override - String path_invalidHexPrefixes(String prefixes) { - return '无效的十六进制前缀:$prefixes'; - } - - @override - String get path_tooLong => '路径过长,最多允许 64 跳。'; - - @override - String get path_setPath => '设置路径'; - @override String get repeater_management => '转发节点管理'; @@ -2036,15 +2085,6 @@ class AppLocalizationsZh extends AppLocalizations { @override String get repeater_routingMode => '路由模式'; - @override - String get repeater_autoUseSavedPath => '自动(使用保存的路径)'; - - @override - String get repeater_forceFloodMode => '强制泛洪模式'; - - @override - String get repeater_pathManagement => '路径管理'; - @override String get repeater_refresh => '刷新'; @@ -4086,4 +4126,28 @@ class AppLocalizationsZh extends AppLocalizations { @override String get contact_typeUnknown => 'Unknown'; + + @override + String get map_zoomIn => 'Zoom in'; + + @override + String get map_zoomOut => 'Zoom out'; + + @override + String get map_centerMap => 'Center map'; + + @override + String get chrome_bluetoothRequiresChromium => + 'Web Bluetooth requires a Chromium browser'; + + @override + String channels_communityShortId(String id) { + return 'ID: $id...'; + } + + @override + String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + + @override + String get pathTrace_legendInferred => 'Inferred position'; } diff --git a/lib/main.dart b/lib/main.dart index 37aa29ff..1445bdde 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -24,11 +24,21 @@ import 'services/translation_service.dart'; import 'services/ui_view_state_service.dart'; import 'services/timeout_prediction_service.dart'; import 'storage/prefs_manager.dart'; +import 'theme/mesh_theme.dart'; import 'utils/app_logger.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + // On desktop, debugPrint is not suppressed in release builds and every + // call is a synchronous stdout write. The connector logs heavily on hot + // paths (frame handling, queue/channel sync), which shows up as syscall + // overhead on low-end Linux machines (issue #202). The in-app debug log + // screens are unaffected — they store entries themselves. + if (kReleaseMode) { + debugPrint = (String? message, {int? wrapWidth}) {}; + } + // Initialize SharedPreferences cache await PrefsManager.initialize(); @@ -191,23 +201,8 @@ class MeshCoreApp extends StatelessWidget { locale: _localeFromSetting( settingsService.settings.languageOverride, ), - theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue), - useMaterial3: true, - snackBarTheme: const SnackBarThemeData( - behavior: SnackBarBehavior.floating, - ), - ), - darkTheme: ThemeData( - colorScheme: ColorScheme.fromSeed( - seedColor: Colors.blue, - brightness: Brightness.dark, - ), - useMaterial3: true, - snackBarTheme: const SnackBarThemeData( - behavior: SnackBarBehavior.floating, - ), - ), + theme: MeshTheme.light(), + darkTheme: MeshTheme.dark(), themeMode: _themeModeFromSetting( settingsService.settings.themeMode, ), diff --git a/lib/screens/app_debug_log_screen.dart b/lib/screens/app_debug_log_screen.dart index ca6a6bf1..719e5735 100644 --- a/lib/screens/app_debug_log_screen.dart +++ b/lib/screens/app_debug_log_screen.dart @@ -63,7 +63,7 @@ class AppDebugLogScreen extends StatelessWidget { final entry = entries[index]; return ListTile( dense: true, - leading: _buildLevelIcon(entry.level), + leading: _buildLevelIcon(context, entry.level), title: Text( '[${entry.tag}] ${entry.message}', style: const TextStyle( @@ -75,7 +75,7 @@ class AppDebugLogScreen extends StatelessWidget { entry.formattedTime, style: TextStyle( fontSize: 10, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ); @@ -88,14 +88,14 @@ class AppDebugLogScreen extends StatelessWidget { Icon( Icons.bug_report_outlined, size: 64, - color: Colors.grey[400], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), const SizedBox(height: 16), Text( context.l10n.debugLog_noEntries, style: TextStyle( fontSize: 16, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), const SizedBox(height: 8), @@ -103,7 +103,7 @@ class AppDebugLogScreen extends StatelessWidget { context.l10n.debugLog_enableInSettings, style: TextStyle( fontSize: 12, - color: Colors.grey[500], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -115,18 +115,19 @@ class AppDebugLogScreen extends StatelessWidget { ); } - Widget _buildLevelIcon(AppDebugLogLevel level) { + Widget _buildLevelIcon(BuildContext context, AppDebugLogLevel level) { + final colorScheme = Theme.of(context).colorScheme; switch (level) { case AppDebugLogLevel.info: - return const Icon(Icons.info_outline, size: 18, color: Colors.blue); + return Icon(Icons.info_outline, size: 18, color: colorScheme.primary); case AppDebugLogLevel.warning: - return const Icon( + return Icon( Icons.warning_amber_outlined, size: 18, - color: Colors.orange, + color: colorScheme.tertiary, ); case AppDebugLogLevel.error: - return const Icon(Icons.error_outline, size: 18, color: Colors.red); + return Icon(Icons.error_outline, size: 18, color: colorScheme.error); } } } diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 9b0fb378..76ce1f07 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -92,11 +92,29 @@ class AppSettingsScreen extends StatelessWidget { ListTile( leading: const Icon(Icons.brightness_6_outlined), title: Text(context.l10n.appSettings_theme), - subtitle: Text( - _themeModeLabel(context, settingsService.settings.themeMode), + subtitle: Padding( + padding: const EdgeInsets.only(top: 8), + child: SegmentedButton( + segments: [ + ButtonSegment( + value: 'system', + label: Text(context.l10n.appSettings_themeSystem), + ), + ButtonSegment( + value: 'light', + label: Text(context.l10n.appSettings_themeLight), + ), + ButtonSegment( + value: 'dark', + label: Text(context.l10n.appSettings_themeDark), + ), + ], + selected: {settingsService.settings.themeMode}, + onSelectionChanged: (selection) { + settingsService.setThemeMode(selection.first); + }, + ), ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showThemeModeDialog(context, settingsService), ), const Divider(height: 1), ListTile( @@ -111,18 +129,6 @@ class AppSettingsScreen extends StatelessWidget { trailing: const Icon(Icons.chevron_right), onTap: () => _showLanguageDialog(context, settingsService), ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.location_searching), - title: Text(context.l10n.appSettings_enableMessageTracing), - subtitle: Text( - context.l10n.appSettings_enableMessageTracingSubtitle, - ), - value: settingsService.settings.enableMessageTracing, - onChanged: (value) { - settingsService.setEnableMessageTracing(value); - }, - ), ], ), ); @@ -189,14 +195,14 @@ class AppSettingsScreen extends StatelessWidget { Icons.message_outlined, color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), title: Text( context.l10n.appSettings_messageNotifications, style: TextStyle( color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), ), subtitle: Text( @@ -204,7 +210,7 @@ class AppSettingsScreen extends StatelessWidget { style: TextStyle( color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), ), value: settingsService.settings.notifyOnNewMessage, @@ -220,14 +226,14 @@ class AppSettingsScreen extends StatelessWidget { Icons.forum_outlined, color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), title: Text( context.l10n.appSettings_channelMessageNotifications, style: TextStyle( color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), ), subtitle: Text( @@ -235,7 +241,7 @@ class AppSettingsScreen extends StatelessWidget { style: TextStyle( color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), ), value: settingsService.settings.notifyOnNewChannelMessage, @@ -251,14 +257,14 @@ class AppSettingsScreen extends StatelessWidget { Icons.cell_tower, color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), title: Text( context.l10n.appSettings_advertisementNotifications, style: TextStyle( color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), ), subtitle: Text( @@ -266,7 +272,7 @@ class AppSettingsScreen extends StatelessWidget { style: TextStyle( color: settingsService.settings.notificationsEnabled ? null - : Colors.grey, + : Theme.of(context).disabledColor, ), ), value: settingsService.settings.notifyOnNewAdvert, @@ -343,10 +349,16 @@ class AppSettingsScreen extends StatelessWidget { ); }, ), - if (settingsService.settings.autoRouteRotationEnabled) ...[ - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_maxRouteWeight), + if (settingsService.settings.autoRouteRotationEnabled) + Container( + color: Theme.of(context).colorScheme.surfaceContainerHighest, + padding: const EdgeInsets.only(left: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(height: 1), + ListTile( + title: Text(context.l10n.appSettings_maxRouteWeight), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -454,7 +466,21 @@ class AppSettingsScreen extends StatelessWidget { ], ), ), - ], + ], + ), + ), + const Divider(height: 1), + SwitchListTile( + secondary: const Icon(Icons.location_searching), + title: Text(context.l10n.appSettings_enableMessageTracing), + subtitle: Text( + context.l10n.appSettings_enableMessageTracingSubtitle, + ), + value: settingsService.settings.enableMessageTracing, + onChanged: (value) { + settingsService.setEnableMessageTracing(value); + }, + ), ], ), ); @@ -584,15 +610,15 @@ class AppSettingsScreen extends StatelessWidget { SwitchListTile( secondary: Icon( Icons.auto_awesome_outlined, - color: translationEnabled ? null : Colors.grey, + color: translationEnabled ? null : Theme.of(context).disabledColor, ), title: Text( context.l10n.translation_autoIncomingTitle, - style: TextStyle(color: translationEnabled ? null : Colors.grey), + style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), ), subtitle: Text( context.l10n.translation_autoIncomingSubtitle, - style: TextStyle(color: translationEnabled ? null : Colors.grey), + style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), ), value: settings.autoTranslateIncomingMessages, onChanged: translationEnabled @@ -603,15 +629,15 @@ class AppSettingsScreen extends StatelessWidget { SwitchListTile( secondary: Icon( Icons.outgoing_mail, - color: translationEnabled ? null : Colors.grey, + color: translationEnabled ? null : Theme.of(context).disabledColor, ), title: Text( context.l10n.translation_composerTitle, - style: TextStyle(color: translationEnabled ? null : Colors.grey), + style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), ), subtitle: Text( context.l10n.translation_composerSubtitle, - style: TextStyle(color: translationEnabled ? null : Colors.grey), + style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), ), value: settings.composerTranslationEnabled, onChanged: translationEnabled @@ -871,61 +897,6 @@ class AppSettingsScreen extends StatelessWidget { ); } - void _showThemeModeDialog( - BuildContext context, - AppSettingsService settingsService, - ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_theme), - content: RadioGroup( - groupValue: settingsService.settings.themeMode, - onChanged: (value) { - if (value != null) { - settingsService.setThemeMode(value); - Navigator.pop(context); - } - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - RadioListTile( - title: Text(context.l10n.appSettings_themeSystem), - value: 'system', - ), - RadioListTile( - title: Text(context.l10n.appSettings_themeLight), - value: 'light', - ), - RadioListTile( - title: Text(context.l10n.appSettings_themeDark), - value: 'dark', - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), - ), - ], - ), - ); - } - - String _themeModeLabel(BuildContext context, String value) { - switch (value) { - case 'light': - return context.l10n.appSettings_themeLight; - case 'dark': - return context.l10n.appSettings_themeDark; - default: - return context.l10n.appSettings_themeSystem; - } - } - String _languageLabel(BuildContext context, String? languageCode) { switch (languageCode) { case 'en': diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index b5e151bd..c43c6c67 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -5,7 +5,7 @@ import 'dart:math' as math; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; -import 'package:intl/intl.dart'; +import 'package:intl/intl.dart' hide TextDirection; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; @@ -25,8 +25,9 @@ import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/chat_text_scale_service.dart'; import '../services/translation_service.dart'; -import '../utils/emoji_utils.dart'; +import '../helpers/contact_ui.dart'; import '../widgets/byte_count_input.dart'; +import '../widgets/empty_state.dart'; import '../widgets/chat_zoom_wrapper.dart'; import '../widgets/emoji_picker.dart'; import '../widgets/gif_message.dart'; @@ -283,6 +284,8 @@ class _ChannelChatScreenState extends State { ) : widget.channel.name, style: const TextStyle(fontSize: 16), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), Consumer( builder: (context, connector, _) { @@ -311,9 +314,7 @@ class _ChannelChatScreenState extends State { icon: const Icon(Icons.more_vert), onSelected: (value) { if (value == 'clearChat') { - context.read().clearMessagesForChannel( - widget.channel.index, - ); + _confirmClearChat(); } }, itemBuilder: (context) => [ @@ -321,11 +322,17 @@ class _ChannelChatScreenState extends State { value: 'clearChat', child: Row( children: [ - const Icon(Icons.delete, size: 20, color: Colors.red), + Icon( + Icons.delete, + size: 20, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 12), Text( context.l10n.contact_clearChat, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), ), ], ), @@ -344,34 +351,17 @@ class _ChannelChatScreenState extends State { final messages = connector.getChannelMessages(widget.channel); if (messages.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - widget.channel.isPublicChannel - ? Icons.public - : Icons.tag, - size: 64, - color: Colors.grey[400], - ), - const SizedBox(height: 16), - Text( - context.l10n.chat_noMessages, - style: TextStyle( - fontSize: 16, - color: Colors.grey[600], - ), - ), - const SizedBox(height: 8), - Text( - context.l10n.chat_sendMessageToStart, - style: TextStyle( - fontSize: 14, - color: Colors.grey[500], - ), - ), - ], + return EmptyState( + icon: widget.channel.isPublicChannel + ? Icons.public + : Icons.tag, + title: context.l10n.chat_noMessages, + subtitle: context.l10n.chat_sendMessageTo( + widget.channel.name.isEmpty + ? context.l10n.channels_channelIndex( + widget.channel.index, + ) + : widget.channel.name, ), ); } @@ -381,6 +371,25 @@ class _ChannelChatScreenState extends State { final itemCount = reversedMessages.length + (_isLoadingOlder ? 1 : 0); + // Prune stale keys (deleted/cleared messages) to avoid + // unbounded growth. + final liveIds = reversedMessages + .map((m) => m.messageId) + .toSet(); + _messageKeys.removeWhere((id, _) => !liveIds.contains(id)); + + // Two messages can collide on messageId (same ms + name/text + // hash). Only the first occurrence owns the shared GlobalKey + // used for scroll-to-message; duplicates get a local key so + // no two widgets share one GlobalKey. + final seenIds = {}; + final keyedIndices = {}; + for (var i = 0; i < reversedMessages.length; i++) { + if (seenIds.add(reversedMessages[i].messageId)) { + keyedIndices.add(i); + } + } + // Auto-scroll to bottom if user is already at bottom WidgetsBinding.instance.addPostFrameCallback((_) { if (_channelSkipNextBottomSnap) { @@ -416,14 +425,20 @@ class _ChannelChatScreenState extends State { } final messageIndex = index; final message = reversedMessages[messageIndex]; - if (!_messageKeys.containsKey(message.messageId)) { - _messageKeys[message.messageId] = GlobalKey(); + final GlobalKey messageKey; + if (keyedIndices.contains(messageIndex)) { + messageKey = _messageKeys.putIfAbsent( + message.messageId, + GlobalKey.new, + ); + } else { + messageKey = GlobalKey(); } final isUnreadAnchor = _unreadDividerMessageId != null && message.messageId == _unreadDividerMessageId; return Container( - key: _messageKeys[message.messageId]!, + key: messageKey, child: Builder( builder: (context) { final textScale = context @@ -495,7 +510,8 @@ class _ChannelChatScreenState extends State { const maxSwipeOffset = 64.0; const replySwipeThreshold = 64.0; const bodyFontSize = 14.0; - final messageBody = Column( + final messageBody = LayoutBuilder( + builder: (context, constraints) => Column( crossAxisAlignment: isOutgoing ? CrossAxisAlignment.end : CrossAxisAlignment.start, @@ -512,9 +528,6 @@ class _ChannelChatScreenState extends State { ], Flexible( child: GestureDetector( - onTap: PlatformInfo.isDesktop - ? null - : () => _showMessagePathInfo(message), onLongPress: () => _showMessageActions(message), onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => _showMessageActions(message) @@ -524,7 +537,7 @@ class _ChannelChatScreenState extends State { ? const EdgeInsets.all(4) : const EdgeInsets.symmetric(horizontal: 12, vertical: 8), constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width * 0.65, + maxWidth: constraints.maxWidth * 0.65, ), decoration: BoxDecoration( color: isOutgoing @@ -566,20 +579,6 @@ class _ChannelChatScreenState extends State { isOutgoing, textScale, message.senderName, - trailing: (!enableTracing && isOutgoing) - ? Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isFailed: - message.status == - ChannelMessageStatus.failed, - ), - ) - : null, ) else if (gifId != null) Stack( @@ -599,36 +598,6 @@ class _ChannelChatScreenState extends State { .withValues(alpha: 0.6), ), ), - if (!enableTracing && isOutgoing) - Positioned( - top: 0, - right: 0, - child: Container( - padding: const EdgeInsets.all(3), - decoration: BoxDecoration( - color: isOutgoing - ? Theme.of( - context, - ).colorScheme.primaryContainer - : Theme.of( - context, - ).colorScheme.surfaceContainerHighest, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(10), - topRight: Radius.circular(8), - ), - ), - child: MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isFailed: - message.status == - ChannelMessageStatus.failed, - ), - ), - ), ], ) else @@ -651,97 +620,89 @@ class _ChannelChatScreenState extends State { ), ), ), - if (!enableTracing && isOutgoing) ...[ - const SizedBox(width: 4), - Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isFailed: - message.status == - ChannelMessageStatus.failed, + ], + ), + if (enableTracing && displayPath.isNotEmpty) ...[ + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.symmetric(horizontal: 8) + : EdgeInsets.zero, + child: Text( + context.l10n.channels_via( + _formatPathPrefixes(displayPath), + ), + style: TextStyle( + fontSize: 11 * textScale, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), + ), + ), + ], + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + right: 8, + bottom: 4, + ) + : EdgeInsets.zero, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + _formatTime(context, message.timestamp), + style: TextStyle( + fontSize: 11 * textScale, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), + ), + if (enableTracing && message.repeatCount > 0) ...[ + const SizedBox(width: 6), + Icon( + Icons.repeat, + size: 12 * textScale, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), + const SizedBox(width: 2), + Text( + '${message.repeatCount}', + style: TextStyle( + fontSize: 11 * textScale, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), ], + if (isOutgoing) ...[ + const SizedBox(width: 4), + MessageStatusIcon( + isAcked: + message.status == + ChannelMessageStatus.sent, + isRepeated: + message.status == + ChannelMessageStatus.sent && + displayPath.isNotEmpty, + isPending: + message.status == + ChannelMessageStatus.pending, + isFailed: + message.status == + ChannelMessageStatus.failed, + ), + ], ], ), - if (enableTracing) ...[ - if (displayPath.isNotEmpty) ...[ - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.symmetric(horizontal: 8) - : EdgeInsets.zero, - child: Text( - context.l10n.channels_via( - _formatPathPrefixes(displayPath), - ), - style: TextStyle( - fontSize: 11, - color: Colors.grey[600], - ), - ), - ), - ], - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - right: 8, - bottom: 4, - ) - : EdgeInsets.zero, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - _formatTime(context, message.timestamp), - style: TextStyle( - fontSize: 11, - color: Colors.grey[600], - ), - ), - if (message.repeatCount > 0) ...[ - const SizedBox(width: 6), - Icon( - Icons.repeat, - size: 12, - color: Colors.grey[600], - ), - const SizedBox(width: 2), - Text( - '${message.repeatCount}', - style: TextStyle( - fontSize: 11, - color: Colors.grey[600], - ), - ), - ], - if (isOutgoing) ...[ - const SizedBox(width: 4), - Icon( - message.status == ChannelMessageStatus.sent - ? Icons.check - : message.status == - ChannelMessageStatus.pending - ? Icons.schedule - : Icons.error_outline, - size: 14, - color: - message.status == - ChannelMessageStatus.failed - ? Colors.red - : Colors.grey[600], - ), - ], - ], - ), - ), - ], + ), ], ), ), @@ -757,6 +718,7 @@ class _ChannelChatScreenState extends State { ), ], ], + ), ); if (!isOutgoing && !PlatformInfo.isDesktop) { @@ -958,9 +920,9 @@ class _ChannelChatScreenState extends State { IconButton( icon: Icon(Icons.location_on_outlined, color: channelColor), padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: 32, minHeight: 32), + constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () { - final selfName = context.read().selfName ?? 'Me'; + final selfName = context.read().selfName ?? context.l10n.chat_me; final fromName = isOutgoing ? selfName : senderName; final key = buildSharedMarkerKey( sourceId: 'channel:${widget.channel.index}', @@ -1020,8 +982,8 @@ class _ChannelChatScreenState extends State { } Widget _buildAvatar(String senderName) { - final initial = _getFirstCharacterOrEmoji(senderName); - final color = _getColorForName(senderName); + final initial = firstCharacterOrEmoji(senderName); + final color = colorForName(senderName); return CircleAvatar( radius: 18, @@ -1037,36 +999,6 @@ class _ChannelChatScreenState extends State { ); } - String _getFirstCharacterOrEmoji(String name) { - if (name.isEmpty) return '?'; - - final emoji = firstEmoji(name); - if (emoji != null) return emoji; - - final runes = name.runes.toList(); - if (runes.isEmpty) return '?'; - return String.fromCharCode(runes[0]).toUpperCase(); - } - - Color _getColorForName(String name) { - // Generate a consistent color based on the name hash - final hash = name.hashCode; - final colors = [ - Colors.blue, - Colors.green, - Colors.orange, - Colors.purple, - Colors.pink, - Colors.teal, - Colors.indigo, - Colors.cyan, - Colors.amber, - Colors.deepOrange, - ]; - - return colors[hash.abs() % colors.length]; - } - Widget _buildReplyBanner(double textScale) { final message = _replyingToMessage!; return Container( @@ -1116,8 +1048,7 @@ class _ChannelChatScreenState extends State { icon: const Icon(Icons.close, size: 18), onPressed: _cancelReply, color: Theme.of(context).colorScheme.onSecondaryContainer, - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), ), ], ), @@ -1412,15 +1343,14 @@ class _ChannelChatScreenState extends State { _setReplyingTo(message); }, ), - if (PlatformInfo.isDesktop) - ListTile( - leading: const Icon(Icons.route), - title: Text(context.l10n.chat_path), - onTap: () { - Navigator.pop(sheetContext); - _showMessagePathInfo(message); - }, - ), + ListTile( + leading: const Icon(Icons.route), + title: Text(context.l10n.chat_path), + onTap: () { + Navigator.pop(sheetContext); + _showMessagePathInfo(message); + }, + ), // Can't react to your own messages if (!message.isOutgoing) ListTile( @@ -1463,19 +1393,21 @@ class _ChannelChatScreenState extends State { _markAsUnread(message); }, ), + const Divider(), ListTile( - leading: const Icon(Icons.delete_outline), - title: Text(context.l10n.common_delete), + leading: Icon( + Icons.delete_outline, + color: Theme.of(context).colorScheme.error, + ), + title: Text( + context.l10n.common_delete, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), onTap: () async { Navigator.pop(sheetContext); await _deleteMessage(message); }, ), - ListTile( - leading: const Icon(Icons.close), - title: Text(context.l10n.common_cancel), - onTap: () => Navigator.pop(sheetContext), - ), ], ), ), @@ -1516,6 +1448,34 @@ class _ChannelChatScreenState extends State { ); } + Future _confirmClearChat() async { + final confirmed = await showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.contact_clearChat), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(context.l10n.common_cancel), + ), + TextButton( + onPressed: () => Navigator.pop(dialogContext, true), + style: TextButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.error, + ), + child: Text(context.l10n.common_delete), + ), + ], + ), + ); + if (confirmed == true) { + if (!mounted) return; + context.read().clearMessagesForChannel( + widget.channel.index, + ); + } + } + Future _deleteMessage(ChannelMessage message) async { await context.read().deleteChannelMessage(message); if (!mounted) return; @@ -1557,6 +1517,7 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { double _maxSwipeDistance = 0; int? _swipePointerId; bool _swipeLockedToHorizontal = false; + bool _isRtl = false; void _handleSwipeStart(Offset position) { _swipeStartPosition = position; @@ -1577,11 +1538,13 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { return; } - final dx = event.position.dx - _swipeStartPosition!.dx; + final rawDx = event.position.dx - _swipeStartPosition!.dx; + // In LTR swipe left (rawDx < 0) triggers reply; in RTL swipe right (rawDx > 0). + final signedDx = _isRtl ? rawDx : -rawDx; const axisLockThreshold = 12.0; if (!_swipeLockedToHorizontal) { - if (-dx < axisLockThreshold) { + if (signedDx < axisLockThreshold) { return; } _swipeLockedToHorizontal = true; @@ -1593,28 +1556,32 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { void _handleSwipeUpdate(Offset position) { if (_swipeStartPosition == null) return; - final dx = position.dx - _swipeStartPosition!.dx; - if (dx >= 0) return; + final rawDx = position.dx - _swipeStartPosition!.dx; + final signedDx = _isRtl ? rawDx : -rawDx; + if (signedDx <= 0) return; - if (-dx < 6) return; + if (signedDx < 6) return; - if (-dx > _maxSwipeDistance) { - _maxSwipeDistance = -dx; + if (signedDx > _maxSwipeDistance) { + _maxSwipeDistance = signedDx; } - final double clamped = dx.clamp(-widget.maxSwipeOffset, 0.0).toDouble(); + final double clamped = signedDx.clamp(0.0, widget.maxSwipeOffset); final adjusted = _applySwipeResistance(clamped, widget.maxSwipeOffset); - if (adjusted != _swipeOffset) { - setState(() => _swipeOffset = adjusted); + // Translate in the gesture direction: negative for LTR (left), positive for RTL (right). + final translationOffset = _isRtl ? adjusted : -adjusted; + if (translationOffset != _swipeOffset) { + setState(() => _swipeOffset = translationOffset); } } void _handleSwipePointerUp(Offset position) { if (_swipeLockedToHorizontal && _swipeStartPosition != null) { - final dx = position.dx - _swipeStartPosition!.dx; + final rawDx = position.dx - _swipeStartPosition!.dx; + final signedDx = _isRtl ? rawDx : -rawDx; final peak = math.max( _maxSwipeDistance, - (-dx).clamp(0.0, double.infinity), + signedDx.clamp(0.0, double.infinity), ); if (peak >= widget.replySwipeThreshold) { widget.onReplyTriggered(); @@ -1654,6 +1621,10 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { @override Widget build(BuildContext context) { + _isRtl = Directionality.of(context) == TextDirection.rtl; + // In LTR, the bubble slides left and the hint appears on the right (isStart: false). + // In RTL, the bubble slides right and the hint appears on the left (isStart: true). + final hintIsStart = _isRtl; return Listener( onPointerDown: _handleSwipePointerDown, onPointerMove: _handleSwipePointerMove, @@ -1667,7 +1638,7 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { Positioned.fill( child: Opacity( opacity: _swipeOffset.abs() / widget.maxSwipeOffset, - child: widget.hintBuilder(isStart: false), + child: widget.hintBuilder(isStart: hintIsStart), ), ), AnimatedContainer( diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index afb2b906..6e9f3882 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -106,7 +106,7 @@ class ChannelMessagePathScreen extends StatelessWidget { if (!hasHopDetails) Text( l10n.channelPath_noHopDetails, - style: const TextStyle(color: Colors.grey), + style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant), ) else ..._buildHopTiles(context, hops), @@ -131,22 +131,25 @@ class ChannelMessagePathScreen extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 8), - _buildDetailRow(l10n.channelPath_senderLabel, message.senderName), + _buildDetailRow(context, l10n.channelPath_senderLabel, message.senderName), _buildDetailRow( + context, l10n.channelPath_timeLabel, _formatTime(message.timestamp, l10n), ), if (message.repeatCount > 0) _buildDetailRow( + context, l10n.channelPath_repeatsLabel, message.repeatCount.toString(), ), _buildDetailRow( + context, l10n.channelPath_pathLabelTitle, _formatPathLabel(message.pathLength, l10n), ), if (observedLabel != null) - _buildDetailRow(l10n.channelPath_observedLabel, observedLabel), + _buildDetailRow(context, l10n.channelPath_observedLabel, observedLabel), ], ), ), @@ -250,7 +253,7 @@ class ChannelMessagePathScreen extends StatelessWidget { return l10n.channelPath_observedSomeOf(observedCount, pathLength); } - Widget _buildDetailRow(String label, String value) { + Widget _buildDetailRow(BuildContext context, String label, String value) { return Padding( padding: const EdgeInsets.symmetric(vertical: 2), child: Row( @@ -258,7 +261,7 @@ class ChannelMessagePathScreen extends StatelessWidget { children: [ SizedBox( width: 70, - child: Text(label, style: TextStyle(color: Colors.grey[600])), + child: Text(label, style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant)), ), Expanded(child: Text(value)), ], @@ -412,17 +415,17 @@ class _ChannelMessagePathMapScreenState children: [ IconButton( icon: const Icon(Icons.add), - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( icon: const Icon(Icons.remove), - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( icon: const Icon(Icons.my_location), - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: () => _resetMapView( initialCenter: initialCenter, initialZoom: initialZoom, @@ -593,7 +596,7 @@ class _ChannelMessagePathMapScreenState if (points.isEmpty) Center( child: Card( - color: Colors.white.withValues(alpha: 0.9), + color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.9), child: Padding( padding: EdgeInsets.all(12), child: Text( @@ -664,7 +667,7 @@ class _ChannelMessagePathMapScreenState label, _formatPathPrefixes(selectedPath.pathBytes), ), - style: TextStyle(color: Colors.grey[700], fontSize: 12), + style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 12), ), ], ), @@ -685,28 +688,32 @@ class _ChannelMessagePathMapScreenState markers.add( Marker( point: point, - width: 35, - height: 35, - child: Container( - decoration: BoxDecoration( - color: Colors.green, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: Colors.green, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, ), - ], - ), - alignment: Alignment.center, - child: Text( - hop.index.toString(), - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -729,28 +736,32 @@ class _ChannelMessagePathMapScreenState markers.add( Marker( point: selfPoint, - width: 35, - height: 35, - child: Container( - decoration: BoxDecoration( - color: Colors.teal, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: Colors.teal, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + context.l10n.pathTrace_you, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, ), - ], - ), - alignment: Alignment.center, - child: Text( - context.l10n.pathTrace_you, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -804,6 +815,12 @@ class _ChannelMessagePathMapScreenState ); } + Widget _colorDot(Color color) => Container( + width: 10, + height: 10, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), + ); + Widget _buildLegendCard( BuildContext context, List<_PathHop> hops, @@ -826,9 +843,22 @@ class _ChannelMessagePathMapScreenState children: [ Padding( padding: const EdgeInsets.all(12), - child: Text( - '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistance, isImperial: isImperial)}', - style: const TextStyle(fontWeight: FontWeight.w600), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistance, isImperial: isImperial)}', + style: const TextStyle(fontWeight: FontWeight.w600), + ), + const SizedBox(height: 6), + Row( + children: [ + _colorDot(Colors.green), + const SizedBox(width: 4), + Text(l10n.pathTrace_legendGpsConfirmed, style: const TextStyle(fontSize: 11)), + ], + ), + ], ), ), const Divider(height: 1), diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 40726021..b725cc61 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -111,24 +111,26 @@ class _ChannelsScreenState extends State PopupMenuItem( child: Row( children: [ - const Icon(Icons.logout, color: Colors.red), + Icon( + Icons.logout, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.common_disconnect), ], ), onTap: () => _disconnect(context), ), - if (_communities.isNotEmpty) - PopupMenuItem( - child: Row( - children: [ - const Icon(Icons.groups), - const SizedBox(width: 8), - Text(context.l10n.community_manageCommunities), - ], - ), - onTap: () => _showManageCommunitiesDialog(context), + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.groups), + const SizedBox(width: 8), + Text(context.l10n.community_manageCommunities), + ], ), + onTap: () => _showManageCommunitiesDialog(context), + ), PopupMenuItem( child: Row( children: [ @@ -241,32 +243,22 @@ class _ChannelsScreenState extends State ), Expanded( child: filteredChannels.isEmpty - ? ListView( - children: [ - SizedBox( - height: MediaQuery.of(context).size.height - 300, - child: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.search_off, - size: 64, - color: Colors.grey[400], - ), - const SizedBox(height: 16), - Text( + ? LayoutBuilder( + builder: (context, constraints) => ListView( + physics: const AlwaysScrollableScrollPhysics(), + children: [ + ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: EmptyState( + icon: Icons.search_off, + title: context.l10n.channels_noChannelsFound, - style: TextStyle( - fontSize: 16, - color: Colors.grey[600], - ), - ), - ], ), ), - ), - ], + ], + ), ) : (viewState.channelsSortOption == ChannelSortOption.manual && @@ -357,6 +349,9 @@ class _ChannelsScreenState extends State int? dragIndex, }) { final unreadCount = connector.getUnreadCountForChannel(channel); + final isMuted = context.watch().isChannelMuted( + channel.name, + ); // Determine icon and colors based on channel type IconData icon; @@ -449,37 +444,45 @@ class _ChannelsScreenState extends State trailing: Row( mainAxisSize: MainAxisSize.min, children: [ + if (isMuted) ...[ + Icon( + Icons.notifications_off, + size: 14, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + const SizedBox(width: 4), + ], if (unreadCount > 0) ...[ UnreadBadge(count: unreadCount), const SizedBox(width: 4), ], if (showDragHandle && dragIndex != null) - ReorderableDelayedDragStartListener( + ReorderableDragStartListener( index: dragIndex, - child: Icon( - Icons.drag_handle, - color: Theme.of(context).colorScheme.onSurfaceVariant, + child: Padding( + padding: const EdgeInsets.all(12), + child: Icon( + Icons.drag_handle, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ), ], ), - onTap: () async { + onTap: () { final unread = connector.getUnreadCountForChannelIndex( channel.index, ); connector.markChannelRead(channel.index); - await Future.delayed(const Duration(milliseconds: 50)); - if (context.mounted) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChannelChatScreen( - channel: channel, - initialUnreadCount: unread, - ), + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChannelChatScreen( + channel: channel, + initialUnreadCount: unread, ), - ); - } + ), + ); }, onLongPress: () => _showChannelActions( context, @@ -540,10 +543,15 @@ class _ChannelsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.delete_outline, color: Colors.red), + leading: Icon( + Icons.delete_outline, + color: Theme.of(sheetContext).colorScheme.error, + ), title: Text( context.l10n.channels_deleteChannel, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(sheetContext).colorScheme.error, + ), ), onTap: () async { Navigator.pop(sheetContext); @@ -725,23 +733,39 @@ class _ChannelsScreenState extends State ? (isSelected ? Theme.of(dialogContext).colorScheme.primaryContainer : null) - : Colors.grey.withValues(alpha: 0.2), + : Theme.of( + dialogContext, + ).colorScheme.onSurface.withValues(alpha: 0.12), child: Icon( icon, color: enabled ? (isSelected ? Theme.of(dialogContext).colorScheme.primary : null) - : Colors.grey, + : Theme.of( + dialogContext, + ).colorScheme.onSurface.withValues(alpha: 0.38), ), ), title: Text( title, - style: TextStyle(color: enabled ? null : Colors.grey), + style: TextStyle( + color: enabled + ? null + : Theme.of( + dialogContext, + ).colorScheme.onSurface.withValues(alpha: 0.38), + ), ), subtitle: Text( subtitle, - style: TextStyle(color: enabled ? null : Colors.grey), + style: TextStyle( + color: enabled + ? null + : Theme.of( + dialogContext, + ).colorScheme.onSurface.withValues(alpha: 0.38), + ), ), trailing: enabled ? const Icon(Icons.chevron_right) : null, selected: isSelected, @@ -929,7 +953,7 @@ class _ChannelsScreenState extends State Channel.publicChannelPsk, ); Navigator.pop(dialogContext); - connector.setChannel(nextIndex, 'Public', psk); + connector.setChannel(nextIndex, context.l10n.channels_public, psk); if (context.mounted) { showDismissibleSnackBar( context, @@ -1043,7 +1067,9 @@ class _ChannelsScreenState extends State dialogContext.l10n.community_hashtagPrivacyHint, style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of( + dialogContext, + ).colorScheme.onSurfaceVariant, fontStyle: FontStyle.italic, ), ), @@ -1214,6 +1240,7 @@ class _ChannelsScreenState extends State child: FilledButton( onPressed: () async { final name = nameController.text.trim(); + final publicLabel = context.l10n.channels_public; if (name.isEmpty) { showDismissibleSnackBar( context, @@ -1238,7 +1265,7 @@ class _ChannelsScreenState extends State final psk = community .deriveCommunityPublicPsk(); final channelName = - '${community.name} Public'; + '${community.name} $publicLabel'; connector.setChannel( nextIndex, channelName, @@ -1594,7 +1621,7 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.common_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], @@ -1604,7 +1631,7 @@ class _ChannelsScreenState extends State void _addPublicChannel(BuildContext context, MeshCoreConnector connector) { final psk = Channel.parsePskHex(Channel.publicChannelPsk); - connector.setChannel(0, 'Public', psk); + connector.setChannel(0, context.l10n.channels_public, psk); showDismissibleSnackBar( context, content: Text(context.l10n.channels_publicChannelAdded), @@ -1653,14 +1680,19 @@ class _ChannelsScreenState extends State Icon( Icons.groups_outlined, size: 64, - color: Colors.grey[400], + color: Theme.of(context) + .colorScheme + .onSurfaceVariant + .withValues(alpha: 0.6), ), const SizedBox(height: 16), Text( context.l10n.community_noCommunities, style: TextStyle( fontSize: 16, - color: Colors.grey[600], + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), const SizedBox(height: 8), @@ -1668,7 +1700,10 @@ class _ChannelsScreenState extends State context.l10n.community_scanOrCreate, style: TextStyle( fontSize: 14, - color: Colors.grey[500], + color: Theme.of(context) + .colorScheme + .onSurfaceVariant + .withValues(alpha: 0.8), ), textAlign: TextAlign.center, ), @@ -1692,10 +1727,12 @@ class _ChannelsScreenState extends State ), title: Text(community.name), subtitle: Text( - 'ID: ${community.shortCommunityId}...', + context.l10n.channels_communityShortId(community.shortCommunityId), style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), trailing: PopupMenuButton( @@ -1722,14 +1759,20 @@ class _ChannelsScreenState extends State value: 'leave', child: Row( children: [ - const Icon( + Icon( Icons.exit_to_app, - color: Colors.red, + color: Theme.of( + context, + ).colorScheme.error, ), const SizedBox(width: 12), Text( context.l10n.community_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of( + context, + ).colorScheme.error, + ), ), ], ), @@ -1830,7 +1873,7 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.community_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 5e9f960e..b96095bf 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -5,7 +5,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; -import 'package:meshcore_open/screens/path_trace_map.dart'; import 'package:provider/provider.dart'; import '../utils/platform_info.dart'; @@ -15,35 +14,32 @@ import '../connector/meshcore_protocol.dart'; import '../helpers/cyr2lat.dart'; import '../helpers/reaction_helper.dart'; import '../widgets/message_status_icon.dart'; +import '../widgets/empty_state.dart'; import '../helpers/chat_scroll_controller.dart'; import '../helpers/gif_helper.dart'; -import '../helpers/path_helper.dart'; import '../models/channel_message.dart'; import '../models/contact.dart'; import '../l10n/contact_localization.dart'; import '../models/message.dart'; -import '../models/path_history.dart'; import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/chat_text_scale_service.dart'; import '../services/path_history_service.dart'; import '../services/translation_service.dart'; import '../widgets/chat_zoom_wrapper.dart'; -import '../widgets/elements_ui.dart'; import '../widgets/byte_count_input.dart'; import 'channel_message_path_screen.dart'; import 'map_screen.dart'; -import '../utils/emoji_utils.dart'; +import '../helpers/contact_ui.dart'; import '../widgets/emoji_picker.dart'; import '../widgets/gif_message.dart'; import '../widgets/jump_to_bottom_button.dart'; import '../widgets/gif_picker.dart'; import '../widgets/message_translation_button.dart'; -import '../widgets/path_selection_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../widgets/radio_stats_entry.dart'; import '../widgets/sync_progress_overlay.dart'; import '../widgets/translated_message_content.dart'; -import '../utils/app_logger.dart'; import '../l10n/l10n.dart'; import '../helpers/snack_bar_builder.dart'; import '../widgets/unread_divider.dart'; @@ -187,28 +183,26 @@ class _ChatScreenState extends State { final unreadLabel = context.l10n.chat_unread(unreadCount); final pathLabel = _currentPathLabel(contact); - // Show path details if we have non-empty path data (from device or override) - final effectivePath = contact.pathOverrideBytes ?? contact.path; - final hasPathData = effectivePath.isNotEmpty; - return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(contact.name), + Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), GestureDetector( behavior: HitTestBehavior.opaque, - onTap: hasPathData - ? () => _showFullPathDialog(context, effectivePath) - : null, - child: Text( - '$pathLabel • $unreadLabel', - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 11, - fontWeight: FontWeight.normal, - decoration: hasPathData ? TextDecoration.underline : null, - decorationStyle: TextDecorationStyle.dotted, + onTap: () => + ContactRoutingSheet.show(context, contact: contact), + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Text( + '$pathLabel • $unreadLabel', + overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontSize: 11, + fontWeight: FontWeight.normal, + decoration: TextDecoration.underline, + decorationStyle: TextDecorationStyle.dotted, + ), ), ), ), @@ -219,139 +213,44 @@ class _ChatScreenState extends State { centerTitle: false, bottom: const SyncProgressAppBarBottom(), actions: [ - Consumer( - builder: (context, connector, _) { - final contact = _resolveContact(connector); - final isFloodMode = contact.pathOverride == -1; - - final isDirectMode = contact.pathOverride == 0; - final activeMode = isFloodMode - ? 'flood' - : isDirectMode - ? 'direct' - : 'auto'; - - return PopupMenuButton( - icon: Icon(isFloodMode ? Icons.waves : Icons.route), - tooltip: context.l10n.chat_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(contact, pathLen: -1); - } else if (mode == 'direct') { - await connector.setPathOverride( - contact, - pathLen: 0, - pathBytes: Uint8List(0), - ); - } else { - await connector.setPathOverride(contact, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: activeMode == 'auto' - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - context.l10n.chat_autoUseSavedPath, - style: TextStyle( - fontWeight: activeMode == 'auto' - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'direct', - child: Row( - children: [ - Icon( - Icons.near_me, - size: 20, - color: activeMode == 'direct' - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - context.l10n.chat_direct, - style: TextStyle( - fontWeight: activeMode == 'direct' - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: activeMode == 'flood' - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - context.l10n.chat_forceFloodMode, - style: TextStyle( - fontWeight: activeMode == 'flood' - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ); - }, - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: context.l10n.chat_pathManagement, - onPressed: () => _showPathHistory(context), - ), const RadioStatsIconButton(), Consumer( builder: (context, connector, _) { + final contact = _resolveContact(connector); + return PopupMenuButton( icon: const Icon(Icons.more_vert), onSelected: (value) { - if (value == 'info') { - _showContactInfo(context); - } - if (value == 'settings') { - _showContactSettings(context); - } - if (value == 'telemetry') { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - TelemetryScreen(contact: widget.contact), - ), - ); - } - if (value == 'clearChat') { - connector.clearMessagesForContact(widget.contact); + switch (value) { + case 'routing': + ContactRoutingSheet.show(context, contact: contact); + case 'info': + _showContactInfo(context); + case 'settings': + _showContactSettings(context); + case 'telemetry': + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + TelemetryScreen(contact: widget.contact), + ), + ); + case 'clearChat': + _confirmClearChat(context, connector); } }, itemBuilder: (context) => [ + PopupMenuItem( + value: 'routing', + child: Row( + children: [ + const Icon(Icons.route, size: 20), + const SizedBox(width: 12), + Text(context.l10n.routing_title), + ], + ), + ), PopupMenuItem( value: 'info', child: Row( @@ -386,11 +285,17 @@ class _ChatScreenState extends State { value: 'clearChat', child: Row( children: [ - const Icon(Icons.delete, size: 20, color: Colors.red), + Icon( + Icons.delete, + size: 20, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 12), Text( context.l10n.contact_clearChat, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), ), ], ), @@ -425,24 +330,11 @@ class _ChatScreenState extends State { } Widget _buildEmptyState() { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.chat_bubble_outline, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - context.l10n.chat_noMessages, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - const SizedBox(height: 8), - Text( - context.l10n.chat_sendMessageTo( - _resolveContact(context.read()).name, - ), - style: TextStyle(fontSize: 14, color: Colors.grey[500]), - ), - ], + return EmptyState( + icon: Icons.chat_bubble_outline, + title: context.l10n.chat_noMessages, + subtitle: context.l10n.chat_sendMessageTo( + _resolveContact(context.read()).name, ), ); } @@ -514,7 +406,6 @@ class _ChatScreenState extends State { : contact.name, sourceId: widget.contact.publicKeyHex, textScale: textScale, - onTap: () => _openMessagePath(message, contact), onLongPress: () => _showMessageActions(message, contact), onRetryReaction: (msg, emoji) => _sendReaction(msg, contact, emoji), @@ -775,389 +666,32 @@ class _ChatScreenState extends State { ); } - void _showPathHistory(BuildContext context) { - final connector = Provider.of(context, listen: false); - bool showAllPaths = false; - showDialog( + Future _confirmClearChat( + BuildContext context, + MeshCoreConnector connector, + ) async { + final confirmed = await showDialog( context: context, - builder: (context) => StatefulBuilder( - builder: (context, setDialogState) => Consumer( - builder: (context, pathService, _) { - final paths = pathService.getRecentPaths( - widget.contact.publicKeyHex, - ); - - final repeatersList = List.of(connector.directRepeaters) - ..sort((a, b) => b.ranking.compareTo(a.ranking)); - - if (repeatersList.isEmpty) { - showAllPaths = true; - } - - final directRepeater = repeatersList.isEmpty - ? null - : repeatersList.first; - final secondDirectRepeater = repeatersList.length < 2 - ? null - : repeatersList.elementAt(1); - final thirdDirectRepeater = repeatersList.length < 3 - ? null - : repeatersList.elementAt(2); - - List>> - pathsWithRepeaters = paths.map((path) { - final isDirectRepeater = - directRepeater != null && - path.pathBytes.isNotEmpty && - directRepeater.pubkeyFirstByte == path.pathBytes.first; - final isSecondDirectRepeater = - secondDirectRepeater != null && - path.pathBytes.isNotEmpty && - secondDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - final isThirdDirectRepeater = - thirdDirectRepeater != null && - path.pathBytes.isNotEmpty && - thirdDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - - int ranking = -1; - Color color = Colors.grey; - if (isDirectRepeater) { - color = Colors.green; - ranking = 3; - } else if (isSecondDirectRepeater) { - color = Colors.yellow; - ranking = 2; - } else if (isThirdDirectRepeater) { - color = Colors.red; - ranking = 1; - } else if (path.wasFloodDiscovery) { - color = Colors.blue; - ranking = 0; - } - - return MapEntry(ranking, MapEntry(color, path)); - }).toList(); - - pathsWithRepeaters.sort((a, b) => b.key.compareTo(a.key)); - - return AlertDialog( - title: Row( - children: [ - const Icon(Icons.timeline), - const SizedBox(width: 8), - Text(context.l10n.chat_pathManagement), - ], - ), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (pathsWithRepeaters.isNotEmpty) ...[ - if (repeatersList.isNotEmpty) - FeatureToggleRow( - title: context.l10n.chat_ShowAllPaths, - subtitle: "", - value: showAllPaths, - onChanged: (val) { - setDialogState(() { - showAllPaths = val; - }); - }, - ), - Text( - context.l10n.chat_recentAckPaths, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - if (pathsWithRepeaters.length >= 100) ...[ - const SizedBox(height: 8), - Container( - width: double.infinity, - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - decoration: BoxDecoration( - color: Colors.amber[100], - borderRadius: BorderRadius.circular(8), - ), - child: Text( - context.l10n.chat_pathHistoryFull, - style: const TextStyle(fontSize: 12), - ), - ), - ], - const SizedBox(height: 8), - ...pathsWithRepeaters.map((entry) { - final path = entry.value.value; - final color = entry.value.key; - if (!showAllPaths && entry.key < 1) { - return const SizedBox.shrink(); - } else { - return Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: CircleAvatar( - radius: 16, - backgroundColor: color, - child: Text( - '${path.hopCount}', - style: const TextStyle(fontSize: 12), - ), - ), - title: Text( - '${path.hopCount} ${path.hopCount == 1 ? context.l10n.chat_hopSingular : context.l10n.chat_hopPlural}', - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - '${(path.tripTimeMs / 1000).toStringAsFixed(2)}s • ${_formatRelativeTime(path.timestamp)} • ${path.successCount} ${context.l10n.chat_successes}', - style: const TextStyle(fontSize: 11), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.close, size: 16), - tooltip: context.l10n.chat_removePath, - onPressed: () async { - await pathService.removePathRecord( - widget.contact.publicKeyHex, - path.pathBytes, - ); - }, - ), - path.wasFloodDiscovery - ? const Icon( - Icons.waves, - size: 16, - color: Colors.grey, - ) - : const Icon( - Icons.route, - size: 16, - color: Colors.grey, - ), - ], - ), - onLongPress: () => - _showFullPathDialog(context, path.pathBytes), - onTap: () async { - if (path.pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text( - context.l10n.chat_pathDetailsNotAvailable, - ), - duration: const Duration(seconds: 2), - ); - return; - } - - final pathBytes = Uint8List.fromList( - path.pathBytes, - ); - final pathLength = path.pathBytes.length; - - // Set the path override to persist user's choice - await connector.setPathOverride( - _resolveContact(connector), - pathLen: pathLength, - pathBytes: pathBytes, - ); - - if (!context.mounted) return; - Navigator.pop(context); - await _notifyPathSet( - connector, - _resolveContact(connector), - pathBytes, - path.hopCount, - ); - }, - ), - ); - } - }), - const Divider(), - ] else ...[ - Text(context.l10n.chat_noPathHistoryYet), - const Divider(), - ], - const SizedBox(height: 8), - Text( - context.l10n.chat_pathActions, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - const SizedBox(height: 8), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.purple, - child: Icon(Icons.edit_road, size: 16), - ), - title: Text( - context.l10n.chat_setCustomPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - context.l10n.chat_setCustomPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () { - Navigator.pop(context); - _showCustomPathDialog(context); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.orange, - child: Icon(Icons.clear_all, size: 16), - ), - title: Text( - context.l10n.chat_clearPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - context.l10n.chat_clearPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.clearContactPath( - _resolveContact(connector), - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_pathCleared), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.blue, - child: Icon(Icons.waves, size: 16), - ), - title: Text( - context.l10n.chat_forceFloodMode, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - context.l10n.chat_floodModeSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.setPathOverride( - _resolveContact(connector), - pathLen: -1, - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_floodModeEnabled), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), - ), - ], - ); - }, - ), - ), - ); - } - - String _formatRelativeTime(DateTime? time) { - if (time == null) return '—'; - final diff = DateTime.now().difference(time); - if (diff.inSeconds < 60) return context.l10n.time_justNow; - if (diff.inMinutes < 60) { - return context.l10n.time_minutesAgo(diff.inMinutes); - } - if (diff.inHours < 24) return context.l10n.time_hoursAgo(diff.inHours); - return context.l10n.time_daysAgo(diff.inDays); - } - - void _showFullPathDialog(BuildContext context, List pathBytes) { - if (pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_pathDetailsNotAvailable), - duration: const Duration(seconds: 2), - ); - return; - } - - final connector = context.read(); - final allContacts = connector.allContacts; - - final formattedPath = PathHelper.formatPathHex(pathBytes); - final resolvedNames = PathHelper.resolvePathNames(pathBytes, allContacts); - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.chat_fullPath), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText(formattedPath), - const SizedBox(height: 8), - SelectableText( - resolvedNames, - style: TextStyle( - fontSize: 13, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], - ), + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.contact_clearChat), actions: [ TextButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: context.l10n.contacts_repeaterPathTrace, - path: Uint8List.fromList(pathBytes), - flipPathAround: true, - targetContact: widget.contact, - pathHashByteWidth: connector.pathHashByteWidth, - ), - ), - ), - child: Text(context.l10n.contacts_pathTrace), + onPressed: () => Navigator.pop(dialogContext, false), + child: Text(context.l10n.common_cancel), ), TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), + onPressed: () => Navigator.pop(dialogContext, true), + style: TextButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.error, + ), + child: Text(context.l10n.common_delete), ), ], ), ); + if (confirmed == true) { + connector.clearMessagesForContact(widget.contact); + } } int _resolveContactIndex = -1; @@ -1202,29 +736,6 @@ class _ChatScreenState extends State { return context.l10n.chat_hopsCount(contact.pathLength); } - Future _notifyPathSet( - MeshCoreConnector connector, - Contact contact, - Uint8List pathBytes, - int hopCount, - ) async { - final verified = connector.isConnected - ? await connector.verifyContactPathOnDevice(contact, pathBytes) - : false; - if (!mounted) return; - - final status = !connector.isConnected - ? context.l10n.chat_pathSavedLocally - : (verified - ? context.l10n.chat_pathDeviceConfirmed - : context.l10n.chat_pathDeviceNotConfirmed); - showDismissibleSnackBar( - context, - content: Text(context.l10n.chat_pathSetHops(hopCount, status)), - duration: const Duration(seconds: 3), - ); - } - void _showContactInfo(BuildContext context) { final connector = Provider.of(context, listen: false); final contact = _resolveContact(connector); @@ -1439,7 +950,12 @@ class _ChatScreenState extends State { children: [ SizedBox( width: 80, - child: Text(label, style: TextStyle(color: Colors.grey[600])), + child: Text( + label, + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), ), Expanded(child: SelectableText(value)), ], @@ -1480,72 +996,6 @@ class _ChatScreenState extends State { ); } - Future _showCustomPathDialog(BuildContext context) async { - final connector = Provider.of(context, listen: false); - - final currentContact = _resolveContact(connector); - if (currentContact.pathLength > 0 && - currentContact.path.isEmpty && - connector.isConnected) { - connector.getContacts(); - } - - final pathForInput = currentContact.pathFormattedIdList( - connector.pathHashByteWidth, - ); - final currentPathLabel = _currentPathLabel(currentContact); - - // Filter out the current contact from available contacts - final availableContacts = connector.allContacts - .where((c) => c != widget.contact) - .toList(); - - final result = await PathSelectionDialog.show( - context, - availableContacts: availableContacts, - initialPath: pathForInput.isEmpty ? null : pathForInput, - title: context.l10n.chat_setCustomPath, - currentPathLabel: currentPathLabel, - onRefresh: connector.isConnected ? connector.getContacts : null, - ); - - appLogger.info( - 'PathSelectionDialog returned: ${result?.length ?? 0} bytes, mounted: $mounted', - tag: 'ChatScreen', - ); - - if (result == null) { - return; // Cancelled — keep existing path - } - - if (!mounted) { - appLogger.warn( - 'Widget not mounted after dialog, cannot set path', - tag: 'ChatScreen', - ); - return; - } - - appLogger.info( - 'Calling setPathOverride for ${widget.contact.name}', - tag: 'ChatScreen', - ); - await connector.setPathOverride( - _resolveContact(connector), - pathLen: result.length, - pathBytes: result, - ); - appLogger.info('setPathOverride completed', tag: 'ChatScreen'); - - if (!mounted) return; - await _notifyPathSet( - connector, - _resolveContact(connector), - result, - result.length, - ); - } - void _openMessagePath(Message message, Contact contact) { final connector = context.read(); final fourByteHex = message.fourByteRoomContactKey @@ -1605,15 +1055,14 @@ class _ChatScreenState extends State { _showEmojiPicker(message, contact); }, ), - if (PlatformInfo.isDesktop) - ListTile( - leading: const Icon(Icons.route), - title: Text(context.l10n.chat_path), - onTap: () { - Navigator.pop(sheetContext); - _openMessagePath(message, contact); - }, - ), + ListTile( + leading: const Icon(Icons.route), + title: Text(context.l10n.chat_path), + onTap: () { + Navigator.pop(sheetContext); + _openMessagePath(message, contact); + }, + ), ListTile( leading: const Icon(Icons.copy), title: Text(context.l10n.common_copy), @@ -1646,14 +1095,6 @@ class _ChatScreenState extends State { _markAsUnread(message); }, ), - ListTile( - leading: const Icon(Icons.delete_outline), - title: Text(context.l10n.common_delete), - onTap: () async { - Navigator.pop(sheetContext); - await _deleteMessage(message); - }, - ), if (message.isOutgoing && message.status == MessageStatus.failed) ListTile( leading: const Icon(Icons.refresh), @@ -1673,10 +1114,20 @@ class _ChatScreenState extends State { _openChat(context, contact); }, ), + const Divider(), ListTile( - leading: const Icon(Icons.close), - title: Text(context.l10n.common_cancel), - onTap: () => Navigator.pop(sheetContext), + leading: Icon( + Icons.delete_outline, + color: Theme.of(context).colorScheme.error, + ), + title: Text( + context.l10n.common_delete, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + onTap: () async { + Navigator.pop(sheetContext); + await _deleteMessage(message); + }, ), ], ), @@ -1703,8 +1154,7 @@ class _ChatScreenState extends State { void _retryMessage(Message message) { final connector = Provider.of(context, listen: false); - // Retry using the contact's current path override setting - connector.sendMessage(_resolveContact(connector), message.text); + connector.resendMessage(_resolveContact(connector), message); showDismissibleSnackBar( context, content: Text(context.l10n.chat_retryingMessage), @@ -1748,7 +1198,6 @@ class _ChatScreenState extends State { class _MessageBubble extends StatelessWidget { final Message message; final String senderName; - final VoidCallback? onTap; final VoidCallback? onLongPress; final void Function(Message message, String emoji)? onRetryReaction; final double textScale; @@ -1759,7 +1208,6 @@ class _MessageBubble extends StatelessWidget { required this.senderName, required this.sourceId, required this.textScale, - this.onTap, this.onLongPress, this.onRetryReaction, }); @@ -1801,8 +1249,8 @@ class _MessageBubble extends StatelessWidget { ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ - GestureDetector( - onTap: PlatformInfo.isDesktop ? null : onTap, + LayoutBuilder( + builder: (context, constraints) => GestureDetector( onLongPress: onLongPress, onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => onLongPress?.call() @@ -1826,11 +1274,14 @@ class _MessageBubble extends StatelessWidget { vertical: 8, ), constraints: BoxConstraints( - maxWidth: MediaQuery.of(context).size.width * 0.65, + maxWidth: constraints.maxWidth * 0.65, ), decoration: BoxDecoration( color: bubbleColor, borderRadius: BorderRadius.circular(16), + border: isFailed + ? Border.all(color: colorScheme.error) + : null, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -1863,20 +1314,6 @@ class _MessageBubble extends StatelessWidget { metaColor, textScale, senderName, - trailing: (!enableTracing && isOutgoing) - ? Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - MessageStatus.delivered && - message.pathBytes.isNotEmpty, - isFailed: - message.status == - MessageStatus.failed, - ), - ) - : null, ) else if (gifId != null) Stack( @@ -1892,30 +1329,6 @@ class _MessageBubble extends StatelessWidget { ), ), ), - if (!enableTracing && isOutgoing) - Positioned( - top: 0, - right: 0, - child: Container( - padding: const EdgeInsets.all(3), - decoration: BoxDecoration( - color: bubbleColor, - borderRadius: const BorderRadius.only( - bottomLeft: Radius.circular(10), - topRight: Radius.circular(12), - ), - ), - child: MessageStatusIcon( - isAcked: - message.status == - MessageStatus.delivered && - message.pathBytes.isNotEmpty, - isFailed: - message.status == - MessageStatus.failed, - ), - ), - ), ], ) else @@ -1937,94 +1350,95 @@ class _MessageBubble extends StatelessWidget { ), ), ), - if (!enableTracing && isOutgoing) ...[ + ], + ), + if (enableTracing && + isOutgoing && + message.retryCount > 0) ...[ + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.symmetric(horizontal: 8) + : EdgeInsets.zero, + child: Text( + context.l10n.chat_retryCount( + message.retryCount, + context + .read() + .settings + .maxMessageRetries, + ), + style: TextStyle( + fontSize: 10 * textScale, + color: metaColor, + fontWeight: FontWeight.w500, + ), + ), + ), + ], + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + right: 8, + bottom: 4, + ) + : EdgeInsets.zero, + child: Wrap( + spacing: 4, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + Text( + _formatTime(message.timestamp), + style: TextStyle( + fontSize: 10 * textScale, + color: metaColor, + ), + ), + if (isOutgoing) ...[ const SizedBox(width: 4), - Padding( - padding: const EdgeInsets.only(bottom: 2), - child: MessageStatusIcon( - isAcked: - message.status == - MessageStatus.delivered && - message.pathBytes.isNotEmpty, - isFailed: - message.status == MessageStatus.failed, + MessageStatusIcon( + size: 12 * textScale, + onColor: metaColor, + isAcked: + message.status == + MessageStatus.delivered, + isPending: + message.status == MessageStatus.pending, + isFailed: + message.status == MessageStatus.failed, + ), + ], + if (enableTracing && + message.tripTimeMs != null && + message.status == + MessageStatus.delivered) ...[ + const SizedBox(width: 4), + Icon( + Icons.speed, + size: 10 * textScale, + color: isOutgoing + ? metaColor + : Theme.of( + context, + ).colorScheme.tertiary, + ), + Text( + '${(message.tripTimeMs! / 1000).toStringAsFixed(1)}s', + style: TextStyle( + fontSize: 9 * textScale, + color: isOutgoing + ? metaColor + : Theme.of( + context, + ).colorScheme.tertiary, ), ), ], ], ), - if (enableTracing) ...[ - if (isOutgoing && message.retryCount > 0) ...[ - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.symmetric(horizontal: 8) - : EdgeInsets.zero, - child: Text( - context.l10n.chat_retryCount( - message.retryCount, - context - .read() - .settings - .maxMessageRetries, - ), - style: TextStyle( - fontSize: 10, - color: metaColor, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - right: 8, - bottom: 4, - ) - : EdgeInsets.zero, - child: Wrap( - spacing: 4, - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Text( - _formatTime(message.timestamp), - style: TextStyle( - fontSize: 10, - color: metaColor, - ), - ), - if (isOutgoing) ...[ - const SizedBox(width: 4), - _buildStatusIcon(metaColor), - ], - if (message.tripTimeMs != null && - message.status == - MessageStatus.delivered) ...[ - const SizedBox(width: 4), - Icon( - Icons.speed, - size: 10, - color: isOutgoing - ? metaColor - : Colors.green[700], - ), - Text( - '${(message.tripTimeMs! / 1000).toStringAsFixed(1)}s', - style: TextStyle( - fontSize: 9, - color: isOutgoing - ? metaColor - : Colors.green[700], - ), - ), - ], - ], - ), - ), - ], + ), ], ), ), @@ -2032,6 +1446,7 @@ class _MessageBubble extends StatelessWidget { ], ), ), + ), if (message.reactions.isNotEmpty) ...[ const SizedBox(height: 4), Padding( @@ -2059,9 +1474,9 @@ class _MessageBubble extends StatelessWidget { IconButton( icon: Icon(Icons.location_on_outlined, color: textColor), padding: EdgeInsets.zero, - constraints: const BoxConstraints(minWidth: 32, minHeight: 32), + constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () async { - final selfName = context.read().selfName ?? 'Me'; + final selfName = context.read().selfName ?? context.l10n.chat_me; final fromName = message.isOutgoing ? selfName : senderName; final key = buildSharedMarkerKey( sourceId: sourceId, @@ -2184,8 +1599,8 @@ class _MessageBubble extends StatelessWidget { } Widget _buildAvatar(String senderName, ColorScheme colorScheme) { - final initial = _getFirstCharacterOrEmoji(senderName); - final color = _getColorForName(senderName); + final initial = firstCharacterOrEmoji(senderName); + final color = colorForName(senderName); return CircleAvatar( radius: 18, @@ -2201,56 +1616,6 @@ class _MessageBubble extends StatelessWidget { ); } - String _getFirstCharacterOrEmoji(String name) { - if (name.isEmpty) return '?'; - - final emoji = firstEmoji(name); - if (emoji != null) return emoji; - - final runes = name.runes.toList(); - if (runes.isEmpty) return '?'; - return String.fromCharCode(runes[0]).toUpperCase(); - } - - Color _getColorForName(String name) { - // Generate a consistent color based on the name hash - final hash = name.hashCode; - final colors = [ - Colors.blue, - Colors.green, - Colors.orange, - Colors.purple, - Colors.pink, - Colors.teal, - Colors.indigo, - Colors.cyan, - Colors.amber, - Colors.deepOrange, - ]; - - return colors[hash.abs() % colors.length]; - } - - Widget _buildStatusIcon(Color color) { - IconData icon; - switch (message.status) { - case MessageStatus.pending: - icon = Icons.access_time; - break; - case MessageStatus.sent: - icon = Icons.schedule; - break; - case MessageStatus.delivered: - icon = Icons.check; - break; - case MessageStatus.failed: - icon = Icons.error_outline; - break; - } - - return Icon(icon, size: 12, color: color); - } - String _formatTime(DateTime time) { final hour = time.hour.toString().padLeft(2, '0'); final minute = time.minute.toString().padLeft(2, '0'); diff --git a/lib/screens/chrome_required_screen.dart b/lib/screens/chrome_required_screen.dart index 1827aeb9..53271d8f 100644 --- a/lib/screens/chrome_required_screen.dart +++ b/lib/screens/chrome_required_screen.dart @@ -8,34 +8,25 @@ class ChromeRequiredScreen extends StatelessWidget { Widget build(BuildContext context) { final l10n = context.l10n; final theme = Theme.of(context); - final isDark = theme.brightness == Brightness.dark; - + final colorScheme = theme.colorScheme; return Scaffold( body: Container( width: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 32), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: isDark - ? [const Color(0xFF1A1A1A), const Color(0xFF0D0D0D)] - : [const Color(0xFFF5F7FA), const Color(0xFFE4E7EB)], - ), - ), + color: colorScheme.surface, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( padding: const EdgeInsets.all(24), decoration: BoxDecoration( - color: Colors.orange.withValues(alpha: 0.1), + color: colorScheme.tertiaryContainer.withValues(alpha: 0.4), shape: BoxShape.circle, ), - child: const Icon( + child: Icon( Icons.browser_not_supported_rounded, size: 80, - color: Colors.orange, + color: colorScheme.tertiary, ), ), const SizedBox(height: 32), @@ -44,7 +35,7 @@ class ChromeRequiredScreen extends StatelessWidget { textAlign: TextAlign.center, style: theme.textTheme.headlineMedium?.copyWith( fontWeight: FontWeight.bold, - color: isDark ? Colors.white : Colors.black87, + color: colorScheme.onSurface, ), ), const SizedBox(height: 16), @@ -52,7 +43,7 @@ class ChromeRequiredScreen extends StatelessWidget { l10n.scanner_chromeRequiredMessage, textAlign: TextAlign.center, style: theme.textTheme.bodyLarge?.copyWith( - color: isDark ? Colors.white70 : Colors.black54, + color: colorScheme.onSurfaceVariant, height: 1.5, ), ), @@ -62,19 +53,19 @@ class ChromeRequiredScreen extends StatelessWidget { Container( padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), decoration: BoxDecoration( - color: Colors.blue.withValues(alpha: 0.1), + color: colorScheme.secondaryContainer.withValues(alpha: 0.4), borderRadius: BorderRadius.circular(30), - border: Border.all(color: Colors.blue.withValues(alpha: 0.3)), + border: Border.all(color: colorScheme.outline.withValues(alpha: 0.4)), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - const Icon(Icons.info_outline, size: 20, color: Colors.blue), + Icon(Icons.info_outline, size: 20, color: colorScheme.secondary), const SizedBox(width: 12), Text( - "Web Bluetooth requires a Chromium browser", + l10n.chrome_bluetoothRequiresChromium, style: theme.textTheme.bodyMedium?.copyWith( - color: Colors.blue, + color: colorScheme.onSecondaryContainer, fontWeight: FontWeight.w500, ), ), diff --git a/lib/screens/companion_radio_stats_screen.dart b/lib/screens/companion_radio_stats_screen.dart index 9c376769..f666254c 100644 --- a/lib/screens/companion_radio_stats_screen.dart +++ b/lib/screens/companion_radio_stats_screen.dart @@ -210,10 +210,10 @@ class _NoiseChartPainter extends CustomPainter { } final span = maxV - minV; - for (var i = 0; i <= 2; i++) { - final v = maxV - span * i / 2; + for (var i = 0; i <= 4; i++) { + final v = maxV - span * i / 4; final tp = _yAxisLabel(v); - final y = chart.top + (chart.height * i / 2) - tp.height / 2; + final y = chart.top + (chart.height * i / 4) - tp.height / 2; tp.paint(canvas, Offset(4, y)); } diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index bdadc2b6..d64b8dd1 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -29,6 +29,7 @@ import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; import '../widgets/sync_progress_overlay.dart'; import '../widgets/unread_badge.dart'; +import '../helpers/contact_ui.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; import 'chat_screen.dart'; @@ -59,7 +60,7 @@ class _ContactsScreenState extends State String _loadedGroupScopeKeyHex = ''; Timer? _searchDebounce; - final Set _pendingOperations = {}; + final List _pendingOperations = []; StreamSubscription? _frameSubscription; @@ -185,59 +186,52 @@ class _ContactsScreenState extends State Clipboard.setData(ClipboardData(text: "meshcore://$hexString")); } + // Generic OK/ERR acks carry no command correlation, so consume only + // the oldest pending operation per ack instead of clearing all. if (code == respCodeOk) { - // Show a snackbar indicating success if (!mounted) return; - - if (_pendingOperations.contains(ContactOperationType.import)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactImported), - ); + if (_pendingOperations.isEmpty) return; + final op = _pendingOperations.removeAt(0); + switch (op) { + case ContactOperationType.import: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImported), + ); + case ContactOperationType.zeroHopShare: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_zeroHopContactAdvertSent), + ); + case ContactOperationType.export: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactAdvertCopied), + ); } - - if (_pendingOperations.contains(ContactOperationType.zeroHopShare)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_zeroHopContactAdvertSent), - ); - } - - if (_pendingOperations.contains(ContactOperationType.export)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactAdvertCopied), - ); - } - - _pendingOperations.clear(); } if (code == respCodeErr) { - // Show a snackbar indicating failure if (!mounted) return; - - if (_pendingOperations.contains(ContactOperationType.import)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactImportFailed), - ); + if (_pendingOperations.isEmpty) return; + final op = _pendingOperations.removeAt(0); + switch (op) { + case ContactOperationType.import: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + case ContactOperationType.zeroHopShare: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_zeroHopContactAdvertFailed), + ); + case ContactOperationType.export: + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactAdvertCopyFailed), + ); } - - if (_pendingOperations.contains(ContactOperationType.zeroHopShare)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_zeroHopContactAdvertFailed), - ); - } - if (_pendingOperations.contains(ContactOperationType.export)) { - showDismissibleSnackBar( - context, - content: Text(context.l10n.contacts_contactAdvertCopyFailed), - ); - } - - _pendingOperations.clear(); } } catch (e) { appLogger.error( @@ -252,17 +246,37 @@ class _ContactsScreenState extends State final connector = Provider.of(context, listen: false); final exportContactFrame = buildExportContactFrame(pubKey); _pendingOperations.add(ContactOperationType.export); - await connector.sendFrame(exportContactFrame, expectsGenericAck: true); + try { + await connector.sendFrame(exportContactFrame, expectsGenericAck: true); + } catch (e) { + _pendingOperations.remove(ContactOperationType.export); + if (mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactAdvertCopyFailed), + ); + } + } } Future _contactZeroHop(Uint8List pubKey) async { final connector = Provider.of(context, listen: false); final exportContactZeroHopFrame = buildZeroHopContact(pubKey); _pendingOperations.add(ContactOperationType.zeroHopShare); - await connector.sendFrame( - exportContactZeroHopFrame, - expectsGenericAck: true, - ); + try { + await connector.sendFrame( + exportContactZeroHopFrame, + expectsGenericAck: true, + ); + } catch (e) { + _pendingOperations.remove(ContactOperationType.zeroHopShare); + if (mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_zeroHopContactAdvertFailed), + ); + } + } } Future _contactImport() async { @@ -288,11 +302,10 @@ class _ContactsScreenState extends State return; } final hexString = text.substring('meshcore://'.length); + final Uint8List importContactFrame; try { final bytes = hex2Uint8List(hexString); - final importContactFrame = buildImportContactFrame(bytes); - _pendingOperations.add(ContactOperationType.import); - connector.importContact(importContactFrame); + importContactFrame = buildImportContactFrame(bytes); } catch (e) { if (mounted) { showDismissibleSnackBar( @@ -300,6 +313,19 @@ class _ContactsScreenState extends State content: Text(context.l10n.contacts_invalidAdvertFormat), ); } + return; + } + _pendingOperations.add(ContactOperationType.import); + try { + await connector.sendFrame(importContactFrame, expectsGenericAck: true); + } catch (e) { + _pendingOperations.remove(ContactOperationType.import); + if (mounted) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + } } } @@ -322,7 +348,34 @@ class _ContactsScreenState extends State bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( - itemBuilder: (context) => [ + tooltip: context.l10n.contacts_moreOptions, + itemBuilder: (context) => >[ + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.person_add_rounded), + const SizedBox(width: 8), + Text(context.l10n.discoveredContacts_Title), + ], + ), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DiscoveryScreen(), + ), + ), + ), + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.paste), + const SizedBox(width: 8), + Text(context.l10n.contacts_addContactFromClipboard), + ], + ), + onTap: () => _contactImport(), + ), + const PopupMenuDivider(), PopupMenuItem( child: Row( children: [ @@ -365,46 +418,20 @@ class _ContactsScreenState extends State ), onTap: () => _contactExport(Uint8List.fromList([])), ), + const PopupMenuDivider(), PopupMenuItem( child: Row( children: [ - const Icon(Icons.paste), - const SizedBox(width: 8), - Text(context.l10n.contacts_addContactFromClipboard), - ], - ), - onTap: () => _contactImport(), - ), - ], - icon: const Icon(Icons.connect_without_contact), - ), - PopupMenuButton( - itemBuilder: (context) => [ - PopupMenuItem( - child: Row( - children: [ - const Icon(Icons.logout, color: Colors.red), + Icon( + Icons.logout, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.common_disconnect), ], ), onTap: () => _disconnect(context, connector), ), - PopupMenuItem( - child: Row( - children: [ - const Icon(Icons.person_add_rounded), - const SizedBox(width: 8), - Text(context.l10n.discoveredContacts_Title), - ], - ), - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const DiscoveryScreen(), - ), - ), - ), PopupMenuItem( child: Row( children: [ @@ -426,6 +453,10 @@ class _ContactsScreenState extends State ], ), body: _buildContactsBody(context, connector), + floatingActionButton: FloatingActionButton( + onPressed: () => _showAddContactSheet(context), + child: const Icon(Icons.person_add), + ), bottomNavigationBar: SafeArea( top: false, child: QuickSwitchBar( @@ -440,6 +471,40 @@ class _ContactsScreenState extends State ); } + void _showAddContactSheet(BuildContext context) { + showModalBottomSheet( + context: context, + builder: (sheetContext) => SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: const Icon(Icons.paste), + title: Text(context.l10n.contacts_addContactFromClipboard), + onTap: () { + Navigator.pop(sheetContext); + _contactImport(); + }, + ), + ListTile( + leading: const Icon(Icons.person_add_rounded), + title: Text(context.l10n.discoveredContacts_Title), + onTap: () { + Navigator.pop(sheetContext); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DiscoveryScreen(), + ), + ); + }, + ), + ], + ), + ), + ); + } + Future _disconnect( BuildContext context, MeshCoreConnector connector, @@ -571,7 +636,11 @@ class _ContactsScreenState extends State const SizedBox(width: 8), IconButton( tooltip: menuContext.l10n.contacts_deleteGroup, - icon: const Icon(Icons.delete, size: 20, color: Colors.red), + icon: Icon( + Icons.delete, + size: 20, + color: Theme.of(context).colorScheme.error, + ), onPressed: canManageGroups ? () => _closeDropdownAndRun( menuContext, @@ -589,16 +658,25 @@ class _ContactsScreenState extends State ], child: SizedBox( height: 48, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), - child: Row( - children: [ - Expanded( - child: Text(selectedGroupName, overflow: TextOverflow.ellipsis), - ), - const SizedBox(width: 8), - const Icon(Icons.arrow_drop_down), - ], + child: DecoratedBox( + decoration: BoxDecoration( + border: Border.all(color: Theme.of(context).colorScheme.outline), + borderRadius: BorderRadius.circular(12), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + children: [ + Expanded( + child: Text( + selectedGroupName, + overflow: TextOverflow.ellipsis, + ), + ), + const SizedBox(width: 8), + const Icon(Icons.arrow_drop_down), + ], + ), ), ), ), @@ -624,6 +702,16 @@ class _ContactsScreenState extends State icon: Icons.people_outline, title: context.l10n.contacts_noContacts, subtitle: context.l10n.contacts_contactsWillAppear, + action: FilledButton.icon( + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const DiscoveryScreen(), + ), + ), + icon: const Icon(Icons.person_add_rounded), + label: Text(context.l10n.discoveredContacts_Title), + ), ); } @@ -759,6 +847,9 @@ class _ContactsScreenState extends State width: 48, height: 48, child: IconButton( + tooltip: viewState.contactsSearchExpanded + ? context.l10n.contacts_searchClose + : context.l10n.contacts_searchOpen, onPressed: () { if (viewState.contactsSearchExpanded) { _collapseContactsSearch(viewState); @@ -791,25 +882,29 @@ class _ContactsScreenState extends State ), ), Expanded( - child: filteredAndSorted.isEmpty - ? Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.search_off, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - viewState.contactsShowUnreadOnly - ? context.l10n.contacts_noUnreadContacts - : context.l10n.contacts_noContactsFound, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - ], - ), - ) - : RefreshIndicator( - onRefresh: () => connector.getContacts(), - child: ListView.builder( + child: RefreshIndicator( + onRefresh: () => connector.getContacts(), + child: filteredAndSorted.isEmpty + ? LayoutBuilder( + builder: (context, constraints) => ListView( + physics: const AlwaysScrollableScrollPhysics(), + children: [ + ConstrainedBox( + constraints: BoxConstraints( + minHeight: constraints.maxHeight, + ), + child: EmptyState( + icon: Icons.search_off, + title: viewState.contactsShowUnreadOnly + ? context.l10n.contacts_noUnreadContacts + : context.l10n.contacts_noContactsFound, + ), + ), + ], + ), + ) + : ListView.builder( + padding: const EdgeInsets.only(bottom: 88), itemCount: filteredAndSorted.length, itemBuilder: (context, index) { final contact = filteredAndSorted[index]; @@ -827,7 +922,7 @@ class _ContactsScreenState extends State ); }, ), - ), + ), ), ], ); @@ -1048,7 +1143,7 @@ class _ContactsScreenState extends State }, child: Text( context.l10n.common_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], @@ -1359,14 +1454,6 @@ class _ContactsScreenState extends State ); }, ), - ListTile( - leading: const Icon(Icons.chat), - title: Text(context.l10n.contacts_openChat), - onTap: () { - Navigator.pop(sheetContext); - _openChat(context, contact); - }, - ), ], ListTile( leading: Icon( @@ -1403,10 +1490,15 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.delete, color: Colors.red), + leading: Icon( + Icons.delete, + color: Theme.of(context).colorScheme.error, + ), title: Text( context.l10n.contacts_deleteContact, - style: const TextStyle(color: Colors.red), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), ), onTap: () { Navigator.pop(sheetContext); @@ -1441,7 +1533,7 @@ class _ContactsScreenState extends State }, child: Text( context.l10n.common_delete, - style: const TextStyle(color: Colors.red), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], @@ -1473,25 +1565,14 @@ class _ContactTile extends StatelessWidget { onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => onLongPress() : null, child: ListTile( leading: CircleAvatar( - backgroundColor: _getTypeColor(contact.type), + backgroundColor: contactTypeColor(contact.type), child: _buildContactAvatar(contact), ), title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - contact.pathLabel(context.l10n), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - contact.shortPubKeyHex, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 12), - ), - ], + subtitle: Text( + contact.pathLabel(context.l10n), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), // Clamp text scaling in trailing section to prevent overflow while // maintaining accessibility. Primary content (title/subtitle) scales normally. @@ -1502,7 +1583,7 @@ class _ContactTile extends StatelessWidget { ), ), child: SizedBox( - width: 120, + width: 96, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, @@ -1516,7 +1597,10 @@ class _ContactTile extends StatelessWidget { maxLines: 1, overflow: TextOverflow.ellipsis, textAlign: TextAlign.right, - style: TextStyle(fontSize: 12, color: Colors.grey[600]), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), Row( mainAxisSize: MainAxisSize.min, @@ -1529,7 +1613,9 @@ class _ContactTile extends StatelessWidget { Icon( Icons.location_on, size: 14, - color: Colors.grey[400], + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant.withValues(alpha: 0.6), ), ], ), @@ -1548,37 +1634,7 @@ class _ContactTile extends StatelessWidget { if (emoji != null) { return Text(emoji, style: const TextStyle(fontSize: 18)); } - return Icon(_getTypeIcon(contact.type), color: Colors.white, size: 20); - } - - IconData _getTypeIcon(int type) { - switch (type) { - case advTypeChat: - return Icons.chat; - case advTypeRepeater: - return Icons.cell_tower; - case advTypeRoom: - return Icons.group; - case advTypeSensor: - return Icons.sensors; - default: - return Icons.device_unknown; - } - } - - Color _getTypeColor(int type) { - switch (type) { - case advTypeChat: - return Colors.blue; - case advTypeRepeater: - return Colors.orange; - case advTypeRoom: - return Colors.purple; - case advTypeSensor: - return Colors.green; - default: - return Colors.grey; - } + return Icon(contactTypeIcon(contact.type), color: Colors.white, size: 20); } String _formatLastSeen(BuildContext context, DateTime lastSeen) { diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index f9f0e07e..736e8f36 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -12,6 +12,7 @@ import '../utils/contact_search.dart'; import '../utils/platform_info.dart'; import '../widgets/app_bar.dart'; import '../widgets/list_filter_widget.dart'; +import '../helpers/contact_ui.dart'; import '../helpers/snack_bar_builder.dart'; enum DiscoverySortOption { lastSeen, name, type } @@ -71,7 +72,10 @@ class _DiscoveryScreenState extends State { PopupMenuItem( child: Row( children: [ - const Icon(Icons.delete, color: Colors.red), + Icon( + Icons.delete, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.discoveredContacts_deleteContactAll), ], @@ -99,9 +103,9 @@ class _DiscoveryScreenState extends State { final contact = filteredAndSorted[index]; final tile = ListTile( leading: CircleAvatar( - backgroundColor: _getTypeColor(contact.type), + backgroundColor: contactTypeColor(contact.type), child: Icon( - _getTypeIcon(contact.type), + contactTypeIcon(contact.type), color: Colors.white, size: 20, ), @@ -142,7 +146,9 @@ class _DiscoveryScreenState extends State { textAlign: TextAlign.right, style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), Row( @@ -152,7 +158,10 @@ class _DiscoveryScreenState extends State { Icon( Icons.location_on, size: 14, - color: Colors.grey[400], + color: Theme.of(context) + .colorScheme + .onSurfaceVariant + .withValues(alpha: 0.6), ), if (contact.rawPacket != null) const SizedBox(width: 2), @@ -160,7 +169,10 @@ class _DiscoveryScreenState extends State { Icon( Icons.cell_tower, size: 14, - color: Colors.grey[400], + color: Theme.of(context) + .colorScheme + .onSurfaceVariant + .withValues(alpha: 0.6), ), ], ), @@ -170,6 +182,17 @@ class _DiscoveryScreenState extends State { ), onTap: () { connector.importDiscoveredContact(contact); + showDismissibleSnackBar( + context, + content: Text( + context.l10n.discoveredContacts_contactAdded, + ), + action: SnackBarAction( + label: context.l10n.common_undo, + onPressed: () => + connector.removeContact(contact), + ), + ); }, onLongPress: () => _showContactContextMenu(contact, connector), @@ -203,11 +226,6 @@ class _DiscoveryScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - ListTile( - leading: const Icon(Icons.add_reaction_sharp), - title: Text(l10n.discoveredContacts_addContact), - onTap: () => Navigator.of(sheetContext).pop('import_contact'), - ), ListTile( leading: const Icon(Icons.copy), title: Text(l10n.discoveredContacts_copyContact), @@ -227,9 +245,6 @@ class _DiscoveryScreenState extends State { if (!mounted || action == null) return; switch (action) { - case 'import_contact': - connector.importDiscoveredContact(contact); - break; case 'copy_contact': if (contact.rawPacket == null) return; final hexString = pubKeyToHex(contact.rawPacket!); @@ -429,35 +444,6 @@ class _DiscoveryScreenState extends State { } } - IconData _getTypeIcon(int type) { - switch (type) { - case advTypeChat: - return Icons.chat; - case advTypeRepeater: - return Icons.cell_tower; - case advTypeRoom: - return Icons.group; - case advTypeSensor: - return Icons.sensors; - default: - return Icons.device_unknown; - } - } - - Color _getTypeColor(int type) { - switch (type) { - case advTypeChat: - return Colors.blue; - case advTypeRepeater: - return Colors.orange; - case advTypeRoom: - return Colors.purple; - case advTypeSensor: - return Colors.green; - default: - return Colors.grey; - } - } String _formatLastSeen(BuildContext context, DateTime lastSeen) { final now = DateTime.now(); diff --git a/lib/screens/line_of_sight_map_screen.dart b/lib/screens/line_of_sight_map_screen.dart index f908f5ea..1d63b910 100644 --- a/lib/screens/line_of_sight_map_screen.dart +++ b/lib/screens/line_of_sight_map_screen.dart @@ -73,7 +73,7 @@ class _LineOfSightMapScreenState extends State { double _startAntennaHeight = 5.0; double _endAntennaHeight = 5.0; bool _showHud = true; - bool _menuExpanded = true; + bool _menuExpanded = false; bool _showDisplayNodes = true; bool _showMarkerLabels = true; bool _didReceivePositionUpdate = false; @@ -159,17 +159,17 @@ class _LineOfSightMapScreenState extends State { children: [ IconButton( icon: const Icon(Icons.add), - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( icon: const Icon(Icons.remove), - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( icon: const Icon(Icons.my_location), - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: () => _resetMapView( initialCenter: initialCenter, initialZoom: initialZoom, @@ -224,6 +224,7 @@ class _LineOfSightMapScreenState extends State { setState(() { _result = result; _selectedObstruction = _defaultObstructionFor(result); + _menuExpanded = true; }); } catch (e) { if (!mounted) return; @@ -506,7 +507,7 @@ class _LineOfSightMapScreenState extends State { bottom: 12, child: DecoratedBox( decoration: BoxDecoration( - color: Colors.black54, + color: Theme.of(context).colorScheme.surfaceContainerHighest.withValues(alpha: 0.85), borderRadius: BorderRadius.circular(8), ), child: Padding( @@ -516,11 +517,18 @@ class _LineOfSightMapScreenState extends State { ), child: Text( context.l10n.losElevationAttribution, - style: const TextStyle(fontSize: 10, color: Colors.white), + style: TextStyle(fontSize: 10, color: Theme.of(context).colorScheme.onSurface), ), ), ), ), + if (_loading) + const Positioned( + left: 0, + right: 0, + top: 0, + child: LinearProgressIndicator(), + ), ], ), floatingActionButton: FloatingActionButton( @@ -623,7 +631,7 @@ class _LineOfSightMapScreenState extends State { const SizedBox(height: 4), Text( context.l10n.losBlockedSpotsHint, - style: TextStyle(fontSize: 11, color: Colors.grey[700]), + style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 6), Wrap( @@ -692,7 +700,7 @@ class _LineOfSightMapScreenState extends State { '${_selectedObstruction!.point.longitude.toStringAsFixed(5)}', style: TextStyle( fontSize: 11, - color: Colors.grey[700], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -711,14 +719,14 @@ class _LineOfSightMapScreenState extends State { context.l10n.losFrequencyLabel, style: TextStyle( fontSize: 11, - color: Colors.grey[700], + color: Theme.of(context).colorScheme.onSurfaceVariant, fontWeight: FontWeight.w600, ), ), const SizedBox(width: 8), Text( '${displayFrequencyMHz.toStringAsFixed(3)} MHz', - style: TextStyle(fontSize: 11, color: Colors.grey[700]), + style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), ), if (kFactorUsed != null) ...[ const SizedBox(width: 8), @@ -726,7 +734,7 @@ class _LineOfSightMapScreenState extends State { 'k=${kFactorUsed.toStringAsFixed(3)}', style: TextStyle( fontSize: 11, - color: Colors.grey[700], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), const SizedBox(width: 4), @@ -734,7 +742,7 @@ class _LineOfSightMapScreenState extends State { padding: EdgeInsets.zero, constraints: const BoxConstraints(), icon: const Icon(Icons.info_outline, size: 16), - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, tooltip: context.l10n.losFrequencyInfoTooltip, onPressed: () { _showFrequencyInfoDialog( @@ -750,7 +758,7 @@ class _LineOfSightMapScreenState extends State { ), Text( context.l10n.losElevationAttribution, - style: TextStyle(fontSize: 10, color: Colors.grey[700]), + style: TextStyle(fontSize: 10, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 6), ExpansionTile( @@ -1730,12 +1738,12 @@ class _LosLegend extends StatelessWidget { Widget build(BuildContext context) { final textStyle = Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.white70, + color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 11, fontWeight: FontWeight.w500, ) ?? - const TextStyle( - color: Colors.white70, + TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 11, fontWeight: FontWeight.w500, ); diff --git a/lib/screens/map_cache_screen.dart b/lib/screens/map_cache_screen.dart index 4057e0ec..6bc62018 100644 --- a/lib/screens/map_cache_screen.dart +++ b/lib/screens/map_cache_screen.dart @@ -83,17 +83,17 @@ class _MapCacheScreenState extends State { children: [ IconButton( icon: const Icon(Icons.add), - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( icon: const Icon(Icons.remove), - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( icon: const Icon(Icons.my_location), - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: _resetMapView, ), ], @@ -458,7 +458,7 @@ class _MapCacheScreenState extends State { padding: const EdgeInsets.only(top: 8), child: Text( l10n.mapCache_failedDownloads(_failedTiles), - style: TextStyle(color: Colors.orange[700]), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), ], diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 766b1852..dd6462b7 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -183,17 +183,17 @@ class _MapScreenState extends State { children: [ IconButton( icon: const Icon(Icons.add), - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( icon: const Icon(Icons.remove), - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( icon: const Icon(Icons.my_location), - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: () => _mapController.move(center, zoom), ), ], @@ -417,61 +417,76 @@ class _MapScreenState extends State { automaticallyImplyLeading: false, bottom: const SyncProgressAppBarBottom(), actions: [ - if (!_isBuildingPathTrace) - IconButton( - icon: const Icon(Icons.radar), - onPressed: () => _startPath( - LatLng(connector.selfLatitude!, connector.selfLongitude!), - ), - tooltip: context.l10n.contacts_pathTrace, - ), - if (!_isBuildingPathTrace) - IconButton( - icon: const LosIcon(), - onPressed: () { - final candidates = []; - if (connector.selfLatitude != null && - connector.selfLongitude != null) { - candidates.add( - LineOfSightEndpoint( - label: context.l10n.pathTrace_you, - point: LatLng( - connector.selfLatitude!, - connector.selfLongitude!, - ), - color: Colors.teal, - icon: Icons.person_pin_circle, - ), - ); - } - for (final c in contactsWithLocation) { - candidates.add( - LineOfSightEndpoint( - label: c.name, - point: LatLng(c.latitude!, c.longitude!), - color: _getNodeColor(c.type), - icon: _getNodeIcon(c.type), - ), - ); - } - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => LineOfSightMapScreen( - title: context.l10n.map_losScreenTitle, - candidates: candidates, - ), - ), - ); - }, - tooltip: context.l10n.map_lineOfSight, - ), PopupMenuButton( itemBuilder: (context) => [ + if (!_isBuildingPathTrace && + connector.selfLatitude != null && + connector.selfLongitude != null) + PopupMenuItem( + child: Row( + children: [ + const Icon(Icons.radar), + const SizedBox(width: 8), + Text(context.l10n.contacts_pathTrace), + ], + ), + onTap: () => _startPath( + LatLng( + connector.selfLatitude!, + connector.selfLongitude!, + ), + ), + ), + if (!_isBuildingPathTrace) + PopupMenuItem( + child: Row( + children: [ + const LosIcon(), + const SizedBox(width: 8), + Text(context.l10n.map_lineOfSight), + ], + ), + onTap: () { + final candidates = []; + if (connector.selfLatitude != null && + connector.selfLongitude != null) { + candidates.add( + LineOfSightEndpoint( + label: context.l10n.pathTrace_you, + point: LatLng( + connector.selfLatitude!, + connector.selfLongitude!, + ), + color: Colors.teal, + icon: Icons.person_pin_circle, + ), + ); + } + for (final c in contactsWithLocation) { + candidates.add( + LineOfSightEndpoint( + label: c.name, + point: LatLng(c.latitude!, c.longitude!), + color: _getNodeColor(c.type), + icon: _getNodeIcon(c.type), + ), + ); + } + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LineOfSightMapScreen( + title: context.l10n.map_losScreenTitle, + candidates: candidates, + ), + ), + ); + }, + ), PopupMenuItem( child: Row( children: [ - const Icon(Icons.logout, color: Colors.red), + Icon(Icons.logout, color: Theme.of(context).colorScheme.error), const SizedBox(width: 8), Text(context.l10n.common_disconnect), ], @@ -906,8 +921,8 @@ class _MapScreenState extends State { final color = _getNodeColor(guess.contact.type); final marker = Marker( point: guess.position, - width: 35, - height: 35, + width: 48, + height: 48, child: GestureDetector( onLongPress: () => _isBuildingPathTrace ? _showNodeInfo(context, guess.contact) @@ -919,26 +934,28 @@ class _MapScreenState extends State { guess.contact, guessedPosition: guess.position, ), - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: color.withValues( - alpha: guess.highConfidence ? 0.55 : 0.30, - ), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + child: Center( + child: Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: color.withValues( + alpha: guess.highConfidence ? 0.55 : 0.30, ), - ], - ), - child: const Icon( - Icons.not_listed_location, - color: Colors.white, - size: 20, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + child: const Icon( + Icons.not_listed_location, + color: Colors.white, + size: 20, + ), ), ), ), @@ -1030,39 +1047,37 @@ class _MapScreenState extends State { for (final contact in filteredContacts) { final marker = Marker( point: LatLng(contact.latitude!, contact.longitude!), - width: 35, - height: 35, + width: 48, + height: 48, child: GestureDetector( onLongPress: () => _isBuildingPathTrace ? _showNodeInfo(context, contact) : null, onTap: () => _isBuildingPathTrace ? _addToPath(context, contact) : _showNodeInfo(context, contact), - child: Column( - children: [ - Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: settings.mapShowOverlaps && !_isBuildingPathTrace - ? Colors.red - : _getNodeColor(contact.type), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], - ), - child: Icon( - _getNodeIcon(contact.type), - color: Colors.white, - size: 20, - ), + child: Center( + child: Container( + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: settings.mapShowOverlaps && !_isBuildingPathTrace + ? Colors.red + : _getNodeColor(contact.type), + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], ), - ], + child: Icon( + _getNodeIcon(contact.type), + color: Colors.white, + size: 20, + ), + ), ), ), ); @@ -1208,7 +1223,7 @@ class _MapScreenState extends State { Icon( Icons.location_on, size: 16, - color: Colors.grey, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), Text( ": $nodeCount", @@ -1221,10 +1236,10 @@ class _MapScreenState extends State { ), Row( children: [ - const Icon( + Icon( Icons.wrong_location, size: 16, - color: Colors.grey, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), Text( ": ${nodeCountAll - nodeCount}", @@ -1237,10 +1252,10 @@ class _MapScreenState extends State { ), Row( children: [ - const Icon( + Icon( Icons.add_outlined, size: 16, - color: Colors.grey, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), Text( ": $nodeCountAll", @@ -1536,56 +1551,14 @@ class _MapScreenState extends State { LatLng? guessedPosition, }) { final connector = context.read(); - showDialog( + showModalBottomSheet( context: context, - builder: (dialogContext) => AlertDialog( - title: Row( - children: [ - Icon( - _getNodeIcon(contact.type), - color: _getNodeColor(contact.type), - ), - const SizedBox(width: 8), - Expanded(child: SelectableText(contact.name)), - ], - ), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildInfoRow( - context.l10n.map_type, - contact.typeLabel(context.l10n), - ), - _buildInfoRow( - context.l10n.map_path, - contact.pathLabel(context.l10n), - ), - if (contact.hasLocation) - _buildInfoRow( - context.l10n.map_location, - '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', - ) - else if (guessedPosition != null) - _buildInfoRow( - context.l10n.map_estLocation, - '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', - ), - _buildInfoRow( - context.l10n.map_lastSeen, - _formatLastSeen(contact.lastSeen), - ), - _buildInfoRow(context.l10n.map_publicKey, contact.publicKeyHex), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(context.l10n.common_close), - ), - if (contact.type == - advTypeChat) // Only show chat button for chat nodes - TextButton( + showDragHandle: true, + builder: (sheetContext) { + final actions = []; + if (contact.type == advTypeChat) { + actions.add( + FilledButton( onPressed: () { if (!contact.isActive) { connector.importDiscoveredContact(contact); @@ -1593,7 +1566,7 @@ class _MapScreenState extends State { final unread = connector.getUnreadCountForContactKey( contact.publicKeyHex, ); - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); Navigator.push( context, MaterialPageRoute( @@ -1606,30 +1579,88 @@ class _MapScreenState extends State { }, child: Text(context.l10n.contacts_openChat), ), - if (contact.type == advTypeRepeater) - TextButton( + ); + } + if (contact.type == advTypeRepeater) { + actions.add( + FilledButton( onPressed: () { if (!contact.isActive) { connector.importDiscoveredContact(contact); } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); _showRepeaterLogin(context, contact); }, child: Text(context.l10n.map_manageRepeater), ), - if (contact.type == advTypeRoom) - TextButton( + ); + } + if (contact.type == advTypeRoom) { + actions.add( + FilledButton( onPressed: () { if (!contact.isActive) { connector.importDiscoveredContact(contact); } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); _showRoomLogin(context, contact); }, child: Text(context.l10n.map_joinRoom), ), - ], - ), + ); + } + return SafeArea( + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + _getNodeIcon(contact.type), + color: _getNodeColor(contact.type), + ), + const SizedBox(width: 8), + Expanded(child: SelectableText(contact.name)), + ], + ), + const SizedBox(height: 8), + _buildInfoRow( + context.l10n.map_type, + contact.typeLabel(context.l10n), + ), + _buildInfoRow( + context.l10n.map_path, + contact.pathLabel(context.l10n), + ), + if (contact.hasLocation) + _buildInfoRow( + context.l10n.map_location, + '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', + ) + else if (guessedPosition != null) + _buildInfoRow( + context.l10n.map_estLocation, + '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', + ), + _buildInfoRow( + context.l10n.map_lastSeen, + _formatLastSeen(contact.lastSeen), + ), + _buildInfoRow(context.l10n.map_publicKey, contact.publicKeyHex), + const SizedBox(height: 16), + ...actions, + TextButton( + onPressed: () => Navigator.pop(sheetContext), + child: Text(context.l10n.common_close), + ), + ], + ), + ), + ); + }, ); } @@ -1714,6 +1745,9 @@ class _MapScreenState extends State { child: Text(context.l10n.common_hide), ), TextButton( + style: TextButton.styleFrom( + foregroundColor: Theme.of(context).colorScheme.error, + ), onPressed: () async { setState(() { _hiddenMarkerIds.add(marker.id); @@ -1745,7 +1779,7 @@ class _MapScreenState extends State { label, style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, fontWeight: FontWeight.w500, ), ), @@ -1810,9 +1844,8 @@ class _MapScreenState extends State { ); await connector.refreshDeviceInfo(); if (!mounted) return; - showDismissibleSnackBar( - messenger.context, - content: Text(successMsg), + messenger.showSnackBar( + SnackBar(content: Text(successMsg)), ); }, ), @@ -2202,7 +2235,7 @@ class _MapScreenState extends State { const SizedBox(height: 8), Text( _getTimeFilterLabel(settings.mapTimeFilterHours), - style: TextStyle(fontSize: 14, color: Colors.grey[700]), + style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), ), Slider( value: _hoursToSliderValue(settings.mapTimeFilterHours), @@ -2354,7 +2387,7 @@ class _MapScreenState extends State { if (_pathTrace.isNotEmpty) Text( "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", - style: TextStyle(fontSize: 12, color: Colors.grey[700]), + style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant), ), SelectableText( _pathTrace diff --git a/lib/screens/neighbors_screen.dart b/lib/screens/neighbors_screen.dart index 77559d48..e92a5cc0 100644 --- a/lib/screens/neighbors_screen.dart +++ b/lib/screens/neighbors_screen.dart @@ -9,7 +9,8 @@ import '../models/path_selection.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/repeater_command_service.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/empty_state.dart'; +import '../widgets/routing_sheet.dart'; import '../widgets/snr_indicator.dart'; import '../helpers/snack_bar_builder.dart'; @@ -167,7 +168,7 @@ class _NeighborsScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.neighbors_receivedData), - backgroundColor: Colors.green, + backgroundColor: Theme.of(context).colorScheme.tertiary, ); _statusTimeout?.cancel(); if (!mounted) return; @@ -227,7 +228,7 @@ class _NeighborsScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.neighbors_requestTimedOut), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); _recordStatusResult(false); }); @@ -241,7 +242,7 @@ class _NeighborsScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.neighbors_errorLoading(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -279,7 +280,9 @@ class _NeighborsScreenState extends State { children: [ Text( l10n.neighbors_repeatersNeighbors, - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), Text( repeater.name, @@ -287,75 +290,18 @@ class _NeighborsScreenState extends State { fontSize: 14, fontWeight: FontWeight.normal, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), centerTitle: false, actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), ), IconButton( icon: _isLoading @@ -380,11 +326,9 @@ class _NeighborsScreenState extends State { if (!_isLoaded && !_hasData && (_parsedNeighbors == null || _parsedNeighbors!.isEmpty)) - Center( - child: Text( - l10n.neighbors_noData, - style: TextStyle(fontSize: 16, color: Colors.grey), - ), + EmptyState( + icon: Icons.wifi_find, + title: l10n.neighbors_noData, ), if (_isLoaded || _hasData && @@ -435,7 +379,7 @@ class _NeighborsScreenState extends State { fmtDuration(entry.value['lastHeard'] + 0.0), ), entry.value['snr'], - connector.currentSf!, + connector.currentSf, ), ], ), @@ -447,7 +391,7 @@ class _NeighborsScreenState extends State { String label, String value, double snr, - int spreadingFactor, + int? spreadingFactor, ) { final snrUi = snrUiFromSNR(snr, spreadingFactor); return Padding( diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index c810570d..81082b9e 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -103,6 +103,9 @@ class _PathTraceMapScreenState extends State { double _pathDistanceMeters = 0.0; bool _showNodeLabels = true; Contact? _targetContact; + // Live path resolved at trace time; used by the response handler for + // endpoint inference so it matches the path that was actually traced. + Uint8List _tracedPath = Uint8List(0); String _formatPathPrefixes(Uint8List pathBytes) { return pathBytes @@ -168,17 +171,17 @@ class _PathTraceMapScreenState extends State { children: [ IconButton( icon: const Icon(Icons.add), - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( icon: const Icon(Icons.remove), - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( icon: const Icon(Icons.my_location), - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: _resetMapView, ), ], @@ -228,6 +231,23 @@ class _PathTraceMapScreenState extends State { return traceBytes; } + /// Resolves the path bytes to trace. When tracing a specific contact's + /// route (flipPathAround), re-read that contact's live forced/auto path from + /// the connector so a path the user just changed (force flood / set path / + /// reset to auto) is honored immediately, instead of the value captured when + /// this screen was first pushed. + Uint8List _resolveLivePath(MeshCoreConnector connector) { + final target = widget.targetContact; + if (!widget.flipPathAround || target == null) { + return widget.path; + } + final live = connector.allContactsUnfiltered.firstWhere( + (c) => c.publicKeyHex == target.publicKeyHex, + orElse: () => target, + ); + return live.pathBytesForDisplay; + } + Future _doPathTrace() async { if (mounted) { setState(() { @@ -236,9 +256,13 @@ class _PathTraceMapScreenState extends State { }); } + final connector = Provider.of(context, listen: false); + final livePath = _resolveLivePath(connector); + _tracedPath = livePath; + final pathTmp = widget.reversePathAround - ? Uint8List.fromList(widget.path.reversed.toList()) - : widget.path; + ? Uint8List.fromList(livePath.reversed.toList()) + : livePath; final path = widget.flipPathAround ? buildPath(pathTmp) : pathTmp; @@ -248,7 +272,6 @@ class _PathTraceMapScreenState extends State { noNotify: !mounted, ); - final connector = Provider.of(context, listen: false); final frame = buildTraceReq( DateTime.now().millisecondsSinceEpoch ~/ 1000, 0, //flags @@ -414,13 +437,13 @@ class _PathTraceMapScreenState extends State { final tc = _targetContact!; if (tc.hasLocation) { targetPos = LatLng(tc.latitude!, tc.longitude!); - } else if (widget.path.length > 1) { + } else if (_tracedPath.length > 1) { // Infer from the last hop: average GPS contacts sharing that hop. // For a round-trip path (flipPathAround/reversePathAround), the target-side hop // sits in the middle of the symmetric sequence; .last is the local side. final lastHop = widget.reversePathAround - ? widget.path.first - : widget.path.last; + ? _tracedPath.first + : _tracedPath.last; final peers = connector.allContacts .where( @@ -593,7 +616,7 @@ class _PathTraceMapScreenState extends State { !_failed2Loaded) Center( child: Card( - color: Colors.white.withValues(alpha: 0.9), + color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.9), child: Padding( padding: EdgeInsets.all(12), child: Text( @@ -640,31 +663,35 @@ class _PathTraceMapScreenState extends State { markers.add( Marker( point: point, - width: 35, - height: 35, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: hasGps - ? Colors.green - : Colors.orange.withValues(alpha: 0.75), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: hasGps + ? Colors.green + : Colors.orange.withValues(alpha: 0.75), + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + hasGps ? label : '~$label', + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, ), - ], - ), - alignment: Alignment.center, - child: Text( - hasGps ? label : '~$label', - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -689,29 +716,33 @@ class _PathTraceMapScreenState extends State { markers.add( Marker( point: selfPoint, - width: 35, - height: 35, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: Colors.blue, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: Colors.blue, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + context.l10n.pathTrace_you, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, ), - ], - ), - alignment: Alignment.center, - child: Text( - context.l10n.pathTrace_you, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, ), ), ), @@ -735,26 +766,30 @@ class _PathTraceMapScreenState extends State { markers.add( Marker( point: targetPos, - width: 35, - height: 35, - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: isGuessed - ? Colors.purple.withValues(alpha: 0.55) - : Colors.red, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + padding: const EdgeInsets.all(4), + decoration: BoxDecoration( + color: isGuessed + ? Colors.purple.withValues(alpha: 0.55) + : Colors.red, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: const Icon(Icons.person, color: Colors.white, size: 18), ), - alignment: Alignment.center, - child: const Icon(Icons.person, color: Colors.white, size: 18), ), ), ); @@ -927,6 +962,12 @@ class _PathTraceMapScreenState extends State { ); } + Widget _colorDot(Color color) => Container( + width: 10, + height: 10, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), + ); + Widget _buildLegendCard( BuildContext context, PathTraceData pathTraceData, @@ -949,9 +990,26 @@ class _PathTraceMapScreenState extends State { children: [ Padding( padding: const EdgeInsets.all(12), - child: Text( - '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistanceMeters, isImperial: isImperial)}', - style: const TextStyle(fontWeight: FontWeight.w600), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistanceMeters, isImperial: isImperial)}', + style: const TextStyle(fontWeight: FontWeight.w600), + ), + const SizedBox(height: 6), + Row( + children: [ + _colorDot(Colors.green), + const SizedBox(width: 4), + Text(l10n.pathTrace_legendGpsConfirmed, style: const TextStyle(fontSize: 11)), + const SizedBox(width: 12), + _colorDot(Colors.orange), + const SizedBox(width: 4), + Text(l10n.pathTrace_legendInferred, style: const TextStyle(fontSize: 11)), + ], + ), + ], ), ), const Divider(height: 1), diff --git a/lib/screens/repeater_cli_screen.dart b/lib/screens/repeater_cli_screen.dart index 10e325ac..93720f28 100644 --- a/lib/screens/repeater_cli_screen.dart +++ b/lib/screens/repeater_cli_screen.dart @@ -8,7 +8,7 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../widgets/debug_frame_viewer.dart'; import '../services/repeater_command_service.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterCliScreen extends StatefulWidget { @@ -252,97 +252,29 @@ class _RepeaterCliScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(l10n.repeater_cliTitle), + Text( + l10n.repeater_cliTitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), Text( repeater.name, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.normal, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), centerTitle: false, actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: repeater), - ), - IconButton( - icon: const Icon(Icons.bug_report), - tooltip: l10n.repeater_debugNextCommand, - onPressed: () { - // Set a flag or just send next command with debug - if (_commandController.text.trim().isNotEmpty) { - _sendCommand(showDebug: true); - } else { - showDismissibleSnackBar( - context, - content: Text(l10n.repeater_enterCommandFirst), - ); - } - }, + ContactRoutingSheet.show(context, contact: repeater), ), IconButton( icon: const Icon(Icons.help_outline), @@ -354,6 +286,33 @@ class _RepeaterCliScreenState extends State { tooltip: l10n.repeater_clearHistory, onPressed: _commandHistory.isEmpty ? null : _clearHistory, ), + PopupMenuButton( + icon: const Icon(Icons.more_vert), + onSelected: (value) { + if (value == 'debug') { + if (_commandController.text.trim().isNotEmpty) { + _sendCommand(showDebug: true); + } else { + showDismissibleSnackBar( + context, + content: Text(l10n.repeater_enterCommandFirst), + ); + } + } + }, + itemBuilder: (context) => [ + PopupMenuItem( + value: 'debug', + child: Row( + children: [ + const Icon(Icons.bug_report), + const SizedBox(width: 8), + Text(l10n.repeater_debugNextCommand), + ], + ), + ), + ], + ), ], ), body: Column( @@ -426,16 +385,16 @@ class _RepeaterCliScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.terminal, size: 64, color: Colors.grey[400]), + Icon(Icons.terminal, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), const SizedBox(height: 16), Text( l10n.repeater_noCommandsSent, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 8), Text( l10n.repeater_typeCommandOrUseQuick, - style: TextStyle(fontSize: 14, color: Colors.grey[500]), + style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index 5b1e30ca..337d148c 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -72,11 +72,11 @@ class RepeaterHubScreen extends StatelessWidget { children: [ CircleAvatar( radius: 40, - backgroundColor: Colors.orange, - child: const Icon( + backgroundColor: Theme.of(context).colorScheme.tertiaryContainer, + child: Icon( Icons.cell_tower, size: 40, - color: Colors.white, + color: Theme.of(context).colorScheme.onTertiaryContainer, ), ), const SizedBox(height: 16), @@ -90,12 +90,12 @@ class RepeaterHubScreen extends StatelessWidget { const SizedBox(height: 8), Text( repeater.shortPubKeyHex, - style: TextStyle(fontSize: 14, color: Colors.grey[600]), + style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 8), Text( repeater.pathLabel(context.l10n), - style: TextStyle(fontSize: 14, color: Colors.grey[600]), + style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), ), if (repeater.hasLocation) ...[ const SizedBox(height: 4), @@ -105,14 +105,14 @@ class RepeaterHubScreen extends StatelessWidget { Icon( Icons.location_on, size: 14, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), const SizedBox(width: 4), Text( '${repeater.latitude?.toStringAsFixed(4)}, ${repeater.longitude?.toStringAsFixed(4)}', style: TextStyle( fontSize: 12, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -193,7 +193,7 @@ class RepeaterHubScreen extends StatelessWidget { icon: Icons.analytics, title: l10n.repeater_status, subtitle: l10n.repeater_statusSubtitle, - color: Colors.blue, + color: Theme.of(context).colorScheme.primary, onTap: () { Navigator.push( context, @@ -213,7 +213,7 @@ class RepeaterHubScreen extends StatelessWidget { icon: Icons.bar_chart_sharp, title: l10n.repeater_telemetry, subtitle: l10n.repeater_telemetrySubtitle, - color: Colors.teal, + color: Theme.of(context).colorScheme.secondary, onTap: () { Navigator.push( context, @@ -231,7 +231,7 @@ class RepeaterHubScreen extends StatelessWidget { icon: Icons.terminal, title: l10n.repeater_cli, subtitle: l10n.repeater_cliSubtitle, - color: Colors.green, + color: Theme.of(context).colorScheme.tertiary, onTap: () { Navigator.push( context, @@ -251,7 +251,7 @@ class RepeaterHubScreen extends StatelessWidget { icon: Icons.group, title: l10n.repeater_neighbors, subtitle: l10n.repeater_neighborsSubtitle, - color: Colors.orange, + color: Theme.of(context).colorScheme.tertiary, onTap: () { Navigator.push( context, @@ -270,7 +270,7 @@ class RepeaterHubScreen extends StatelessWidget { icon: Icons.settings, title: l10n.repeater_settings, subtitle: l10n.repeater_settingsSubtitle, - color: Colors.deepOrange, + color: Theme.of(context).colorScheme.error, onTap: () { Navigator.push( context, @@ -329,12 +329,12 @@ class RepeaterHubScreen extends StatelessWidget { const SizedBox(height: 4), Text( subtitle, - style: TextStyle(fontSize: 14, color: Colors.grey[600]), + style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), ), - Icon(Icons.chevron_right, color: Colors.grey[400]), + Icon(Icons.chevron_right, color: Theme.of(context).colorScheme.onSurfaceVariant), ], ), ), diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index 9ffd1b37..1d8ae3bc 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -8,7 +8,7 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/repeater_command_service.dart'; import '../services/storage_service.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterSettingsScreen extends StatefulWidget { @@ -126,6 +126,8 @@ class _RepeaterSettingsScreenState extends State { // Location settings final TextEditingController _latController = TextEditingController(); final TextEditingController _lonController = TextEditingController(); + bool _latInvalid = false; + bool _lonInvalid = false; // Feature toggles bool _repeatEnabled = true; @@ -457,7 +459,7 @@ class _RepeaterSettingsScreenState extends State { ? l10n.repeater_refreshed(label) : l10n.repeater_errorRefreshing(label), ), - backgroundColor: successCount > 0 ? Colors.green : Colors.red, + backgroundColor: successCount > 0 ? null : Theme.of(context).colorScheme.error, ); setState(() => setRefreshing(false)); } @@ -667,15 +669,15 @@ class _RepeaterSettingsScreenState extends State { : l10n.repeater_actionSucceeded(label), ), backgroundColor: outcome == _SaveOutcome.error - ? Colors.red - : Colors.green, + ? Theme.of(context).colorScheme.error + : null, ); } catch (e) { if (!mounted) return; showDismissibleSnackBar( context, content: Text(l10n.repeater_actionFailed(label, e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } finally { if (mounted) setState(() => _runningAction = false); @@ -768,14 +770,16 @@ class _RepeaterSettingsScreenState extends State { } if (_dirtyFields.contains(_SettingField.lat) && - _latController.text.isNotEmpty) { + _latController.text.isNotEmpty && + _isValidCoordinate(_latController.text, 90)) { pending.add(( field: _SettingField.lat, command: 'set lat ${_latController.text}', )); } if (_dirtyFields.contains(_SettingField.lon) && - _lonController.text.isNotEmpty) { + _lonController.text.isNotEmpty && + _isValidCoordinate(_lonController.text, 180)) { pending.add(( field: _SettingField.lon, command: 'set lon ${_lonController.text}', @@ -944,13 +948,12 @@ class _RepeaterSettingsScreenState extends State { showDismissibleSnackBar( context, content: Text(l10n.repeater_settingsSavedRebootNeeded), - backgroundColor: Colors.orange, + backgroundColor: Theme.of(context).colorScheme.tertiary, ); } else if (failures.isEmpty) { showDismissibleSnackBar( context, content: Text(l10n.repeater_settingsSaved), - backgroundColor: Colors.green, ); } else { showDismissibleSnackBar( @@ -958,7 +961,7 @@ class _RepeaterSettingsScreenState extends State { content: Text( l10n.repeater_settingsPartialFailure(failures.join('; ')), ), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -973,7 +976,7 @@ class _RepeaterSettingsScreenState extends State { content: Text( context.l10n.repeater_errorSavingSettings(e.toString()), ), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -984,6 +987,12 @@ class _RepeaterSettingsScreenState extends State { _flagHasChanges(); } + static bool _isValidCoordinate(String text, double max) { + if (text.trim().isEmpty) return true; + final value = double.tryParse(text.trim()); + return value != null && value >= -max && value <= max; + } + void _flagHasChanges() { if (!_hasChanges) { setState(() { @@ -1072,73 +1081,11 @@ class _RepeaterSettingsScreenState extends State { ), centerTitle: false, actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - if (mounted) { - setState(() {}); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), ), if (_hasChanges) TextButton.icon( @@ -1173,6 +1120,8 @@ class _RepeaterSettingsScreenState extends State { const SizedBox(height: 16), _buildAdvancedCard(), const SizedBox(height: 32), + const Divider(), + const SizedBox(height: 16), _buildDangerZoneCard(), ], ), @@ -1388,13 +1337,22 @@ class _RepeaterSettingsScreenState extends State { decoration: InputDecoration( labelText: l10n.repeater_latitude, helperText: l10n.repeater_latitudeHelper, + errorText: _latInvalid + ? l10n.settings_locationInvalid + : null, border: const OutlineInputBorder(), ), keyboardType: const TextInputType.numberWithOptions( decimal: true, signed: true, ), - onChanged: (_) => _markChanged(_SettingField.lat), + onChanged: (value) { + _markChanged(_SettingField.lat); + final invalid = !_isValidCoordinate(value, 90); + if (invalid != _latInvalid) { + setState(() => _latInvalid = invalid); + } + }, ), ), const SizedBox(width: 8), @@ -1415,13 +1373,22 @@ class _RepeaterSettingsScreenState extends State { decoration: InputDecoration( labelText: l10n.repeater_longitude, helperText: l10n.repeater_longitudeHelper, + errorText: _lonInvalid + ? l10n.settings_locationInvalid + : null, border: const OutlineInputBorder(), ), keyboardType: const TextInputType.numberWithOptions( decimal: true, signed: true, ), - onChanged: (_) => _markChanged(_SettingField.lon), + onChanged: (value) { + _markChanged(_SettingField.lon); + final invalid = !_isValidCoordinate(value, 180); + if (invalid != _lonInvalid) { + setState(() => _lonInvalid = invalid); + } + }, ), ), const SizedBox(width: 8), @@ -2233,7 +2200,7 @@ class _RepeaterSettingsScreenState extends State { showDismissibleSnackBar( context, content: Text(l10n.repeater_errorSendingCommand(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -2262,7 +2229,7 @@ class _RepeaterSettingsScreenState extends State { onConfirm(); }, style: isDestructive - ? FilledButton.styleFrom(backgroundColor: Colors.red) + ? FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.error) : null, child: Text(l10n.repeater_confirm), ), diff --git a/lib/screens/repeater_status_screen.dart b/lib/screens/repeater_status_screen.dart index 9dbd8e31..f121605d 100644 --- a/lib/screens/repeater_status_screen.dart +++ b/lib/screens/repeater_status_screen.dart @@ -11,7 +11,7 @@ import '../connector/meshcore_protocol.dart'; import '../services/app_settings_service.dart'; import '../services/repeater_command_service.dart'; import '../utils/battery_utils.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterStatusScreen extends StatefulWidget { @@ -318,7 +318,7 @@ class _RepeaterStatusScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.repeater_statusRequestTimeout), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); _recordStatusResult(false); }); @@ -331,7 +331,7 @@ class _RepeaterStatusScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.repeater_errorLoadingStatus(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } _recordStatusResult(false); @@ -360,82 +360,29 @@ class _RepeaterStatusScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(l10n.repeater_statusTitle), + Text( + l10n.repeater_statusTitle, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), Text( repeater.name, style: const TextStyle( fontSize: 14, fontWeight: FontWeight.normal, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), centerTitle: false, actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(repeater, pathLen: -1); - } else { - await connector.setPathOverride(repeater, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), ), IconButton( icon: _isLoading @@ -588,21 +535,20 @@ class _RepeaterStatusScreenState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - width: 130, + Expanded( child: Text( label, style: TextStyle( - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, fontWeight: FontWeight.w500, ), ), ), - Expanded( - child: Text( - value, - style: const TextStyle(fontWeight: FontWeight.w400), - ), + const SizedBox(width: 8), + Text( + value, + style: const TextStyle(fontWeight: FontWeight.w400), + textAlign: TextAlign.end, ), ], ), diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index ec148c5f..e665cbc7 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -10,6 +10,7 @@ import '../services/linux_ble_error_classifier.dart'; import '../utils/app_logger.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../widgets/device_tile.dart'; +import '../widgets/empty_state.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; import 'tcp_screen.dart'; @@ -25,6 +26,7 @@ class ScannerScreen extends StatefulWidget { class _ScannerScreenState extends State { bool _changedNavigation = false; + String? _connectingDeviceId; late final MeshCoreConnector _connector; late final VoidCallback _connectionListener; BluetoothAdapterState _bluetoothState = BluetoothAdapterState.unknown; @@ -101,6 +103,32 @@ class _ScannerScreenState extends State { title: AdaptiveAppBarTitle(context.l10n.scanner_title), centerTitle: true, automaticallyImplyLeading: false, + actions: [ + if (PlatformInfo.supportsUsbSerial) + IconButton( + icon: const Icon(Icons.usb), + tooltip: context.l10n.connectionChoiceUsbLabel, + onPressed: () { + appLogger.info( + 'USB selected, opening UsbScreen', + tag: 'ScannerScreen', + ); + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const UsbScreen()), + ); + }, + ), + if (!PlatformInfo.isWeb) + IconButton( + icon: const Icon(Icons.lan), + tooltip: context.l10n.connectionChoiceTcpLabel, + onPressed: () { + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => const TcpScreen()), + ); + }, + ), + ], ), body: SafeArea( top: false, @@ -122,84 +150,24 @@ class _ScannerScreenState extends State { }, ), ), - bottomNavigationBar: Consumer( + floatingActionButton: Consumer( builder: (context, connector, child) { final isScanning = connector.state == MeshCoreConnectionState.scanning; final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off; - final usbSupported = PlatformInfo.supportsUsbSerial; - final tcpSupported = !PlatformInfo.isWeb; - return SafeArea( - top: false, - minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerRight, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - if (usbSupported) - FloatingActionButton.extended( - onPressed: () { - appLogger.info( - 'USB selected, opening UsbScreen', - tag: 'ScannerScreen', - ); - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const UsbScreen()), - ); - }, - heroTag: 'scanner_usb_action', - icon: const Icon(Icons.usb), - label: Text(context.l10n.connectionChoiceUsbLabel), - ), - if (usbSupported) const SizedBox(width: 12), - if (tcpSupported) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const TcpScreen()), - ); - }, - heroTag: 'scanner_tcp_action', - icon: const Icon(Icons.lan), - label: Text(context.l10n.connectionChoiceTcpLabel), - ), - if (tcpSupported) const SizedBox(width: 12), - FloatingActionButton.extended( - heroTag: 'scanner_ble_action', - onPressed: isBluetoothOff - ? null - : () { - if (isScanning) { - connector.stopScan(); - } else { - unawaited( - connector.startScan().catchError((e) { - appLogger.warn( - 'startScan error: $e', - tag: 'ScannerScreen', - ); - }), - ); - } - }, - icon: isScanning - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.bluetooth_searching), - label: Text( - isScanning - ? context.l10n.scanner_stop - : context.l10n.scanner_scan, - ), - ), - ], - ), + return FloatingActionButton.extended( + heroTag: 'scanner_ble_action', + onPressed: isBluetoothOff ? null : () => _toggleScan(connector), + icon: isScanning + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.bluetooth_searching), + label: Text( + isScanning ? context.l10n.scanner_stop : context.l10n.scanner_scan, ), ); }, @@ -207,6 +175,18 @@ class _ScannerScreenState extends State { ); } + void _toggleScan(MeshCoreConnector connector) { + if (connector.state == MeshCoreConnectionState.scanning) { + connector.stopScan(); + } else { + unawaited( + connector.startScan().catchError((e) { + appLogger.warn('startScan error: $e', tag: 'ScannerScreen'); + }), + ); + } + } + Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { String statusText; Color statusColor; @@ -254,32 +234,43 @@ class _ScannerScreenState extends State { Widget _buildDeviceList(BuildContext context, MeshCoreConnector connector) { if (connector.scanResults.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(Icons.bluetooth, size: 64, color: Colors.grey[400]), - const SizedBox(height: 16), - Text( - connector.state == MeshCoreConnectionState.scanning - ? context.l10n.scanner_searchingDevices - : context.l10n.scanner_tapToScan, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - ), - ], - ), + final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off; + final isScanning = connector.state == MeshCoreConnectionState.scanning; + return EmptyState( + icon: isBluetoothOff ? Icons.bluetooth_disabled : Icons.bluetooth, + title: isBluetoothOff + ? context.l10n.scanner_bluetoothOff + : isScanning + ? context.l10n.scanner_searchingDevices + : context.l10n.scanner_tapToScan, + subtitle: isBluetoothOff + ? context.l10n.scanner_bluetoothOffMessage + : null, + action: (isBluetoothOff || isScanning) + ? null + : FilledButton.icon( + onPressed: () => _toggleScan(connector), + icon: const Icon(Icons.bluetooth_searching), + label: Text(context.l10n.scanner_scan), + ), ); } + final isConnecting = + connector.state == MeshCoreConnectionState.connecting; return ListView.separated( padding: const EdgeInsets.all(8), itemCount: connector.scanResults.length, separatorBuilder: (context, index) => const Divider(), itemBuilder: (context, index) { final result = connector.scanResults[index]; + final deviceId = result.device.remoteId.toString(); return DeviceTile( scanResult: result, - onTap: () => _connectToDevice(context, connector, result), + isConnecting: isConnecting && _connectingDeviceId == deviceId, + onTap: isConnecting + ? null + : () => _connectToDevice(context, connector, result), ); }, ); @@ -293,6 +284,9 @@ class _ScannerScreenState extends State { final name = result.device.platformName.isNotEmpty ? result.device.platformName : result.advertisementData.advName; + setState(() { + _connectingDeviceId = result.device.remoteId.toString(); + }); try { await connector.connect( result.device, @@ -321,9 +315,15 @@ class _ScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.scanner_connectionFailed(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } + } finally { + if (mounted) { + setState(() { + _connectingDeviceId = null; + }); + } } } diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index ead36eaf..0fe077cb 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -53,6 +53,7 @@ class _SettingsScreenState extends State { Future _loadVersionInfo() async { final packageInfo = await PackageInfo.fromPlatform(); + if (!mounted) return; setState(() { _appVersion = packageInfo.version; }); @@ -213,12 +214,12 @@ class _SettingsScreenState extends State { if (percent == null) { icon = Icons.battery_unknown; - iconColor = Colors.grey; + iconColor = Theme.of(context).colorScheme.onSurfaceVariant; valueColor = null; } else if (percent <= 15) { icon = Icons.battery_alert; - iconColor = Colors.orange; - valueColor = Colors.orange; + iconColor = Theme.of(context).colorScheme.tertiary; + valueColor = Theme.of(context).colorScheme.tertiary; } else { icon = Icons.battery_full; iconColor = null; @@ -307,18 +308,6 @@ class _SettingsScreenState extends State { trailing: const Icon(Icons.chevron_right), onTap: () => _editLocation(context, connector), ), - if (connector.currentCustomVars?.containsKey('gps') ?? false) ...[ - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.gps_fixed), - title: Text(l10n.settings_locationGPSEnable), - subtitle: Text(l10n.settings_locationGPSEnableSubtitle), - value: connector.currentCustomVars?['gps'] == '1', - onChanged: (value) async { - await connector.setCustomVar(value ? 'gps:1' : 'gps:0'); - }, - ), - ], const Divider(height: 1), ListTile( leading: const Icon(Icons.group_add_outlined), @@ -354,13 +343,13 @@ class _SettingsScreenState extends State { ), ), ListTile( - leading: const Icon(Icons.delete_outline, color: Colors.red), + leading: Icon(Icons.delete_outline, color: Theme.of(context).colorScheme.error), title: Text(l10n.settings_deleteAllPaths), subtitle: Text( l10n.settings_deleteAllPathsSubtitle, - style: TextStyle(color: Colors.red[700]), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), - onTap: () => connector.deleteAllPaths(), + onTap: () => _confirmDeleteAllPaths(context, connector), ), const Divider(height: 1), ListTile( @@ -378,7 +367,7 @@ class _SettingsScreenState extends State { ), const Divider(height: 1), ListTile( - leading: const Icon(Icons.restart_alt, color: Colors.orange), + leading: Icon(Icons.restart_alt, color: Theme.of(context).colorScheme.tertiary), title: Text(l10n.settings_rebootDevice), subtitle: Text(l10n.settings_rebootDeviceSubtitle), onTap: () => _confirmReboot(context, connector), @@ -565,6 +554,8 @@ class _SettingsScreenState extends State { int.tryParse(customVars["gps_interval"] ?? "") ?? 900; intervalController.text = currentInterval.toString(); + String? intervalError; + showDialog( context: context, builder: (dialogContext) => StatefulBuilder( @@ -600,9 +591,15 @@ class _SettingsScreenState extends State { const SizedBox(height: 16), TextField( controller: intervalController, + onChanged: (_) { + if (intervalError != null) { + setDialogState(() => intervalError = null); + } + }, decoration: InputDecoration( labelText: l10n.settings_locationIntervalSec, border: const OutlineInputBorder(), + errorText: intervalError, ), keyboardType: const TextInputType.numberWithOptions( decimal: false, @@ -633,24 +630,25 @@ class _SettingsScreenState extends State { ), TextButton( onPressed: () async { - Navigator.pop(context); - + int? interval; if (hasGPS) { final intervalText = intervalController.text.trim(); - if (intervalText.isEmpty) { - return; + if (intervalText.isNotEmpty) { + interval = int.tryParse(intervalText); + if (interval == null || + interval < 60 || + interval >= 86400) { + setDialogState(() { + intervalError = l10n.settings_locationIntervalInvalid; + }); + return; + } } + } - final interval = int.tryParse(intervalText); - if (interval == null || interval < 60 || interval >= 86400) { - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.settings_locationIntervalInvalid), - ); - return; - } + Navigator.pop(context); + if (interval != null) { await connector.setCustomVar("gps_interval:$interval"); await connector.refreshDeviceInfo(); if (!context.mounted) return; @@ -716,6 +714,36 @@ class _SettingsScreenState extends State { ); } + void _confirmDeleteAllPaths( + BuildContext context, + MeshCoreConnector connector, + ) { + final l10n = context.l10n; + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(l10n.settings_deleteAllPaths), + content: Text(l10n.settings_deleteAllPathsSubtitle), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text(l10n.common_cancel), + ), + TextButton( + onPressed: () { + Navigator.pop(context); + connector.deleteAllPaths(); + }, + child: Text( + l10n.common_deleteAll, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ), + ], + ), + ); + } + void _confirmReboot(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; showDialog( @@ -735,7 +763,7 @@ class _SettingsScreenState extends State { }, child: Text( l10n.common_reboot, - style: const TextStyle(color: Colors.orange), + style: TextStyle(color: Theme.of(context).colorScheme.tertiary), ), ), ], @@ -1126,6 +1154,8 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { bool _clientRepeat = false; int? _selectedPresetIndex; _RadioSettingsSnapshot? _lastNonRepeatSnapshot; + String? _frequencyError; + String? _txPowerError; AppDebugLogService get _appLog => Provider.of(context, listen: false); @@ -1392,7 +1422,24 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { void _handleManualSettingsChanged(String source) { _logRadioSettingsState('Manual settings edit: $source'); - setState(_syncPresetSelection); + setState(() { + _validateFields(); + _syncPresetSelection(); + }); + } + + void _validateFields() { + final l10n = context.l10n; + final freqMHz = double.tryParse(_frequencyController.text); + _frequencyError = (freqMHz == null || freqMHz < 300 || freqMHz > 2500) + ? l10n.settings_frequencyInvalid + : null; + + final maxTxPower = widget.connector.maxTxPower ?? 22; + final txPower = int.tryParse(_txPowerController.text); + _txPowerError = (txPower == null || txPower < 0 || txPower > maxTxPower) + ? '${l10n.settings_txPowerInvalid} (0-$maxTxPower dBm)' + : null; } void _handleClientRepeatChanged(bool enabled) { @@ -1504,6 +1551,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { content: Text(l10n.settings_error(e.toString())), ); } + if (!mounted) return; Navigator.pop(context); } @@ -1579,6 +1627,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { labelText: l10n.settings_frequency, border: const OutlineInputBorder(), helperText: l10n.settings_frequencyHelper, + errorText: _frequencyError, ), keyboardType: const TextInputType.numberWithOptions( decimal: true, @@ -1662,6 +1711,7 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { helperText: widget.connector.maxTxPower != null ? '${l10n.settings_txPowerHelper} (max: ${widget.connector.maxTxPower} dBm)' : l10n.settings_txPowerHelper, + errorText: _txPowerError, ), keyboardType: TextInputType.number, ), @@ -1683,7 +1733,12 @@ class _RadioSettingsDialogState extends State<_RadioSettingsDialog> { onPressed: () => Navigator.pop(context), child: Text(l10n.common_cancel), ), - FilledButton(onPressed: _saveSettings, child: Text(l10n.common_save)), + FilledButton( + onPressed: (_frequencyError != null || _txPowerError != null) + ? null + : _saveSettings, + child: Text(l10n.common_save), + ), ], ); } diff --git a/lib/screens/tcp_screen.dart b/lib/screens/tcp_screen.dart index a0d71922..755a4298 100644 --- a/lib/screens/tcp_screen.dart +++ b/lib/screens/tcp_screen.dart @@ -95,12 +95,14 @@ class _TcpScreenState extends State { final isConnecting = connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.tcp; - final isButtonDisabled = - isConnecting || - connector.state == MeshCoreConnectionState.scanning; + // A running BLE scan must not block TCP connect: connectTcp() stops + // any active scan before connecting, so the only reason to disable + // the button is a TCP connect already in flight. + final isButtonDisabled = isConnecting; return Column( children: [ _buildStatusBar(context, connector), + _buildTransportLinks(context), Padding( padding: const EdgeInsets.all(16), child: Column( @@ -154,40 +156,32 @@ class _TcpScreenState extends State { }, ), ), - bottomNavigationBar: SafeArea( - top: false, - minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerRight, - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - if (PlatformInfo.supportsUsbSerial) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const UsbScreen()), - ); - }, - heroTag: 'tcp_usb_action', - extendedPadding: const EdgeInsets.symmetric(horizontal: 12), - icon: const Icon(Icons.usb), - label: Text(context.l10n.connectionChoiceUsbLabel), - ), - if (PlatformInfo.supportsUsbSerial) const SizedBox(width: 12), - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).maybePop(); - }, - heroTag: 'tcp_ble_action', - extendedPadding: const EdgeInsets.symmetric(horizontal: 12), - icon: const Icon(Icons.bluetooth), - label: Text(context.l10n.connectionChoiceBluetoothLabel), - ), - ], + ); + } + + Widget _buildTransportLinks(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Wrap( + spacing: 12, + runSpacing: 8, + children: [ + if (PlatformInfo.supportsUsbSerial) + OutlinedButton.icon( + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (_) => const UsbScreen()), + ); + }, + icon: const Icon(Icons.usb), + label: Text(context.l10n.connectionChoiceUsbLabel), + ), + OutlinedButton.icon( + onPressed: () => Navigator.of(context).maybePop(), + icon: const Icon(Icons.bluetooth), + label: Text(context.l10n.connectionChoiceBluetoothLabel), ), - ), + ], ), ); } @@ -214,7 +208,7 @@ class _TcpScreenState extends State { statusColor = Colors.orange; } else { statusText = l10n.tcpStatus_notConnected; - statusColor = Colors.grey; + statusColor = Theme.of(context).colorScheme.onSurfaceVariant; } return Container( @@ -226,15 +220,13 @@ class _TcpScreenState extends State { Icon(Icons.circle, size: 12, color: statusColor), const SizedBox(width: 8), Expanded( - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - statusText, - style: TextStyle( - color: statusColor, - fontWeight: FontWeight.w500, - ), + child: Text( + statusText, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: statusColor, + fontWeight: FontWeight.w500, ), ), ), @@ -274,7 +266,7 @@ class _TcpScreenState extends State { showDismissibleSnackBar( context, content: Text(message), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index f277a8e1..6634a6af 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -13,7 +13,7 @@ import '../connector/meshcore_protocol.dart'; import '../services/app_settings_service.dart'; import '../services/repeater_command_service.dart'; import '../utils/app_logger.dart'; -import '../widgets/path_management_dialog.dart'; +import '../widgets/routing_sheet.dart'; import '../helpers/cayenne_lpp.dart'; import '../utils/battery_utils.dart'; import '../helpers/snack_bar_builder.dart'; @@ -118,7 +118,7 @@ class _TelemetryScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.telemetry_requestTimeout), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } if (isAutoRefreshRequest && _isAutoRefreshEnabled) { @@ -178,7 +178,6 @@ class _TelemetryScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.telemetry_receivedData), - backgroundColor: Colors.green, ); } _statusTimeout?.cancel(); @@ -235,7 +234,7 @@ class _TelemetryScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.telemetry_errorLoading(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -323,7 +322,11 @@ class _TelemetryScreenState extends State { final connector = context.watch(); final settings = context.watch().settings; final isImperialUnits = settings.unitSystem == UnitSystem.imperial; - final isFloodMode = widget.contact.pathOverride == -1; + final contact = connector.contacts.firstWhere( + (c) => c.publicKeyHex == widget.contact.publicKeyHex, + orElse: () => widget.contact, + ); + final isFloodMode = contact.pathOverride == -1; return Scaffold( appBar: AppBar( @@ -347,70 +350,11 @@ class _TelemetryScreenState extends State { centerTitle: false, bottom: const SyncProgressAppBarBottom(), actions: [ - PopupMenuButton( + IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), tooltip: l10n.repeater_routingMode, - onSelected: (mode) async { - if (mode == 'flood') { - await connector.setPathOverride(widget.contact, pathLen: -1); - } else { - await connector.setPathOverride(widget.contact, pathLen: null); - } - }, - itemBuilder: (context) => [ - PopupMenuItem( - value: 'auto', - child: Row( - children: [ - Icon( - Icons.auto_mode, - size: 20, - color: !isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_autoUseSavedPath, - style: TextStyle( - fontWeight: !isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - PopupMenuItem( - value: 'flood', - child: Row( - children: [ - Icon( - Icons.waves, - size: 20, - color: isFloodMode - ? Theme.of(context).primaryColor - : null, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_forceFloodMode, - style: TextStyle( - fontWeight: isFloodMode - ? FontWeight.bold - : FontWeight.normal, - ), - ), - ], - ), - ), - ], - ), - IconButton( - icon: const Icon(Icons.timeline), - tooltip: l10n.repeater_pathManagement, onPressed: () => - PathManagementDialog.show(context, contact: widget.contact), + ContactRoutingSheet.show(context, contact: widget.contact), ), IconButton( icon: _isLoading @@ -441,7 +385,7 @@ class _TelemetryScreenState extends State { Center( child: Text( l10n.telemetry_noData, - style: const TextStyle(fontSize: 16, color: Colors.grey), + style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ), if ((_isLoaded || _hasData) && @@ -718,14 +662,14 @@ class _TelemetryScreenState extends State { alignment: Alignment.center, children: [ Center(child: Text(l10n.common_disable)), - const Positioned( + Positioned( right: 0, child: SizedBox( width: 18, height: 18, child: CircularProgressIndicator( strokeWidth: 2, - color: Colors.white, + color: Theme.of(context).colorScheme.onPrimary, ), ), ), @@ -971,21 +915,20 @@ class _TelemetryScreenState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - width: 130, + Expanded( child: Text( label, style: TextStyle( - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, fontWeight: FontWeight.w500, ), ), ), - Expanded( - child: Text( - value, - style: const TextStyle(fontWeight: FontWeight.w400), - ), + const SizedBox(width: 8), + Text( + value, + style: const TextStyle(fontWeight: FontWeight.w400), + textAlign: TextAlign.end, ), ], ), diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index 25992de8..331de5e3 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -12,7 +12,6 @@ import '../utils/usb_port_labels.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; -import 'scanner_screen.dart'; import 'tcp_screen.dart'; class UsbScreen extends StatefulWidget { @@ -100,81 +99,62 @@ class _UsbScreenState extends State { return Column( children: [ _buildStatusBar(context, connector), + _buildTransportLinks(context), Expanded(child: _buildPortList(context, connector)), ], ); }, ), ), - bottomNavigationBar: Consumer( - builder: (context, connector, child) { - final isLoading = _isLoadingPorts; - final showBle = true; - final showTcp = !PlatformInfo.isWeb; - - return SafeArea( - top: false, - minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerRight, + bottomNavigationBar: _supportsHotPlug + ? null + : SafeArea( + top: false, + minimum: const EdgeInsets.fromLTRB(16, 8, 16, 16), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - if (showTcp) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => const TcpScreen()), - ); - }, - heroTag: 'usb_tcp_action', - extendedPadding: const EdgeInsets.symmetric( - horizontal: 12, - ), - icon: const Icon(Icons.lan), - label: Text(context.l10n.connectionChoiceTcpLabel), - ), - if (showTcp && showBle) const SizedBox(width: 12), - if (showBle) - FloatingActionButton.extended( - onPressed: () { - Navigator.of(context).pushReplacement( - MaterialPageRoute( - builder: (_) => const ScannerScreen(), - ), - ); - }, - heroTag: 'usb_ble_action', - extendedPadding: const EdgeInsets.symmetric( - horizontal: 12, - ), - icon: const Icon(Icons.bluetooth), - label: Text(context.l10n.connectionChoiceBluetoothLabel), - ), - if ((showTcp || showBle) && !_supportsHotPlug) - const SizedBox(width: 12), - if (!_supportsHotPlug) - FloatingActionButton.extended( - onPressed: isLoading ? null : _loadPorts, - heroTag: 'usb_refresh_action', - extendedPadding: const EdgeInsets.symmetric( - horizontal: 12, - ), - icon: isLoading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.usb), - label: Text(context.l10n.scanner_scan), - ), + FloatingActionButton.extended( + onPressed: _isLoadingPorts ? null : _loadPorts, + heroTag: 'usb_refresh_action', + icon: _isLoadingPorts + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.usb), + label: Text(context.l10n.scanner_scan), + ), ], ), ), - ); - }, + ); + } + + Widget _buildTransportLinks(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Wrap( + spacing: 12, + runSpacing: 8, + children: [ + if (!PlatformInfo.isWeb) + OutlinedButton.icon( + onPressed: () { + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (_) => const TcpScreen()), + ); + }, + icon: const Icon(Icons.lan), + label: Text(context.l10n.connectionChoiceTcpLabel), + ), + OutlinedButton.icon( + onPressed: () => Navigator.of(context).maybePop(), + icon: const Icon(Icons.bluetooth), + label: Text(context.l10n.connectionChoiceBluetoothLabel), + ), + ], ), ); } @@ -186,7 +166,7 @@ class _UsbScreenState extends State { if (_isLoadingPorts) { statusText = l10n.usbStatus_searching; - statusColor = Colors.blue; + statusColor = Theme.of(context).colorScheme.primary; } else if (connector.isUsbTransportConnected) { switch (connector.state) { case MeshCoreConnectionState.connected: @@ -199,7 +179,7 @@ class _UsbScreenState extends State { statusColor = Colors.orange; default: statusText = l10n.usbStatus_notConnected; - statusColor = Colors.grey; + statusColor = Theme.of(context).colorScheme.onSurfaceVariant; } } else if (connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.usb) { @@ -207,7 +187,7 @@ class _UsbScreenState extends State { statusColor = Colors.orange; } else { statusText = l10n.usbStatus_notConnected; - statusColor = Colors.grey; + statusColor = Theme.of(context).colorScheme.onSurfaceVariant; } return Container( @@ -219,15 +199,13 @@ class _UsbScreenState extends State { Icon(Icons.circle, size: 12, color: statusColor), const SizedBox(width: 8), Expanded( - child: FittedBox( - fit: BoxFit.scaleDown, - alignment: Alignment.centerLeft, - child: Text( - statusText, - style: TextStyle( - color: statusColor, - fontWeight: FontWeight.w500, - ), + child: Text( + statusText, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: statusColor, + fontWeight: FontWeight.w500, ), ), ), @@ -244,11 +222,11 @@ class _UsbScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.usb, size: 64, color: Colors.grey[400]), + Icon(Icons.usb, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), const SizedBox(height: 16), Text( l10n.usbStatus_searching, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), @@ -260,12 +238,12 @@ class _UsbScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.usb, size: 64, color: Colors.grey[400]), + Icon(Icons.usb, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), const SizedBox(height: 16), Text( l10n.usbScreenEmptyState, textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), @@ -294,10 +272,7 @@ class _UsbScreenState extends State { style: const TextStyle(fontWeight: FontWeight.w500), ), subtitle: showRawName ? Text(rawName) : null, - trailing: ElevatedButton( - onPressed: isConnecting ? null : () => _connectPort(port), - child: Text(l10n.common_connect), - ), + trailing: const Icon(Icons.chevron_right), onTap: isConnecting ? null : () => _connectPort(port), ); }, @@ -387,7 +362,7 @@ class _UsbScreenState extends State { showDismissibleSnackBar( context, content: Text(_friendlyErrorMessage(error)), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } diff --git a/lib/services/message_retry_service.dart b/lib/services/message_retry_service.dart index 733dfc59..a15b9c7d 100644 --- a/lib/services/message_retry_service.dart +++ b/lib/services/message_retry_service.dart @@ -449,6 +449,11 @@ class MessageRetryService extends ChangeNotifier { }); } + void untrack(String messageId) { + _timeoutTimers[messageId]?.cancel(); + _cleanupMessage(messageId); + } + void _cleanupMessage(String messageId) { _moveAckHashesToHistory(messageId); _ackHashToMessageId.removeWhere( diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index b367e0e5..d8e70ce3 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -248,7 +248,7 @@ class NotificationService { await _notifications.show( id: contactId != null ? 'advert:$contactId'.hashCode - : DateTime.now().millisecondsSinceEpoch, + : DateTime.now().millisecondsSinceEpoch & 0x7FFFFFFF, title: _l10n.notification_newTypeDiscovered(contactType), body: contactName, notificationDetails: notificationDetails, @@ -304,7 +304,8 @@ class NotificationService { try { await _notifications.show( - id: channelIndex?.hashCode ?? DateTime.now().millisecondsSinceEpoch, + id: channelIndex?.hashCode ?? + DateTime.now().millisecondsSinceEpoch & 0x7FFFFFFF, title: channelName, body: body, notificationDetails: notificationDetails, diff --git a/lib/services/translation_service.dart b/lib/services/translation_service.dart index 7b1d7f5f..d01155ab 100644 --- a/lib/services/translation_service.dart +++ b/lib/services/translation_service.dart @@ -47,6 +47,7 @@ class TranslationService extends ChangeNotifier { _langDetectInit = initLangDetect(); } + bool _disposed = false; bool _isBusy = false; bool _isDownloading = false; bool _cancelDownloadRequested = false; @@ -215,7 +216,7 @@ class TranslationService extends ChangeNotifier { } _downloadTotalBytes = totalSize; - notifyListeners(); + _notify(); DownloadedModelFile downloaded; if (supportsRange && @@ -268,7 +269,7 @@ class TranslationService extends ChangeNotifier { throw StateError('Model download failed: HTTP ${response.statusCode}'); } _downloadTotalBytes ??= response.contentLength; - notifyListeners(); + _notify(); final trackedStream = _trackDownloadProgress(response.stream); return await _fileStore.writeModelBytes( fileName: fileName, @@ -313,7 +314,7 @@ class TranslationService extends ChangeNotifier { throw const TranslationDownloadCancelled(); } _downloadFileName = 'Merging chunks...'; - notifyListeners(); + _notify(); combineReached = true; return await _fileStore.combineChunks( fileName: fileName, @@ -361,7 +362,7 @@ class TranslationService extends ChangeNotifier { } _cancelDownloadRequested = true; _lastError = 'Download stopped.'; - notifyListeners(); + _notify(); } Future removeModel(TranslationModelRecord model) async { @@ -469,7 +470,7 @@ class TranslationService extends ChangeNotifier { } catch (error) { _lastError = error.toString(); appLogger.warn('Language detection failed: $error'); - notifyListeners(); + _notify(); return null; } } @@ -538,7 +539,7 @@ class TranslationService extends ChangeNotifier { } catch (error) { _lastError = error.toString(); appLogger.warn('Translation request failed: $error'); - notifyListeners(); + _notify(); return null; } } @@ -631,6 +632,10 @@ class TranslationService extends ChangeNotifier { final completer = Completer(); _setBusy(true); _queue = _queue.then((_) async { + if (_disposed) { + completer.completeError(StateError('TranslationService disposed.')); + return; + } try { completer.complete(await action()); } catch (error, stackTrace) { @@ -648,17 +653,24 @@ class TranslationService extends ChangeNotifier { throw const TranslationDownloadCancelled(); } _downloadedBytes += chunk.length; - notifyListeners(); + _notify(); yield chunk; } } + void _notify() { + if (_disposed) { + return; + } + notifyListeners(); + } + void _setBusy(bool value) { if (_isBusy == value) { return; } _isBusy = value; - notifyListeners(); + _notify(); } void _setDownloading(bool value) { @@ -669,11 +681,12 @@ class TranslationService extends ChangeNotifier { _downloadTotalBytes = null; _downloadFileName = null; } - notifyListeners(); + _notify(); } @override void dispose() { + _disposed = true; final engine = _engine; _engine = null; _loadedModelPath = null; diff --git a/lib/theme/mesh_theme.dart b/lib/theme/mesh_theme.dart index 7c35d57c..00b92ec0 100644 --- a/lib/theme/mesh_theme.dart +++ b/lib/theme/mesh_theme.dart @@ -1,34 +1,30 @@ import 'package:flutter/material.dart'; -/// MeshCore redesign palette — warm field-journal dark theme with -/// phosphor-green signal accents. Mirrors values from the redesign spec. +/// MeshCore palette — cool slate dark theme with sky-blue accents. class MeshPalette { MeshPalette._(); - // Surfaces (warm near-black, olive undertone) - static const bg = Color(0xFF0F1412); - static const bg1 = Color(0xFF161C19); - static const bg2 = Color(0xFF1D2521); - static const bg3 = Color(0xFF28322D); - static const bg4 = Color(0xFF34403A); + // Surfaces (cool near-black, slate undertone) + static const bg = Color(0xFF101417); + static const bg1 = Color(0xFF161B1F); + static const bg2 = Color(0xFF1D242A); + static const bg3 = Color(0xFF28313A); + static const bg4 = Color(0xFF344049); // Lines - static const line = Color(0xFF232C28); - static const line2 = Color(0xFF34403A); - static const line3 = Color(0xFF48564F); + static const line = Color(0xFF222B31); + static const line2 = Color(0xFF344049); + static const line3 = Color(0xFF485762); // Ink - static const ink = Color(0xFFEFF3E8); - static const ink2 = Color(0xFFBAC4B5); - static const ink3 = Color(0xFF7C8B82); - static const ink4 = Color(0xFF55635B); + static const ink = Color(0xFFE9EEF3); + static const ink2 = Color(0xFFB5C0C9); + static const ink3 = Color(0xFF7C8A95); + static const ink4 = Color(0xFF556470); - // Signal (phosphor) + // Signal-quality green (used only for SNR coloring, not UI chrome) static const signal = Color(0xFF7BEFA8); static const signalDim = Color(0xFF4DC580); - static const signalBg = Color(0x177BEFA8); // ~9% alpha - static const signalLine = Color(0x427BEFA8); // ~26% - static const signalGlow = Color(0x597BEFA8); // ~35% // Warn (ember) static const warn = Color(0xFFFFA552); @@ -41,8 +37,9 @@ class MeshPalette { static const alertBg = Color(0x1CFF6A5C); static const alertLine = Color(0x52FF6A5C); - // Blue (dusk sky) + // Blue (sky) — primary accent static const blue = Color(0xFF7FCBF5); + static const blueDim = Color(0xFF4A9CC9); static const blueBg = Color(0x1C7FCBF5); static const blueLine = Color(0x477FCBF5); @@ -51,20 +48,20 @@ class MeshPalette { static const magentaBg = Color(0x1CDE7FDB); static const magentaLine = Color(0x47DE7FDB); - // Me bubble (mossy) - static const me = Color(0xFF1E3527); - static const meBorder = Color(0xFF2D5039); - static const meInk = Color(0xFFDEF0DC); + // Me bubble (dusk blue) + static const me = Color(0xFF1B2C3D); + static const meBorder = Color(0xFF2C4A66); + static const meInk = Color(0xFFDCE9F5); // ── Light variant (used when user explicitly picks light theme) - static const lightBg = Color(0xFFF5F3EC); - static const lightBg1 = Color(0xFFECE9DF); - static const lightBg2 = Color(0xFFE2DED2); - static const lightLine = Color(0xFFCAC5B4); - static const lightInk = Color(0xFF0F1410); - static const lightInk2 = Color(0xFF3D463E); - static const lightInk3 = Color(0xFF6A756D); - static const lightSignal = Color(0xFF1A7A44); + static const lightBg = Color(0xFFF4F6F8); + static const lightBg1 = Color(0xFFEAEEF2); + static const lightBg2 = Color(0xFFDFE5EA); + static const lightLine = Color(0xFFC3CCD4); + static const lightInk = Color(0xFF10161B); + static const lightInk2 = Color(0xFF3C4853); + static const lightInk3 = Color(0xFF69767F); + static const lightBlue = Color(0xFF2F6EA8); } /// Named font stacks — Flutter falls back to system fonts when the named @@ -115,14 +112,18 @@ class MeshTheme { static ThemeData dark() { const scheme = ColorScheme.dark( - primary: MeshPalette.signal, - onPrimary: Color(0xFF0A1810), - primaryContainer: MeshPalette.signalBg, - onPrimaryContainer: MeshPalette.signal, - secondary: MeshPalette.blue, - onSecondary: Color(0xFF0A1520), - tertiary: MeshPalette.magenta, - onTertiary: Color(0xFF201020), + primary: MeshPalette.blue, + onPrimary: Color(0xFF0A1A26), + primaryContainer: MeshPalette.blueBg, + onPrimaryContainer: MeshPalette.blue, + secondary: MeshPalette.magenta, + onSecondary: Color(0xFF201020), + secondaryContainer: Color(0xFF331A33), + onSecondaryContainer: MeshPalette.magenta, + tertiary: MeshPalette.warn, + onTertiary: Color(0xFF1F1206), + tertiaryContainer: Color(0xFF3A2710), + onTertiaryContainer: Color(0xFFFFC58A), error: MeshPalette.alert, onError: Color(0xFF1A0A08), errorContainer: MeshPalette.alertBg, @@ -141,33 +142,39 @@ class MeshTheme { scrim: Colors.black54, inverseSurface: MeshPalette.ink, onInverseSurface: MeshPalette.bg, - inversePrimary: MeshPalette.signalDim, + inversePrimary: MeshPalette.blueDim, ); return _build(scheme, Brightness.dark); } static ThemeData light() { const scheme = ColorScheme.light( - primary: MeshPalette.lightSignal, + primary: MeshPalette.lightBlue, onPrimary: Colors.white, - primaryContainer: Color(0xFFD4E8D8), - onPrimaryContainer: MeshPalette.lightSignal, - secondary: Color(0xFF2F6EA8), + primaryContainer: Color(0xFFD3E4F5), + onPrimaryContainer: Color(0xFF12354F), + secondary: Color(0xFF8C4A8A), onSecondary: Colors.white, - tertiary: Color(0xFF8C4A8A), + secondaryContainer: Color(0xFFEFD6EE), + onSecondaryContainer: Color(0xFF3D1A3C), + tertiary: Color(0xFF9A5B16), onTertiary: Colors.white, + tertiaryContainer: Color(0xFFF8E3C9), + onTertiaryContainer: Color(0xFF4A2A05), error: Color(0xFFB53D2F), onError: Colors.white, + errorContainer: Color(0xFFF6D9D4), + onErrorContainer: Color(0xFF5C1A12), surface: MeshPalette.lightBg, onSurface: MeshPalette.lightInk, surfaceContainerLowest: MeshPalette.lightBg, surfaceContainerLow: MeshPalette.lightBg1, surfaceContainer: MeshPalette.lightBg1, surfaceContainerHigh: MeshPalette.lightBg2, - surfaceContainerHighest: Color(0xFFD5D0C0), + surfaceContainerHighest: Color(0xFFD2DAE1), onSurfaceVariant: MeshPalette.lightInk2, outline: MeshPalette.lightLine, - outlineVariant: Color(0xFFDBD6C6), + outlineVariant: Color(0xFFD8DEE5), ); return _build(scheme, Brightness.light); } diff --git a/lib/widgets/byte_count_input.dart b/lib/widgets/byte_count_input.dart index ca432522..91f638b8 100644 --- a/lib/widgets/byte_count_input.dart +++ b/lib/widgets/byte_count_input.dart @@ -86,7 +86,7 @@ class ByteCountedTextField extends StatelessWidget { final counterColor = ratio > errorThreshold ? Theme.of(context).colorScheme.error : ratio > warningThreshold - ? Colors.orange + ? Theme.of(context).colorScheme.tertiary : Theme.of(context).colorScheme.onSurfaceVariant; return Column( @@ -118,8 +118,9 @@ class ByteCountedTextField extends StatelessWidget { textInputAction: textInputAction, onSubmitted: onSubmitted, ), - if (showCounter) - Padding( + Opacity( + opacity: showCounter ? 1 : 0, + child: Padding( padding: const EdgeInsets.only(top: 4, right: 4), child: Align( alignment: Alignment.centerRight, @@ -129,6 +130,7 @@ class ByteCountedTextField extends StatelessWidget { ), ), ), + ), ], ); }, diff --git a/lib/widgets/device_tile.dart b/lib/widgets/device_tile.dart index 3f30b38e..9012128c 100644 --- a/lib/widgets/device_tile.dart +++ b/lib/widgets/device_tile.dart @@ -6,9 +6,15 @@ import 'signal_ui.dart'; /// A reusable tile widget for displaying a MeshCore device in a list class DeviceTile extends StatelessWidget { final ScanResult scanResult; - final VoidCallback onTap; + final VoidCallback? onTap; + final bool isConnecting; - const DeviceTile({super.key, required this.scanResult, required this.onTap}); + const DeviceTile({ + super.key, + required this.scanResult, + required this.onTap, + this.isConnecting = false, + }); @override Widget build(BuildContext context) { @@ -19,16 +25,20 @@ class DeviceTile extends StatelessWidget { : scanResult.advertisementData.advName; return ListTile( + enabled: onTap != null || isConnecting, leading: _buildSignalIcon(rssi), title: Text( name.isNotEmpty ? name : context.l10n.common_unknownDevice, style: const TextStyle(fontWeight: FontWeight.w500), ), subtitle: Text(device.remoteId.toString()), - trailing: ElevatedButton( - onPressed: onTap, - child: Text(context.l10n.common_connect), - ), + trailing: isConnecting + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : null, onTap: onTap, ); } diff --git a/lib/widgets/empty_state.dart b/lib/widgets/empty_state.dart index 172c9a4e..718c1c44 100644 --- a/lib/widgets/empty_state.dart +++ b/lib/widgets/empty_state.dart @@ -17,18 +17,22 @@ class EmptyState extends StatelessWidget { @override Widget build(BuildContext context) { + final onSurfaceVariant = Theme.of(context).colorScheme.onSurfaceVariant; return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(icon, size: 64, color: Colors.grey[400]), + Icon(icon, size: 64, color: onSurfaceVariant.withValues(alpha: 0.6)), const SizedBox(height: 16), - Text(title, style: TextStyle(fontSize: 16, color: Colors.grey[600])), + Text(title, style: TextStyle(fontSize: 16, color: onSurfaceVariant)), if (subtitle != null) ...[ const SizedBox(height: 8), Text( subtitle!, - style: TextStyle(fontSize: 14, color: Colors.grey[500]), + style: TextStyle( + fontSize: 14, + color: onSurfaceVariant.withValues(alpha: 0.8), + ), textAlign: TextAlign.center, ), ], diff --git a/lib/widgets/gif_picker.dart b/lib/widgets/gif_picker.dart index 9c569512..df27ec68 100644 --- a/lib/widgets/gif_picker.dart +++ b/lib/widgets/gif_picker.dart @@ -180,7 +180,7 @@ class _GifPickerState extends State { const SizedBox(height: 8), Text( context.l10n.gifPicker_poweredBy, - style: TextStyle(fontSize: 11, color: Colors.grey[600]), + style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), @@ -197,11 +197,11 @@ class _GifPickerState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.error_outline, size: 64, color: Colors.grey[400]), + Icon(Icons.error_outline, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), const SizedBox(height: 16), Text( _error!, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 16), ElevatedButton.icon( @@ -219,11 +219,11 @@ class _GifPickerState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.search_off, size: 64, color: Colors.grey[400]), + Icon(Icons.search_off, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), const SizedBox(height: 16), Text( context.l10n.gifPicker_noGifsFound, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), + style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), ), ], ), diff --git a/lib/widgets/message_status_icon.dart b/lib/widgets/message_status_icon.dart index 0689f0b5..cf9cd7d6 100644 --- a/lib/widgets/message_status_icon.dart +++ b/lib/widgets/message_status_icon.dart @@ -1,36 +1,155 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -class MessageStatusIcon extends StatelessWidget { +import '../l10n/l10n.dart'; + +class MessageStatusIcon extends StatefulWidget { final bool isAcked; final bool isFailed; + final bool isPending; + final bool isRepeated; final double size; + /// Base tint for the sent/sending state. On a colored (outgoing) bubble a + /// plain grey tick is nearly invisible, so callers can pass the bubble's own + /// meta/text color for contrast. Falls back to [ColorScheme.onSurfaceVariant]. + final Color? onColor; + const MessageStatusIcon({ super.key, required this.isAcked, this.isFailed = false, + this.isPending = false, + this.isRepeated = false, this.size = 14, + this.onColor, + }); + + @override + State createState() => _MessageStatusIconState(); +} + +class _MessageStatusIconState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 1200), + ); + if (widget.isPending) _controller.repeat(); + } + + @override + void didUpdateWidget(MessageStatusIcon oldWidget) { + super.didUpdateWidget(oldWidget); + if (widget.isPending && !_controller.isAnimating) { + _controller.repeat(); + } else if (!widget.isPending && _controller.isAnimating) { + _controller + ..stop() + ..reset(); + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final colorScheme = Theme.of(context).colorScheme; + final double size = widget.size; + final Color baseColor = widget.onColor ?? colorScheme.onSurfaceVariant; + + if (widget.isFailed) { + return Semantics( + label: l10n.messageStatus_failed, + child: Icon(Icons.cancel, size: size, color: colorScheme.error), + ); + } + + if (widget.isPending) { + return Semantics( + label: l10n.messageStatus_pending, + child: _SendingDots( + controller: _controller, + color: baseColor, + size: size, + ), + ); + } + + final bool delivered = widget.isAcked || widget.isRepeated; + final String label = widget.isRepeated + ? l10n.messageStatus_repeated + : widget.isAcked + ? l10n.messageStatus_delivered + : l10n.messageStatus_sent; + final Color color = delivered ? colorScheme.tertiary : baseColor; + + return Semantics( + label: label, + child: delivered + ? SvgPicture.asset( + 'assets/icons/done_all.svg', + width: size, + height: size, + colorFilter: ColorFilter.mode(color, BlendMode.srcIn), + ) + : Icon(Icons.done, size: size, color: color), + ); + } +} + +/// Three dots that pulse left-to-right while a message is in flight. +class _SendingDots extends StatelessWidget { + final AnimationController controller; + final Color color; + final double size; + + const _SendingDots({ + required this.controller, + required this.color, + required this.size, }); @override Widget build(BuildContext context) { - if (isFailed) { - return Icon(Icons.cancel, size: size, color: Colors.red); - } - - final Color color; - if (isAcked) { - color = Colors.green; - } else { - color = Colors.grey; - } - - return SvgPicture.asset( - 'assets/icons/done_all.svg', - width: size, + final double dot = (size * 0.24).clamp(2.0, 4.0); + return SizedBox( height: size, - colorFilter: ColorFilter.mode(color, BlendMode.srcIn), + child: AnimatedBuilder( + animation: controller, + builder: (context, _) { + return Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: List.generate(3, (i) { + final double phase = (controller.value - i * 0.18) % 1.0; + final double t = phase < 0.5 ? phase * 2 : (1 - phase) * 2; + final double opacity = 0.25 + 0.75 * t.clamp(0.0, 1.0); + return Padding( + padding: EdgeInsets.symmetric(horizontal: dot * 0.28), + child: Container( + width: dot, + height: dot, + decoration: BoxDecoration( + color: color.withValues(alpha: opacity), + shape: BoxShape.circle, + ), + ), + ); + }), + ); + }, + ), ); } } diff --git a/lib/widgets/path_editor_sheet.dart b/lib/widgets/path_editor_sheet.dart new file mode 100644 index 00000000..66c1fa4b --- /dev/null +++ b/lib/widgets/path_editor_sheet.dart @@ -0,0 +1,377 @@ +import 'dart:typed_data'; + +import 'package:flutter/material.dart'; + +import '../connector/meshcore_protocol.dart'; +import '../helpers/path_helper.dart'; +import '../l10n/contact_localization.dart'; +import '../l10n/l10n.dart'; +import '../models/contact.dart'; + +class PathEditorSheet extends StatefulWidget { + final List availableContacts; + final List initialPath; + + const PathEditorSheet({ + super.key, + required this.availableContacts, + this.initialPath = const [], + }); + + static Future show( + BuildContext context, { + required List availableContacts, + List initialPath = const [], + }) { + return showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (context) => Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.of(context).viewInsets.bottom, + ), + child: FractionallySizedBox( + heightFactor: 0.9, + child: PathEditorSheet( + availableContacts: availableContacts, + initialPath: initialPath, + ), + ), + ), + ); + } + + @override + State createState() => _PathEditorSheetState(); +} + +class _Hop { + final int id; + final int byte; + + const _Hop(this.id, this.byte); +} + +class _PathEditorSheetState extends State { + static const int _maxHops = 64; + + final List<_Hop> _hops = []; + final _hexController = TextEditingController(); + String? _hexError; + bool _syncingHex = false; + String _search = ''; + int _nextHopId = 0; + + @override + void initState() { + super.initState(); + for (final byte in widget.initialPath) { + _hops.add(_Hop(_nextHopId++, byte)); + } + _syncHexFromHops(); + } + + @override + void dispose() { + _hexController.dispose(); + super.dispose(); + } + + List get _repeaters { + final query = _search.trim().toLowerCase(); + return widget.availableContacts + .where((c) => c.type == advTypeRepeater || c.type == advTypeRoom) + .where((c) => c.publicKey.isNotEmpty) + .where((c) => query.isEmpty || c.name.toLowerCase().contains(query)) + .toList() + ..sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase())); + } + + void _syncHexFromHops() { + _syncingHex = true; + _hexController.text = PathHelper.formatPathHex( + _hops.map((h) => h.byte).toList(), + ); + _syncingHex = false; + _hexError = null; + } + + void _onHexChanged(String text) { + if (_syncingHex) return; + final l10n = context.l10n; + final tokens = text + .split(RegExp(r'[,\s]+')) + .where((t) => t.isNotEmpty) + .toList(); + final invalid = tokens + .where((t) => t.length != 2 || int.tryParse(t, radix: 16) == null) + .toList(); + setState(() { + if (invalid.isNotEmpty) { + _hexError = l10n.pathEditor_invalidTokens(invalid.join(', ')); + return; + } + if (tokens.length > _maxHops) { + _hexError = l10n.pathEditor_tooManyHops; + return; + } + _hexError = null; + _hops + ..clear() + ..addAll(tokens.map((t) => _Hop(_nextHopId++, int.parse(t, radix: 16)))); + }); + } + + void _addHop(Contact contact) { + if (_hops.length >= _maxHops) return; + setState(() { + _hops.add(_Hop(_nextHopId++, contact.publicKey.first)); + _syncHexFromHops(); + }); + } + + void _removeHop(int index) { + setState(() { + _hops.removeAt(index); + _syncHexFromHops(); + }); + } + + void _reorderHop(int oldIndex, int newIndex) { + setState(() { + final hop = _hops.removeAt(oldIndex); + _hops.insert(newIndex, hop); + _syncHexFromHops(); + }); + } + + void _save() { + Navigator.pop( + context, + Uint8List.fromList(_hops.map((h) => h.byte).toList()), + ); + } + + Widget _hopTile(BuildContext context, int index) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final hop = _hops[index]; + final hex = PathHelper.hopHex(hop.byte); + final name = PathHelper.hopName(hop.byte, widget.availableContacts); + + return ListTile( + key: ValueKey(hop.id), + contentPadding: EdgeInsets.zero, + leading: CircleAvatar( + radius: 14, + backgroundColor: scheme.primaryContainer, + child: Text( + '${index + 1}', + style: TextStyle(fontSize: 12, color: scheme.onPrimaryContainer), + ), + ), + title: Text( + name ?? l10n.pathEditor_unknownHop, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + subtitle: Text(hex), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.remove_circle_outline), + tooltip: l10n.pathEditor_removeHop, + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), + onPressed: () => _removeHop(index), + ), + ReorderableDragStartListener( + index: index, + child: const Padding( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 12), + child: Icon(Icons.drag_handle), + ), + ), + ], + ), + ); + } + + Widget _repeaterTile(BuildContext context, Contact contact) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final isRepeater = contact.type == advTypeRepeater; + final full = _hops.length >= _maxHops; + + return ListTile( + contentPadding: EdgeInsets.zero, + enabled: !full, + leading: CircleAvatar( + radius: 16, + backgroundColor: isRepeater + ? scheme.primaryContainer + : scheme.secondaryContainer, + child: Icon( + isRepeater ? Icons.router : Icons.meeting_room, + size: 16, + color: isRepeater + ? scheme.onPrimaryContainer + : scheme.onSecondaryContainer, + ), + ), + title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), + subtitle: Text( + '${contact.typeLabel(l10n)} • ${PathHelper.hopHex(contact.publicKey.first)}', + ), + trailing: const Icon(Icons.add_circle_outline), + onTap: full ? null : () => _addHop(contact), + ); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + final repeaters = _repeaters; + + return Column( + children: [ + const SizedBox(height: 8), + Container( + width: 32, + height: 4, + decoration: BoxDecoration( + color: scheme.outlineVariant, + borderRadius: BorderRadius.circular(2), + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(l10n.pathEditor_title, style: theme.textTheme.titleLarge), + Text( + l10n.pathEditor_hopCounter(_hops.length), + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Expanded( + child: ListView( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 8), + children: [ + if (_hops.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Text( + l10n.pathEditor_noHops, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ) + else + ReorderableListView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + buildDefaultDragHandles: false, + itemCount: _hops.length, + onReorderItem: _reorderHop, + itemBuilder: _hopTile, + ), + const Divider(), + const SizedBox(height: 8), + Text( + l10n.pathEditor_addHops, + style: theme.textTheme.titleSmall, + ), + const SizedBox(height: 8), + TextField( + onChanged: (value) => setState(() => _search = value), + decoration: InputDecoration( + labelText: l10n.pathEditor_searchRepeaters, + prefixIcon: const Icon(Icons.search), + border: const OutlineInputBorder(), + isDense: true, + ), + ), + const SizedBox(height: 4), + if (repeaters.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Text( + l10n.path_noRepeatersFound, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ) + else + ...repeaters.map((c) => _repeaterTile(context, c)), + ExpansionTile( + tilePadding: EdgeInsets.zero, + title: Text( + l10n.pathEditor_advancedHex, + style: theme.textTheme.titleSmall, + ), + children: [ + Padding( + padding: const EdgeInsets.only(bottom: 12), + child: TextField( + controller: _hexController, + onChanged: _onHexChanged, + textCapitalization: TextCapitalization.characters, + decoration: InputDecoration( + labelText: l10n.pathEditor_hexLabel, + helperText: _hexError == null + ? l10n.pathEditor_hexHelper + : null, + errorText: _hexError, + border: const OutlineInputBorder(), + ), + ), + ), + ], + ), + ], + ), + ), + SafeArea( + top: false, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: TextButton( + style: TextButton.styleFrom( + minimumSize: const Size.fromHeight(48), + ), + onPressed: () => Navigator.pop(context), + child: Text(l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + style: FilledButton.styleFrom( + minimumSize: const Size.fromHeight(48), + ), + onPressed: _hexError != null ? null : _save, + child: Text(l10n.pathEditor_usePath), + ), + ), + ], + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/path_management_dialog.dart b/lib/widgets/path_management_dialog.dart deleted file mode 100644 index a2122f46..00000000 --- a/lib/widgets/path_management_dialog.dart +++ /dev/null @@ -1,510 +0,0 @@ -import 'dart:typed_data'; - -import 'package:flutter/material.dart'; -import 'package:meshcore_open/models/path_history.dart'; -import 'package:meshcore_open/screens/path_trace_map.dart'; -import 'package:meshcore_open/widgets/elements_ui.dart'; -import 'package:provider/provider.dart'; - -import '../connector/meshcore_connector.dart'; -import '../l10n/l10n.dart'; -import '../models/contact.dart'; -import '../l10n/contact_localization.dart'; -import '../helpers/path_helper.dart'; -import '../services/path_history_service.dart'; -import '../helpers/snack_bar_builder.dart'; -import 'path_selection_dialog.dart'; - -class PathManagementDialog { - static Future show(BuildContext context, {required Contact contact}) { - return showDialog( - context: context, - builder: (context) => _PathManagementDialog(contact: contact), - ); - } -} - -class _PathManagementDialog extends StatefulWidget { - final Contact contact; - - const _PathManagementDialog({required this.contact}); - - @override - State<_PathManagementDialog> createState() => _PathManagementDialogState(); -} - -class _PathManagementDialogState extends State<_PathManagementDialog> { - bool _showAllPaths = false; - - int _resolveContactIndex = -1; - - Contact _resolveContact(MeshCoreConnector connector) { - if (_resolveContactIndex >= 0 && - _resolveContactIndex < connector.contacts.length && - connector.contacts[_resolveContactIndex].publicKeyHex == - widget.contact.publicKeyHex) { - return connector.contacts[_resolveContactIndex]; - } - _resolveContactIndex = connector.contacts.indexWhere( - (c) => c.publicKeyHex == widget.contact.publicKeyHex, - ); - if (_resolveContactIndex == -1) { - return widget.contact; - } - return connector.contacts[_resolveContactIndex]; - } - - String _formatRelativeTime(BuildContext context, DateTime? time) { - if (time == null) return '—'; - final l10n = context.l10n; - final diff = DateTime.now().difference(time); - if (diff.inSeconds < 60) return l10n.time_justNow; - if (diff.inMinutes < 60) return l10n.time_minutesAgo(diff.inMinutes); - if (diff.inHours < 24) return l10n.time_hoursAgo(diff.inHours); - return l10n.time_daysAgo(diff.inDays); - } - - void _showFullPathDialog(BuildContext context, List pathBytes) { - final l10n = context.l10n; - if (pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text(l10n.chat_pathDetailsNotAvailable), - duration: const Duration(seconds: 2), - ); - return; - } - - final connector = context.read(); - final allContacts = connector.allContacts; - - final formattedPath = PathHelper.formatPathHex(pathBytes); - final resolvedNames = PathHelper.resolvePathNames(pathBytes, allContacts); - - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(l10n.chat_fullPath), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText(formattedPath), - const SizedBox(height: 8), - SelectableText( - resolvedNames, - style: TextStyle( - fontSize: 13, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: context.l10n.contacts_repeaterPathTrace, - path: Uint8List.fromList(pathBytes), - flipPathAround: true, - targetContact: widget.contact, - pathHashByteWidth: connector.pathHashByteWidth, - ), - ), - ), - child: Text(context.l10n.contacts_pathTrace), - ), - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(l10n.common_close), - ), - ], - ), - ); - } - - Future _setCustomPath( - BuildContext context, - MeshCoreConnector connector, - Contact currentContact, - ) async { - final l10n = context.l10n; - if (currentContact.pathLength > 0 && - currentContact.path.isEmpty && - connector.isConnected) { - connector.getContacts(); - } - - final pathForInput = currentContact.pathFormattedIdList( - connector.pathHashByteWidth, - ); - final availableContacts = connector.allContacts - .where((c) => c.publicKeyHex != currentContact.publicKeyHex) - .toList(); - - final result = await PathSelectionDialog.show( - context, - availableContacts: availableContacts, - initialPath: pathForInput.isEmpty ? null : pathForInput, - currentPathLabel: currentContact.pathLabel(l10n), - onRefresh: connector.isConnected ? connector.getContacts : null, - ); - - if (result != null && context.mounted) { - await connector.setPathOverride( - currentContact, - pathLen: result.length, - pathBytes: result, - ); - - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.chat_hopsCount(result.length)), - duration: const Duration(seconds: 2), - ); - } - } - - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - return Consumer2( - builder: (context, connector, pathService, _) { - final currentContact = _resolveContact(connector); - final paths = pathService.getRecentPaths(currentContact.publicKeyHex); - - final repeatersList = List.of(connector.directRepeaters) - ..sort((a, b) => b.ranking.compareTo(a.ranking)); - - if (repeatersList.isEmpty) { - _showAllPaths = true; - } - - final directRepeater = repeatersList.isEmpty - ? null - : repeatersList.first; - final secondDirectRepeater = repeatersList.length < 2 - ? null - : repeatersList.elementAt(1); - final thirdDirectRepeater = repeatersList.length < 3 - ? null - : repeatersList.elementAt(2); - - List>> pathsWithRepeaters = - paths.map((path) { - final isDirectRepeater = - directRepeater != null && - path.pathBytes.isNotEmpty && - directRepeater.pubkeyFirstByte == path.pathBytes.first; - final isSecondDirectRepeater = - secondDirectRepeater != null && - path.pathBytes.isNotEmpty && - secondDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - final isThirdDirectRepeater = - thirdDirectRepeater != null && - path.pathBytes.isNotEmpty && - thirdDirectRepeater.pubkeyFirstByte == path.pathBytes.first; - - int ranking = -1; - Color color = Colors.grey; - if (isDirectRepeater) { - color = Colors.green; - ranking = 3; - } else if (isSecondDirectRepeater) { - color = Colors.yellow; - ranking = 2; - } else if (isThirdDirectRepeater) { - color = Colors.red; - ranking = 1; - } else if (path.wasFloodDiscovery) { - color = Colors.blue; - ranking = 0; - } - - return MapEntry(ranking, MapEntry(color, path)); - }).toList(); - - pathsWithRepeaters.sort((a, b) => b.key.compareTo(a.key)); - - return AlertDialog( - title: Text(l10n.chat_pathManagement), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - l10n.path_currentPath(currentContact.pathLabel(l10n)), - style: const TextStyle(fontSize: 12, color: Colors.grey), - ), - const SizedBox(height: 12), - if (paths.isNotEmpty) ...[ - if (repeatersList.isNotEmpty) - FeatureToggleRow( - title: l10n.chat_ShowAllPaths, - subtitle: "", - value: _showAllPaths, - onChanged: (val) { - setState(() { - _showAllPaths = val; - }); - }, - ), - Text( - l10n.chat_recentAckPaths, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - if (pathsWithRepeaters.length >= 100) ...[ - const SizedBox(height: 8), - Container( - width: double.infinity, - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - decoration: BoxDecoration( - color: Colors.amberAccent, - borderRadius: BorderRadius.circular(8), - ), - child: Text( - l10n.chat_pathHistoryFull, - style: const TextStyle(fontSize: 12), - ), - ), - ], - const SizedBox(height: 8), - ...pathsWithRepeaters.map((entry) { - final path = entry.value.value; - final color = entry.value.key; - - if (!_showAllPaths && entry.key < 1) { - return const SizedBox.shrink(); - } else { - return Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: CircleAvatar( - radius: 16, - backgroundColor: color, - child: Text( - path.routeWeight.toStringAsFixed(1), - style: const TextStyle(fontSize: 10), - ), - ), - title: Text( - l10n.chat_hopsCount(path.hopCount), - style: const TextStyle(fontSize: 14), - ), - isThreeLine: true, - subtitle: Text( - '${(path.tripTimeMs / 1000).toStringAsFixed(2)}s • ${_formatRelativeTime(context, path.timestamp)}\n${path.successCount} ${l10n.chat_successes} • ${l10n.chat_score}: ${path.routeWeight.toStringAsFixed(1)}', - style: const TextStyle(fontSize: 11), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.close, size: 16), - tooltip: l10n.chat_removePath, - onPressed: () async { - await pathService.removePathRecord( - currentContact.publicKeyHex, - path.pathBytes, - ); - }, - ), - path.wasFloodDiscovery - ? const Icon( - Icons.waves, - size: 16, - color: Colors.grey, - ) - : const Icon( - Icons.route, - size: 16, - color: Colors.grey, - ), - ], - ), - onLongPress: () => - _showFullPathDialog(context, path.pathBytes), - onTap: () async { - if (path.pathBytes.isEmpty) { - showDismissibleSnackBar( - context, - content: Text( - l10n.chat_pathDetailsNotAvailable, - ), - duration: const Duration(seconds: 2), - ); - return; - } - - final pathBytes = Uint8List.fromList( - path.pathBytes, - ); - final pathLength = path.pathBytes.length; - - await connector.setPathOverride( - currentContact, - pathLen: pathLength, - pathBytes: pathBytes, - ); - - if (!context.mounted) return; - Navigator.pop(context); - showDismissibleSnackBar( - context, - content: Text( - l10n.path_usingHopsPath(path.hopCount), - ), - duration: const Duration(seconds: 2), - ); - }, - ), - ); - } - }), - const Divider(), - ] else ...[ - Text(l10n.chat_noPathHistoryYet), - const Divider(), - ], - // Flood delivery stats - Builder( - builder: (context) { - final floodStats = pathService.getFloodStats( - currentContact.publicKeyHex, - ); - if (floodStats == null || - (floodStats.successCount == 0 && - floodStats.failureCount == 0)) { - return const SizedBox.shrink(); - } - return Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.blue, - child: Icon(Icons.waves, size: 16), - ), - title: const Text( - 'Flood Mode', - style: TextStyle(fontSize: 14), - ), - subtitle: Text( - '${floodStats.successCount} ${l10n.chat_successes} / ${floodStats.failureCount} failures' - '${floodStats.lastTripTimeMs > 0 ? ' • ${(floodStats.lastTripTimeMs / 1000).toStringAsFixed(2)}s' : ''}' - '${floodStats.lastUsed != null ? ' • ${_formatRelativeTime(context, floodStats.lastUsed!)}' : ''}', - style: const TextStyle(fontSize: 11), - ), - ), - ); - }, - ), - const SizedBox(height: 8), - Text( - l10n.chat_pathActions, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 12, - ), - ), - const SizedBox(height: 8), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.purple, - child: Icon(Icons.edit_road, size: 16), - ), - title: Text( - l10n.chat_setCustomPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - l10n.chat_setCustomPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await _setCustomPath(context, connector, currentContact); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.orange, - child: Icon(Icons.clear_all, size: 16), - ), - title: Text( - l10n.chat_clearPath, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - l10n.chat_clearPathSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.clearContactPath(currentContact); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.chat_pathCleared), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ListTile( - dense: true, - leading: const CircleAvatar( - radius: 16, - backgroundColor: Colors.blue, - child: Icon(Icons.waves, size: 16), - ), - title: Text( - l10n.chat_forceFloodMode, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - l10n.chat_floodModeSubtitle, - style: const TextStyle(fontSize: 11), - ), - onTap: () async { - await connector.setPathOverride( - currentContact, - pathLen: -1, - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.chat_floodModeEnabled), - duration: const Duration(seconds: 2), - ); - Navigator.pop(context); - }, - ), - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(l10n.common_close), - ), - ], - ); - }, - ); - } -} diff --git a/lib/widgets/path_selection_dialog.dart b/lib/widgets/path_selection_dialog.dart deleted file mode 100644 index 44ae58f9..00000000 --- a/lib/widgets/path_selection_dialog.dart +++ /dev/null @@ -1,346 +0,0 @@ -import 'dart:typed_data'; -import 'package:flutter/material.dart'; -import 'package:meshcore_open/connector/meshcore_protocol.dart'; -import '../l10n/l10n.dart'; -import '../models/contact.dart'; -import '../l10n/contact_localization.dart'; -import '../helpers/snack_bar_builder.dart'; - -class PathSelectionDialog extends StatefulWidget { - final List availableContacts; - final String title; - final String? initialPath; - final String? currentPathLabel; - final VoidCallback? onRefresh; - - const PathSelectionDialog({ - super.key, - required this.availableContacts, - required this.title, - this.initialPath, - this.currentPathLabel, - this.onRefresh, - }); - - @override - State createState() => _PathSelectionDialogState(); - - static Future show( - BuildContext context, { - required List availableContacts, - String? title, - String? initialPath, - String? currentPathLabel, - VoidCallback? onRefresh, - }) { - return showDialog( - context: context, - builder: (context) => PathSelectionDialog( - availableContacts: availableContacts, - title: title ?? context.l10n.path_enterCustomPath, - initialPath: initialPath, - currentPathLabel: currentPathLabel, - onRefresh: onRefresh, - ), - ); - } -} - -class _PathSelectionDialogState extends State { - late TextEditingController _controller; - final List _selectedContacts = []; - List _validContacts = []; - - @override - void initState() { - super.initState(); - _controller = TextEditingController(text: widget.initialPath ?? ''); - _filterValidContacts(); - } - - @override - void didUpdateWidget(PathSelectionDialog oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.availableContacts != oldWidget.availableContacts) { - _filterValidContacts(); - } - } - - void _filterValidContacts() { - _validContacts = widget.availableContacts - .where((c) => c.type == advTypeRepeater || c.type == advTypeRoom) - .toList(); - } - - void _updateTextFromContacts() { - final pathParts = _selectedContacts - .map((contact) { - if (contact.publicKeyHex.length >= 2) { - return contact.publicKeyHex.substring(0, 2); - } - return ''; - }) - .where((s) => s.isNotEmpty) - .toList(); - - _controller.text = pathParts.join(','); - } - - void _toggleContact(Contact contact) { - setState(() { - if (_selectedContacts.contains(contact)) { - _selectedContacts.remove(contact); - } else { - _selectedContacts.add(contact); - } - _updateTextFromContacts(); - }); - } - - void _clearSelection() { - setState(() { - _selectedContacts.clear(); - _controller.clear(); - }); - } - - Future _validateAndSubmit() async { - final l10n = context.l10n; - final path = _controller.text.trim().toUpperCase(); - if (path.isEmpty) { - if (mounted) Navigator.pop(context); - return; - } - - // Parse comma-separated hex prefixes - final pathIds = path - .split(',') - .map((s) => s.trim()) - .where((s) => s.isNotEmpty) - .toList(); - final pathBytesList = []; - final invalidPrefixes = []; - - for (final id in pathIds) { - if (id.length < 2) { - invalidPrefixes.add(id); - continue; - } - - final prefix = id.substring(0, 2); - try { - final byte = int.parse(prefix, radix: 16); - pathBytesList.add(byte); - } catch (e) { - invalidPrefixes.add(id); - } - } - - if (!mounted) return; - - // Show error for invalid prefixes - if (invalidPrefixes.isNotEmpty) { - showDismissibleSnackBar( - context, - content: Text(l10n.path_invalidHexPrefixes(invalidPrefixes.join(", "))), - duration: const Duration(seconds: 3), - backgroundColor: Colors.red, - ); - return; - } - - // Check max path length (64 hops) - if (pathBytesList.length > 64) { - showDismissibleSnackBar( - context, - content: Text(l10n.path_tooLong), - duration: const Duration(seconds: 3), - backgroundColor: Colors.red, - ); - return; - } - - if (pathBytesList.isNotEmpty && mounted) { - Navigator.pop(context, Uint8List.fromList(pathBytesList)); - } - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - return AlertDialog( - title: Text(widget.title), - content: SingleChildScrollView( - child: SizedBox( - width: double.maxFinite, - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (widget.currentPathLabel != null) ...[ - Row( - children: [ - Text( - l10n.path_currentPathLabel, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - const Spacer(), - if (widget.onRefresh != null) - TextButton.icon( - onPressed: widget.onRefresh, - icon: const Icon(Icons.refresh, size: 16), - label: Text(l10n.common_reload), - ), - ], - ), - Text( - widget.currentPathLabel!, - style: const TextStyle(fontSize: 11, color: Colors.grey), - ), - const SizedBox(height: 16), - ], - Text( - l10n.path_hexPrefixInstructions, - style: const TextStyle(fontSize: 12, color: Colors.grey), - ), - const SizedBox(height: 8), - Text( - l10n.path_hexPrefixExample, - style: const TextStyle(fontSize: 11, color: Colors.grey), - ), - const SizedBox(height: 16), - TextField( - controller: _controller, - decoration: InputDecoration( - labelText: l10n.path_labelHexPrefixes, - hintText: l10n.path_hexPrefixExample, - border: const OutlineInputBorder(), - helperText: l10n.path_helperMaxHops, - ), - textCapitalization: TextCapitalization.characters, - maxLength: 191, // 64 hops * 2 chars + 63 commas - ), - const SizedBox(height: 16), - const Divider(), - const SizedBox(height: 8), - Row( - children: [ - Text( - l10n.path_selectFromContacts, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - ), - ), - const Spacer(), - if (_selectedContacts.isNotEmpty) - TextButton( - onPressed: _clearSelection, - child: Text(l10n.common_clear), - ), - ], - ), - const SizedBox(height: 8), - if (_validContacts.isEmpty) ...[ - Center( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - children: [ - const Icon( - Icons.info_outline, - size: 48, - color: Colors.grey, - ), - const SizedBox(height: 16), - Text( - l10n.path_noRepeatersFound, - style: const TextStyle(fontSize: 14), - textAlign: TextAlign.center, - ), - const SizedBox(height: 8), - Text( - l10n.path_customPathsRequire, - style: const TextStyle( - fontSize: 12, - color: Colors.grey, - ), - textAlign: TextAlign.center, - ), - ], - ), - ), - ), - ] else ...[ - ConstrainedBox( - constraints: const BoxConstraints(maxHeight: 200), - child: ListView.builder( - shrinkWrap: true, - itemCount: _validContacts.length, - itemBuilder: (context, index) { - final contact = _validContacts[index]; - final isSelected = _selectedContacts.contains(contact); - - return ListTile( - dense: true, - leading: CircleAvatar( - radius: 16, - backgroundColor: isSelected - ? Colors.green - : (contact.type == 2 - ? Colors.blue - : Colors.purple), - child: Icon( - contact.type == 2 - ? Icons.router - : Icons.meeting_room, - size: 16, - color: Colors.white, - ), - ), - title: Text( - contact.name, - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - '${contact.typeLabel(l10n)} • ${contact.publicKeyHex.substring(0, 2)}', - style: const TextStyle(fontSize: 10), - ), - trailing: isSelected - ? const Icon( - Icons.check_circle, - color: Colors.green, - ) - : const Icon(Icons.add_circle_outline), - onTap: () => _toggleContact(contact), - ); - }, - ), - ), - ], - ], - ), - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(l10n.common_cancel), - ), - TextButton( - onPressed: _validateAndSubmit, - child: Text(l10n.path_setPath), - ), - ], - ); - } -} diff --git a/lib/widgets/quick_switch_bar.dart b/lib/widgets/quick_switch_bar.dart index 40dcb59a..bcb4781f 100644 --- a/lib/widgets/quick_switch_bar.dart +++ b/lib/widgets/quick_switch_bar.dart @@ -67,10 +67,12 @@ class QuickSwitchBar extends StatelessWidget { destinations: [ NavigationDestination( icon: _buildIconWithBadge( + context, const Icon(Icons.people_outline), contactsUnreadCount, ), selectedIcon: _buildIconWithBadge( + context, const Icon(Icons.people), contactsUnreadCount, ), @@ -78,10 +80,12 @@ class QuickSwitchBar extends StatelessWidget { ), NavigationDestination( icon: _buildIconWithBadge( + context, const Icon(Icons.tag), channelsUnreadCount, ), selectedIcon: _buildIconWithBadge( + context, const Icon(Icons.tag), channelsUnreadCount, ), @@ -101,26 +105,9 @@ class QuickSwitchBar extends StatelessWidget { ); } - Widget _buildIconWithBadge(Icon icon, int count) { + Widget _buildIconWithBadge(BuildContext context, Icon icon, int count) { if (count <= 0) return icon; - - return Stack( - clipBehavior: Clip.none, - children: [ - icon, - Positioned( - right: -2, - top: -2, - child: Container( - width: 8, - height: 8, - decoration: const BoxDecoration( - color: Colors.redAccent, - shape: BoxShape.circle, - ), - ), - ), - ], - ); + final label = count > 99 ? '99+' : '$count'; + return Badge(label: Text(label), child: icon); } } diff --git a/lib/widgets/radio_stats_entry.dart b/lib/widgets/radio_stats_entry.dart index eda0848a..d5fbc670 100644 --- a/lib/widgets/radio_stats_entry.dart +++ b/lib/widgets/radio_stats_entry.dart @@ -59,11 +59,15 @@ class _RadioStatsIconButtonState extends State { active: connector.radioStatsAirActivityPulse, ); if (widget.compact) { - return GestureDetector( - onTap: () => pushCompanionRadioStatsScreen(context), - child: Padding( - padding: const EdgeInsets.only(left: 4), - child: dot, + return Semantics( + label: context.l10n.radioStats_tooltip, + button: true, + child: GestureDetector( + onTap: () => pushCompanionRadioStatsScreen(context), + child: Padding( + padding: const EdgeInsets.only(left: 4), + child: dot, + ), ), ); } diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 0973faec..9ba8efd9 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import '../utils/platform_info.dart'; import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; @@ -11,7 +10,7 @@ import '../services/storage_service.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../utils/app_logger.dart'; -import 'path_management_dialog.dart'; +import 'routing_sheet.dart'; class RepeaterLoginDialog extends StatefulWidget { final Contact repeater; @@ -276,7 +275,7 @@ class _RepeaterLoginDialogState extends State { return AlertDialog( title: Row( children: [ - const Icon(Icons.cell_tower, color: Colors.orange), + Icon(Icons.cell_tower, color: Theme.of(context).colorScheme.tertiary), const SizedBox(width: 8), Expanded( child: Column( @@ -288,7 +287,7 @@ class _RepeaterLoginDialogState extends State { style: TextStyle( fontSize: 14, fontWeight: FontWeight.normal, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -365,9 +364,7 @@ class _RepeaterLoginDialogState extends State { } }, onSubmitted: (_) => _handleLogin(), - autofocus: - !PlatformInfo.isMobile && - _passwordController.text.isEmpty, + autofocus: _passwordController.text.isEmpty, ), const SizedBox(height: 12), CheckboxListTile( @@ -469,14 +466,14 @@ class _RepeaterLoginDialogState extends State { const SizedBox(height: 4), Text( repeater.pathLabel(context.l10n), - style: const TextStyle(fontSize: 11, color: Colors.grey), + style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 8), Align( alignment: Alignment.centerLeft, child: TextButton.icon( onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), icon: const Icon(Icons.timeline, size: 18), label: Text(l10n.login_managePaths), ), @@ -497,12 +494,12 @@ class _RepeaterLoginDialogState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const SizedBox( + SizedBox( width: 16, height: 16, child: CircularProgressIndicator( strokeWidth: 2, - color: Colors.white, + color: Theme.of(context).colorScheme.onPrimary, ), ), const SizedBox(width: 12), diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index 2641c023..8a737130 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -12,7 +12,7 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../utils/app_logger.dart'; import '../helpers/snack_bar_builder.dart'; -import 'path_management_dialog.dart'; +import 'routing_sheet.dart'; class RoomLoginDialog extends StatefulWidget { final Contact room; @@ -181,7 +181,7 @@ class _RoomLoginDialogState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.login_failed(e.toString())), - backgroundColor: Colors.red, + backgroundColor: Theme.of(context).colorScheme.error, ); } } @@ -232,7 +232,7 @@ class _RoomLoginDialogState extends State { return AlertDialog( title: Row( children: [ - const Icon(Icons.group, color: Colors.purple), + Icon(Icons.group, color: Theme.of(context).colorScheme.secondary), const SizedBox(width: 8), Expanded( child: Column( @@ -244,7 +244,7 @@ class _RoomLoginDialogState extends State { style: TextStyle( fontSize: 14, fontWeight: FontWeight.normal, - color: Colors.grey[600], + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], @@ -395,14 +395,14 @@ class _RoomLoginDialogState extends State { const SizedBox(height: 4), Text( repeater.pathLabel(context.l10n), - style: const TextStyle(fontSize: 11, color: Colors.grey), + style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), ), const SizedBox(height: 8), Align( alignment: Alignment.centerLeft, child: TextButton.icon( onPressed: () => - PathManagementDialog.show(context, contact: repeater), + ContactRoutingSheet.show(context, contact: repeater), icon: const Icon(Icons.timeline, size: 18), label: Text(l10n.login_managePaths), ), @@ -423,12 +423,12 @@ class _RoomLoginDialogState extends State { child: Row( mainAxisSize: MainAxisSize.min, children: [ - const SizedBox( + SizedBox( width: 16, height: 16, child: CircularProgressIndicator( strokeWidth: 2, - color: Colors.white, + color: Theme.of(context).colorScheme.onPrimary, ), ), const SizedBox(width: 12), diff --git a/lib/widgets/routing_sheet.dart b/lib/widgets/routing_sheet.dart new file mode 100644 index 00000000..ddb0bb04 --- /dev/null +++ b/lib/widgets/routing_sheet.dart @@ -0,0 +1,709 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +import '../connector/meshcore_connector.dart'; +import '../helpers/path_helper.dart'; +import '../l10n/l10n.dart'; +import '../models/contact.dart'; +import '../models/path_history.dart'; +import '../screens/path_trace_map.dart'; +import '../services/path_history_service.dart'; +import 'path_editor_sheet.dart'; + +enum _RoutingMode { auto, flood, manual } + +enum _PathQuality { strong, good, fair, proven, flood, untested } + +class ContactRoutingSheet { + static Future show(BuildContext context, {required Contact contact}) { + return showModalBottomSheet( + context: context, + isScrollControlled: true, + useSafeArea: true, + builder: (context) => DraggableScrollableSheet( + expand: false, + initialChildSize: 0.75, + minChildSize: 0.4, + maxChildSize: 0.95, + builder: (context, scrollController) => _RoutingSheetBody( + contact: contact, + scrollController: scrollController, + ), + ), + ); + } +} + +class _RoutingSheetBody extends StatefulWidget { + final Contact contact; + final ScrollController scrollController; + + const _RoutingSheetBody({ + required this.contact, + required this.scrollController, + }); + + @override + State<_RoutingSheetBody> createState() => _RoutingSheetBodyState(); +} + +class _RoutingSheetBodyState extends State<_RoutingSheetBody> { + int _resolveContactIndex = -1; + String? _syncStatus; + + Contact _resolveContact(MeshCoreConnector connector) { + if (_resolveContactIndex >= 0 && + _resolveContactIndex < connector.contacts.length && + connector.contacts[_resolveContactIndex].publicKeyHex == + widget.contact.publicKeyHex) { + return connector.contacts[_resolveContactIndex]; + } + _resolveContactIndex = connector.contacts.indexWhere( + (c) => c.publicKeyHex == widget.contact.publicKeyHex, + ); + if (_resolveContactIndex == -1) { + return widget.contact; + } + return connector.contacts[_resolveContactIndex]; + } + + _RoutingMode _modeOf(Contact contact) { + final override = contact.pathOverride; + if (override == null) return _RoutingMode.auto; + return override < 0 ? _RoutingMode.flood : _RoutingMode.manual; + } + + Future _selectMode( + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ) async { + switch (mode) { + case _RoutingMode.auto: + setState(() => _syncStatus = null); + await connector.setPathOverride(contact, pathLen: null); + case _RoutingMode.flood: + setState(() => _syncStatus = null); + await connector.setPathOverride(contact, pathLen: -1); + case _RoutingMode.manual: + await _editManualPath(connector, contact); + } + } + + Future _editManualPath( + MeshCoreConnector connector, + Contact contact, + ) async { + final override = contact.pathOverride; + final initial = override != null && override > 0 + ? (contact.pathOverrideBytes ?? Uint8List(0)) + : (contact.pathLength > 0 ? contact.path : Uint8List(0)); + final available = connector.allContacts + .where((c) => c.publicKeyHex != contact.publicKeyHex) + .toList(); + final result = await PathEditorSheet.show( + context, + availableContacts: available, + initialPath: initial, + ); + if (result == null || !mounted) return; + await connector.setPathOverride( + contact, + pathLen: result.length, + pathBytes: result, + ); + await _verifyPath(connector, contact, result); + } + + Future _applyHistoryPath( + MeshCoreConnector connector, + Contact contact, + PathRecord record, + ) async { + final bytes = Uint8List.fromList(record.pathBytes); + await connector.setPathOverride( + contact, + pathLen: bytes.length, + pathBytes: bytes, + ); + await _verifyPath(connector, contact, bytes); + } + + Future _verifyPath( + MeshCoreConnector connector, + Contact contact, + Uint8List bytes, + ) async { + if (!mounted) return; + if (!connector.isConnected) { + setState(() => _syncStatus = context.l10n.chat_pathSavedLocally); + return; + } + setState(() => _syncStatus = null); + final verified = await connector.verifyContactPathOnDevice(contact, bytes); + if (!mounted) return; + setState( + () => _syncStatus = verified + ? context.l10n.chat_pathDeviceConfirmed + : context.l10n.chat_pathDeviceNotConfirmed, + ); + } + + Future _forgetPath( + MeshCoreConnector connector, + Contact contact, + ) async { + await connector.clearContactPath(contact); + if (!mounted) return; + setState(() => _syncStatus = context.l10n.chat_pathCleared); + } + + _PathQuality _qualityOf(PathRecord record, List ranked) { + if (record.pathBytes.isNotEmpty) { + final first = record.pathBytes.first; + for (var i = 0; i < ranked.length && i < 3; i++) { + if (ranked[i].pubkeyFirstByte == first) { + return switch (i) { + 0 => _PathQuality.strong, + 1 => _PathQuality.good, + _ => _PathQuality.fair, + }; + } + } + } + if (record.successCount > 0) return _PathQuality.proven; + if (record.wasFloodDiscovery) return _PathQuality.flood; + return _PathQuality.untested; + } + + String _qualityLabel(BuildContext context, _PathQuality quality) { + final l10n = context.l10n; + return switch (quality) { + _PathQuality.strong => l10n.routing_qualityStrong, + _PathQuality.good => l10n.routing_qualityGood, + _PathQuality.fair => l10n.routing_qualityFair, + _PathQuality.proven => l10n.routing_qualityWorked, + _PathQuality.flood => l10n.routing_qualityFlood, + _PathQuality.untested => l10n.routing_qualityUntested, + }; + } + + IconData _qualityIcon(_PathQuality quality) { + return switch (quality) { + _PathQuality.strong => Icons.signal_cellular_alt, + _PathQuality.good => Icons.signal_cellular_alt_2_bar, + _PathQuality.fair => Icons.signal_cellular_alt_1_bar, + _PathQuality.proven => Icons.check_circle_outline, + _PathQuality.flood => Icons.waves, + _PathQuality.untested => Icons.route, + }; + } + + String _relativeTime(BuildContext context, DateTime time) { + final l10n = context.l10n; + final diff = DateTime.now().difference(time); + if (diff.inSeconds < 60) return l10n.time_justNow; + if (diff.inMinutes < 60) return l10n.time_minutesAgo(diff.inMinutes); + if (diff.inHours < 24) return l10n.time_hoursAgo(diff.inHours); + return l10n.time_daysAgo(diff.inDays); + } + + String _modeHint(BuildContext context, _RoutingMode mode) { + final l10n = context.l10n; + return switch (mode) { + _RoutingMode.auto => l10n.routing_modeAutoHint, + _RoutingMode.flood => l10n.routing_modeFloodHint, + _RoutingMode.manual => l10n.routing_modeManualHint, + }; + } + + String _routeText( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ) { + final l10n = context.l10n; + switch (mode) { + case _RoutingMode.flood: + return l10n.routing_floodBroadcast; + case _RoutingMode.manual: + final bytes = contact.pathOverrideBytes ?? Uint8List(0); + if (bytes.isEmpty) return l10n.routing_directNoHops; + return PathHelper.resolvePathNames(bytes, connector.allContacts); + case _RoutingMode.auto: + if (contact.pathLength < 0) return l10n.routing_noPathYet; + if (contact.pathLength == 0) return l10n.routing_directNoHops; + if (contact.path.isEmpty) return l10n.chat_hopsCount(contact.pathLength); + return PathHelper.resolvePathNames(contact.path, connector.allContacts); + } + } + + Uint8List _displayBytes(Contact contact, _RoutingMode mode) { + return switch (mode) { + _RoutingMode.flood => Uint8List(0), + _RoutingMode.manual => contact.pathOverrideBytes ?? Uint8List(0), + _RoutingMode.auto => contact.path, + }; + } + + void _openPathTrace( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + List pathBytes, + ) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PathTraceMapScreen( + title: context.l10n.contacts_repeaterPathTrace, + path: Uint8List.fromList(pathBytes), + flipPathAround: true, + targetContact: contact, + pathHashByteWidth: connector.pathHashByteWidth, + ), + ), + ); + } + + void _showPathDetail( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + List pathBytes, + ) { + final l10n = context.l10n; + final formattedPath = PathHelper.formatPathHex(pathBytes); + final resolvedNames = PathHelper.resolvePathNames( + pathBytes, + connector.allContacts, + ); + + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(l10n.chat_fullPath), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SelectableText(formattedPath), + const SizedBox(height: 8), + SelectableText( + resolvedNames, + style: TextStyle( + fontSize: 13, + color: Theme.of(dialogContext).colorScheme.onSurfaceVariant, + ), + ), + ], + ), + actions: [ + TextButton( + onPressed: () => + _openPathTrace(dialogContext, connector, contact, pathBytes), + child: Text(l10n.contacts_pathTrace), + ), + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(l10n.common_close), + ), + ], + ), + ); + } + + Widget _currentRouteCard( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ({ + int successCount, + int failureCount, + int lastTripTimeMs, + DateTime? lastUsed, + })? floodStats, + ) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + final displayBytes = _displayBytes(contact, mode); + + return Card( + margin: EdgeInsets.zero, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + mode == _RoutingMode.flood ? Icons.waves : Icons.route, + size: 18, + color: scheme.primary, + ), + const SizedBox(width: 8), + Text(l10n.routing_currentRoute, style: theme.textTheme.titleSmall), + ], + ), + const SizedBox(height: 8), + Text( + _routeText(context, connector, contact, mode), + style: theme.textTheme.bodyMedium, + ), + if (mode == _RoutingMode.flood && + floodStats != null && + (floodStats.successCount > 0 || floodStats.failureCount > 0)) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + _floodStatsLine(context, floodStats), + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ), + if (_syncStatus != null) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + _syncStatus!, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.tertiary, + ), + ), + ), + Wrap( + spacing: 8, + children: [ + if (displayBytes.isNotEmpty) + TextButton.icon( + icon: const Icon(Icons.map_outlined, size: 18), + label: Text(l10n.contacts_pathTrace), + onPressed: () => _openPathTrace( + context, + connector, + contact, + displayBytes, + ), + ), + if (mode == _RoutingMode.manual) + TextButton.icon( + icon: const Icon(Icons.edit, size: 18), + label: Text(l10n.routing_editPath), + onPressed: () => _editManualPath(connector, contact), + ), + if (mode == _RoutingMode.auto && contact.pathLength >= 0) + TextButton.icon( + icon: const Icon(Icons.restart_alt, size: 18), + label: Text(l10n.routing_forgetPath), + onPressed: () => _forgetPath(connector, contact), + ), + ], + ), + ], + ), + ), + ); + } + + String _floodStatsLine( + BuildContext context, + ({ + int successCount, + int failureCount, + int lastTripTimeMs, + DateTime? lastUsed, + }) stats, + ) { + final l10n = context.l10n; + final parts = [ + l10n.routing_deliveryCounts(stats.successCount, stats.failureCount), + if (stats.lastTripTimeMs > 0) + '${(stats.lastTripTimeMs / 1000).toStringAsFixed(1)}s', + if (stats.lastUsed != null) + l10n.routing_lastWorked(_relativeTime(context, stats.lastUsed!)), + ]; + return parts.join(' • '); + } + + Widget _floodTile( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + ({ + int successCount, + int failureCount, + int lastTripTimeMs, + DateTime? lastUsed, + }) stats, + ) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + + return Card( + margin: const EdgeInsets.symmetric(vertical: 4), + child: ListTile( + leading: CircleAvatar( + radius: 18, + backgroundColor: scheme.surfaceContainerHighest, + child: Icon(Icons.waves, size: 18, color: scheme.onSurfaceVariant), + ), + title: Text(l10n.routing_floodDelivery), + subtitle: Text( + _floodStatsLine(context, stats), + style: const TextStyle(fontSize: 11), + ), + trailing: mode == _RoutingMode.flood + ? Icon( + Icons.check_circle, + color: scheme.primary, + semanticLabel: l10n.routing_inUse, + ) + : null, + onTap: mode == _RoutingMode.flood + ? null + : () => _selectMode(connector, contact, _RoutingMode.flood), + ), + ); + } + + Widget _pathRecordTile( + BuildContext context, + MeshCoreConnector connector, + Contact contact, + _RoutingMode mode, + PathHistoryService pathService, + PathRecord record, + _PathQuality quality, + ) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + + final (Color bg, Color fg) = switch (quality) { + _PathQuality.strong => (scheme.primaryContainer, scheme.onPrimaryContainer), + _PathQuality.good => ( + scheme.secondaryContainer, + scheme.onSecondaryContainer, + ), + _PathQuality.fair => ( + scheme.tertiaryContainer, + scheme.onTertiaryContainer, + ), + _PathQuality.proven => ( + scheme.primaryContainer, + scheme.onPrimaryContainer, + ), + _ => (scheme.surfaceContainerHighest, scheme.onSurfaceVariant), + }; + + final hasBytes = record.pathBytes.isNotEmpty; + final inUse = hasBytes && + ((mode == _RoutingMode.manual && + listEquals(record.pathBytes, contact.pathOverrideBytes)) || + (mode == _RoutingMode.auto && + listEquals(record.pathBytes, contact.path))); + + final title = hasBytes + ? PathHelper.resolvePathNames(record.pathBytes, connector.allContacts) + : l10n.chat_hopsCount(record.hopCount); + + final line1 = + '${l10n.chat_hopsCount(record.hopCount)} • ${_qualityLabel(context, quality)}'; + final line2Parts = [ + record.timestamp != null + ? l10n.routing_lastWorked(_relativeTime(context, record.timestamp!)) + : l10n.routing_neverWorked, + if (record.tripTimeMs > 0) + '${(record.tripTimeMs / 1000).toStringAsFixed(1)}s', + l10n.routing_deliveryCounts(record.successCount, record.failureCount), + ]; + + return Card( + margin: const EdgeInsets.symmetric(vertical: 4), + child: ListTile( + enabled: hasBytes, + leading: CircleAvatar( + radius: 18, + backgroundColor: bg, + child: Icon( + _qualityIcon(quality), + size: 18, + color: fg, + semanticLabel: _qualityLabel(context, quality), + ), + ), + title: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis), + subtitle: Text( + '$line1\n${line2Parts.join(' • ')}', + style: const TextStyle(fontSize: 11), + ), + isThreeLine: true, + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (inUse) + Tooltip( + message: l10n.routing_inUse, + child: Icon( + Icons.check_circle, + color: scheme.primary, + semanticLabel: l10n.routing_inUse, + ), + ), + IconButton( + icon: const Icon(Icons.delete_outline, size: 20), + tooltip: l10n.chat_removePath, + constraints: const BoxConstraints(minWidth: 44, minHeight: 44), + onPressed: () => pathService.removePathRecord( + contact.publicKeyHex, + record.pathBytes, + ), + ), + ], + ), + onTap: hasBytes && !inUse + ? () => _applyHistoryPath(connector, contact, record) + : null, + onLongPress: hasBytes + ? () => + _showPathDetail(context, connector, contact, record.pathBytes) + : null, + ), + ); + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final theme = Theme.of(context); + final scheme = theme.colorScheme; + + return Consumer2( + builder: (context, connector, pathService, _) { + final contact = _resolveContact(connector); + final mode = _modeOf(contact); + final floodStats = pathService.getFloodStats(contact.publicKeyHex); + final hasFloodStats = + floodStats != null && + (floodStats.successCount > 0 || floodStats.failureCount > 0); + + final rankedRepeaters = List.of(connector.directRepeaters) + ..sort((a, b) => b.ranking.compareTo(a.ranking)); + final entries = pathService + .getRecentPaths(contact.publicKeyHex) + .map((r) => (quality: _qualityOf(r, rankedRepeaters), record: r)) + .toList() + ..sort((a, b) { + final byQuality = a.quality.index.compareTo(b.quality.index); + if (byQuality != 0) return byQuality; + final aTime = + a.record.timestamp ?? DateTime.fromMillisecondsSinceEpoch(0); + final bTime = + b.record.timestamp ?? DateTime.fromMillisecondsSinceEpoch(0); + return bTime.compareTo(aTime); + }); + + return ListView( + controller: widget.scrollController, + padding: const EdgeInsets.fromLTRB(16, 8, 16, 24), + children: [ + Center( + child: Container( + width: 32, + height: 4, + decoration: BoxDecoration( + color: scheme.outlineVariant, + borderRadius: BorderRadius.circular(2), + ), + ), + ), + const SizedBox(height: 12), + Text(l10n.routing_title, style: theme.textTheme.titleLarge), + Text( + contact.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 16), + SegmentedButton<_RoutingMode>( + style: const ButtonStyle( + minimumSize: WidgetStatePropertyAll(Size.fromHeight(44)), + ), + segments: [ + ButtonSegment( + value: _RoutingMode.auto, + icon: const Icon(Icons.auto_mode), + label: Text(l10n.routing_modeAuto), + ), + ButtonSegment( + value: _RoutingMode.flood, + icon: const Icon(Icons.waves), + label: Text(l10n.routing_modeFlood), + ), + ButtonSegment( + value: _RoutingMode.manual, + icon: const Icon(Icons.edit_road), + label: Text(l10n.routing_modeManual), + ), + ], + selected: {mode}, + onSelectionChanged: (selection) => + _selectMode(connector, contact, selection.first), + ), + const SizedBox(height: 8), + Text( + _modeHint(context, mode), + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 16), + _currentRouteCard(context, connector, contact, mode, floodStats), + const SizedBox(height: 16), + Text(l10n.routing_knownPaths, style: theme.textTheme.titleSmall), + Text( + l10n.routing_knownPathsHint, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 8), + if (hasFloodStats) + _floodTile(context, connector, contact, mode, floodStats), + if (entries.isEmpty && !hasFloodStats) + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Text( + l10n.chat_noPathHistoryYet, + style: theme.textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ), + ...entries.map( + (entry) => _pathRecordTile( + context, + connector, + contact, + mode, + pathService, + entry.record, + entry.quality, + ), + ), + ], + ); + }, + ); + } +} diff --git a/lib/widgets/snr_indicator.dart b/lib/widgets/snr_indicator.dart index 99f20539..21efffd1 100644 --- a/lib/widgets/snr_indicator.dart +++ b/lib/widgets/snr_indicator.dart @@ -166,7 +166,7 @@ class _SNRIndicatorState extends State { style: TextStyle( fontSize: 12, fontWeight: FontWeight.w500, - color: Colors.grey, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/widgets/telemetry_location_map.dart b/lib/widgets/telemetry_location_map.dart index b47d16d1..a73fb640 100644 --- a/lib/widgets/telemetry_location_map.dart +++ b/lib/widgets/telemetry_location_map.dart @@ -147,19 +147,19 @@ class _TelemetryLocationMapState extends State { children: [ _MapButton( icon: Icons.add, - tooltip: 'Zoom in', + tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomBy(1), ), const SizedBox(height: 6), _MapButton( icon: Icons.remove, - tooltip: 'Zoom out', + tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomBy(-1), ), const SizedBox(height: 6), _MapButton( icon: Icons.my_location, - tooltip: 'Center map', + tooltip: context.l10n.map_centerMap, onPressed: () => _mapController.move(_position, _initialZoom), ), diff --git a/pubspec.yaml b/pubspec.yaml index 72cca35f..504d61f1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,7 +65,7 @@ dependencies: path_provider: ^2.1.5 share_plus: ^12.0.1 build_pipe: ^0.3.1 - material_symbols_icons: ^4.2906.0 + material_symbols_icons: ^4.2928.1 web: ^1.1.1 flutter_svg: ^2.0.10+1 flutter_blue_plus_platform_interface: ^8.2.1 diff --git a/scripts/security/contact_import_clipboard_pocs.py b/scripts/security/contact_import_clipboard_pocs.py new file mode 100644 index 00000000..dcf7ced9 --- /dev/null +++ b/scripts/security/contact_import_clipboard_pocs.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python3 +"""Generate local PoCs for MeshCore clipboard contact import validation gaps. + +The output is a meshcore:// URI suitable for manual testing in a local/dev app +session. It does not connect to BLE/USB/TCP devices or transmit anything. +""" + +from __future__ import annotations + +import argparse +import sys + + +SCHEME = "meshcore://" + + +def uri_from_bytes(payload: bytes) -> str: + return SCHEME + payload.hex() + + +def oversized_payload(size: int) -> bytes: + if size < 1: + raise ValueError("size must be positive") + return b"A" * size + + +def short_malformed_payload() -> bytes: + return b"\x00" + + +def non_advert_like_payload() -> bytes: + # 98 bytes matches the UI's minimum exported-contact length check, but the + # content is intentionally not a valid signed advert/contact packet. + payload = bytearray(98) + payload[0:4] = b"POC!" + payload[36] = 0xFF + payload[-4:] = b"END!" + return bytes(payload) + + +def main() -> int: + parser = argparse.ArgumentParser( + description="Generate meshcore:// clipboard import PoC payloads." + ) + parser.add_argument( + "case", + choices=("short", "non-advert", "oversized"), + help="PoC case to generate.", + ) + parser.add_argument( + "--size", + type=int, + default=4096, + help="Byte length for the oversized case. Default: 4096.", + ) + args = parser.parse_args() + + if args.case == "short": + payload = short_malformed_payload() + elif args.case == "non-advert": + payload = non_advert_like_payload() + else: + payload = oversized_payload(args.size) + + sys.stdout.write(uri_from_bytes(payload)) + sys.stdout.write("\n") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/test/screens/tcp_flow_test.dart b/test/screens/tcp_flow_test.dart index 1d8174c8..d48ae33d 100644 --- a/test/screens/tcp_flow_test.dart +++ b/test/screens/tcp_flow_test.dart @@ -123,11 +123,13 @@ void main() { ); await tester.pumpAndSettle(); - await tester.tap(find.widgetWithText(FloatingActionButton, 'TCP')); + final scannerContext = tester.element(find.byType(ScannerScreen)); + final scannerL10n = AppLocalizations.of(scannerContext); + await tester.tap(find.byTooltip(scannerL10n.connectionChoiceTcpLabel)); await tester.pumpAndSettle(); expect(find.byType(TcpScreen), findsOneWidget); - await tester.tap(find.widgetWithText(FloatingActionButton, 'Bluetooth')); + await tester.tap(find.widgetWithText(OutlinedButton, 'Bluetooth')); await tester.pumpAndSettle(); expect(find.byType(TcpScreen), findsNothing); diff --git a/test/screens/usb_flow_test.dart b/test/screens/usb_flow_test.dart index 16e5a951..ecd33ee9 100644 --- a/test/screens/usb_flow_test.dart +++ b/test/screens/usb_flow_test.dart @@ -157,10 +157,18 @@ void main() { ); await tester.pumpAndSettle(); + final context = tester.element(find.byType(ScannerScreen)); + final l10n = AppLocalizations.of(context); if (PlatformInfo.supportsUsbSerial) { - expect(find.widgetWithText(FloatingActionButton, 'USB'), findsOneWidget); + expect( + find.byTooltip(l10n.connectionChoiceUsbLabel), + findsOneWidget, + ); } else { - expect(find.widgetWithText(FloatingActionButton, 'USB'), findsNothing); + expect( + find.byTooltip(l10n.connectionChoiceUsbLabel), + findsNothing, + ); } // ScannerScreen.dispose() schedules disconnect work that debounces notify. @@ -186,13 +194,13 @@ void main() { final context = tester.element(find.byType(ScannerScreen)); final l10n = AppLocalizations.of(context); - expect(find.text(l10n.scanner_scan), findsOneWidget); + expect(find.text(l10n.scanner_scan), findsWidgets); if (PlatformInfo.supportsUsbSerial) { - expect(find.text(l10n.connectionChoiceUsbLabel), findsOneWidget); + expect(find.byTooltip(l10n.connectionChoiceUsbLabel), findsOneWidget); } if (!PlatformInfo.isWeb) { - expect(find.text(l10n.connectionChoiceTcpLabel), findsOneWidget); + expect(find.byTooltip(l10n.connectionChoiceTcpLabel), findsOneWidget); } await tester.pumpWidget(const SizedBox.shrink()); diff --git a/untranslated.json b/untranslated.json index 9e26dfee..c3a9394b 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,987 @@ -{} \ No newline at end of file +{ + "bg": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "de": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "es": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "fr": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "hu": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "it": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "ja": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "ko": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "nl": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "pl": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "pt": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "ru": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "sk": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "sl": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "sv": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "uk": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ], + + "zh": [ + "common_undo", + "messageStatus_sent", + "messageStatus_delivered", + "messageStatus_pending", + "messageStatus_failed", + "messageStatus_repeated", + "contacts_moreOptions", + "contacts_searchOpen", + "contacts_searchClose", + "routing_title", + "routing_modeAuto", + "routing_modeFlood", + "routing_modeManual", + "routing_modeAutoHint", + "routing_modeFloodHint", + "routing_modeManualHint", + "routing_currentRoute", + "routing_directNoHops", + "routing_noPathYet", + "routing_floodBroadcast", + "routing_editPath", + "routing_forgetPath", + "routing_knownPaths", + "routing_knownPathsHint", + "routing_inUse", + "routing_qualityStrong", + "routing_qualityGood", + "routing_qualityFair", + "routing_qualityWorked", + "routing_qualityFlood", + "routing_qualityUntested", + "routing_lastWorked", + "routing_neverWorked", + "routing_deliveryCounts", + "routing_floodDelivery", + "pathEditor_title", + "pathEditor_hopCounter", + "pathEditor_noHops", + "pathEditor_addHops", + "pathEditor_searchRepeaters", + "pathEditor_advancedHex", + "pathEditor_hexLabel", + "pathEditor_hexHelper", + "pathEditor_invalidTokens", + "pathEditor_tooManyHops", + "pathEditor_usePath", + "pathEditor_removeHop", + "pathEditor_unknownHop", + "map_zoomIn", + "map_zoomOut", + "map_centerMap", + "chrome_bluetoothRequiresChromium", + "channels_communityShortId", + "pathTrace_legendGpsConfirmed", + "pathTrace_legendInferred" + ] +} From 3c26ce2d93d33801c42d636485c21cb8767c6551 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Thu, 11 Jun 2026 00:10:49 -0700 Subject: [PATCH 28/36] chore: stop tracking .claude worktrees and ignore .claude/ The previous commit accidentally added the Claude Code worktree gitlinks under .claude/worktrees. Untrack them and ignore .claude/. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index fa4d28d6..6e4fb526 100644 --- a/.gitignore +++ b/.gitignore @@ -91,3 +91,6 @@ keystore.properties # Cloudflare Wrangler .wrangler + +# Claude Code local working dir (worktrees, jobs, settings) +.claude/ From b1de1b4bf00ed06ce61c0b1b476b519189e22fce Mon Sep 17 00:00:00 2001 From: zjs81 Date: Thu, 11 Jun 2026 00:11:56 -0700 Subject: [PATCH 29/36] chore: untrack .claude/worktrees gitlinks Remove the accidentally committed Claude Code worktree gitlinks. .claude/ is already gitignored (prev commit). Worktree files remain on disk locally. Co-Authored-By: Claude Opus 4.8 (1M context) --- .claude/worktrees/agent-a01277dd8cf0dedb6 | 1 - .claude/worktrees/agent-a0c7384491c5fc807 | 1 - .claude/worktrees/agent-a1751d6addbf69e1d | 1 - .claude/worktrees/agent-a2fad933ed81b10e2 | 1 - .claude/worktrees/agent-a4d771c23db919c7f | 1 - .claude/worktrees/agent-a6675128f3ee1d6a6 | 1 - .claude/worktrees/agent-a894f10813e684f84 | 1 - .claude/worktrees/agent-a8ba0537ad42768d7 | 1 - .claude/worktrees/agent-a926d49d72757ce68 | 1 - .claude/worktrees/agent-ad2e38b6608f23ab4 | 1 - .claude/worktrees/agent-ada5836798aea71a1 | 1 - .claude/worktrees/agent-aee10bd582e9e36cf | 1 - 12 files changed, 12 deletions(-) delete mode 160000 .claude/worktrees/agent-a01277dd8cf0dedb6 delete mode 160000 .claude/worktrees/agent-a0c7384491c5fc807 delete mode 160000 .claude/worktrees/agent-a1751d6addbf69e1d delete mode 160000 .claude/worktrees/agent-a2fad933ed81b10e2 delete mode 160000 .claude/worktrees/agent-a4d771c23db919c7f delete mode 160000 .claude/worktrees/agent-a6675128f3ee1d6a6 delete mode 160000 .claude/worktrees/agent-a894f10813e684f84 delete mode 160000 .claude/worktrees/agent-a8ba0537ad42768d7 delete mode 160000 .claude/worktrees/agent-a926d49d72757ce68 delete mode 160000 .claude/worktrees/agent-ad2e38b6608f23ab4 delete mode 160000 .claude/worktrees/agent-ada5836798aea71a1 delete mode 160000 .claude/worktrees/agent-aee10bd582e9e36cf diff --git a/.claude/worktrees/agent-a01277dd8cf0dedb6 b/.claude/worktrees/agent-a01277dd8cf0dedb6 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a01277dd8cf0dedb6 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a0c7384491c5fc807 b/.claude/worktrees/agent-a0c7384491c5fc807 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a0c7384491c5fc807 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a1751d6addbf69e1d b/.claude/worktrees/agent-a1751d6addbf69e1d deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a1751d6addbf69e1d +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a2fad933ed81b10e2 b/.claude/worktrees/agent-a2fad933ed81b10e2 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a2fad933ed81b10e2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a4d771c23db919c7f b/.claude/worktrees/agent-a4d771c23db919c7f deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a4d771c23db919c7f +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a6675128f3ee1d6a6 b/.claude/worktrees/agent-a6675128f3ee1d6a6 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a6675128f3ee1d6a6 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a894f10813e684f84 b/.claude/worktrees/agent-a894f10813e684f84 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a894f10813e684f84 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a8ba0537ad42768d7 b/.claude/worktrees/agent-a8ba0537ad42768d7 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a8ba0537ad42768d7 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-a926d49d72757ce68 b/.claude/worktrees/agent-a926d49d72757ce68 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-a926d49d72757ce68 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-ad2e38b6608f23ab4 b/.claude/worktrees/agent-ad2e38b6608f23ab4 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-ad2e38b6608f23ab4 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-ada5836798aea71a1 b/.claude/worktrees/agent-ada5836798aea71a1 deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-ada5836798aea71a1 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 diff --git a/.claude/worktrees/agent-aee10bd582e9e36cf b/.claude/worktrees/agent-aee10bd582e9e36cf deleted file mode 160000 index e37616fa..00000000 --- a/.claude/worktrees/agent-aee10bd582e9e36cf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e37616fa1560d6abe1286cdd5f1b329788e93ef6 From 26fdf74d69fbdd10a1995b09754944b59b94ded8 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Thu, 11 Jun 2026 00:28:13 -0700 Subject: [PATCH 30/36] Refactor UI code for better readability and consistency - Improved formatting of ListTile icons and text styles in settings_screen.dart, telemetry_screen.dart, usb_screen.dart, gif_picker.dart, path_editor_sheet.dart, repeater_login_dialog.dart, and room_login_dialog.dart for better readability. - Consolidated TextStyle definitions into single lines where applicable. - Updated notification_service.dart to enhance readability of notification ID assignment. - Simplified function signatures in routing_sheet.dart for clarity. - Cleaned up test assertions in usb_flow_test.dart for conciseness. - Removed unused translations in untranslated.json to streamline localization files. --- lib/connector/meshcore_connector.dart | 31 +- lib/connector/meshcore_protocol.dart | 2 +- lib/l10n/app_bg.arb | 97 +- lib/l10n/app_de.arb | 97 +- lib/l10n/app_es.arb | 97 +- lib/l10n/app_fr.arb | 97 +- lib/l10n/app_hu.arb | 97 +- lib/l10n/app_it.arb | 97 +- lib/l10n/app_ja.arb | 97 +- lib/l10n/app_ko.arb | 97 +- lib/l10n/app_localizations_bg.dart | 108 +- lib/l10n/app_localizations_de.dart | 110 ++- lib/l10n/app_localizations_es.dart | 107 +- lib/l10n/app_localizations_fr.dart | 110 ++- lib/l10n/app_localizations_hu.dart | 110 ++- lib/l10n/app_localizations_it.dart | 106 +- lib/l10n/app_localizations_ja.dart | 111 +-- lib/l10n/app_localizations_ko.dart | 110 +-- lib/l10n/app_localizations_nl.dart | 104 +- lib/l10n/app_localizations_pl.dart | 110 ++- lib/l10n/app_localizations_pt.dart | 106 +- lib/l10n/app_localizations_ru.dart | 112 ++- lib/l10n/app_localizations_sk.dart | 106 +- lib/l10n/app_localizations_sl.dart | 107 +- lib/l10n/app_localizations_sv.dart | 106 +- lib/l10n/app_localizations_uk.dart | 108 +- lib/l10n/app_localizations_zh.dart | 111 +-- lib/l10n/app_nl.arb | 97 +- lib/l10n/app_pl.arb | 97 +- lib/l10n/app_pt.arb | 97 +- lib/l10n/app_ru.arb | 97 +- lib/l10n/app_sk.arb | 97 +- lib/l10n/app_sl.arb | 97 +- lib/l10n/app_sv.arb | 97 +- lib/l10n/app_uk.arb | 97 +- lib/l10n/app_zh.arb | 97 +- lib/screens/app_debug_log_screen.dart | 12 +- lib/screens/app_settings_screen.dart | 252 +++-- lib/screens/channel_chat_screen.dart | 369 +++---- lib/screens/channel_message_path_screen.dart | 45 +- lib/screens/channels_screen.dart | 16 +- lib/screens/chat_screen.dart | 360 +++---- lib/screens/chrome_required_screen.dart | 10 +- lib/screens/contacts_screen.dart | 8 +- lib/screens/discovery_screen.dart | 4 +- lib/screens/line_of_sight_map_screen.dart | 32 +- lib/screens/map_cache_screen.dart | 4 +- lib/screens/map_screen.dart | 124 ++- lib/screens/neighbors_screen.dart | 5 +- lib/screens/path_trace_map.dart | 33 +- lib/screens/repeater_cli_screen.dart | 16 +- lib/screens/repeater_hub_screen.dart | 36 +- lib/screens/repeater_settings_screen.dart | 8 +- lib/screens/scanner_screen.dart | 19 +- lib/screens/settings_screen.dart | 10 +- lib/screens/tcp_screen.dart | 5 +- lib/screens/telemetry_screen.dart | 5 +- lib/screens/usb_screen.dart | 27 +- lib/services/notification_service.dart | 3 +- lib/widgets/gif_picker.dart | 27 +- lib/widgets/path_editor_sheet.dart | 9 +- lib/widgets/repeater_login_dialog.dart | 5 +- lib/widgets/room_login_dialog.dart | 5 +- lib/widgets/routing_sheet.dart | 61 +- test/screens/usb_flow_test.dart | 10 +- untranslated.json | 988 +------------------ 66 files changed, 3436 insertions(+), 2596 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index dee34fb0..c9f11dd8 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -1484,23 +1484,22 @@ class MeshCoreConnector extends ChangeNotifier { _linuxSystemScanResults ..clear() ..addAll( - systemDevices - .map( - (device) => ScanResult( - device: device, - advertisementData: AdvertisementData( - advName: device.platformName, - txPowerLevel: null, - appearance: null, - connectable: true, - manufacturerData: const >{}, - serviceData: const >{}, - serviceUuids: [Guid(MeshCoreUuids.service)], - ), - rssi: 0, - timeStamp: DateTime.now(), - ), + systemDevices.map( + (device) => ScanResult( + device: device, + advertisementData: AdvertisementData( + advName: device.platformName, + txPowerLevel: null, + appearance: null, + connectable: true, + manufacturerData: const >{}, + serviceData: const >{}, + serviceUuids: [Guid(MeshCoreUuids.service)], ), + rssi: 0, + timeStamp: DateTime.now(), + ), + ), ); _mergeLinuxSystemScanResults(); notifyListeners(); diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index 7213b753..7b594894 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -956,7 +956,7 @@ Uint8List buildSendTelemetryReq(Uint8List? pubKey) { writer.writeBytes(Uint8List(3)); // reserved bytes writer.writeBytes(pubKey); } else { - writer.writeBytes(Uint8List(4)); // reserved bytes + writer.writeBytes(Uint8List(3)); // reserved bytes } return writer.toBytes(); } diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index 496b3e3d..f288b774 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Брой заявки", "telemetry_error": "Неуспешно получаване на данни", "telemetry_noData": "Няма налични данни за телеметрията.", @@ -2353,5 +2353,98 @@ "settings_companionDebugLogSubtitle": "Команди, отговори и сурови данни за протоколите BLE/TCP/USB", "chat_newMessages": "Нови съобщения", "settings_companionDebugLog": "Лог за отстраняване на грешки (за съпътстваща програма)", - "repeater_chanUtil": "Използване на канала" + "repeater_chanUtil": "Използване на канала", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "Изпращане", + "common_undo": "Отмяни", + "messageStatus_delivered": "Доставен", + "messageStatus_sent": "Изпратено", + "messageStatus_failed": "Не успях да изпратя", + "messageStatus_repeated": "Слушах го многократно", + "contacts_moreOptions": "Повече възможности", + "contacts_searchOpen": "Търсене на контакти", + "contacts_searchClose": "Затвори търсене", + "routing_title": "Маршрутизиране", + "routing_modeAuto": "Автомобил", + "routing_modeFlood": "Наводнение", + "routing_modeManual": "Ръководство", + "routing_modeAutoHint": "Автоматично избира най-известния път, като при липса на информация, използва стратегия за \"запълване\" на празните пространства.", + "routing_modeFloodHint": "Излъчване през всички ретранслатори. Най-надежният начин, но изисква повече време на въздуха.", + "routing_modeManualHint": "Винаги следва точно пътя, който сте определили.", + "routing_currentRoute": "Текущ маршрут", + "routing_directNoHops": "Директ – без превключватели", + "routing_noPathYet": "Все още няма път. Съобщението продължава да се изпраща, докато не бъде открит маршрут.", + "routing_floodBroadcast": "Предаване през всички ретранслатори", + "routing_editPath": "Редактиране на пътя", + "routing_forgetPath": "Забравете за пътя", + "routing_knownPaths": "Известни маршрути", + "routing_knownPathsHint": "Натиснете бутона, за да превключите към него.", + "routing_inUse": "В експлоатация", + "routing_qualityStrong": "Силен първи скок", + "routing_qualityGood": "Добър първи опит", + "routing_qualityFair": "Първият добър скок", + "routing_qualityWorked": "Беше изпълнено/Доведено до край", + "routing_qualityFlood": "Получено чрез информация, разпространена в резултат на навод.", + "routing_qualityUntested": "Не тестван", + "routing_neverWorked": "никога не е потвърдено", + "routing_floodDelivery": "Доставка при навод", + "pathEditor_title": "Създаване на път", + "pathEditor_hopCounter": "{count} от 64 различни вида малц", + "pathEditor_noHops": "Все още няма добавени хмел. Можете да използвате бутоните по-долу, за да ги добавите по ред, или да запазите рецептата без хмел, за да я изпратите директно.", + "pathEditor_addHops": "Добавете хмела в реда, в който е посочено.", + "pathEditor_searchRepeaters": "Търсене на повтори", + "pathEditor_advancedHex": "Разширено: необработен шестничен път", + "pathEditor_hexLabel": "Префикси на шестнадесетична система", + "pathEditor_hexHelper": "Два шест-символни идентификатора на скок, разделени със запетаи", + "pathEditor_invalidTokens": "Невалидно: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Максимум 64 крачета", + "pathEditor_usePath": "Използвайте този маршрут.", + "pathEditor_removeHop": "Премахнете хмела", + "pathEditor_unknownHop": "Неизвестен репитер", + "map_zoomIn": "Увеличи", + "map_zoomOut": "Приближете се по-малко", + "map_centerMap": "Карта на центъра", + "chrome_bluetoothRequiresChromium": "Web Bluetooth изисква браузър, базиран на Chromium.", + "channels_communityShortId": "Идентификационен номер: {id}...", + "pathTrace_legendGpsConfirmed": "GPS потвърдено", + "pathTrace_legendInferred": "Извлечена позиция" } diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index f7cb8040..47062aa6 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Anzahl der Anfragen", "telemetry_error": "Daten konnten nicht abgerufen werden", "telemetry_noData": "Keine Telemetriedaten verfügbar.", @@ -2381,5 +2381,98 @@ "chat_newMessages": "Neue Nachrichten", "settings_companionDebugLog": "Debug-Protokoll für die Begleitsoftware", "settings_companionDebugLogSubtitle": "BLE/TCP/USB-Befehle, Antworten und Rohdaten", - "repeater_chanUtil": "Nutzung des Kanals" + "repeater_chanUtil": "Nutzung des Kanals", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Gesendet", + "messageStatus_delivered": "Geliefert", + "common_undo": "Rückgängig machen", + "messageStatus_pending": "Versenden", + "messageStatus_failed": "Nicht gesendet", + "messageStatus_repeated": "Wiederholt gehört", + "contacts_moreOptions": "Weitere Optionen", + "contacts_searchOpen": "Kontakte suchen", + "contacts_searchClose": "Erweiterte Suche", + "routing_title": "Routenplanung", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Überschwemmung", + "routing_modeManual": "Handbuch", + "routing_modeFloodHint": "Übertragung über alle Repeater. Die zuverlässigste Methode, jedoch mit höherem Datenverbrauch.", + "routing_modeAutoHint": "Wählt automatisch den bekanntesten Pfad aus und verwendet eine Flutungsmethode, wenn kein Pfad bekannt ist.", + "routing_modeManualHint": "Sendet immer genau den von Ihnen festgelegten Weg.", + "routing_currentRoute": "Aktuelle Route", + "routing_directNoHops": "Direkt – ohne Zwischenverstärkung", + "routing_noPathYet": "Noch kein Pfad gefunden. Die Nachricht wird gesendet, bis ein Weg entdeckt wurde.", + "routing_floodBroadcast": "Übertragung über jeden Repeater", + "routing_editPath": "Pfad bearbeiten", + "routing_forgetPath": "Vergiss den Weg", + "routing_knownPaths": "Bekannte Routen", + "routing_knownPathsHint": "Wählen Sie den Pfad, um zu diesem zu wechseln.", + "routing_inUse": "Im Gebrauch", + "routing_qualityStrong": "Ein starker erster Sprung", + "routing_qualityGood": "Ein guter erster Schritt", + "routing_qualityFair": "Erster erfolgreicher Schritt", + "routing_qualityWorked": "Hat erfolgreich geliefert", + "routing_qualityFlood": "Information erhalten durch Nachrichten über die Überschwemmung", + "routing_qualityUntested": "Nicht getestet", + "routing_lastWorked": "war beschäftigt {when}", + "routing_neverWorked": "nie bestätigt", + "routing_floodDelivery": "Lieferung bei Überschwemmung", + "pathEditor_title": "Pfad erstellen", + "pathEditor_hopCounter": "{count} von 64 Hopfengewächsen", + "pathEditor_noHops": "Noch keine Hopfen hinzugefügt. Klicken Sie auf die Schaltflächen unten, um sie nacheinander hinzuzufügen, oder speichern Sie die Rezepter ohne Hopfen, um sie direkt zu versenden.", + "pathEditor_addHops": "Fügen Sie die Hopfen in der richtigen Reihenfolge hinzu.", + "pathEditor_searchRepeaters": "Suche nach wiederholten Nachrichten", + "pathEditor_advancedHex": "Fortgeschritten: Roh-Hex-Pfad", + "pathEditor_hexLabel": "Hex-Präfixe", + "pathEditor_hexHelper": "Zwei Hexadezimalzeichen pro Sprung, getrennt durch Kommas", + "pathEditor_invalidTokens": "Ungültig: {tokens}", + "pathEditor_tooManyHops": "Maximal 64 Hopfengreifer", + "pathEditor_usePath": "Verwenden Sie diesen Pfad.", + "pathEditor_removeHop": "Hop entfernen", + "pathEditor_unknownHop": "Unbekannter Repeater", + "map_zoomIn": "Zoomen", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Auszoomen", + "map_centerMap": "Zentralkarte", + "chrome_bluetoothRequiresChromium": "Web Bluetooth benötigt einen Chromium-Browser.", + "channels_communityShortId": "ID: {id}…", + "pathTrace_legendGpsConfirmed": "GPS-Bestätigung", + "pathTrace_legendInferred": "Abgeleitete Position" } diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index f24fb52a..31b6dc7d 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Número de solicitudes", "telemetry_error": "No se pudieron obtener los datos", "telemetry_noData": "No hay datos de telemetría disponibles.", @@ -2381,5 +2381,98 @@ "chat_newMessages": "Nuevos mensajes", "settings_companionDebugLogSubtitle": "Comandos, respuestas y datos brutos para protocolos BLE/TCP/USB", "chat_markAsUnread": "Marcar como no leído", - "repeater_chanUtil": "Utilización del canal" + "repeater_chanUtil": "Utilización del canal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "Enviar", + "common_undo": "Deshacer", + "messageStatus_sent": "Sentido", + "messageStatus_delivered": "Entregado", + "messageStatus_failed": "No se pudo enviar", + "messageStatus_repeated": "Escuché repetidamente", + "contacts_moreOptions": "Más opciones", + "contacts_searchOpen": "Buscar contactos", + "contacts_searchClose": "Búsqueda avanzada", + "routing_title": "Ruteo", + "routing_modeAuto": "Coche", + "routing_modeFlood": "Inundación", + "routing_modeManual": "Manual", + "routing_modeAutoHint": "Selecciona automáticamente la ruta más conocida, y si no hay ninguna ruta conocida, utiliza la ruta más directa.", + "routing_modeFloodHint": "Transmisiones a través de todos los repetidores. Es la opción más fiable, pero utiliza más tiempo de transmisión.", + "routing_modeManualHint": "Siempre sigue exactamente la ruta que usted ha definido.", + "routing_currentRoute": "Ruta actual", + "routing_directNoHops": "Directo — sin saltos de repetidor", + "routing_noPathYet": "Aún no hay un camino definido. El mensaje se envía continuamente hasta que se encuentre una ruta.", + "routing_floodBroadcast": "Transmisión a través de todos los repetidores.", + "routing_editPath": "Editar ruta", + "routing_forgetPath": "Olvídate del camino", + "routing_knownPaths": "Rutas conocidas", + "routing_knownPathsHint": "Seleccione una opción para cambiar a esa.", + "routing_inUse": "En uso", + "routing_qualityStrong": "Primer salto exitoso", + "routing_qualityGood": "Primer paso exitoso", + "routing_qualityWorked": "Ha cumplido", + "routing_qualityFair": "Primer salto de calidad", + "routing_qualityFlood": "Se ha escuchado a través de rumores.", + "routing_qualityUntested": "Sin probar", + "routing_lastWorked": "trabajó {when}", + "routing_neverWorked": "nunca confirmado", + "routing_floodDelivery": "Entrega por inundación", + "pathEditor_title": "Crear ruta", + "pathEditor_hopCounter": "{count} de 64 granos de lúpulo", + "pathEditor_noHops": "Aún no se han añadido lúpulos. Haga clic en los repetidores para añadirlos en el orden deseado, o guarde la receta sin lúpulos para enviarla directamente.", + "pathEditor_addHops": "Añadir los lúpulos en el orden adecuado.", + "pathEditor_searchRepeaters": "Buscar repetidores", + "pathEditor_advancedHex": "Avanzado: ruta hexadecimal sin procesar", + "pathEditor_hexLabel": "Prefijos hexadecimales", + "pathEditor_hexHelper": "Dos caracteres hexadecimales por salto, separados por comas.", + "pathEditor_invalidTokens": "Inválido: {tokens}", + "pathEditor_tooManyHops": "Máximo 64 saltos", + "pathEditor_usePath": "Utilice esta ruta.", + "pathEditor_removeHop": "Eliminar el lúpulo", + "pathEditor_unknownHop": "Repetidor desconocido", + "map_zoomIn": "Acercar", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Acercar", + "map_centerMap": "Mapa del centro", + "chrome_bluetoothRequiresChromium": "Web Bluetooth requiere un navegador Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "Confirmado mediante GPS", + "pathTrace_legendInferred": "Posición inferida" } diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index 710ee53a..76d6244b 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Nombre de requêtes", "telemetry_error": "Impossible de récupérer les données", "telemetry_noData": "Aucune donnée de télémétrie disponible.", @@ -2360,5 +2360,98 @@ "chat_markAsUnread": "Signaler comme non lu", "chat_newMessages": "Nouveaux messages", "settings_companionDebugLogSubtitle": "Commandes, réponses et données brutes pour les protocoles BLE/TCP/USB", - "repeater_chanUtil": "Utilisation du canal" + "repeater_chanUtil": "Utilisation du canal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Annuler", + "messageStatus_sent": "Envoyer", + "messageStatus_delivered": "Livré", + "messageStatus_pending": "Envoyer", + "messageStatus_failed": "Échec de l'envoi", + "messageStatus_repeated": "Répété plusieurs fois", + "contacts_searchOpen": "Rechercher des contacts", + "contacts_moreOptions": "Plus d'options", + "contacts_searchClose": "Recherche avancée", + "routing_title": "Planification des itinéraires", + "routing_modeAuto": "Voiture", + "routing_modeFlood": "Inondation", + "routing_modeManual": "Manuel", + "routing_modeFloodHint": "Diffusion via tous les répéteurs. La méthode la plus fiable, mais qui utilise plus de temps d'antenne.", + "routing_modeAutoHint": "Sélectionne automatiquement le chemin le plus connu, et utilise la méthode de \"inondation\" si aucun chemin n'est connu.", + "routing_modeManualHint": "Il suit toujours le chemin précis que vous avez défini.", + "routing_currentRoute": "Itinéraire actuel", + "routing_directNoHops": "Direct — sans relais", + "routing_noPathYet": "Aucune voie encore trouvée. Le message suivant est envoyé jusqu'à ce qu'une route soit découverte.", + "routing_floodBroadcast": "Diffusion via tous les répéteurs", + "routing_editPath": "Modifier le chemin", + "routing_forgetPath": "Oubliez le chemin", + "routing_knownPaths": "Chemins connus", + "routing_knownPathsHint": "Créez un raccourci pour y accéder.", + "routing_inUse": "En cours d'utilisation", + "routing_qualityStrong": "Première étape réussie", + "routing_qualityGood": "Première étape réussie", + "routing_qualityFair": "Première étape réussie", + "routing_qualityWorked": "A livré", + "routing_qualityFlood": "Rapporté par des informations provenant de plusieurs sources.", + "routing_qualityUntested": "Non testé", + "routing_lastWorked": "a travaillé {when}", + "routing_neverWorked": "jamais confirmé", + "routing_floodDelivery": "Livraison en cas de inondation", + "pathEditor_hopCounter": "{count} parmi 64 houblons", + "pathEditor_title": "Créer un chemin", + "pathEditor_noHops": "Aucun houblon ajouté pour le moment. Cliquez sur les répétiteurs ci-dessous pour les ajouter dans l'ordre souhaité, ou enregistrez sans houblon pour envoyer directement.", + "pathEditor_addHops": "Ajoutez les houblons dans l'ordre souhaité.", + "pathEditor_searchRepeaters": "Rechercher des répétiteurs", + "pathEditor_advancedHex": "Avancé : chemin hexadécimal brut", + "pathEditor_hexLabel": "Préfixes hexadécimaux", + "pathEditor_hexHelper": "Deux caractères hexadécimaux par saut, séparés par des virgules.", + "pathEditor_invalidTokens": "Incorrect : {tokens}", + "pathEditor_tooManyHops": "Maximum 64 sauts", + "pathEditor_usePath": "Utilisez ce chemin.", + "pathEditor_removeHop": "Éliminer le haricot", + "pathEditor_unknownHop": "Répéteur non identifié", + "map_zoomIn": "Zoomez", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Zoomez", + "map_centerMap": "Carte du centre", + "chrome_bluetoothRequiresChromium": "Web Bluetooth nécessite un navigateur Chromium.", + "channels_communityShortId": "ID : {id}…", + "pathTrace_legendGpsConfirmed": "Le GPS a confirmé.", + "pathTrace_legendInferred": "Position déduite" } diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index 1807fa68..cd5ed8c8 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -1502,7 +1502,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Kérések száma", "telemetry_error": "Nem sikerült lekérni az adatokat", "telemetry_noData": "Nincsenek elérhető telemetriadatok.", @@ -2391,5 +2391,98 @@ "chat_newMessages": "Új üzenetek", "settings_companionDebugLog": "Párhuzamos hibakeresési napló", "settings_companionDebugLogSubtitle": "BLE/TCP/USB parancsok, válaszok és alapvető adatok", - "repeater_chanUtil": "Csatorna-használat" + "repeater_chanUtil": "Csatorna-használat", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_delivered": "Szállítva", + "common_undo": "Még egyszer", + "messageStatus_sent": "Elküldve", + "messageStatus_pending": "Elküldés", + "messageStatus_failed": "Nem sikerült elküldeni", + "messageStatus_repeated": "Ismételtem", + "contacts_moreOptions": "További lehetőségek", + "contacts_searchOpen": "Keresssz kapcsolatokat", + "contacts_searchClose": "Teljesítse a keresést", + "routing_title": "Útvonal meghatározás", + "routing_modeAuto": "Autó", + "routing_modeFlood": "Áradás", + "routing_modeManual": "Használati útmutató", + "routing_modeAutoHint": "Automatikusan kiválasztja a legismertebb útvonalat, és ha egyik sem ismert, akkor \"vízzel\" tölti ki.", + "routing_modeFloodHint": "Átvisszaadások minden erősítőn keresztül. A legmegbízhatóbb megoldás, de több időt igényel.", + "routing_modeManualHint": "Mindig pontosan az útvonalat követi, amelyet megad.", + "routing_currentRoute": "Jelenlegi útvonal", + "routing_directNoHops": "Közvetlen – nincs átjáró állomás", + "routing_noPathYet": "Még nincs útvonal. A következő üzenet a keresésig vár.", + "routing_floodBroadcast": "Azonnali továbbítás minden erősítőn keresztül.", + "routing_editPath": "Útvonal szerkesztése", + "routing_forgetPath": "Felejtsd el a útvonalat", + "routing_knownPaths": "Jellegzetes útvonalak", + "routing_knownPathsHint": "Készíts egy útvonalat, hogy átválhass rá.", + "routing_inUse": "Használatban", + "routing_qualityStrong": "Erős első lépés", + "routing_qualityGood": "Jó első lépés", + "routing_qualityFair": "Jó első lépés", + "routing_qualityWorked": "Előállított", + "routing_qualityFlood": "Információt hallottam a katasztrófa miatt.", + "routing_qualityUntested": "Vizsgálatnak nem подвержен", + "routing_neverWorked": "sosem megerősítve", + "routing_floodDelivery": "Vízparti szállítás", + "pathEditor_title": "Út megépítése", + "pathEditor_hopCounter": "{count} db 64-ből", + "pathEditor_noHops": "Még nem adtam hozzá a bazsalikomot. A lent található gombokat használhatod, hogy sorrendben adjd hozzá, vagy mentheted anélkül, hogy bazsalikomot adnál hozzá, hogy közvetlenül elküldd.", + "pathEditor_addHops": "Adja hozzá a bazsaidat a megfelelő sorrendben.", + "pathEditor_searchRepeaters": "Ismétlő eszközök keresése", + "pathEditor_advancedHex": "Haladó szint: alapvető hex-út", + "pathEditor_hexLabel": "Hex előtagok", + "pathEditor_hexHelper": "Két hatjegyű szám minden lépésen, amelyek egymástól elválasztják a kommák.", + "pathEditor_invalidTokens": "Érvénytelen: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "A maximális szám 64.", + "pathEditor_usePath": "Használja ezt az útvonalat.", + "pathEditor_removeHop": "Távolítsa el a bazsalikomot", + "pathEditor_unknownHop": "Tudatlan erősítő", + "map_zoomIn": "Nagyítva", + "map_zoomOut": "Kicsökkentett nézet", + "map_centerMap": "Központi tér térkép", + "chrome_bluetoothRequiresChromium": "A Web Bluetooth-hoz egy Chromium-alapú böngésző szükséges.", + "channels_communityShortId": "Az azonosító: {id}...", + "pathTrace_legendGpsConfirmed": "GPS-en megerősítve", + "pathTrace_legendInferred": "Feltehető helyzet" } diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index d378d19d..10fc16e4 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Numero di richieste", "telemetry_error": "Impossibile recuperare i dati", "telemetry_noData": "Nessun dato di telemetria disponibile.", @@ -2353,5 +2353,98 @@ "settings_companionDebugLog": "Registro di debug per il supporto", "chat_newMessages": "Nuovi messaggi", "chat_markAsUnread": "Segna come non letto", - "repeater_chanUtil": "Utilizzo del canale" + "repeater_chanUtil": "Utilizzo del canale", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Annulla", + "messageStatus_delivered": "Consegnato", + "messageStatus_sent": "Invia", + "messageStatus_pending": "Invio", + "messageStatus_failed": "Impossibile inviare", + "messageStatus_repeated": "Sentito ripetutamente", + "contacts_moreOptions": "Ulteriori opzioni", + "contacts_searchOpen": "Cerca contatti", + "contacts_searchClose": "Ricerca avanzata", + "routing_title": "Instradamento", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Inondazione", + "routing_modeManual": "Manuale", + "routing_modeAutoHint": "Seleziona automaticamente il percorso più noto, e in caso di assenza di informazioni, utilizza un percorso casuale.", + "routing_modeFloodHint": "Trasmissioni tramite ogni ripetitore. Il metodo più affidabile, ma richiede più tempo di trasmissione.", + "routing_modeManualHint": "Invia sempre esattamente il percorso che hai definito.", + "routing_currentRoute": "Percorso attuale", + "routing_directNoHops": "Diretto — senza passaggi tramite ripetitori", + "routing_noPathYet": "Al momento non è stata individuata alcuna via. Il messaggio viene inviato ripetutamente finché non viene trovata una rotta.", + "routing_floodBroadcast": "Trasmissione attraverso ogni ripetitore", + "routing_editPath": "Percorso di modifica", + "routing_forgetPath": "Dimentica il percorso", + "routing_knownPaths": "Percorsi noti", + "routing_knownPathsHint": "Seleziona un percorso per accedere a questa opzione.", + "routing_inUse": "In uso", + "routing_qualityStrong": "Primo salto molto deciso", + "routing_qualityGood": "Primo tentativo di successo", + "routing_qualityFair": "Primo salto di qualità", + "routing_qualityWorked": "È stato consegnato", + "routing_qualityFlood": "Ho sentito tramite un messaggio urgente", + "routing_qualityUntested": "Non testato", + "routing_neverWorked": "mai confermato", + "routing_floodDelivery": "Consegna in caso di alluvione", + "pathEditor_title": "Creare percorso", + "pathEditor_hopCounter": "{count} tra 64 varietà di luppolo", + "pathEditor_noHops": "Al momento non ci sono ingredienti aggiuntivi. Per aggiungerli nell'ordine desiderato, cliccate sui ripetitori sottostanti. In alternativa, potete salvare la ricetta senza ingredienti aggiuntivi per inviarla direttamente.", + "pathEditor_addHops": "Aggiungere i luppoli nell'ordine desiderato.", + "pathEditor_searchRepeaters": "Ricerca ripetitori", + "pathEditor_advancedHex": "Avanzato: percorso esadecimale grezzo", + "pathEditor_hexLabel": "Prefissi esadecimali", + "pathEditor_hexHelper": "Due caratteri esadecimali per ogni salto, separati da virgole.", + "pathEditor_invalidTokens": "Non valido: {tokens}", + "routing_lastWorked": "worked {when}", + "pathEditor_tooManyHops": "Massimo 64 orari", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_usePath": "Utilizza questo percorso", + "pathEditor_removeHop": "Rimuovere il luppolo", + "pathEditor_unknownHop": "Ripetitore sconosciuto", + "map_zoomIn": "Ingrandisci", + "map_zoomOut": "Riduci la visualizzazione", + "map_centerMap": "Mappa del centro", + "channels_communityShortId": "ID: {id}...", + "chrome_bluetoothRequiresChromium": "Web Bluetooth richiede un browser basato su Chromium.", + "pathTrace_legendGpsConfirmed": "Il GPS conferma", + "pathTrace_legendInferred": "Posizione dedotta" } diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index e000a0d9..4afea945 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -1502,7 +1502,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "リクエスト数", "telemetry_error": "データを取得できません", "telemetry_noData": "テレメトリデータは利用できません。", @@ -2391,5 +2391,98 @@ "settings_companionDebugLog": "同伴デバッグログ", "chat_newMessages": "新しいメッセージ", "chat_markAsUnread": "未読としてマークする", - "repeater_chanUtil": "チャンネルの利用状況" + "repeater_chanUtil": "チャンネルの利用状況", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_delivered": "配達", + "common_undo": "元に戻す", + "messageStatus_pending": "送信", + "messageStatus_sent": "送信", + "messageStatus_failed": "送信できませんでした", + "contacts_moreOptions": "さらに多くの選択肢", + "messageStatus_repeated": "何度も聞いた", + "contacts_searchOpen": "連絡先を検索する", + "contacts_searchClose": "検索を終了", + "routing_modeFlood": "洪水", + "routing_title": "経路設定", + "routing_modeAuto": "自動車", + "routing_modeManual": "マニュアル", + "routing_modeAutoHint": "最も一般的な経路を自動的に選択し、経路が不明な場合は、水没状態にします。", + "routing_modeFloodHint": "すべてのリピーターを通じて放送。最も信頼性が高いですが、より多くの時間を使用します。", + "routing_modeManualHint": "常に、あなたが設定した正確な経路を辿って移動します。", + "routing_currentRoute": "現在までのルート", + "routing_directNoHops": "直接接続—中継装置を経由しない", + "routing_noPathYet": "まだ経路は確立されていません。「次のメッセージを送信し、経路が特定されるまで待ちます」。", + "routing_floodBroadcast": "すべてのリピーターを通じて放送", + "routing_editPath": "パスの編集", + "routing_forgetPath": "道にこだわらない", + "routing_knownPaths": "既知の経路", + "routing_knownPathsHint": "そのアプリケーションに切り替えるためのショートカットを作成します。", + "routing_inUse": "使用中", + "routing_qualityStrong": "最初の段階で大きな成果を上げる", + "routing_qualityGood": "最初の成功", + "routing_qualityFair": "最初の試みは成功を収めた", + "routing_qualityWorked": "完了しました", + "routing_qualityFlood": "氾濫によって伝聞", + "routing_qualityUntested": "未検証", + "routing_lastWorked": "{when}に勤務", + "routing_neverWorked": "確認されていない", + "routing_floodDelivery": "洪水による配送", + "pathEditor_title": "経路の作成", + "pathEditor_hopCounter": "64個のホップのうち、{count}個", + "pathEditor_noHops": "まだホップは追加されていません。ホップを順番に追加するには、以下の「タップ」ボタンをクリックしてください。または、ホップを一切追加せずに直接送信するには、「保存」ボタンをクリックしてください。", + "pathEditor_addHops": "ホップを、指定された順番に加える", + "pathEditor_searchRepeaters": "繰り返し検索", + "pathEditor_advancedHex": "高度なレベル:生のヘックスパス", + "pathEditor_hexLabel": "ヘックスプレフィックス", + "pathEditor_hexHelper": "各ホップごとに2つのハッシュ文字を、カンマで区切って記述", + "pathEditor_invalidTokens": "無効: {tokens}", + "pathEditor_tooManyHops": "最大64段階", + "pathEditor_usePath": "この経路を使用してください", + "pathEditor_removeHop": "ホップを取り除く", + "pathEditor_unknownHop": "不明な増幅器", + "map_zoomIn": "ズームイン", + "map_zoomOut": "ズームアウト", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_centerMap": "中心地図", + "chrome_bluetoothRequiresChromium": "Web Bluetooth は、Chromium ブラウザが必要です。", + "channels_communityShortId": "ID: {id}…", + "pathTrace_legendGpsConfirmed": "GPSによる確認", + "pathTrace_legendInferred": "推測される位置" } diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index 8f6781e3..f6f804e4 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -1502,7 +1502,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "요청 수", "telemetry_error": "데이터를 가져올 수 없습니다", "telemetry_noData": "텔레메트리 데이터는 제공되지 않습니다.", @@ -2391,5 +2391,98 @@ "chat_newMessages": "새로운 메시지", "settings_companionDebugLogSubtitle": "BLE/TCP/USB 명령어, 응답 및 원시 데이터", "chat_markAsUnread": "미리 읽지 않음으로 표시", - "repeater_chanUtil": "채널 활용도" + "repeater_chanUtil": "채널 활용도", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "발송", + "messageStatus_sent": "발송", + "messageStatus_delivered": "배송 완료", + "common_undo": "취소", + "messageStatus_failed": "발송 실패", + "messageStatus_repeated": "반복적으로 들었습니다", + "contacts_searchOpen": "연락처 검색", + "contacts_moreOptions": "더 많은 옵션", + "contacts_searchClose": "검색 닫기", + "routing_title": "라우팅", + "routing_modeAuto": "자동", + "routing_modeFlood": "홍수", + "routing_modeManual": "사용 설명서", + "routing_modeAutoHint": "가장 잘 알려진 경로를 자동으로 선택하고, 경로가 없을 경우에는 무작위로 경로를 선택합니다.", + "routing_modeFloodHint": "모든 증폭기를 통해 방송됩니다. 가장 안정적이지만, 더 많은 송출 시간을 사용합니다.", + "routing_modeManualHint": "항상 설정하신 정확한 경로를 따라 이동합니다.", + "routing_currentRoute": "현재 경로", + "routing_directNoHops": "직접 연결 – 중계 장치 사용 없이", + "routing_noPathYet": "아직 경로가 없습니다. 다음 메시지가 도착할 때까지 계속 탐색합니다.", + "routing_floodBroadcast": "모든 증폭기를 통해 방송", + "routing_editPath": "경로 편집", + "routing_forgetPath": "길을 잊어라", + "routing_knownPaths": "알려진 경로", + "routing_knownPathsHint": "해당 항목으로 전환하기 위한 경로를 선택합니다.", + "routing_inUse": "사용 중", + "routing_qualityStrong": "강력한 첫 번째 단계", + "routing_qualityGood": "좋은 첫 시작", + "routing_qualityFair": "처음 시도", + "routing_qualityWorked": "완료됨", + "routing_qualityFlood": "홍수 피해 상황을 통해 들었습니다.", + "routing_qualityUntested": "검증되지 않음", + "routing_lastWorked": "{when}에 일했습니다", + "routing_neverWorked": "확인되지 않음", + "routing_floodDelivery": "홍수 피해 지역 배송", + "pathEditor_title": "경로 만들기", + "pathEditor_hopCounter": "64개의 홉 중 {count}", + "pathEditor_noHops": "현재 홉은 추가되지 않았습니다. 아래의 탭을 사용하여 순서대로 추가하거나, 홉 없이 바로 전송하려면 \"홉 없음\"으로 저장하십시오.", + "pathEditor_addHops": "홉을 순서대로 첨가해주세요.", + "pathEditor_searchRepeaters": "반복 검색", + "pathEditor_advancedHex": "고급: 원시 헥스 경로", + "pathEditor_hexLabel": "헥스 접두사", + "pathEditor_hexHelper": "각 홉마다 2개의 6자리 숫자, 쉼표로 구분", + "pathEditor_invalidTokens": "유효하지 않음: {tokens}", + "pathEditor_tooManyHops": "최대 64개의 홉", + "pathEditor_usePath": "이 경로를 사용하세요", + "pathEditor_removeHop": "홉 제거", + "pathEditor_unknownHop": "알 수 없는 중계기", + "map_zoomIn": "줌 인", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "줌 아웃", + "map_centerMap": "중심 지도", + "chrome_bluetoothRequiresChromium": "웹 블루투스는 크롬 브라우저가 필요합니다.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS 확인 완료", + "pathTrace_legendInferred": "추론된 위치" } diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 68742652..d22848c3 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -93,22 +93,22 @@ class AppLocalizationsBg extends AppLocalizations { String get common_disable => 'Деактивирай'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Отмяни'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Изпратено'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Доставен'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Изпращане'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Не успях да изпратя'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Слушах го многократно'; @override String get common_reboot => 'Рестартирай'; @@ -1016,13 +1016,13 @@ class AppLocalizationsBg extends AppLocalizations { String get contacts_newGroup => 'Нова група'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Повече възможности'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Търсене на контакти'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Затвори търсене'; @override String get contacts_groupName => 'Група'; @@ -1530,74 +1530,76 @@ class AppLocalizationsBg extends AppLocalizations { String get chat_fullPath => 'Пълен път'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Маршрутизиране'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Автомобил'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Наводнение'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Ръководство'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Автоматично избира най-известния път, като при липса на информация, използва стратегия за \"запълване\" на празните пространства.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Излъчване през всички ретранслатори. Най-надежният начин, но изисква повече време на въздуха.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Винаги следва точно пътя, който сте определили.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Текущ маршрут'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Директ – без превключватели'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Все още няма път. Съобщението продължава да се изпраща, докато не бъде открит маршрут.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Предаване през всички ретранслатори'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Редактиране на пътя'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Забравете за пътя'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Известни маршрути'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Натиснете бутона, за да превключите към него.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'В експлоатация'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Силен първи скок'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Добър първи опит'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Първият добър скок'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Беше изпълнено/Доведено до край'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Получено чрез информация, разпространена в резултат на навод.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Не тестван'; @override String routing_lastWorked(String when) { @@ -1605,7 +1607,7 @@ class AppLocalizationsBg extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'никога не е потвърдено'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1613,52 +1615,52 @@ class AppLocalizationsBg extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Доставка при навод'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Създаване на път'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count от 64 различни вида малц'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Все още няма добавени хмел. Можете да използвате бутоните по-долу, за да ги добавите по ред, или да запазите рецептата без хмел, за да я изпратите директно.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Добавете хмела в реда, в който е посочено.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Търсене на повтори'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Разширено: необработен шестничен път'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Префикси на шестнадесетична система'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Два шест-символни идентификатора на скок, разделени със запетаи'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Невалидно: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Максимум 64 крачета'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Използвайте този маршрут.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Премахнете хмела'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Неизвестен репитер'; @override String get chat_pathSavedLocally => @@ -4455,26 +4457,26 @@ class AppLocalizationsBg extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Увеличи'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Приближете се по-малко'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Карта на центъра'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth изисква браузър, базиран на Chromium.'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'Идентификационен номер: $id...'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS потвърдено'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Извлечена позиция'; } diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 62df5bb6..98d25a6d 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -93,22 +93,22 @@ class AppLocalizationsDe extends AppLocalizations { String get common_disable => 'Deaktivieren'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Rückgängig machen'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Gesendet'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Geliefert'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Versenden'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Nicht gesendet'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Wiederholt gehört'; @override String get common_reboot => 'Neustart'; @@ -1012,13 +1012,13 @@ class AppLocalizationsDe extends AppLocalizations { String get contacts_newGroup => 'Neue Gruppe'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Weitere Optionen'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Kontakte suchen'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Erweiterte Suche'; @override String get contacts_groupName => 'Gruppenname'; @@ -1528,82 +1528,84 @@ class AppLocalizationsDe extends AppLocalizations { String get chat_fullPath => 'Vollständiger Pfad'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Routenplanung'; @override String get routing_modeAuto => 'Auto'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Überschwemmung'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Handbuch'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Wählt automatisch den bekanntesten Pfad aus und verwendet eine Flutungsmethode, wenn kein Pfad bekannt ist.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Übertragung über alle Repeater. Die zuverlässigste Methode, jedoch mit höherem Datenverbrauch.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Sendet immer genau den von Ihnen festgelegten Weg.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Aktuelle Route'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Direkt – ohne Zwischenverstärkung'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Noch kein Pfad gefunden. Die Nachricht wird gesendet, bis ein Weg entdeckt wurde.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Übertragung über jeden Repeater'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Pfad bearbeiten'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Vergiss den Weg'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Bekannte Routen'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Wählen Sie den Pfad, um zu diesem zu wechseln.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'Im Gebrauch'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Ein starker erster Sprung'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Ein guter erster Schritt'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Erster erfolgreicher Schritt'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Hat erfolgreich geliefert'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Information erhalten durch Nachrichten über die Überschwemmung'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Nicht getestet'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return 'war beschäftigt $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nie bestätigt'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1611,52 +1613,54 @@ class AppLocalizationsDe extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Lieferung bei Überschwemmung'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Pfad erstellen'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count von 64 Hopfengewächsen'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Noch keine Hopfen hinzugefügt. Klicken Sie auf die Schaltflächen unten, um sie nacheinander hinzuzufügen, oder speichern Sie die Rezepter ohne Hopfen, um sie direkt zu versenden.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => + 'Fügen Sie die Hopfen in der richtigen Reihenfolge hinzu.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => + 'Suche nach wiederholten Nachrichten'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Fortgeschritten: Roh-Hex-Pfad'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Hex-Präfixe'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Zwei Hexadezimalzeichen pro Sprung, getrennt durch Kommas'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Ungültig: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Maximal 64 Hopfengreifer'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Verwenden Sie diesen Pfad.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Hop entfernen'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Unbekannter Repeater'; @override String get chat_pathSavedLocally => @@ -4474,26 +4478,26 @@ class AppLocalizationsDe extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Zoomen'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Auszoomen'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Zentralkarte'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth benötigt einen Chromium-Browser.'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'ID: $id…'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS-Bestätigung'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Abgeleitete Position'; } diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index aa17930b..e0268b4f 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -93,22 +93,22 @@ class AppLocalizationsEs extends AppLocalizations { String get common_disable => 'Desactivar'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Deshacer'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Sentido'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Entregado'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Enviar'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'No se pudo enviar'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Escuché repetidamente'; @override String get common_reboot => 'Reiniciar'; @@ -1011,13 +1011,13 @@ class AppLocalizationsEs extends AppLocalizations { String get contacts_newGroup => 'Nuevo Grupo'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Más opciones'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Buscar contactos'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Búsqueda avanzada'; @override String get contacts_groupName => 'Nombre del grupo'; @@ -1527,82 +1527,84 @@ class AppLocalizationsEs extends AppLocalizations { String get chat_fullPath => 'Ruta completa'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Ruteo'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Coche'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Inundación'; @override String get routing_modeManual => 'Manual'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Selecciona automáticamente la ruta más conocida, y si no hay ninguna ruta conocida, utiliza la ruta más directa.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Transmisiones a través de todos los repetidores. Es la opción más fiable, pero utiliza más tiempo de transmisión.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Siempre sigue exactamente la ruta que usted ha definido.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Ruta actual'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Directo — sin saltos de repetidor'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Aún no hay un camino definido. El mensaje se envía continuamente hasta que se encuentre una ruta.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => + 'Transmisión a través de todos los repetidores.'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Editar ruta'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Olvídate del camino'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Rutas conocidas'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Seleccione una opción para cambiar a esa.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'En uso'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Primer salto exitoso'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Primer paso exitoso'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Primer salto de calidad'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Ha cumplido'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Se ha escuchado a través de rumores.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Sin probar'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return 'trabajó $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nunca confirmado'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1610,52 +1612,53 @@ class AppLocalizationsEs extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Entrega por inundación'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Crear ruta'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count de 64 granos de lúpulo'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Aún no se han añadido lúpulos. Haga clic en los repetidores para añadirlos en el orden deseado, o guarde la receta sin lúpulos para enviarla directamente.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Añadir los lúpulos en el orden adecuado.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Buscar repetidores'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => + 'Avanzado: ruta hexadecimal sin procesar'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Prefijos hexadecimales'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Dos caracteres hexadecimales por salto, separados por comas.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Inválido: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Máximo 64 saltos'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Utilice esta ruta.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Eliminar el lúpulo'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Repetidor desconocido'; @override String get chat_pathSavedLocally => @@ -4461,17 +4464,17 @@ class AppLocalizationsEs extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Acercar'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Acercar'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Mapa del centro'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth requiere un navegador Chromium.'; @override String channels_communityShortId(String id) { @@ -4479,8 +4482,8 @@ class AppLocalizationsEs extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'Confirmado mediante GPS'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Posición inferida'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 69e2af85..7bb38a0d 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -93,22 +93,22 @@ class AppLocalizationsFr extends AppLocalizations { String get common_disable => 'Désactiver'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Annuler'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Envoyer'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Livré'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Envoyer'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Échec de l\'envoi'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Répété plusieurs fois'; @override String get common_reboot => 'Redémarrer'; @@ -1017,13 +1017,13 @@ class AppLocalizationsFr extends AppLocalizations { String get contacts_newGroup => 'Nouveau Groupe'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Plus d\'options'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Rechercher des contacts'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Recherche avancée'; @override String get contacts_groupName => 'Nom du groupe'; @@ -1533,82 +1533,83 @@ class AppLocalizationsFr extends AppLocalizations { String get chat_fullPath => 'Chemin complet'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Planification des itinéraires'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Voiture'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Inondation'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Manuel'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Sélectionne automatiquement le chemin le plus connu, et utilise la méthode de \"inondation\" si aucun chemin n\'est connu.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Diffusion via tous les répéteurs. La méthode la plus fiable, mais qui utilise plus de temps d\'antenne.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Il suit toujours le chemin précis que vous avez défini.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Itinéraire actuel'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Direct — sans relais'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Aucune voie encore trouvée. Le message suivant est envoyé jusqu\'à ce qu\'une route soit découverte.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Diffusion via tous les répéteurs'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Modifier le chemin'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Oubliez le chemin'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Chemins connus'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => 'Créez un raccourci pour y accéder.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'En cours d\'utilisation'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Première étape réussie'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Première étape réussie'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Première étape réussie'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'A livré'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Rapporté par des informations provenant de plusieurs sources.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Non testé'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return 'a travaillé $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'jamais confirmé'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1616,52 +1617,53 @@ class AppLocalizationsFr extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Livraison en cas de inondation'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Créer un chemin'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count parmi 64 houblons'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Aucun houblon ajouté pour le moment. Cliquez sur les répétiteurs ci-dessous pour les ajouter dans l\'ordre souhaité, ou enregistrez sans houblon pour envoyer directement.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => + 'Ajoutez les houblons dans l\'ordre souhaité.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Rechercher des répétiteurs'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Avancé : chemin hexadécimal brut'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Préfixes hexadécimaux'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Deux caractères hexadécimaux par saut, séparés par des virgules.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Incorrect : $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Maximum 64 sauts'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Utilisez ce chemin.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Éliminer le haricot'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Répéteur non identifié'; @override String get chat_pathSavedLocally => @@ -4488,26 +4490,26 @@ class AppLocalizationsFr extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Zoomez'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Zoomez'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Carte du centre'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth nécessite un navigateur Chromium.'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'ID : $id…'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'Le GPS a confirmé.'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Position déduite'; } diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index f58b8afc..eef91d09 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -93,22 +93,22 @@ class AppLocalizationsHu extends AppLocalizations { String get common_disable => 'Leteteszt'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Még egyszer'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Elküldve'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Szállítva'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Elküldés'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Nem sikerült elküldeni'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Ismételtem'; @override String get common_reboot => 'Újraindítás'; @@ -1017,13 +1017,13 @@ class AppLocalizationsHu extends AppLocalizations { String get contacts_newGroup => 'Új csoport'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'További lehetőségek'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Keresssz kapcsolatokat'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Teljesítse a keresést'; @override String get contacts_groupName => 'Csoport neve'; @@ -1536,74 +1536,77 @@ class AppLocalizationsHu extends AppLocalizations { String get chat_fullPath => 'Teljes elérési út'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Útvonal meghatározás'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Autó'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Áradás'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Használati útmutató'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Automatikusan kiválasztja a legismertebb útvonalat, és ha egyik sem ismert, akkor \"vízzel\" tölti ki.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Átvisszaadások minden erősítőn keresztül. A legmegbízhatóbb megoldás, de több időt igényel.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Mindig pontosan az útvonalat követi, amelyet megad.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Jelenlegi útvonal'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Közvetlen – nincs átjáró állomás'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Még nincs útvonal. A következő üzenet a keresésig vár.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => + 'Azonnali továbbítás minden erősítőn keresztül.'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Útvonal szerkesztése'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Felejtsd el a útvonalat'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Jellegzetes útvonalak'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Készíts egy útvonalat, hogy átválhass rá.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'Használatban'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Erős első lépés'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Jó első lépés'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Jó első lépés'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Előállított'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Információt hallottam a katasztrófa miatt.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Vizsgálatnak nem подвержен'; @override String routing_lastWorked(String when) { @@ -1611,7 +1614,7 @@ class AppLocalizationsHu extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'sosem megerősítve'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1619,52 +1622,53 @@ class AppLocalizationsHu extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Vízparti szállítás'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Út megépítése'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count db 64-ből'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Még nem adtam hozzá a bazsalikomot. A lent található gombokat használhatod, hogy sorrendben adjd hozzá, vagy mentheted anélkül, hogy bazsalikomot adnál hozzá, hogy közvetlenül elküldd.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => + 'Adja hozzá a bazsaidat a megfelelő sorrendben.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Ismétlő eszközök keresése'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Haladó szint: alapvető hex-út'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Hex előtagok'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Két hatjegyű szám minden lépésen, amelyek egymástól elválasztják a kommák.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Érvénytelen: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'A maximális szám 64.'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Használja ezt az útvonalat.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Távolítsa el a bazsalikomot'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Tudatlan erősítő'; @override String get chat_pathSavedLocally => @@ -4474,26 +4478,26 @@ class AppLocalizationsHu extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Nagyítva'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Kicsökkentett nézet'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Központi tér térkép'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'A Web Bluetooth-hoz egy Chromium-alapú böngésző szükséges.'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'Az azonosító: $id...'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS-en megerősítve'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Feltehető helyzet'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 7a7043bb..89fb77e7 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -93,22 +93,22 @@ class AppLocalizationsIt extends AppLocalizations { String get common_disable => 'Disattivare'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Annulla'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Invia'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Consegnato'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Invio'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Impossibile inviare'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Sentito ripetutamente'; @override String get common_reboot => 'Riavvia'; @@ -1013,13 +1013,13 @@ class AppLocalizationsIt extends AppLocalizations { String get contacts_newGroup => 'Nuovo Gruppo'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Ulteriori opzioni'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Cerca contatti'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Ricerca avanzata'; @override String get contacts_groupName => 'Nome gruppo'; @@ -1529,74 +1529,77 @@ class AppLocalizationsIt extends AppLocalizations { String get chat_fullPath => 'Percorso Completo'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Instradamento'; @override String get routing_modeAuto => 'Auto'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Inondazione'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Manuale'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Seleziona automaticamente il percorso più noto, e in caso di assenza di informazioni, utilizza un percorso casuale.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Trasmissioni tramite ogni ripetitore. Il metodo più affidabile, ma richiede più tempo di trasmissione.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Invia sempre esattamente il percorso che hai definito.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Percorso attuale'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => + 'Diretto — senza passaggi tramite ripetitori'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Al momento non è stata individuata alcuna via. Il messaggio viene inviato ripetutamente finché non viene trovata una rotta.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => + 'Trasmissione attraverso ogni ripetitore'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Percorso di modifica'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Dimentica il percorso'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Percorsi noti'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Seleziona un percorso per accedere a questa opzione.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'In uso'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Primo salto molto deciso'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Primo tentativo di successo'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Primo salto di qualità'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'È stato consegnato'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Ho sentito tramite un messaggio urgente'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Non testato'; @override String routing_lastWorked(String when) { @@ -1604,7 +1607,7 @@ class AppLocalizationsIt extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'mai confermato'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1612,52 +1615,53 @@ class AppLocalizationsIt extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Consegna in caso di alluvione'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Creare percorso'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count tra 64 varietà di luppolo'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Al momento non ci sono ingredienti aggiuntivi. Per aggiungerli nell\'ordine desiderato, cliccate sui ripetitori sottostanti. In alternativa, potete salvare la ricetta senza ingredienti aggiuntivi per inviarla direttamente.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => + 'Aggiungere i luppoli nell\'ordine desiderato.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Ricerca ripetitori'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Avanzato: percorso esadecimale grezzo'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Prefissi esadecimali'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Due caratteri esadecimali per ogni salto, separati da virgole.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Non valido: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Massimo 64 orari'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Utilizza questo percorso'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Rimuovere il luppolo'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Ripetitore sconosciuto'; @override String get chat_pathSavedLocally => @@ -4466,17 +4470,17 @@ class AppLocalizationsIt extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Ingrandisci'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Riduci la visualizzazione'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Mappa del centro'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth richiede un browser basato su Chromium.'; @override String channels_communityShortId(String id) { @@ -4484,8 +4488,8 @@ class AppLocalizationsIt extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'Il GPS conferma'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Posizione dedotta'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index ee79c6ee..c60816ee 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -93,22 +93,22 @@ class AppLocalizationsJa extends AppLocalizations { String get common_disable => '無効化する'; @override - String get common_undo => 'Undo'; + String get common_undo => '元に戻す'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => '送信'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => '配達'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => '送信'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => '送信できませんでした'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => '何度も聞いた'; @override String get common_reboot => '再起動'; @@ -964,13 +964,13 @@ class AppLocalizationsJa extends AppLocalizations { String get contacts_newGroup => '新しいグループ'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'さらに多くの選択肢'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => '連絡先を検索する'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => '検索を終了'; @override String get contacts_groupName => 'グループ名'; @@ -1462,82 +1462,80 @@ class AppLocalizationsJa extends AppLocalizations { String get chat_fullPath => 'フルパス'; @override - String get routing_title => 'Routing'; + String get routing_title => '経路設定'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => '自動車'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => '洪水'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'マニュアル'; @override - String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + String get routing_modeAutoHint => '最も一般的な経路を自動的に選択し、経路が不明な場合は、水没状態にします。'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'すべてのリピーターを通じて放送。最も信頼性が高いですが、より多くの時間を使用します。'; @override - String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + String get routing_modeManualHint => '常に、あなたが設定した正確な経路を辿って移動します。'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => '現在までのルート'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => '直接接続—中継装置を経由しない'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'まだ経路は確立されていません。「次のメッセージを送信し、経路が特定されるまで待ちます」。'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'すべてのリピーターを通じて放送'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'パスの編集'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => '道にこだわらない'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => '既知の経路'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => 'そのアプリケーションに切り替えるためのショートカットを作成します。'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => '使用中'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => '最初の段階で大きな成果を上げる'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => '最初の成功'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => '最初の試みは成功を収めた'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => '完了しました'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => '氾濫によって伝聞'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => '未検証'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return '$whenに勤務'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => '確認されていない'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1545,52 +1543,51 @@ class AppLocalizationsJa extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => '洪水による配送'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => '経路の作成'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '64個のホップのうち、$count個'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'まだホップは追加されていません。ホップを順番に追加するには、以下の「タップ」ボタンをクリックしてください。または、ホップを一切追加せずに直接送信するには、「保存」ボタンをクリックしてください。'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'ホップを、指定された順番に加える'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => '繰り返し検索'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => '高度なレベル:生のヘックスパス'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'ヘックスプレフィックス'; @override - String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + String get pathEditor_hexHelper => '各ホップごとに2つのハッシュ文字を、カンマで区切って記述'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return '無効: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => '最大64段階'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'この経路を使用してください'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'ホップを取り除く'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => '不明な増幅器'; @override String get chat_pathSavedLocally => 'ローカルで保存。同期のために接続する。'; @@ -4238,26 +4235,26 @@ class AppLocalizationsJa extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'ズームイン'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'ズームアウト'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => '中心地図'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth は、Chromium ブラウザが必要です。'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'ID: $id…'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPSによる確認'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => '推測される位置'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 64c5a6a6..812c2f94 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -93,22 +93,22 @@ class AppLocalizationsKo extends AppLocalizations { String get common_disable => '비활성화'; @override - String get common_undo => 'Undo'; + String get common_undo => '취소'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => '발송'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => '배송 완료'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => '발송'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => '발송 실패'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => '반복적으로 들었습니다'; @override String get common_reboot => '재부팅'; @@ -959,13 +959,13 @@ class AppLocalizationsKo extends AppLocalizations { String get contacts_newGroup => '새로운 그룹'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => '더 많은 옵션'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => '연락처 검색'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => '검색 닫기'; @override String get contacts_groupName => '그룹 이름'; @@ -1457,82 +1457,80 @@ class AppLocalizationsKo extends AppLocalizations { String get chat_fullPath => '전체 경로'; @override - String get routing_title => 'Routing'; + String get routing_title => '라우팅'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => '자동'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => '홍수'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => '사용 설명서'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + '가장 잘 알려진 경로를 자동으로 선택하고, 경로가 없을 경우에는 무작위로 경로를 선택합니다.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + '모든 증폭기를 통해 방송됩니다. 가장 안정적이지만, 더 많은 송출 시간을 사용합니다.'; @override - String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + String get routing_modeManualHint => '항상 설정하신 정확한 경로를 따라 이동합니다.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => '현재 경로'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => '직접 연결 – 중계 장치 사용 없이'; @override - String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + String get routing_noPathYet => '아직 경로가 없습니다. 다음 메시지가 도착할 때까지 계속 탐색합니다.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => '모든 증폭기를 통해 방송'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => '경로 편집'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => '길을 잊어라'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => '알려진 경로'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => '해당 항목으로 전환하기 위한 경로를 선택합니다.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => '사용 중'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => '강력한 첫 번째 단계'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => '좋은 첫 시작'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => '처음 시도'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => '완료됨'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => '홍수 피해 상황을 통해 들었습니다.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => '검증되지 않음'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return '$when에 일했습니다'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => '확인되지 않음'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1540,52 +1538,51 @@ class AppLocalizationsKo extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => '홍수 피해 지역 배송'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => '경로 만들기'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '64개의 홉 중 $count'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + '현재 홉은 추가되지 않았습니다. 아래의 탭을 사용하여 순서대로 추가하거나, 홉 없이 바로 전송하려면 \"홉 없음\"으로 저장하십시오.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => '홉을 순서대로 첨가해주세요.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => '반복 검색'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => '고급: 원시 헥스 경로'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => '헥스 접두사'; @override - String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + String get pathEditor_hexHelper => '각 홉마다 2개의 6자리 숫자, 쉼표로 구분'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return '유효하지 않음: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => '최대 64개의 홉'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => '이 경로를 사용하세요'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => '홉 제거'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => '알 수 없는 중계기'; @override String get chat_pathSavedLocally => '로컬에 저장. 동기화 연결'; @@ -4236,17 +4233,16 @@ class AppLocalizationsKo extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => '줌 인'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => '줌 아웃'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => '중심 지도'; @override - String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + String get chrome_bluetoothRequiresChromium => '웹 블루투스는 크롬 브라우저가 필요합니다.'; @override String channels_communityShortId(String id) { @@ -4254,8 +4250,8 @@ class AppLocalizationsKo extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS 확인 완료'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => '추론된 위치'; } diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 6f4d9fbb..94d5e1e3 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -93,22 +93,22 @@ class AppLocalizationsNl extends AppLocalizations { String get common_disable => 'Uitschakelen'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Achterhalen/Annuleren'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Verzonden'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Leverd'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Verzenden'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Niet verzonden'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Hearsay, herhaald'; @override String get common_reboot => 'Herstarten'; @@ -1005,13 +1005,13 @@ class AppLocalizationsNl extends AppLocalizations { String get contacts_newGroup => 'Nieuwe Groep'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Meer opties'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Zoek contactpersonen'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Zoeken'; @override String get contacts_groupName => 'Groepnaam'; @@ -1516,74 +1516,74 @@ class AppLocalizationsNl extends AppLocalizations { String get chat_fullPath => 'Volledige Pad'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Routeplanning'; @override String get routing_modeAuto => 'Auto'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Overstroming'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Handleiding'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Selecteert automatisch het bekendste pad, en gebruikt een flood-algoritme als er geen bekend pad is.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Uitzendingen via elke zender. De meest betrouwbare methode, maar vereist meer uitzendtijd.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Stuurt altijd de exacte route die u heeft aangegeven.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Huidige route'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Direct – zonder tussenliggende schakels'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Er is nog geen route gevonden. De berichten blijven binnenkomen totdat een route is ontdekt.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Uitgestoten via elke zender.'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Pad bewerken'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Vergeet het pad'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Bekende routes'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => 'Maak een route om er naartoe te gaan.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'In gebruik'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Sterke eerste sprong'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Een goede eerste stap'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Een goede eerste hop'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Is geleverd'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Hears via een overstroming'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Niet getest'; @override String routing_lastWorked(String when) { @@ -1591,60 +1591,60 @@ class AppLocalizationsNl extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nooit bevestigd'; @override String routing_deliveryCounts(int successes, int failures) { - return '$successes delivered, $failures failed'; + return '$successes zijn behaald, $failures zijn mislukt'; } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Levering bij overstroming'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Pad creëren'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count van 64 hopgranen'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Er zijn nog geen hop toegevoegd. Klik op de onderstaande knoppen om ze in de juiste volgorde toe te voegen, of sla de bestelling op zonder hop om deze direct te versturen.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Voeg hop toe in de juiste volgorde.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Zoek naar herhaaldelijke zenders'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Geavanceerd: ruwe hex-pad'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Hex-voorkanten'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Twee hex-tekens per stap, gescheiden door komma\'s'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Ongeldig: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Maximaal 64 hopken'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Gebruik deze route.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Verwijder de hop'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Onbekend type zender'; @override String get chat_pathSavedLocally => @@ -4441,17 +4441,17 @@ class AppLocalizationsNl extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Inzoomen'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Inzoomen'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Centraal overzicht'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth vereist een Chromium-browser.'; @override String channels_communityShortId(String id) { @@ -4459,8 +4459,8 @@ class AppLocalizationsNl extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS-locatie bevestigd'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Afgeleide positie'; } diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index f582d2df..b95dcbfc 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -93,22 +93,22 @@ class AppLocalizationsPl extends AppLocalizations { String get common_disable => 'Wyłącz'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Wycofaj'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Wysłane'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Dostarczone'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Wysyłanie'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Nie udało się wysłać'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Usłyszałem to wielokrotnie'; @override String get common_reboot => 'Uruchom ponownie'; @@ -1023,13 +1023,13 @@ class AppLocalizationsPl extends AppLocalizations { String get contacts_newGroup => 'Nowa Grupa'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Więcej opcji'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Wyszukaj kontakty'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Zaawansowane wyszukiwanie'; @override String get contacts_groupName => 'Nazwa grupy'; @@ -1541,82 +1541,85 @@ class AppLocalizationsPl extends AppLocalizations { String get chat_fullPath => 'Pełna ścieżka'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Planowanie tras'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Samochód'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Powódź'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Instrukcja obsługi'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Automatycznie wybiera najpopularniejszą ścieżkę, a w przypadku braku znanej, przechodzi do trybu \"przepływu\".'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Transmisje za pośrednictwem każdego repeatera. Najbardziej niezawodna metoda, ale zużywa więcej czasu transmisji.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Zawsze prowadzi dokładnie po trasie, którą określiłeś.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Obecna trasa'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => + 'Bezpośrednio – bez pośrednictwa repeaterów'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Na razie nie ma żadnej ścieżki. Komunikacja trwa do momentu, gdy zostanie odkryta trasa.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => + 'Transmisja za pośrednictwem każdego urządzenia powielającego'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Edytuj ścieżkę'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Zapomnij o ścieżce'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Znane trasy'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Wybierz ścieżkę, aby przełączyć się na nią.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'W użyciu'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Silny pierwszy skok'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Świetny początek'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Świetny pierwszy krzak'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Zostało dostarczone'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Usłyszano dzięki doniesieniom'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Nieużywany'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return 'pracował $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nigdy nie zostało potwierdzone'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1624,52 +1627,53 @@ class AppLocalizationsPl extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Dostawa w przypadku powodzi'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Stworzenie ścieżki'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count z 64 rodzajów chmielu'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Na razie nie dodano żadnych chmielu. Aby dodać je w odpowiedniej kolejności, kliknij w odpowiednie przyciski poniżej, lub zapisz przepis bez chmielu, aby wysłać go bezpośrednio.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Dodawaj chmiel zgodnie z kolejnością.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Funkcje powtarzania'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => + 'Zaawansowane: ścieżka w formacie szesnastkowym'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Prefiksy heksadecymalne'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Dwa znaki szesnastkowe na każdym kroku, oddzielone przecinkami'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Nieprawidłowe: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Maksymalnie 64 hopów'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Użyj tej ścieżki.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Usuń dziką psiankę'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Nieznany repeater'; @override String get chat_pathSavedLocally => @@ -4475,17 +4479,17 @@ class AppLocalizationsPl extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Przybliż'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Przybliż z powrotem'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Mapa centrum'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth wymaga przeglądarki Chromium.'; @override String channels_communityShortId(String id) { @@ -4493,8 +4497,8 @@ class AppLocalizationsPl extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS potwierdzone'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Wywnioskowana pozycja'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 23495d55..09a4fa79 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -93,22 +93,22 @@ class AppLocalizationsPt extends AppLocalizations { String get common_disable => 'Desativar'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Desfazer'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Enviado'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Entregue'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Enviar'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Falhou ao enviar'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Ouvi repetidamente'; @override String get common_reboot => 'Reiniciar'; @@ -1013,13 +1013,13 @@ class AppLocalizationsPt extends AppLocalizations { String get contacts_newGroup => 'Novo Grupo'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Mais opções'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Pesquisar contatos'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Pesquisa avançada'; @override String get contacts_groupName => 'Nome do grupo'; @@ -1526,74 +1526,77 @@ class AppLocalizationsPt extends AppLocalizations { String get chat_fullPath => 'Caminho Completo'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Rotas'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Carro'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Inundação'; @override String get routing_modeManual => 'Manual'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Seleciona automaticamente o caminho mais conhecido, e, se nenhum caminho conhecido for encontrado, utiliza a estratégia de \"inundação\".'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Transmissão através de todos os repetidores. É a opção mais confiável, mas utiliza mais tempo de transmissão.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Sempre segue exatamente o caminho que você define.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Rota atual'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Direto – sem saltos de repetidor'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Ainda não há um caminho definido. A mensagem continua a ser enviada até que uma rota seja encontrada.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => + 'Transmissão através de todos os repetidores'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Editar caminho'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Esqueça o caminho'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Rotas conhecidas'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Toque em um caminho para alternar para ele.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'Em uso'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Primeiro salto notável'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Primeiro salto bem-sucedido'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Primeira etapa bem-sucedida'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Foi entregue'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Informação obtida através de relatos generalizados.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Não testado'; @override String routing_lastWorked(String when) { @@ -1601,7 +1604,7 @@ class AppLocalizationsPt extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nunca confirmado'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1609,52 +1612,53 @@ class AppLocalizationsPt extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => + 'Entrega em áreas afetadas por inundações'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Criar Caminho'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count de 64 gramas de lúpulo'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Ainda não há lúpulos adicionados. Clique nos repetidores abaixo para adicioná-los na ordem desejada, ou salve sem adicionar lúpulos para enviar diretamente.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Adicione os lúpulos na seguinte ordem.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Encontrar repetidores'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Avançado: caminho hexadecimal bruto'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Prefixos hexadecimais'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Dois caracteres hexadecimais por salto, separados por vírgulas.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Inválido: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Máximo de 64 saltos'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Utilize este caminho.'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Remova o lúpulo'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Repetidor desconhecido'; @override String get chat_pathSavedLocally => @@ -4454,17 +4458,17 @@ class AppLocalizationsPt extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Ampliar'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Ampliar'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Mapa do centro'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'O Web Bluetooth requer um navegador Chromium.'; @override String channels_communityShortId(String id) { @@ -4472,8 +4476,8 @@ class AppLocalizationsPt extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS confirmado'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Posição inferida'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index fe535172..6503c5c1 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -93,22 +93,22 @@ class AppLocalizationsRu extends AppLocalizations { String get common_disable => 'Выключить'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Отменить'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Отправлено'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Доставлено'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Отправка'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Не удалось отправить'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Услышал несколько раз'; @override String get common_reboot => 'Перезагрузить'; @@ -1014,13 +1014,13 @@ class AppLocalizationsRu extends AppLocalizations { String get contacts_newGroup => 'Новая группа'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Больше вариантов'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Найти контакты'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Закрыть поиск'; @override String get contacts_groupName => 'Имя группы'; @@ -1529,74 +1529,77 @@ class AppLocalizationsRu extends AppLocalizations { String get chat_fullPath => 'Полный маршрут'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Маршрутизация'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Авто'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Наводнение'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Инструкция'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Автоматически выбирает наиболее известный путь, и если такой путь неизвестен, использует алгоритм поиска пути.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Передача сигнала через все ретрансляторы. Самый надежный способ, но требует больше времени на передачу.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Всегда следует точно по указанному вами маршруту.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Текущий маршрут'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => + 'Прямое соединение – без использования ретрансляторов'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Пока нет пути. Следующее сообщение будет отправлено до тех пор, пока не будет обнаружен маршрут.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Транслируется через все ретрансляторы'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Изменить путь'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Забудьте о маршруте'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Известные маршруты'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Создайте маршрут для переключения на этот пункт.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'В эксплуатации'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Сильный первый скачок'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Хорошее начало'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Первый хороший урожай'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Осуществлено'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Узнал из новостей, распространяющихся в интернете.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Непроверенный'; @override String routing_lastWorked(String when) { @@ -1604,7 +1607,7 @@ class AppLocalizationsRu extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'никогда не было подтверждено'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1612,52 +1615,55 @@ class AppLocalizationsRu extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Доставка при затоплении'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Создать маршрут'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count из 64 хмеля'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'На данный момент хмель еще не добавлен. Чтобы добавить его, нажмите на соответствующие кнопки ниже в нужном порядке, или сохраните рецепт без хмеля, чтобы отправить его напрямую.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => + 'Добавляйте хмель в соответствии с указанным порядком.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Поиск повторителей'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => + 'Продвинутый уровень: прямой путь в шестнадцатеричном формате'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Префиксы шестнадцатеричной системы'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Два шестнадцатеричных символа на каждом шаге, разделенные запятыми.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Неверно: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => + 'Максимальное количество ингредиентов – 64'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Используйте этот путь'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Удалить хмель'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Неизвестный ретранслятор'; @override String get chat_pathSavedLocally => @@ -4468,26 +4474,26 @@ class AppLocalizationsRu extends AppLocalizations { String get contact_typeUnknown => 'Неизвестно'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Увеличить масштаб'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Увеличить масштаб'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Карта центра'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Для работы Web Bluetooth требуется браузер на основе Chromium.'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'Идентификатор: $id...'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS подтверждено'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Выведенная позиция'; } diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index f15bcfc1..3bb7ac5f 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -93,22 +93,22 @@ class AppLocalizationsSk extends AppLocalizations { String get common_disable => 'Zakázať'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Zrušiť'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Odoslané'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Doručené'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Odoslanie'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Neúspešné odeslanie'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Slyšal som to opakovane'; @override String get common_reboot => 'Restartovať'; @@ -1002,13 +1002,13 @@ class AppLocalizationsSk extends AppLocalizations { String get contacts_newGroup => 'Nová skupina'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Ďalšie možnosti'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Vyhľadajte kontakty'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Zavrieť vyhľadávanie'; @override String get contacts_groupName => 'Názov skupiny'; @@ -1517,74 +1517,77 @@ class AppLocalizationsSk extends AppLocalizations { String get chat_fullPath => 'Celá cesta'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Navigácia'; @override String get routing_modeAuto => 'Auto'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Povodňová vlna'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Ručná príručka'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Automaticky vyberá najznámejší trasa, a ak žiadna nie je známa, použije náhodnú trasu.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Prenos prostredníctvom všetkých opakovačov. Najspoľahlivejší spôsob, ale vyžaduje viac času vysielania.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Vždy dodáva presne podľa zadaného trasy.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Aktuálna trasa'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Priamo – bez prechodných trás'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Zatiaľ neexistuje žiadna cesta. Nasledujúce správy budú pokračovať, kým sa nenájde trasa.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => + 'Prenos prostredníctvom každého opakovača'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Upraviť trasu'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Zabudnite na trasu'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Známe cesty'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Kliknite na cestu, aby ste sa k nej presunuli.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'V prevádzke'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Silný prvý krok'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Úspešný prvý krok'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Prvá, spravodlivá fáza'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Dosiahnutý úspech'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => + 'Zistil som to z informácií, ktoré som získal v dôsledku povodňovej situácie.'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Neotestované'; @override String routing_lastWorked(String when) { @@ -1592,7 +1595,7 @@ class AppLocalizationsSk extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nikedy nebolo potvrdené'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1600,52 +1603,53 @@ class AppLocalizationsSk extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Doručenie v prípade povodní'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Vytvorenie cesty'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count z 64 chmelových zŕš'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Zatiaľ žiadne chmel. Kliknite na opakované, aby ste ich pridali postupne, alebo uložte bez chmelu, aby ste ho mohli poslať priamo.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Pridávajte chmel podľa zadaného poriadku.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Hľadať opakované'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Pokročilé: pôvodná hexová cesta'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Prefiksy pre hexadecimálne čísla'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Dve hexové čísla na každý krok, oddelené čiarkami'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Neplatné: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Maximálne 64 krokov'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Použite túto cestu'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Odstráňte chmel'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => + 'Neznáme zariadenie na opakované vysielanie'; @override String get chat_pathSavedLocally => @@ -4436,17 +4440,17 @@ class AppLocalizationsSk extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Zväčšiť'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Zmenť zamer zblízka'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Mapa centra'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth vyžaduje prehliadač Chromium.'; @override String channels_communityShortId(String id) { @@ -4454,8 +4458,8 @@ class AppLocalizationsSk extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS potvrdilo'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Odvodená poloha'; } diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index c2dc192b..e1efed05 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -93,22 +93,23 @@ class AppLocalizationsSl extends AppLocalizations { String get common_disable => 'Izklopiti'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Preobrn'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Pošljeno'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Dostavljeno'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Pošiljanje'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => + 'Uspešno ni bilo mogo, da se sporočilo pošlje'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Slišal sem večkrat'; @override String get common_reboot => 'Ponoviti'; @@ -1001,13 +1002,13 @@ class AppLocalizationsSl extends AppLocalizations { String get contacts_newGroup => 'Nova skupina'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Več možnosti'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Iskanje kontaktov'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Izklopi iskanje'; @override String get contacts_groupName => 'Ime skupine'; @@ -1514,82 +1515,82 @@ class AppLocalizationsSl extends AppLocalizations { String get chat_fullPath => 'Polna pot'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Navigacija'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Avto'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Poplavo'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Navodilo'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Samodejno izbere najbolj poznano pot, in sicer, ko ni na voljo nobena.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Prenosi preko vseh repetitorjev. Najzanesljivejši način, vendar zahteva več časa.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Vedno sledi natančni poti, ki jo ste določili.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Trenutna pot'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Neposredno – brez prehodov'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Žep trenutno ni mogoče najti. Naslednje sporočilo bo posredovano, dokler ne bo ugotovljeno, kje je pot.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Prenos preko vseh repetitiv'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Uredi pot'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Pozabi na pot'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Poznati poti'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => 'Kliknite na pot, da jo izberete.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'V uporabi'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Močan prvi korak'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Prva uspešna faza'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Prva, uspešna faza'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Izpolnil'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Slišano preko poplave'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Ne preizkušen'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return 'delal/a $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'nikoli ni bilo potrjeno'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1597,52 +1598,52 @@ class AppLocalizationsSl extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Dostava zaradi poplave'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Izgradnja poti'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count od 64 različnih sort hropa'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Še niso dodani hmelji. Za dodajanje hmelja v vrstnem redu kliknite na povezavo spodaj, ali pa shranite brez dodanega hmelja, da ga lahko posredujete neposredno.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Dodajte suho travo v skladu s postopkom.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Iskanje ponovitev'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Napredno: surovi šestnajstni pot'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Predfiks za heksadecimalno šifro'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Dva šestbitna znaka na vsak skok, ločena z vejico'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Neveljaven: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Največ 64 hopov'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Uporabite to poto'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Odstranite hmelj'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Neznani ponovitelj'; @override String get chat_pathSavedLocally => @@ -4438,17 +4439,17 @@ class AppLocalizationsSl extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Povečaj'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Povečajte pogled'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Krajšarska karta'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth zahteva brskalnik Chromium.'; @override String channels_communityShortId(String id) { @@ -4456,8 +4457,8 @@ class AppLocalizationsSl extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS potrdilo'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Izpeljana lokacija'; } diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index ef0df94c..a95e8903 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -93,22 +93,22 @@ class AppLocalizationsSv extends AppLocalizations { String get common_disable => 'Inaktivera'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Ångra'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Sen'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Levererad'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Skicka'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Misslyckades med att skicka'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Hördes upprepade gånger'; @override String get common_reboot => 'Start om'; @@ -996,13 +996,13 @@ class AppLocalizationsSv extends AppLocalizations { String get contacts_newGroup => 'Ny grupp'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Fler alternativ'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Sök efter kontakter'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Avancerad sökning'; @override String get contacts_groupName => 'Gruppnamn'; @@ -1508,82 +1508,82 @@ class AppLocalizationsSv extends AppLocalizations { String get chat_fullPath => 'Fullständig sökväg'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Ruttplanering'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Bil'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Översvämning'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Instruktioner'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Väljer automatiskt den bästa kända vägen, och använder en \"flooding\"-strategi om ingen väg är känd.'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Sändningar via alla repetrar. Det mest pålitliga alternativet, men kräver mer sändtid.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Skickar alltid den exakta väg du har angivit.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Nuvarande rutt'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => 'Direkt – utan mellanliggande routrar'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Ingen väg hittad ännu. Nästa meddelande skickas tills en rutt har upptäckts.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Sändas via alla repetrar'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Redigera sökväg'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Glöm vägen'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Kända vägar'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => 'Välj en väg för att byta till den.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'I användning'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'En stark start'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Bra första steg'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Bra första hopp'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Har levererat'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Fått information via nyhetsflöde'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Ej testat'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return 'arbetade $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'aldrig bekräftat'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1591,52 +1591,52 @@ class AppLocalizationsSv extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Leverans vid översvämningsområde'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Skapa väg'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count av 64 humlor'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Inga humle än. Använd knapparna nedan för att lägga till dem i rätt ordning, eller spara utan humle för att skicka direkt.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Tillsätt humlen i rätt ordning.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Sök efter återupptagna samtal'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => 'Avancerat: rå hex-sökväg'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => 'Hex-prefikser'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Två hex-tecken per steg, separerade med kommatecken.'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Ogiltigt: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Maximalt 64 humlörter'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Använd denna väg'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Ta bort humlen'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Okänd förstärkare'; @override String get chat_pathSavedLocally => @@ -4413,17 +4413,17 @@ class AppLocalizationsSv extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Zooma in'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Zooma ut'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Kartöversikt'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth kräver en Chromium-baserad webbläsare.'; @override String channels_communityShortId(String id) { @@ -4431,8 +4431,8 @@ class AppLocalizationsSv extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS-verifierat'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Antagen position'; } diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index beb14024..989acdb8 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -93,22 +93,22 @@ class AppLocalizationsUk extends AppLocalizations { String get common_disable => 'Вимкнути'; @override - String get common_undo => 'Undo'; + String get common_undo => 'Скасувати'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => 'Надіслано'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => 'Доставлено'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => 'Надсилання'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => 'Не вдалося надіслати'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => 'Почув неодноразово'; @override String get common_reboot => 'Перезавантажити'; @@ -1009,13 +1009,13 @@ class AppLocalizationsUk extends AppLocalizations { String get contacts_newGroup => 'Нова група'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => 'Більше можливостей'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => 'Пошук контактів'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => 'Закрити пошук'; @override String get contacts_groupName => 'Назва групи'; @@ -1524,74 +1524,76 @@ class AppLocalizationsUk extends AppLocalizations { String get chat_fullPath => 'Повний шлях'; @override - String get routing_title => 'Routing'; + String get routing_title => 'Маршрутизація'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => 'Автомобіль'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => 'Повені'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => 'Інструкція'; @override String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + 'Автоматично обирає найкращий відомий шлях, та у разі відсутності відомого шляху, використовує алгоритм \"занурення\".'; @override String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + 'Передавання через усі ретранслятори. Найбільш надійний спосіб, але потребує більше часу.'; @override String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + 'Завжди доставляє точно за вказаним вами маршрутом.'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => 'Поточний маршрут'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => + 'Пряме з\'єднання – без проміжних ретрансляторів'; @override String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + 'Поки що немає жодного шляху. Повідомлення продовжуються надходити, поки не буде знайдено маршрут.'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => 'Поширення через усі ретранслятори'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => 'Редагувати шлях'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => 'Забудь про шлях'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => 'Відомі маршрути'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => + 'Виберіть опцію, щоб переключитися на неї.'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => 'У робочому стані'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => 'Сильний перший стрибок'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => 'Чудова перша спроба'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => 'Перший, але вдалий, крок'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => 'Доставлено'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => 'Дізнався через новини'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => 'Не протестовано'; @override String routing_lastWorked(String when) { @@ -1599,7 +1601,7 @@ class AppLocalizationsUk extends AppLocalizations { } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => 'ніколи не підтверджено'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1607,52 +1609,54 @@ class AppLocalizationsUk extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => 'Доставка під час повені'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => 'Створити маршрут'; @override String pathEditor_hopCounter(int count) { - return '$count of 64 hops'; + return '$count з 64 штук хмелю'; } @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + 'Ще не додано хміль. Натисніть на відповідні кнопки, щоб додати його в потрібному порядку, або збережіть рецепт без хмілю, щоб відправити його безпосередньо.'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => 'Додавайте хміль у наступній послідовності.'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => 'Пошук повторювачів'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => + 'Просунутий рівень: пряма шлях у форматі шестнадцяткової системи.'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => + 'Префікси для шестнадцяткової системи числення'; @override String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + 'Два шестизначні символи на кожний крок, розділені комами'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return 'Неправильно: $tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => 'Максимум 64 хмелеві колоди'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => 'Використовуйте цей шлях'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => 'Видалити хміль'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => 'Невідомий ретранслятор'; @override String get chat_pathSavedLocally => @@ -4469,17 +4473,17 @@ class AppLocalizationsUk extends AppLocalizations { String get contact_typeUnknown => 'Невідомо'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => 'Увійти в режим збільшення'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => 'Видалити зум'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => 'Карта центру'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth вимагає браузера на основі Chromium'; @override String channels_communityShortId(String id) { @@ -4487,8 +4491,8 @@ class AppLocalizationsUk extends AppLocalizations { } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => 'GPS підтверджено'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => 'Висновок щодо положення'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 41374057..bf4131b8 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -93,22 +93,22 @@ class AppLocalizationsZh extends AppLocalizations { String get common_disable => '禁用'; @override - String get common_undo => 'Undo'; + String get common_undo => '撤销'; @override - String get messageStatus_sent => 'Sent'; + String get messageStatus_sent => '发送'; @override - String get messageStatus_delivered => 'Delivered'; + String get messageStatus_delivered => '已送达'; @override - String get messageStatus_pending => 'Sending'; + String get messageStatus_pending => '发送'; @override - String get messageStatus_failed => 'Failed to send'; + String get messageStatus_failed => '发送失败'; @override - String get messageStatus_repeated => 'Heard repeated'; + String get messageStatus_repeated => '多次听到'; @override String get common_reboot => '重启'; @@ -945,13 +945,13 @@ class AppLocalizationsZh extends AppLocalizations { String get contacts_newGroup => '新建群聊'; @override - String get contacts_moreOptions => 'More options'; + String get contacts_moreOptions => '更多选择'; @override - String get contacts_searchOpen => 'Search contacts'; + String get contacts_searchOpen => '搜索联系人'; @override - String get contacts_searchClose => 'Close search'; + String get contacts_searchClose => '高级搜索'; @override String get contacts_groupName => '群聊名称'; @@ -1437,82 +1437,78 @@ class AppLocalizationsZh extends AppLocalizations { String get chat_fullPath => '完整路径'; @override - String get routing_title => 'Routing'; + String get routing_title => '路由'; @override - String get routing_modeAuto => 'Auto'; + String get routing_modeAuto => '汽车'; @override - String get routing_modeFlood => 'Flood'; + String get routing_modeFlood => '洪水'; @override - String get routing_modeManual => 'Manual'; + String get routing_modeManual => '手册'; @override - String get routing_modeAutoHint => - 'Picks the best known path automatically, flooding when none is known.'; + String get routing_modeAutoHint => '自动选择已知最佳路径,当没有已知路径时,则进行“洪水”搜索。'; @override - String get routing_modeFloodHint => - 'Broadcasts through every repeater. Most reliable, but uses more airtime.'; + String get routing_modeFloodHint => '通过所有中继站进行广播。 这种方式最可靠,但占用更多的时间。'; @override - String get routing_modeManualHint => - 'Always sends along the exact path you set.'; + String get routing_modeManualHint => '总是按照您设置的路径进行导航。'; @override - String get routing_currentRoute => 'Current route'; + String get routing_currentRoute => '当前路线'; @override - String get routing_directNoHops => 'Direct — no repeater hops'; + String get routing_directNoHops => '直接连接— 无中继跳'; @override - String get routing_noPathYet => - 'No path yet. The next message floods until a route is discovered.'; + String get routing_noPathYet => '目前还没有找到路径。直到找到路径,才会收到后续消息。'; @override - String get routing_floodBroadcast => 'Broadcast through every repeater'; + String get routing_floodBroadcast => '通过所有中继器进行广播'; @override - String get routing_editPath => 'Edit path'; + String get routing_editPath => '编辑路径'; @override - String get routing_forgetPath => 'Forget path'; + String get routing_forgetPath => '忘记原路'; @override - String get routing_knownPaths => 'Known paths'; + String get routing_knownPaths => '已知的路径'; @override - String get routing_knownPathsHint => 'Tap a path to switch to it.'; + String get routing_knownPathsHint => '点击该路径以切换到它。'; @override - String get routing_inUse => 'In use'; + String get routing_inUse => '使用中'; @override - String get routing_qualityStrong => 'Strong first hop'; + String get routing_qualityStrong => '强劲的初始阶段'; @override - String get routing_qualityGood => 'Good first hop'; + String get routing_qualityGood => '不错的开端'; @override - String get routing_qualityFair => 'Fair first hop'; + String get routing_qualityFair => '第一次尝试,结果良好'; @override - String get routing_qualityWorked => 'Has delivered'; + String get routing_qualityWorked => '已完成'; @override - String get routing_qualityFlood => 'Heard via flood'; + String get routing_qualityFlood => '通过新闻报道'; @override - String get routing_qualityUntested => 'Untested'; + String get routing_qualityUntested => '未经测试'; @override String routing_lastWorked(String when) { - return 'worked $when'; + return '工作于 $when'; } @override - String get routing_neverWorked => 'never confirmed'; + String get routing_neverWorked => '从未得到证实'; @override String routing_deliveryCounts(int successes, int failures) { @@ -1520,10 +1516,10 @@ class AppLocalizationsZh extends AppLocalizations { } @override - String get routing_floodDelivery => 'Flood delivery'; + String get routing_floodDelivery => '洪水配送'; @override - String get pathEditor_title => 'Build Path'; + String get pathEditor_title => '构建路径'; @override String pathEditor_hopCounter(int count) { @@ -1532,40 +1528,39 @@ class AppLocalizationsZh extends AppLocalizations { @override String get pathEditor_noHops => - 'No hops yet. Tap repeaters below to add them in order, or save with no hops to send direct.'; + '目前还没有添加任何啤酒花。点击下面的“添加”按钮,按顺序添加,或者直接保存,不添加任何啤酒花。'; @override - String get pathEditor_addHops => 'Add hops in order'; + String get pathEditor_addHops => '按照顺序添加啤酒花'; @override - String get pathEditor_searchRepeaters => 'Search repeaters'; + String get pathEditor_searchRepeaters => '重复搜索'; @override - String get pathEditor_advancedHex => 'Advanced: raw hex path'; + String get pathEditor_advancedHex => '高级:原始十六进制路径'; @override - String get pathEditor_hexLabel => 'Hex prefixes'; + String get pathEditor_hexLabel => '十六进制前缀'; @override - String get pathEditor_hexHelper => - 'Two hex characters per hop, separated by commas'; + String get pathEditor_hexHelper => '每次跳跃,使用两个十六进制字符,用逗号分隔。'; @override String pathEditor_invalidTokens(String tokens) { - return 'Invalid: $tokens'; + return '无效:$tokens'; } @override - String get pathEditor_tooManyHops => 'Maximum 64 hops'; + String get pathEditor_tooManyHops => '最多 64 个跳跃'; @override - String get pathEditor_usePath => 'Use this path'; + String get pathEditor_usePath => '请使用此路径'; @override - String get pathEditor_removeHop => 'Remove hop'; + String get pathEditor_removeHop => '去除啤酒花'; @override - String get pathEditor_unknownHop => 'Unknown repeater'; + String get pathEditor_unknownHop => '未知的重复器'; @override String get chat_pathSavedLocally => '已本地保存,连接设备后可同步。'; @@ -4128,26 +4123,26 @@ class AppLocalizationsZh extends AppLocalizations { String get contact_typeUnknown => 'Unknown'; @override - String get map_zoomIn => 'Zoom in'; + String get map_zoomIn => '放大'; @override - String get map_zoomOut => 'Zoom out'; + String get map_zoomOut => '放大'; @override - String get map_centerMap => 'Center map'; + String get map_centerMap => '中心地图'; @override String get chrome_bluetoothRequiresChromium => - 'Web Bluetooth requires a Chromium browser'; + 'Web Bluetooth 需要 Chromium 浏览器'; @override String channels_communityShortId(String id) { - return 'ID: $id...'; + return 'ID:$id...'; } @override - String get pathTrace_legendGpsConfirmed => 'GPS confirmed'; + String get pathTrace_legendGpsConfirmed => '通过GPS确认'; @override - String get pathTrace_legendInferred => 'Inferred position'; + String get pathTrace_legendInferred => '推测的位置'; } diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index dfcf03b1..7c72900b 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Aantal aanvragen", "telemetry_error": "Kan gegevens niet ophalen", "telemetry_noData": "Geen telemetriedata beschikbaar.", @@ -2353,5 +2353,98 @@ "chat_newMessages": "Nieuwe berichten", "chat_markAsUnread": "Markeer als ongelezen", "settings_companionDebugLogSubtitle": "BLE/TCP/USB commando's, antwoorden en ruwe data", - "repeater_chanUtil": "Gebruik van het kanaal" + "repeater_chanUtil": "Gebruik van het kanaal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Verzonden", + "common_undo": "Achterhalen/Annuleren", + "messageStatus_delivered": "Leverd", + "messageStatus_pending": "Verzenden", + "messageStatus_failed": "Niet verzonden", + "messageStatus_repeated": "Hearsay, herhaald", + "contacts_moreOptions": "Meer opties", + "contacts_searchOpen": "Zoek contactpersonen", + "contacts_searchClose": "Zoeken", + "routing_title": "Routeplanning", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Overstroming", + "routing_modeManual": "Handleiding", + "routing_modeAutoHint": "Selecteert automatisch het bekendste pad, en gebruikt een flood-algoritme als er geen bekend pad is.", + "routing_modeFloodHint": "Uitzendingen via elke zender. De meest betrouwbare methode, maar vereist meer uitzendtijd.", + "routing_modeManualHint": "Stuurt altijd de exacte route die u heeft aangegeven.", + "routing_currentRoute": "Huidige route", + "routing_directNoHops": "Direct – zonder tussenliggende schakels", + "routing_noPathYet": "Er is nog geen route gevonden. De berichten blijven binnenkomen totdat een route is ontdekt.", + "routing_floodBroadcast": "Uitgestoten via elke zender.", + "routing_editPath": "Pad bewerken", + "routing_forgetPath": "Vergeet het pad", + "routing_knownPaths": "Bekende routes", + "routing_knownPathsHint": "Maak een route om er naartoe te gaan.", + "routing_inUse": "In gebruik", + "routing_qualityStrong": "Sterke eerste sprong", + "routing_qualityGood": "Een goede eerste stap", + "routing_qualityFair": "Een goede eerste hop", + "routing_qualityWorked": "Is geleverd", + "routing_qualityFlood": "Hears via een overstroming", + "routing_qualityUntested": "Niet getest", + "routing_neverWorked": "nooit bevestigd", + "routing_deliveryCounts": "{successes} zijn behaald, {failures} zijn mislukt", + "routing_floodDelivery": "Levering bij overstroming", + "pathEditor_title": "Pad creëren", + "pathEditor_hopCounter": "{count} van 64 hopgranen", + "pathEditor_noHops": "Er zijn nog geen hop toegevoegd. Klik op de onderstaande knoppen om ze in de juiste volgorde toe te voegen, of sla de bestelling op zonder hop om deze direct te versturen.", + "pathEditor_addHops": "Voeg hop toe in de juiste volgorde.", + "pathEditor_searchRepeaters": "Zoek naar herhaaldelijke zenders", + "pathEditor_advancedHex": "Geavanceerd: ruwe hex-pad", + "pathEditor_hexLabel": "Hex-voorkanten", + "pathEditor_hexHelper": "Twee hex-tekens per stap, gescheiden door komma's", + "pathEditor_invalidTokens": "Ongeldig: {tokens}", + "pathEditor_tooManyHops": "Maximaal 64 hopken", + "pathEditor_usePath": "Gebruik deze route.", + "pathEditor_removeHop": "Verwijder de hop", + "pathEditor_unknownHop": "Onbekend type zender", + "map_zoomIn": "Inzoomen", + "routing_lastWorked": "worked {when}", + "map_zoomOut": "Inzoomen", + "map_centerMap": "Centraal overzicht", + "chrome_bluetoothRequiresChromium": "Web Bluetooth vereist een Chromium-browser.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS-locatie bevestigd", + "pathTrace_legendInferred": "Afgeleide positie" } diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 2dcdc7d8..92fc6797 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -1326,7 +1326,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Liczba żądań", "telemetry_error": "Nie udało się pobrać danych", "telemetry_noData": "Brak dostępnych danych telemetrycznych.", @@ -2391,5 +2391,98 @@ "settings_companionDebugLogSubtitle": "Polecenia, odpowiedzi i surowe dane związane z protokołami BLE/TCP/USB", "chat_markAsUnread": "Oznacz jako nieprzeczytane", "settings_companionDebugLog": "Log debugowania (dla pomocy w rozwiązywaniu problemów)", - "repeater_chanUtil": "Wykorzystanie kanału" + "repeater_chanUtil": "Wykorzystanie kanału", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Wysłane", + "messageStatus_delivered": "Dostarczone", + "messageStatus_pending": "Wysyłanie", + "common_undo": "Wycofaj", + "messageStatus_failed": "Nie udało się wysłać", + "messageStatus_repeated": "Usłyszałem to wielokrotnie", + "contacts_moreOptions": "Więcej opcji", + "contacts_searchOpen": "Wyszukaj kontakty", + "contacts_searchClose": "Zaawansowane wyszukiwanie", + "routing_title": "Planowanie tras", + "routing_modeAuto": "Samochód", + "routing_modeFlood": "Powódź", + "routing_modeManual": "Instrukcja obsługi", + "routing_modeAutoHint": "Automatycznie wybiera najpopularniejszą ścieżkę, a w przypadku braku znanej, przechodzi do trybu \"przepływu\".", + "routing_modeFloodHint": "Transmisje za pośrednictwem każdego repeatera. Najbardziej niezawodna metoda, ale zużywa więcej czasu transmisji.", + "routing_modeManualHint": "Zawsze prowadzi dokładnie po trasie, którą określiłeś.", + "routing_currentRoute": "Obecna trasa", + "routing_directNoHops": "Bezpośrednio – bez pośrednictwa repeaterów", + "routing_noPathYet": "Na razie nie ma żadnej ścieżki. Komunikacja trwa do momentu, gdy zostanie odkryta trasa.", + "routing_floodBroadcast": "Transmisja za pośrednictwem każdego urządzenia powielającego", + "routing_editPath": "Edytuj ścieżkę", + "routing_forgetPath": "Zapomnij o ścieżce", + "routing_knownPaths": "Znane trasy", + "routing_knownPathsHint": "Wybierz ścieżkę, aby przełączyć się na nią.", + "routing_inUse": "W użyciu", + "routing_qualityStrong": "Silny pierwszy skok", + "routing_qualityGood": "Świetny początek", + "routing_qualityFair": "Świetny pierwszy krzak", + "routing_qualityWorked": "Zostało dostarczone", + "routing_qualityFlood": "Usłyszano dzięki doniesieniom", + "routing_qualityUntested": "Nieużywany", + "routing_lastWorked": "pracował {when}", + "routing_neverWorked": "nigdy nie zostało potwierdzone", + "routing_floodDelivery": "Dostawa w przypadku powodzi", + "pathEditor_title": "Stworzenie ścieżki", + "pathEditor_hopCounter": "{count} z 64 rodzajów chmielu", + "pathEditor_noHops": "Na razie nie dodano żadnych chmielu. Aby dodać je w odpowiedniej kolejności, kliknij w odpowiednie przyciski poniżej, lub zapisz przepis bez chmielu, aby wysłać go bezpośrednio.", + "pathEditor_addHops": "Dodawaj chmiel zgodnie z kolejnością.", + "pathEditor_searchRepeaters": "Funkcje powtarzania", + "pathEditor_advancedHex": "Zaawansowane: ścieżka w formacie szesnastkowym", + "pathEditor_hexLabel": "Prefiksy heksadecymalne", + "pathEditor_hexHelper": "Dwa znaki szesnastkowe na każdym kroku, oddzielone przecinkami", + "pathEditor_invalidTokens": "Nieprawidłowe: {tokens}", + "pathEditor_tooManyHops": "Maksymalnie 64 hopów", + "pathEditor_usePath": "Użyj tej ścieżki.", + "pathEditor_removeHop": "Usuń dziką psiankę", + "pathEditor_unknownHop": "Nieznany repeater", + "map_zoomIn": "Przybliż", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Przybliż z powrotem", + "map_centerMap": "Mapa centrum", + "chrome_bluetoothRequiresChromium": "Web Bluetooth wymaga przeglądarki Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS potwierdzone", + "pathTrace_legendInferred": "Wywnioskowana pozycja" } diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 9dff4417..e9c72cf4 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Número de solicitações", "telemetry_error": "Não foi possível obter os dados", "telemetry_noData": "Não estão disponíveis dados de telemetria.", @@ -2353,5 +2353,98 @@ "settings_companionDebugLogSubtitle": "Comandos, respostas e dados brutos para protocolos BLE/TCP/USB", "chat_markAsUnread": "Marcar como não lido", "chat_newMessages": "Novas mensagens", - "repeater_chanUtil": "Utilização do canal" + "repeater_chanUtil": "Utilização do canal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Desfazer", + "messageStatus_sent": "Enviado", + "messageStatus_pending": "Enviar", + "messageStatus_delivered": "Entregue", + "messageStatus_failed": "Falhou ao enviar", + "messageStatus_repeated": "Ouvi repetidamente", + "contacts_moreOptions": "Mais opções", + "contacts_searchOpen": "Pesquisar contatos", + "contacts_searchClose": "Pesquisa avançada", + "routing_title": "Rotas", + "routing_modeAuto": "Carro", + "routing_modeFlood": "Inundação", + "routing_modeManual": "Manual", + "routing_modeAutoHint": "Seleciona automaticamente o caminho mais conhecido, e, se nenhum caminho conhecido for encontrado, utiliza a estratégia de \"inundação\".", + "routing_modeFloodHint": "Transmissão através de todos os repetidores. É a opção mais confiável, mas utiliza mais tempo de transmissão.", + "routing_modeManualHint": "Sempre segue exatamente o caminho que você define.", + "routing_currentRoute": "Rota atual", + "routing_directNoHops": "Direto – sem saltos de repetidor", + "routing_noPathYet": "Ainda não há um caminho definido. A mensagem continua a ser enviada até que uma rota seja encontrada.", + "routing_floodBroadcast": "Transmissão através de todos os repetidores", + "routing_editPath": "Editar caminho", + "routing_forgetPath": "Esqueça o caminho", + "routing_knownPaths": "Rotas conhecidas", + "routing_knownPathsHint": "Toque em um caminho para alternar para ele.", + "routing_inUse": "Em uso", + "routing_qualityStrong": "Primeiro salto notável", + "routing_qualityGood": "Primeiro salto bem-sucedido", + "routing_qualityFair": "Primeira etapa bem-sucedida", + "routing_qualityWorked": "Foi entregue", + "routing_qualityFlood": "Informação obtida através de relatos generalizados.", + "routing_qualityUntested": "Não testado", + "routing_neverWorked": "nunca confirmado", + "routing_floodDelivery": "Entrega em áreas afetadas por inundações", + "pathEditor_title": "Criar Caminho", + "pathEditor_hopCounter": "{count} de 64 gramas de lúpulo", + "pathEditor_noHops": "Ainda não há lúpulos adicionados. Clique nos repetidores abaixo para adicioná-los na ordem desejada, ou salve sem adicionar lúpulos para enviar diretamente.", + "pathEditor_addHops": "Adicione os lúpulos na seguinte ordem.", + "pathEditor_searchRepeaters": "Encontrar repetidores", + "pathEditor_advancedHex": "Avançado: caminho hexadecimal bruto", + "pathEditor_hexLabel": "Prefixos hexadecimais", + "pathEditor_hexHelper": "Dois caracteres hexadecimais por salto, separados por vírgulas.", + "pathEditor_invalidTokens": "Inválido: {tokens}", + "routing_lastWorked": "worked {when}", + "pathEditor_tooManyHops": "Máximo de 64 saltos", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_usePath": "Utilize este caminho.", + "pathEditor_removeHop": "Remova o lúpulo", + "pathEditor_unknownHop": "Repetidor desconhecido", + "map_zoomIn": "Ampliar", + "map_zoomOut": "Ampliar", + "map_centerMap": "Mapa do centro", + "chrome_bluetoothRequiresChromium": "O Web Bluetooth requer um navegador Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS confirmado", + "pathTrace_legendInferred": "Posição inferida" } diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index 0ae3eda4..58ddacc8 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -722,7 +722,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Количество запросов", "telemetry_error": "Не удалось получить данные", "neighbors_receivedData": "Полученные данные о соседях", @@ -1656,5 +1656,98 @@ "repeater_cliHelpStatsCore": "(Только для серийного оборудования) Отображает основные статистические данные прошивки.", "settings_companionDebugLogSubtitle": "Команды, ответы и необработанные данные, используемые для протоколов BLE, TCP и USB.", "repeater_chanUtil": "Использование канала", - "settings_companionDebugLog": "Журнал отладки (для сопутствующего приложения)" + "settings_companionDebugLog": "Журнал отладки (для сопутствующего приложения)", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_pending": "Отправка", + "common_undo": "Отменить", + "messageStatus_delivered": "Доставлено", + "messageStatus_sent": "Отправлено", + "messageStatus_failed": "Не удалось отправить", + "messageStatus_repeated": "Услышал несколько раз", + "contacts_moreOptions": "Больше вариантов", + "contacts_searchOpen": "Найти контакты", + "contacts_searchClose": "Закрыть поиск", + "routing_title": "Маршрутизация", + "routing_modeAuto": "Авто", + "routing_modeFlood": "Наводнение", + "routing_modeManual": "Инструкция", + "routing_modeAutoHint": "Автоматически выбирает наиболее известный путь, и если такой путь неизвестен, использует алгоритм поиска пути.", + "routing_modeFloodHint": "Передача сигнала через все ретрансляторы. Самый надежный способ, но требует больше времени на передачу.", + "routing_modeManualHint": "Всегда следует точно по указанному вами маршруту.", + "routing_currentRoute": "Текущий маршрут", + "routing_directNoHops": "Прямое соединение – без использования ретрансляторов", + "routing_noPathYet": "Пока нет пути. Следующее сообщение будет отправлено до тех пор, пока не будет обнаружен маршрут.", + "routing_floodBroadcast": "Транслируется через все ретрансляторы", + "routing_editPath": "Изменить путь", + "routing_forgetPath": "Забудьте о маршруте", + "routing_knownPaths": "Известные маршруты", + "routing_knownPathsHint": "Создайте маршрут для переключения на этот пункт.", + "routing_inUse": "В эксплуатации", + "routing_qualityStrong": "Сильный первый скачок", + "routing_qualityGood": "Хорошее начало", + "routing_qualityFair": "Первый хороший урожай", + "routing_qualityWorked": "Осуществлено", + "routing_qualityFlood": "Узнал из новостей, распространяющихся в интернете.", + "routing_qualityUntested": "Непроверенный", + "routing_neverWorked": "никогда не было подтверждено", + "routing_floodDelivery": "Доставка при затоплении", + "pathEditor_title": "Создать маршрут", + "pathEditor_hopCounter": "{count} из 64 хмеля", + "pathEditor_noHops": "На данный момент хмель еще не добавлен. Чтобы добавить его, нажмите на соответствующие кнопки ниже в нужном порядке, или сохраните рецепт без хмеля, чтобы отправить его напрямую.", + "pathEditor_addHops": "Добавляйте хмель в соответствии с указанным порядком.", + "pathEditor_searchRepeaters": "Поиск повторителей", + "pathEditor_advancedHex": "Продвинутый уровень: прямой путь в шестнадцатеричном формате", + "pathEditor_hexLabel": "Префиксы шестнадцатеричной системы", + "pathEditor_hexHelper": "Два шестнадцатеричных символа на каждом шаге, разделенные запятыми.", + "pathEditor_invalidTokens": "Неверно: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Максимальное количество ингредиентов – 64", + "pathEditor_usePath": "Используйте этот путь", + "pathEditor_removeHop": "Удалить хмель", + "pathEditor_unknownHop": "Неизвестный ретранслятор", + "map_zoomIn": "Увеличить масштаб", + "map_zoomOut": "Увеличить масштаб", + "map_centerMap": "Карта центра", + "chrome_bluetoothRequiresChromium": "Для работы Web Bluetooth требуется браузер на основе Chromium.", + "channels_communityShortId": "Идентификатор: {id}...", + "pathTrace_legendGpsConfirmed": "GPS подтверждено", + "pathTrace_legendInferred": "Выведенная позиция" } diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index 3ade2e0d..2a8ac872 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Počet požiadaviek", "telemetry_error": "Nepodarilo sa získať údaje", "telemetry_noData": "Nejsú dostupné žiadne údaje z telemetrie.", @@ -2353,5 +2353,98 @@ "settings_companionDebugLogSubtitle": "Príkazy, odpovede a surové dáta pre protokoly BLE/TCP/USB", "settings_companionDebugLog": "Logovanie pre ladenie (sprievodný log)", "chat_newMessages": "Nové správy", - "repeater_chanUtil": "Využitie kanálu" + "repeater_chanUtil": "Využitie kanálu", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Odoslané", + "messageStatus_delivered": "Doručené", + "messageStatus_pending": "Odoslanie", + "common_undo": "Zrušiť", + "messageStatus_failed": "Neúspešné odeslanie", + "messageStatus_repeated": "Slyšal som to opakovane", + "contacts_moreOptions": "Ďalšie možnosti", + "contacts_searchOpen": "Vyhľadajte kontakty", + "contacts_searchClose": "Zavrieť vyhľadávanie", + "routing_title": "Navigácia", + "routing_modeAuto": "Auto", + "routing_modeFlood": "Povodňová vlna", + "routing_modeManual": "Ručná príručka", + "routing_modeAutoHint": "Automaticky vyberá najznámejší trasa, a ak žiadna nie je známa, použije náhodnú trasu.", + "routing_modeFloodHint": "Prenos prostredníctvom všetkých opakovačov. Najspoľahlivejší spôsob, ale vyžaduje viac času vysielania.", + "routing_modeManualHint": "Vždy dodáva presne podľa zadaného trasy.", + "routing_currentRoute": "Aktuálna trasa", + "routing_directNoHops": "Priamo – bez prechodných trás", + "routing_noPathYet": "Zatiaľ neexistuje žiadna cesta. Nasledujúce správy budú pokračovať, kým sa nenájde trasa.", + "routing_floodBroadcast": "Prenos prostredníctvom každého opakovača", + "routing_editPath": "Upraviť trasu", + "routing_forgetPath": "Zabudnite na trasu", + "routing_knownPaths": "Známe cesty", + "routing_knownPathsHint": "Kliknite na cestu, aby ste sa k nej presunuli.", + "routing_inUse": "V prevádzke", + "routing_qualityStrong": "Silný prvý krok", + "routing_qualityGood": "Úspešný prvý krok", + "routing_qualityFair": "Prvá, spravodlivá fáza", + "routing_qualityWorked": "Dosiahnutý úspech", + "routing_qualityFlood": "Zistil som to z informácií, ktoré som získal v dôsledku povodňovej situácie.", + "routing_qualityUntested": "Neotestované", + "routing_neverWorked": "nikedy nebolo potvrdené", + "routing_floodDelivery": "Doručenie v prípade povodní", + "pathEditor_title": "Vytvorenie cesty", + "pathEditor_hopCounter": "{count} z 64 chmelových zŕš", + "pathEditor_noHops": "Zatiaľ žiadne chmel. Kliknite na opakované, aby ste ich pridali postupne, alebo uložte bez chmelu, aby ste ho mohli poslať priamo.", + "pathEditor_addHops": "Pridávajte chmel podľa zadaného poriadku.", + "pathEditor_searchRepeaters": "Hľadať opakované", + "pathEditor_advancedHex": "Pokročilé: pôvodná hexová cesta", + "pathEditor_hexLabel": "Prefiksy pre hexadecimálne čísla", + "pathEditor_hexHelper": "Dve hexové čísla na každý krok, oddelené čiarkami", + "routing_lastWorked": "worked {when}", + "pathEditor_invalidTokens": "Neplatné: {tokens}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Maximálne 64 krokov", + "pathEditor_usePath": "Použite túto cestu", + "pathEditor_removeHop": "Odstráňte chmel", + "pathEditor_unknownHop": "Neznáme zariadenie na opakované vysielanie", + "map_zoomIn": "Zväčšiť", + "map_zoomOut": "Zmenť zamer zblízka", + "map_centerMap": "Mapa centra", + "chrome_bluetoothRequiresChromium": "Web Bluetooth vyžaduje prehliadač Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS potvrdilo", + "pathTrace_legendInferred": "Odvodená poloha" } diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index fa3e2676..0c7ce198 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Število zahtev", "telemetry_error": "Podatkov ni bilo mogoče pridobiti", "telemetry_noData": "Niso na voljo podatki o telemetriji.", @@ -2353,5 +2353,98 @@ "chat_markAsUnread": "Označiti kot neneobdelano", "chat_newMessages": "Nove novice", "settings_companionDebugLogSubtitle": "Navodila, odgovori in surova podatka za BLE/TCP/USB.", - "repeater_chanUtil": "Uporaba kanala" + "repeater_chanUtil": "Uporaba kanala", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "common_undo": "Preobrn", + "messageStatus_delivered": "Dostavljeno", + "messageStatus_sent": "Pošljeno", + "messageStatus_pending": "Pošiljanje", + "messageStatus_failed": "Uspešno ni bilo mogo, da se sporočilo pošlje", + "messageStatus_repeated": "Slišal sem večkrat", + "contacts_moreOptions": "Več možnosti", + "contacts_searchOpen": "Iskanje kontaktov", + "contacts_searchClose": "Izklopi iskanje", + "routing_title": "Navigacija", + "routing_modeAuto": "Avto", + "routing_modeFlood": "Poplavo", + "routing_modeManual": "Navodilo", + "routing_modeAutoHint": "Samodejno izbere najbolj poznano pot, in sicer, ko ni na voljo nobena.", + "routing_modeFloodHint": "Prenosi preko vseh repetitorjev. Najzanesljivejši način, vendar zahteva več časa.", + "routing_modeManualHint": "Vedno sledi natančni poti, ki jo ste določili.", + "routing_currentRoute": "Trenutna pot", + "routing_directNoHops": "Neposredno – brez prehodov", + "routing_noPathYet": "Žep trenutno ni mogoče najti. Naslednje sporočilo bo posredovano, dokler ne bo ugotovljeno, kje je pot.", + "routing_floodBroadcast": "Prenos preko vseh repetitiv", + "routing_editPath": "Uredi pot", + "routing_forgetPath": "Pozabi na pot", + "routing_knownPaths": "Poznati poti", + "routing_knownPathsHint": "Kliknite na pot, da jo izberete.", + "routing_inUse": "V uporabi", + "routing_qualityStrong": "Močan prvi korak", + "routing_qualityGood": "Prva uspešna faza", + "routing_qualityFair": "Prva, uspešna faza", + "routing_qualityWorked": "Izpolnil", + "routing_qualityFlood": "Slišano preko poplave", + "routing_qualityUntested": "Ne preizkušen", + "routing_lastWorked": "delal/a {when}", + "routing_neverWorked": "nikoli ni bilo potrjeno", + "routing_floodDelivery": "Dostava zaradi poplave", + "pathEditor_title": "Izgradnja poti", + "pathEditor_hopCounter": "{count} od 64 različnih sort hropa", + "pathEditor_noHops": "Še niso dodani hmelji. Za dodajanje hmelja v vrstnem redu kliknite na povezavo spodaj, ali pa shranite brez dodanega hmelja, da ga lahko posredujete neposredno.", + "pathEditor_addHops": "Dodajte suho travo v skladu s postopkom.", + "pathEditor_searchRepeaters": "Iskanje ponovitev", + "pathEditor_advancedHex": "Napredno: surovi šestnajstni pot", + "pathEditor_hexLabel": "Predfiks za heksadecimalno šifro", + "pathEditor_hexHelper": "Dva šestbitna znaka na vsak skok, ločena z vejico", + "pathEditor_invalidTokens": "Neveljaven: {tokens}", + "pathEditor_tooManyHops": "Največ 64 hopov", + "pathEditor_usePath": "Uporabite to poto", + "pathEditor_removeHop": "Odstranite hmelj", + "pathEditor_unknownHop": "Neznani ponovitelj", + "map_zoomIn": "Povečaj", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Povečajte pogled", + "map_centerMap": "Krajšarska karta", + "chrome_bluetoothRequiresChromium": "Web Bluetooth zahteva brskalnik Chromium.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS potrdilo", + "pathTrace_legendInferred": "Izpeljana lokacija" } diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 1658f186..e5ae55d8 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -1316,7 +1316,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Antal förfrågningar", "telemetry_error": "Det gick inte att hämta data", "telemetry_noData": "Inga telemetridata tillgängliga.", @@ -2353,5 +2353,98 @@ "settings_companionDebugLog": "Följande felsökningslogg", "chat_newMessages": "Nya meddelanden", "settings_companionDebugLogSubtitle": "BLE/TCP/USB-kommandon, svar och rådata", - "repeater_chanUtil": "Användning av kanal" + "repeater_chanUtil": "Användning av kanal", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "Sen", + "messageStatus_delivered": "Levererad", + "common_undo": "Ångra", + "messageStatus_pending": "Skicka", + "messageStatus_failed": "Misslyckades med att skicka", + "messageStatus_repeated": "Hördes upprepade gånger", + "contacts_moreOptions": "Fler alternativ", + "contacts_searchOpen": "Sök efter kontakter", + "contacts_searchClose": "Avancerad sökning", + "routing_title": "Ruttplanering", + "routing_modeAuto": "Bil", + "routing_modeFlood": "Översvämning", + "routing_modeManual": "Instruktioner", + "routing_modeAutoHint": "Väljer automatiskt den bästa kända vägen, och använder en \"flooding\"-strategi om ingen väg är känd.", + "routing_modeFloodHint": "Sändningar via alla repetrar. Det mest pålitliga alternativet, men kräver mer sändtid.", + "routing_modeManualHint": "Skickar alltid den exakta väg du har angivit.", + "routing_currentRoute": "Nuvarande rutt", + "routing_directNoHops": "Direkt – utan mellanliggande routrar", + "routing_noPathYet": "Ingen väg hittad ännu. Nästa meddelande skickas tills en rutt har upptäckts.", + "routing_floodBroadcast": "Sändas via alla repetrar", + "routing_editPath": "Redigera sökväg", + "routing_forgetPath": "Glöm vägen", + "routing_knownPaths": "Kända vägar", + "routing_knownPathsHint": "Välj en väg för att byta till den.", + "routing_inUse": "I användning", + "routing_qualityStrong": "En stark start", + "routing_qualityGood": "Bra första steg", + "routing_qualityFair": "Bra första hopp", + "routing_qualityWorked": "Har levererat", + "routing_qualityFlood": "Fått information via nyhetsflöde", + "routing_qualityUntested": "Ej testat", + "routing_lastWorked": "arbetade {when}", + "routing_neverWorked": "aldrig bekräftat", + "routing_floodDelivery": "Leverans vid översvämningsområde", + "pathEditor_title": "Skapa väg", + "pathEditor_hopCounter": "{count} av 64 humlor", + "pathEditor_noHops": "Inga humle än. Använd knapparna nedan för att lägga till dem i rätt ordning, eller spara utan humle för att skicka direkt.", + "pathEditor_addHops": "Tillsätt humlen i rätt ordning.", + "pathEditor_searchRepeaters": "Sök efter återupptagna samtal", + "pathEditor_advancedHex": "Avancerat: rå hex-sökväg", + "pathEditor_hexLabel": "Hex-prefikser", + "pathEditor_hexHelper": "Två hex-tecken per steg, separerade med kommatecken.", + "pathEditor_invalidTokens": "Ogiltigt: {tokens}", + "pathEditor_tooManyHops": "Maximalt 64 humlörter", + "pathEditor_usePath": "Använd denna väg", + "pathEditor_removeHop": "Ta bort humlen", + "pathEditor_unknownHop": "Okänd förstärkare", + "map_zoomIn": "Zooma in", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "map_zoomOut": "Zooma ut", + "map_centerMap": "Kartöversikt", + "chrome_bluetoothRequiresChromium": "Web Bluetooth kräver en Chromium-baserad webbläsare.", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS-verifierat", + "pathTrace_legendInferred": "Antagen position" } diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index 990ecb90..4ceecbb2 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -1327,7 +1327,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "Кількість запитів", "telemetry_error": "Не вдалося отримати дані", "telemetry_noData": "Дані телеметрії недоступні.", @@ -2333,5 +2333,98 @@ "settings_companionDebugLogSubtitle": "Команди, відповіді та необроблена інформація для протоколів BLE/TCP/USB", "chat_newMessages": "Нові повідомлення", "chat_markAsUnread": "Позначити як непрочитане", - "repeater_chanUtil": "Використання каналу" + "repeater_chanUtil": "Використання каналу", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_delivered": "Доставлено", + "messageStatus_sent": "Надіслано", + "common_undo": "Скасувати", + "messageStatus_pending": "Надсилання", + "messageStatus_failed": "Не вдалося надіслати", + "messageStatus_repeated": "Почув неодноразово", + "contacts_moreOptions": "Більше можливостей", + "contacts_searchOpen": "Пошук контактів", + "contacts_searchClose": "Закрити пошук", + "routing_title": "Маршрутизація", + "routing_modeAuto": "Автомобіль", + "routing_modeFlood": "Повені", + "routing_modeManual": "Інструкція", + "routing_modeAutoHint": "Автоматично обирає найкращий відомий шлях, та у разі відсутності відомого шляху, використовує алгоритм \"занурення\".", + "routing_modeFloodHint": "Передавання через усі ретранслятори. Найбільш надійний спосіб, але потребує більше часу.", + "routing_modeManualHint": "Завжди доставляє точно за вказаним вами маршрутом.", + "routing_currentRoute": "Поточний маршрут", + "routing_directNoHops": "Пряме з'єднання – без проміжних ретрансляторів", + "routing_noPathYet": "Поки що немає жодного шляху. Повідомлення продовжуються надходити, поки не буде знайдено маршрут.", + "routing_floodBroadcast": "Поширення через усі ретранслятори", + "routing_editPath": "Редагувати шлях", + "routing_forgetPath": "Забудь про шлях", + "routing_knownPaths": "Відомі маршрути", + "routing_knownPathsHint": "Виберіть опцію, щоб переключитися на неї.", + "routing_inUse": "У робочому стані", + "routing_qualityStrong": "Сильний перший стрибок", + "routing_qualityGood": "Чудова перша спроба", + "routing_qualityFair": "Перший, але вдалий, крок", + "routing_qualityWorked": "Доставлено", + "routing_qualityFlood": "Дізнався через новини", + "routing_qualityUntested": "Не протестовано", + "routing_neverWorked": "ніколи не підтверджено", + "routing_floodDelivery": "Доставка під час повені", + "pathEditor_title": "Створити маршрут", + "pathEditor_hopCounter": "{count} з 64 штук хмелю", + "pathEditor_noHops": "Ще не додано хміль. Натисніть на відповідні кнопки, щоб додати його в потрібному порядку, або збережіть рецепт без хмілю, щоб відправити його безпосередньо.", + "pathEditor_addHops": "Додавайте хміль у наступній послідовності.", + "pathEditor_searchRepeaters": "Пошук повторювачів", + "pathEditor_advancedHex": "Просунутий рівень: пряма шлях у форматі шестнадцяткової системи.", + "pathEditor_hexLabel": "Префікси для шестнадцяткової системи числення", + "pathEditor_hexHelper": "Два шестизначні символи на кожний крок, розділені комами", + "pathEditor_invalidTokens": "Неправильно: {tokens}", + "routing_lastWorked": "worked {when}", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_tooManyHops": "Максимум 64 хмелеві колоди", + "pathEditor_usePath": "Використовуйте цей шлях", + "pathEditor_removeHop": "Видалити хміль", + "pathEditor_unknownHop": "Невідомий ретранслятор", + "map_zoomIn": "Увійти в режим збільшення", + "map_zoomOut": "Видалити зум", + "map_centerMap": "Карта центру", + "chrome_bluetoothRequiresChromium": "Web Bluetooth вимагає браузера на основі Chromium", + "channels_communityShortId": "ID: {id}...", + "pathTrace_legendGpsConfirmed": "GPS підтверджено", + "pathTrace_legendInferred": "Висновок щодо положення" } diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 170e7212..d1ee964c 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -1346,7 +1346,7 @@ "telemetry_directionValue": "{degrees}°", "telemetry_concentrationValue": "{ppm} ppm", "telemetry_percentageValue": "{percent}%", - "telemetry_analogValue": "{value}", + "telemetry_analogValue": "{value}", "telemetry_autoFetchQuantity": "请求次数", "telemetry_error": "无法获取数据", "telemetry_noData": "暂无遥测数据", @@ -2358,5 +2358,98 @@ "settings_companionDebugLog": "调试日志", "chat_newMessages": "新的消息", "settings_companionDebugLogSubtitle": "BLE/TCP/USB 协议、响应和原始数据", - "repeater_chanUtil": "频道利用率" + "repeater_chanUtil": "频道利用率", + "@routing_lastWorked": { + "placeholders": { + "when": { + "type": "String" + } + } + }, + "@routing_deliveryCounts": { + "placeholders": { + "successes": { + "type": "int" + }, + "failures": { + "type": "int" + } + } + }, + "@pathEditor_hopCounter": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "@pathEditor_invalidTokens": { + "placeholders": { + "tokens": { + "type": "String" + } + } + }, + "@channels_communityShortId": { + "placeholders": { + "id": { + "type": "String" + } + } + }, + "messageStatus_sent": "发送", + "common_undo": "撤销", + "messageStatus_delivered": "已送达", + "messageStatus_pending": "发送", + "messageStatus_failed": "发送失败", + "messageStatus_repeated": "多次听到", + "contacts_moreOptions": "更多选择", + "contacts_searchOpen": "搜索联系人", + "contacts_searchClose": "高级搜索", + "routing_title": "路由", + "routing_modeAuto": "汽车", + "routing_modeFlood": "洪水", + "routing_modeManual": "手册", + "routing_modeAutoHint": "自动选择已知最佳路径,当没有已知路径时,则进行“洪水”搜索。", + "routing_modeFloodHint": "通过所有中继站进行广播。 这种方式最可靠,但占用更多的时间。", + "routing_modeManualHint": "总是按照您设置的路径进行导航。", + "routing_currentRoute": "当前路线", + "routing_directNoHops": "直接连接— 无中继跳", + "routing_noPathYet": "目前还没有找到路径。直到找到路径,才会收到后续消息。", + "routing_floodBroadcast": "通过所有中继器进行广播", + "routing_editPath": "编辑路径", + "routing_forgetPath": "忘记原路", + "routing_knownPaths": "已知的路径", + "routing_knownPathsHint": "点击该路径以切换到它。", + "routing_inUse": "使用中", + "routing_qualityStrong": "强劲的初始阶段", + "routing_qualityGood": "不错的开端", + "routing_qualityFair": "第一次尝试,结果良好", + "routing_qualityWorked": "已完成", + "routing_qualityFlood": "通过新闻报道", + "routing_qualityUntested": "未经测试", + "routing_lastWorked": "工作于 {when}", + "routing_neverWorked": "从未得到证实", + "routing_floodDelivery": "洪水配送", + "pathEditor_title": "构建路径", + "pathEditor_noHops": "目前还没有添加任何啤酒花。点击下面的“添加”按钮,按顺序添加,或者直接保存,不添加任何啤酒花。", + "pathEditor_addHops": "按照顺序添加啤酒花", + "pathEditor_searchRepeaters": "重复搜索", + "pathEditor_advancedHex": "高级:原始十六进制路径", + "pathEditor_hexLabel": "十六进制前缀", + "pathEditor_hexHelper": "每次跳跃,使用两个十六进制字符,用逗号分隔。", + "pathEditor_invalidTokens": "无效:{tokens}", + "pathEditor_tooManyHops": "最多 64 个跳跃", + "pathEditor_usePath": "请使用此路径", + "pathEditor_removeHop": "去除啤酒花", + "routing_deliveryCounts": "{successes} delivered, {failures} failed", + "pathEditor_hopCounter": "{count} of 64 hops", + "pathEditor_unknownHop": "未知的重复器", + "map_zoomIn": "放大", + "map_zoomOut": "放大", + "map_centerMap": "中心地图", + "chrome_bluetoothRequiresChromium": "Web Bluetooth 需要 Chromium 浏览器", + "channels_communityShortId": "ID:{id}...", + "pathTrace_legendGpsConfirmed": "通过GPS确认", + "pathTrace_legendInferred": "推测的位置" } diff --git a/lib/screens/app_debug_log_screen.dart b/lib/screens/app_debug_log_screen.dart index 719e5735..522a2c5c 100644 --- a/lib/screens/app_debug_log_screen.dart +++ b/lib/screens/app_debug_log_screen.dart @@ -75,7 +75,9 @@ class AppDebugLogScreen extends StatelessWidget { entry.formattedTime, style: TextStyle( fontSize: 10, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), ); @@ -95,7 +97,9 @@ class AppDebugLogScreen extends StatelessWidget { context.l10n.debugLog_noEntries, style: TextStyle( fontSize: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), const SizedBox(height: 8), @@ -103,7 +107,9 @@ class AppDebugLogScreen extends StatelessWidget { context.l10n.debugLog_enableInSettings, style: TextStyle( fontSize: 12, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), ], diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 76ce1f07..d1ccfd09 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -359,113 +359,129 @@ class AppSettingsScreen extends StatelessWidget { const Divider(height: 1), ListTile( title: Text(context.l10n.appSettings_maxRouteWeight), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_maxRouteWeightSubtitle), - Slider( - value: settingsService.settings.maxRouteWeight, - min: 1, - max: 10, - divisions: 9, - label: settingsService.settings.maxRouteWeight - .round() - .toString(), - onChanged: (value) => - settingsService.setMaxRouteWeight(value), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(context.l10n.appSettings_maxRouteWeightSubtitle), + Slider( + value: settingsService.settings.maxRouteWeight, + min: 1, + max: 10, + divisions: 9, + label: settingsService.settings.maxRouteWeight + .round() + .toString(), + onChanged: (value) => + settingsService.setMaxRouteWeight(value), + ), + ], + ), ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_initialRouteWeight), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_initialRouteWeightSubtitle), - Slider( - value: settingsService.settings.initialRouteWeight, - min: 0.5, - max: 5.0, - divisions: 9, - label: settingsService.settings.initialRouteWeight - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setInitialRouteWeight(value), + const Divider(height: 1), + ListTile( + title: Text(context.l10n.appSettings_initialRouteWeight), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_initialRouteWeightSubtitle, + ), + Slider( + value: settingsService.settings.initialRouteWeight, + min: 0.5, + max: 5.0, + divisions: 9, + label: settingsService.settings.initialRouteWeight + .toStringAsFixed(1), + onChanged: (value) => + settingsService.setInitialRouteWeight(value), + ), + ], + ), ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_routeWeightSuccessIncrement), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context - .l10n - .appSettings_routeWeightSuccessIncrementSubtitle, + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_routeWeightSuccessIncrement, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_routeWeightSuccessIncrementSubtitle, + ), + Slider( + value: settingsService + .settings + .routeWeightSuccessIncrement, + min: 0.1, + max: 2.0, + divisions: 19, + label: settingsService + .settings + .routeWeightSuccessIncrement + .toStringAsFixed(1), + onChanged: (value) => settingsService + .setRouteWeightSuccessIncrement(value), + ), + ], + ), ), - Slider( - value: settingsService.settings.routeWeightSuccessIncrement, - min: 0.1, - max: 2.0, - divisions: 19, - label: settingsService.settings.routeWeightSuccessIncrement - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setRouteWeightSuccessIncrement(value), + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_routeWeightFailureDecrement, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_routeWeightFailureDecrementSubtitle, + ), + Slider( + value: settingsService + .settings + .routeWeightFailureDecrement, + min: 0.1, + max: 2.0, + divisions: 19, + label: settingsService + .settings + .routeWeightFailureDecrement + .toStringAsFixed(1), + onChanged: (value) => settingsService + .setRouteWeightFailureDecrement(value), + ), + ], + ), ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_routeWeightFailureDecrement), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context - .l10n - .appSettings_routeWeightFailureDecrementSubtitle, + const Divider(height: 1), + ListTile( + title: Text(context.l10n.appSettings_maxMessageRetries), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_maxMessageRetriesSubtitle, + ), + Slider( + value: settingsService.settings.maxMessageRetries + .toDouble(), + min: 2, + max: 10, + divisions: 8, + label: settingsService.settings.maxMessageRetries + .toString(), + onChanged: (value) => settingsService + .setMaxMessageRetries(value.toInt()), + ), + ], + ), ), - Slider( - value: settingsService.settings.routeWeightFailureDecrement, - min: 0.1, - max: 2.0, - divisions: 19, - label: settingsService.settings.routeWeightFailureDecrement - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setRouteWeightFailureDecrement(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_maxMessageRetries), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_maxMessageRetriesSubtitle), - Slider( - value: settingsService.settings.maxMessageRetries - .toDouble(), - min: 2, - max: 10, - divisions: 8, - label: settingsService.settings.maxMessageRetries - .toString(), - onChanged: (value) => - settingsService.setMaxMessageRetries(value.toInt()), - ), - ], - ), - ), ], ), ), @@ -610,15 +626,25 @@ class AppSettingsScreen extends StatelessWidget { SwitchListTile( secondary: Icon( Icons.auto_awesome_outlined, - color: translationEnabled ? null : Theme.of(context).disabledColor, + color: translationEnabled + ? null + : Theme.of(context).disabledColor, ), title: Text( context.l10n.translation_autoIncomingTitle, - style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), + style: TextStyle( + color: translationEnabled + ? null + : Theme.of(context).disabledColor, + ), ), subtitle: Text( context.l10n.translation_autoIncomingSubtitle, - style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), + style: TextStyle( + color: translationEnabled + ? null + : Theme.of(context).disabledColor, + ), ), value: settings.autoTranslateIncomingMessages, onChanged: translationEnabled @@ -629,15 +655,25 @@ class AppSettingsScreen extends StatelessWidget { SwitchListTile( secondary: Icon( Icons.outgoing_mail, - color: translationEnabled ? null : Theme.of(context).disabledColor, + color: translationEnabled + ? null + : Theme.of(context).disabledColor, ), title: Text( context.l10n.translation_composerTitle, - style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), + style: TextStyle( + color: translationEnabled + ? null + : Theme.of(context).disabledColor, + ), ), subtitle: Text( context.l10n.translation_composerSubtitle, - style: TextStyle(color: translationEnabled ? null : Theme.of(context).disabledColor), + style: TextStyle( + color: translationEnabled + ? null + : Theme.of(context).disabledColor, + ), ), value: settings.composerTranslationEnabled, onChanged: translationEnabled diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index c43c6c67..e2c63c35 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -512,149 +512,133 @@ class _ChannelChatScreenState extends State { const bodyFontSize = 14.0; final messageBody = LayoutBuilder( builder: (context, constraints) => Column( - crossAxisAlignment: isOutgoing - ? CrossAxisAlignment.end - : CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: isOutgoing - ? MainAxisAlignment.end - : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - _buildAvatar(message.senderName), - const SizedBox(width: 8), - ], - Flexible( - child: GestureDetector( - onLongPress: () => _showMessageActions(message), - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => _showMessageActions(message) - : null, - child: Container( - padding: gifId != null - ? const EdgeInsets.all(4) - : const EdgeInsets.symmetric(horizontal: 12, vertical: 8), - constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.65, - ), - decoration: BoxDecoration( - color: isOutgoing - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.surfaceContainerHighest, - borderRadius: BorderRadius.circular(12), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - top: 4, - bottom: 4, - ) - : EdgeInsets.zero, - child: Text( + crossAxisAlignment: isOutgoing + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: isOutgoing + ? MainAxisAlignment.end + : MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!isOutgoing) ...[ + _buildAvatar(message.senderName), + const SizedBox(width: 8), + ], + Flexible( + child: GestureDetector( + onLongPress: () => _showMessageActions(message), + onSecondaryTapUp: PlatformInfo.isDesktop + ? (_) => _showMessageActions(message) + : null, + child: Container( + padding: gifId != null + ? const EdgeInsets.all(4) + : const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: BoxConstraints( + maxWidth: constraints.maxWidth * 0.65, + ), + decoration: BoxDecoration( + color: isOutgoing + ? Theme.of(context).colorScheme.primaryContainer + : Theme.of( + context, + ).colorScheme.surfaceContainerHighest, + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!isOutgoing) ...[ + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + top: 4, + bottom: 4, + ) + : EdgeInsets.zero, + child: Text( + message.senderName, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.primary, + ), + ), + ), + if (gifId == null) const SizedBox(height: 4), + ], + if (message.replyToMessageId != null) ...[ + _buildReplyPreview(message, textScale), + const SizedBox(height: 8), + ], + if (poi != null) + _buildPoiMessage( + context, + poi, + isOutgoing, + textScale, message.senderName, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.primary, - ), - ), - ), - if (gifId == null) const SizedBox(height: 4), - ], - if (message.replyToMessageId != null) ...[ - _buildReplyPreview(message, textScale), - const SizedBox(height: 8), - ], - if (poi != null) - _buildPoiMessage( - context, - poi, - isOutgoing, - textScale, - message.senderName, - ) - else if (gifId != null) - Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(8), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: Colors.transparent, - fallbackTextColor: isOutgoing - ? Theme.of(context) - .colorScheme - .onPrimaryContainer - .withValues(alpha: 0.7) - : Theme.of(context).colorScheme.onSurface - .withValues(alpha: 0.6), - ), - ), - ], - ) - else - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: TranslatedMessageContent( - displayText: translatedDisplayText, - originalText: originalDisplayText, - style: TextStyle( - fontSize: bodyFontSize * textScale, - ), - originalStyle: TextStyle( - fontSize: bodyFontSize * textScale, - fontStyle: FontStyle.italic, - color: Theme.of(context).colorScheme.onSurface - .withValues(alpha: 0.72), + ) + else if (gifId != null) + Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: Colors.transparent, + fallbackTextColor: isOutgoing + ? Theme.of(context) + .colorScheme + .onPrimaryContainer + .withValues(alpha: 0.7) + : Theme.of(context).colorScheme.onSurface + .withValues(alpha: 0.6), ), ), - ), - ], - ), - if (enableTracing && displayPath.isNotEmpty) ...[ - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.symmetric(horizontal: 8) - : EdgeInsets.zero, - child: Text( - context.l10n.channels_via( - _formatPathPrefixes(displayPath), - ), - style: TextStyle( - fontSize: 11 * textScale, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), + ], + ) + else + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: TranslatedMessageContent( + displayText: translatedDisplayText, + originalText: originalDisplayText, + style: TextStyle( + fontSize: bodyFontSize * textScale, + ), + originalStyle: TextStyle( + fontSize: bodyFontSize * textScale, + fontStyle: FontStyle.italic, + color: Theme.of(context) + .colorScheme + .onSurface + .withValues(alpha: 0.72), + ), + ), + ), + ], ), - ), - ], - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - right: 8, - bottom: 4, - ) - : EdgeInsets.zero, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - _formatTime(context, message.timestamp), + if (enableTracing && displayPath.isNotEmpty) ...[ + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.symmetric(horizontal: 8) + : EdgeInsets.zero, + child: Text( + context.l10n.channels_via( + _formatPathPrefixes(displayPath), + ), style: TextStyle( fontSize: 11 * textScale, color: Theme.of( @@ -662,18 +646,22 @@ class _ChannelChatScreenState extends State { ).colorScheme.onSurfaceVariant, ), ), - if (enableTracing && message.repeatCount > 0) ...[ - const SizedBox(width: 6), - Icon( - Icons.repeat, - size: 12 * textScale, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - const SizedBox(width: 2), + ), + ], + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + right: 8, + bottom: 4, + ) + : EdgeInsets.zero, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ Text( - '${message.repeatCount}', + _formatTime(context, message.timestamp), style: TextStyle( fontSize: 11 * textScale, color: Theme.of( @@ -681,43 +669,62 @@ class _ChannelChatScreenState extends State { ).colorScheme.onSurfaceVariant, ), ), + if (enableTracing && message.repeatCount > 0) ...[ + const SizedBox(width: 6), + Icon( + Icons.repeat, + size: 12 * textScale, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), + const SizedBox(width: 2), + Text( + '${message.repeatCount}', + style: TextStyle( + fontSize: 11 * textScale, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, + ), + ), + ], + if (isOutgoing) ...[ + const SizedBox(width: 4), + MessageStatusIcon( + isAcked: + message.status == + ChannelMessageStatus.sent, + isRepeated: + message.status == + ChannelMessageStatus.sent && + displayPath.isNotEmpty, + isPending: + message.status == + ChannelMessageStatus.pending, + isFailed: + message.status == + ChannelMessageStatus.failed, + ), + ], ], - if (isOutgoing) ...[ - const SizedBox(width: 4), - MessageStatusIcon( - isAcked: - message.status == - ChannelMessageStatus.sent, - isRepeated: - message.status == - ChannelMessageStatus.sent && - displayPath.isNotEmpty, - isPending: - message.status == - ChannelMessageStatus.pending, - isFailed: - message.status == - ChannelMessageStatus.failed, - ), - ], - ], + ), ), - ), - ], + ], + ), ), ), ), + ], + ), + if (message.reactions.isNotEmpty) ...[ + const SizedBox(height: 4), + Padding( + padding: EdgeInsets.only(left: isOutgoing ? 0 : 48), + child: _buildReactionsDisplay(message), ), ], - ), - if (message.reactions.isNotEmpty) ...[ - const SizedBox(height: 4), - Padding( - padding: EdgeInsets.only(left: isOutgoing ? 0 : 48), - child: _buildReactionsDisplay(message), - ), ], - ], ), ); @@ -922,7 +929,9 @@ class _ChannelChatScreenState extends State { padding: EdgeInsets.zero, constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () { - final selfName = context.read().selfName ?? context.l10n.chat_me; + final selfName = + context.read().selfName ?? + context.l10n.chat_me; final fromName = isOutgoing ? selfName : senderName; final key = buildSharedMarkerKey( sourceId: 'channel:${widget.channel.index}', diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index 6e9f3882..e7f21459 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -106,7 +106,9 @@ class ChannelMessagePathScreen extends StatelessWidget { if (!hasHopDetails) Text( l10n.channelPath_noHopDetails, - style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ) else ..._buildHopTiles(context, hops), @@ -131,7 +133,11 @@ class ChannelMessagePathScreen extends StatelessWidget { style: Theme.of(context).textTheme.titleSmall, ), const SizedBox(height: 8), - _buildDetailRow(context, l10n.channelPath_senderLabel, message.senderName), + _buildDetailRow( + context, + l10n.channelPath_senderLabel, + message.senderName, + ), _buildDetailRow( context, l10n.channelPath_timeLabel, @@ -149,7 +155,11 @@ class ChannelMessagePathScreen extends StatelessWidget { _formatPathLabel(message.pathLength, l10n), ), if (observedLabel != null) - _buildDetailRow(context, l10n.channelPath_observedLabel, observedLabel), + _buildDetailRow( + context, + l10n.channelPath_observedLabel, + observedLabel, + ), ], ), ), @@ -261,7 +271,12 @@ class ChannelMessagePathScreen extends StatelessWidget { children: [ SizedBox( width: 70, - child: Text(label, style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant)), + child: Text( + label, + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), ), Expanded(child: Text(value)), ], @@ -596,7 +611,9 @@ class _ChannelMessagePathMapScreenState if (points.isEmpty) Center( child: Card( - color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.9), + color: Theme.of( + context, + ).colorScheme.surface.withValues(alpha: 0.9), child: Padding( padding: EdgeInsets.all(12), child: Text( @@ -667,7 +684,10 @@ class _ChannelMessagePathMapScreenState label, _formatPathPrefixes(selectedPath.pathBytes), ), - style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant, fontSize: 12), + style: TextStyle( + color: Theme.of(context).colorScheme.onSurfaceVariant, + fontSize: 12, + ), ), ], ), @@ -816,10 +836,10 @@ class _ChannelMessagePathMapScreenState } Widget _colorDot(Color color) => Container( - width: 10, - height: 10, - decoration: BoxDecoration(color: color, shape: BoxShape.circle), - ); + width: 10, + height: 10, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), + ); Widget _buildLegendCard( BuildContext context, @@ -855,7 +875,10 @@ class _ChannelMessagePathMapScreenState children: [ _colorDot(Colors.green), const SizedBox(width: 4), - Text(l10n.pathTrace_legendGpsConfirmed, style: const TextStyle(fontSize: 11)), + Text( + l10n.pathTrace_legendGpsConfirmed, + style: const TextStyle(fontSize: 11), + ), ], ), ], diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index b725cc61..36e82049 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -253,8 +253,7 @@ class _ChannelsScreenState extends State ), child: EmptyState( icon: Icons.search_off, - title: - context.l10n.channels_noChannelsFound, + title: context.l10n.channels_noChannelsFound, ), ), ], @@ -953,7 +952,11 @@ class _ChannelsScreenState extends State Channel.publicChannelPsk, ); Navigator.pop(dialogContext); - connector.setChannel(nextIndex, context.l10n.channels_public, psk); + connector.setChannel( + nextIndex, + context.l10n.channels_public, + psk, + ); if (context.mounted) { showDismissibleSnackBar( context, @@ -1240,7 +1243,8 @@ class _ChannelsScreenState extends State child: FilledButton( onPressed: () async { final name = nameController.text.trim(); - final publicLabel = context.l10n.channels_public; + final publicLabel = + context.l10n.channels_public; if (name.isEmpty) { showDismissibleSnackBar( context, @@ -1727,7 +1731,9 @@ class _ChannelsScreenState extends State ), title: Text(community.name), subtitle: Text( - context.l10n.channels_communityShortId(community.shortCommunityId), + context.l10n.channels_communityShortId( + community.shortCommunityId, + ), style: TextStyle( fontSize: 12, color: Theme.of( diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index b96095bf..89310bbd 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -187,7 +187,11 @@ class _ChatScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), + Text( + contact.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => @@ -1251,202 +1255,202 @@ class _MessageBubble extends StatelessWidget { children: [ LayoutBuilder( builder: (context, constraints) => GestureDetector( - onLongPress: onLongPress, - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => onLongPress?.call() - : null, - child: Row( - mainAxisAlignment: isOutgoing - ? MainAxisAlignment.end - : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ - _buildAvatar(senderName, colorScheme), - const SizedBox(width: 8), - ], - Flexible( - child: Container( - padding: gifId != null - ? const EdgeInsets.all(4) - : const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.65, - ), - decoration: BoxDecoration( - color: bubbleColor, - borderRadius: BorderRadius.circular(16), - border: isFailed - ? Border.all(color: colorScheme.error) - : null, - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (!isOutgoing) ...[ + onLongPress: onLongPress, + onSecondaryTapUp: PlatformInfo.isDesktop + ? (_) => onLongPress?.call() + : null, + child: Row( + mainAxisAlignment: isOutgoing + ? MainAxisAlignment.end + : MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!isOutgoing) ...[ + _buildAvatar(senderName, colorScheme), + const SizedBox(width: 8), + ], + Flexible( + child: Container( + padding: gifId != null + ? const EdgeInsets.all(4) + : const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + constraints: BoxConstraints( + maxWidth: constraints.maxWidth * 0.65, + ), + decoration: BoxDecoration( + color: bubbleColor, + borderRadius: BorderRadius.circular(16), + border: isFailed + ? Border.all(color: colorScheme.error) + : null, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (!isOutgoing) ...[ + Padding( + padding: gifId != null + ? const EdgeInsets.only( + left: 8, + top: 4, + bottom: 4, + ) + : EdgeInsets.zero, + child: Text( + senderName, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: colorScheme.primary, + ), + ), + ), + if (gifId == null) const SizedBox(height: 4), + ], + if (poi != null) + _buildPoiMessage( + context, + poi, + textColor, + metaColor, + textScale, + senderName, + ) + else if (gifId != null) + Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(12), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: Colors.transparent, + fallbackTextColor: textColor.withValues( + alpha: 0.7, + ), + ), + ), + ], + ) + else + Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Flexible( + child: TranslatedMessageContent( + displayText: translatedDisplayText, + originalText: originalDisplayText, + style: TextStyle( + color: textColor, + fontSize: bodyFontSize * textScale, + ), + originalStyle: TextStyle( + color: textColor.withValues(alpha: 0.78), + fontSize: bodyFontSize * textScale, + ), + ), + ), + ], + ), + if (enableTracing && + isOutgoing && + message.retryCount > 0) ...[ + const SizedBox(height: 4), + Padding( + padding: gifId != null + ? const EdgeInsets.symmetric(horizontal: 8) + : EdgeInsets.zero, + child: Text( + context.l10n.chat_retryCount( + message.retryCount, + context + .read() + .settings + .maxMessageRetries, + ), + style: TextStyle( + fontSize: 10 * textScale, + color: metaColor, + fontWeight: FontWeight.w500, + ), + ), + ), + ], + const SizedBox(height: 4), Padding( padding: gifId != null ? const EdgeInsets.only( left: 8, - top: 4, + right: 8, bottom: 4, ) : EdgeInsets.zero, - child: Text( - senderName, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: colorScheme.primary, - ), - ), - ), - if (gifId == null) const SizedBox(height: 4), - ], - if (poi != null) - _buildPoiMessage( - context, - poi, - textColor, - metaColor, - textScale, - senderName, - ) - else if (gifId != null) - Stack( - children: [ - ClipRRect( - borderRadius: BorderRadius.circular(12), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: Colors.transparent, - fallbackTextColor: textColor.withValues( - alpha: 0.7, - ), - ), - ), - ], - ) - else - Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Flexible( - child: TranslatedMessageContent( - displayText: translatedDisplayText, - originalText: originalDisplayText, - style: TextStyle( - color: textColor, - fontSize: bodyFontSize * textScale, - ), - originalStyle: TextStyle( - color: textColor.withValues(alpha: 0.78), - fontSize: bodyFontSize * textScale, - ), - ), - ), - ], - ), - if (enableTracing && - isOutgoing && - message.retryCount > 0) ...[ - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.symmetric(horizontal: 8) - : EdgeInsets.zero, - child: Text( - context.l10n.chat_retryCount( - message.retryCount, - context - .read() - .settings - .maxMessageRetries, - ), - style: TextStyle( - fontSize: 10 * textScale, - color: metaColor, - fontWeight: FontWeight.w500, - ), - ), - ), - ], - const SizedBox(height: 4), - Padding( - padding: gifId != null - ? const EdgeInsets.only( - left: 8, - right: 8, - bottom: 4, - ) - : EdgeInsets.zero, - child: Wrap( - spacing: 4, - crossAxisAlignment: WrapCrossAlignment.center, - children: [ - Text( - _formatTime(message.timestamp), - style: TextStyle( - fontSize: 10 * textScale, - color: metaColor, - ), - ), - if (isOutgoing) ...[ - const SizedBox(width: 4), - MessageStatusIcon( - size: 12 * textScale, - onColor: metaColor, - isAcked: - message.status == - MessageStatus.delivered, - isPending: - message.status == MessageStatus.pending, - isFailed: - message.status == MessageStatus.failed, - ), - ], - if (enableTracing && - message.tripTimeMs != null && - message.status == - MessageStatus.delivered) ...[ - const SizedBox(width: 4), - Icon( - Icons.speed, - size: 10 * textScale, - color: isOutgoing - ? metaColor - : Theme.of( - context, - ).colorScheme.tertiary, - ), + child: Wrap( + spacing: 4, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ Text( - '${(message.tripTimeMs! / 1000).toStringAsFixed(1)}s', + _formatTime(message.timestamp), style: TextStyle( - fontSize: 9 * textScale, + fontSize: 10 * textScale, + color: metaColor, + ), + ), + if (isOutgoing) ...[ + const SizedBox(width: 4), + MessageStatusIcon( + size: 12 * textScale, + onColor: metaColor, + isAcked: + message.status == + MessageStatus.delivered, + isPending: + message.status == MessageStatus.pending, + isFailed: + message.status == MessageStatus.failed, + ), + ], + if (enableTracing && + message.tripTimeMs != null && + message.status == + MessageStatus.delivered) ...[ + const SizedBox(width: 4), + Icon( + Icons.speed, + size: 10 * textScale, color: isOutgoing ? metaColor : Theme.of( context, ).colorScheme.tertiary, ), - ), + Text( + '${(message.tripTimeMs! / 1000).toStringAsFixed(1)}s', + style: TextStyle( + fontSize: 9 * textScale, + color: isOutgoing + ? metaColor + : Theme.of( + context, + ).colorScheme.tertiary, + ), + ), + ], ], - ], + ), ), - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), ), - ), if (message.reactions.isNotEmpty) ...[ const SizedBox(height: 4), Padding( @@ -1476,7 +1480,9 @@ class _MessageBubble extends StatelessWidget { padding: EdgeInsets.zero, constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () async { - final selfName = context.read().selfName ?? context.l10n.chat_me; + final selfName = + context.read().selfName ?? + context.l10n.chat_me; final fromName = message.isOutgoing ? selfName : senderName; final key = buildSharedMarkerKey( sourceId: sourceId, diff --git a/lib/screens/chrome_required_screen.dart b/lib/screens/chrome_required_screen.dart index 53271d8f..cdf3c938 100644 --- a/lib/screens/chrome_required_screen.dart +++ b/lib/screens/chrome_required_screen.dart @@ -55,12 +55,18 @@ class ChromeRequiredScreen extends StatelessWidget { decoration: BoxDecoration( color: colorScheme.secondaryContainer.withValues(alpha: 0.4), borderRadius: BorderRadius.circular(30), - border: Border.all(color: colorScheme.outline.withValues(alpha: 0.4)), + border: Border.all( + color: colorScheme.outline.withValues(alpha: 0.4), + ), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(Icons.info_outline, size: 20, color: colorScheme.secondary), + Icon( + Icons.info_outline, + size: 20, + color: colorScheme.secondary, + ), const SizedBox(width: 12), Text( l10n.chrome_bluetoothRequiresChromium, diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index d64b8dd1..95cbb55d 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -705,9 +705,7 @@ class _ContactsScreenState extends State action: FilledButton.icon( onPressed: () => Navigator.push( context, - MaterialPageRoute( - builder: (context) => const DiscoveryScreen(), - ), + MaterialPageRoute(builder: (context) => const DiscoveryScreen()), ), icon: const Icon(Icons.person_add_rounded), label: Text(context.l10n.discoveredContacts_Title), @@ -1496,9 +1494,7 @@ class _ContactsScreenState extends State ), title: Text( context.l10n.contacts_deleteContact, - style: TextStyle( - color: Theme.of(context).colorScheme.error, - ), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), onTap: () { Navigator.pop(sheetContext); diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index 736e8f36..1bc392bf 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -189,8 +189,7 @@ class _DiscoveryScreenState extends State { ), action: SnackBarAction( label: context.l10n.common_undo, - onPressed: () => - connector.removeContact(contact), + onPressed: () => connector.removeContact(contact), ), ); }, @@ -444,7 +443,6 @@ class _DiscoveryScreenState extends State { } } - String _formatLastSeen(BuildContext context, DateTime lastSeen) { final now = DateTime.now(); final diff = now.difference(lastSeen); diff --git a/lib/screens/line_of_sight_map_screen.dart b/lib/screens/line_of_sight_map_screen.dart index 1d63b910..af80ca22 100644 --- a/lib/screens/line_of_sight_map_screen.dart +++ b/lib/screens/line_of_sight_map_screen.dart @@ -507,7 +507,9 @@ class _LineOfSightMapScreenState extends State { bottom: 12, child: DecoratedBox( decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surfaceContainerHighest.withValues(alpha: 0.85), + color: Theme.of( + context, + ).colorScheme.surfaceContainerHighest.withValues(alpha: 0.85), borderRadius: BorderRadius.circular(8), ), child: Padding( @@ -517,7 +519,10 @@ class _LineOfSightMapScreenState extends State { ), child: Text( context.l10n.losElevationAttribution, - style: TextStyle(fontSize: 10, color: Theme.of(context).colorScheme.onSurface), + style: TextStyle( + fontSize: 10, + color: Theme.of(context).colorScheme.onSurface, + ), ), ), ), @@ -631,7 +636,10 @@ class _LineOfSightMapScreenState extends State { const SizedBox(height: 4), Text( context.l10n.losBlockedSpotsHint, - style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 6), Wrap( @@ -700,7 +708,9 @@ class _LineOfSightMapScreenState extends State { '${_selectedObstruction!.point.longitude.toStringAsFixed(5)}', style: TextStyle( fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), ], @@ -726,7 +736,10 @@ class _LineOfSightMapScreenState extends State { const SizedBox(width: 8), Text( '${displayFrequencyMHz.toStringAsFixed(3)} MHz', - style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), if (kFactorUsed != null) ...[ const SizedBox(width: 8), @@ -734,7 +747,9 @@ class _LineOfSightMapScreenState extends State { 'k=${kFactorUsed.toStringAsFixed(3)}', style: TextStyle( fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), const SizedBox(width: 4), @@ -758,7 +773,10 @@ class _LineOfSightMapScreenState extends State { ), Text( context.l10n.losElevationAttribution, - style: TextStyle(fontSize: 10, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 10, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 6), ExpansionTile( diff --git a/lib/screens/map_cache_screen.dart b/lib/screens/map_cache_screen.dart index 6bc62018..e627bd58 100644 --- a/lib/screens/map_cache_screen.dart +++ b/lib/screens/map_cache_screen.dart @@ -458,7 +458,9 @@ class _MapCacheScreenState extends State { padding: const EdgeInsets.only(top: 8), child: Text( l10n.mapCache_failedDownloads(_failedTiles), - style: TextStyle(color: Theme.of(context).colorScheme.error), + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), ), ), ], diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index dd6462b7..3e4193c0 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -486,7 +486,10 @@ class _MapScreenState extends State { PopupMenuItem( child: Row( children: [ - Icon(Icons.logout, color: Theme.of(context).colorScheme.error), + Icon( + Icons.logout, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Text(context.l10n.common_disconnect), ], @@ -1223,7 +1226,9 @@ class _MapScreenState extends State { Icon( Icons.location_on, size: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), Text( ": $nodeCount", @@ -1239,7 +1244,9 @@ class _MapScreenState extends State { Icon( Icons.wrong_location, size: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), Text( ": ${nodeCountAll - nodeCount}", @@ -1255,7 +1262,9 @@ class _MapScreenState extends State { Icon( Icons.add_outlined, size: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), Text( ": $nodeCountAll", @@ -1612,51 +1621,56 @@ class _MapScreenState extends State { return SafeArea( child: Padding( padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - _getNodeIcon(contact.type), - color: _getNodeColor(contact.type), - ), - const SizedBox(width: 8), - Expanded(child: SelectableText(contact.name)), - ], - ), - const SizedBox(height: 8), - _buildInfoRow( - context.l10n.map_type, - contact.typeLabel(context.l10n), - ), - _buildInfoRow( - context.l10n.map_path, - contact.pathLabel(context.l10n), - ), - if (contact.hasLocation) - _buildInfoRow( - context.l10n.map_location, - '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', - ) - else if (guessedPosition != null) - _buildInfoRow( - context.l10n.map_estLocation, - '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + _getNodeIcon(contact.type), + color: _getNodeColor(contact.type), + ), + const SizedBox(width: 8), + Expanded(child: SelectableText(contact.name)), + ], ), - _buildInfoRow( - context.l10n.map_lastSeen, - _formatLastSeen(contact.lastSeen), - ), - _buildInfoRow(context.l10n.map_publicKey, contact.publicKeyHex), - const SizedBox(height: 16), - ...actions, - TextButton( - onPressed: () => Navigator.pop(sheetContext), - child: Text(context.l10n.common_close), - ), - ], + const SizedBox(height: 8), + _buildInfoRow( + context.l10n.map_type, + contact.typeLabel(context.l10n), + ), + _buildInfoRow( + context.l10n.map_path, + contact.pathLabel(context.l10n), + ), + if (contact.hasLocation) + _buildInfoRow( + context.l10n.map_location, + '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', + ) + else if (guessedPosition != null) + _buildInfoRow( + context.l10n.map_estLocation, + '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', + ), + _buildInfoRow( + context.l10n.map_lastSeen, + _formatLastSeen(contact.lastSeen), + ), + _buildInfoRow( + context.l10n.map_publicKey, + contact.publicKeyHex, + ), + const SizedBox(height: 16), + ...actions, + TextButton( + onPressed: () => Navigator.pop(sheetContext), + child: Text(context.l10n.common_close), + ), + ], + ), ), ), ); @@ -1844,9 +1858,7 @@ class _MapScreenState extends State { ); await connector.refreshDeviceInfo(); if (!mounted) return; - messenger.showSnackBar( - SnackBar(content: Text(successMsg)), - ); + messenger.showSnackBar(SnackBar(content: Text(successMsg))); }, ), ListTile( @@ -2235,7 +2247,10 @@ class _MapScreenState extends State { const SizedBox(height: 8), Text( _getTimeFilterLabel(settings.mapTimeFilterHours), - style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), Slider( value: _hoursToSliderValue(settings.mapTimeFilterHours), @@ -2387,7 +2402,10 @@ class _MapScreenState extends State { if (_pathTrace.isNotEmpty) Text( "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", - style: TextStyle(fontSize: 12, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), SelectableText( _pathTrace diff --git a/lib/screens/neighbors_screen.dart b/lib/screens/neighbors_screen.dart index e92a5cc0..c34af7f1 100644 --- a/lib/screens/neighbors_screen.dart +++ b/lib/screens/neighbors_screen.dart @@ -326,10 +326,7 @@ class _NeighborsScreenState extends State { if (!_isLoaded && !_hasData && (_parsedNeighbors == null || _parsedNeighbors!.isEmpty)) - EmptyState( - icon: Icons.wifi_find, - title: l10n.neighbors_noData, - ), + EmptyState(icon: Icons.wifi_find, title: l10n.neighbors_noData), if (_isLoaded || _hasData && !(_parsedNeighbors == null || _parsedNeighbors!.isEmpty)) diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index 81082b9e..99bc4deb 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -274,8 +274,8 @@ class _PathTraceMapScreenState extends State { final frame = buildTraceReq( DateTime.now().millisecondsSinceEpoch ~/ 1000, - 0, //flags 0, //auth + 0, //flag payload: path, ); connector.sendFrame(frame); @@ -350,11 +350,16 @@ class _PathTraceMapScreenState extends State { try { buffer.skipBytes(2); // Skip push code and reserved byte int pathLength = buffer.readUInt8(); - buffer.skipBytes(5); // Skip Flag byte and tag data + final int flags = buffer + .readUInt8(); // path_sz = flags & 0x03 (path-hash mode, fw v1.11+) + buffer.skipBytes(4); // Skip tag data buffer.skipBytes(4); // Skip auth code + final int pathSz = flags & 0x03; Uint8List pathData = buffer.readBytes(pathLength); + // Firmware emits (path_len >> path_sz) hop SNRs plus 1 final SNR (to this node). + final int snrCount = (pathLength >> pathSz) + 1; List snrData = buffer - .readRemainingBytes() + .readBytes(snrCount) .map((snr) => snr.toSigned(8).toDouble() / 4) .toList(); @@ -616,7 +621,9 @@ class _PathTraceMapScreenState extends State { !_failed2Loaded) Center( child: Card( - color: Theme.of(context).colorScheme.surface.withValues(alpha: 0.9), + color: Theme.of( + context, + ).colorScheme.surface.withValues(alpha: 0.9), child: Padding( padding: EdgeInsets.all(12), child: Text( @@ -963,10 +970,10 @@ class _PathTraceMapScreenState extends State { } Widget _colorDot(Color color) => Container( - width: 10, - height: 10, - decoration: BoxDecoration(color: color, shape: BoxShape.circle), - ); + width: 10, + height: 10, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), + ); Widget _buildLegendCard( BuildContext context, @@ -1002,11 +1009,17 @@ class _PathTraceMapScreenState extends State { children: [ _colorDot(Colors.green), const SizedBox(width: 4), - Text(l10n.pathTrace_legendGpsConfirmed, style: const TextStyle(fontSize: 11)), + Text( + l10n.pathTrace_legendGpsConfirmed, + style: const TextStyle(fontSize: 11), + ), const SizedBox(width: 12), _colorDot(Colors.orange), const SizedBox(width: 4), - Text(l10n.pathTrace_legendInferred, style: const TextStyle(fontSize: 11)), + Text( + l10n.pathTrace_legendInferred, + style: const TextStyle(fontSize: 11), + ), ], ), ], diff --git a/lib/screens/repeater_cli_screen.dart b/lib/screens/repeater_cli_screen.dart index 93720f28..80269061 100644 --- a/lib/screens/repeater_cli_screen.dart +++ b/lib/screens/repeater_cli_screen.dart @@ -385,16 +385,26 @@ class _RepeaterCliScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.terminal, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), + Icon( + Icons.terminal, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( l10n.repeater_noCommandsSent, - style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 8), Text( l10n.repeater_typeCommandOrUseQuick, - style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index 337d148c..2aebcf03 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -72,11 +72,15 @@ class RepeaterHubScreen extends StatelessWidget { children: [ CircleAvatar( radius: 40, - backgroundColor: Theme.of(context).colorScheme.tertiaryContainer, + backgroundColor: Theme.of( + context, + ).colorScheme.tertiaryContainer, child: Icon( Icons.cell_tower, size: 40, - color: Theme.of(context).colorScheme.onTertiaryContainer, + color: Theme.of( + context, + ).colorScheme.onTertiaryContainer, ), ), const SizedBox(height: 16), @@ -90,12 +94,18 @@ class RepeaterHubScreen extends StatelessWidget { const SizedBox(height: 8), Text( repeater.shortPubKeyHex, - style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 8), Text( repeater.pathLabel(context.l10n), - style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), if (repeater.hasLocation) ...[ const SizedBox(height: 4), @@ -105,14 +115,18 @@ class RepeaterHubScreen extends StatelessWidget { Icon( Icons.location_on, size: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), const SizedBox(width: 4), Text( '${repeater.latitude?.toStringAsFixed(4)}, ${repeater.longitude?.toStringAsFixed(4)}', style: TextStyle( fontSize: 12, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of( + context, + ).colorScheme.onSurfaceVariant, ), ), ], @@ -329,12 +343,18 @@ class RepeaterHubScreen extends StatelessWidget { const SizedBox(height: 4), Text( subtitle, - style: TextStyle(fontSize: 14, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 14, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), ), - Icon(Icons.chevron_right, color: Theme.of(context).colorScheme.onSurfaceVariant), + Icon( + Icons.chevron_right, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ], ), ), diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index 1d8ae3bc..e04cfb70 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -459,7 +459,9 @@ class _RepeaterSettingsScreenState extends State { ? l10n.repeater_refreshed(label) : l10n.repeater_errorRefreshing(label), ), - backgroundColor: successCount > 0 ? null : Theme.of(context).colorScheme.error, + backgroundColor: successCount > 0 + ? null + : Theme.of(context).colorScheme.error, ); setState(() => setRefreshing(false)); } @@ -2229,7 +2231,9 @@ class _RepeaterSettingsScreenState extends State { onConfirm(); }, style: isDestructive - ? FilledButton.styleFrom(backgroundColor: Theme.of(context).colorScheme.error) + ? FilledButton.styleFrom( + backgroundColor: Theme.of(context).colorScheme.error, + ) : null, child: Text(l10n.repeater_confirm), ), diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index e665cbc7..1fd2c53c 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -113,9 +113,9 @@ class _ScannerScreenState extends State { 'USB selected, opening UsbScreen', tag: 'ScannerScreen', ); - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const UsbScreen()), - ); + Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => const UsbScreen())); }, ), if (!PlatformInfo.isWeb) @@ -123,9 +123,9 @@ class _ScannerScreenState extends State { icon: const Icon(Icons.lan), tooltip: context.l10n.connectionChoiceTcpLabel, onPressed: () { - Navigator.of(context).push( - MaterialPageRoute(builder: (_) => const TcpScreen()), - ); + Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => const TcpScreen())); }, ), ], @@ -167,7 +167,9 @@ class _ScannerScreenState extends State { ) : const Icon(Icons.bluetooth_searching), label: Text( - isScanning ? context.l10n.scanner_stop : context.l10n.scanner_scan, + isScanning + ? context.l10n.scanner_stop + : context.l10n.scanner_scan, ), ); }, @@ -256,8 +258,7 @@ class _ScannerScreenState extends State { ); } - final isConnecting = - connector.state == MeshCoreConnectionState.connecting; + final isConnecting = connector.state == MeshCoreConnectionState.connecting; return ListView.separated( padding: const EdgeInsets.all(8), itemCount: connector.scanResults.length, diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 0fe077cb..b6eefb05 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -343,7 +343,10 @@ class _SettingsScreenState extends State { ), ), ListTile( - leading: Icon(Icons.delete_outline, color: Theme.of(context).colorScheme.error), + leading: Icon( + Icons.delete_outline, + color: Theme.of(context).colorScheme.error, + ), title: Text(l10n.settings_deleteAllPaths), subtitle: Text( l10n.settings_deleteAllPathsSubtitle, @@ -367,7 +370,10 @@ class _SettingsScreenState extends State { ), const Divider(height: 1), ListTile( - leading: Icon(Icons.restart_alt, color: Theme.of(context).colorScheme.tertiary), + leading: Icon( + Icons.restart_alt, + color: Theme.of(context).colorScheme.tertiary, + ), title: Text(l10n.settings_rebootDevice), subtitle: Text(l10n.settings_rebootDeviceSubtitle), onTap: () => _confirmReboot(context, connector), diff --git a/lib/screens/tcp_screen.dart b/lib/screens/tcp_screen.dart index 755a4298..517b39a6 100644 --- a/lib/screens/tcp_screen.dart +++ b/lib/screens/tcp_screen.dart @@ -224,10 +224,7 @@ class _TcpScreenState extends State { statusText, maxLines: 1, overflow: TextOverflow.ellipsis, - style: TextStyle( - color: statusColor, - fontWeight: FontWeight.w500, - ), + style: TextStyle(color: statusColor, fontWeight: FontWeight.w500), ), ), ], diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index 6634a6af..4559adac 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -385,7 +385,10 @@ class _TelemetryScreenState extends State { Center( child: Text( l10n.telemetry_noData, - style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ), if ((_isLoaded || _hasData) && diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index 331de5e3..ec551c6f 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -203,10 +203,7 @@ class _UsbScreenState extends State { statusText, maxLines: 1, overflow: TextOverflow.ellipsis, - style: TextStyle( - color: statusColor, - fontWeight: FontWeight.w500, - ), + style: TextStyle(color: statusColor, fontWeight: FontWeight.w500), ), ), ], @@ -222,11 +219,18 @@ class _UsbScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.usb, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), + Icon( + Icons.usb, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( l10n.usbStatus_searching, - style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), @@ -238,12 +242,19 @@ class _UsbScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.usb, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), + Icon( + Icons.usb, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( l10n.usbScreenEmptyState, textAlign: TextAlign.center, - style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index d8e70ce3..36027917 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -304,7 +304,8 @@ class NotificationService { try { await _notifications.show( - id: channelIndex?.hashCode ?? + id: + channelIndex?.hashCode ?? DateTime.now().millisecondsSinceEpoch & 0x7FFFFFFF, title: channelName, body: body, diff --git a/lib/widgets/gif_picker.dart b/lib/widgets/gif_picker.dart index df27ec68..90b6261b 100644 --- a/lib/widgets/gif_picker.dart +++ b/lib/widgets/gif_picker.dart @@ -180,7 +180,10 @@ class _GifPickerState extends State { const SizedBox(height: 8), Text( context.l10n.gifPicker_poweredBy, - style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), @@ -197,11 +200,18 @@ class _GifPickerState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.error_outline, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), + Icon( + Icons.error_outline, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( _error!, - style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 16), ElevatedButton.icon( @@ -219,11 +229,18 @@ class _GifPickerState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.search_off, size: 64, color: Theme.of(context).colorScheme.onSurfaceVariant), + Icon( + Icons.search_off, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), const SizedBox(height: 16), Text( context.l10n.gifPicker_noGifsFound, - style: TextStyle(fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 16, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), ], ), diff --git a/lib/widgets/path_editor_sheet.dart b/lib/widgets/path_editor_sheet.dart index 66c1fa4b..ee6ba006 100644 --- a/lib/widgets/path_editor_sheet.dart +++ b/lib/widgets/path_editor_sheet.dart @@ -119,7 +119,9 @@ class _PathEditorSheetState extends State { _hexError = null; _hops ..clear() - ..addAll(tokens.map((t) => _Hop(_nextHopId++, int.parse(t, radix: 16)))); + ..addAll( + tokens.map((t) => _Hop(_nextHopId++, int.parse(t, radix: 16))), + ); }); } @@ -287,10 +289,7 @@ class _PathEditorSheetState extends State { ), const Divider(), const SizedBox(height: 8), - Text( - l10n.pathEditor_addHops, - style: theme.textTheme.titleSmall, - ), + Text(l10n.pathEditor_addHops, style: theme.textTheme.titleSmall), const SizedBox(height: 8), TextField( onChanged: (value) => setState(() => _search = value), diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 9ba8efd9..5b45037d 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -466,7 +466,10 @@ class _RepeaterLoginDialogState extends State { const SizedBox(height: 4), Text( repeater.pathLabel(context.l10n), - style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 8), Align( diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index 8a737130..a6475cfb 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -395,7 +395,10 @@ class _RoomLoginDialogState extends State { const SizedBox(height: 4), Text( repeater.pathLabel(context.l10n), - style: TextStyle(fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant), + style: TextStyle( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), ), const SizedBox(height: 8), Align( diff --git a/lib/widgets/routing_sheet.dart b/lib/widgets/routing_sheet.dart index ddb0bb04..71fe2a4d 100644 --- a/lib/widgets/routing_sheet.dart +++ b/lib/widgets/routing_sheet.dart @@ -150,10 +150,7 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { ); } - Future _forgetPath( - MeshCoreConnector connector, - Contact contact, - ) async { + Future _forgetPath(MeshCoreConnector connector, Contact contact) async { await connector.clearContactPath(contact); if (!mounted) return; setState(() => _syncStatus = context.l10n.chat_pathCleared); @@ -235,7 +232,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { case _RoutingMode.auto: if (contact.pathLength < 0) return l10n.routing_noPathYet; if (contact.pathLength == 0) return l10n.routing_directNoHops; - if (contact.path.isEmpty) return l10n.chat_hopsCount(contact.pathLength); + if (contact.path.isEmpty) + return l10n.chat_hopsCount(contact.pathLength); return PathHelper.resolvePathNames(contact.path, connector.allContacts); } } @@ -325,7 +323,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { int failureCount, int lastTripTimeMs, DateTime? lastUsed, - })? floodStats, + })? + floodStats, ) { final l10n = context.l10n; final theme = Theme.of(context); @@ -347,7 +346,10 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { color: scheme.primary, ), const SizedBox(width: 8), - Text(l10n.routing_currentRoute, style: theme.textTheme.titleSmall), + Text( + l10n.routing_currentRoute, + style: theme.textTheme.titleSmall, + ), ], ), const SizedBox(height: 8), @@ -418,7 +420,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { int failureCount, int lastTripTimeMs, DateTime? lastUsed, - }) stats, + }) + stats, ) { final l10n = context.l10n; final parts = [ @@ -441,7 +444,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { int failureCount, int lastTripTimeMs, DateTime? lastUsed, - }) stats, + }) + stats, ) { final l10n = context.l10n; final scheme = Theme.of(context).colorScheme; @@ -487,7 +491,10 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { final scheme = theme.colorScheme; final (Color bg, Color fg) = switch (quality) { - _PathQuality.strong => (scheme.primaryContainer, scheme.onPrimaryContainer), + _PathQuality.strong => ( + scheme.primaryContainer, + scheme.onPrimaryContainer, + ), _PathQuality.good => ( scheme.secondaryContainer, scheme.onSecondaryContainer, @@ -504,7 +511,8 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { }; final hasBytes = record.pathBytes.isNotEmpty; - final inUse = hasBytes && + final inUse = + hasBytes && ((mode == _RoutingMode.manual && listEquals(record.pathBytes, contact.pathOverrideBytes)) || (mode == _RoutingMode.auto && @@ -596,19 +604,24 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { final rankedRepeaters = List.of(connector.directRepeaters) ..sort((a, b) => b.ranking.compareTo(a.ranking)); - final entries = pathService - .getRecentPaths(contact.publicKeyHex) - .map((r) => (quality: _qualityOf(r, rankedRepeaters), record: r)) - .toList() - ..sort((a, b) { - final byQuality = a.quality.index.compareTo(b.quality.index); - if (byQuality != 0) return byQuality; - final aTime = - a.record.timestamp ?? DateTime.fromMillisecondsSinceEpoch(0); - final bTime = - b.record.timestamp ?? DateTime.fromMillisecondsSinceEpoch(0); - return bTime.compareTo(aTime); - }); + final entries = + pathService + .getRecentPaths(contact.publicKeyHex) + .map( + (r) => (quality: _qualityOf(r, rankedRepeaters), record: r), + ) + .toList() + ..sort((a, b) { + final byQuality = a.quality.index.compareTo(b.quality.index); + if (byQuality != 0) return byQuality; + final aTime = + a.record.timestamp ?? + DateTime.fromMillisecondsSinceEpoch(0); + final bTime = + b.record.timestamp ?? + DateTime.fromMillisecondsSinceEpoch(0); + return bTime.compareTo(aTime); + }); return ListView( controller: widget.scrollController, diff --git a/test/screens/usb_flow_test.dart b/test/screens/usb_flow_test.dart index ecd33ee9..4c6b8bd2 100644 --- a/test/screens/usb_flow_test.dart +++ b/test/screens/usb_flow_test.dart @@ -160,15 +160,9 @@ void main() { final context = tester.element(find.byType(ScannerScreen)); final l10n = AppLocalizations.of(context); if (PlatformInfo.supportsUsbSerial) { - expect( - find.byTooltip(l10n.connectionChoiceUsbLabel), - findsOneWidget, - ); + expect(find.byTooltip(l10n.connectionChoiceUsbLabel), findsOneWidget); } else { - expect( - find.byTooltip(l10n.connectionChoiceUsbLabel), - findsNothing, - ); + expect(find.byTooltip(l10n.connectionChoiceUsbLabel), findsNothing); } // ScannerScreen.dispose() schedules disconnect work that debounces notify. diff --git a/untranslated.json b/untranslated.json index c3a9394b..9e26dfee 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1,987 +1 @@ -{ - "bg": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "de": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "es": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "fr": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "hu": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "it": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "ja": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "ko": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "nl": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "pl": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "pt": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "ru": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "sk": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "sl": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "sv": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "uk": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ], - - "zh": [ - "common_undo", - "messageStatus_sent", - "messageStatus_delivered", - "messageStatus_pending", - "messageStatus_failed", - "messageStatus_repeated", - "contacts_moreOptions", - "contacts_searchOpen", - "contacts_searchClose", - "routing_title", - "routing_modeAuto", - "routing_modeFlood", - "routing_modeManual", - "routing_modeAutoHint", - "routing_modeFloodHint", - "routing_modeManualHint", - "routing_currentRoute", - "routing_directNoHops", - "routing_noPathYet", - "routing_floodBroadcast", - "routing_editPath", - "routing_forgetPath", - "routing_knownPaths", - "routing_knownPathsHint", - "routing_inUse", - "routing_qualityStrong", - "routing_qualityGood", - "routing_qualityFair", - "routing_qualityWorked", - "routing_qualityFlood", - "routing_qualityUntested", - "routing_lastWorked", - "routing_neverWorked", - "routing_deliveryCounts", - "routing_floodDelivery", - "pathEditor_title", - "pathEditor_hopCounter", - "pathEditor_noHops", - "pathEditor_addHops", - "pathEditor_searchRepeaters", - "pathEditor_advancedHex", - "pathEditor_hexLabel", - "pathEditor_hexHelper", - "pathEditor_invalidTokens", - "pathEditor_tooManyHops", - "pathEditor_usePath", - "pathEditor_removeHop", - "pathEditor_unknownHop", - "map_zoomIn", - "map_zoomOut", - "map_centerMap", - "chrome_bluetoothRequiresChromium", - "channels_communityShortId", - "pathTrace_legendGpsConfirmed", - "pathTrace_legendInferred" - ] -} +{} \ No newline at end of file From 6a31d304d398a724079687133df4cb2a80c393a7 Mon Sep 17 00:00:00 2001 From: Zach Date: Thu, 11 Jun 2026 10:08:31 -0700 Subject: [PATCH 31/36] feat: update license type to nonprofit and add jni to plugin lists; bump dependencies for flutter_local_notifications, package_info_plus, share_plus, flutter_blue_plus_platform_interface, and llamadart --- lib/connector/meshcore_connector.dart | 6 +-- lib/widgets/routing_sheet.dart | 3 +- linux/flutter/generated_plugins.cmake | 1 + macos/Podfile.lock | 52 ------------------- macos/Runner.xcodeproj/project.pbxproj | 22 ++++++++ .../xcshareddata/xcschemes/Runner.xcscheme | 18 +++++++ pubspec.yaml | 10 ++-- windows/flutter/generated_plugins.cmake | 1 + 8 files changed, 52 insertions(+), 61 deletions(-) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index c9f11dd8..579d8257 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -1883,7 +1883,7 @@ class MeshCoreConnector extends ChangeNotifier { .connect( timeout: connectTimeout, mtu: null, - license: License.free, + license: License.nonprofit, ) .timeout( connectTimeout + const Duration(seconds: 2), @@ -1979,7 +1979,7 @@ class MeshCoreConnector extends ChangeNotifier { return device.connect( timeout: connectTimeout, mtu: null, - license: License.free, + license: License.nonprofit, ); } @@ -2088,7 +2088,7 @@ class MeshCoreConnector extends ChangeNotifier { await device.connect( timeout: const Duration(seconds: 15), mtu: null, - license: License.free, + license: License.nonprofit, ); services = await device.discoverServices(); } else { diff --git a/lib/widgets/routing_sheet.dart b/lib/widgets/routing_sheet.dart index 71fe2a4d..4c1a26f6 100644 --- a/lib/widgets/routing_sheet.dart +++ b/lib/widgets/routing_sheet.dart @@ -232,8 +232,9 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { case _RoutingMode.auto: if (contact.pathLength < 0) return l10n.routing_noPathYet; if (contact.pathLength == 0) return l10n.routing_directNoHops; - if (contact.path.isEmpty) + if (contact.path.isEmpty) { return l10n.chat_hopsCount(contact.pathLength); + } return PathHelper.resolvePathNames(contact.path, connector.allContacts); } } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 379e36fa..93e46829 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST flserial + jni ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 481f1bcc..0f1561a5 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -1,73 +1,21 @@ PODS: - flserial (0.0.1): - FlutterMacOS - - flutter_blue_plus_darwin (0.0.2): - - Flutter - - FlutterMacOS - - flutter_local_notifications (0.0.1): - - FlutterMacOS - FlutterMacOS (1.0.0) - - mobile_scanner (7.0.0): - - Flutter - - FlutterMacOS - - package_info_plus (0.0.1): - - FlutterMacOS - - share_plus (0.0.1): - - FlutterMacOS - - shared_preferences_foundation (0.0.1): - - Flutter - - FlutterMacOS - - sqflite_darwin (0.0.4): - - Flutter - - FlutterMacOS - - url_launcher_macos (0.0.1): - - FlutterMacOS DEPENDENCIES: - flserial (from `Flutter/ephemeral/.symlinks/plugins/flserial/macos`) - - flutter_blue_plus_darwin (from `Flutter/ephemeral/.symlinks/plugins/flutter_blue_plus_darwin/darwin`) - - flutter_local_notifications (from `Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - - mobile_scanner (from `Flutter/ephemeral/.symlinks/plugins/mobile_scanner/darwin`) - - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) - - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) - - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`) - - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) EXTERNAL SOURCES: flserial: :path: Flutter/ephemeral/.symlinks/plugins/flserial/macos - flutter_blue_plus_darwin: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_blue_plus_darwin/darwin - flutter_local_notifications: - :path: Flutter/ephemeral/.symlinks/plugins/flutter_local_notifications/macos FlutterMacOS: :path: Flutter/ephemeral - mobile_scanner: - :path: Flutter/ephemeral/.symlinks/plugins/mobile_scanner/darwin - package_info_plus: - :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos - share_plus: - :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos - shared_preferences_foundation: - :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin - sqflite_darwin: - :path: Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin - url_launcher_macos: - :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: flserial: 3c161e076dfc73458ec5803e7a9a9d2bb85fadf6 - flutter_blue_plus_darwin: 20a08bfeaa0f7804d524858d3d8744bcc1b6dbc3 - flutter_local_notifications: 4bf37a31afde695b56091b4ae3e4d9c7a7e6cda0 FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1 - mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93 - package_info_plus: f0052d280d17aa382b932f399edf32507174e870 - share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc - shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb - sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 - url_launcher_macos: f87a979182d112f911de6820aefddaf56ee9fbfd PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index defe6932..10f8906b 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 99C5B380294D2DE19A818101 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B665683D805EE21638F484F2 /* Pods_RunnerTests.framework */; }; D7DDCBD47F2955423D77927D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0F985DDB6BE5BEB6B545DE9A /* Pods_Runner.framework */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -88,6 +89,7 @@ BEFF4DDC60AFB628205F8E82 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; D99E941424F19B7B9AA1B968 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; EA5A89F8C49904B995EFAA24 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -103,6 +105,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, D7DDCBD47F2955423D77927D /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -164,6 +167,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */ = { isa = PBXGroup; children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, @@ -231,6 +235,9 @@ productType = "com.apple.product-type.bundle.unit-test"; }; 33CC10EC2044A3C60003C045 /* Runner */ = { + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( @@ -256,6 +263,9 @@ /* Begin PBXProject section */ 33CC10E52044A3C60003C045 /* Project object */ = { + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; @@ -796,6 +806,18 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 33CC10E52044A3C60003C045 /* Project object */; } diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fd43b250..e082e324 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + =0.6.8 <0.7.0' + llamadart: ^0.8.0 flutter_langdetect: ^0.0.1 hooks: diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index f02857f4..533a1712 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST flserial flutter_local_notifications_windows + jni ) set(PLUGIN_BUNDLED_LIBRARIES) From 51d62109201b88f557eb600f86097c9c9850fedf Mon Sep 17 00:00:00 2001 From: zjs81 Date: Fri, 12 Jun 2026 21:04:02 -0700 Subject: [PATCH 32/36] Add shared UI components for mesh application - Introduced `mesh_ui.dart` with reusable widgets including SectionHeader, MeshCard, StatusChip, StatTile, AvatarCircle, SignalBars, RouteChip, PulseDot, BottomSheetHeader, ErrorRetryCard, and ListEntrance. - Implemented `path_map_ui.dart` for path map screens, featuring path distance calculations, playback controls, and a summary list of observed paths. - Created `themed_map_tile_layer.dart` for shared cached map tiles with automatic dark-mode treatment. --- lib/helpers/snack_bar_builder.dart | 14 +- lib/l10n/app_en.arb | 95 +- lib/l10n/app_localizations.dart | 228 ++ lib/l10n/app_localizations_bg.dart | 140 + lib/l10n/app_localizations_de.dart | 140 + lib/l10n/app_localizations_en.dart | 140 + lib/l10n/app_localizations_es.dart | 140 + lib/l10n/app_localizations_fr.dart | 140 + lib/l10n/app_localizations_hu.dart | 140 + lib/l10n/app_localizations_it.dart | 140 + lib/l10n/app_localizations_ja.dart | 140 + lib/l10n/app_localizations_ko.dart | 140 + lib/l10n/app_localizations_nl.dart | 140 + lib/l10n/app_localizations_pl.dart | 140 + lib/l10n/app_localizations_pt.dart | 140 + lib/l10n/app_localizations_ru.dart | 140 + lib/l10n/app_localizations_sk.dart | 140 + lib/l10n/app_localizations_sl.dart | 140 + lib/l10n/app_localizations_sv.dart | 140 + lib/l10n/app_localizations_uk.dart | 140 + lib/l10n/app_localizations_zh.dart | 140 + lib/models/display_path.dart | 69 + lib/models/path_playback.dart | 177 ++ lib/screens/app_debug_log_screen.dart | 113 +- lib/screens/app_settings_screen.dart | 2491 ++++++++++------- lib/screens/ble_debug_log_screen.dart | 132 +- lib/screens/channel_chat_screen.dart | 521 ++-- lib/screens/channel_message_path_screen.dart | 1251 +++++++-- lib/screens/channels_screen.dart | 994 ++++--- lib/screens/chat_screen.dart | 413 +-- lib/screens/chrome_required_screen.dart | 155 +- lib/screens/community_qr_scanner_screen.dart | 289 +- lib/screens/companion_radio_stats_screen.dart | 143 +- lib/screens/contacts_screen.dart | 314 ++- lib/screens/discovery_screen.dart | 298 +- lib/screens/line_of_sight_map_screen.dart | 1666 +++++++---- lib/screens/map_cache_screen.dart | 294 +- lib/screens/map_screen.dart | 2354 +++++++++++----- lib/screens/neighbors_screen.dart | 160 +- lib/screens/path_trace_map.dart | 1097 ++++++-- lib/screens/repeater_cli_screen.dart | 1091 +++----- lib/screens/repeater_hub_screen.dart | 457 ++- lib/screens/repeater_settings_screen.dart | 1500 +++++----- lib/screens/repeater_status_screen.dart | 458 ++- lib/screens/scanner_screen.dart | 223 +- lib/screens/settings_screen.dart | 932 +++--- lib/screens/tcp_screen.dart | 156 +- lib/screens/telemetry_screen.dart | 93 +- lib/screens/usb_screen.dart | 222 +- lib/theme/mesh_theme.dart | 258 +- lib/widgets/battery_indicator.dart | 23 +- lib/widgets/device_tile.dart | 112 +- lib/widgets/elements_ui.dart | 83 +- lib/widgets/emoji_picker.dart | 14 +- lib/widgets/empty_state.dart | 112 +- lib/widgets/jump_to_bottom_button.dart | 36 +- lib/widgets/mesh_ui.dart | 643 +++++ lib/widgets/message_status_icon.dart | 12 +- lib/widgets/path_map_ui.dart | 659 +++++ lib/widgets/quick_switch_bar.dart | 27 +- lib/widgets/radio_stats_entry.dart | 13 +- lib/widgets/repeater_login_dialog.dart | 45 +- lib/widgets/room_login_dialog.dart | 41 +- lib/widgets/signal_ui.dart | 11 +- lib/widgets/snr_indicator.dart | 57 +- lib/widgets/telemetry_location_map.dart | 9 +- lib/widgets/themed_map_tile_layer.dart | 60 + lib/widgets/unread_badge.dart | 15 +- lib/widgets/unread_divider.dart | 37 +- linux/flutter/generated_plugins.cmake | 1 - untranslated.json | 699 ++++- windows/flutter/generated_plugins.cmake | 1 - 72 files changed, 16778 insertions(+), 7110 deletions(-) create mode 100644 lib/models/display_path.dart create mode 100644 lib/models/path_playback.dart create mode 100644 lib/widgets/mesh_ui.dart create mode 100644 lib/widgets/path_map_ui.dart create mode 100644 lib/widgets/themed_map_tile_layer.dart diff --git a/lib/helpers/snack_bar_builder.dart b/lib/helpers/snack_bar_builder.dart index d7409b6d..913e783f 100644 --- a/lib/helpers/snack_bar_builder.dart +++ b/lib/helpers/snack_bar_builder.dart @@ -25,7 +25,19 @@ void showDismissibleSnackBar( DismissDirection? dismissDirection, Clip? clipBehavior, }) { - final messenger = ScaffoldMessenger.of(context); + // Callers often reach here after an async gap; the context may already be + // unmounted, or deactivated (popped but not yet disposed) — ancestor + // lookups on a deactivated element throw. Showing nothing is the right + // outcome in both cases. + if (!context.mounted) return; + var isActive = true; + assert(() { + isActive = (context as Element).debugIsActive; + return true; + }()); + if (!isActive) return; + final messenger = ScaffoldMessenger.maybeOf(context); + if (messenger == null) return; messenger.showSnackBar( SnackBar( key: key, diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 58613d02..37308ba5 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -900,6 +900,17 @@ }, "chat_invalidLink": "Invalid link format", "map_title": "Node Map", + "map_searchHint": "Search node name or ID", + "map_activity": "Activity", + "map_online": "Online", + "map_recent": "Recent", + "map_stale": "Stale", + "map_visible": "Visible", + "map_hidden": "Hidden", + "map_centerOnNode": "Center on node", + "map_details": "Details", + "map_noGps": "No GPS", + "map_noResults": "No matching nodes", "map_lineOfSight": "Line of Sight", "map_losScreenTitle": "Line of Sight", "map_noNodesWithLocation": "No nodes with location data", @@ -2501,5 +2512,87 @@ } }, "pathTrace_legendGpsConfirmed": "GPS confirmed", - "pathTrace_legendInferred": "Inferred position" + "pathTrace_legendInferred": "Inferred position", + "pathMap_viewSingle": "Single", + "pathMap_viewCombined": "Combined", + "pathMap_play": "Play", + "pathMap_pause": "Pause", + "pathMap_replay": "Replay", + "pathMap_stepBack": "Previous hop", + "pathMap_stepForward": "Next hop", + "pathMap_animationOn": "Show packet animation", + "pathMap_animationOff": "Hide packet animation", + "pathMap_hopOf": "Hop {current} of {total}", + "@pathMap_hopOf": { + "placeholders": { + "current": { + "type": "int" + }, + "total": { + "type": "int" + } + } + }, + "pathMap_observedPaths": "Observed paths: {count}", + "@pathMap_observedPaths": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_primary": "Primary", + "pathMap_alternate": "Alt {index}", + "@pathMap_alternate": { + "placeholders": { + "index": { + "type": "int" + } + } + }, + "pathMap_hopCount": "{count, plural, =1{1 hop} other{{count} hops}}", + "@pathMap_hopCount": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_gpsCount": "{confirmed}/{total} GPS", + "@pathMap_gpsCount": { + "placeholders": { + "confirmed": { + "type": "int" + }, + "total": { + "type": "int" + } + } + }, + "pathMap_legendShared": "Shared segment", + "pathMap_legendEstimated": "Estimated segment", + "pathMap_sharedNodeCount": "Used by {count} paths", + "@pathMap_sharedNodeCount": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_partialAnimation": "{count, plural, =1{1 hop has no location — the shown path is partial} other{{count} hops have no location — the shown path is partial}}", + "@pathMap_partialAnimation": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "pathMap_showAllPaths": "Show all", + "pathMap_hidePath": "Hide path", + "pathMap_showPath": "Show path", + "pathMap_collapsePanel": "Collapse panel", + "pathMap_expandPanel": "Expand panel", + "pathMap_noLocation": "No location", + "pathMap_followPacket": "Lock view to packet", + "pathMap_unfollowPacket": "Unlock view from packet" } diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index f55fc02c..8b513be5 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -3154,6 +3154,72 @@ abstract class AppLocalizations { /// **'Node Map'** String get map_title; + /// No description provided for @map_searchHint. + /// + /// In en, this message translates to: + /// **'Search node name or ID'** + String get map_searchHint; + + /// No description provided for @map_activity. + /// + /// In en, this message translates to: + /// **'Activity'** + String get map_activity; + + /// No description provided for @map_online. + /// + /// In en, this message translates to: + /// **'Online'** + String get map_online; + + /// No description provided for @map_recent. + /// + /// In en, this message translates to: + /// **'Recent'** + String get map_recent; + + /// No description provided for @map_stale. + /// + /// In en, this message translates to: + /// **'Stale'** + String get map_stale; + + /// No description provided for @map_visible. + /// + /// In en, this message translates to: + /// **'Visible'** + String get map_visible; + + /// No description provided for @map_hidden. + /// + /// In en, this message translates to: + /// **'Hidden'** + String get map_hidden; + + /// No description provided for @map_centerOnNode. + /// + /// In en, this message translates to: + /// **'Center on node'** + String get map_centerOnNode; + + /// No description provided for @map_details. + /// + /// In en, this message translates to: + /// **'Details'** + String get map_details; + + /// No description provided for @map_noGps. + /// + /// In en, this message translates to: + /// **'No GPS'** + String get map_noGps; + + /// No description provided for @map_noResults. + /// + /// In en, this message translates to: + /// **'No matching nodes'** + String get map_noResults; + /// No description provided for @map_lineOfSight. /// /// In en, this message translates to: @@ -7701,6 +7767,168 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Inferred position'** String get pathTrace_legendInferred; + + /// No description provided for @pathMap_viewSingle. + /// + /// In en, this message translates to: + /// **'Single'** + String get pathMap_viewSingle; + + /// No description provided for @pathMap_viewCombined. + /// + /// In en, this message translates to: + /// **'Combined'** + String get pathMap_viewCombined; + + /// No description provided for @pathMap_play. + /// + /// In en, this message translates to: + /// **'Play'** + String get pathMap_play; + + /// No description provided for @pathMap_pause. + /// + /// In en, this message translates to: + /// **'Pause'** + String get pathMap_pause; + + /// No description provided for @pathMap_replay. + /// + /// In en, this message translates to: + /// **'Replay'** + String get pathMap_replay; + + /// No description provided for @pathMap_stepBack. + /// + /// In en, this message translates to: + /// **'Previous hop'** + String get pathMap_stepBack; + + /// No description provided for @pathMap_stepForward. + /// + /// In en, this message translates to: + /// **'Next hop'** + String get pathMap_stepForward; + + /// No description provided for @pathMap_animationOn. + /// + /// In en, this message translates to: + /// **'Show packet animation'** + String get pathMap_animationOn; + + /// No description provided for @pathMap_animationOff. + /// + /// In en, this message translates to: + /// **'Hide packet animation'** + String get pathMap_animationOff; + + /// No description provided for @pathMap_hopOf. + /// + /// In en, this message translates to: + /// **'Hop {current} of {total}'** + String pathMap_hopOf(int current, int total); + + /// No description provided for @pathMap_observedPaths. + /// + /// In en, this message translates to: + /// **'Observed paths: {count}'** + String pathMap_observedPaths(int count); + + /// No description provided for @pathMap_primary. + /// + /// In en, this message translates to: + /// **'Primary'** + String get pathMap_primary; + + /// No description provided for @pathMap_alternate. + /// + /// In en, this message translates to: + /// **'Alt {index}'** + String pathMap_alternate(int index); + + /// No description provided for @pathMap_hopCount. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 hop} other{{count} hops}}'** + String pathMap_hopCount(int count); + + /// No description provided for @pathMap_gpsCount. + /// + /// In en, this message translates to: + /// **'{confirmed}/{total} GPS'** + String pathMap_gpsCount(int confirmed, int total); + + /// No description provided for @pathMap_legendShared. + /// + /// In en, this message translates to: + /// **'Shared segment'** + String get pathMap_legendShared; + + /// No description provided for @pathMap_legendEstimated. + /// + /// In en, this message translates to: + /// **'Estimated segment'** + String get pathMap_legendEstimated; + + /// No description provided for @pathMap_sharedNodeCount. + /// + /// In en, this message translates to: + /// **'Used by {count} paths'** + String pathMap_sharedNodeCount(int count); + + /// No description provided for @pathMap_partialAnimation. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 hop has no location — the shown path is partial} other{{count} hops have no location — the shown path is partial}}'** + String pathMap_partialAnimation(int count); + + /// No description provided for @pathMap_showAllPaths. + /// + /// In en, this message translates to: + /// **'Show all'** + String get pathMap_showAllPaths; + + /// No description provided for @pathMap_hidePath. + /// + /// In en, this message translates to: + /// **'Hide path'** + String get pathMap_hidePath; + + /// No description provided for @pathMap_showPath. + /// + /// In en, this message translates to: + /// **'Show path'** + String get pathMap_showPath; + + /// No description provided for @pathMap_collapsePanel. + /// + /// In en, this message translates to: + /// **'Collapse panel'** + String get pathMap_collapsePanel; + + /// No description provided for @pathMap_expandPanel. + /// + /// In en, this message translates to: + /// **'Expand panel'** + String get pathMap_expandPanel; + + /// No description provided for @pathMap_noLocation. + /// + /// In en, this message translates to: + /// **'No location'** + String get pathMap_noLocation; + + /// No description provided for @pathMap_followPacket. + /// + /// In en, this message translates to: + /// **'Lock view to packet'** + String get pathMap_followPacket; + + /// No description provided for @pathMap_unfollowPacket. + /// + /// In en, this message translates to: + /// **'Unlock view from packet'** + String get pathMap_unfollowPacket; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index d22848c3..48d0ea2a 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -1738,6 +1738,39 @@ class AppLocalizationsBg extends AppLocalizations { @override String get map_title => 'Карта на възлите'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Линия на видимост'; @@ -4479,4 +4512,111 @@ class AppLocalizationsBg extends AppLocalizations { @override String get pathTrace_legendInferred => 'Извлечена позиция'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 98d25a6d..10cc0baf 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -1737,6 +1737,39 @@ class AppLocalizationsDe extends AppLocalizations { @override String get map_title => 'Karte'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Sichtlinie'; @@ -4500,4 +4533,111 @@ class AppLocalizationsDe extends AppLocalizations { @override String get pathTrace_legendInferred => 'Abgeleitete Position'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index eecfbc41..f851b914 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -1703,6 +1703,39 @@ class AppLocalizationsEn extends AppLocalizations { @override String get map_title => 'Node Map'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Line of Sight'; @@ -4405,4 +4438,111 @@ class AppLocalizationsEn extends AppLocalizations { @override String get pathTrace_legendInferred => 'Inferred position'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index e0268b4f..c6e8ad2f 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -1734,6 +1734,39 @@ class AppLocalizationsEs extends AppLocalizations { @override String get map_title => 'Mapa de Nodos'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Línea de visión'; @@ -4486,4 +4519,111 @@ class AppLocalizationsEs extends AppLocalizations { @override String get pathTrace_legendInferred => 'Posición inferida'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 7bb38a0d..3fd7839d 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -1741,6 +1741,39 @@ class AppLocalizationsFr extends AppLocalizations { @override String get map_title => 'Carte des nœuds'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Ligne de vue'; @@ -4512,4 +4545,111 @@ class AppLocalizationsFr extends AppLocalizations { @override String get pathTrace_legendInferred => 'Position déduite'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index eef91d09..0a09c402 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -1744,6 +1744,39 @@ class AppLocalizationsHu extends AppLocalizations { @override String get map_title => 'Grafikus ábrázás'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Látási vonal'; @@ -4500,4 +4533,111 @@ class AppLocalizationsHu extends AppLocalizations { @override String get pathTrace_legendInferred => 'Feltehető helyzet'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index 89fb77e7..b748de9e 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -1738,6 +1738,39 @@ class AppLocalizationsIt extends AppLocalizations { @override String get map_title => 'Mappa Nodi'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linea di vista'; @@ -4492,4 +4525,111 @@ class AppLocalizationsIt extends AppLocalizations { @override String get pathTrace_legendInferred => 'Posizione dedotta'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index c60816ee..150fef5f 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -1661,6 +1661,39 @@ class AppLocalizationsJa extends AppLocalizations { @override String get map_title => 'ノードマップ'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => '視界'; @@ -4257,4 +4290,111 @@ class AppLocalizationsJa extends AppLocalizations { @override String get pathTrace_legendInferred => '推測される位置'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 812c2f94..783990cc 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -1656,6 +1656,39 @@ class AppLocalizationsKo extends AppLocalizations { @override String get map_title => '노드 매핑'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => '시야'; @@ -4254,4 +4287,111 @@ class AppLocalizationsKo extends AppLocalizations { @override String get pathTrace_legendInferred => '추론된 위치'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 94d5e1e3..087a0204 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -1721,6 +1721,39 @@ class AppLocalizationsNl extends AppLocalizations { @override String get map_title => 'Kaart van de knopen'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Zichtlijn'; @@ -4463,4 +4496,111 @@ class AppLocalizationsNl extends AppLocalizations { @override String get pathTrace_legendInferred => 'Afgeleide positie'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index b95dcbfc..ae102624 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -1750,6 +1750,39 @@ class AppLocalizationsPl extends AppLocalizations { @override String get map_title => 'Mapa węzłów'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linia wzroku'; @@ -4501,4 +4534,111 @@ class AppLocalizationsPl extends AppLocalizations { @override String get pathTrace_legendInferred => 'Wywnioskowana pozycja'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 09a4fa79..55dccf17 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -1734,6 +1734,39 @@ class AppLocalizationsPt extends AppLocalizations { @override String get map_title => 'Mapa de Nós'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linha de visão'; @@ -4480,4 +4513,111 @@ class AppLocalizationsPt extends AppLocalizations { @override String get pathTrace_legendInferred => 'Posição inferida'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 6503c5c1..a66e99d4 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -1739,6 +1739,39 @@ class AppLocalizationsRu extends AppLocalizations { @override String get map_title => 'Карта нод'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Линия видимости'; @@ -4496,4 +4529,111 @@ class AppLocalizationsRu extends AppLocalizations { @override String get pathTrace_legendInferred => 'Выведенная позиция'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 3bb7ac5f..349c4c6e 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -1726,6 +1726,39 @@ class AppLocalizationsSk extends AppLocalizations { @override String get map_title => 'Mapa uzlov'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Úroveň výhľadu'; @@ -4462,4 +4495,111 @@ class AppLocalizationsSk extends AppLocalizations { @override String get pathTrace_legendInferred => 'Odvodená poloha'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index e1efed05..f79b0d2e 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -1719,6 +1719,39 @@ class AppLocalizationsSl extends AppLocalizations { @override String get map_title => 'Mapa omrežja'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Linija vida'; @@ -4461,4 +4494,111 @@ class AppLocalizationsSl extends AppLocalizations { @override String get pathTrace_legendInferred => 'Izpeljana lokacija'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index a95e8903..8a354354 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -1712,6 +1712,39 @@ class AppLocalizationsSv extends AppLocalizations { @override String get map_title => 'Nodkarta'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Synlinje'; @@ -4435,4 +4468,111 @@ class AppLocalizationsSv extends AppLocalizations { @override String get pathTrace_legendInferred => 'Antagen position'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 989acdb8..8379a505 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -1732,6 +1732,39 @@ class AppLocalizationsUk extends AppLocalizations { @override String get map_title => 'Карта вузлів'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => 'Пряма видимість'; @@ -4495,4 +4528,111 @@ class AppLocalizationsUk extends AppLocalizations { @override String get pathTrace_legendInferred => 'Висновок щодо положення'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index bf4131b8..d2643bd9 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -1634,6 +1634,39 @@ class AppLocalizationsZh extends AppLocalizations { @override String get map_title => '节点地图'; + @override + String get map_searchHint => 'Search node name or ID'; + + @override + String get map_activity => 'Activity'; + + @override + String get map_online => 'Online'; + + @override + String get map_recent => 'Recent'; + + @override + String get map_stale => 'Stale'; + + @override + String get map_visible => 'Visible'; + + @override + String get map_hidden => 'Hidden'; + + @override + String get map_centerOnNode => 'Center on node'; + + @override + String get map_details => 'Details'; + + @override + String get map_noGps => 'No GPS'; + + @override + String get map_noResults => 'No matching nodes'; + @override String get map_lineOfSight => '视线'; @@ -4145,4 +4178,111 @@ class AppLocalizationsZh extends AppLocalizations { @override String get pathTrace_legendInferred => '推测的位置'; + + @override + String get pathMap_viewSingle => 'Single'; + + @override + String get pathMap_viewCombined => 'Combined'; + + @override + String get pathMap_play => 'Play'; + + @override + String get pathMap_pause => 'Pause'; + + @override + String get pathMap_replay => 'Replay'; + + @override + String get pathMap_stepBack => 'Previous hop'; + + @override + String get pathMap_stepForward => 'Next hop'; + + @override + String get pathMap_animationOn => 'Show packet animation'; + + @override + String get pathMap_animationOff => 'Hide packet animation'; + + @override + String pathMap_hopOf(int current, int total) { + return 'Hop $current of $total'; + } + + @override + String pathMap_observedPaths(int count) { + return 'Observed paths: $count'; + } + + @override + String get pathMap_primary => 'Primary'; + + @override + String pathMap_alternate(int index) { + return 'Alt $index'; + } + + @override + String pathMap_hopCount(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops', + one: '1 hop', + ); + return '$_temp0'; + } + + @override + String pathMap_gpsCount(int confirmed, int total) { + return '$confirmed/$total GPS'; + } + + @override + String get pathMap_legendShared => 'Shared segment'; + + @override + String get pathMap_legendEstimated => 'Estimated segment'; + + @override + String pathMap_sharedNodeCount(int count) { + return 'Used by $count paths'; + } + + @override + String pathMap_partialAnimation(int count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count hops have no location — the shown path is partial', + one: '1 hop has no location — the shown path is partial', + ); + return '$_temp0'; + } + + @override + String get pathMap_showAllPaths => 'Show all'; + + @override + String get pathMap_hidePath => 'Hide path'; + + @override + String get pathMap_showPath => 'Show path'; + + @override + String get pathMap_collapsePanel => 'Collapse panel'; + + @override + String get pathMap_expandPanel => 'Expand panel'; + + @override + String get pathMap_noLocation => 'No location'; + + @override + String get pathMap_followPacket => 'Lock view to packet'; + + @override + String get pathMap_unfollowPacket => 'Unlock view from packet'; } diff --git a/lib/models/display_path.dart b/lib/models/display_path.dart new file mode 100644 index 00000000..71f8ed53 --- /dev/null +++ b/lib/models/display_path.dart @@ -0,0 +1,69 @@ +import 'dart:ui'; + +import 'package:latlong2/latlong.dart'; + +import 'path_history.dart'; + +/// One observed route rendered on the path map — the live traced path +/// (primary) or an alternate from the contact's path history — resolved to +/// map coordinates with per-hop confidence flags. +class DisplayPath { + final String id; + final String label; + final Color color; + final bool isPrimary; + + /// Outbound hop bytes, including hops that could not be placed on the map. + final List hopBytes; + + /// Resolved map points: self, each locatable hop, then the target when its + /// position is known. Hops with no position are skipped here but still + /// counted in [unresolvedHops]. + final List points; + + /// Display name for each entry of [points]. + final List pointLabels; + + /// Whether each entry of [points] is a GPS-grade position (vs inferred). + final List pointConfirmed; + + /// Per segment (length points-1): true when either endpoint is inferred or + /// unlocatable hops were skipped in between — rendered dashed. + final List segmentEstimated; + + /// Per segment: the transmission ordinal of the segment's destination, + /// used to highlight the matching hop-list row during animation. + final List rowForSegment; + + /// Total transmissions on the full route (including unlocatable hops). + final int totalTransmissions; + + /// True when the route ends with a chat-target endpoint row. + final bool hasTargetEndpoint; + + final int gpsConfirmedHops; + final int unresolvedHops; + final double distanceMeters; + + /// History metadata; null for the live traced (primary) path. + final PathRecord? record; + + const DisplayPath({ + required this.id, + required this.label, + required this.color, + required this.isPrimary, + required this.hopBytes, + required this.points, + required this.pointLabels, + required this.pointConfirmed, + required this.segmentEstimated, + required this.rowForSegment, + required this.totalTransmissions, + required this.hasTargetEndpoint, + required this.gpsConfirmedHops, + required this.unresolvedHops, + required this.distanceMeters, + this.record, + }); +} diff --git a/lib/models/path_playback.dart b/lib/models/path_playback.dart new file mode 100644 index 00000000..89fdff0b --- /dev/null +++ b/lib/models/path_playback.dart @@ -0,0 +1,177 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/scheduler.dart'; +import 'package:latlong2/latlong.dart'; + +/// Timeline state for the packet-flow animation on the path map. +/// +/// The packet travels each segment over [segmentMs] (scaled by [speed]), +/// then dwells at the reached hop for [dwellMs] so the hop visibly lights up. +/// Overlay layers listen to this controller directly; [activeSegment] only +/// fires when the segment index changes so list highlights rebuild cheaply. +class PathPlaybackController extends ChangeNotifier { + static const double segmentMs = 1100; + static const double dwellMs = 380; + static const List speedSteps = [0.5, 1.0, 2.0]; + + late final Ticker _ticker; + List _points = const []; + double _timelineMs = 0; + Duration _lastTick = Duration.zero; + bool _playing = false; + bool _started = false; + double _speed = 1.0; + + /// Segment currently being traveled (clamped to the last segment), or -1 + /// while the animation has not been started — listeners use this for + /// hop-list highlighting without rebuilding every tick. + final ValueNotifier activeSegment = ValueNotifier(-1); + + PathPlaybackController(TickerProvider vsync) { + _ticker = vsync.createTicker(_onTick); + } + + List get points => _points; + bool get hasPath => _points.length >= 2; + int get segmentCount => hasPath ? _points.length - 1 : 0; + bool get playing => _playing; + double get speed => _speed; + + /// True once the user has started or stepped the animation; the packet + /// overlay renders only in this state. + bool get started => _started; + + double get _slotMs => segmentMs + dwellMs; + double get _totalMs => segmentCount * _slotMs; + bool get isComplete => hasPath && _timelineMs >= _totalMs; + + int get currentSegment { + if (!hasPath) return 0; + return (_timelineMs / _slotMs).floor().clamp(0, segmentCount - 1); + } + + /// Travel progress through [currentSegment]; 1.0 while dwelling at its end. + double get segmentProgress { + if (!hasPath) return 0; + final within = _timelineMs - currentSegment * _slotMs; + return (within / segmentMs).clamp(0.0, 1.0); + } + + /// Dwell progress (0..1) at the reached hop, or null while traveling. + double? get dwellProgress { + if (!hasPath || isComplete) return null; + final within = _timelineMs - currentSegment * _slotMs; + if (within < segmentMs) return null; + return ((within - segmentMs) / dwellMs).clamp(0.0, 1.0); + } + + /// Index of the point the packet has most recently reached. + int get reachedPointIndex { + if (!hasPath) return 0; + if (isComplete) return _points.length - 1; + return segmentProgress >= 1.0 ? currentSegment + 1 : currentSegment; + } + + LatLng get position { + if (!hasPath) return const LatLng(0, 0); + final seg = currentSegment; + final a = _points[seg]; + final b = _points[seg + 1]; + final t = segmentProgress; + return LatLng( + a.latitude + (b.latitude - a.latitude) * t, + a.longitude + (b.longitude - a.longitude) * t, + ); + } + + /// Replaces the path and resets the animation to the start. + void setPath(List points) { + _ticker.stop(); + _points = List.unmodifiable(points); + _timelineMs = 0; + _playing = false; + _started = false; + activeSegment.value = -1; + notifyListeners(); + } + + void play() { + if (!hasPath) return; + if (isComplete) _timelineMs = 0; + _started = true; + _playing = true; + activeSegment.value = currentSegment; + if (!_ticker.isActive) { + _lastTick = Duration.zero; + _ticker.start(); + } + notifyListeners(); + } + + void pause() { + _ticker.stop(); + _playing = false; + notifyListeners(); + } + + void togglePlay() => _playing ? pause() : play(); + + void replay() { + if (!hasPath) return; + _timelineMs = 0; + activeSegment.value = 0; + play(); + } + + /// Stops playback and hides the packet overlay. + void stop() { + _ticker.stop(); + _playing = false; + _started = false; + _timelineMs = 0; + activeSegment.value = -1; + notifyListeners(); + } + + void stepForward() => _jumpToPoint(reachedPointIndex + 1); + + void stepBack() => _jumpToPoint(reachedPointIndex - 1); + + void cycleSpeed() { + final index = speedSteps.indexOf(_speed); + _speed = speedSteps[(index + 1) % speedSteps.length]; + notifyListeners(); + } + + void _jumpToPoint(int index) { + if (!hasPath) return; + _ticker.stop(); + _playing = false; + _started = true; + final clamped = index.clamp(0, _points.length - 1); + // Land at the start of the dwell window so the hop pulse plays. + _timelineMs = clamped == 0 ? 0 : (clamped - 1) * _slotMs + segmentMs; + activeSegment.value = currentSegment; + notifyListeners(); + } + + void _onTick(Duration elapsed) { + final dtMs = (elapsed - _lastTick).inMicroseconds / 1000.0; + _lastTick = elapsed; + _timelineMs = (_timelineMs + dtMs * _speed).clamp(0.0, _totalMs); + if (_timelineMs >= _totalMs) { + _ticker.stop(); + _playing = false; + } + if (activeSegment.value != currentSegment) { + activeSegment.value = currentSegment; + } + notifyListeners(); + } + + @override + void dispose() { + _ticker.dispose(); + activeSegment.dispose(); + super.dispose(); + } +} diff --git a/lib/screens/app_debug_log_screen.dart b/lib/screens/app_debug_log_screen.dart index 522a2c5c..4b00c70c 100644 --- a/lib/screens/app_debug_log_screen.dart +++ b/lib/screens/app_debug_log_screen.dart @@ -4,6 +4,7 @@ import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../services/app_debug_log_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; @@ -58,27 +59,57 @@ class AppDebugLogScreen extends StatelessWidget { child: hasEntries ? ListView.separated( itemCount: entries.length, - separatorBuilder: (_, _) => const Divider(height: 1), + separatorBuilder: (_, _) => + const Divider(height: 1, color: MeshPalette.line), itemBuilder: (context, index) { final entry = entries[index]; - return ListTile( - dense: true, - leading: _buildLevelIcon(context, entry.level), - title: Text( - '[${entry.tag}] ${entry.message}', - style: const TextStyle( - fontSize: 12, - fontFamily: 'monospace', - ), + return Container( + color: MeshPalette.bg, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), - subtitle: Text( - entry.formattedTime, - style: TextStyle( - fontSize: 10, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildLevelIcon(context, entry.level), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text.rich( + TextSpan( + children: [ + TextSpan( + text: '[${entry.tag}] ', + style: MeshTheme.mono( + fontSize: 11.5, + color: _levelColor(entry.level), + ), + ), + TextSpan( + text: entry.message, + style: MeshTheme.mono( + fontSize: 11.5, + color: MeshPalette.ink2, + ), + ), + ], + ), + ), + const SizedBox(height: 2), + Text( + entry.formattedTime, + style: MeshTheme.mono( + fontSize: 9.5, + color: MeshPalette.ink4, + ), + ), + ], + ), + ), + ], ), ); }, @@ -87,29 +118,25 @@ class AppDebugLogScreen extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon( + const Icon( Icons.bug_report_outlined, size: 64, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: MeshPalette.ink3, ), const SizedBox(height: 16), Text( context.l10n.debugLog_noEntries, - style: TextStyle( + style: const TextStyle( fontSize: 16, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + color: MeshPalette.ink3, ), ), const SizedBox(height: 8), Text( context.l10n.debugLog_enableInSettings, - style: TextStyle( + style: const TextStyle( fontSize: 12, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + color: MeshPalette.ink3, ), ), ], @@ -121,19 +148,37 @@ class AppDebugLogScreen extends StatelessWidget { ); } - Widget _buildLevelIcon(BuildContext context, AppDebugLogLevel level) { - final colorScheme = Theme.of(context).colorScheme; + Color _levelColor(AppDebugLogLevel level) { switch (level) { case AppDebugLogLevel.info: - return Icon(Icons.info_outline, size: 18, color: colorScheme.primary); + return MeshPalette.blue; case AppDebugLogLevel.warning: - return Icon( + return MeshPalette.warn; + case AppDebugLogLevel.error: + return MeshPalette.alert; + } + } + + Widget _buildLevelIcon(BuildContext context, AppDebugLogLevel level) { + switch (level) { + case AppDebugLogLevel.info: + return const Icon( + Icons.info_outline, + size: 18, + color: MeshPalette.blue, + ); + case AppDebugLogLevel.warning: + return const Icon( Icons.warning_amber_outlined, size: 18, - color: colorScheme.tertiary, + color: MeshPalette.warn, ); case AppDebugLogLevel.error: - return Icon(Icons.error_outline, size: 18, color: colorScheme.error); + return const Icon( + Icons.error_outline, + size: 18, + color: MeshPalette.alert, + ); } } } diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index d1ccfd09..3d3af8b9 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -10,7 +10,9 @@ import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/notification_service.dart'; import '../services/translation_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/sync_progress_overlay.dart'; import '../helpers/snack_bar_builder.dart'; import 'map_cache_screen.dart'; @@ -28,73 +30,123 @@ class AppSettingsScreen extends StatelessWidget { ), body: SafeArea( top: false, - child: - Consumer3< - AppSettingsService, - MeshCoreConnector, - TranslationService - >( - builder: - ( + child: Consumer3( + builder: ( + context, + settingsService, + connector, + translationService, + child, + ) { + return ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + // APPEARANCE + SectionHeader(context.l10n.appSettings_appearance), + MeshCard( + padding: EdgeInsets.zero, + child: _buildAppearanceContent(context, settingsService), + ), + + // NOTIFICATIONS + SectionHeader(context.l10n.appSettings_notifications), + MeshCard( + padding: EdgeInsets.zero, + child: _buildNotificationsContent(context, settingsService), + ), + + // MESSAGING + SectionHeader(context.l10n.appSettings_messaging), + MeshCard( + padding: EdgeInsets.zero, + child: _buildMessagingContent(context, settingsService), + ), + + // BATTERY + SectionHeader(context.l10n.appSettings_battery), + MeshCard( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: _buildBatteryContent( context, settingsService, connector, - translationService, - child, - ) { - return ListView( - padding: const EdgeInsets.all(16), - children: [ - _buildAppearanceCard(context, settingsService), - const SizedBox(height: 16), - _buildNotificationsCard(context, settingsService), - const SizedBox(height: 16), - _buildMessagingCard(context, settingsService), - const SizedBox(height: 16), - if (!kIsWeb) ...[ - _buildTranslationCard( - context, - settingsService, - translationService, - ), - const SizedBox(height: 16), - ], - _buildBatteryCard(context, settingsService, connector), - const SizedBox(height: 16), - _buildMapSettingsCard(context, settingsService), - const SizedBox(height: 16), - _buildCyr2LatCard(context, settingsService), - const SizedBox(height: 16), - _buildDebugCard(context, settingsService), - ], - ); - }, - ), + ), + ), + + // MAP + SectionHeader(context.l10n.appSettings_mapDisplay), + MeshCard( + padding: EdgeInsets.zero, + child: _buildMapContent(context, settingsService), + ), + + // TRANSLATION (non-web only) + if (!kIsWeb) ...[ + SectionHeader(context.l10n.translation_title), + MeshCard( + padding: EdgeInsets.zero, + child: _buildTranslationContent( + context, + settingsService, + translationService, + ), + ), + ], + + // CYR2LAT + SectionHeader(context.l10n.channels_cyr2latSettingsHeading), + MeshCard( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: _buildCyr2LatContent(context, settingsService), + ), + + // DEBUG + SectionHeader(context.l10n.appSettings_debugCard), + MeshCard( + padding: EdgeInsets.zero, + child: _buildDebugContent(context, settingsService), + ), + ], + ); + }, + ), ), ); } - Widget _buildAppearanceCard( + Widget _buildAppearanceContent( BuildContext context, AppSettingsService settingsService, ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_appearance, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.brightness_6_outlined), - title: Text(context.l10n.appSettings_theme), - subtitle: Padding( - padding: const EdgeInsets.only(top: 8), - child: SegmentedButton( + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 16, 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.brightness_6_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Text( + context.l10n.appSettings_theme, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + ], + ), + const SizedBox(height: 10), + SegmentedButton( segments: [ ButtonSegment( value: 'system', @@ -114,713 +166,1016 @@ class AppSettingsScreen extends StatelessWidget { settingsService.setThemeMode(selection.first); }, ), + ], + ), + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showLanguageSheet(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.language_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_language, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _languageLabel( + context, + settingsService.settings.languageOverride, + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.language_outlined), - title: Text(context.l10n.appSettings_language), - subtitle: Text( - _languageLabel( - context, - settingsService.settings.languageOverride, - ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showLanguageDialog(context, settingsService), - ), - ], - ), + ), + ], ); } - Widget _buildNotificationsCard( + Widget _buildNotificationsContent( BuildContext context, AppSettingsService settingsService, ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_notifications, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + final notifEnabled = settingsService.settings.notificationsEnabled; + return Column( + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.notifications_outlined, size: 20), + title: Text(context.l10n.appSettings_enableNotifications), + subtitle: Text(context.l10n.appSettings_enableNotificationsSubtitle), + value: settingsService.settings.notificationsEnabled, + onChanged: (value) async { + if (value) { + final granted = await NotificationService().requestPermissions(); + if (!granted) { + if (context.mounted) { + showDismissibleSnackBar( + context, + content: Text( + context.l10n.appSettings_notificationPermissionDenied, + ), + duration: const Duration(seconds: 2), + ); + } + return; + } + } + await settingsService.setNotificationsEnabled(value); + if (context.mounted) { + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_notificationsEnabled + : context.l10n.appSettings_notificationsDisabled, + ), + duration: const Duration(seconds: 2), + ); + } + }, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.message_outlined, + size: 20, + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.appSettings_messageNotifications, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, ), ), - SwitchListTile( - secondary: const Icon(Icons.notifications_outlined), - title: Text(context.l10n.appSettings_enableNotifications), - subtitle: Text( - context.l10n.appSettings_enableNotificationsSubtitle, + subtitle: Text( + context.l10n.appSettings_messageNotificationsSubtitle, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, ), - value: settingsService.settings.notificationsEnabled, - onChanged: (value) async { - if (value) { - // Request permission when enabling - final granted = await NotificationService() - .requestPermissions(); - if (!granted) { - if (context.mounted) { - showDismissibleSnackBar( - context, - content: Text( - context.l10n.appSettings_notificationPermissionDenied, + ), + value: settingsService.settings.notifyOnNewMessage, + onChanged: notifEnabled + ? (value) => settingsService.setNotifyOnNewMessage(value) + : null, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.forum_outlined, + size: 20, + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.appSettings_channelMessageNotifications, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + subtitle: Text( + context.l10n.appSettings_channelMessageNotificationsSubtitle, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + value: settingsService.settings.notifyOnNewChannelMessage, + onChanged: notifEnabled + ? (value) => + settingsService.setNotifyOnNewChannelMessage(value) + : null, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.cell_tower, + size: 20, + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.appSettings_advertisementNotifications, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + subtitle: Text( + context.l10n.appSettings_advertisementNotificationsSubtitle, + style: TextStyle( + color: notifEnabled ? null : Theme.of(context).disabledColor, + ), + ), + value: settingsService.settings.notifyOnNewAdvert, + onChanged: notifEnabled + ? (value) => settingsService.setNotifyOnNewAdvert(value) + : null, + ), + ], + ); + } + + Widget _buildMessagingContent( + BuildContext context, + AppSettingsService settingsService, + ) { + final autoRouteEnabled = settingsService.settings.autoRouteRotationEnabled; + return Column( + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.refresh_outlined, size: 20), + title: Text(context.l10n.appSettings_clearPathOnMaxRetry), + subtitle: Text( + context.l10n.appSettings_clearPathOnMaxRetrySubtitle, + ), + value: settingsService.settings.clearPathOnMaxRetry, + onChanged: (value) { + settingsService.setClearPathOnMaxRetry(value); + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_pathsWillBeCleared + : context.l10n.appSettings_pathsWillNotBeCleared, + ), + duration: const Duration(seconds: 2), + ); + }, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.vertical_align_top, size: 20), + title: Text(context.l10n.appSettings_jumpToOldestUnread), + subtitle: Text(context.l10n.appSettings_jumpToOldestUnreadSubtitle), + value: settingsService.settings.jumpToOldestUnread, + onChanged: settingsService.setJumpToOldestUnread, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.alt_route, size: 20), + title: Text(context.l10n.appSettings_autoRouteRotation), + subtitle: Text(context.l10n.appSettings_autoRouteRotationSubtitle), + value: autoRouteEnabled, + onChanged: (value) { + settingsService.setAutoRouteRotationEnabled(value); + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_autoRouteRotationEnabled + : context.l10n.appSettings_autoRouteRotationDisabled, + ), + duration: const Duration(seconds: 2), + ); + }, + ), + // AnimatedSize sub-options for auto-route rotation + AnimatedSize( + duration: const Duration(milliseconds: 200), + alignment: Alignment.topCenter, + child: autoRouteEnabled + ? Container( + color: Theme.of(context).colorScheme.surfaceContainerHighest, + padding: const EdgeInsets.only(left: 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(height: 1), + ListTile( + title: Text(context.l10n.appSettings_maxRouteWeight), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_maxRouteWeightSubtitle, + ), + Slider( + value: settingsService.settings.maxRouteWeight, + min: 1, + max: 10, + divisions: 9, + label: settingsService.settings.maxRouteWeight + .round() + .toString(), + onChanged: (value) => + settingsService.setMaxRouteWeight(value), + ), + ], + ), ), - duration: const Duration(seconds: 2), + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_initialRouteWeight, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_initialRouteWeightSubtitle, + ), + Slider( + value: + settingsService.settings.initialRouteWeight, + min: 0.5, + max: 5.0, + divisions: 9, + label: settingsService + .settings + .initialRouteWeight + .toStringAsFixed(1), + onChanged: (value) => + settingsService.setInitialRouteWeight(value), + ), + ], + ), + ), + const Divider(height: 1), + ListTile( + title: Text( + context + .l10n + .appSettings_routeWeightSuccessIncrement, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_routeWeightSuccessIncrementSubtitle, + ), + Slider( + value: settingsService + .settings + .routeWeightSuccessIncrement, + min: 0.1, + max: 2.0, + divisions: 19, + label: settingsService + .settings + .routeWeightSuccessIncrement + .toStringAsFixed(1), + onChanged: (value) => settingsService + .setRouteWeightSuccessIncrement(value), + ), + ], + ), + ), + const Divider(height: 1), + ListTile( + title: Text( + context + .l10n + .appSettings_routeWeightFailureDecrement, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_routeWeightFailureDecrementSubtitle, + ), + Slider( + value: settingsService + .settings + .routeWeightFailureDecrement, + min: 0.1, + max: 2.0, + divisions: 19, + label: settingsService + .settings + .routeWeightFailureDecrement + .toStringAsFixed(1), + onChanged: (value) => settingsService + .setRouteWeightFailureDecrement(value), + ), + ], + ), + ), + const Divider(height: 1), + ListTile( + title: Text( + context.l10n.appSettings_maxMessageRetries, + ), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context + .l10n + .appSettings_maxMessageRetriesSubtitle, + ), + Slider( + value: settingsService + .settings + .maxMessageRetries + .toDouble(), + min: 2, + max: 10, + divisions: 8, + label: settingsService + .settings + .maxMessageRetries + .toString(), + onChanged: (value) => settingsService + .setMaxMessageRetries(value.toInt()), + ), + ], + ), + ), + ], + ), + ) + : const SizedBox.shrink(), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.location_searching, size: 20), + title: Text(context.l10n.appSettings_enableMessageTracing), + subtitle: Text( + context.l10n.appSettings_enableMessageTracingSubtitle, + ), + value: settingsService.settings.enableMessageTracing, + onChanged: (value) { + settingsService.setEnableMessageTracing(value); + }, + ), + ], + ); + } + + Widget _buildBatteryContent( + BuildContext context, + AppSettingsService settingsService, + MeshCoreConnector connector, + ) { + final deviceId = connector.deviceId; + final isConnected = connector.isConnected && deviceId != null; + final selection = isConnected + ? settingsService.batteryChemistryForDevice(deviceId) + : 'nmc'; + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.only(top: 12, bottom: 4), + child: Row( + children: [ + Icon( + Icons.battery_full, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_batteryChemistry, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + isConnected + ? context.l10n.appSettings_batteryChemistryPerDevice( + connector.deviceDisplayName, + ) + : context + .l10n + .appSettings_batteryChemistryConnectFirst, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: 8), + DropdownButtonFormField( + initialValue: selection, + isExpanded: true, + decoration: const InputDecoration( + border: UnderlineInputBorder(), + isDense: true, + ), + onChanged: isConnected + ? (value) { + if (value != null) { + settingsService.setBatteryChemistryForDevice( + deviceId, + value, ); } - return; } - } - - await settingsService.setNotificationsEnabled(value); - if (context.mounted) { - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_notificationsEnabled - : context.l10n.appSettings_notificationsDisabled, - ), - duration: const Duration(seconds: 2), - ); - } - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.message_outlined, - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, + : null, + items: [ + DropdownMenuItem( + value: 'nmc', + child: Text(context.l10n.appSettings_batteryNmc), ), - title: Text( - context.l10n.appSettings_messageNotifications, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), + DropdownMenuItem( + value: 'lifepo4', + child: Text(context.l10n.appSettings_batteryLifepo4), ), - subtitle: Text( - context.l10n.appSettings_messageNotificationsSubtitle, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), + DropdownMenuItem( + value: 'lipo', + child: Text(context.l10n.appSettings_batteryLipo), ), - value: settingsService.settings.notifyOnNewMessage, - onChanged: settingsService.settings.notificationsEnabled - ? (value) { - settingsService.setNotifyOnNewMessage(value); - } - : null, - ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.forum_outlined, - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), - title: Text( - context.l10n.appSettings_channelMessageNotifications, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - subtitle: Text( - context.l10n.appSettings_channelMessageNotificationsSubtitle, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - value: settingsService.settings.notifyOnNewChannelMessage, - onChanged: settingsService.settings.notificationsEnabled - ? (value) { - settingsService.setNotifyOnNewChannelMessage(value); - } - : null, - ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.cell_tower, - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), - title: Text( - context.l10n.appSettings_advertisementNotifications, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - subtitle: Text( - context.l10n.appSettings_advertisementNotificationsSubtitle, - style: TextStyle( - color: settingsService.settings.notificationsEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - value: settingsService.settings.notifyOnNewAdvert, - onChanged: settingsService.settings.notificationsEnabled - ? (value) { - settingsService.setNotifyOnNewAdvert(value); - } - : null, - ), - ], - ), + ], + ), + ], ); } - Widget _buildMessagingCard( + Widget _buildMapContent( BuildContext context, AppSettingsService settingsService, ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_messaging, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Column( + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, ), - SwitchListTile( - secondary: const Icon(Icons.refresh_outlined), - title: Text(context.l10n.appSettings_clearPathOnMaxRetry), - subtitle: Text( - context.l10n.appSettings_clearPathOnMaxRetrySubtitle, - ), - value: settingsService.settings.clearPathOnMaxRetry, - onChanged: (value) { - settingsService.setClearPathOnMaxRetry(value); - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_pathsWillBeCleared - : context.l10n.appSettings_pathsWillNotBeCleared, + secondary: const Icon(Icons.router_outlined, size: 20), + title: Text(context.l10n.appSettings_showRepeaters), + subtitle: Text(context.l10n.appSettings_showRepeatersSubtitle), + value: settingsService.settings.mapShowRepeaters, + onChanged: (value) => settingsService.setMapShowRepeaters(value), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.chat_outlined, size: 20), + title: Text(context.l10n.appSettings_showChatNodes), + subtitle: Text(context.l10n.appSettings_showChatNodesSubtitle), + value: settingsService.settings.mapShowChatNodes, + onChanged: (value) => settingsService.setMapShowChatNodes(value), + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.people_outline, size: 20), + title: Text(context.l10n.appSettings_showOtherNodes), + subtitle: Text(context.l10n.appSettings_showOtherNodesSubtitle), + value: settingsService.settings.mapShowOtherNodes, + onChanged: (value) => settingsService.setMapShowOtherNodes(value), + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showTimeFilterSheet(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.timer_outlined, + size: 20, + color: scheme.onSurfaceVariant, ), - duration: const Duration(seconds: 2), - ); - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.vertical_align_top), - title: Text(context.l10n.appSettings_jumpToOldestUnread), - subtitle: Text(context.l10n.appSettings_jumpToOldestUnreadSubtitle), - value: settingsService.settings.jumpToOldestUnread, - onChanged: settingsService.setJumpToOldestUnread, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.alt_route), - title: Text(context.l10n.appSettings_autoRouteRotation), - subtitle: Text(context.l10n.appSettings_autoRouteRotationSubtitle), - value: settingsService.settings.autoRouteRotationEnabled, - onChanged: (value) { - settingsService.setAutoRouteRotationEnabled(value); - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_autoRouteRotationEnabled - : context.l10n.appSettings_autoRouteRotationDisabled, + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_timeFilter, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + settingsService.settings.mapTimeFilterHours == 0 + ? context.l10n.appSettings_timeFilterShowAll + : context.l10n.appSettings_timeFilterShowLast( + settingsService + .settings + .mapTimeFilterHours + .toInt(), + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), ), - duration: const Duration(seconds: 2), - ); - }, - ), - if (settingsService.settings.autoRouteRotationEnabled) - Container( - color: Theme.of(context).colorScheme.surfaceContainerHighest, - padding: const EdgeInsets.only(left: 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_maxRouteWeight), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.appSettings_maxRouteWeightSubtitle), - Slider( - value: settingsService.settings.maxRouteWeight, - min: 1, - max: 10, - divisions: 9, - label: settingsService.settings.maxRouteWeight - .round() - .toString(), - onChanged: (value) => - settingsService.setMaxRouteWeight(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_initialRouteWeight), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.appSettings_initialRouteWeightSubtitle, - ), - Slider( - value: settingsService.settings.initialRouteWeight, - min: 0.5, - max: 5.0, - divisions: 9, - label: settingsService.settings.initialRouteWeight - .toStringAsFixed(1), - onChanged: (value) => - settingsService.setInitialRouteWeight(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text( - context.l10n.appSettings_routeWeightSuccessIncrement, - ), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context - .l10n - .appSettings_routeWeightSuccessIncrementSubtitle, - ), - Slider( - value: settingsService - .settings - .routeWeightSuccessIncrement, - min: 0.1, - max: 2.0, - divisions: 19, - label: settingsService - .settings - .routeWeightSuccessIncrement - .toStringAsFixed(1), - onChanged: (value) => settingsService - .setRouteWeightSuccessIncrement(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text( - context.l10n.appSettings_routeWeightFailureDecrement, - ), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context - .l10n - .appSettings_routeWeightFailureDecrementSubtitle, - ), - Slider( - value: settingsService - .settings - .routeWeightFailureDecrement, - min: 0.1, - max: 2.0, - divisions: 19, - label: settingsService - .settings - .routeWeightFailureDecrement - .toStringAsFixed(1), - onChanged: (value) => settingsService - .setRouteWeightFailureDecrement(value), - ), - ], - ), - ), - const Divider(height: 1), - ListTile( - title: Text(context.l10n.appSettings_maxMessageRetries), - subtitle: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.appSettings_maxMessageRetriesSubtitle, - ), - Slider( - value: settingsService.settings.maxMessageRetries - .toDouble(), - min: 2, - max: 10, - divisions: 8, - label: settingsService.settings.maxMessageRetries - .toString(), - onChanged: (value) => settingsService - .setMaxMessageRetries(value.toInt()), - ), - ], - ), - ), - ], - ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.location_searching), - title: Text(context.l10n.appSettings_enableMessageTracing), - subtitle: Text( - context.l10n.appSettings_enableMessageTracingSubtitle, - ), - value: settingsService.settings.enableMessageTracing, - onChanged: (value) { - settingsService.setEnableMessageTracing(value); - }, ), - ], - ), + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => _showUnitsSheet(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.straighten, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_unitsTitle, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + settingsService.settings.unitSystem == + UnitSystem.imperial + ? context.l10n.appSettings_unitsImperial + : context.l10n.appSettings_unitsMetric, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], + ), + ), + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => const MapCacheScreen()), + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.download_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_offlineMapCache, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + settingsService.settings.mapCacheBounds == null + ? context.l10n.appSettings_noAreaSelected + : context.l10n.appSettings_areaSelectedZoom( + settingsService.settings.mapCacheMinZoom, + settingsService.settings.mapCacheMaxZoom, + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], + ), + ), + ), + ], ); } - Widget _buildMapSettingsCard( - BuildContext context, - AppSettingsService settingsService, - ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_mapDisplay, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - SwitchListTile( - secondary: const Icon(Icons.router_outlined), - title: Text(context.l10n.appSettings_showRepeaters), - subtitle: Text(context.l10n.appSettings_showRepeatersSubtitle), - value: settingsService.settings.mapShowRepeaters, - onChanged: (value) { - settingsService.setMapShowRepeaters(value); - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.chat_outlined), - title: Text(context.l10n.appSettings_showChatNodes), - subtitle: Text(context.l10n.appSettings_showChatNodesSubtitle), - value: settingsService.settings.mapShowChatNodes, - onChanged: (value) { - settingsService.setMapShowChatNodes(value); - }, - ), - const Divider(height: 1), - SwitchListTile( - secondary: const Icon(Icons.people_outline), - title: Text(context.l10n.appSettings_showOtherNodes), - subtitle: Text(context.l10n.appSettings_showOtherNodesSubtitle), - value: settingsService.settings.mapShowOtherNodes, - onChanged: (value) { - settingsService.setMapShowOtherNodes(value); - }, - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.timer_outlined), - title: Text(context.l10n.appSettings_timeFilter), - subtitle: Text( - settingsService.settings.mapTimeFilterHours == 0 - ? context.l10n.appSettings_timeFilterShowAll - : context.l10n.appSettings_timeFilterShowLast( - settingsService.settings.mapTimeFilterHours.toInt(), - ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showTimeFilterDialog(context, settingsService), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.straighten), - title: Text(context.l10n.appSettings_unitsTitle), - subtitle: Text( - settingsService.settings.unitSystem == UnitSystem.imperial - ? context.l10n.appSettings_unitsImperial - : context.l10n.appSettings_unitsMetric, - ), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showUnitsDialog(context, settingsService), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(context.l10n.appSettings_offlineMapCache), - subtitle: Text( - settingsService.settings.mapCacheBounds == null - ? context.l10n.appSettings_noAreaSelected - : context.l10n.appSettings_areaSelectedZoom( - settingsService.settings.mapCacheMinZoom, - settingsService.settings.mapCacheMaxZoom, - ), - ), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const MapCacheScreen()), - ); - }, - ), - ], - ), - ); - } - - Widget _buildTranslationCard( + Widget _buildTranslationContent( BuildContext context, AppSettingsService settingsService, TranslationService translationService, ) { final settings = settingsService.settings; final translationEnabled = settings.translationEnabled; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.translation_title, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: const Icon(Icons.translate, size: 20), + title: Text(context.l10n.translation_enableTitle), + subtitle: Text(context.l10n.translation_enableSubtitle), + value: settings.translationEnabled, + onChanged: settingsService.setTranslationEnabled, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + secondary: Icon( + Icons.auto_awesome_outlined, + size: 20, + color: translationEnabled ? null : Theme.of(context).disabledColor, + ), + title: Text( + context.l10n.translation_autoIncomingTitle, + style: TextStyle( + color: + translationEnabled ? null : Theme.of(context).disabledColor, ), ), - SwitchListTile( - secondary: const Icon(Icons.translate), - title: Text(context.l10n.translation_enableTitle), - subtitle: Text(context.l10n.translation_enableSubtitle), - value: settings.translationEnabled, - onChanged: settingsService.setTranslationEnabled, + subtitle: Text( + context.l10n.translation_autoIncomingSubtitle, + style: TextStyle( + color: + translationEnabled ? null : Theme.of(context).disabledColor, + ), ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.auto_awesome_outlined, - color: translationEnabled - ? null - : Theme.of(context).disabledColor, - ), - title: Text( - context.l10n.translation_autoIncomingTitle, - style: TextStyle( - color: translationEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - subtitle: Text( - context.l10n.translation_autoIncomingSubtitle, - style: TextStyle( - color: translationEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - value: settings.autoTranslateIncomingMessages, - onChanged: translationEnabled - ? settingsService.setAutoTranslateIncomingMessages - : null, + value: settings.autoTranslateIncomingMessages, + onChanged: translationEnabled + ? settingsService.setAutoTranslateIncomingMessages + : null, + ), + const Divider(height: 1, indent: 16), + SwitchListTile( + contentPadding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, ), - const Divider(height: 1), - SwitchListTile( - secondary: Icon( - Icons.outgoing_mail, - color: translationEnabled - ? null - : Theme.of(context).disabledColor, - ), - title: Text( - context.l10n.translation_composerTitle, - style: TextStyle( - color: translationEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - subtitle: Text( - context.l10n.translation_composerSubtitle, - style: TextStyle( - color: translationEnabled - ? null - : Theme.of(context).disabledColor, - ), - ), - value: settings.composerTranslationEnabled, - onChanged: translationEnabled - ? settingsService.setComposerTranslationEnabled - : null, + secondary: Icon( + Icons.outgoing_mail, + size: 20, + color: translationEnabled ? null : Theme.of(context).disabledColor, ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.language), - title: Text(context.l10n.translation_targetLanguage), - subtitle: Text( - _translationLanguageLabel( - context, - settings.translationTargetLanguageCode, - ), + title: Text( + context.l10n.translation_composerTitle, + style: TextStyle( + color: + translationEnabled ? null : Theme.of(context).disabledColor, ), - trailing: const Icon(Icons.chevron_right), - onTap: () => - _showTranslationLanguageDialog(context, settingsService), ), - const Divider(height: 1), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), - child: DropdownButtonFormField( - initialValue: settings.translationSelectedModelId, - isExpanded: true, - decoration: InputDecoration( - labelText: context.l10n.translation_downloadedModelLabel, - border: const OutlineInputBorder(), - ), - items: [ - for (final model in settings.translationDownloadedModels) - DropdownMenuItem( - value: model.id, - child: Text(translationModelFriendlyName(model)), + subtitle: Text( + context.l10n.translation_composerSubtitle, + style: TextStyle( + color: + translationEnabled ? null : Theme.of(context).disabledColor, + ), + ), + value: settings.composerTranslationEnabled, + onChanged: translationEnabled + ? settingsService.setComposerTranslationEnabled + : null, + ), + const Divider(height: 1, indent: 16), + InkWell( + onTap: () => + _showTranslationLanguageDialog(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.language, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.translation_targetLanguage, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _translationLanguageLabel( + context, + settings.translationTargetLanguageCode, + ), + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), ], - onChanged: settings.translationDownloadedModels.isEmpty - ? null - : (value) { - settingsService.setTranslationSelectedModelId(value); - }, ), ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), - child: DropdownButtonFormField( - initialValue: null, - isExpanded: true, - decoration: InputDecoration( - labelText: context.l10n.translation_presetModelLabel, - border: const OutlineInputBorder(), - ), - items: [ - for (final preset in translationPresetModels) - DropdownMenuItem( - value: preset.sourceUrl, - child: Text(translationModelFriendlyName(preset)), - ), - ], - onChanged: translationService.isBusy - ? null - : (value) async { - if (value == null) return; - final preset = translationPresetModels.firstWhere( - (entry) => entry.sourceUrl == value, - ); - await _downloadTranslationModel( + ), + const Divider(height: 1, indent: 16), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: DropdownButtonFormField( + initialValue: settings.translationSelectedModelId, + isExpanded: true, + decoration: InputDecoration( + labelText: context.l10n.translation_downloadedModelLabel, + border: const OutlineInputBorder(), + ), + items: [ + for (final model in settings.translationDownloadedModels) + DropdownMenuItem( + value: model.id, + child: Text(translationModelFriendlyName(model)), + ), + ], + onChanged: settings.translationDownloadedModels.isEmpty + ? null + : (value) { + settingsService.setTranslationSelectedModelId(value); + }, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: DropdownButtonFormField( + initialValue: null, + isExpanded: true, + decoration: InputDecoration( + labelText: context.l10n.translation_presetModelLabel, + border: const OutlineInputBorder(), + ), + items: [ + for (final preset in translationPresetModels) + DropdownMenuItem( + value: preset.sourceUrl, + child: Text(translationModelFriendlyName(preset)), + ), + ], + onChanged: translationService.isBusy + ? null + : (value) async { + if (value == null) return; + final preset = translationPresetModels.firstWhere( + (entry) => entry.sourceUrl == value, + ); + await _downloadTranslationModel( + context, + translationService, + settingsService, + sourceUrl: preset.sourceUrl, + fileName: preset.name, + id: preset.id, + ); + }, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _TranslationUrlField( + initialValue: settings.translationModelSourceUrl ?? '', + onChanged: settingsService.setTranslationModelSourceUrl, + onDownload: translationService.isBusy + ? null + : (url) => _downloadTranslationModel( context, translationService, settingsService, - sourceUrl: preset.sourceUrl, - fileName: preset.name, - id: preset.id, - ); - }, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), - child: Column( - children: [ - _TranslationUrlField( - initialValue: settings.translationModelSourceUrl ?? '', - onChanged: settingsService.setTranslationModelSourceUrl, - onDownload: translationService.isBusy - ? null - : (url) => _downloadTranslationModel( - context, - translationService, - settingsService, - sourceUrl: url, - ), - downloadLabel: translationService.isDownloading - ? context.l10n.translation_downloading - : translationService.isBusy - ? context.l10n.translation_working - : context.l10n.translation_downloadModel, - isDownloading: translationService.isDownloading, - onCancel: translationService.cancelDownload, - labelText: context.l10n.translation_manualUrlLabel, - stopLabel: context.l10n.translation_stop, - ), - if (translationService.isDownloading) ...[ - const SizedBox(height: 12), - LinearProgressIndicator( - value: - translationService.downloadFileName == + sourceUrl: url, + ), + downloadLabel: translationService.isDownloading + ? context.l10n.translation_downloading + : translationService.isBusy + ? context.l10n.translation_working + : context.l10n.translation_downloadModel, + isDownloading: translationService.isDownloading, + onCancel: translationService.cancelDownload, + labelText: context.l10n.translation_manualUrlLabel, + stopLabel: context.l10n.translation_stop, + ), + if (translationService.isDownloading) ...[ + const SizedBox(height: 12), + ClipRRect( + borderRadius: BorderRadius.circular(2), + child: LinearProgressIndicator( + value: translationService.downloadFileName == 'Merging chunks...' ? null : translationService.downloadProgress, ), - const SizedBox(height: 8), - Align( - alignment: Alignment.centerLeft, - child: Text( - _downloadProgressLabel(context, translationService), - style: Theme.of(context).textTheme.bodySmall, + ), + const SizedBox(height: 8), + Align( + alignment: Alignment.centerLeft, + child: Text( + _downloadProgressLabel(context, translationService), + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSurfaceVariant, ), ), - ], - if (settings.translationDownloadedModels.isNotEmpty) ...[ - const SizedBox(height: 16), - Align( - alignment: Alignment.centerLeft, - child: Text( - context.l10n.translation_downloadedModels, - style: Theme.of(context).textTheme.titleSmall, - ), + ), + ], + if (settings.translationDownloadedModels.isNotEmpty) ...[ + const SizedBox(height: 16), + Align( + alignment: Alignment.centerLeft, + child: Text( + context.l10n.translation_downloadedModels, + style: Theme.of(context).textTheme.titleSmall, ), - const SizedBox(height: 8), - for (final model in settings.translationDownloadedModels) - Card.outlined( - margin: const EdgeInsets.only(bottom: 8), - child: ListTile( - contentPadding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 4, - ), - leading: Icon( + ), + const SizedBox(height: 8), + for (final model in settings.translationDownloadedModels) + Padding( + padding: const EdgeInsets.only(bottom: 8), + child: Row( + children: [ + Icon( model.id == settings.translationSelectedModelId ? Icons.check_circle : Icons.memory_outlined, + size: 20, + color: model.id == settings.translationSelectedModelId + ? scheme.primary + : scheme.onSurfaceVariant, ), - title: Text(translationModelFriendlyName(model)), - subtitle: Text(_downloadedModelLabel(model)), - trailing: IconButton( + const SizedBox(width: 12), + Expanded( + child: InkWell( + borderRadius: + BorderRadius.circular(MeshRadii.xs), + onTap: () => settingsService + .setTranslationSelectedModelId(model.id), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + translationModelFriendlyName(model), + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + Text( + _downloadedModelLabel(model), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ), + IconButton( tooltip: context.l10n.translation_deleteModel, onPressed: translationService.isBusy ? null @@ -831,105 +1186,119 @@ class AppSettingsScreen extends StatelessWidget { ), icon: const Icon(Icons.delete_outline), ), - onTap: () => settingsService - .setTranslationSelectedModelId(model.id), - ), - ), - ], - if (translationService.lastError != null) ...[ - const SizedBox(height: 8), - Text( - translationService.lastError!, - style: TextStyle( - color: Theme.of(context).colorScheme.error, + ], ), ), - ], ], - ), + if (translationService.lastError != null) ...[ + const SizedBox(height: 8), + Text( + translationService.lastError!, + style: TextStyle( + color: Theme.of(context).colorScheme.error, + ), + ), + ], + ], ), - ], - ), + ), + ], ); } - // Fixed rendering issues - Widget _buildBatteryCard( + Widget _buildCyr2LatContent( BuildContext context, AppSettingsService settingsService, - MeshCoreConnector connector, ) { - final deviceId = connector.deviceId; - final isConnected = connector.isConnected && deviceId != null; - final selection = isConnected - ? settingsService.batteryChemistryForDevice(deviceId) - : 'nmc'; - - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 4), - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_battery, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), + final selectedProfile = settingsService.getSelectedCyr2LatProfile(); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 8), + DropdownButtonFormField( + initialValue: settingsService.settings.selectedCyr2latProfileId, + decoration: InputDecoration( + labelText: context.l10n.channels_cyr2latSettingsSubheading, + border: const OutlineInputBorder(), ), - - // Main tile (icon + text only) - ListTile( - leading: const Icon(Icons.battery_full), - title: Text(context.l10n.appSettings_batteryChemistry), - subtitle: Text( - isConnected - ? context.l10n.appSettings_batteryChemistryPerDevice( - connector.deviceDisplayName, - ) - : context.l10n.appSettings_batteryChemistryConnectFirst, - ), - contentPadding: const EdgeInsets.symmetric(horizontal: 16), - ), - - // Dropdown (separate full-width row) - Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: DropdownButtonFormField( - initialValue: selection, - isExpanded: true, - decoration: const InputDecoration( - border: UnderlineInputBorder(), - isDense: true, + items: settingsService.settings.cyr2latProfiles.map((profile) { + return DropdownMenuItem( + value: profile.id, + child: Text(profile.name), + ); + }).toList(), + onChanged: (value) { + if (value != null) { + settingsService.setSelectedCyr2LatProfile(value); + } + }, + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: OutlinedButton.icon( + onPressed: () => + _showAddCyr2LatProfileDialog(context, settingsService), + icon: const Icon(Icons.add), + label: Text(context.l10n.common_add), ), - onChanged: isConnected - ? (value) { - if (value != null) { - settingsService.setBatteryChemistryForDevice( - deviceId, - value, - ); - } - } - : null, - items: [ - DropdownMenuItem( - value: 'nmc', - child: Text(context.l10n.appSettings_batteryNmc), - ), - DropdownMenuItem( - value: 'lifepo4', - child: Text(context.l10n.appSettings_batteryLifepo4), - ), - DropdownMenuItem( - value: 'lipo', - child: Text(context.l10n.appSettings_batteryLipo), - ), - ], ), + const SizedBox(width: 8), + Expanded( + child: OutlinedButton.icon( + onPressed: () => _showEditCyr2LatProfileDialog( + context, + settingsService, + selectedProfile, + ), + icon: const Icon(Icons.edit), + label: Text(context.l10n.common_edit), + ), + ), + const SizedBox(width: 8), + Expanded( + child: OutlinedButton.icon( + onPressed: settingsService.settings.cyr2latProfiles.length > 1 + ? () => _showDeleteCyr2LatProfileDialog( + context, + settingsService, + selectedProfile, + ) + : null, + icon: const Icon(Icons.delete), + label: Text(context.l10n.common_delete), + ), + ), + ], + ), + ], + ); + } + + Widget _buildDebugContent( + BuildContext context, + AppSettingsService settingsService, + ) { + return SwitchListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + secondary: const Icon(Icons.bug_report_outlined, size: 20), + title: Text(context.l10n.appSettings_appDebugLogging), + subtitle: Text(context.l10n.appSettings_appDebugLoggingSubtitle), + value: settingsService.settings.appDebugLogEnabled, + onChanged: (value) async { + await settingsService.setAppDebugLogEnabled(value); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text( + value + ? context.l10n.appSettings_appDebugLoggingEnabled + : context.l10n.appSettings_appDebugLoggingDisabled, ), - ], - ), + duration: const Duration(seconds: 2), + ); + }, ); } @@ -976,208 +1345,363 @@ class AppSettingsScreen extends StatelessWidget { } } - void _showLanguageDialog( + void _showLanguageSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_language), - content: SingleChildScrollView( - child: RadioGroup( - groupValue: settingsService.settings.languageOverride, - onChanged: (value) { - settingsService.setLanguageOverride(value); - Navigator.pop(context); - }, - child: Column( - mainAxisSize: MainAxisSize.min, + showMeshSheet( + context, + builder: (ctx) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.appSettings_language), + SizedBox( + height: 400, + child: ListView( children: [ - RadioListTile( - title: Text(context.l10n.appSettings_languageSystem), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSystem, value: null, + selected: settingsService.settings.languageOverride == null, + onTap: () { + settingsService.setLanguageOverride(null); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageEn), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageEn, value: 'en', + selected: + settingsService.settings.languageOverride == 'en', + onTap: () { + settingsService.setLanguageOverride('en'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageFr), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageFr, value: 'fr', + selected: + settingsService.settings.languageOverride == 'fr', + onTap: () { + settingsService.setLanguageOverride('fr'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageEs), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageEs, value: 'es', + selected: + settingsService.settings.languageOverride == 'es', + onTap: () { + settingsService.setLanguageOverride('es'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageDe), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageDe, value: 'de', + selected: + settingsService.settings.languageOverride == 'de', + onTap: () { + settingsService.setLanguageOverride('de'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languagePl), + _sheetOption( + ctx, + label: context.l10n.appSettings_languagePl, value: 'pl', + selected: + settingsService.settings.languageOverride == 'pl', + onTap: () { + settingsService.setLanguageOverride('pl'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageSl), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSl, value: 'sl', + selected: + settingsService.settings.languageOverride == 'sl', + onTap: () { + settingsService.setLanguageOverride('sl'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languagePt), + _sheetOption( + ctx, + label: context.l10n.appSettings_languagePt, value: 'pt', + selected: + settingsService.settings.languageOverride == 'pt', + onTap: () { + settingsService.setLanguageOverride('pt'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageIt), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageIt, value: 'it', + selected: + settingsService.settings.languageOverride == 'it', + onTap: () { + settingsService.setLanguageOverride('it'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageZh), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageZh, value: 'zh', + selected: + settingsService.settings.languageOverride == 'zh', + onTap: () { + settingsService.setLanguageOverride('zh'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageSv), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSv, value: 'sv', + selected: + settingsService.settings.languageOverride == 'sv', + onTap: () { + settingsService.setLanguageOverride('sv'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageNl), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageNl, value: 'nl', + selected: + settingsService.settings.languageOverride == 'nl', + onTap: () { + settingsService.setLanguageOverride('nl'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageSk), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageSk, value: 'sk', + selected: + settingsService.settings.languageOverride == 'sk', + onTap: () { + settingsService.setLanguageOverride('sk'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageBg), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageBg, value: 'bg', + selected: + settingsService.settings.languageOverride == 'bg', + onTap: () { + settingsService.setLanguageOverride('bg'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageRu), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageRu, value: 'ru', + selected: + settingsService.settings.languageOverride == 'ru', + onTap: () { + settingsService.setLanguageOverride('ru'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageUk), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageUk, value: 'uk', + selected: + settingsService.settings.languageOverride == 'uk', + onTap: () { + settingsService.setLanguageOverride('uk'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageHu), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageHu, value: 'hu', + selected: + settingsService.settings.languageOverride == 'hu', + onTap: () { + settingsService.setLanguageOverride('hu'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageJa), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageJa, value: 'ja', + selected: + settingsService.settings.languageOverride == 'ja', + onTap: () { + settingsService.setLanguageOverride('ja'); + Navigator.pop(ctx); + }, ), - RadioListTile( - title: Text(context.l10n.appSettings_languageKo), + _sheetOption( + ctx, + label: context.l10n.appSettings_languageKo, value: 'ko', + selected: + settingsService.settings.languageOverride == 'ko', + onTap: () { + settingsService.setLanguageOverride('ko'); + Navigator.pop(ctx); + }, ), + SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8), ], ), ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), - ), ], ), ); } - void _showTimeFilterDialog( + void _showTimeFilterSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_mapTimeFilter), - content: RadioGroup( - groupValue: settingsService.settings.mapTimeFilterHours, - onChanged: (value) { - if (value != null) { - settingsService.setMapTimeFilterHours(value); - Navigator.pop(context); - } - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text(context.l10n.appSettings_showNodesDiscoveredWithin), - const SizedBox(height: 16), - RadioListTile( - title: Text(context.l10n.appSettings_allTime), - value: 0, - ), - RadioListTile( - title: Text(context.l10n.appSettings_lastHour), - value: 1, - ), - RadioListTile( - title: Text(context.l10n.appSettings_last6Hours), - value: 6, - ), - RadioListTile( - title: Text(context.l10n.appSettings_last24Hours), - value: 24, - ), - RadioListTile( - title: Text(context.l10n.appSettings_lastWeek), - value: 168, - ), - ], + showMeshSheet( + context, + builder: (ctx) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.appSettings_mapTimeFilter), + Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 8), + child: Text(context.l10n.appSettings_showNodesDiscoveredWithin), ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), + _sheetOption( + ctx, + label: context.l10n.appSettings_allTime, + value: 0, + selected: settingsService.settings.mapTimeFilterHours == 0, + onTap: () { + settingsService.setMapTimeFilterHours(0); + Navigator.pop(ctx); + }, ), + _sheetOption( + ctx, + label: context.l10n.appSettings_lastHour, + value: 1, + selected: settingsService.settings.mapTimeFilterHours == 1, + onTap: () { + settingsService.setMapTimeFilterHours(1); + Navigator.pop(ctx); + }, + ), + _sheetOption( + ctx, + label: context.l10n.appSettings_last6Hours, + value: 6, + selected: settingsService.settings.mapTimeFilterHours == 6, + onTap: () { + settingsService.setMapTimeFilterHours(6); + Navigator.pop(ctx); + }, + ), + _sheetOption( + ctx, + label: context.l10n.appSettings_last24Hours, + value: 24, + selected: settingsService.settings.mapTimeFilterHours == 24, + onTap: () { + settingsService.setMapTimeFilterHours(24); + Navigator.pop(ctx); + }, + ), + _sheetOption( + ctx, + label: context.l10n.appSettings_lastWeek, + value: 168, + selected: settingsService.settings.mapTimeFilterHours == 168, + onTap: () { + settingsService.setMapTimeFilterHours(168); + Navigator.pop(ctx); + }, + ), + SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8), ], ), ); } - void _showUnitsDialog( + void _showUnitsSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (context) => AlertDialog( - title: Text(context.l10n.appSettings_unitsTitle), - content: RadioGroup( - groupValue: settingsService.settings.unitSystem, - onChanged: (value) { - if (value != null) { - settingsService.setUnitSystem(value); - Navigator.pop(context); - } - }, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - RadioListTile( - title: Text(context.l10n.appSettings_unitsMetric), - value: UnitSystem.metric, - ), - RadioListTile( - title: Text(context.l10n.appSettings_unitsImperial), - value: UnitSystem.imperial, - ), - ], + showMeshSheet( + context, + builder: (ctx) => Column( + mainAxisSize: MainAxisSize.min, + children: [ + BottomSheetHeader(title: context.l10n.appSettings_unitsTitle), + _sheetOption( + ctx, + label: context.l10n.appSettings_unitsMetric, + value: UnitSystem.metric, + selected: + settingsService.settings.unitSystem == UnitSystem.metric, + onTap: () { + settingsService.setUnitSystem(UnitSystem.metric); + Navigator.pop(ctx); + }, ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(context), - child: Text(context.l10n.common_close), + _sheetOption( + ctx, + label: context.l10n.appSettings_unitsImperial, + value: UnitSystem.imperial, + selected: + settingsService.settings.unitSystem == UnitSystem.imperial, + onTap: () { + settingsService.setUnitSystem(UnitSystem.imperial); + Navigator.pop(ctx); + }, ), + SizedBox(height: MediaQuery.paddingOf(ctx).bottom + 8), ], ), ); } + Widget _sheetOption( + BuildContext context, { + required String label, + required T value, + required bool selected, + required VoidCallback onTap, + }) { + final scheme = Theme.of(context).colorScheme; + return ListTile( + leading: Icon( + selected ? Icons.radio_button_checked : Icons.radio_button_unchecked, + color: selected ? scheme.primary : scheme.onSurfaceVariant, + ), + title: Text(label), + onTap: onTap, + ); + } + void _showTranslationLanguageDialog( BuildContext context, AppSettingsService settingsService, @@ -1303,90 +1827,6 @@ class AppSettingsScreen extends StatelessWidget { return '${sizeMb.toStringAsFixed(1)} MB • $source'; } - Widget _buildCyr2LatCard( - BuildContext context, - AppSettingsService settingsService, - ) { - final selectedProfile = settingsService.getSelectedCyr2LatProfile(); - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.channels_cyr2latSettingsHeading, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 8), - child: DropdownButtonFormField( - initialValue: settingsService.settings.selectedCyr2latProfileId, - decoration: InputDecoration( - labelText: context.l10n.channels_cyr2latSettingsSubheading, - border: const OutlineInputBorder(), - ), - items: settingsService.settings.cyr2latProfiles.map((profile) { - return DropdownMenuItem( - value: profile.id, - child: Text(profile.name), - ); - }).toList(), - onChanged: (value) { - if (value != null) { - settingsService.setSelectedCyr2LatProfile(value); - } - }, - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: Row( - children: [ - Expanded( - child: OutlinedButton.icon( - onPressed: () => - _showAddCyr2LatProfileDialog(context, settingsService), - icon: const Icon(Icons.add), - label: Text(context.l10n.common_add), - ), - ), - const SizedBox(width: 8), - Expanded( - child: OutlinedButton.icon( - onPressed: () => _showEditCyr2LatProfileDialog( - context, - settingsService, - selectedProfile, - ), - icon: const Icon(Icons.edit), - label: Text(context.l10n.common_edit), - ), - ), - const SizedBox(width: 8), - Expanded( - child: OutlinedButton.icon( - onPressed: - settingsService.settings.cyr2latProfiles.length > 1 - ? () => _showDeleteCyr2LatProfileDialog( - context, - settingsService, - selectedProfile, - ) - : null, - icon: const Icon(Icons.delete), - label: Text(context.l10n.common_delete), - ), - ), - ], - ), - ), - ], - ), - ); - } - void _showAddCyr2LatProfileDialog( BuildContext context, AppSettingsService settingsService, @@ -1434,7 +1874,9 @@ class AppSettingsScreen extends StatelessWidget { if (nameController.text.isEmpty) { showDismissibleSnackBar( context, - content: Text(context.l10n.settings_cyr2latProfileNameEmpty), + content: Text( + context.l10n.settings_cyr2latProfileNameEmpty, + ), ); return; } @@ -1522,7 +1964,9 @@ class AppSettingsScreen extends StatelessWidget { if (nameController.text.isEmpty) { showDismissibleSnackBar( context, - content: Text(context.l10n.settings_cyr2latProfileNameEmpty), + content: Text( + context.l10n.settings_cyr2latProfileNameEmpty, + ), ); return; } @@ -1594,45 +2038,6 @@ class AppSettingsScreen extends StatelessWidget { ), ); } - - Widget _buildDebugCard( - BuildContext context, - AppSettingsService settingsService, - ) { - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - context.l10n.appSettings_debugCard, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - SwitchListTile( - secondary: const Icon(Icons.bug_report_outlined), - title: Text(context.l10n.appSettings_appDebugLogging), - subtitle: Text(context.l10n.appSettings_appDebugLoggingSubtitle), - value: settingsService.settings.appDebugLogEnabled, - onChanged: (value) async { - await settingsService.setAppDebugLogEnabled(value); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text( - value - ? context.l10n.appSettings_appDebugLoggingEnabled - : context.l10n.appSettings_appDebugLoggingDisabled, - ), - duration: const Duration(seconds: 2), - ); - }, - ), - ], - ), - ); - } } /// Owns the [TextEditingController] for the manual model URL field so it diff --git a/lib/screens/ble_debug_log_screen.dart b/lib/screens/ble_debug_log_screen.dart index 6d186970..c229c2e5 100644 --- a/lib/screens/ble_debug_log_screen.dart +++ b/lib/screens/ble_debug_log_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter/services.dart'; import '../l10n/l10n.dart'; import '../services/ble_debug_log_service.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; @@ -32,6 +33,7 @@ class _BleDebugLogScreenState extends State { return Scaffold( appBar: AppBar( title: AdaptiveAppBarTitle(context.l10n.debugLog_bleTitle), + centerTitle: true, actions: [ IconButton( tooltip: context.l10n.debugLog_copyLog, @@ -101,23 +103,14 @@ class _BleDebugLogScreenState extends State { itemCount: showingFrames ? entries.length : rawEntries.length, - separatorBuilder: (_, _) => const Divider(height: 1), + separatorBuilder: (_, _) => + const Divider(height: 1, color: MeshPalette.line), itemBuilder: (context, index) { if (showingFrames) { final entry = entries[index]; final time = '${entry.timestamp.hour.toString().padLeft(2, '0')}:${entry.timestamp.minute.toString().padLeft(2, '0')}:${entry.timestamp.second.toString().padLeft(2, '0')}'; - return ListTile( - dense: true, - title: Text(entry.description), - subtitle: Text('${entry.hexPreview}\n$time'), - isThreeLine: true, - leading: Icon( - entry.outgoing - ? Icons.upload - : Icons.download, - size: 18, - ), + return GestureDetector( onLongPress: () async { await Clipboard.setData( ClipboardData( @@ -131,6 +124,60 @@ class _BleDebugLogScreenState extends State { ), ); }, + child: Container( + color: MeshPalette.bg, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Icon( + entry.outgoing + ? Icons.upload + : Icons.download, + size: 18, + color: entry.outgoing + ? MeshPalette.blue + : MeshPalette.signal, + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + entry.description, + style: MeshTheme.mono( + fontSize: 11.5, + color: MeshPalette.ink, + ), + ), + const SizedBox(height: 2), + Text( + entry.hexPreview, + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + ), + const SizedBox(height: 2), + Text( + time, + style: MeshTheme.mono( + fontSize: 9.5, + color: MeshPalette.ink4, + ), + ), + ], + ), + ), + ], + ), + ), ); } @@ -138,18 +185,65 @@ class _BleDebugLogScreenState extends State { final info = _decodeRawPacket(entry.payload); final time = '${entry.timestamp.hour.toString().padLeft(2, '0')}:${entry.timestamp.minute.toString().padLeft(2, '0')}:${entry.timestamp.second.toString().padLeft(2, '0')}'; - return ListTile( - dense: true, - title: Text(info.title), - subtitle: Text('${info.summary}\n$time'), - isThreeLine: true, - leading: const Icon(Icons.download, size: 18), + return GestureDetector( onTap: () => _showRawDialog(context, info), + child: Container( + color: MeshPalette.bg, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Icon( + Icons.download, + size: 18, + color: MeshPalette.signal, + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + info.title, + style: MeshTheme.mono( + fontSize: 11.5, + color: MeshPalette.ink, + ), + ), + const SizedBox(height: 2), + Text( + info.summary, + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + ), + const SizedBox(height: 2), + Text( + time, + style: MeshTheme.mono( + fontSize: 9.5, + color: MeshPalette.ink4, + ), + ), + ], + ), + ), + ], + ), + ), ); }, ) : Center( - child: Text(context.l10n.debugLog_noBleActivity), + child: Text( + context.l10n.debugLog_noBleActivity, + style: const TextStyle(color: MeshPalette.ink3), + ), ), ), ], diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index e2c63c35..94101ef3 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -25,7 +25,6 @@ import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; import '../services/chat_text_scale_service.dart'; import '../services/translation_service.dart'; -import '../helpers/contact_ui.dart'; import '../widgets/byte_count_input.dart'; import '../widgets/empty_state.dart'; import '../widgets/chat_zoom_wrapper.dart'; @@ -39,6 +38,8 @@ import '../widgets/radio_stats_entry.dart'; import '../widgets/sync_progress_overlay.dart'; import '../widgets/translated_message_content.dart'; import '../widgets/unread_divider.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import 'channel_message_path_screen.dart'; import 'map_screen.dart'; @@ -108,7 +109,7 @@ class _ChannelChatScreenState extends State { totalMessages: messages.length, onJumped: () { if (!mounted) return; - _scrollToMessage(anchor!.messageId); + _scrollToMessage(anchor!.messageId, quiet: true); }, ); }); @@ -193,9 +194,12 @@ class _ChannelChatScreenState extends State { }); } - Future _scrollToMessage(String messageId) async { + Future _scrollToMessage(String messageId, {bool quiet = false}) async { final key = _messageKeys[messageId]; if (key == null) { + // The auto unread-jump can resolve a frame after navigating away; + // a deactivated context can't host a snackbar. + if (quiet || !mounted || !context.mounted) return; showDismissibleSnackBar( context, content: Text(context.l10n.chat_originalMessageNotFound), @@ -491,6 +495,7 @@ class _ChannelChatScreenState extends State { final settingsService = context.watch(); final enableTracing = settingsService.settings.enableMessageTracing; final isOutgoing = message.isOutgoing; + final scheme = Theme.of(context).colorScheme; final gifId = GifHelper.parseGif(message.text); final poi = parseMarkerText(message.text); final translatedDisplayText = @@ -507,9 +512,34 @@ class _ChannelChatScreenState extends State { ? message.pathVariants.first : Uint8List(0)); + // Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk. + final bubbleColor = isOutgoing + ? MeshPalette.me + : scheme.surfaceContainerLow; + final bubbleBorder = isOutgoing + ? MeshPalette.meBorder + : scheme.outlineVariant; + final textColor = isOutgoing ? MeshPalette.meInk : scheme.onSurface; + final metaColor = textColor.withValues(alpha: 0.65); + const bodyFontSize = 14.0; + + // Asymmetric radius matching chat_screen bubbles. + final borderRadius = isOutgoing + ? const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.lg), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.xs), + ) + : const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.xs), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.lg), + ); + const maxSwipeOffset = 64.0; const replySwipeThreshold = 64.0; - const bodyFontSize = 14.0; final messageBody = LayoutBuilder( builder: (context, constraints) => Column( crossAxisAlignment: isOutgoing @@ -520,11 +550,11 @@ class _ChannelChatScreenState extends State { mainAxisAlignment: isOutgoing ? MainAxisAlignment.end : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ if (!isOutgoing) ...[ _buildAvatar(message.senderName), - const SizedBox(width: 8), + const SizedBox(width: 6), ], Flexible( child: GestureDetector( @@ -540,15 +570,12 @@ class _ChannelChatScreenState extends State { vertical: 8, ), constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.65, + maxWidth: constraints.maxWidth * 0.72, ), decoration: BoxDecoration( - color: isOutgoing - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of( - context, - ).colorScheme.surfaceContainerHighest, - borderRadius: BorderRadius.circular(12), + color: bubbleColor, + borderRadius: borderRadius, + border: Border.all(color: bubbleBorder, width: 1), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -564,14 +591,14 @@ class _ChannelChatScreenState extends State { : EdgeInsets.zero, child: Text( message.senderName, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.primary, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: _colorForName(message.senderName), ), ), ), - if (gifId == null) const SizedBox(height: 4), + if (gifId == null) const SizedBox(height: 2), ], if (message.replyToMessageId != null) ...[ _buildReplyPreview(message, textScale), @@ -594,13 +621,9 @@ class _ChannelChatScreenState extends State { url: 'https://media.giphy.com/media/$gifId/giphy.gif', backgroundColor: Colors.transparent, - fallbackTextColor: isOutgoing - ? Theme.of(context) - .colorScheme - .onPrimaryContainer - .withValues(alpha: 0.7) - : Theme.of(context).colorScheme.onSurface - .withValues(alpha: 0.6), + fallbackTextColor: textColor.withValues( + alpha: 0.7, + ), ), ), ], @@ -615,40 +638,48 @@ class _ChannelChatScreenState extends State { displayText: translatedDisplayText, originalText: originalDisplayText, style: TextStyle( + color: textColor, fontSize: bodyFontSize * textScale, ), originalStyle: TextStyle( fontSize: bodyFontSize * textScale, fontStyle: FontStyle.italic, - color: Theme.of(context) - .colorScheme - .onSurface - .withValues(alpha: 0.72), + color: textColor.withValues(alpha: 0.72), ), ), ), ], ), if (enableTracing && displayPath.isNotEmpty) ...[ - const SizedBox(height: 4), + const SizedBox(height: 3), Padding( padding: gifId != null ? const EdgeInsets.symmetric(horizontal: 8) : EdgeInsets.zero, - child: Text( - context.l10n.channels_via( - _formatPathPrefixes(displayPath), - ), - style: TextStyle( - fontSize: 11 * textScale, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + RouteChip( + isDirect: (message.pathLength ?? -1) >= 0, + hops: (message.pathLength ?? -1) >= 0 + ? message.pathLength + : null, + ), + const SizedBox(width: 4), + Text( + context.l10n.channels_via( + _formatPathPrefixes(displayPath), + ), + style: MeshTheme.mono( + fontSize: 9.5 * textScale, + color: metaColor, + ), + ), + ], ), ), ], - const SizedBox(height: 4), + const SizedBox(height: 3), Padding( padding: gifId != null ? const EdgeInsets.only( @@ -662,30 +693,24 @@ class _ChannelChatScreenState extends State { children: [ Text( _formatTime(context, message.timestamp), - style: TextStyle( - fontSize: 11 * textScale, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + style: MeshTheme.mono( + fontSize: 10 * textScale, + color: metaColor, ), ), if (enableTracing && message.repeatCount > 0) ...[ const SizedBox(width: 6), Icon( Icons.repeat, - size: 12 * textScale, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + size: 11 * textScale, + color: metaColor, ), const SizedBox(width: 2), Text( '${message.repeatCount}', - style: TextStyle( - fontSize: 11 * textScale, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + style: MeshTheme.mono( + fontSize: 10 * textScale, + color: metaColor, ), ), ], @@ -705,6 +730,7 @@ class _ChannelChatScreenState extends State { isFailed: message.status == ChannelMessageStatus.failed, + onColor: metaColor, ), ], ], @@ -720,7 +746,7 @@ class _ChannelChatScreenState extends State { if (message.reactions.isNotEmpty) ...[ const SizedBox(height: 4), Padding( - padding: EdgeInsets.only(left: isOutgoing ? 0 : 48), + padding: EdgeInsets.only(left: isOutgoing ? 0 : 42), child: _buildReactionsDisplay(message), ), ], @@ -739,7 +765,7 @@ class _ChannelChatScreenState extends State { ); } else { return Padding( - padding: const EdgeInsets.symmetric(vertical: 4), + padding: const EdgeInsets.symmetric(vertical: 3), child: messageBody, ); } @@ -836,7 +862,7 @@ class _ChannelChatScreenState extends State { padding: const EdgeInsets.all(8), decoration: BoxDecoration( color: colorScheme.surfaceContainerHighest.withValues(alpha: 0.5), - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(MeshRadii.sm), border: Border( left: BorderSide(color: colorScheme.primary, width: 3), ), @@ -849,9 +875,7 @@ class _ChannelChatScreenState extends State { style: TextStyle( fontSize: 11 * textScale, fontWeight: FontWeight.bold, - color: isOwnNode - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.onSurface, + color: isOwnNode ? colorScheme.primary : colorScheme.onSurface, ), ), const SizedBox(height: 2), @@ -863,6 +887,7 @@ class _ChannelChatScreenState extends State { } Widget _buildReactionsDisplay(ChannelMessage message) { + final scheme = Theme.of(context).colorScheme; return Wrap( spacing: 6, runSpacing: 6, @@ -873,27 +898,29 @@ class _ChannelChatScreenState extends State { return Container( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(12), - border: Border.all( - color: Theme.of( - context, - ).colorScheme.outline.withValues(alpha: 0.3), - width: 1, - ), + color: scheme.surfaceContainerHigh, + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: scheme.outlineVariant, width: 1), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(emoji, style: const TextStyle(fontSize: 16)), + Text( + emoji, + style: MeshTheme.emoji(fontSize: 16), + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), + ), if (count > 1) ...[ const SizedBox(width: 4), Text( '$count', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.onSecondaryContainer, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: scheme.onSurface, ), ), ], @@ -912,20 +939,15 @@ class _ChannelChatScreenState extends State { String senderName, { Widget? trailing, }) { - final colorScheme = Theme.of(context).colorScheme; - final textColor = isOutgoing - ? colorScheme.onPrimaryContainer - : colorScheme.onSurface; + final scheme = Theme.of(context).colorScheme; + final textColor = isOutgoing ? MeshPalette.meInk : scheme.onSurface; final metaColor = textColor.withValues(alpha: 0.7); - final channelColor = widget.channel.isPublicChannel - ? Colors.orange - : Colors.blue; return Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ IconButton( - icon: Icon(Icons.location_on_outlined, color: channelColor), + icon: Icon(Icons.location_on_outlined, color: scheme.primary), padding: EdgeInsets.zero, constraints: const BoxConstraints(minWidth: 40, minHeight: 40), onPressed: () { @@ -991,41 +1013,24 @@ class _ChannelChatScreenState extends State { } Widget _buildAvatar(String senderName) { - final initial = firstCharacterOrEmoji(senderName); - final color = colorForName(senderName); - - return CircleAvatar( - radius: 18, - backgroundColor: color.withValues(alpha: 0.2), - child: Text( - initial, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: color, - ), - ), - ); + return AvatarCircle(name: senderName, size: 32); } Widget _buildReplyBanner(double textScale) { final message = _replyingToMessage!; + final scheme = Theme.of(context).colorScheme; return Container( width: double.infinity, padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondaryContainer, + color: scheme.surfaceContainerHigh, border: Border( - bottom: BorderSide(color: Theme.of(context).dividerColor, width: 1), + bottom: BorderSide(color: scheme.outlineVariant, width: 1), ), ), child: Row( children: [ - Icon( - Icons.reply, - size: 18, - color: Theme.of(context).colorScheme.onSecondaryContainer, - ), + Icon(Icons.reply, size: 18, color: scheme.primary), const SizedBox(width: 8), Expanded( child: Column( @@ -1033,10 +1038,10 @@ class _ChannelChatScreenState extends State { children: [ Text( context.l10n.chat_replyingTo(message.senderName), - style: TextStyle( - fontSize: 12 * textScale, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.onSecondaryContainer, + style: MeshTheme.mono( + fontSize: 11 * textScale, + fontWeight: FontWeight.w700, + color: scheme.primary, ), ), Text( @@ -1045,9 +1050,7 @@ class _ChannelChatScreenState extends State { overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 11 * textScale, - color: Theme.of( - context, - ).colorScheme.onSecondaryContainer.withValues(alpha: 0.7), + color: scheme.onSurfaceVariant, ), ), ], @@ -1056,7 +1059,7 @@ class _ChannelChatScreenState extends State { IconButton( icon: const Icon(Icons.close, size: 18), onPressed: _cancelReply, - color: Theme.of(context).colorScheme.onSecondaryContainer, + color: scheme.onSurfaceVariant, constraints: const BoxConstraints(minWidth: 44, minHeight: 44), ), ], @@ -1068,6 +1071,7 @@ class _ChannelChatScreenState extends State { final connector = context.watch(); final maxBytes = maxChannelMessageBytes(connector.selfName); final settings = context.watch().settings; + final scheme = Theme.of(context).colorScheme; return Column( mainAxisSize: MainAxisSize.min, children: [ @@ -1081,123 +1085,166 @@ class _ChannelChatScreenState extends State { }, ), Container( - padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.1), - blurRadius: 4, - offset: const Offset(0, -2), - ), - ], + color: scheme.surface, + border: Border( + top: BorderSide(color: scheme.outlineVariant, width: 1), + ), ), - child: Row( - children: [ - IconButton( - icon: const Icon(Icons.gif_box), - onPressed: () => _showGifPicker(context), - tooltip: context.l10n.chat_sendGif, - ), - if (settings.translationEnabled) - MessageTranslationButton( - enabled: settings.composerTranslationEnabled, - languageCode: settings.translationTargetLanguageCode, - onPressed: _showTranslationOptions, - ), - Expanded( - child: ValueListenableBuilder( - valueListenable: _textController, - builder: (context, value, child) { - final gifId = GifHelper.parseGif(value.text); - if (gifId != null) { - return Focus( - autofocus: true, - onKeyEvent: (node, event) { - if (event is KeyDownEvent && - (event.logicalKey == LogicalKeyboardKey.enter || - event.logicalKey == - LogicalKeyboardKey.numpadEnter)) { - _sendMessage(); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - }, - child: Row( - children: [ - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: Theme.of( - context, - ).colorScheme.surfaceContainerHighest, - fallbackTextColor: Theme.of(context) - .colorScheme - .onSurface - .withValues(alpha: 0.6), - maxSize: 160, + child: SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + IconButton( + icon: const Icon(Icons.gif_box), + onPressed: () => _showGifPicker(context), + tooltip: context.l10n.chat_sendGif, + ), + if (settings.translationEnabled) + MessageTranslationButton( + enabled: settings.composerTranslationEnabled, + languageCode: settings.translationTargetLanguageCode, + onPressed: _showTranslationOptions, + ), + Expanded( + child: ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, child) { + final gifId = GifHelper.parseGif(value.text); + if (gifId != null) { + return Focus( + autofocus: true, + onKeyEvent: (node, event) { + if (event is KeyDownEvent && + (event.logicalKey == + LogicalKeyboardKey.enter || + event.logicalKey == + LogicalKeyboardKey.numpadEnter)) { + _sendMessage(); + return KeyEventResult.handled; + } + return KeyEventResult.ignored; + }, + child: Row( + children: [ + Expanded( + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: + scheme.surfaceContainerHighest, + fallbackTextColor: scheme.onSurface + .withValues(alpha: 0.6), + maxSize: 160, + ), + ), ), + const SizedBox(width: 8), + IconButton( + icon: const Icon(Icons.close), + onPressed: () { + _textController.clear(); + _textFieldFocusNode.requestFocus(); + }, + ), + ], + ), + ); + } + return ByteCountedTextField( + maxBytes: maxBytes, + controller: _textController, + focusNode: _textFieldFocusNode, + hintText: context.l10n.chat_typeMessage, + onSubmitted: (_) => _sendMessage(), + encoder: + (connector.isChannelSmazEnabled( + widget.channel.index, + ) || + connector.isChannelCyr2LatEnabled( + widget.channel.index, + )) + ? (text) => connector.prepareChannelOutboundText( + widget.channel.index, + text, + ) + : null, + decoration: InputDecoration( + hintText: context.l10n.chat_typeMessage, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular( + MeshRadii.pill, + ), + borderSide: BorderSide( + color: scheme.outlineVariant, ), ), - const SizedBox(width: 8), - IconButton( - icon: const Icon(Icons.close), - onPressed: () { - _textController.clear(); - _textFieldFocusNode.requestFocus(); - }, + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular( + MeshRadii.pill, + ), + borderSide: BorderSide( + color: scheme.outlineVariant, + ), ), - ], + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular( + MeshRadii.pill, + ), + borderSide: BorderSide( + color: scheme.primary, + width: 1.5, + ), + ), + filled: true, + fillColor: scheme.surfaceContainerLow, + contentPadding: const EdgeInsets.symmetric( + horizontal: 18, + vertical: 12, + ), + ), + ); + }, + ), + ), + const SizedBox(width: 6), + ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, _) { + final hasText = value.text.trim().isNotEmpty; + return AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeInOut, + child: IconButton.filled( + icon: const Icon(Icons.send, size: 20), + tooltip: context.l10n.chat_sendMessage, + style: IconButton.styleFrom( + backgroundColor: hasText + ? scheme.primary + : scheme.surfaceContainerHighest, + foregroundColor: hasText + ? scheme.onPrimary + : scheme.onSurfaceVariant, + minimumSize: const Size(40, 40), + shape: const CircleBorder(), + ), + onPressed: hasText + ? () { + HapticFeedback.lightImpact(); + _sendMessage(); + } + : null, ), ); - } - return ByteCountedTextField( - maxBytes: maxBytes, - controller: _textController, - focusNode: _textFieldFocusNode, - hintText: context.l10n.chat_typeMessage, - onSubmitted: (_) => _sendMessage(), - encoder: - (connector.isChannelSmazEnabled( - widget.channel.index, - ) || - connector.isChannelCyr2LatEnabled( - widget.channel.index, - )) - ? (text) => connector.prepareChannelOutboundText( - widget.channel.index, - text, - ) - : null, - decoration: InputDecoration( - hintText: context.l10n.chat_typeMessage, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(24), - ), - filled: true, - fillColor: Theme.of( - context, - ).colorScheme.surfaceContainerLow, - contentPadding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 14, - ), - ), - ); - }, - ), + }, + ), + ], ), - const SizedBox(width: 8), - IconButton( - icon: const Icon(Icons.send), - tooltip: context.l10n.chat_sendMessage, - onPressed: _sendMessage, - color: Theme.of(context).colorScheme.primary, - ), - ], + ), ), ), ], @@ -1338,12 +1385,20 @@ class _ChannelChatScreenState extends State { ) && (message.translatedText?.trim().isEmpty ?? true); - showModalBottomSheet( - context: context, + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: message.text.length > 40 + ? '${message.text.substring(0, 40)}…' + : message.text, + subtitle: message.senderName.isNotEmpty + ? message.senderName + : null, + ), ListTile( leading: const Icon(Icons.reply), title: Text(context.l10n.chat_reply), @@ -1402,7 +1457,7 @@ class _ChannelChatScreenState extends State { _markAsUnread(message); }, ), - const Divider(), + const Divider(height: 1), ListTile( leading: Icon( Icons.delete_outline, @@ -1417,6 +1472,7 @@ class _ChannelChatScreenState extends State { await _deleteMessage(message); }, ), + const SizedBox(height: 8), ], ), ), @@ -1499,6 +1555,23 @@ class _ChannelChatScreenState extends State { .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) .join(','); } + + /// Deterministic name-to-hue mapping consistent with [AvatarCircle]. + Color _colorForName(String name) { + const hues = [ + MeshPalette.blue, + MeshPalette.magenta, + MeshPalette.signal, + MeshPalette.warn, + Color(0xFF8FA8F0), + Color(0xFF6FD9CE), + ]; + var h = 0; + for (final c in name.codeUnits) { + h = (h * 31 + c) & 0x7fffffff; + } + return hues[h % hues.length]; + } } class _SwipeReplyBubble extends StatefulWidget { @@ -1640,7 +1713,7 @@ class _SwipeReplyBubbleState extends State<_SwipeReplyBubble> { onPointerUp: (event) => _handleSwipePointerUp(event.position), onPointerCancel: (_) => _resetSwipe(), child: Padding( - padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8), + padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 8), child: Stack( alignment: Alignment.center, children: [ diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index e7f21459..13bc0c3c 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -16,7 +16,13 @@ import '../l10n/l10n.dart'; import '../models/channel_message.dart'; import '../models/app_settings.dart'; import '../models/contact.dart'; +import '../models/display_path.dart'; +import '../models/path_playback.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/path_map_ui.dart'; +import '../widgets/themed_map_tile_layer.dart'; class ChannelMessagePathScreen extends StatelessWidget { final ChannelMessage message; @@ -85,33 +91,25 @@ class ChannelMessagePathScreen extends StatelessWidget { body: SafeArea( top: false, child: ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(vertical: 8), children: [ _buildSummaryCard(context, observedLabel: observedLabel), - const SizedBox(height: 16), if (extraPaths.isNotEmpty) ...[ - Text( + SectionHeader( l10n.channelPath_otherObservedPaths, - style: Theme.of(context).textTheme.titleSmall, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), ), - const SizedBox(height: 8), _buildPathVariants(context, extraPaths), - const SizedBox(height: 16), ], - Text( + SectionHeader( l10n.channelPath_repeaterHops, - style: Theme.of(context).textTheme.titleSmall, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), ), - const SizedBox(height: 8), if (!hasHopDetails) - Text( - l10n.channelPath_noHopDetails, - style: TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ) + _buildNoHopCard(context, l10n) else - ..._buildHopTiles(context, hops), + _buildHopTimeline(context, hops, l10n), + const SizedBox(height: 16), ], ), ), @@ -122,46 +120,64 @@ class ChannelMessagePathScreen extends StatelessWidget { Widget _buildSummaryCard(BuildContext context, {String? observedLabel}) { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - l10n.channelPath_messageDetails, - style: Theme.of(context).textTheme.titleSmall, - ), - const SizedBox(height: 8), - _buildDetailRow( - context, - l10n.channelPath_senderLabel, - message.senderName, - ), - _buildDetailRow( - context, - l10n.channelPath_timeLabel, - _formatTime(message.timestamp, l10n), - ), - if (message.repeatCount > 0) - _buildDetailRow( - context, - l10n.channelPath_repeatsLabel, - message.repeatCount.toString(), + final scheme = Theme.of(context).colorScheme; + final routeChip = message.pathLength == null + ? null + : message.pathLength! < 0 + ? const RouteChip(isDirect: false) + : RouteChip(isDirect: true, hops: message.pathLength); + + return MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.all(14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: SectionHeader( + l10n.channelPath_messageDetails, + padding: EdgeInsets.zero, + ), ), + ?routeChip, + ], + ), + const SizedBox(height: 10), + _buildDetailRow( + context, + l10n.channelPath_senderLabel, + message.senderName, + scheme: scheme, + ), + _buildDetailRow( + context, + l10n.channelPath_timeLabel, + _formatTime(message.timestamp, l10n), + scheme: scheme, + ), + if (message.repeatCount > 0) _buildDetailRow( context, - l10n.channelPath_pathLabelTitle, - _formatPathLabel(message.pathLength, l10n), + l10n.channelPath_repeatsLabel, + message.repeatCount.toString(), + scheme: scheme, ), - if (observedLabel != null) - _buildDetailRow( - context, - l10n.channelPath_observedLabel, - observedLabel, - ), - ], - ), + _buildDetailRow( + context, + l10n.channelPath_pathLabelTitle, + _formatPathLabel(message.pathLength, l10n), + scheme: scheme, + ), + if (observedLabel != null) + _buildDetailRow( + context, + l10n.channelPath_observedLabel, + observedLabel, + scheme: scheme, + ), + ], ), ); } @@ -172,54 +188,199 @@ class ChannelMessagePathScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ for (int i = 0; i < variants.length; i++) - Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - title: Text( - l10n.channelPath_observedPathTitle( - i + 1, - _formatHopCount(variants[i].length, l10n), + MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + onTap: () => _openPathMap( + context, + initialPath: variants[i], + channelMessage: channelMessage, + ), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + l10n.channelPath_observedPathTitle( + i + 1, + _formatHopCount(variants[i].length, l10n), + ), + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _formatPathPrefixes(variants[i]), + style: MeshTheme.mono( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ], + ), ), - ), - subtitle: Text(_formatPathPrefixes(variants[i])), - trailing: const Icon(Icons.map_outlined, size: 20), - onTap: () => _openPathMap( - context, - initialPath: variants[i], - channelMessage: channelMessage, - ), + const SizedBox(width: 8), + Icon( + Icons.map_outlined, + size: 20, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ], ), ), ], ); } - List _buildHopTiles(BuildContext context, List<_PathHop> hops) { - final l10n = context.l10n; - return [ - for (final hop in hops) - Card( - margin: const EdgeInsets.symmetric(vertical: 4), - child: ListTile( - dense: true, - leading: CircleAvatar( - radius: 14, - child: Text( - hop.index.toString(), - style: const TextStyle(fontSize: 12), - ), - ), - title: Text(hop.displayLabel), - subtitle: Text( - hop.hasLocation - ? '${hop.position!.latitude.toStringAsFixed(5)}, ' - '${hop.position!.longitude.toStringAsFixed(5)}' - : l10n.channelPath_noLocationData, + Widget _buildNoHopCard(BuildContext context, AppLocalizations l10n) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.all(14), + child: Row( + children: [ + Icon(Icons.route_outlined, size: 20, color: scheme.onSurfaceVariant), + const SizedBox(width: 10), + Expanded( + child: Text( + l10n.channelPath_noHopDetails, + style: TextStyle(color: scheme.onSurfaceVariant), ), ), - ), - ]; + ], + ), + ); + } + + Widget _buildHopTimeline( + BuildContext context, + List<_PathHop> hops, + AppLocalizations l10n, + ) { + if (hops.isEmpty) return const SizedBox.shrink(); + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + for (int i = 0; i < hops.length; i++) + ListEntrance( + index: i, + child: _buildTimelineNode( + context, + hops[i], + l10n, + isLast: i == hops.length - 1, + ), + ), + ], + ), + ); + } + + Widget _buildTimelineNode( + BuildContext context, + _PathHop hop, + AppLocalizations l10n, { + required bool isLast, + }) { + final scheme = Theme.of(context).colorScheme; + final hexPrefix = _formatPrefix(hop.prefix); + final locationText = hop.hasLocation + ? '${hop.position!.latitude.toStringAsFixed(5)}, ' + '${hop.position!.longitude.toStringAsFixed(5)}' + : l10n.channelPath_noLocationData; + + return IntrinsicHeight( + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox( + width: 48, + child: Column( + children: [ + Stack( + clipBehavior: Clip.none, + children: [ + AvatarCircle(name: hop.displayLabel, size: 36), + Positioned( + right: -4, + top: -4, + child: Container( + width: 18, + height: 18, + decoration: BoxDecoration( + color: MeshPalette.blueDim, + shape: BoxShape.circle, + border: Border.all( + color: scheme.surfaceContainerLow, + width: 1.5, + ), + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontSize: 9, + fontWeight: FontWeight.w700, + ), + ), + ), + ), + ], + ), + if (!isLast) + Expanded( + child: Container( + width: 2, + margin: const EdgeInsets.symmetric(vertical: 4), + color: MeshPalette.blueLine, + ), + ) + else + const SizedBox(height: 12), + ], + ), + ), + const SizedBox(width: 12), + Expanded( + child: Padding( + padding: const EdgeInsets.only(bottom: 16, top: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + hop.displayLabel, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + hexPrefix, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 2), + Text( + locationText, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ), + ], + ), + ); } String _formatTime(DateTime time, AppLocalizations l10n) { @@ -263,21 +424,25 @@ class ChannelMessagePathScreen extends StatelessWidget { return l10n.channelPath_observedSomeOf(observedCount, pathLength); } - Widget _buildDetailRow(BuildContext context, String label, String value) { + Widget _buildDetailRow( + BuildContext context, + String label, + String value, { + required ColorScheme scheme, + }) { return Padding( - padding: const EdgeInsets.symmetric(vertical: 2), + padding: const EdgeInsets.symmetric(vertical: 3), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( - width: 70, + width: 72, child: Text( - label, - style: TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), + label.toUpperCase(), + style: MeshTheme.accentLabel(color: scheme.onSurfaceVariant), ), ), + const SizedBox(width: 8), Expanded(child: Text(value)), ], ), @@ -320,7 +485,8 @@ class ChannelMessagePathMapScreen extends StatefulWidget { } class _ChannelMessagePathMapScreenState - extends State { + extends State + with SingleTickerProviderStateMixin { static const double _labelZoomThreshold = 8.5; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; @@ -332,10 +498,39 @@ class _ChannelMessagePathMapScreenState bool _didReceivePositionUpdate = false; int? _focusedHopIndex; + // Packet-flow animation + multi-path view state. + late final PathPlaybackController _playback; + PathViewMode _viewMode = PathViewMode.single; + final Set _hiddenPathIds = {}; + bool _panelCollapsed = false; + bool _animationEnabled = true; + bool _followPacket = false; + @override void initState() { super.initState(); _selectedPath = widget.initialPath; + _playback = PathPlaybackController(this); + _playback.addListener(_followPacketCamera); + } + + /// Keeps the camera centered on the packet while the follow lock is on. + void _followPacketCamera() { + if (!_followPacket || + !_animationEnabled || + !_playback.started || + !_playback.hasPath || + !mounted) { + return; + } + _mapController.move(_playback.position, _mapController.camera.zoom); + } + + void _toggleFollowPacket() { + setState(() { + _followPacket = !_followPacket; + }); + _followPacketCamera(); } @override @@ -352,10 +547,142 @@ class _ChannelMessagePathMapScreenState @override void dispose() { + _playback.dispose(); _mapController.dispose(); super.dispose(); } + /// Builds a renderable [DisplayPath] for one observed route, oriented in + /// the direction the packet traveled (sender first, receiver last). + DisplayPath? _buildDisplayPath({ + required int index, + required bool isPrimary, + required Uint8List orientedBytes, + required List<_PathHop> hops, + required MeshCoreConnector connector, + }) { + final l10n = context.l10n; + final selfLat = connector.selfLatitude; + final selfLon = connector.selfLongitude; + + final points = []; + final labels = []; + final confirmed = []; + final rowIdx = []; + final gapBefore = []; + var pendingGap = false; + var locatedHops = 0; + + void addSelf() { + if (selfLat == null || selfLon == null) return; + points.add(LatLng(selfLat, selfLon)); + labels.add(l10n.pathTrace_you); + confirmed.add(true); + rowIdx.add(-1); + gapBefore.add(pendingGap); + pendingGap = false; + } + + final selfFirst = widget.message.isOutgoing; + if (selfFirst) addSelf(); + for (var i = 0; i < hops.length; i++) { + final hop = hops[i]; + if (!hop.hasLocation) { + pendingGap = true; + continue; + } + locatedHops++; + points.add(hop.position!); + labels.add(hop.contact?.name ?? _formatPrefix(hop.prefix)); + confirmed.add(true); + rowIdx.add(i); + gapBefore.add(pendingGap); + pendingGap = false; + } + if (!selfFirst) addSelf(); + + if (points.length < 2) return null; + + final segmentEstimated = []; + final rowForSegment = []; + for (var i = 0; i < points.length - 1; i++) { + segmentEstimated.add(gapBefore[i + 1]); + final dest = rowIdx[i + 1]; + rowForSegment.add(dest >= 0 ? dest : (rowIdx[i] >= 0 ? rowIdx[i] : 0)); + } + + return DisplayPath( + id: 'op-$index', + label: isPrimary ? l10n.pathMap_primary : l10n.pathMap_alternate(index), + color: isPrimary + ? kPrimaryPathColor + : kAlternatePathColors[(index - 1) % kAlternatePathColors.length], + isPrimary: isPrimary, + hopBytes: List.from(orientedBytes), + points: points, + pointLabels: labels, + pointConfirmed: confirmed, + segmentEstimated: segmentEstimated, + rowForSegment: rowForSegment, + totalTransmissions: hops.length, + hasTargetEndpoint: false, + gpsConfirmedHops: locatedHops, + unresolvedHops: hops.length - locatedHops, + distanceMeters: getPathDistanceMeters(points), + record: null, + ); + } + + /// Updates the playback path after this frame, but only when the selected + /// path's geometry actually changed, so rebuilds don't reset a running + /// animation. + void _schedulePlaybackSync(DisplayPath? selected) { + final points = selected?.points ?? const []; + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!mounted) return; + if (points.length == _playback.points.length) { + var same = true; + for (var i = 0; i < points.length; i++) { + if (points[i] != _playback.points[i]) { + same = false; + break; + } + } + if (same) return; + } + _playback.setPath(points); + }); + } + + void _selectEntry(_ObservedPathEntry entry) { + setState(() { + _selectedPath = entry.observedBytes; + _hiddenPathIds.remove(entry.display.id); + _focusedHopIndex = null; + }); + } + + void _togglePathVisibility( + DisplayPath path, + List<_ObservedPathEntry> entries, + DisplayPath? selected, + ) { + setState(() { + if (!_hiddenPathIds.remove(path.id)) { + _hiddenPathIds.add(path.id); + if (path.id == selected?.id) { + final visible = entries.where( + (e) => !_hiddenPathIds.contains(e.display.id), + ); + if (visible.isNotEmpty) { + _selectedPath = visible.first.observedBytes; + _focusedHopIndex = null; + } + } + } + }); + } + bool _isDesktopPlatform(TargetPlatform platform) { return platform == TargetPlatform.linux || platform == TargetPlatform.windows || @@ -460,6 +787,7 @@ class _ChannelMessagePathMapScreenState final settings = context.watch().settings; final isImperial = settings.unitSystem == UnitSystem.imperial; final tileCache = context.read(); + final mapScheme = Theme.of(context).colorScheme; final primaryPath = _selectPrimaryPath( widget.message.pathBytes, widget.message.pathVariants, @@ -475,15 +803,57 @@ class _ChannelMessagePathMapScreenState primaryPath, ); - final selectedPath = - ((!widget.message.isOutgoing && !widget.channelMessage) || - (widget.message.isOutgoing && widget.channelMessage)) - ? Uint8List.fromList(selectedPathTmp.reversed.toList()) - : selectedPathTmp; + final selectedPath = _orientPath(selectedPathTmp); - final selectedIndex = _indexForPath(selectedPath, observedPaths); + // Match on the unoriented bytes — observedPaths stores them as + // recorded, while selectedPath may be reversed for display. + final selectedIndex = _indexForPath(selectedPathTmp, observedPaths); final hops = _buildPathHops(selectedPath, connector, context.l10n); + // Renderable paths for the animation and combined view. + final entries = <_ObservedPathEntry>[]; + for (var i = 0; i < observedPaths.length; i++) { + final oriented = _orientPath(observedPaths[i].pathBytes); + final pathHops = i == selectedIndex + ? hops + : _buildPathHops(oriented, connector, context.l10n); + final display = _buildDisplayPath( + index: i, + isPrimary: observedPaths[i].isPrimary, + orientedBytes: oriented, + hops: pathHops, + connector: connector, + ); + if (display != null) { + entries.add( + _ObservedPathEntry( + index: i, + observedBytes: observedPaths[i].pathBytes, + display: display, + hops: pathHops, + ), + ); + } + } + final effectiveMode = entries.length > 1 + ? _viewMode + : PathViewMode.single; + _ObservedPathEntry? selectedEntry; + for (final entry in entries) { + if (entry.index == selectedIndex) { + selectedEntry = entry; + break; + } + } + final selectedDisplay = selectedEntry?.display; + final visibleEntries = effectiveMode == PathViewMode.single + ? [?selectedEntry] + : entries + .where((e) => !_hiddenPathIds.contains(e.display.id)) + .toList(); + final visibleDisplays = visibleEntries.map((e) => e.display).toList(); + _schedulePlaybackSync(selectedDisplay); + final points = []; if ((widget.message.isOutgoing && !widget.channelMessage) || @@ -507,7 +877,7 @@ class _ChannelMessagePathMapScreenState Polyline( points: points, strokeWidth: 4, - color: Colors.blueAccent, + color: MeshPalette.blue, ), ] : []; @@ -564,10 +934,16 @@ class _ChannelMessagePathMapScreenState : const KeyboardOptions.disabled(), ), onPositionChanged: (camera, hasGesture) { + if (!mounted) return; + // A manual pan/zoom releases the follow lock. + if (hasGesture && _followPacket) { + setState(() { + _followPacket = false; + }); + } final shouldShow = camera.zoom >= _labelZoomThreshold; if (!_didReceivePositionUpdate || shouldShow != _showNodeLabels) { - if (!mounted) return; setState(() { _didReceivePositionUpdate = true; _showNodeLabels = shouldShow; @@ -576,20 +952,65 @@ class _ChannelMessagePathMapScreenState }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, + ThemedMapTileLayer(tileCache: tileCache), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + List lines; + if (visibleDisplays.isEmpty) { + lines = polylines; + } else { + final animating = + _animationEnabled && + _playback.started && + _playback.hasPath; + lines = buildMultiPathPolylines( + visible: visibleDisplays, + selected: selectedDisplay, + combined: + effectiveMode == PathViewMode.combined, + animating: animating, + ); + if (animating && selectedDisplay != null) { + lines.addAll( + buildPacketTrailPolylines( + _playback, + selectedDisplay.color, + ), + ); + } + } + if (lines.isEmpty) return const SizedBox.shrink(); + return PolylineLayer(polylines: lines); + }, ), - if (polylines.isNotEmpty) - PolylineLayer(polylines: polylines), - MarkerLayer( - markers: _buildHopMarkers( - hops, - showLabels: _showNodeLabels, + if (effectiveMode == PathViewMode.combined) + MarkerLayer( + markers: _buildCombinedHopMarkers( + visibleEntries, + showLabels: _showNodeLabels, + ), + ) + else + MarkerLayer( + markers: _buildHopMarkers( + hops, + showLabels: _showNodeLabels, + ), ), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + if (!_animationEnabled || selectedDisplay == null) { + return const SizedBox.shrink(); + } + final markers = buildPacketMarkers( + _playback, + selectedDisplay.color, + ); + if (markers.isEmpty) return const SizedBox.shrink(); + return MarkerLayer(markers: markers); + }, ), ], ), @@ -599,30 +1020,46 @@ class _ChannelMessagePathMapScreenState initialZoom: initialZoom, bounds: bounds, ), - if (observedPaths.length > 1) - _buildPathSelector(context, observedPaths, selectedIndex, ( - index, - ) { - setState(() { - _selectedPath = observedPaths[index].pathBytes; - _focusedHopIndex = null; - }); - }), + if (entries.length > 1) + PathViewModeToggle( + mode: effectiveMode, + onChanged: (mode) => setState(() => _viewMode = mode), + ), + if (observedPaths.length > 1 && + effectiveMode == PathViewMode.single) + _buildPathSelector( + context, + observedPaths, + selectedIndex, + (index) { + setState(() { + _selectedPath = observedPaths[index].pathBytes; + _focusedHopIndex = null; + }); + }, + topOffset: entries.length > 1 ? 60.0 : 16.0, + ), if (points.isEmpty) Center( - child: Card( - color: Theme.of( - context, - ).colorScheme.surface.withValues(alpha: 0.9), - child: Padding( - padding: EdgeInsets.all(12), - child: Text( - context.l10n.channelPath_noRepeaterLocations, - ), + child: Container( + margin: const EdgeInsets.all(24), + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: mapScheme.surfaceContainerLow, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: mapScheme.outlineVariant), ), + child: Text(context.l10n.channelPath_noRepeaterLocations), ), ), - _buildLegendCard(context, hops, isImperial), + _buildLegendCard( + context, + hops, + isImperial, + entries: entries, + selectedEntry: selectedEntry, + effectiveMode: effectiveMode, + ), ], ), ), @@ -635,8 +1072,9 @@ class _ChannelMessagePathMapScreenState BuildContext context, List<_ObservedPath> paths, int selectedIndex, - ValueChanged onSelected, - ) { + ValueChanged onSelected, { + double topOffset = 16, + }) { final l10n = context.l10n; final selectedPath = paths[selectedIndex]; final label = selectedPath.isPrimary @@ -645,7 +1083,7 @@ class _ChannelMessagePathMapScreenState return Positioned( left: 16, right: 16, - top: 16, + top: topOffset, child: SafeArea( child: Card( child: Padding( @@ -715,7 +1153,7 @@ class _ChannelMessagePathMapScreenState width: 35, height: 35, decoration: BoxDecoration( - color: Colors.green, + color: MeshPalette.blue, shape: BoxShape.circle, border: Border.all(color: Colors.white, width: 2), boxShadow: [ @@ -749,40 +1187,163 @@ class _ChannelMessagePathMapScreenState } } + markers.addAll(_buildSelfMarkers(showLabels: showLabels)); + + return markers; + } + + List _buildSelfMarkers({required bool showLabels}) { final selfLat = context.read().selfLatitude; final selfLon = context.read().selfLongitude; - if (selfLat != null && selfLon != null) { - final selfPoint = LatLng(selfLat, selfLon); + if (selfLat == null || selfLon == null) return const []; + final markers = []; + final selfPoint = LatLng(selfLat, selfLon); + markers.add( + Marker( + point: selfPoint, + width: 48, + height: 48, + child: Center( + child: Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: MeshPalette.signal, + shape: BoxShape.circle, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + context.l10n.pathTrace_you, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 12, + ), + ), + ), + ), + ), + ); + if (showLabels) { + markers.add( + _buildNodeLabelMarker( + point: selfPoint, + label: context.l10n.pathTrace_you, + ), + ); + } + return markers; + } + + /// Markers for the union of located hops across all visible paths, with a + /// badge on repeaters used by more than one path. + List _buildCombinedHopMarkers( + List<_ObservedPathEntry> visibleEntries, { + required bool showLabels, + }) { + final markers = []; + + final nodes = {}; + for (final entry in visibleEntries) { + final seenInPath = {}; + for (final hop in entry.hops) { + if (!hop.hasLocation) continue; + final key = + '${hop.prefix}|${hop.position!.latitude.toStringAsFixed(5)},' + '${hop.position!.longitude.toStringAsFixed(5)}'; + if (!seenInPath.add(key)) continue; + nodes.putIfAbsent(key, () => _SharedNode(hop)).paths.add(entry.display); + } + } + + for (final node in nodes.values) { + final hop = node.hop; + final point = hop.position!; + final label = _formatPrefix(hop.prefix); + final shared = node.paths.length > 1; + markers.add( Marker( - point: selfPoint, + point: point, width: 48, height: 48, - child: Center( - child: Container( - width: 35, - height: 35, - decoration: BoxDecoration( - color: Colors.teal, - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], - ), + child: GestureDetector( + onTap: () => showSharedNodeSheet( + context, + title: '$label: ${_resolveName(hop.contact, context.l10n)}', + paths: node.paths, + onSelect: (display) { + for (final entry in visibleEntries) { + if (entry.display.id == display.id) { + _selectEntry(entry); + break; + } + } + }, + ), + child: Stack( alignment: Alignment.center, - child: Text( - context.l10n.pathTrace_you, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, + children: [ + Container( + width: 35, + height: 35, + decoration: BoxDecoration( + color: MeshPalette.blue, + shape: BoxShape.circle, + border: Border.all( + color: Colors.white, + width: shared ? 2.5 : 2, + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + alignment: Alignment.center, + child: Text( + label, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 11, + ), + ), ), - ), + if (shared) + Positioned( + top: 0, + right: 0, + child: Container( + width: 17, + height: 17, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MeshPalette.bg1, + border: Border.all(color: MeshPalette.line3), + ), + alignment: Alignment.center, + child: Text( + '${node.paths.length}', + style: MeshTheme.mono( + fontSize: 9, + fontWeight: FontWeight.w700, + color: MeshPalette.ink, + ), + ), + ), + ), + ], ), ), ), @@ -790,16 +1351,26 @@ class _ChannelMessagePathMapScreenState if (showLabels) { markers.add( _buildNodeLabelMarker( - point: selfPoint, - label: context.l10n.pathTrace_you, + point: point, + label: hop.contact?.name ?? label, ), ); } } + markers.addAll(_buildSelfMarkers(showLabels: showLabels)); + return markers; } + /// Orients recorded path bytes in the direction the packet traveled. + Uint8List _orientPath(Uint8List bytes) { + final reverse = + (!widget.message.isOutgoing && !widget.channelMessage) || + (widget.message.isOutgoing && widget.channelMessage); + return reverse ? Uint8List.fromList(bytes.reversed.toList()) : bytes; + } + Marker _buildNodeLabelMarker({required LatLng point, required String label}) { return Marker( point: point, @@ -835,21 +1406,38 @@ class _ChannelMessagePathMapScreenState ); } - Widget _colorDot(Color color) => Container( - width: 10, - height: 10, - decoration: BoxDecoration(color: color, shape: BoxShape.circle), - ); - Widget _buildLegendCard( BuildContext context, List<_PathHop> hops, - bool isImperial, - ) { + bool isImperial, { + required List<_ObservedPathEntry> entries, + required _ObservedPathEntry? selectedEntry, + required PathViewMode effectiveMode, + }) { final l10n = context.l10n; - final maxHeight = MediaQuery.of(context).size.height * 0.35; - final estimatedHeight = 72.0 + (hops.length * 56.0); - final cardHeight = max(96.0, min(maxHeight, estimatedHeight)); + final combined = effectiveMode == PathViewMode.combined; + final selectedDisplay = selectedEntry?.display; + final maxHeight = + MediaQuery.of(context).size.height * (combined ? 0.45 : 0.35); + + double cardHeight; + if (_panelCollapsed) { + cardHeight = 128; + } else { + final summaryHeight = combined ? 34.0 + entries.length * 36.0 : 0; + final estimatedHeight = 132.0 + summaryHeight + hops.length * 56.0; + cardHeight = max(176.0, min(maxHeight, estimatedHeight)); + } + + final hopUseCount = {}; + if (combined) { + for (final entry in entries) { + if (_hiddenPathIds.contains(entry.display.id)) continue; + for (final prefix in entry.hops.map((h) => h.prefix).toSet()) { + hopUseCount.update(prefix, (v) => v + 1, ifAbsent: () => 1); + } + } + } return Positioned( left: 16, @@ -857,80 +1445,269 @@ class _ChannelMessagePathMapScreenState bottom: 16, child: SizedBox( height: cardHeight, - child: Card( + child: Container( + decoration: BoxDecoration( + color: MeshPalette.bg1, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + clipBehavior: Clip.antiAlias, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: const EdgeInsets.all(12), - child: Column( + padding: const EdgeInsets.fromLTRB(12, 8, 4, 0), + child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistance, isImperial: isImperial)}', - style: const TextStyle(fontWeight: FontWeight.w600), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + l10n.channelPath_repeaterHops, + style: const TextStyle( + fontWeight: FontWeight.w600, + ), + ), + ), + Text( + formatDistance( + selectedDisplay?.distanceMeters ?? + _pathDistance, + isImperial: isImperial, + ), + style: MeshTheme.mono( + fontSize: 12, + color: MeshPalette.ink2, + ), + ), + ], + ), + const SizedBox(height: 4), + PathMiniLegend( + combined: combined, + showInferred: false, + ), + ], + ), ), - const SizedBox(height: 6), - Row( - children: [ - _colorDot(Colors.green), - const SizedBox(width: 4), - Text( - l10n.pathTrace_legendGpsConfirmed, - style: const TextStyle(fontSize: 11), - ), - ], + IconButton( + visualDensity: VisualDensity.compact, + icon: Icon( + _panelCollapsed + ? Icons.expand_less + : Icons.expand_more, + size: 20, + ), + tooltip: _panelCollapsed + ? l10n.pathMap_expandPanel + : l10n.pathMap_collapsePanel, + onPressed: () => setState( + () => _panelCollapsed = !_panelCollapsed, + ), ), ], ), ), - const Divider(height: 1), - Expanded( - child: hops.isEmpty - ? Center( - child: Text(l10n.channelPath_noHopDetailsAvailable), - ) - : ListView.separated( - padding: const EdgeInsets.symmetric(vertical: 4), - itemCount: hops.length, - separatorBuilder: (_, _) => const Divider(height: 1), - itemBuilder: (context, index) { - final hop = hops[index]; - final isFocused = _focusedHopIndex == hop.index; - return ListTile( - dense: true, - enabled: hop.hasLocation, - selected: isFocused, - selectedTileColor: Theme.of( - context, - ).colorScheme.primary.withValues(alpha: 0.12), - onTap: hop.hasLocation - ? () => _onHopTapped(hop) - : null, - leading: CircleAvatar( - radius: 14, - child: Text( - hop.index.toString(), - style: const TextStyle(fontSize: 12), - ), - ), - title: Text(hop.displayLabel), - subtitle: Text( - hop.hasLocation - ? '${hop.position!.latitude.toStringAsFixed(5)}, ' - '${hop.position!.longitude.toStringAsFixed(5)}' - : l10n.channelPath_noLocationData, - ), - ); - }, - ), + PathAnimationControls( + playback: _playback, + selected: selectedDisplay, + animationEnabled: _animationEnabled, + onToggleAnimation: () => setState(() { + _animationEnabled = !_animationEnabled; + if (!_animationEnabled) _playback.stop(); + }), + followEnabled: _followPacket, + onToggleFollow: _toggleFollowPacket, ), + if (!_panelCollapsed) ...[ + if (selectedDisplay != null && + selectedDisplay.unresolvedHops > 0) + Padding( + padding: const EdgeInsets.fromLTRB(12, 0, 12, 4), + child: Text( + l10n.pathMap_partialAnimation( + selectedDisplay.unresolvedHops, + ), + style: TextStyle(fontSize: 10.5, color: MeshPalette.warn), + ), + ), + if (combined) + PathSummaryList( + paths: entries.map((e) => e.display).toList(), + selectedId: selectedDisplay?.id ?? '', + hiddenIds: _hiddenPathIds, + isImperial: isImperial, + onSelect: (display) { + for (final entry in entries) { + if (entry.display.id == display.id) { + _selectEntry(entry); + break; + } + } + }, + onToggleVisibility: (display) => _togglePathVisibility( + display, + entries, + selectedDisplay, + ), + onShowAll: () => setState(_hiddenPathIds.clear), + ), + const Divider(height: 1), + Expanded( + child: _buildHopListView( + hops, + selectedDisplay, + hopUseCount, + ), + ), + ], ], ), ), ), ); } + + Widget _buildHopListView( + List<_PathHop> hops, + DisplayPath? selectedDisplay, + Map hopUseCount, + ) { + final l10n = context.l10n; + if (hops.isEmpty) { + return Center(child: Text(l10n.channelPath_noHopDetailsAvailable)); + } + return ValueListenableBuilder( + valueListenable: _playback.activeSegment, + builder: (context, activeSegment, _) { + int highlightRow = -1; + if (_animationEnabled && + selectedDisplay != null && + activeSegment >= 0 && + activeSegment < selectedDisplay.rowForSegment.length) { + highlightRow = selectedDisplay.rowForSegment[activeSegment]; + } + final highlightColor = (selectedDisplay?.color ?? MeshPalette.blue) + .withValues(alpha: 0.14); + return ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: hops.length, + separatorBuilder: (_, _) => const Divider(height: 1), + itemBuilder: (context, index) { + final hop = hops[index]; + final isFocused = _focusedHopIndex == hop.index; + final sharedCount = hopUseCount[hop.prefix] ?? 0; + return InkWell( + onTap: hop.hasLocation ? () => _onHopTapped(hop) : null, + child: Container( + color: index == highlightRow + ? highlightColor + : isFocused + ? MeshPalette.blueBg + : Colors.transparent, + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: Row( + children: [ + Container( + width: 28, + height: 28, + decoration: BoxDecoration( + color: MeshPalette.blueDim.withValues( + alpha: 0.3, + ), + shape: BoxShape.circle, + border: Border.all( + color: MeshPalette.blueDim.withValues( + alpha: 0.5, + ), + ), + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w700, + ), + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + hop.displayLabel, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 13, + ), + overflow: TextOverflow.ellipsis, + ), + Text( + [ + hop.hasLocation + ? '${hop.position!.latitude.toStringAsFixed(5)}, ' + '${hop.position!.longitude.toStringAsFixed(5)}' + : context + .l10n + .channelPath_noLocationData, + if (sharedCount > 1) + context.l10n.pathMap_sharedNodeCount( + sharedCount, + ), + ].join(' · '), + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ], + ), + ), + ); + }, + ); + }, + ); + } +} + +/// One observed route paired with its renderable form and resolved hops. +class _ObservedPathEntry { + final int index; + final Uint8List observedBytes; + final DisplayPath display; + final List<_PathHop> hops; + + const _ObservedPathEntry({ + required this.index, + required this.observedBytes, + required this.display, + required this.hops, + }); +} + +/// A located hop shared across one or more visible paths. +class _SharedNode { + final _PathHop hop; + final List paths = []; + + _SharedNode(this.hop); } class _PathHop { diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 36e82049..080eef8e 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:math'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:meshcore_open/storage/channel_message_store.dart'; import 'package:meshcore_open/utils/platform_info.dart'; import 'package:meshcore_open/widgets/app_bar.dart'; @@ -16,11 +16,13 @@ import '../services/ui_view_state_service.dart'; import '../models/channel.dart'; import '../models/community.dart'; import '../storage/community_store.dart'; +import '../theme/mesh_theme.dart'; import '../utils/dialog_utils.dart'; import '../utils/disconnect_navigation_mixin.dart'; import '../utils/route_transitions.dart'; import '../widgets/list_filter_widget.dart'; import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/qr_code_display.dart'; import '../widgets/quick_switch_bar.dart'; import '../widgets/sync_progress_overlay.dart'; @@ -82,6 +84,14 @@ class _ChannelsScreenState extends State super.dispose(); } + String _relativeTime(DateTime t) { + final diff = DateTime.now().difference(t); + if (diff.inMinutes < 1) return 'now'; + if (diff.inMinutes < 60) return '${diff.inMinutes}m'; + if (diff.inHours < 24) return '${diff.inHours}h'; + return '${diff.inDays}d'; + } + @override Widget build(BuildContext context) { final connector = context.watch(); @@ -107,16 +117,19 @@ class _ChannelsScreenState extends State bottom: const SyncProgressAppBarBottom(), actions: [ PopupMenuButton( - itemBuilder: (context) => [ + // onTap handlers run after the menu route pops, so they must + // capture the screen's context — not the itemBuilder's menu + // context, which is deactivated by then. + itemBuilder: (menuContext) => [ PopupMenuItem( child: Row( children: [ Icon( Icons.logout, - color: Theme.of(context).colorScheme.error, + color: Theme.of(menuContext).colorScheme.error, ), const SizedBox(width: 8), - Text(context.l10n.common_disconnect), + Text(menuContext.l10n.common_disconnect), ], ), onTap: () => _disconnect(context), @@ -126,7 +139,7 @@ class _ChannelsScreenState extends State children: [ const Icon(Icons.groups), const SizedBox(width: 8), - Text(context.l10n.community_manageCommunities), + Text(menuContext.l10n.community_manageCommunities), ], ), onTap: () => _showManageCommunitiesDialog(context), @@ -136,7 +149,7 @@ class _ChannelsScreenState extends State children: [ const Icon(Icons.settings), const SizedBox(width: 8), - Text(context.l10n.settings_title), + Text(menuContext.l10n.settings_title), ], ), onTap: () => Navigator.push( @@ -219,9 +232,6 @@ class _ChannelsScreenState extends State _buildFilterButton(viewState), ], ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(12), - ), contentPadding: const EdgeInsets.symmetric( horizontal: 16, vertical: 12, @@ -264,8 +274,8 @@ class _ChannelsScreenState extends State viewState.channelsSearchText.isEmpty) ? ReorderableListView.builder( padding: const EdgeInsets.only( - left: 16, - right: 16, + left: 0, + right: 0, top: 8, bottom: 88, ), @@ -294,13 +304,14 @@ class _ChannelsScreenState extends State channel, showDragHandle: true, dragIndex: index, + listIndex: index, ); }, ) : ListView.builder( padding: const EdgeInsets.only( - left: 16, - right: 16, + left: 0, + right: 0, top: 8, bottom: 88, ), @@ -312,6 +323,7 @@ class _ChannelsScreenState extends State connector, channelMessageStore, channel, + listIndex: index, ); }, ), @@ -346,16 +358,17 @@ class _ChannelsScreenState extends State Channel channel, { bool showDragHandle = false, int? dragIndex, + int listIndex = 0, }) { final unreadCount = connector.getUnreadCountForChannel(channel); final isMuted = context.watch().isChannelMuted( channel.name, ); + final scheme = Theme.of(context).colorScheme; // Determine icon and colors based on channel type IconData icon; Color iconColor; - Color bgColor; final ChannelType channelType = Channel.getChannelType( channel, _communityIndex, @@ -364,131 +377,194 @@ class _ChannelsScreenState extends State switch (channelType) { case ChannelType.communityPublic: icon = Icons.groups; - iconColor = Colors.purple; - bgColor = Colors.purple.withValues(alpha: 0.2); + iconColor = MeshPalette.magenta; case ChannelType.communityHashtag: - icon = Icons.tag; - iconColor = Colors.purple; - bgColor = Colors.purple.withValues(alpha: 0.2); + icon = Icons.groups; + iconColor = MeshPalette.magenta; case ChannelType.public: icon = Icons.public; - iconColor = Colors.green; - bgColor = Colors.green.withValues(alpha: 0.2); + iconColor = MeshPalette.signal; case ChannelType.hashtag: icon = Icons.tag; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); + iconColor = MeshPalette.blue; case ChannelType.private: icon = Icons.lock; - iconColor = Colors.blue; - bgColor = Colors.blue.withValues(alpha: 0.2); + iconColor = MeshPalette.blue; } - return Card( - key: ValueKey('channel_${channel.index}'), - margin: const EdgeInsets.only(bottom: 12), - child: GestureDetector( - onSecondaryTapUp: PlatformInfo.isDesktop - ? (_) => _showChannelActions( - context, - connector, - channelMessageStore, - channel, - ) - : null, - child: ListTile( - dense: true, - minVerticalPadding: 14, - contentPadding: const EdgeInsets.symmetric(horizontal: 12), - visualDensity: const VisualDensity(vertical: -2), - leading: Stack( - children: [ - Padding( - padding: const EdgeInsets.symmetric(vertical: 3), - child: CircleAvatar( - backgroundColor: bgColor, - child: Icon(icon, color: iconColor), - ), + // Last message preview + final messages = connector.getChannelMessages(channel); + final lastMessage = messages.isNotEmpty ? messages.last : null; + final lastPreview = lastMessage?.text ?? ''; + final lastTime = lastMessage?.timestamp; + + final channelLabel = channel.name.isEmpty + ? context.l10n.channels_channelIndex(channel.index) + : channel.name; + + return ListEntrance( + key: ValueKey('channel_entrance_${channel.index}'), + index: dragIndex ?? listIndex, + child: MeshCard( + key: ValueKey('channel_${channel.index}'), + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + onTap: () { + HapticFeedback.selectionClick(); + final unread = connector.getUnreadCountForChannelIndex(channel.index); + connector.markChannelRead(channel.index); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => ChannelChatScreen( + channel: channel, + initialUnreadCount: unread, ), - if (isCommunityChannel) - Positioned( - right: 0, - bottom: 0, - child: Container( - width: 14, - height: 14, - decoration: BoxDecoration( - color: Colors.purple, - shape: BoxShape.circle, - border: Border.all( - color: Theme.of(context).cardColor, - width: 2, + ), + ); + }, + onLongPress: () => _showChannelActions( + this.context, + connector, + channelMessageStore, + channel, + ), + child: GestureDetector( + onSecondaryTapUp: PlatformInfo.isDesktop + ? (_) => _showChannelActions( + this.context, + connector, + channelMessageStore, + channel, + ) + : null, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Leading avatar with optional community badge + Stack( + clipBehavior: Clip.none, + children: [ + AvatarCircle( + name: channelLabel, + size: 42, + color: iconColor, + icon: icon, + ), + if (isCommunityChannel) + Positioned( + right: -2, + bottom: -2, + child: Container( + width: 16, + height: 16, + decoration: BoxDecoration( + color: MeshPalette.magenta, + shape: BoxShape.circle, + border: Border.all( + color: Theme.of(context).colorScheme.surfaceContainerLow, + width: 2, + ), + ), + child: const Icon( + Icons.people, + size: 8, + color: Colors.white, + ), ), ), - child: const Icon( - Icons.people, - size: 8, - color: Colors.white, + ], + ), + const SizedBox(width: 12), + // Title + subtitle + ch chip + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Text( + channelLabel, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + const SizedBox(width: 6), + StatusChip( + label: 'CH ${channel.index}', + color: MeshPalette.blue, + fontSize: 10, + ), + ], ), + if (lastPreview.isNotEmpty) ...[ + const SizedBox(height: 2), + Text( + lastPreview, + style: MeshTheme.mono( + fontSize: 11.5, + color: scheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ], + ), + ), + const SizedBox(width: 8), + // Right side: time + unread badge + muted + drag handle + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + if (lastTime != null) + Text( + _relativeTime(lastTime), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 4), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (isMuted) ...[ + Icon( + Icons.notifications_off, + size: 14, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 4), + ], + if (unreadCount > 0) + UnreadBadge(count: unreadCount), + ], ), - ), - ], - ), - title: Text( - channel.name.isEmpty - ? context.l10n.channels_channelIndex(channel.index) - : channel.name, - style: const TextStyle(fontWeight: FontWeight.w500), - ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (isMuted) ...[ - Icon( - Icons.notifications_off, - size: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), + ], + ), + if (showDragHandle && dragIndex != null) ...[ const SizedBox(width: 4), - ], - if (unreadCount > 0) ...[ - UnreadBadge(count: unreadCount), - const SizedBox(width: 4), - ], - if (showDragHandle && dragIndex != null) ReorderableDragStartListener( index: dragIndex, child: Padding( - padding: const EdgeInsets.all(12), + padding: const EdgeInsets.all(8), child: Icon( Icons.drag_handle, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, ), ), ), + ], ], ), - onTap: () { - final unread = connector.getUnreadCountForChannelIndex( - channel.index, - ); - connector.markChannelRead(channel.index); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => ChannelChatScreen( - channel: channel, - initialUnreadCount: unread, - ), - ), - ); - }, - onLongPress: () => _showChannelActions( - context, - connector, - channelMessageStore, - channel, - ), ), ), ); @@ -512,7 +588,7 @@ class _ChannelsScreenState extends State children: [ ListTile( leading: const Icon(Icons.edit_outlined), - title: Text(context.l10n.channels_editChannel), + title: Text(sheetContext.l10n.channels_editChannel), onTap: () async { Navigator.pop(sheetContext); await Future.delayed(const Duration(milliseconds: 100)); @@ -529,8 +605,8 @@ class _ChannelsScreenState extends State ), title: Text( isMuted - ? context.l10n.channels_unmuteChannel - : context.l10n.channels_muteChannel, + ? sheetContext.l10n.channels_unmuteChannel + : sheetContext.l10n.channels_muteChannel, ), onTap: () async { Navigator.pop(sheetContext); @@ -547,7 +623,7 @@ class _ChannelsScreenState extends State color: Theme.of(sheetContext).colorScheme.error, ), title: Text( - context.l10n.channels_deleteChannel, + sheetContext.l10n.channels_deleteChannel, style: TextStyle( color: Theme.of(sheetContext).colorScheme.error, ), @@ -557,7 +633,7 @@ class _ChannelsScreenState extends State await Future.delayed(const Duration(milliseconds: 100)); if (parentContext.mounted) { _confirmDeleteChannel( - context, + parentContext, connector, channelMessageStore, channel, @@ -714,11 +790,11 @@ class _ChannelsScreenState extends State _communityStore.setPublicKeyHex = connector.selfPublicKeyHex; - showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (dialogContext, setDialogState) { - Widget buildOptionTile({ + showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) { + Widget buildOptionCard({ required int optionIndex, required IconData icon, required String title, @@ -726,51 +802,19 @@ class _ChannelsScreenState extends State bool enabled = true, }) { final isSelected = selectedOption == optionIndex; - return ListTile( - leading: CircleAvatar( - backgroundColor: enabled - ? (isSelected - ? Theme.of(dialogContext).colorScheme.primaryContainer - : null) - : Theme.of( - dialogContext, - ).colorScheme.onSurface.withValues(alpha: 0.12), - child: Icon( - icon, - color: enabled - ? (isSelected - ? Theme.of(dialogContext).colorScheme.primary - : null) - : Theme.of( - dialogContext, - ).colorScheme.onSurface.withValues(alpha: 0.38), - ), - ), - title: Text( - title, - style: TextStyle( - color: enabled - ? null - : Theme.of( - dialogContext, - ).colorScheme.onSurface.withValues(alpha: 0.38), - ), - ), - subtitle: Text( - subtitle, - style: TextStyle( - color: enabled - ? null - : Theme.of( - dialogContext, - ).colorScheme.onSurface.withValues(alpha: 0.38), - ), - ), - trailing: enabled ? const Icon(Icons.chevron_right) : null, - selected: isSelected, + final cardScheme = Theme.of(sheetContext).colorScheme; + return MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + borderColor: isSelected && enabled + ? MeshPalette.blueLine + : null, + color: isSelected && enabled + ? MeshPalette.blueBg + : null, onTap: enabled ? () { - setDialogState(() { + setSheetState(() { selectedOption = optionIndex; nameController.clear(); pskController.clear(); @@ -778,6 +822,49 @@ class _ChannelsScreenState extends State }); } : null, + child: Row( + children: [ + AvatarCircle( + name: title, + size: 38, + color: enabled + ? (isSelected ? MeshPalette.blue : cardScheme.onSurfaceVariant) + : cardScheme.outline, + icon: icon, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + title, + style: Theme.of(sheetContext).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + color: enabled ? null : cardScheme.outline, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: Theme.of(sheetContext).textTheme.bodySmall?.copyWith( + color: enabled ? cardScheme.onSurfaceVariant : cardScheme.outline, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + if (enabled) + Icon( + Icons.chevron_right, + color: isSelected ? MeshPalette.blue : cardScheme.onSurfaceVariant, + size: 20, + ), + ], + ), ); } @@ -796,7 +883,7 @@ class _ChannelsScreenState extends State child: TextField( controller: nameController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_channelName, + labelText: sheetContext.l10n.channels_channelName, border: const OutlineInputBorder(), ), maxLength: 31, @@ -814,7 +901,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_enterChannelName, ), @@ -826,7 +913,7 @@ class _ChannelsScreenState extends State for (int i = 0; i < 16; i++) { psk[i] = random.nextInt(256); } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); await connector.setChannel( nextIndex, name, @@ -844,12 +931,13 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_create), + child: Text(sheetContext.l10n.common_create), ), ), ], ), ), + const SizedBox(height: 8), ], ); @@ -864,7 +952,7 @@ class _ChannelsScreenState extends State child: TextField( controller: nameController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_channelName, + labelText: sheetContext.l10n.channels_channelName, border: const OutlineInputBorder(), ), maxLength: 31, @@ -878,7 +966,7 @@ class _ChannelsScreenState extends State child: TextField( controller: pskController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_pskHex, + labelText: sheetContext.l10n.channels_pskHex, border: const OutlineInputBorder(), ), ), @@ -896,7 +984,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_enterChannelName, ), @@ -910,14 +998,14 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_pskMustBe32Hex, ), ); return; } - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); connector.setChannel(nextIndex, name, psk); if (context.mounted) { showDismissibleSnackBar( @@ -928,12 +1016,13 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_add), + child: Text(sheetContext.l10n.common_add), ), ), ], ), ), + const SizedBox(height: 8), ], ); @@ -951,7 +1040,7 @@ class _ChannelsScreenState extends State final psk = Channel.parsePskHex( Channel.publicChannelPsk, ); - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); connector.setChannel( nextIndex, context.l10n.channels_public, @@ -966,7 +1055,7 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_add), + child: Text(sheetContext.l10n.common_add), ), ), ], @@ -980,7 +1069,7 @@ class _ChannelsScreenState extends State if (_communities.isNotEmpty) ...[ RadioGroup( groupValue: isRegularHashtag, - onChanged: (v) => setDialogState(() { + onChanged: (v) => setSheetState(() { if (v == null) return; isRegularHashtag = v; if (isRegularHashtag) { @@ -995,20 +1084,20 @@ class _ChannelsScreenState extends State RadioListTile( value: true, title: Text( - dialogContext.l10n.community_regularHashtag, + sheetContext.l10n.community_regularHashtag, ), subtitle: Text( - dialogContext.l10n.community_regularHashtagDesc, + sheetContext.l10n.community_regularHashtagDesc, ), dense: true, ), RadioListTile( value: false, title: Text( - dialogContext.l10n.community_communityHashtag, + sheetContext.l10n.community_communityHashtag, ), subtitle: Text( - dialogContext + sheetContext .l10n .community_communityHashtagDesc, ), @@ -1036,10 +1125,10 @@ class _ChannelsScreenState extends State ) .toList(), onChanged: (c) => - setDialogState(() => selectedCommunity = c), + setSheetState(() => selectedCommunity = c), decoration: InputDecoration( labelText: - dialogContext.l10n.community_selectCommunity, + sheetContext.l10n.community_selectCommunity, border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.groups), ), @@ -1054,8 +1143,8 @@ class _ChannelsScreenState extends State child: TextField( controller: hashtagController, decoration: InputDecoration( - labelText: dialogContext.l10n.channels_enterHashtag, - hintText: dialogContext.l10n.channels_hashtagHint, + labelText: sheetContext.l10n.channels_enterHashtag, + hintText: sheetContext.l10n.channels_hashtagHint, border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.tag), ), @@ -1067,11 +1156,11 @@ class _ChannelsScreenState extends State Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: Text( - dialogContext.l10n.community_hashtagPrivacyHint, + sheetContext.l10n.community_hashtagPrivacyHint, style: TextStyle( fontSize: 12, color: Theme.of( - dialogContext, + sheetContext, ).colorScheme.onSurfaceVariant, fontStyle: FontStyle.italic, ), @@ -1092,7 +1181,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext + sheetContext .l10n .channels_enterChannelName, ), @@ -1115,9 +1204,9 @@ class _ChannelsScreenState extends State // Community hashtag - HMAC derivation from community secret if (selectedCommunity == null) { showDismissibleSnackBar( - dialogContext, + sheetContext, content: Text( - dialogContext + sheetContext .l10n .community_selectCommunity, ), @@ -1136,8 +1225,8 @@ class _ChannelsScreenState extends State _loadCommunities(); } - if (dialogContext.mounted) { - Navigator.pop(dialogContext); + if (sheetContext.mounted) { + Navigator.pop(sheetContext); } connector.setChannel( nextIndex, @@ -1155,7 +1244,7 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_add), + child: Text(sheetContext.l10n.common_add), ), ), ], @@ -1175,7 +1264,7 @@ class _ChannelsScreenState extends State Expanded( child: FilledButton.icon( onPressed: () async { - Navigator.pop(dialogContext); + Navigator.pop(sheetContext); if (context.mounted) { final result = await Navigator.push( context, @@ -1191,7 +1280,7 @@ class _ChannelsScreenState extends State } }, icon: const Icon(Icons.qr_code_scanner), - label: Text(dialogContext.l10n.community_scanQr), + label: Text(sheetContext.l10n.community_scanQr), ), ), ], @@ -1209,8 +1298,8 @@ class _ChannelsScreenState extends State child: TextField( controller: nameController, decoration: InputDecoration( - labelText: dialogContext.l10n.community_name, - hintText: dialogContext.l10n.community_enterName, + labelText: sheetContext.l10n.community_name, + hintText: sheetContext.l10n.community_enterName, border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.groups), ), @@ -1220,15 +1309,15 @@ class _ChannelsScreenState extends State CheckboxListTile( value: addPublicChannel, onChanged: (value) { - setDialogState(() { + setSheetState(() { addPublicChannel = value ?? true; }); }, title: Text( - dialogContext.l10n.community_addPublicChannel, + sheetContext.l10n.community_addPublicChannel, ), subtitle: Text( - dialogContext.l10n.community_addPublicChannelHint, + sheetContext.l10n.community_addPublicChannelHint, ), controlAffinity: ListTileControlAffinity.leading, contentPadding: const EdgeInsets.symmetric( @@ -1249,7 +1338,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - dialogContext.l10n.community_enterName, + sheetContext.l10n.community_enterName, ), ); return; @@ -1277,8 +1366,8 @@ class _ChannelsScreenState extends State ); } - if (dialogContext.mounted) { - Navigator.pop(dialogContext); + if (sheetContext.mounted) { + Navigator.pop(sheetContext); } // Refresh communities list @@ -1307,12 +1396,13 @@ class _ChannelsScreenState extends State ); } }, - child: Text(dialogContext.l10n.common_create), + child: Text(sheetContext.l10n.common_create), ), ), ], ), ), + const SizedBox(height: 8), ], ); @@ -1321,84 +1411,80 @@ class _ChannelsScreenState extends State } } - return AlertDialog( - title: Text(dialogContext.l10n.channels_addChannel), - contentPadding: const EdgeInsets.symmetric(vertical: 16), - content: SizedBox( - width: double.maxFinite, - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - buildOptionTile( - optionIndex: 0, - icon: Icons.add, - title: dialogContext.l10n.channels_createPrivateChannel, - subtitle: - dialogContext.l10n.channels_createPrivateChannelDesc, - ), - if (selectedOption == 0) - buildExpandedContent(_channelMessageStore)!, - const Divider(height: 1), - buildOptionTile( - optionIndex: 1, - icon: Icons.lock, - title: dialogContext.l10n.channels_joinPrivateChannel, - subtitle: - dialogContext.l10n.channels_joinPrivateChannelDesc, - ), - if (selectedOption == 1) - buildExpandedContent(_channelMessageStore)!, - if (!hasPublicChannel) ...[ - const Divider(height: 1), - buildOptionTile( - optionIndex: 2, - icon: Icons.public, - title: dialogContext.l10n.channels_joinPublicChannel, + return DraggableScrollableSheet( + expand: false, + initialChildSize: 0.7, + minChildSize: 0.4, + maxChildSize: 0.95, + builder: (_, scrollController) => Column( + children: [ + BottomSheetHeader( + title: sheetContext.l10n.channels_addChannel, + ), + Expanded( + child: ListView( + controller: scrollController, + padding: const EdgeInsets.only(bottom: 24), + children: [ + buildOptionCard( + optionIndex: 0, + icon: Icons.add, + title: sheetContext.l10n.channels_createPrivateChannel, subtitle: - dialogContext.l10n.channels_joinPublicChannelDesc, + sheetContext.l10n.channels_createPrivateChannelDesc, ), - if (selectedOption == 2) + if (selectedOption == 0) + buildExpandedContent(_channelMessageStore)!, + buildOptionCard( + optionIndex: 1, + icon: Icons.lock, + title: sheetContext.l10n.channels_joinPrivateChannel, + subtitle: + sheetContext.l10n.channels_joinPrivateChannelDesc, + ), + if (selectedOption == 1) + buildExpandedContent(_channelMessageStore)!, + if (!hasPublicChannel) ...[ + buildOptionCard( + optionIndex: 2, + icon: Icons.public, + title: sheetContext.l10n.channels_joinPublicChannel, + subtitle: + sheetContext.l10n.channels_joinPublicChannelDesc, + ), + if (selectedOption == 2) + buildExpandedContent(_channelMessageStore)!, + ], + buildOptionCard( + optionIndex: 3, + icon: Icons.tag, + title: sheetContext.l10n.channels_joinHashtagChannel, + subtitle: + sheetContext.l10n.channels_joinHashtagChannelDesc, + ), + if (selectedOption == 3) + buildExpandedContent(_channelMessageStore)!, + buildOptionCard( + optionIndex: 4, + icon: Icons.qr_code_scanner, + title: sheetContext.l10n.community_scanQr, + subtitle: sheetContext.l10n.community_join, + ), + if (selectedOption == 4) + buildExpandedContent(_channelMessageStore)!, + buildOptionCard( + optionIndex: 5, + icon: Icons.groups, + title: sheetContext.l10n.community_create, + subtitle: sheetContext.l10n.community_createDesc, + ), + if (selectedOption == 5) buildExpandedContent(_channelMessageStore)!, ], - const Divider(height: 1), - buildOptionTile( - optionIndex: 3, - icon: Icons.tag, - title: dialogContext.l10n.channels_joinHashtagChannel, - subtitle: - dialogContext.l10n.channels_joinHashtagChannelDesc, - ), - if (selectedOption == 3) - buildExpandedContent(_channelMessageStore)!, - const Divider(height: 1), - buildOptionTile( - optionIndex: 4, - icon: Icons.qr_code_scanner, - title: dialogContext.l10n.community_scanQr, - subtitle: dialogContext.l10n.community_join, - ), - if (selectedOption == 4) - buildExpandedContent(_channelMessageStore)!, - const Divider(height: 1), - buildOptionTile( - optionIndex: 5, - icon: Icons.groups, - title: dialogContext.l10n.community_create, - subtitle: dialogContext.l10n.community_createDesc, - ), - if (selectedOption == 5) - buildExpandedContent(_channelMessageStore)!, - ], + ), ), - ), + ], ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(dialogContext.l10n.common_close), - ), - ], ); }, ), @@ -1422,154 +1508,175 @@ class _ChannelsScreenState extends State channel.index, ); - showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (dialogContext, setState) => AlertDialog( - title: Text( - dialogContext.l10n.channels_editChannelTitle(channel.index), - ), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextField( - controller: nameController, - decoration: InputDecoration( - labelText: dialogContext.l10n.channels_channelName, - border: const OutlineInputBorder(), - ), - maxLength: 31, - ), - const SizedBox(height: 16), - TextField( - controller: pskController, - decoration: InputDecoration( - labelText: dialogContext.l10n.channels_pskHex, - border: const OutlineInputBorder(), - suffixIcon: IconButton( - icon: const Icon(Icons.casino), - tooltip: dialogContext.l10n.channels_generateRandomPsk, - onPressed: () { - final random = Random.secure(); - final bytes = Uint8List(16); - for (int i = 0; i < 16; i++) { - bytes[i] = random.nextInt(256); - } - pskController.text = Channel.formatPskHex(bytes); - }, - ), - ), - ), - const SizedBox(height: 16), - SwitchListTile( - contentPadding: EdgeInsets.zero, - title: Text(dialogContext.l10n.channels_smazCompression), - value: smazEnabled, - onChanged: (value) => setState(() { - smazEnabled = value; - if (smazEnabled) { - cyr2latEnabled = false; - } - }), - ), - SwitchListTile( - contentPadding: EdgeInsets.zero, - title: Text(dialogContext.l10n.channels_cyr2latCompression), - subtitle: Text( - dialogContext.l10n.channels_cyr2latCompressionDscr, - ), - value: cyr2latEnabled, - onChanged: (value) => setState(() { - cyr2latEnabled = value; - if (cyr2latEnabled) { - smazEnabled = false; - } - }), - ), - if (cyr2latEnabled) ...[ - Padding( - padding: const EdgeInsets.fromLTRB(0, 8, 0, 8), - child: DropdownButtonFormField( - initialValue: selectedCyr2LatProfileId, + showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) => DraggableScrollableSheet( + expand: false, + initialChildSize: 0.65, + minChildSize: 0.4, + maxChildSize: 0.95, + builder: (_, scrollController) => Column( + children: [ + BottomSheetHeader( + title: sheetContext.l10n.channels_editChannelTitle(channel.index), + ), + Expanded( + child: ListView( + controller: scrollController, + padding: const EdgeInsets.symmetric(horizontal: 16), + children: [ + const SizedBox(height: 8), + TextField( + controller: nameController, decoration: InputDecoration( - labelText: dialogContext - .l10n - .channels_cyr2latSettingsSubheading, + labelText: sheetContext.l10n.channels_channelName, border: const OutlineInputBorder(), ), - items: appSettingsService.settings.cyr2latProfiles.map(( - profile, - ) { - return DropdownMenuItem( - value: profile.id, - child: Text(profile.name), - ); - }).toList(), - onChanged: (value) => setState(() { - selectedCyr2LatProfileId = value; + maxLength: 31, + ), + const SizedBox(height: 16), + TextField( + controller: pskController, + decoration: InputDecoration( + labelText: sheetContext.l10n.channels_pskHex, + border: const OutlineInputBorder(), + suffixIcon: IconButton( + icon: const Icon(Icons.casino), + tooltip: sheetContext.l10n.channels_generateRandomPsk, + onPressed: () { + final random = Random.secure(); + final bytes = Uint8List(16); + for (int i = 0; i < 16; i++) { + bytes[i] = random.nextInt(256); + } + pskController.text = Channel.formatPskHex(bytes); + }, + ), + ), + ), + const SizedBox(height: 16), + SwitchListTile( + contentPadding: EdgeInsets.zero, + title: Text(sheetContext.l10n.channels_smazCompression), + value: smazEnabled, + onChanged: (value) => setSheetState(() { + smazEnabled = value; + if (smazEnabled) { + cyr2latEnabled = false; + } }), ), - ), - ], - ], - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(dialogContext.l10n.common_cancel), - ), - FilledButton( - onPressed: () async { - final name = nameController.text.trim(); - final pskHex = pskController.text.trim(); - - Uint8List psk; - try { - psk = Channel.parsePskHex(pskHex); - } on FormatException { - showDismissibleSnackBar( - dialogContext, - content: Text(dialogContext.l10n.channels_pskMustBe32Hex), - ); - return; - } - - Navigator.pop(dialogContext); - try { - await connector.setChannel(channel.index, name, psk); - await connector.setChannelSmazEnabled( - channel.index, - smazEnabled, - ); - await connector.setChannelCyr2LatEnabled( - channel.index, - cyr2latEnabled, - ); - await connector.setChannelCyr2LatProfileId( - channel.index, - selectedCyr2LatProfileId, - ); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(context.l10n.channels_channelUpdated(name)), - ); - } catch (e, st) { - debugPrint(st.toString()); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text( - context.l10n.channels_channelUpdateFailed('$e'), + SwitchListTile( + contentPadding: EdgeInsets.zero, + title: Text(sheetContext.l10n.channels_cyr2latCompression), + subtitle: Text( + sheetContext.l10n.channels_cyr2latCompressionDscr, + ), + value: cyr2latEnabled, + onChanged: (value) => setSheetState(() { + cyr2latEnabled = value; + if (cyr2latEnabled) { + smazEnabled = false; + } + }), ), - ); - } - }, - child: Text(dialogContext.l10n.common_save), - ), - ], + if (cyr2latEnabled) ...[ + Padding( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 8), + child: DropdownButtonFormField( + initialValue: selectedCyr2LatProfileId, + decoration: InputDecoration( + labelText: sheetContext + .l10n + .channels_cyr2latSettingsSubheading, + border: const OutlineInputBorder(), + ), + items: appSettingsService.settings.cyr2latProfiles.map(( + profile, + ) { + return DropdownMenuItem( + value: profile.id, + child: Text(profile.name), + ); + }).toList(), + onChanged: (value) => setSheetState(() { + selectedCyr2LatProfileId = value; + }), + ), + ), + ], + const SizedBox(height: 24), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: OutlinedButton( + onPressed: () => Navigator.pop(sheetContext), + child: Text(sheetContext.l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + onPressed: () async { + final name = nameController.text.trim(); + final pskHex = pskController.text.trim(); + + Uint8List psk; + try { + psk = Channel.parsePskHex(pskHex); + } on FormatException { + showDismissibleSnackBar( + sheetContext, + content: Text(sheetContext.l10n.channels_pskMustBe32Hex), + ); + return; + } + + Navigator.pop(sheetContext); + try { + await connector.setChannel(channel.index, name, psk); + await connector.setChannelSmazEnabled( + channel.index, + smazEnabled, + ); + await connector.setChannelCyr2LatEnabled( + channel.index, + cyr2latEnabled, + ); + await connector.setChannelCyr2LatProfileId( + channel.index, + selectedCyr2LatProfileId, + ); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(context.l10n.channels_channelUpdated(name)), + ); + } catch (e, st) { + debugPrint(st.toString()); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text( + context.l10n.channels_channelUpdateFailed('$e'), + ), + ); + } + }, + child: Text(sheetContext.l10n.common_save), + ), + ), + ], + ), + ), + ], + ), ), ), ); @@ -1625,7 +1732,7 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.common_delete, - style: TextStyle(color: Theme.of(context).colorScheme.error), + style: TextStyle(color: Theme.of(dialogContext).colorScheme.error), ), ), ], @@ -1651,9 +1758,8 @@ class _ChannelsScreenState extends State } void _showManageCommunitiesDialog(BuildContext context) { - showModalBottomSheet( - context: context, - isScrollControlled: true, + showMeshSheet( + context, builder: (sheetContext) => DraggableScrollableSheet( initialChildSize: 0.5, minChildSize: 0.3, @@ -1661,18 +1767,8 @@ class _ChannelsScreenState extends State expand: false, builder: (_, scrollController) => Column( children: [ - Padding( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - const Icon(Icons.groups, size: 28), - const SizedBox(width: 12), - Text( - context.l10n.community_manageCommunities, - style: Theme.of(context).textTheme.titleLarge, - ), - ], - ), + BottomSheetHeader( + title: sheetContext.l10n.community_manageCommunities, ), const Divider(height: 1), Expanded( @@ -1684,27 +1780,27 @@ class _ChannelsScreenState extends State Icon( Icons.groups_outlined, size: 64, - color: Theme.of(context) + color: Theme.of(sheetContext) .colorScheme .onSurfaceVariant .withValues(alpha: 0.6), ), const SizedBox(height: 16), Text( - context.l10n.community_noCommunities, + sheetContext.l10n.community_noCommunities, style: TextStyle( fontSize: 16, color: Theme.of( - context, + sheetContext, ).colorScheme.onSurfaceVariant, ), ), const SizedBox(height: 8), Text( - context.l10n.community_scanOrCreate, + sheetContext.l10n.community_scanOrCreate, style: TextStyle( fontSize: 14, - color: Theme.of(context) + color: Theme.of(sheetContext) .colorScheme .onSurfaceVariant .withValues(alpha: 0.8), @@ -1721,12 +1817,10 @@ class _ChannelsScreenState extends State final community = _communities[index]; return ListTile( leading: CircleAvatar( - backgroundColor: Colors.purple.withValues( - alpha: 0.2, - ), + backgroundColor: MeshPalette.magentaBg, child: const Icon( Icons.groups, - color: Colors.purple, + color: MeshPalette.magenta, ), ), title: Text(community.name), @@ -1744,10 +1838,12 @@ class _ChannelsScreenState extends State trailing: PopupMenuButton( onSelected: (value) { Navigator.pop(sheetContext); + // Use the screen's context: the sheet item's + // context is deactivated once the sheet pops. if (value == 'share') { - _showCommunityQrDialog(context, community); + _showCommunityQrDialog(this.context, community); } else if (value == 'leave') { - _confirmLeaveCommunity(context, community); + _confirmLeaveCommunity(this.context, community); } }, itemBuilder: (context) => [ @@ -1879,7 +1975,7 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.community_delete, - style: TextStyle(color: Theme.of(context).colorScheme.error), + style: TextStyle(color: Theme.of(dialogContext).colorScheme.error), ), ), ], diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 89310bbd..3b0a2441 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -30,7 +30,6 @@ import '../widgets/chat_zoom_wrapper.dart'; import '../widgets/byte_count_input.dart'; import 'channel_message_path_screen.dart'; import 'map_screen.dart'; -import '../helpers/contact_ui.dart'; import '../widgets/emoji_picker.dart'; import '../widgets/gif_message.dart'; import '../widgets/jump_to_bottom_button.dart'; @@ -43,6 +42,8 @@ import '../widgets/translated_message_content.dart'; import '../l10n/l10n.dart'; import '../helpers/snack_bar_builder.dart'; import '../widgets/unread_divider.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import 'telemetry_screen.dart'; class ChatScreen extends StatefulWidget { @@ -448,119 +449,157 @@ class _ChatScreenState extends State { Widget _buildInputBar(MeshCoreConnector connector) { final maxBytes = maxContactMessageBytes(); - final colorScheme = Theme.of(context).colorScheme; + final scheme = Theme.of(context).colorScheme; final settings = context.watch().settings; return Container( - padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: colorScheme.surface, - border: Border(top: BorderSide(color: Theme.of(context).dividerColor)), + color: scheme.surface, + border: Border(top: BorderSide(color: scheme.outlineVariant, width: 1)), ), child: SafeArea( - child: Row( - children: [ - IconButton( - icon: const Icon(Icons.gif_box), - onPressed: () => _showGifPicker(context), - tooltip: context.l10n.chat_sendGif, - ), - if (settings.translationEnabled) - MessageTranslationButton( - enabled: settings.composerTranslationEnabled, - languageCode: settings.translationTargetLanguageCode, - onPressed: _showTranslationOptions, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + IconButton( + icon: const Icon(Icons.gif_box), + onPressed: () => _showGifPicker(context), + tooltip: context.l10n.chat_sendGif, ), - Expanded( - child: ValueListenableBuilder( - valueListenable: _textController, - builder: (context, value, child) { - final gifId = GifHelper.parseGif(value.text); - if (gifId != null) { - return Focus( - autofocus: true, - onKeyEvent: (node, event) { - if (event is KeyDownEvent && - (event.logicalKey == LogicalKeyboardKey.enter || - event.logicalKey == - LogicalKeyboardKey.numpadEnter)) { - _sendMessage(connector); - return KeyEventResult.handled; - } - return KeyEventResult.ignored; - }, - child: Row( - children: [ - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.circular(12), - child: GifMessage( - url: - 'https://media.giphy.com/media/$gifId/giphy.gif', - backgroundColor: - colorScheme.surfaceContainerHighest, - fallbackTextColor: colorScheme.onSurface - .withValues(alpha: 0.6), - maxSize: 160, + if (settings.translationEnabled) + MessageTranslationButton( + enabled: settings.composerTranslationEnabled, + languageCode: settings.translationTargetLanguageCode, + onPressed: _showTranslationOptions, + ), + Expanded( + child: ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, child) { + final gifId = GifHelper.parseGif(value.text); + if (gifId != null) { + return Focus( + autofocus: true, + onKeyEvent: (node, event) { + if (event is KeyDownEvent && + (event.logicalKey == LogicalKeyboardKey.enter || + event.logicalKey == + LogicalKeyboardKey.numpadEnter)) { + _sendMessage(connector); + return KeyEventResult.handled; + } + return KeyEventResult.ignored; + }, + child: Row( + children: [ + Expanded( + child: ClipRRect( + borderRadius: BorderRadius.circular(12), + child: GifMessage( + url: + 'https://media.giphy.com/media/$gifId/giphy.gif', + backgroundColor: + scheme.surfaceContainerHighest, + fallbackTextColor: scheme.onSurface + .withValues(alpha: 0.6), + maxSize: 160, + ), ), ), + const SizedBox(width: 8), + IconButton( + icon: const Icon(Icons.close), + onPressed: () { + _textController.clear(); + _textFieldFocusNode.requestFocus(); + }, + ), + ], + ), + ); + } + return ByteCountedTextField( + maxBytes: maxBytes, + controller: _textController, + focusNode: _textFieldFocusNode, + hintText: context.l10n.chat_typeMessage, + onSubmitted: (_) => _sendMessage(connector), + encoder: + (connector.isContactSmazEnabled( + widget.contact.publicKeyHex, + ) || + connector.isContactCyr2LatEnabled( + widget.contact.publicKeyHex, + )) + ? (text) => connector.prepareContactOutboundText( + widget.contact, + text, + ) + : null, + decoration: InputDecoration( + hintText: context.l10n.chat_typeMessage, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: BorderSide(color: scheme.outlineVariant), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: BorderSide(color: scheme.outlineVariant), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: BorderSide( + color: scheme.primary, + width: 1.5, ), - const SizedBox(width: 8), - IconButton( - icon: const Icon(Icons.close), - onPressed: () { - _textController.clear(); - _textFieldFocusNode.requestFocus(); - }, - ), - ], + ), + filled: true, + fillColor: scheme.surfaceContainerLow, + contentPadding: const EdgeInsets.symmetric( + horizontal: 18, + vertical: 12, + ), ), ); - } - return ByteCountedTextField( - maxBytes: maxBytes, - controller: _textController, - focusNode: _textFieldFocusNode, - hintText: context.l10n.chat_typeMessage, - onSubmitted: (_) => _sendMessage(connector), - encoder: - (connector.isContactSmazEnabled( - widget.contact.publicKeyHex, - ) || - connector.isContactCyr2LatEnabled( - widget.contact.publicKeyHex, - )) - ? (text) => connector.prepareContactOutboundText( - widget.contact, - text, - ) - : null, - decoration: InputDecoration( - hintText: context.l10n.chat_typeMessage, - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(24), + }, + ), + ), + const SizedBox(width: 6), + ValueListenableBuilder( + valueListenable: _textController, + builder: (context, value, _) { + final hasText = value.text.trim().isNotEmpty; + return AnimatedContainer( + duration: const Duration(milliseconds: 180), + curve: Curves.easeInOut, + child: IconButton.filled( + icon: const Icon(Icons.send, size: 20), + tooltip: context.l10n.chat_sendMessageTo( + _resolveContact(connector).name, ), - filled: true, - fillColor: Theme.of( - context, - ).colorScheme.surfaceContainerLow, - contentPadding: const EdgeInsets.symmetric( - horizontal: 20, - vertical: 14, + style: IconButton.styleFrom( + backgroundColor: hasText + ? scheme.primary + : scheme.surfaceContainerHighest, + foregroundColor: hasText + ? scheme.onPrimary + : scheme.onSurfaceVariant, + minimumSize: const Size(40, 40), + shape: const CircleBorder(), ), + onPressed: hasText + ? () { + HapticFeedback.lightImpact(); + _sendMessage(connector); + } + : null, ), ); }, ), - ), - const SizedBox(width: 8), - IconButton.filled( - icon: const Icon(Icons.send), - tooltip: context.l10n.chat_sendMessageTo( - _resolveContact(connector).name, - ), - onPressed: () => _sendMessage(connector), - ), - ], + ], + ), ), ), ); @@ -1043,12 +1082,17 @@ class _ChatScreenState extends State { ) && (message.translatedText?.trim().isEmpty ?? true); - showModalBottomSheet( - context: context, + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: message.text.length > 40 + ? '${message.text.substring(0, 40)}…' + : message.text, + ), // Can't react to your own messages if (!message.isOutgoing) ListTile( @@ -1118,7 +1162,7 @@ class _ChatScreenState extends State { _openChat(context, contact); }, ), - const Divider(), + const Divider(height: 1), ListTile( leading: Icon( Icons.delete_outline, @@ -1133,6 +1177,7 @@ class _ChatScreenState extends State { await _deleteMessage(message); }, ), + const SizedBox(height: 8), ], ), ), @@ -1221,20 +1266,45 @@ class _MessageBubble extends StatelessWidget { final settingsService = context.watch(); final enableTracing = settingsService.settings.enableMessageTracing; final isOutgoing = message.isOutgoing; - final colorScheme = Theme.of(context).colorScheme; + final scheme = Theme.of(context).colorScheme; final gifId = GifHelper.parseGif(message.text); final poi = parseMarkerText(message.text); final isFailed = message.status == MessageStatus.failed; + + // Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk. final bubbleColor = isFailed - ? colorScheme.errorContainer - : (isOutgoing - ? colorScheme.primary - : colorScheme.surfaceContainerHighest); + ? scheme.errorContainer + : isOutgoing + ? MeshPalette.me + : scheme.surfaceContainerLow; + final bubbleBorder = isFailed + ? scheme.error + : isOutgoing + ? MeshPalette.meBorder + : scheme.outlineVariant; final textColor = isFailed - ? colorScheme.onErrorContainer - : (isOutgoing ? colorScheme.onPrimary : colorScheme.onSurface); - final metaColor = textColor.withValues(alpha: 0.7); + ? scheme.onErrorContainer + : isOutgoing + ? MeshPalette.meInk + : scheme.onSurface; + final metaColor = textColor.withValues(alpha: 0.65); const bodyFontSize = 14.0; + + // Asymmetric radius: outgoing — top-left large, others also large; outgoing bottom-right tight. + final borderRadius = isOutgoing + ? const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.lg), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.xs), + ) + : const BorderRadius.only( + topLeft: Radius.circular(MeshRadii.xs), + topRight: Radius.circular(MeshRadii.lg), + bottomLeft: Radius.circular(MeshRadii.lg), + bottomRight: Radius.circular(MeshRadii.lg), + ); + // Do not strip room-server author bytes here: the parser stores them in // fourByteRoomContactKey, so message.text is safe to render as-is. final messageText = message.text; @@ -1246,8 +1316,9 @@ class _MessageBubble extends StatelessWidget { final originalDisplayText = isOutgoing ? message.originalText : (translatedDisplayText != messageText ? messageText : null); + return Padding( - padding: const EdgeInsets.symmetric(vertical: 4), + padding: const EdgeInsets.symmetric(vertical: 3), child: Column( crossAxisAlignment: isOutgoing ? CrossAxisAlignment.end @@ -1263,11 +1334,11 @@ class _MessageBubble extends StatelessWidget { mainAxisAlignment: isOutgoing ? MainAxisAlignment.end : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ if (!isOutgoing) ...[ - _buildAvatar(senderName, colorScheme), - const SizedBox(width: 8), + _buildAvatar(senderName), + const SizedBox(width: 6), ], Flexible( child: Container( @@ -1278,14 +1349,12 @@ class _MessageBubble extends StatelessWidget { vertical: 8, ), constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.65, + maxWidth: constraints.maxWidth * 0.72, ), decoration: BoxDecoration( color: bubbleColor, - borderRadius: BorderRadius.circular(16), - border: isFailed - ? Border.all(color: colorScheme.error) - : null, + borderRadius: borderRadius, + border: Border.all(color: bubbleBorder, width: 1), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -1301,14 +1370,14 @@ class _MessageBubble extends StatelessWidget { : EdgeInsets.zero, child: Text( senderName, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: colorScheme.primary, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: _colorForName(senderName), ), ), ), - if (gifId == null) const SizedBox(height: 4), + if (gifId == null) const SizedBox(height: 2), ], if (poi != null) _buildPoiMessage( @@ -1349,7 +1418,7 @@ class _MessageBubble extends StatelessWidget { fontSize: bodyFontSize * textScale, ), originalStyle: TextStyle( - color: textColor.withValues(alpha: 0.78), + color: textColor.withValues(alpha: 0.72), fontSize: bodyFontSize * textScale, ), ), @@ -1359,7 +1428,7 @@ class _MessageBubble extends StatelessWidget { if (enableTracing && isOutgoing && message.retryCount > 0) ...[ - const SizedBox(height: 4), + const SizedBox(height: 3), Padding( padding: gifId != null ? const EdgeInsets.symmetric(horizontal: 8) @@ -1372,15 +1441,15 @@ class _MessageBubble extends StatelessWidget { .settings .maxMessageRetries, ), - style: TextStyle( - fontSize: 10 * textScale, + style: MeshTheme.mono( + fontSize: 9.5 * textScale, color: metaColor, - fontWeight: FontWeight.w500, ), ), ), ], - const SizedBox(height: 4), + const SizedBox(height: 3), + // Meta row: timestamp + status icon + optional tracing Padding( padding: gifId != null ? const EdgeInsets.only( @@ -1395,13 +1464,13 @@ class _MessageBubble extends StatelessWidget { children: [ Text( _formatTime(message.timestamp), - style: TextStyle( + style: MeshTheme.mono( fontSize: 10 * textScale, color: metaColor, ), ), if (isOutgoing) ...[ - const SizedBox(width: 4), + const SizedBox(width: 2), MessageStatusIcon( size: 12 * textScale, onColor: metaColor, @@ -1418,25 +1487,21 @@ class _MessageBubble extends StatelessWidget { message.tripTimeMs != null && message.status == MessageStatus.delivered) ...[ - const SizedBox(width: 4), + const SizedBox(width: 2), Icon( Icons.speed, size: 10 * textScale, color: isOutgoing ? metaColor - : Theme.of( - context, - ).colorScheme.tertiary, + : scheme.tertiary, ), Text( '${(message.tripTimeMs! / 1000).toStringAsFixed(1)}s', - style: TextStyle( + style: MeshTheme.mono( fontSize: 9 * textScale, color: isOutgoing ? metaColor - : Theme.of( - context, - ).colorScheme.tertiary, + : scheme.tertiary, ), ), ], @@ -1454,8 +1519,8 @@ class _MessageBubble extends StatelessWidget { if (message.reactions.isNotEmpty) ...[ const SizedBox(height: 4), Padding( - padding: EdgeInsets.only(left: isOutgoing ? 0 : 48), - child: _buildReactionsDisplay(context, message, colorScheme), + padding: EdgeInsets.only(left: isOutgoing ? 0 : 42), + child: _buildReactionsDisplay(context, message, scheme), ), ], ], @@ -1532,7 +1597,7 @@ class _MessageBubble extends StatelessWidget { Widget _buildReactionsDisplay( BuildContext context, Message message, - ColorScheme colorScheme, + ColorScheme scheme, ) { return Wrap( spacing: 6, @@ -1555,28 +1620,33 @@ class _MessageBubble extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), decoration: BoxDecoration( color: isFailed - ? colorScheme.errorContainer - : colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(12), + ? scheme.errorContainer + : scheme.surfaceContainerHigh, + borderRadius: BorderRadius.circular(MeshRadii.pill), border: Border.all( - color: isFailed - ? colorScheme.error - : colorScheme.outline.withValues(alpha: 0.3), + color: isFailed ? scheme.error : scheme.outlineVariant, width: 1, ), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(emoji, style: const TextStyle(fontSize: 16)), + Text( + emoji, + style: MeshTheme.emoji(fontSize: 16), + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), + ), if (count > 1) ...[ const SizedBox(width: 4), Text( '$count', - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: colorScheme.onSecondaryContainer, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: scheme.onSurface, ), ), ], @@ -1587,13 +1657,13 @@ class _MessageBubble extends StatelessWidget { height: 8, child: CircularProgressIndicator( strokeWidth: 1.5, - color: colorScheme.onSecondaryContainer, + color: scheme.primary, ), ), ], if (isFailed) ...[ const SizedBox(width: 2), - Icon(Icons.replay, size: 10, color: colorScheme.error), + Icon(Icons.replay, size: 10, color: scheme.error), ], ], ), @@ -1604,22 +1674,8 @@ class _MessageBubble extends StatelessWidget { ); } - Widget _buildAvatar(String senderName, ColorScheme colorScheme) { - final initial = firstCharacterOrEmoji(senderName); - final color = colorForName(senderName); - - return CircleAvatar( - radius: 18, - backgroundColor: color.withValues(alpha: 0.2), - child: Text( - initial, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.bold, - color: color, - ), - ), - ); + Widget _buildAvatar(String senderName) { + return AvatarCircle(name: senderName, size: 32); } String _formatTime(DateTime time) { @@ -1628,3 +1684,20 @@ class _MessageBubble extends StatelessWidget { return '$hour:$minute'; } } + +/// Deterministic name-to-hue mapping consistent with [AvatarCircle]. +Color _colorForName(String name) { + const hues = [ + MeshPalette.blue, + MeshPalette.magenta, + MeshPalette.signal, + MeshPalette.warn, + Color(0xFF8FA8F0), + Color(0xFF6FD9CE), + ]; + var h = 0; + for (final c in name.codeUnits) { + h = (h * 31 + c) & 0x7fffffff; + } + return hues[h % hues.length]; +} diff --git a/lib/screens/chrome_required_screen.dart b/lib/screens/chrome_required_screen.dart index cdf3c938..4507b10f 100644 --- a/lib/screens/chrome_required_screen.dart +++ b/lib/screens/chrome_required_screen.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; class ChromeRequiredScreen extends StatelessWidget { const ChromeRequiredScreen({super.key}); @@ -7,78 +9,95 @@ class ChromeRequiredScreen extends StatelessWidget { @override Widget build(BuildContext context) { final l10n = context.l10n; - final theme = Theme.of(context); - final colorScheme = theme.colorScheme; + final scheme = Theme.of(context).colorScheme; + return Scaffold( - body: Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(horizontal: 32), - color: colorScheme.surface, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - padding: const EdgeInsets.all(24), - decoration: BoxDecoration( - color: colorScheme.tertiaryContainer.withValues(alpha: 0.4), - shape: BoxShape.circle, - ), - child: Icon( - Icons.browser_not_supported_rounded, - size: 80, - color: colorScheme.tertiary, - ), - ), - const SizedBox(height: 32), - Text( - l10n.scanner_chromeRequired, - textAlign: TextAlign.center, - style: theme.textTheme.headlineMedium?.copyWith( - fontWeight: FontWeight.bold, - color: colorScheme.onSurface, - ), - ), - const SizedBox(height: 16), - Text( - l10n.scanner_chromeRequiredMessage, - textAlign: TextAlign.center, - style: theme.textTheme.bodyLarge?.copyWith( - color: colorScheme.onSurfaceVariant, - height: 1.5, - ), - ), - const SizedBox(height: 48), - // We can't really "fix" it for them other than telling them to use Chrome - // but we can provide a nice visual. - Container( - padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), - decoration: BoxDecoration( - color: colorScheme.secondaryContainer.withValues(alpha: 0.4), - borderRadius: BorderRadius.circular(30), - border: Border.all( - color: colorScheme.outline.withValues(alpha: 0.4), - ), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - Icons.info_outline, - size: 20, - color: colorScheme.secondary, - ), - const SizedBox(width: 12), - Text( - l10n.chrome_bluetoothRequiresChromium, - style: theme.textTheme.bodyMedium?.copyWith( - color: colorScheme.onSecondaryContainer, - fontWeight: FontWeight.w500, + body: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 40), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // Icon in tinted circle + Container( + width: 88, + height: 88, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.tertiary.withValues(alpha: 0.10), + border: Border.all( + color: scheme.tertiary.withValues(alpha: 0.25), + width: 1.5, ), ), - ], - ), + child: Icon( + Icons.browser_not_supported_rounded, + size: 42, + color: scheme.tertiary, + ), + ), + const SizedBox(height: 28), + + // Title + Text( + l10n.scanner_chromeRequired, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.w700, + color: scheme.onSurface, + letterSpacing: -0.3, + ), + ), + const SizedBox(height: 12), + + // Body text + Text( + l10n.scanner_chromeRequiredMessage, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 14, + color: scheme.onSurfaceVariant, + height: 1.55, + ), + ), + const SizedBox(height: 32), + + // Info chip + MeshCard( + margin: EdgeInsets.zero, + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 12, + ), + color: scheme.secondaryContainer.withValues(alpha: 0.35), + borderColor: scheme.outline.withValues(alpha: 0.3), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.info_outline, + size: 18, + color: scheme.secondary, + ), + const SizedBox(width: 10), + Flexible( + child: Text( + l10n.chrome_bluetoothRequiresChromium, + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSecondaryContainer, + fontWeight: FontWeight.w500, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ], ), - ], + ), ), ), ); diff --git a/lib/screens/community_qr_scanner_screen.dart b/lib/screens/community_qr_scanner_screen.dart index 6b71715f..c7941900 100644 --- a/lib/screens/community_qr_scanner_screen.dart +++ b/lib/screens/community_qr_scanner_screen.dart @@ -1,14 +1,18 @@ +import 'dart:async'; + import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:uuid/uuid.dart'; import '../connector/meshcore_connector.dart'; +import '../helpers/snack_bar_builder.dart'; import '../l10n/l10n.dart'; import '../models/community.dart'; import '../storage/community_store.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/qr_scanner_widget.dart'; -import '../helpers/snack_bar_builder.dart'; /// Screen for scanning community QR codes to join communities. /// @@ -35,16 +39,90 @@ class _CommunityQrScannerScreenState extends State { centerTitle: true, ), body: _isProcessing - ? const Center(child: CircularProgressIndicator()) + ? Container( + color: Theme.of(context).colorScheme.surface, + child: const Center(child: CircularProgressIndicator()), + ) : QrScannerWidget( onScanned: (data) => _handleScannedData(context, data), validator: Community.isValidQrData, onValidationFailed: (_) => _showInvalidQrError(context), instructions: context.l10n.community_scanInstructions, + overlay: _buildThemedOverlay(context), ), ); } + Widget _buildThemedOverlay(BuildContext context) { + return Stack( + fit: StackFit.expand, + children: [ + // Dark semi-transparent background with cutout + ColorFiltered( + colorFilter: ColorFilter.mode( + Colors.black.withValues(alpha: 0.5), + BlendMode.srcOut, + ), + child: Stack( + fit: StackFit.expand, + children: [ + Container( + decoration: const BoxDecoration( + color: Colors.black, + backgroundBlendMode: BlendMode.dstOut, + ), + ), + Center( + child: Container( + height: 250, + width: 250, + decoration: BoxDecoration( + color: Colors.red, + borderRadius: BorderRadius.circular(16), + ), + ), + ), + ], + ), + ), + // Corner brackets on top + const ScannerCornerOverlay( + scanWindowSize: 250, + borderColor: MeshPalette.blue, + borderWidth: 2, + cornerLength: 24, + ), + // Instructions pill below the scan window + Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 250 + 24), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 20, + vertical: 10, + ), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.72), + borderRadius: BorderRadius.circular(MeshRadii.pill), + ), + child: Text( + context.l10n.community_scanInstructions, + style: const TextStyle( + color: MeshPalette.ink2, + fontSize: 13, + ), + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ], + ); + } + Future _handleScannedData(BuildContext context, String data) async { if (_isProcessing) return; @@ -80,7 +158,7 @@ class _CommunityQrScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.community_invalidQrCode), - backgroundColor: Colors.red, + backgroundColor: MeshPalette.alert, ); } } finally { @@ -96,29 +174,74 @@ class _CommunityQrScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.community_invalidQrCode), - backgroundColor: Colors.orange, + backgroundColor: MeshPalette.warn, duration: const Duration(seconds: 2), ); } void _showAlreadyMemberDialog(BuildContext context, Community community) { - showDialog( - context: context, - builder: (dialogContext) => AlertDialog( - title: Text(context.l10n.community_alreadyMember), - content: Text( - context.l10n.community_alreadyMemberMessage(community.name), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.pop(dialogContext); - Navigator.pop(context); - }, - child: Text(context.l10n.common_ok), + showMeshSheet( + context, + builder: (sheetContext) { + final sheetScheme = Theme.of(sheetContext).colorScheme; + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + BottomSheetHeader(title: context.l10n.community_alreadyMember), + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), + child: Text( + context.l10n.community_alreadyMemberMessage(community.name), + style: TextStyle(color: sheetScheme.onSurfaceVariant), + ), + ), + MeshCard( + child: Row( + children: [ + const Icon( + Icons.groups, + color: MeshPalette.magenta, + size: 32, + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + community.name, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + Text( + 'ID: ${community.shortCommunityId}...', + style: MeshTheme.mono( + fontSize: 11.5, + color: sheetScheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: FilledButton( + onPressed: () { + Navigator.pop(sheetContext); + Navigator.pop(context); + }, + child: Text(context.l10n.common_ok), + ), ), ], - ), + ); + }, ); } @@ -127,38 +250,51 @@ class _CommunityQrScannerScreenState extends State { Community community, ) async { bool addPublicChannel = true; + final completer = Completer(); - final result = await showDialog( - context: context, - builder: (dialogContext) => StatefulBuilder( - builder: (dialogContext, setDialogState) => AlertDialog( - title: Text(context.l10n.community_joinTitle), - content: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(context.l10n.community_joinConfirmation(community.name)), - const SizedBox(height: 16), - Row( + await showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) { + final joinScheme = Theme.of(sheetContext).colorScheme; + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + BottomSheetHeader(title: context.l10n.community_joinTitle), + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), + child: Text( + context.l10n.community_joinConfirmation(community.name), + style: TextStyle(color: joinScheme.onSurfaceVariant), + ), + ), + MeshCard( + child: Row( children: [ - Icon( - Icons.groups, - color: Theme.of(dialogContext).colorScheme.primary, + AvatarCircle( + name: community.name, + icon: Icons.groups, + color: MeshPalette.magenta, + size: 44, ), - const SizedBox(width: 12), + const SizedBox(width: 14), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( community.name, - style: const TextStyle(fontWeight: FontWeight.bold), + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), ), Text( 'ID: ${community.shortCommunityId}...', - style: TextStyle( - fontSize: 12, - color: Colors.grey[600], + style: MeshTheme.mono( + fontSize: 11.5, + color: joinScheme.onSurfaceVariant, ), ), ], @@ -166,38 +302,59 @@ class _CommunityQrScannerScreenState extends State { ), ], ), - const SizedBox(height: 16), - const Divider(), - const SizedBox(height: 8), - CheckboxListTile( - value: addPublicChannel, - onChanged: (value) { - setDialogState(() { - addPublicChannel = value ?? true; - }); - }, - title: Text(context.l10n.community_addPublicChannel), - subtitle: Text(context.l10n.community_addPublicChannelHint), - controlAffinity: ListTileControlAffinity.leading, - contentPadding: EdgeInsets.zero, - ), - ], - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext, false), - child: Text(context.l10n.common_cancel), ), - FilledButton( - onPressed: () => Navigator.pop(dialogContext, true), - child: Text(context.l10n.community_join), + CheckboxListTile( + value: addPublicChannel, + onChanged: (value) { + setSheetState(() { + addPublicChannel = value ?? true; + }); + }, + title: Text(context.l10n.community_addPublicChannel), + subtitle: Text(context.l10n.community_addPublicChannelHint), + controlAffinity: ListTileControlAffinity.leading, + contentPadding: const EdgeInsets.symmetric(horizontal: 16), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: OutlinedButton( + onPressed: () { + completer.complete(false); + Navigator.pop(sheetContext); + }, + child: Text(context.l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + onPressed: () { + completer.complete(true); + Navigator.pop(sheetContext); + }, + child: Text(context.l10n.community_join), + ), + ), + ], + ), ), ], - ), + ); + }, ), ); - if (result == true && context.mounted) { + // If sheet was dismissed without a button press, treat as cancel + if (!completer.isCompleted) { + completer.complete(false); + } + + final result = await completer.future; + + if (result && context.mounted) { await _joinCommunity(context, community, addPublicChannel); } else if (context.mounted) { // User cancelled - go back @@ -231,7 +388,7 @@ class _CommunityQrScannerScreenState extends State { showDismissibleSnackBar( context, content: Text(context.l10n.community_joined(community.name)), - backgroundColor: Colors.green, + backgroundColor: MeshPalette.signal, ); // Return to previous screen diff --git a/lib/screens/companion_radio_stats_screen.dart b/lib/screens/companion_radio_stats_screen.dart index f666254c..a36a2a6c 100644 --- a/lib/screens/companion_radio_stats_screen.dart +++ b/lib/screens/companion_radio_stats_screen.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:meshcore_open/connector/meshcore_connector.dart'; import 'package:meshcore_open/models/companion_radio_stats.dart'; import 'package:meshcore_open/l10n/l10n.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:meshcore_open/widgets/mesh_ui.dart'; import 'package:provider/provider.dart'; class CompanionRadioStatsScreen extends StatefulWidget { @@ -49,6 +51,25 @@ class _CompanionRadioStatsScreenState extends State { super.dispose(); } + Widget _tile(String text, IconData icon, Color color) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + children: [ + Icon(icon, size: 16, color: color), + const SizedBox(width: 10), + Expanded( + child: Text( + text, + style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface), + ), + ), + ], + ), + ); + } + @override Widget build(BuildContext context) { final l10n = context.l10n; @@ -85,44 +106,108 @@ class _CompanionRadioStatsScreenState extends State { valueListenable: connector.radioStatsNotifier, builder: (context, stats, _) { return ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(vertical: 8), children: [ if (stats != null) ...[ - Text( - l10n.radioStats_noiseFloor(stats.noiseFloorDbm), - style: tt.titleMedium, + const SectionHeader( + 'Signal', + padding: EdgeInsets.fromLTRB(16, 16, 16, 8), ), - const SizedBox(height: 4), - Text(l10n.radioStats_lastRssi(stats.lastRssiDbm)), - Text( - l10n.radioStats_lastSnr( - stats.lastSnrDb.toStringAsFixed(1), + MeshCard( + margin: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + padding: const EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _tile( + l10n.radioStats_noiseFloor(stats.noiseFloorDbm), + Icons.noise_aware, + scheme.onSurfaceVariant, + ), + const Divider(height: 1), + _tile( + l10n.radioStats_lastRssi(stats.lastRssiDbm), + Icons.wifi_tethering, + scheme.onSurfaceVariant, + ), + const Divider(height: 1), + _tile( + l10n.radioStats_lastSnr( + stats.lastSnrDb.toStringAsFixed(1), + ), + Icons.signal_cellular_alt, + MeshTheme.snrColor( + stats.lastSnrDb, + blocked: false, + ), + ), + ], ), ), - Text(l10n.radioStats_txAir(stats.txAirSecs)), - Text(l10n.radioStats_rxAir(stats.rxAirSecs)), - const SizedBox(height: 16), - ] else - Text(l10n.radioStats_waiting), - const SizedBox(height: 16), - SizedBox( - height: 200, - child: CustomPaint( - painter: _NoiseChartPainter( - samples: List.from(_noiseHistory), - colorScheme: scheme, - textTheme: tt, + const SectionHeader( + 'Airtime', + padding: EdgeInsets.fromLTRB(16, 16, 16, 8), + ), + MeshCard( + margin: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + padding: const EdgeInsets.all(4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _tile( + l10n.radioStats_txAir(stats.txAirSecs), + Icons.upload, + MeshPalette.blue, + ), + const Divider(height: 1), + _tile( + l10n.radioStats_rxAir(stats.rxAirSecs), + Icons.download, + MeshPalette.blue, + ), + ], + ), + ), + ] else ...[ + const SizedBox(height: 80), + Center( + child: CircularProgressIndicator( + color: Theme.of(context).colorScheme.primary, + ), + ), + const SizedBox(height: 8), + Center( + child: Text( + l10n.radioStats_waiting, + style: TextStyle(color: scheme.onSurfaceVariant), + ), + ), + ], + SectionHeader( + l10n.radioStats_chartCaption, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: SizedBox( + height: 200, + child: CustomPaint( + painter: _NoiseChartPainter( + samples: List.from(_noiseHistory), + colorScheme: scheme, + textTheme: tt, + ), + child: const SizedBox.expand(), ), - child: const SizedBox.expand(), ), ), const SizedBox(height: 8), - Text( - l10n.radioStats_chartCaption, - style: tt.bodySmall?.copyWith( - color: scheme.onSurfaceVariant, - ), - ), ], ); }, diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index 95cbb55d..69fb67e0 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -16,6 +16,7 @@ import '../models/contact.dart'; import '../l10n/contact_localization.dart'; import '../models/contact_group.dart'; import '../services/ui_view_state_service.dart'; +import '../theme/mesh_theme.dart'; import '../utils/contact_search.dart'; import '../storage/contact_group_store.dart'; import '../utils/dialog_utils.dart'; @@ -24,12 +25,12 @@ import '../utils/emoji_utils.dart'; import '../utils/route_transitions.dart'; import '../widgets/list_filter_widget.dart'; import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/quick_switch_bar.dart'; import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; import '../widgets/sync_progress_overlay.dart'; import '../widgets/unread_badge.dart'; -import '../helpers/contact_ui.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; import 'chat_screen.dart'; @@ -472,12 +473,13 @@ class _ContactsScreenState extends State } void _showAddContactSheet(BuildContext context) { - showModalBottomSheet( - context: context, + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader(title: context.l10n.contacts_title), ListTile( leading: const Icon(Icons.paste), title: Text(context.l10n.contacts_addContactFromClipboard), @@ -499,6 +501,7 @@ class _ContactsScreenState extends State ); }, ), + const SizedBox(height: 8), ], ), ), @@ -909,7 +912,8 @@ class _ContactsScreenState extends State final unreadCount = connector.getUnreadCountForContact( contact, ); - return _ContactTile( + return _ContactTileEntrance( + index: index, contact: contact, lastSeen: _resolveLastSeen(contact), unreadCount: unreadCount, @@ -1343,17 +1347,22 @@ class _ContactsScreenState extends State final isRoom = contact.type == advTypeRoom; final isFavorite = contact.isFavorite; - showModalBottomSheet( - context: context, + showMeshSheet( + context, builder: (sheetContext) => SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: contact.name, + subtitle: contact.typeLabel(context.l10n), + ), if (isRepeater) ...[ ListTile( - leading: const Icon(Icons.radar, color: Colors.green), + leading: Icon(Icons.radar, color: MeshPalette.signal), title: Text(context.l10n.contacts_ping), onTap: () { + Navigator.pop(sheetContext); final hw = context .read() .pathHashByteWidth; @@ -1371,7 +1380,7 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.cell_tower, color: Colors.orange), + leading: Icon(Icons.cell_tower, color: MeshPalette.warn), title: Text(context.l10n.contacts_manageRepeater), onTap: () { Navigator.pop(sheetContext); @@ -1380,9 +1389,10 @@ class _ContactsScreenState extends State ), ] else if (isRoom) ...[ ListTile( - leading: const Icon(Icons.radar, color: Colors.green), + leading: Icon(Icons.radar, color: MeshPalette.signal), title: Text(context.l10n.contacts_pathTrace), onTap: () { + Navigator.pop(sheetContext); final hw = context .read() .pathHashByteWidth; @@ -1405,7 +1415,7 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon(Icons.room, color: Colors.blue), + leading: Icon(Icons.meeting_room, color: MeshPalette.blue), title: Text(context.l10n.contacts_roomLogin), onTap: () { Navigator.pop(sheetContext); @@ -1413,10 +1423,7 @@ class _ContactsScreenState extends State }, ), ListTile( - leading: const Icon( - Icons.room_preferences, - color: Colors.orange, - ), + leading: Icon(Icons.room_preferences, color: MeshPalette.warn), title: Text(context.l10n.room_management), onTap: () { Navigator.pop(sheetContext); @@ -1430,9 +1437,10 @@ class _ContactsScreenState extends State ] else ...[ if (contact.pathLength > 0) ListTile( - leading: const Icon(Icons.radar, color: Colors.green), + leading: Icon(Icons.radar, color: MeshPalette.signal), title: Text(context.l10n.contacts_chatTraceRoute), onTap: () { + Navigator.pop(sheetContext); final hw = context .read() .pathHashByteWidth; @@ -1456,7 +1464,7 @@ class _ContactsScreenState extends State ListTile( leading: Icon( isFavorite ? Icons.star : Icons.star_border, - color: Colors.amber[700], + color: MeshPalette.warn, ), title: Text( isFavorite @@ -1501,6 +1509,7 @@ class _ContactsScreenState extends State _confirmDelete(context, connector, contact); }, ), + const SizedBox(height: 8), ], ), ), @@ -1555,82 +1564,173 @@ class _ContactTile extends StatelessWidget { required this.onLongPress, }); - @override - Widget build(BuildContext context) { - return GestureDetector( - onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => onLongPress() : null, - child: ListTile( - leading: CircleAvatar( - backgroundColor: contactTypeColor(contact.type), - child: _buildContactAvatar(contact), - ), - title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), - subtitle: Text( - contact.pathLabel(context.l10n), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - // Clamp text scaling in trailing section to prevent overflow while - // maintaining accessibility. Primary content (title/subtitle) scales normally. - trailing: MediaQuery( - data: MediaQuery.of(context).copyWith( - textScaler: TextScaler.linear( - MediaQuery.textScalerOf(context).scale(1.0).clamp(1.0, 1.3), - ), - ), - child: SizedBox( - width: 96, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - if (unreadCount > 0) ...[ - UnreadBadge(count: unreadCount), - const SizedBox(height: 4), - ], - Text( - _formatLastSeen(context, lastSeen), - maxLines: 1, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.right, - style: TextStyle( - fontSize: 12, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (isFavorite) - Icon(Icons.star, size: 14, color: Colors.amber[700]), - if (isFavorite && contact.hasLocation) - const SizedBox(width: 2), - if (contact.hasLocation) - Icon( - Icons.location_on, - size: 14, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant.withValues(alpha: 0.6), - ), - ], - ), - ], - ), - ), - ), - onTap: onTap, - onLongPress: onLongPress, - ), - ); + /// Node-type avatar color per design language. + Color _avatarColor() { + switch (contact.type) { + case advTypeRepeater: + return MeshPalette.warn; + case advTypeRoom: + return MeshPalette.magenta; + case advTypeSensor: + return const Color(0xFF4ACCC4); // teal + default: + return MeshPalette.blue; // chat — AvatarCircle handles deterministic hue + } } - Widget _buildContactAvatar(Contact contact) { - final emoji = firstEmoji(contact.name); - if (emoji != null) { - return Text(emoji, style: const TextStyle(fontSize: 18)); + /// Node-type avatar icon. Returns null for chat nodes so AvatarCircle shows initials. + IconData? _avatarIcon() { + switch (contact.type) { + case advTypeRepeater: + return Icons.cell_tower; + case advTypeRoom: + return Icons.meeting_room; + case advTypeSensor: + return Icons.sensors; + default: + return null; // chat uses initials } - return Icon(contactTypeIcon(contact.type), color: Colors.white, size: 20); + } + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final emoji = firstEmoji(contact.name); + final isChat = contact.type == advTypeChat; + final pathLen = contact.pathBytesForDisplay.length; + final isDirect = contact.pathLength >= 0; + final hasPath = pathLen > 0 || contact.pathLength == 0; + + return GestureDetector( + onSecondaryTapUp: PlatformInfo.isDesktop ? (_) => onLongPress() : null, + child: MeshCard( + onTap: onTap, + onLongPress: onLongPress, + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + child: Row( + children: [ + // Avatar + if (emoji != null) + Container( + width: 42, + height: 42, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.surfaceContainerHigh, + border: Border.all(color: scheme.outlineVariant), + ), + alignment: Alignment.center, + child: Text(emoji, style: const TextStyle(fontSize: 20)), + ) + else + AvatarCircle( + name: contact.name, + size: 42, + color: isChat ? null : _avatarColor(), + icon: _avatarIcon(), + ), + const SizedBox(width: 12), + // Main content + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Name row + route chip + Row( + children: [ + Expanded( + child: Text( + contact.name, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontWeight: unreadCount > 0 + ? FontWeight.w700 + : FontWeight.w500, + fontSize: 15, + color: scheme.onSurface, + ), + ), + ), + if (isFavorite) ...[ + const SizedBox(width: 4), + Icon(Icons.star, size: 13, color: MeshPalette.warn), + ], + if (contact.hasLocation) ...[ + const SizedBox(width: 4), + Icon( + Icons.location_on, + size: 13, + color: scheme.onSurfaceVariant.withValues(alpha: 0.55), + ), + ], + ], + ), + const SizedBox(height: 3), + // Path / subtitle row + Row( + children: [ + Expanded( + child: Text( + contact.pathLabel(context.l10n), + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12, + color: scheme.onSurfaceVariant, + ), + ), + ), + if (hasPath) ...[ + const SizedBox(width: 6), + RouteChip( + isDirect: isDirect, + hops: isDirect ? contact.pathLength : null, + ), + ], + ], + ), + ], + ), + ), + const SizedBox(width: 10), + // Trailing: time + unread badge + // Clamp text scale to prevent overflow in trailing section. + MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaler: TextScaler.linear( + MediaQuery.textScalerOf(context).scale(1.0).clamp(1.0, 1.3), + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + if (unreadCount > 0) ...[ + UnreadBadge(count: unreadCount), + const SizedBox(height: 4), + ], + Text( + _formatLastSeen(context, lastSeen), + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.right, + style: MeshTheme.mono( + fontSize: 11, + color: unreadCount > 0 + ? MeshPalette.blue + : scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), + ), + ); } String _formatLastSeen(BuildContext context, DateTime lastSeen) { @@ -1655,3 +1755,39 @@ class _ContactTile extends StatelessWidget { : context.l10n.contacts_lastSeenDaysAgo(days); } } + +// Wrap each contact tile with staggered entrance. +class _ContactTileEntrance extends StatelessWidget { + final int index; + final Contact contact; + final DateTime lastSeen; + final int unreadCount; + final bool isFavorite; + final VoidCallback onTap; + final VoidCallback onLongPress; + + const _ContactTileEntrance({ + required this.index, + required this.contact, + required this.lastSeen, + required this.unreadCount, + required this.isFavorite, + required this.onTap, + required this.onLongPress, + }); + + @override + Widget build(BuildContext context) { + return ListEntrance( + index: index, + child: _ContactTile( + contact: contact, + lastSeen: lastSeen, + unreadCount: unreadCount, + isFavorite: isFavorite, + onTap: onTap, + onLongPress: onLongPress, + ), + ); + } +} diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index 1bc392bf..8fb4cf95 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -7,12 +7,14 @@ import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; +import '../l10n/contact_localization.dart'; import '../models/contact.dart'; +import '../theme/mesh_theme.dart'; import '../utils/contact_search.dart'; import '../utils/platform_info.dart'; import '../widgets/app_bar.dart'; import '../widgets/list_filter_widget.dart'; -import '../helpers/contact_ui.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; enum DiscoverySortOption { lastSeen, name, type } @@ -47,6 +49,34 @@ class _DiscoveryScreenState extends State { : contact.lastSeen; } + /// Node-type avatar color per design language. + Color _avatarColor(int type) { + switch (type) { + case advTypeRepeater: + return MeshPalette.warn; + case advTypeRoom: + return MeshPalette.magenta; + case advTypeSensor: + return const Color(0xFF4ACCC4); // teal + default: + return MeshPalette.blue; + } + } + + /// Node-type avatar icon; null = show initials for chat nodes. + IconData? _avatarIcon(int type) { + switch (type) { + case advTypeRepeater: + return Icons.cell_tower; + case advTypeRoom: + return Icons.meeting_room; + case advTypeSensor: + return Icons.sensors; + default: + return null; + } + } + @override Widget build(BuildContext context) { final l10n = context.l10n; @@ -93,121 +123,167 @@ class _DiscoveryScreenState extends State { children: [ _buildFilters(filteredAndSorted, connector), Expanded( - child: discoveredContacts.isEmpty - ? Center(child: Text(l10n.contacts_noContacts)) - : filteredAndSorted.isEmpty - ? Center(child: Text(l10n.discoveredContacts_noMatching)) - : ListView.builder( - itemCount: filteredAndSorted.length, - itemBuilder: (context, index) { - final contact = filteredAndSorted[index]; - final tile = ListTile( - leading: CircleAvatar( - backgroundColor: contactTypeColor(contact.type), - child: Icon( - contactTypeIcon(contact.type), - color: Colors.white, - size: 20, - ), - ), - title: Text( + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 220), + child: discoveredContacts.isEmpty + ? Center( + key: const ValueKey('empty_all'), + child: Text(l10n.contacts_noContacts), + ) + : filteredAndSorted.isEmpty + ? Center( + key: const ValueKey('empty_filtered'), + child: Text(l10n.discoveredContacts_noMatching), + ) + : ListView.builder( + key: const ValueKey('list'), + padding: const EdgeInsets.only(bottom: 24), + itemCount: filteredAndSorted.length, + itemBuilder: (context, index) { + final contact = filteredAndSorted[index]; + final tile = _buildDiscoveryTile( + context, + contact, + connector, + index, + ); + if (PlatformInfo.isDesktop) { + return GestureDetector( + onSecondaryTapUp: (_) => + _showContactContextMenu(contact, connector), + child: tile, + ); + } + return tile; + }, + ), + ), + ), + ], + ), + ); + } + + Widget _buildDiscoveryTile( + BuildContext context, + Contact contact, + MeshCoreConnector connector, + int index, + ) { + final scheme = Theme.of(context).colorScheme; + final isChat = contact.type == advTypeChat; + + return ListEntrance( + index: index, + child: MeshCard( + onTap: () { + connector.importDiscoveredContact(contact); + showDismissibleSnackBar( + context, + content: Text( + context.l10n.discoveredContacts_contactAdded, + ), + action: SnackBarAction( + label: context.l10n.common_undo, + onPressed: () => connector.removeContact(contact), + ), + ); + }, + onLongPress: () => _showContactContextMenu(contact, connector), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + child: Row( + children: [ + AvatarCircle( + name: contact.name, + size: 42, + color: isChat ? null : _avatarColor(contact.type), + icon: _avatarIcon(contact.type), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Name + type chip + Row( + children: [ + Expanded( + child: Text( contact.name, maxLines: 1, overflow: TextOverflow.ellipsis, + style: const TextStyle( + fontWeight: FontWeight.w500, + fontSize: 15, + ), ), - subtitle: Text( + ), + const SizedBox(width: 6), + StatusChip( + label: contact.typeLabel(context.l10n).toUpperCase(), + color: _avatarColor(contact.type), + icon: _avatarIcon(contact.type), + ), + ], + ), + const SizedBox(height: 3), + // Short pub key + Row( + children: [ + Expanded( + child: Text( contact.shortPubKeyHex, maxLines: 1, overflow: TextOverflow.ellipsis, - ), - // Clamp text scaling in trailing section to prevent overflow while - // maintaining accessibility. Primary content (title/subtitle) scales normally. - trailing: MediaQuery( - data: MediaQuery.of(context).copyWith( - textScaler: TextScaler.linear( - MediaQuery.textScalerOf( - context, - ).scale(1.0).clamp(1.0, 1.3), - ), - ), - child: SizedBox( - width: 120, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - _formatLastSeen( - context, - _resolveLastSeen(contact), - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - textAlign: TextAlign.right, - style: TextStyle( - fontSize: 12, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - ), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - if (contact.hasLocation) - Icon( - Icons.location_on, - size: 14, - color: Theme.of(context) - .colorScheme - .onSurfaceVariant - .withValues(alpha: 0.6), - ), - if (contact.rawPacket != null) - const SizedBox(width: 2), - if (contact.rawPacket != null) - Icon( - Icons.cell_tower, - size: 14, - color: Theme.of(context) - .colorScheme - .onSurfaceVariant - .withValues(alpha: 0.6), - ), - ], - ), - ], - ), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, ), ), - onTap: () { - connector.importDiscoveredContact(contact); - showDismissibleSnackBar( - context, - content: Text( - context.l10n.discoveredContacts_contactAdded, - ), - action: SnackBarAction( - label: context.l10n.common_undo, - onPressed: () => connector.removeContact(contact), - ), - ); - }, - onLongPress: () => - _showContactContextMenu(contact, connector), - ); - if (PlatformInfo.isDesktop) { - return GestureDetector( - onSecondaryTapUp: (_) => - _showContactContextMenu(contact, connector), - child: tile, - ); - } - return tile; - }, + ), + if (contact.hasLocation) ...[ + const SizedBox(width: 6), + Icon( + Icons.location_on, + size: 13, + color: scheme.onSurfaceVariant.withValues(alpha: 0.55), + ), + ], + if (contact.rawPacket != null) ...[ + const SizedBox(width: 4), + Icon( + Icons.cell_tower, + size: 13, + color: scheme.onSurfaceVariant.withValues(alpha: 0.55), + ), + ], + ], ), - ), - ], + ], + ), + ), + const SizedBox(width: 10), + // Last seen time + MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaler: TextScaler.linear( + MediaQuery.textScalerOf(context).scale(1.0).clamp(1.0, 1.3), + ), + ), + child: Text( + _formatLastSeen(context, _resolveLastSeen(contact)), + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.right, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ), + ], + ), ), ); } @@ -216,15 +292,18 @@ class _DiscoveryScreenState extends State { Contact contact, MeshCoreConnector connector, ) async { - final action = await showModalBottomSheet( - context: context, - showDragHandle: true, + final action = await showMeshSheet( + context, builder: (sheetContext) { final l10n = context.l10n; return SafeArea( child: Column( mainAxisSize: MainAxisSize.min, children: [ + BottomSheetHeader( + title: contact.name, + subtitle: contact.typeLabel(l10n), + ), ListTile( leading: const Icon(Icons.copy), title: Text(l10n.discoveredContacts_copyContact), @@ -235,6 +314,7 @@ class _DiscoveryScreenState extends State { title: Text(l10n.discoveredContacts_deleteContact), onTap: () => Navigator.of(sheetContext).pop('delete_contact'), ), + const SizedBox(height: 8), ], ), ); diff --git a/lib/screens/line_of_sight_map_screen.dart b/lib/screens/line_of_sight_map_screen.dart index af80ca22..57d7603f 100644 --- a/lib/screens/line_of_sight_map_screen.dart +++ b/lib/screens/line_of_sight_map_screen.dart @@ -19,6 +19,8 @@ import '../connector/meshcore_connector.dart'; import '../widgets/app_bar.dart'; import '../widgets/quick_switch_bar.dart'; import '../icons/los_icon.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/themed_map_tile_layer.dart'; class LineOfSightEndpoint { final String label; @@ -30,7 +32,7 @@ class LineOfSightEndpoint { const LineOfSightEndpoint({ required this.label, required this.point, - this.color = Colors.green, + this.color = LosPalette.clear, this.icon = Icons.location_on, this.isCustom = false, }); @@ -59,9 +61,12 @@ class _LineOfSightMapScreenState extends State { static const double _labelZoomThreshold = 8.5; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; + static const double _marginalClearanceMeters = 5.0; final LineOfSightService _lineOfSightService = LineOfSightService(); final MapController _mapController = MapController(); + final DraggableScrollableController _panelController = + DraggableScrollableController(); bool _loading = false; String? _error; @@ -79,6 +84,7 @@ class _LineOfSightMapScreenState extends State { bool _didReceivePositionUpdate = false; int _losRequestNonce = 0; bool _initialLosScheduled = false; + bool _showTerrainLayer = true; @override void initState() { @@ -104,6 +110,7 @@ class _LineOfSightMapScreenState extends State { @override void dispose() { _mapController.dispose(); + _panelController.dispose(); _lineOfSightService.dispose(); super.dispose(); } @@ -140,48 +147,6 @@ class _LineOfSightMapScreenState extends State { _mapController.move(initialCenter, initialZoom); } - Widget _buildDesktopMapControls({ - required LatLng initialCenter, - required double initialZoom, - required LatLngBounds? bounds, - }) { - final screenHeight = MediaQuery.of(context).size.height; - final topOffset = _showHud - ? math.min(screenHeight * 0.52 + 24, screenHeight - 220) - : 12.0; - return Positioned( - top: topOffset, - left: 12, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: context.l10n.map_zoomIn, - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: context.l10n.map_zoomOut, - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: context.l10n.map_centerMap, - onPressed: () => _resetMapView( - initialCenter: initialCenter, - initialZoom: initialZoom, - bounds: bounds, - ), - ), - ], - ), - ), - ); - } - Future _runLos() async { final start = _start; final end = _end; @@ -224,7 +189,7 @@ class _LineOfSightMapScreenState extends State { setState(() { _result = result; _selectedObstruction = _defaultObstructionFor(result); - _menuExpanded = true; + _menuExpanded = false; }); } catch (e) { if (!mounted) return; @@ -288,7 +253,7 @@ class _LineOfSightMapScreenState extends State { final endpoint = LineOfSightEndpoint( label: context.l10n.losCustomPointLabel(_customEndpoints.length + 1), point: point, - color: Colors.orange, + color: LosPalette.marginal, icon: Icons.push_pin, isCustom: true, ); @@ -415,16 +380,23 @@ class _LineOfSightMapScreenState extends State { title: AppBarTitle(widget.title), centerTitle: true, actions: [ - IconButton( - icon: _loading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.delete_outline), - onPressed: _loading ? null : _clearAllPoints, - tooltip: context.l10n.losClearAllPoints, + PopupMenuButton( + onSelected: (value) { + if (value == 'clear') _clearAllPoints(); + }, + itemBuilder: (context) => [ + PopupMenuItem( + value: 'clear', + enabled: !_loading, + child: Row( + children: [ + const Icon(Icons.delete_outline), + const SizedBox(width: 10), + Text(context.l10n.losClearAllPoints), + ], + ), + ), + ], ), ], ), @@ -470,11 +442,9 @@ class _LineOfSightMapScreenState extends State { }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: MapTileCacheService.userAgentPackageName, - maxZoom: 19, + ThemedMapTileLayer( + tileCache: tileCache, + opacity: _showTerrainLayer ? 1 : 0.72, ), if (_result != null && _result!.segments.isNotEmpty) PolylineLayer(polylines: _buildSegmentPolylines(_result!)), @@ -483,70 +453,38 @@ class _LineOfSightMapScreenState extends State { ), ], ), - if (isDesktop) - _buildDesktopMapControls( - initialCenter: initialCenter, - initialZoom: initialZoom, - bounds: bounds, - ), + _buildLinkBanner(isImperial), + _buildMapControlRail( + initialCenter: initialCenter, + initialZoom: initialZoom, + bounds: bounds, + isImperial: isImperial, + ), if (_showHud) - Positioned( - left: 12, - right: 12, - top: 12, - child: ConstrainedBox( - constraints: BoxConstraints( - maxHeight: MediaQuery.of(context).size.height * 0.52, - ), - child: _buildControlPanel(isImperial), - ), - ), - if (!_showHud && _result != null && _result!.segments.isNotEmpty) - Positioned( - left: 12, - bottom: 12, - child: DecoratedBox( - decoration: BoxDecoration( - color: Theme.of( - context, - ).colorScheme.surfaceContainerHighest.withValues(alpha: 0.85), - borderRadius: BorderRadius.circular(8), - ), - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 8, - vertical: 4, - ), - child: Text( - context.l10n.losElevationAttribution, - style: TextStyle( - fontSize: 10, - color: Theme.of(context).colorScheme.onSurface, - ), - ), - ), + DraggableScrollableSheet( + controller: _panelController, + initialChildSize: 0.43, + minChildSize: 0.14, + maxChildSize: 0.88, + snap: true, + snapSizes: const [0.14, 0.43, 0.88], + builder: (context, scrollController) => Theme( + data: MeshTheme.dark(), + child: _buildControlPanel(isImperial, scrollController), ), ), if (_loading) - const Positioned( + Positioned( left: 0, right: 0, top: 0, - child: LinearProgressIndicator(), + child: LinearProgressIndicator( + color: LosPalette.selected, + backgroundColor: LosPalette.chartBackground, + ), ), ], ), - floatingActionButton: FloatingActionButton( - onPressed: () { - setState(() { - _showHud = !_showHud; - }); - }, - tooltip: _showHud - ? context.l10n.losHidePanelTooltip - : context.l10n.losShowPanelTooltip, - child: Icon(_showHud ? Icons.visibility_off : Icons.tune), - ), bottomNavigationBar: SafeArea( top: false, child: QuickSwitchBar( @@ -558,12 +496,477 @@ class _LineOfSightMapScreenState extends State { channelsUnreadCount: context .watch() .getTotalChannelsUnreadCount(), + highContrast: true, ), ), ); } - Widget _buildControlPanel(bool isImperial) { + Widget _buildLinkBanner(bool isImperial) { + final connector = context.watch(); + final segment = _primarySegmentResult(); + final status = _losStatusFor(segment); + final battery = connector.batteryPercent; + final snr = connector.latestRadioStats?.lastSnrDb; + return Positioned( + top: 10, + left: 12, + right: 12, + child: IgnorePointer( + ignoring: false, + child: Material( + color: LosPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + shadowColor: LosPalette.shadow, + elevation: 4, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + children: [ + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + color: _statusColorFor(status).withValues(alpha: 0.18), + shape: BoxShape.circle, + border: Border.all(color: _statusColorFor(status)), + ), + child: Icon( + _statusIcon(status), + color: _statusColorFor(status), + size: 20, + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${_start?.label ?? 'A'} → ${_end?.label ?? 'B'}', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: LosPalette.text, + fontSize: 14, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 2), + Text( + segment == null + ? _statusText() + : '${_statusLabel(status)} • ' + '${_formatDistanceValue(segment.totalDistanceMeters, isImperial)} ' + '${isImperial ? 'mi' : 'km'}', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 11.5, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + _headerMetric( + Icons.battery_5_bar, + battery == null ? '--' : '$battery%', + ), + const SizedBox(width: 10), + _headerMetric( + Icons.network_cell, + snr == null ? '--' : '${snr.toStringAsFixed(1)} dB', + ), + ], + ), + ), + ), + ), + ); + } + + Widget _headerMetric(IconData icon, String value) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(icon, color: LosPalette.textMuted, size: 16), + const SizedBox(height: 2), + Text( + value, + style: MeshTheme.mono( + color: LosPalette.text, + fontSize: 10, + fontWeight: FontWeight.w700, + ), + ), + ], + ); + } + + Widget _buildMapControlRail({ + required LatLng initialCenter, + required double initialZoom, + required LatLngBounds? bounds, + required bool isImperial, + }) { + return Positioned( + right: 12, + top: 92, + child: Material( + color: LosPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + clipBehavior: Clip.antiAlias, + elevation: 4, + shadowColor: LosPalette.shadow, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + color: LosPalette.text, + icon: const Icon(Icons.add), + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + color: LosPalette.text, + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + color: LosPalette.text, + icon: const Icon(Icons.center_focus_strong), + tooltip: context.l10n.map_centerMap, + onPressed: () => _resetMapView( + initialCenter: initialCenter, + initialZoom: initialZoom, + bounds: bounds, + ), + ), + IconButton( + color: _showTerrainLayer + ? LosPalette.selected + : LosPalette.textMuted, + icon: const Icon(Icons.layers_outlined), + tooltip: 'Map detail', + onPressed: () => + setState(() => _showTerrainLayer = !_showTerrainLayer), + ), + IconButton( + color: LosPalette.text, + icon: Text( + isImperial ? 'ft' : 'm', + style: const TextStyle( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w800, + ), + ), + tooltip: 'Units', + onPressed: () => context.read().setUnitSystem( + isImperial ? UnitSystem.metric : UnitSystem.imperial, + ), + ), + IconButton( + color: _showHud ? LosPalette.selected : LosPalette.text, + icon: Icon( + _showHud ? Icons.keyboard_arrow_down : Icons.analytics_outlined, + ), + tooltip: _showHud + ? context.l10n.losHidePanelTooltip + : context.l10n.losShowPanelTooltip, + onPressed: () => setState(() => _showHud = !_showHud), + ), + ], + ), + ), + ); + } + + Widget _buildResultSummary(LineOfSightResult? segment, bool isImperial) { + final status = _losStatusFor(segment); + final color = _statusColorFor(status); + final distanceUnit = isImperial ? 'mi' : 'km'; + final heightUnit = isImperial ? 'ft' : 'm'; + final worst = _defaultObstructionFor(_result); + final minClearance = segment == null || segment.samples.isEmpty + ? null + : segment.samples + .map((sample) => sample.clearanceMeters) + .reduce(math.min); + final amount = segment == null + ? '--' + : segment.isClear + ? '${_formatHeightValue(minClearance ?? 0, isImperial)} $heightUnit' + : '${_formatHeightValue(segment.maxObstructionMeters, isImperial)} $heightUnit'; + return Container( + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: color.withValues(alpha: 0.8)), + ), + child: Column( + children: [ + Row( + children: [ + Icon(_statusIcon(status), color: color, size: 24), + const SizedBox(width: 9), + Expanded( + child: Text( + _statusLabel(status), + style: TextStyle( + color: color, + fontSize: 19, + fontWeight: FontWeight.w900, + ), + ), + ), + if (_loading) + const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + _summaryMetric( + 'Distance', + segment == null + ? '--' + : '${_formatDistanceValue(segment.totalDistanceMeters, isImperial)} $distanceUnit', + ), + _summaryMetric( + segment?.isClear == true ? 'Clearance' : 'Blocked by', + amount, + valueColor: color, + ), + _summaryMetric( + 'Obstruction', + worst == null + ? '--' + : '${_formatDistanceValue(worst.distanceMeters, isImperial)} $distanceUnit from A', + ), + ], + ), + ], + ), + ); + } + + Widget _summaryMetric(String label, String value, {Color? valueColor}) { + return Expanded( + child: Padding( + padding: const EdgeInsets.only(right: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label.toUpperCase(), + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 9, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 3), + Text( + value, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: MeshTheme.mono( + color: valueColor ?? LosPalette.text, + fontSize: 11.5, + fontWeight: FontWeight.w800, + ), + ), + ], + ), + ), + ); + } + + Widget _buildObstructionCard( + LineOfSightObstruction obstruction, + bool isImperial, { + required bool isWorst, + }) { + final selected = + _selectedObstruction?.sampleIndex == obstruction.sampleIndex; + final distanceUnit = isImperial ? 'mi' : 'km'; + final heightUnit = isImperial ? 'ft' : 'm'; + return InkWell( + onTap: () => _centerOnObstruction(obstruction), + borderRadius: BorderRadius.circular(MeshRadii.sm), + child: Container( + width: 154, + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: selected + ? LosPalette.selected.withValues(alpha: 0.18) + : LosPalette.chartBackground, + borderRadius: BorderRadius.circular(MeshRadii.sm), + border: Border.all( + color: selected ? LosPalette.selected : LosPalette.border, + width: selected ? 2 : 1, + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Icon( + Icons.warning_amber_rounded, + color: LosPalette.blocked, + size: 17, + ), + const SizedBox(width: 5), + Expanded( + child: Text( + '${_formatDistanceValue(obstruction.distanceMeters, isImperial)} $distanceUnit', + style: const TextStyle( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w800, + ), + ), + ), + if (isWorst) + Container( + padding: const EdgeInsets.symmetric( + horizontal: 5, + vertical: 2, + ), + decoration: BoxDecoration( + color: LosPalette.blocked, + borderRadius: BorderRadius.circular(99), + ), + child: const Text( + 'WORST', + style: TextStyle( + color: Colors.white, + fontSize: 8, + fontWeight: FontWeight.w900, + ), + ), + ), + ], + ), + const Spacer(), + Text( + 'Blocked ${_formatHeightValue(obstruction.obstructionMeters, isImperial)} $heightUnit', + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 11, + fontWeight: FontWeight.w600, + ), + ), + ], + ), + ), + ); + } + + Widget _buildSelectedObstructionCard( + LineOfSightObstruction obstruction, + LineOfSightResult segment, + bool isImperial, + ) { + final distanceUnit = isImperial ? 'mi' : 'km'; + final heightUnit = isImperial ? 'ft' : 'm'; + return Container( + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: LosPalette.selected.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: LosPalette.selected), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Selected obstruction', + style: TextStyle( + color: LosPalette.text, + fontSize: 14, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 10), + Wrap( + spacing: 18, + runSpacing: 10, + children: [ + _detailValue( + 'Blocked by', + '${_formatHeightValue(obstruction.obstructionMeters, isImperial)} $heightUnit', + ), + _detailValue( + 'From A', + '${_formatDistanceValue(obstruction.distanceMeters, isImperial)} $distanceUnit', + ), + _detailValue( + 'From B', + '${_formatDistanceValue(segment.totalDistanceMeters - obstruction.distanceMeters, isImperial)} $distanceUnit', + ), + _detailValue( + 'Elevation', + '${_formatHeightValue(obstruction.terrainMeters, isImperial)} $heightUnit', + ), + ], + ), + const SizedBox(height: 10), + Align( + alignment: Alignment.centerRight, + child: OutlinedButton.icon( + onPressed: () => _centerOnObstruction(obstruction), + icon: const Icon(Icons.center_focus_strong, size: 17), + label: const Text('Center on map'), + ), + ), + ], + ), + ); + } + + Widget _detailValue(String label, String value) { + return SizedBox( + width: 120, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label.toUpperCase(), + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 9, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 2), + Text( + value, + style: MeshTheme.mono( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w700, + ), + ), + ], + ), + ); + } + + Widget _buildControlPanel( + bool isImperial, + ScrollController scrollController, + ) { _sanitizeSelection(); final segment = _primarySegmentResult(); final connector = context.read(); @@ -583,363 +986,265 @@ class _LineOfSightMapScreenState extends State { final antennaBDisplay = _toDisplayHeight(antennaBMeters, isImperial); final antennaSliderMax = isImperial ? _maxAntennaFeet : _maxAntennaMeters; final antennaSliderDivisions = isImperial ? 400 : 122; - return Card( - child: Padding( - padding: const EdgeInsets.all(12), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, + final worst = _defaultObstructionFor(_result); + return Material( + color: LosPalette.panelDark, + borderRadius: const BorderRadius.vertical( + top: Radius.circular(MeshRadii.lg), + ), + clipBehavior: Clip.antiAlias, + child: ListView( + controller: scrollController, + padding: const EdgeInsets.fromLTRB(16, 8, 16, 28), + children: [ + Center( + child: Container( + width: 44, + height: 5, + decoration: BoxDecoration( + color: LosPalette.textMuted.withValues(alpha: 0.55), + borderRadius: BorderRadius.circular(99), + ), + ), + ), + const SizedBox(height: 10), + _buildResultSummary(segment, isImperial), + if (segment != null) ...[ + const SizedBox(height: 14), + _buildProfileView(segment, distanceUnit, heightUnit, isImperial), + const SizedBox(height: 10), + _LosLegend( + terrainLabel: context.l10n.losLegendTerrain, + losBeamLabel: context.l10n.losLegendLosBeam, + radioHorizonLabel: context.l10n.losLegendRadioHorizon, + ), + ], + if (obstructions.isNotEmpty) ...[ + const SizedBox(height: 18), + Text( + context.l10n.losBlockedSpotsTitle, + style: const TextStyle( + color: LosPalette.text, + fontSize: 15, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 4), + Text( + context.l10n.losBlockedSpotsHint, + style: const TextStyle(color: LosPalette.textMuted, fontSize: 12), + ), + const SizedBox(height: 10), + SizedBox( + height: 86, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: obstructions.length, + separatorBuilder: (_, _) => const SizedBox(width: 8), + itemBuilder: (context, index) { + final obstruction = obstructions[index]; + return _buildObstructionCard( + obstruction, + isImperial, + isWorst: obstruction.sampleIndex == worst?.sampleIndex, + ); + }, + ), + ), + ], + if (_selectedObstruction != null && segment != null) ...[ + const SizedBox(height: 14), + _buildSelectedObstructionCard( + _selectedObstruction!, + segment, + isImperial, + ), + ], + const SizedBox(height: 12), + ExpansionTile( + initiallyExpanded: _menuExpanded, + onExpansionChanged: (value) => + setState(() => _menuExpanded = value), + tilePadding: EdgeInsets.zero, + childrenPadding: EdgeInsets.zero, + iconColor: LosPalette.text, + collapsedIconColor: LosPalette.textMuted, + title: Text( + context.l10n.losMenuTitle, + style: const TextStyle( + color: LosPalette.text, + fontSize: 14, + fontWeight: FontWeight.w700, + ), + ), + subtitle: Text( + context.l10n.losMenuSubtitle, + style: const TextStyle(color: LosPalette.textMuted, fontSize: 11), + ), children: [ - if (segment != null) - _buildProfileView(segment, distanceUnit, heightUnit, isImperial) - else - SizedBox( - height: 44, - child: Center( - child: Text( - context.l10n.losRunToViewElevationProfile, - style: const TextStyle(fontSize: 11), - ), - ), + SwitchListTile( + dense: true, + contentPadding: EdgeInsets.zero, + title: Text( + context.l10n.losShowDisplayNodes, + style: const TextStyle(fontSize: 12), ), - if (segment != null) ...[ - const SizedBox(height: 8), - _LosLegend( - terrainLabel: context.l10n.losLegendTerrain, - losBeamLabel: context.l10n.losLegendLosBeam, - radioHorizonLabel: context.l10n.losLegendRadioHorizon, - ), - ], - const SizedBox(height: 8), - Text( - segment != null - ? _profileStats(segment, isImperial) - : _statusText(), - style: TextStyle( - fontSize: 12, - color: segment != null - ? (segment.isClear ? Colors.green : Colors.red) - : _statusColor(), - fontWeight: FontWeight.w600, - ), - ), - if (obstructions.isNotEmpty) ...[ - const SizedBox(height: 8), - Text( - context.l10n.losBlockedSpotsTitle, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox(height: 4), - Text( - context.l10n.losBlockedSpotsHint, - style: TextStyle( - fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - const SizedBox(height: 6), - Wrap( - spacing: 6, - runSpacing: 6, - children: [ - for (final obstruction in obstructions) - ChoiceChip( - label: Text( - _obstructionChipLabel(obstruction, isImperial), - style: const TextStyle(fontSize: 11), - ), - selected: - _selectedObstruction?.sampleIndex == - obstruction.sampleIndex, - onSelected: (_) => _selectObstruction(obstruction), - ), - ], - ), - if (_selectedObstruction != null) ...[ - const SizedBox(height: 8), - DecoratedBox( - decoration: BoxDecoration( - color: Colors.orange.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(10), - border: Border.all( - color: Colors.deepOrangeAccent.withValues(alpha: 0.45), - ), - ), - child: Padding( - padding: const EdgeInsets.all(10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.losSelectedObstructionTitle, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.w700, - ), - ), - const SizedBox(height: 4), - Text( - context.l10n.losSelectedObstructionDetails( - _formatHeightValue( - _selectedObstruction!.obstructionMeters, - isImperial, - ), - heightUnit, - _formatDistanceValue( - _selectedObstruction!.distanceMeters, - isImperial, - ), - distanceUnit, - _formatDistanceValue( - segment!.totalDistanceMeters - - _selectedObstruction!.distanceMeters, - isImperial, - ), - ), - style: const TextStyle(fontSize: 11), - ), - const SizedBox(height: 4), - Text( - '${_selectedObstruction!.point.latitude.toStringAsFixed(5)}, ' - '${_selectedObstruction!.point.longitude.toStringAsFixed(5)}', - style: TextStyle( - fontSize: 11, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - ), - ], - ), - ), - ), - ], - ], - const SizedBox(height: 4), - if (displayFrequencyMHz != null) - Padding( - padding: const EdgeInsets.only(top: 2, bottom: 4), - child: Row( - children: [ - Text( - context.l10n.losFrequencyLabel, - style: TextStyle( - fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, - fontWeight: FontWeight.w600, - ), - ), - const SizedBox(width: 8), - Text( - '${displayFrequencyMHz.toStringAsFixed(3)} MHz', - style: TextStyle( - fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - if (kFactorUsed != null) ...[ - const SizedBox(width: 8), - Text( - 'k=${kFactorUsed.toStringAsFixed(3)}', - style: TextStyle( - fontSize: 11, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - ), - const SizedBox(width: 4), - IconButton( - padding: EdgeInsets.zero, - constraints: const BoxConstraints(), - icon: const Icon(Icons.info_outline, size: 16), - color: Theme.of(context).colorScheme.onSurfaceVariant, - tooltip: context.l10n.losFrequencyInfoTooltip, - onPressed: () { - _showFrequencyInfoDialog( - context, - displayFrequencyMHz, - kFactorUsed, - ); - }, - ), - ], - ], - ), - ), - Text( - context.l10n.losElevationAttribution, - style: TextStyle( - fontSize: 10, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - const SizedBox(height: 6), - ExpansionTile( - initiallyExpanded: _menuExpanded, - onExpansionChanged: (value) { + value: _showDisplayNodes, + onChanged: (value) { setState(() { - _menuExpanded = value; + _showDisplayNodes = value; + _sanitizeSelection(); + _result = null; + _selectedObstruction = null; }); }, - tilePadding: EdgeInsets.zero, - childrenPadding: EdgeInsets.zero, - title: Text( - context.l10n.losMenuTitle, - style: const TextStyle( - fontSize: 13, - fontWeight: FontWeight.w700, - ), + ), + if (_customEndpoints.isNotEmpty) ...[ + const SizedBox(height: 6), + Text( + context.l10n.losCustomPoints, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600), ), - subtitle: Text( - context.l10n.losMenuSubtitle, - style: const TextStyle(fontSize: 11), - ), - children: [ - SwitchListTile( + for (final point in _customEndpoints) + ListTile( dense: true, contentPadding: EdgeInsets.zero, title: Text( - context.l10n.losShowDisplayNodes, + point.label, style: const TextStyle(fontSize: 12), ), - value: _showDisplayNodes, - onChanged: (value) { - setState(() { - _showDisplayNodes = value; - _sanitizeSelection(); - _result = null; - _selectedObstruction = null; - }); - }, - ), - if (_customEndpoints.isNotEmpty) ...[ - const SizedBox(height: 6), - Text( - context.l10n.losCustomPoints, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w600, - ), + subtitle: Text( + '${point.point.latitude.toStringAsFixed(5)}, ${point.point.longitude.toStringAsFixed(5)}', + style: const TextStyle(fontSize: 11), ), - for (final point in _customEndpoints) - ListTile( - dense: true, - contentPadding: EdgeInsets.zero, - title: Text( - point.label, - style: const TextStyle(fontSize: 12), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.edit, size: 18), + onPressed: () => _renameCustomPoint(point), + tooltip: context.l10n.common_edit, ), - subtitle: Text( - '${point.point.latitude.toStringAsFixed(5)}, ${point.point.longitude.toStringAsFixed(5)}', - style: const TextStyle(fontSize: 11), + IconButton( + icon: const Icon(Icons.delete_outline, size: 18), + onPressed: () => _deleteCustomPoint(point), + tooltip: context.l10n.common_delete, ), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.edit, size: 18), - onPressed: () => _renameCustomPoint(point), - tooltip: context.l10n.common_edit, - ), - IconButton( - icon: const Icon(Icons.delete_outline, size: 18), - onPressed: () => _deleteCustomPoint(point), - tooltip: context.l10n.common_delete, - ), - ], - ), - ), - ], - const SizedBox(height: 8), - _buildEndpointRow( - label: context.l10n.losPointA, - value: _start, - candidates: endpoints, - onChanged: (value) { - setState(() { - _start = value; - _result = null; - _selectedObstruction = null; - }); - if (_start != null && _end != null) { - _runLos(); - } - }, - ), - const SizedBox(height: 8), - _buildEndpointRow( - label: context.l10n.losPointB, - value: _end, - candidates: endpoints, - onChanged: (value) { - setState(() { - _end = value; - _result = null; - _selectedObstruction = null; - }); - if (_start != null && _end != null) { - _runLos(); - } - }, - ), - const SizedBox(height: 10), - Text( - context.l10n.losAntennaA( - antennaADisplay.toStringAsFixed(1), - heightUnit, - ), - style: const TextStyle(fontSize: 12), - ), - Slider( - value: antennaADisplay, - min: 0, - max: antennaSliderMax, - divisions: antennaSliderDivisions, - onChanged: (value) { - setState(() { - _startAntennaHeight = _toMetersHeight( - value, - isImperial, - ); - }); - }, - ), - Text( - context.l10n.losAntennaB( - antennaBDisplay.toStringAsFixed(1), - heightUnit, - ), - style: const TextStyle(fontSize: 12), - ), - Slider( - value: antennaBDisplay, - min: 0, - max: antennaSliderMax, - divisions: antennaSliderDivisions, - onChanged: (value) { - setState(() { - _endAntennaHeight = _toMetersHeight(value, isImperial); - }); - }, - ), - Align( - alignment: Alignment.centerRight, - child: ElevatedButton.icon( - onPressed: _loading ? null : _runLos, - icon: const LosIcon(), - label: Text(context.l10n.losRun), + ], ), ), - ], + ], + const SizedBox(height: 8), + _buildEndpointRow( + label: context.l10n.losPointA, + value: _start, + candidates: endpoints, + onChanged: (value) { + setState(() { + _start = value; + _result = null; + _selectedObstruction = null; + }); + if (_start != null && _end != null) { + _runLos(); + } + }, + ), + const SizedBox(height: 8), + _buildEndpointRow( + label: context.l10n.losPointB, + value: _end, + candidates: endpoints, + onChanged: (value) { + setState(() { + _end = value; + _result = null; + _selectedObstruction = null; + }); + if (_start != null && _end != null) { + _runLos(); + } + }, + ), + const SizedBox(height: 10), + Text( + context.l10n.losAntennaA( + antennaADisplay.toStringAsFixed(1), + heightUnit, + ), + style: const TextStyle(fontSize: 12), + ), + Slider( + value: antennaADisplay, + min: 0, + max: antennaSliderMax, + divisions: antennaSliderDivisions, + onChanged: (value) { + setState(() { + _startAntennaHeight = _toMetersHeight(value, isImperial); + }); + }, + ), + Text( + context.l10n.losAntennaB( + antennaBDisplay.toStringAsFixed(1), + heightUnit, + ), + style: const TextStyle(fontSize: 12), + ), + Slider( + value: antennaBDisplay, + min: 0, + max: antennaSliderMax, + divisions: antennaSliderDivisions, + onChanged: (value) { + setState(() { + _endAntennaHeight = _toMetersHeight(value, isImperial); + }); + }, + ), + Align( + alignment: Alignment.centerRight, + child: FilledButton.icon( + onPressed: _loading ? null : _runLos, + icon: const LosIcon(), + label: Text(context.l10n.losRun), + ), ), ], ), - ), + if (displayFrequencyMHz != null) ...[ + const SizedBox(height: 10), + Row( + children: [ + Text( + '${context.l10n.losFrequencyLabel}: ' + '${displayFrequencyMHz.toStringAsFixed(3)} MHz' + '${kFactorUsed == null ? '' : ' k=${kFactorUsed.toStringAsFixed(3)}'}', + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 11, + ), + ), + if (kFactorUsed != null) + IconButton( + icon: const Icon(Icons.info_outline, size: 17), + color: LosPalette.textMuted, + tooltip: context.l10n.losFrequencyInfoTooltip, + onPressed: () => _showFrequencyInfoDialog( + context, + displayFrequencyMHz, + kFactorUsed, + ), + ), + ], + ), + ], + Text( + context.l10n.losElevationAttribution, + style: const TextStyle(color: LosPalette.textMuted, fontSize: 10), + ), + ], ), ); } @@ -1002,6 +1307,14 @@ class _LineOfSightMapScreenState extends State { }); } + void _centerOnObstruction(LineOfSightObstruction obstruction) { + _selectObstruction(obstruction); + _mapController.move( + obstruction.point, + math.max(_mapController.camera.zoom, 15), + ); + } + String _formatDistanceValue(double meters, bool isImperial) { final value = isImperial ? (meters / 1000.0) * _kmToMiles : meters / 1000.0; return value.toStringAsFixed(2); @@ -1034,7 +1347,7 @@ class _LineOfSightMapScreenState extends State { ) { if (segment.samples.length < 2) { return SizedBox( - height: 160, + height: 190, width: double.infinity, child: CustomPaint( painter: _LosProfilePainter( @@ -1043,12 +1356,12 @@ class _LineOfSightMapScreenState extends State { heightUnit: heightUnit, badgeTextStyle: Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ) ?? const TextStyle( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ), @@ -1061,11 +1374,11 @@ class _LineOfSightMapScreenState extends State { ); } return SizedBox( - height: 160, + height: 190, width: double.infinity, child: LayoutBuilder( builder: (context, constraints) { - final size = Size(constraints.maxWidth, 160); + final size = Size(constraints.maxWidth, 190); final geometry = _LosProfileGeometry( samples: segment.samples, size: size, @@ -1081,12 +1394,12 @@ class _LineOfSightMapScreenState extends State { heightUnit: heightUnit, badgeTextStyle: Theme.of(context).textTheme.labelSmall?.copyWith( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ) ?? const TextStyle( - color: Colors.white70, + color: LosPalette.textMuted, fontSize: 10, fontWeight: FontWeight.w600, ), @@ -1121,23 +1434,26 @@ class _LineOfSightMapScreenState extends State { child: Tooltip( message: _obstructionChipLabel(obstruction, isImperial), child: GestureDetector( - onTap: () => _selectObstruction(obstruction), + onTap: () => _centerOnObstruction(obstruction), child: Container( width: markerSize, height: markerSize, decoration: BoxDecoration( color: isSelected - ? Colors.amberAccent - : Colors.deepOrangeAccent, + ? LosPalette.selected + : LosPalette.blocked, shape: BoxShape.circle, border: Border.all( color: isSelected - ? Colors.white - : Colors.black87, + ? LosPalette.text + : LosPalette.chartBackground, width: isSelected ? 2 : 1.5, ), boxShadow: const [ - BoxShadow(color: Colors.black45, blurRadius: 4), + BoxShadow( + color: LosPalette.shadow, + blurRadius: 4, + ), ], ), ), @@ -1153,51 +1469,19 @@ class _LineOfSightMapScreenState extends State { ); } - String _profileStats(LineOfSightResult result, bool isImperial) { - final distance = isImperial - ? (result.totalDistanceMeters / 1000.0) * _kmToMiles - : result.totalDistanceMeters / 1000.0; - final distanceUnit = isImperial ? 'mi' : 'km'; - final heightUnit = isImperial ? 'ft' : 'm'; - final minClearance = result.samples.isEmpty - ? 0.0 - : result.samples.map((s) => s.clearanceMeters).reduce(math.min); - final minClearanceDisplay = isImperial - ? minClearance * _metersToFeet - : minClearance; - final maxObstructionDisplay = isImperial - ? result.maxObstructionMeters * _metersToFeet - : result.maxObstructionMeters; - if (!result.hasData) { - return _localizedLosError(result.errorMessage); - } - if (result.isClear) { - return context.l10n.losProfileClear( - distance.toStringAsFixed(1), - distanceUnit, - minClearanceDisplay.toStringAsFixed(1), - heightUnit, - ); - } - return context.l10n.losProfileBlocked( - distance.toStringAsFixed(1), - distanceUnit, - maxObstructionDisplay.toStringAsFixed(1), - heightUnit, - ); - } - List _buildSegmentPolylines(LineOfSightPathResult result) { final polylines = []; for (final segment in result.segments) { final color = !segment.result.hasData - ? Colors.grey - : (segment.result.isClear ? Colors.green : Colors.red); + ? LosPalette.textMuted + : _statusColorFor(_losStatusFor(segment.result)); polylines.add( Polyline( points: [segment.start, segment.end], - strokeWidth: 4, + strokeWidth: 5, color: color, + borderStrokeWidth: 2, + borderColor: Colors.white, ), ); } @@ -1215,7 +1499,7 @@ class _LineOfSightMapScreenState extends State { width: 52, height: 52, child: GestureDetector( - onTap: () => _selectObstruction(obstruction), + onTap: () => _centerOnObstruction(obstruction), child: Center( child: Container( width: @@ -1233,16 +1517,20 @@ class _LineOfSightMapScreenState extends State { color: _selectedObstruction?.sampleIndex == obstruction.sampleIndex - ? Colors.amberAccent - : Colors.deepOrangeAccent, + ? LosPalette.selected + : LosPalette.blocked, width: _selectedObstruction?.sampleIndex == obstruction.sampleIndex ? 4 : 3, ), - boxShadow: const [ - BoxShadow(color: Colors.black26, blurRadius: 6), + boxShadow: [ + const BoxShadow( + color: LosPalette.shadow, + blurRadius: 8, + offset: Offset(0, 2), + ), ], ), ), @@ -1258,17 +1546,34 @@ class _LineOfSightMapScreenState extends State { onTap: () => _selectFromMap(endpoint), child: Container( decoration: BoxDecoration( - color: endpoint.color, shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), + color: (endpoint == _start || endpoint == _end) + ? endpoint.color + : LosPalette.panelDark, + border: Border.all( + color: (endpoint == _start || endpoint == _end) + ? Colors.white + : endpoint.color.withValues(alpha: 0.75), + width: (endpoint == _start || endpoint == _end) ? 2.5 : 1.5, + ), boxShadow: const [ - BoxShadow(color: Colors.black26, blurRadius: 4), + BoxShadow( + color: LosPalette.shadow, + blurRadius: 7, + offset: Offset(0, 2), + ), ], ), child: Stack( children: [ Center( - child: Icon(endpoint.icon, color: Colors.white, size: 16), + child: Icon( + endpoint.icon, + color: endpoint == _start || endpoint == _end + ? Colors.white + : endpoint.color, + size: 17, + ), ), if (endpoint == _start || endpoint == _end) Positioned( @@ -1278,17 +1583,17 @@ class _LineOfSightMapScreenState extends State { width: 14, height: 14, decoration: BoxDecoration( - color: Colors.black87, + color: LosPalette.chartBackground, borderRadius: BorderRadius.circular(7), - border: Border.all(color: Colors.white, width: 1), + border: Border.all(color: endpoint.color, width: 1), ), alignment: Alignment.center, child: Text( endpoint == _start ? 'A' : 'B', - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, + style: MeshTheme.mono( fontSize: 9, + fontWeight: FontWeight.w700, + color: endpoint.color, ), ), ), @@ -1316,18 +1621,19 @@ class _LineOfSightMapScreenState extends State { vertical: 2, ), decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), + color: LosPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: LosPalette.border), ), alignment: Alignment.center, child: Text( endpoint.label, maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontSize: 11, - fontWeight: FontWeight.w500, + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: LosPalette.text, ), ), ), @@ -1354,13 +1660,55 @@ class _LineOfSightMapScreenState extends State { ); } - Color _statusColor() { - if (_error != null) return Colors.red; - if (_loading) return Colors.orange; - if (_result == null) return Colors.grey; - if (_result!.blockedSegments > 0) return Colors.red; - if (_result!.clearSegments > 0) return Colors.green; - return Colors.grey; + _LosDisplayStatus _losStatusFor(LineOfSightResult? result) { + if (result == null || !result.hasData) return _LosDisplayStatus.unknown; + if (!result.isClear) return _LosDisplayStatus.blocked; + if (result.samples.isEmpty) return _LosDisplayStatus.clear; + final minClearance = result.samples + .map((sample) => sample.clearanceMeters) + .reduce(math.min); + return minClearance <= _marginalClearanceMeters + ? _LosDisplayStatus.marginal + : _LosDisplayStatus.clear; + } + + String _statusLabel(_LosDisplayStatus status) { + switch (status) { + case _LosDisplayStatus.clear: + return 'Clear'; + case _LosDisplayStatus.marginal: + return 'Marginal'; + case _LosDisplayStatus.blocked: + return 'Blocked'; + case _LosDisplayStatus.unknown: + return _loading ? 'Checking' : 'No result'; + } + } + + Color _statusColorFor(_LosDisplayStatus status) { + switch (status) { + case _LosDisplayStatus.clear: + return LosPalette.clear; + case _LosDisplayStatus.marginal: + return LosPalette.marginal; + case _LosDisplayStatus.blocked: + return LosPalette.blocked; + case _LosDisplayStatus.unknown: + return LosPalette.textMuted; + } + } + + IconData _statusIcon(_LosDisplayStatus status) { + switch (status) { + case _LosDisplayStatus.clear: + return Icons.check_circle; + case _LosDisplayStatus.marginal: + return Icons.warning_amber_rounded; + case _LosDisplayStatus.blocked: + return Icons.block; + case _LosDisplayStatus.unknown: + return Icons.help_outline; + } } double _toDisplayHeight(double meters, bool isImperial) { @@ -1371,16 +1719,6 @@ class _LineOfSightMapScreenState extends State { return isImperial ? displayHeight / _metersToFeet : displayHeight; } - String _localizedLosError(String? message) { - if (message == LineOfSightService.errorElevationUnavailable) { - return context.l10n.losErrorElevationUnavailable; - } - if (message == LineOfSightService.errorInvalidInput) { - return context.l10n.losErrorInvalidInput; - } - return context.l10n.losNoElevationData; - } - void _handleQuickSwitch(int index, BuildContext context) { if (index == 2) { Navigator.pop(context); @@ -1437,9 +1775,13 @@ class _LineOfSightMapScreenState extends State { } } +enum _LosDisplayStatus { clear, marginal, blocked, unknown } + class _LosProfileGeometry { - static const horizontalPadding = 12.0; - static const verticalPadding = 12.0; + static const leftPadding = 38.0; + static const rightPadding = 14.0; + static const topPadding = 20.0; + static const bottomPadding = 28.0; final List samples; final Size size; @@ -1463,20 +1805,20 @@ class _LosProfileGeometry { late final double maxDist = math.max(1.0, samples.last.distanceMeters); late final double chartWidth = math.max( 1.0, - size.width - horizontalPadding * 2, + size.width - leftPadding - rightPadding, ); late final double chartHeight = math.max( 1.0, - size.height - verticalPadding * 2, + size.height - topPadding - bottomPadding, ); _LosProfileGeometry({required this.samples, required this.size}); Offset mapPoint(double distanceMeters, double elevationMeters) { - final px = horizontalPadding + (distanceMeters / maxDist) * chartWidth; + final px = leftPadding + (distanceMeters / maxDist) * chartWidth; final py = size.height - - verticalPadding - + bottomPadding - ((elevationMeters - minY) / ySpan) * chartHeight; return Offset(px, py); } @@ -1505,7 +1847,7 @@ class _LosProfilePainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { - final bg = Paint()..color = const Color(0xFF243A63); + final bg = Paint()..color = LosPalette.chartBackground; canvas.drawRect(Offset.zero & size, bg); _drawUnitBadge(canvas, size); @@ -1529,18 +1871,52 @@ class _LosProfilePainter extends CustomPainter { .reduce(math.max); final ySpan = math.max(1.0, maxY - minY); final maxDist = math.max(1.0, samples.last.distanceMeters); - const horizontalPadding = 12.0; - const verticalPadding = 12.0; - final chartWidth = math.max(1.0, size.width - horizontalPadding * 2); - final chartHeight = math.max(1.0, size.height - verticalPadding * 2); + const leftPadding = _LosProfileGeometry.leftPadding; + const rightPadding = _LosProfileGeometry.rightPadding; + const topPadding = _LosProfileGeometry.topPadding; + const bottomPadding = _LosProfileGeometry.bottomPadding; + final chartWidth = math.max(1.0, size.width - leftPadding - rightPadding); + final chartHeight = math.max(1.0, size.height - topPadding - bottomPadding); Offset mapPoint(double x, double y) { - final px = horizontalPadding + (x / maxDist) * chartWidth; + final px = leftPadding + (x / maxDist) * chartWidth; final py = - size.height - verticalPadding - ((y - minY) / ySpan) * chartHeight; + size.height - bottomPadding - ((y - minY) / ySpan) * chartHeight; return Offset(px, py); } + final gridPaint = Paint() + ..color = LosPalette.textMuted.withValues(alpha: 0.16) + ..strokeWidth = 1; + for (var i = 0; i <= 4; i++) { + final x = leftPadding + chartWidth * i / 4; + final y = topPadding + chartHeight * i / 4; + canvas.drawLine( + Offset(x, topPadding), + Offset(x, size.height - bottomPadding), + gridPaint, + ); + canvas.drawLine( + Offset(leftPadding, y), + Offset(size.width - rightPadding, y), + gridPaint, + ); + final distance = maxDist * i / 4; + _paintLabel( + canvas, + _displayDistance(distance).toStringAsFixed(i == 0 ? 0 : 1), + Offset(x, size.height - bottomPadding + 7), + center: true, + ); + final elevation = maxY - ySpan * i / 4; + _paintLabel( + canvas, + _displayHeight(elevation).toStringAsFixed(0), + Offset(leftPadding - 6, y - 6), + alignRight: true, + ); + } + final firstTerrainPoint = mapPoint( samples.first.distanceMeters, samples.first.terrainMeters, @@ -1551,13 +1927,13 @@ class _LosProfilePainter extends CustomPainter { ); double distanceForCanvasX(double x) { - final normalized = ((x - horizontalPadding) / chartWidth).clamp(0.0, 1.0); + final normalized = ((x - leftPadding) / chartWidth).clamp(0.0, 1.0); return normalized * maxDist; } double elevationToPixel(double elevation) { final normalized = ((elevation - minY) / ySpan).clamp(0.0, 1.0); - return size.height - verticalPadding - normalized * chartHeight; + return size.height - bottomPadding - normalized * chartHeight; } double extrapolateTerrain(double distance, bool isLeft) { @@ -1599,10 +1975,10 @@ class _LosProfilePainter extends CustomPainter { ..lineTo(size.width, size.height) ..close(); - const terrainFillColor = Color(0xCC7C6F5D); - const terrainLineColor = Color(0xFF9FE870); - const losLineColor = Color(0xFFE0E7FF); - canvas.drawPath(terrainPath, Paint()..color = terrainFillColor); + canvas.drawPath( + terrainPath, + Paint()..color = LosPalette.terrain.withValues(alpha: 0.18), + ); final terrainLine = ui.Path()..moveTo(leftEdgePoint.dx, leftEdgePoint.dy); for (final sample in samples) { @@ -1613,9 +1989,9 @@ class _LosProfilePainter extends CustomPainter { canvas.drawPath( terrainLine, Paint() - ..color = terrainLineColor + ..color = LosPalette.terrain ..style = PaintingStyle.stroke - ..strokeWidth = 2, + ..strokeWidth = 2.5, ); final losLine = ui.Path(); @@ -1633,12 +2009,11 @@ class _LosProfilePainter extends CustomPainter { canvas.drawPath( losLine, Paint() - ..color = losLineColor + ..color = LosPalette.beam ..style = PaintingStyle.stroke - ..strokeWidth = 2, + ..strokeWidth = 2.5, ); - const refractedLineColor = Color(0xFFFFD57F); final refractedLine = ui.Path(); for (int i = 0; i < samples.length; i++) { final p = mapPoint( @@ -1654,7 +2029,7 @@ class _LosProfilePainter extends CustomPainter { canvas.drawPath( refractedLine, Paint() - ..color = refractedLineColor + ..color = LosPalette.horizon ..style = PaintingStyle.stroke ..strokeWidth = 1.5, ); @@ -1679,14 +2054,53 @@ class _LosProfilePainter extends CustomPainter { capPath.lineTo(p.dx, p.dy); } capPath.close(); - const horizonFillColor = Color(0x40FFD57F); canvas.drawPath( capPath, Paint() - ..color = horizonFillColor + ..color = LosPalette.horizon.withValues(alpha: 0.10) ..style = PaintingStyle.fill, ); + for (var i = 0; i < samples.length - 1; i++) { + if (samples[i].clearanceMeters >= 0 && + samples[i + 1].clearanceMeters >= 0) { + continue; + } + final terrainA = mapPoint( + samples[i].distanceMeters, + samples[i].terrainMeters, + ); + final terrainB = mapPoint( + samples[i + 1].distanceMeters, + samples[i + 1].terrainMeters, + ); + final lineB = mapPoint( + samples[i + 1].distanceMeters, + samples[i + 1].lineHeightMeters, + ); + final lineA = mapPoint( + samples[i].distanceMeters, + samples[i].lineHeightMeters, + ); + final blockedArea = ui.Path() + ..moveTo(terrainA.dx, terrainA.dy) + ..lineTo(terrainB.dx, terrainB.dy) + ..lineTo(lineB.dx, lineB.dy) + ..lineTo(lineA.dx, lineA.dy) + ..close(); + canvas.drawPath( + blockedArea, + Paint()..color = LosPalette.blocked.withValues(alpha: 0.42), + ); + } + + _paintEndpoint(canvas, mapPoint(0, samples.first.lineHeightMeters), 'A'); + _paintEndpoint( + canvas, + mapPoint(maxDist, samples.last.lineHeightMeters), + 'B', + ); + if (selectedSampleIndex != null && selectedSampleIndex! >= 0 && selectedSampleIndex! < samples.length) { @@ -1696,24 +2110,103 @@ class _LosProfilePainter extends CustomPainter { selectedSample.terrainMeters, ); canvas.drawLine( - Offset(selectedPoint.dx, verticalPadding), - Offset(selectedPoint.dx, size.height - verticalPadding), + Offset(selectedPoint.dx, topPadding), + Offset(selectedPoint.dx, size.height - bottomPadding), Paint() - ..color = Colors.amberAccent.withValues(alpha: 0.7) - ..strokeWidth = 1.5, + ..color = LosPalette.selected + ..strokeWidth = 2, ); - canvas.drawCircle(selectedPoint, 7, Paint()..color = Colors.amberAccent); + canvas.drawCircle(selectedPoint, 7, Paint()..color = LosPalette.selected); canvas.drawCircle( selectedPoint, 8.5, Paint() - ..color = Colors.white + ..color = LosPalette.text ..style = PaintingStyle.stroke ..strokeWidth = 1.5, ); + final labelY = math.max(topPadding + 2, selectedPoint.dy - 27); + _paintPill( + canvas, + 'Selected', + Offset( + selectedPoint.dx.clamp(42.0, size.width - 42).toDouble(), + labelY, + ), + ); } } + double _displayDistance(double meters) { + return distanceUnit == 'mi' + ? (meters / 1000.0) * 0.621371 + : meters / 1000.0; + } + + double _displayHeight(double meters) { + return heightUnit == 'ft' ? meters * 3.28084 : meters; + } + + void _paintLabel( + Canvas canvas, + String text, + Offset offset, { + bool center = false, + bool alignRight = false, + }) { + final painter = TextPainter( + text: TextSpan( + text: text, + style: const TextStyle( + color: LosPalette.textMuted, + fontSize: 9, + fontWeight: FontWeight.w600, + ), + ), + textDirection: TextDirection.ltr, + )..layout(); + var dx = offset.dx; + if (center) dx -= painter.width / 2; + if (alignRight) dx -= painter.width; + painter.paint(canvas, Offset(dx, offset.dy)); + } + + void _paintEndpoint(Canvas canvas, Offset point, String label) { + canvas.drawCircle(point, 9, Paint()..color = LosPalette.chartBackground); + canvas.drawCircle( + point, + 9, + Paint() + ..color = LosPalette.beam + ..style = PaintingStyle.stroke + ..strokeWidth = 2, + ); + _paintLabel(canvas, label, Offset(point.dx, point.dy - 5), center: true); + } + + void _paintPill(Canvas canvas, String text, Offset center) { + final painter = TextPainter( + text: TextSpan( + text: text, + style: const TextStyle( + color: LosPalette.text, + fontSize: 9, + fontWeight: FontWeight.w800, + ), + ), + textDirection: TextDirection.ltr, + )..layout(); + final rect = RRect.fromRectAndRadius( + Rect.fromCenter(center: center, width: painter.width + 12, height: 20), + const Radius.circular(10), + ); + canvas.drawRRect(rect, Paint()..color = LosPalette.selected); + painter.paint( + canvas, + Offset(center.dx - painter.width / 2, center.dy - painter.height / 2), + ); + } + @override bool shouldRepaint(covariant _LosProfilePainter oldDelegate) { return oldDelegate.samples != samples || @@ -1738,10 +2231,6 @@ class _LosProfilePainter extends CustomPainter { } class _LosLegend extends StatelessWidget { - static const _terrainColor = Color(0xFF9FE870); - static const _losColor = Color(0xFFE0E7FF); - static const _radioColor = Color(0xFFFFD57F); - final String terrainLabel; final String losBeamLabel; final String radioHorizonLabel; @@ -1756,23 +2245,24 @@ class _LosLegend extends StatelessWidget { Widget build(BuildContext context) { final textStyle = Theme.of(context).textTheme.labelSmall?.copyWith( - color: Theme.of(context).colorScheme.onSurfaceVariant, - fontSize: 11, - fontWeight: FontWeight.w500, + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w700, ) ?? - TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, - fontSize: 11, - fontWeight: FontWeight.w500, + const TextStyle( + color: LosPalette.text, + fontSize: 12, + fontWeight: FontWeight.w700, ); final entries = [ - _LegendEntry(terrainLabel, _terrainColor), - _LegendEntry(losBeamLabel, _losColor), - _LegendEntry(radioHorizonLabel, _radioColor), + _LegendEntry(terrainLabel, LosPalette.terrain), + _LegendEntry(losBeamLabel, LosPalette.beam), + _LegendEntry(radioHorizonLabel, LosPalette.horizon), + const _LegendEntry('Blocked', LosPalette.blocked), ]; - const swatchSize = 10.0; + const swatchSize = 12.0; return Wrap( spacing: 16, diff --git a/lib/screens/map_cache_screen.dart b/lib/screens/map_cache_screen.dart index e627bd58..6455c15c 100644 --- a/lib/screens/map_cache_screen.dart +++ b/lib/screens/map_cache_screen.dart @@ -10,6 +10,9 @@ import '../services/app_settings_service.dart'; import '../services/map_tile_cache_service.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../helpers/snack_bar_builder.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; +import '../widgets/themed_map_tile_layer.dart'; class MapCacheScreen extends StatefulWidget { const MapCacheScreen({super.key}); @@ -76,27 +79,34 @@ class _MapCacheScreenState extends State { return Positioned( top: 12, left: 12, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: context.l10n.map_zoomIn, - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: context.l10n.map_zoomOut, - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: context.l10n.map_centerMap, - onPressed: _resetMapView, - ), - ], + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.90), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.add), + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + icon: const Icon(Icons.my_location), + tooltip: context.l10n.map_centerMap, + onPressed: _resetMapView, + ), + ], + ), ), ), ); @@ -281,6 +291,7 @@ class _MapCacheScreenState extends State { final tileCache = context.read(); final selectedBounds = _selectedBounds; final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final isDesktop = _isDesktopPlatform(defaultTargetPlatform); final progressValue = _estimatedTiles == 0 ? 0.0 @@ -318,13 +329,7 @@ class _MapCacheScreenState extends State { ), ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, - ), + ThemedMapTileLayer(tileCache: tileCache), if (selectedBounds != null) PolygonLayer( polygons: [ @@ -342,14 +347,25 @@ class _MapCacheScreenState extends State { Positioned( top: 12, right: 12, - child: Card( + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.93), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), child: Padding( - padding: const EdgeInsets.all(8), + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 6, + ), child: Text( selectedBounds == null ? l10n.mapCache_noAreaSelected : _formatBounds(selectedBounds, l10n), - style: const TextStyle(fontSize: 12), + style: MeshTheme.mono( + fontSize: 11, + color: MeshPalette.ink2, + ), ), ), ), @@ -359,111 +375,133 @@ class _MapCacheScreenState extends State { ), SafeArea( top: false, - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - l10n.mapCache_cacheArea, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, + child: DecoratedBox( + decoration: BoxDecoration( + color: scheme.surfaceContainerLow, + border: Border(top: BorderSide(color: scheme.outlineVariant)), + ), + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + SectionHeader( + l10n.mapCache_cacheArea, + padding: const EdgeInsets.fromLTRB(0, 12, 0, 8), ), - ), - const SizedBox(height: 8), - Row( - children: [ - Expanded( - child: ElevatedButton.icon( - icon: const Icon(Icons.crop_free), - label: Text(l10n.mapCache_useCurrentView), - onPressed: _isDownloading ? null : _setBoundsFromView, + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + icon: const Icon(Icons.crop_free), + label: Text(l10n.mapCache_useCurrentView), + onPressed: _isDownloading + ? null + : _setBoundsFromView, + ), ), - ), - const SizedBox(width: 12), - TextButton( - onPressed: _isDownloading || selectedBounds == null - ? null - : _clearBounds, - child: Text(l10n.common_clear), - ), - ], - ), - const SizedBox(height: 12), - Text( - l10n.mapCache_zoomRange, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - RangeSlider( - values: RangeValues( - _minZoom.toDouble(), - _maxZoom.toDouble(), - ), - min: 3, - max: 18, - divisions: 15, - labels: RangeLabels('$_minZoom', '$_maxZoom'), - onChanged: _isDownloading - ? null - : (values) { - setState(() { - _minZoom = values.start.round(); - _maxZoom = values.end.round(); - }); - }, - onChangeEnd: _isDownloading - ? null - : (_) { - _saveZoomRange(); - }, - ), - Text(l10n.mapCache_estimatedTiles(_estimatedTiles)), - if (_isDownloading) ...[ - const SizedBox(height: 8), - LinearProgressIndicator(value: progressValue), - const SizedBox(height: 4), - Text( - l10n.mapCache_downloadedTiles( - _completedTiles, - _estimatedTiles, - ), - ), - ], - const SizedBox(height: 12), - Row( - children: [ - Expanded( - child: ElevatedButton.icon( - icon: const Icon(Icons.download), - label: Text(l10n.mapCache_downloadTilesButton), + const SizedBox(width: 12), + TextButton( onPressed: _isDownloading || selectedBounds == null ? null - : _startDownload, + : _clearBounds, + child: Text(l10n.common_clear), ), + ], + ), + const SizedBox(height: 12), + SectionHeader( + l10n.mapCache_zoomRange, + padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), + ), + RangeSlider( + values: RangeValues( + _minZoom.toDouble(), + _maxZoom.toDouble(), ), - const SizedBox(width: 12), - OutlinedButton( - onPressed: _isDownloading ? null : _clearCache, - child: Text(l10n.mapCache_clearCacheButton), - ), - ], - ), - if (_failedTiles > 0 && !_isDownloading) - Padding( - padding: const EdgeInsets.only(top: 8), - child: Text( - l10n.mapCache_failedDownloads(_failedTiles), - style: TextStyle( - color: Theme.of(context).colorScheme.error, - ), + min: 3, + max: 18, + divisions: 15, + labels: RangeLabels('$_minZoom', '$_maxZoom'), + onChanged: _isDownloading + ? null + : (values) { + setState(() { + _minZoom = values.start.round(); + _maxZoom = values.end.round(); + }); + }, + onChangeEnd: _isDownloading + ? null + : (_) { + _saveZoomRange(); + }, + ), + Text( + l10n.mapCache_estimatedTiles(_estimatedTiles), + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSurfaceVariant, ), ), - ], + if (_isDownloading) ...[ + const SizedBox(height: 8), + LinearProgressIndicator( + value: progressValue, + color: MeshPalette.blue, + backgroundColor: scheme.surfaceContainerHighest, + ), + const SizedBox(height: 4), + Text( + l10n.mapCache_downloadedTiles( + _completedTiles, + _estimatedTiles, + ), + style: MeshTheme.mono( + fontSize: 12, + color: scheme.onSurfaceVariant, + ), + ), + ], + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: ElevatedButton.icon( + icon: const Icon(Icons.download), + label: Text(l10n.mapCache_downloadTilesButton), + onPressed: _isDownloading || selectedBounds == null + ? null + : _startDownload, + ), + ), + const SizedBox(width: 12), + OutlinedButton( + style: OutlinedButton.styleFrom( + foregroundColor: MeshPalette.alert, + side: const BorderSide( + color: MeshPalette.alertLine, + ), + ), + onPressed: _isDownloading ? null : _clearCache, + child: Text(l10n.mapCache_clearCacheButton), + ), + ], + ), + if (_failedTiles > 0 && !_isDownloading) + Padding( + padding: const EdgeInsets.only(top: 8), + child: Text( + l10n.mapCache_failedDownloads(_failedTiles), + style: MeshTheme.mono( + fontSize: 12, + color: MeshPalette.alert, + ), + ), + ), + ], + ), ), ), ), diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index 3e4193c0..f14a1820 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:latlong2/latlong.dart'; import 'package:meshcore_open/screens/path_trace_map.dart'; @@ -21,13 +22,17 @@ import '../services/path_history_service.dart'; import '../services/map_marker_service.dart'; import '../services/map_tile_cache_service.dart'; import '../utils/contact_search.dart'; +import '../utils/battery_utils.dart'; import '../utils/route_transitions.dart'; import '../widgets/quick_switch_bar.dart'; import '../widgets/sync_progress_overlay.dart'; +import '../widgets/themed_map_tile_layer.dart'; import '../icons/los_icon.dart'; import 'channels_screen.dart'; import 'chat_screen.dart'; import 'contacts_screen.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/repeater_login_dialog.dart'; import '../widgets/room_login_dialog.dart'; import '../helpers/snack_bar_builder.dart'; @@ -58,6 +63,11 @@ class MapScreen extends StatefulWidget { class _MapScreenState extends State { // Zoom level at which node labels start to appear static const double _labelZoomThreshold = 14.0; + // Below this zoom, nearby nodes collapse into clusters. + static const double _clusterOffZoom = 12.5; + // Guessed (estimated) locations only render at closer zooms to avoid a + // carpet of approximate markers at city-wide scale. + static const double _guessedZoomThreshold = 12.0; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; @@ -73,11 +83,51 @@ class _MapScreenState extends State { final List _pathTraceContacts = []; final List _points = []; final List _polylines = []; - bool _legendExpanded = false; + bool _statsExpanded = false; bool _showNodeLabels = true; + double _zoom = 10.0; + String? _selectedKey; + LatLng? _selectedGuessPos; + _Freshness _freshness = _Freshness.all; + final TextEditingController _searchController = TextEditingController(); + final FocusNode _searchFocus = FocusNode(); + String _searchQuery = ''; List<_GuessedLocation> _cachedGuessedLocations = []; String _guessedLocationsCacheKey = ''; + @override + void dispose() { + _searchController.dispose(); + _searchFocus.dispose(); + _mapController.dispose(); + super.dispose(); + } + + _NodeAge _ageOf(Contact contact) { + final d = DateTime.now().difference(contact.lastSeen); + if (d.inMinutes <= 60) return _NodeAge.online; + if (d.inHours <= 24) return _NodeAge.recent; + return _NodeAge.stale; + } + + void _selectNode(Contact contact, {LatLng? guessedPosition}) { + HapticFeedback.selectionClick(); + setState(() { + _selectedKey = contact.publicKeyHex; + _selectedGuessPos = guessedPosition; + _searchQuery = ''; + _searchController.clear(); + _searchFocus.unfocus(); + }); + } + + void _clearSelection() { + setState(() { + _selectedKey = null; + _selectedGuessPos = null; + }); + } + @override void initState() { super.initState(); @@ -166,38 +216,67 @@ class _MapScreenState extends State { _mapController.move(camera.center, nextZoom); } - Widget _buildDesktopMapControls( + Widget _buildControlRail( BuildContext context, { required LatLng center, required double zoom, - required bool hasPathSelector, + required MeshCoreConnector connector, }) { + final hasSelf = + connector.selfLatitude != null && connector.selfLongitude != null; return Positioned( - left: 16, - top: hasPathSelector ? null : 16, - bottom: hasPathSelector ? 16 : null, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: context.l10n.map_zoomIn, - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: context.l10n.map_zoomOut, - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: context.l10n.map_centerMap, - onPressed: () => _mapController.move(center, zoom), + left: 12, + bottom: 96, + child: DecoratedBox( + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), ], ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.add), + visualDensity: VisualDensity.standard, + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.crop_free), + tooltip: context.l10n.map_centerMap, + onPressed: () => _mapController.move(center, zoom), + ), + if (hasSelf) + IconButton( + color: MapPalette.selected, + icon: const Icon(Icons.my_location), + tooltip: context.l10n.map_setAsMyLocation, + onPressed: () => _mapController.move( + LatLng(connector.selfLatitude!, connector.selfLongitude!), + max(_zoom, 14), + ), + ), + ], + ), + ), ), ); } @@ -235,16 +314,27 @@ class _MapScreenState extends State { return hoursSinceLastSeen <= settings.mapTimeFilterHours; }).toList(); + // Quick activity filter (search bar chips) + final filteredByFreshness = switch (_freshness) { + _Freshness.all => filteredByTime, + _Freshness.online => + filteredByTime.where((c) => _ageOf(c) == _NodeAge.online).toList(), + _Freshness.recent => + filteredByTime.where((c) => _ageOf(c) != _NodeAge.stale).toList(), + _Freshness.stale => + filteredByTime.where((c) => _ageOf(c) == _NodeAge.stale).toList(), + }; + // Filter by key prefix final keyPrefix = settings.mapKeyPrefix.trim(); final filteredByKeyPrefix = (settings.mapKeyPrefixEnabled && keyPrefix.isNotEmpty) - ? filteredByTime.where((c) { + ? filteredByFreshness.where((c) { return c.publicKeyHex.toLowerCase().startsWith( keyPrefix.toLowerCase(), ); }).toList() - : filteredByTime; + : filteredByFreshness; // Filter by location final contactsWithLocation = filteredByKeyPrefix.where((c) { @@ -292,7 +382,7 @@ class _MapScreenState extends State { Polyline( points: _points, strokeWidth: 4, - color: Colors.blueAccent, + color: MapPalette.selected, ), ] : [], @@ -308,8 +398,10 @@ class _MapScreenState extends State { Polyline( points: points, color: marker.isChannel - ? (marker.isPublicChannel ? Colors.orange : Colors.purple) - : Colors.blue, + ? (marker.isPublicChannel + ? MapPalette.cluster + : MapPalette.router) + : MapPalette.shared, strokeWidth: 3, ), ); @@ -397,6 +489,7 @@ class _MapScreenState extends State { if (!_hasInitializedMap && _removedMarkersLoaded) { _hasInitializedMap = true; _showNodeLabels = initialZoom >= _labelZoomThreshold; + _zoom = initialZoom; if (hasMapContent) { WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) { @@ -408,10 +501,34 @@ class _MapScreenState extends State { final allowBack = !connector.isConnected; + final visibleContacts = _filterContactsBySettings( + contactsWithLocation, + settings, + ); + Contact? selectedContact; + if (_selectedKey != null) { + for (final c in allContacts) { + if (c.publicKeyHex == _selectedKey) { + selectedContact = c; + break; + } + } + } + final locatedTotal = allContacts.where((c) => c.hasLocation).length; + final hiddenCount = max(0, locatedTotal - visibleContacts.length); + final onlineCount = visibleContacts + .where((c) => _ageOf(c) == _NodeAge.online) + .length; + final repeaterCount = visibleContacts + .where((c) => c.type == advTypeRepeater) + .length; + return PopScope( canPop: allowBack, child: Scaffold( appBar: AppBar( + backgroundColor: MapPalette.panelDark, + foregroundColor: MapPalette.textPrimary, title: AppBarTitle(context.l10n.map_title), centerTitle: true, automaticallyImplyLeading: false, @@ -457,7 +574,7 @@ class _MapScreenState extends State { connector.selfLatitude!, connector.selfLongitude!, ), - color: Colors.teal, + color: MapPalette.selected, icon: Icons.person_pin_circle, ), ); @@ -550,6 +667,17 @@ class _MapScreenState extends State { defaultLabel: context.l10n.map_pointOfInterest, flags: 'poi', ); + return; + } + // Tapping empty map dismisses selection + search. + if (_selectedKey != null || _searchQuery.isNotEmpty) { + setState(() { + _selectedKey = null; + _selectedGuessPos = null; + _searchQuery = ''; + _searchController.clear(); + _searchFocus.unfocus(); + }); } }, onLongPress: (_, latLng) { @@ -573,22 +701,21 @@ class _MapScreenState extends State { ); }, onPositionChanged: (camera, hasGesture) { + // Track zoom in half-step buckets so cluster/marker + // detail levels update without rebuilding every frame. + final bucket = (camera.zoom * 2).roundToDouble() / 2; final shouldShow = camera.zoom >= _labelZoomThreshold; - if (shouldShow != _showNodeLabels && mounted) { + if ((bucket != _zoom || shouldShow != _showNodeLabels) && + mounted) { setState(() { + _zoom = bucket; _showNodeLabels = shouldShow; }); } }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, - ), + ThemedMapTileLayer(tileCache: tileCache), if (_polylines.isNotEmpty && _isBuildingPathTrace) PolylineLayer(polylines: _polylines), if (sharedMarkerPolylines.isNotEmpty) @@ -598,25 +725,45 @@ class _MapScreenState extends State { if (highlightPosition != null) Marker( point: highlightPosition, - width: 40, - height: 40, + width: 44, + height: 44, child: IgnorePointer( - child: Icon( - Icons.location_on_outlined, - color: Colors.red[600], - size: 34, + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.batteryLow, + border: Border.all( + color: MapPalette.markerOutline, + width: 3, + ), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), + ), + ], + ), + child: const Icon( + Icons.location_on, + color: Colors.white, + size: 25, + ), ), ), ), - if (!settings.mapShowOverlaps) + if (!settings.mapShowOverlaps && + (_zoom >= _guessedZoomThreshold || + _isBuildingPathTrace)) ..._buildGuessedMarker( guessedLocations, showLabels: _showNodeLabels, ), - ..._buildMarkers( - contactsWithLocation, + ..._buildNodeMarkers( + visibleContacts, settings, showLabels: _showNodeLabels, + selectedContact: selectedContact, ), ...sharedMarkers.map(_buildSharedMarker), if (connector.selfLatitude != null && @@ -631,29 +778,28 @@ class _MapScreenState extends State { child: IgnorePointer( ignoring: true, child: Container( - padding: const EdgeInsets.all(4), + width: 36, + height: 36, decoration: BoxDecoration( - color: Colors.teal, shape: BoxShape.circle, + color: MapPalette.panelDark, border: Border.all( - color: Colors.white, - width: 2, + color: MapPalette.markerOutline, + width: 2.5, ), boxShadow: [ - BoxShadow( - color: Colors.black.withValues( - alpha: 0.3, - ), - blurRadius: 4, - offset: const Offset(0, 2), + const BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 2), ), ], ), alignment: Alignment.center, child: const Icon( Icons.person_pin_circle, - color: Colors.white, - size: 20, + color: MapPalette.selected, + size: 22, ), ), ), @@ -672,22 +818,34 @@ class _MapScreenState extends State { ), ], ), - if (!_isBuildingPathTrace) - _buildLegend( - contacts, - contactsWithLocation, - settings, - sharedMarkers.length, - guessedLocations.length, - ), - if (isDesktop) - _buildDesktopMapControls( + if (selectedContact == null) + _buildControlRail( context, center: center, zoom: initialZoom, - hasPathSelector: _isBuildingPathTrace, + connector: connector, + ), + if (!_isBuildingPathTrace) + _buildTopOverlay( + context, + connector: connector, + settingsService: settingsService, + allContacts: allContacts, + guessedLocations: guessedLocations, + visibleCount: + visibleContacts.length + + ((settings.mapShowGuessedLocations && + _zoom >= _guessedZoomThreshold) + ? guessedLocations.length + : 0), + onlineCount: onlineCount, + repeaterCount: repeaterCount, + hiddenCount: hiddenCount, + pinCount: sharedMarkers.length, ), if (_isBuildingPathTrace) _buildPathTraceOverlay(), + if (selectedContact != null && !_isBuildingPathTrace) + _buildSelectedNodeCard(context, selectedContact, connector), ], ), bottomNavigationBar: SafeArea( @@ -698,13 +856,17 @@ class _MapScreenState extends State { _handleQuickSwitch(index, context), contactsUnreadCount: connector.getTotalContactsUnreadCount(), channelsUnreadCount: connector.getTotalChannelsUnreadCount(), + highContrast: true, ), ), - floatingActionButton: FloatingActionButton( - onPressed: () => _showFilterDialog(context, settingsService), - tooltip: context.l10n.map_filterNodes, - child: const Icon(Icons.filter_list), - ), + floatingActionButton: + (selectedContact == null && !_isBuildingPathTrace) + ? FloatingActionButton( + onPressed: () => _showFilterSheet(context, settingsService), + tooltip: context.l10n.map_filterNodes, + child: const Icon(Icons.filter_list), + ) + : null, ), ); }, @@ -932,32 +1094,31 @@ class _MapScreenState extends State { : null, onTap: () => _isBuildingPathTrace ? _addToPath(context, guess.contact, position: guess.position) - : _showNodeInfo( - context, - guess.contact, - guessedPosition: guess.position, - ), + : _selectNode(guess.contact, guessedPosition: guess.position), child: Center( child: Container( - padding: const EdgeInsets.all(4), + width: 36, + height: 36, decoration: BoxDecoration( - color: color.withValues( - alpha: guess.highConfidence ? 0.55 : 0.30, - ), shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ + color: MapPalette.panelDark, + border: Border.all( + color: guess.highConfidence ? color : MapPalette.textMuted, + width: guess.highConfidence ? 2.5 : 2, + ), + boxShadow: const [ BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + color: MapPalette.markerShadow, + blurRadius: 7, + offset: Offset(0, 2), ), ], ), - child: const Icon( + alignment: Alignment.center, + child: Icon( Icons.not_listed_location, - color: Colors.white, - size: 20, + color: MapPalette.textPrimary, + size: 19, ), ), ), @@ -1040,57 +1201,24 @@ class _MapScreenState extends State { return filtered; } - List _buildMarkers( + List _buildNodeMarkers( List contacts, settings, { required bool showLabels, + Contact? selectedContact, }) { final markers = []; - final filteredContacts = _filterContactsBySettings(contacts, settings); - for (final contact in filteredContacts) { - final marker = Marker( - point: LatLng(contact.latitude!, contact.longitude!), - width: 48, - height: 48, - child: GestureDetector( - onLongPress: () => - _isBuildingPathTrace ? _showNodeInfo(context, contact) : null, - onTap: () => _isBuildingPathTrace - ? _addToPath(context, contact) - : _showNodeInfo(context, contact), - child: Center( - child: Container( - padding: const EdgeInsets.all(4), - decoration: BoxDecoration( - color: settings.mapShowOverlaps && !_isBuildingPathTrace - ? Colors.red - : _getNodeColor(contact.type), - shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), - ), - ], - ), - child: Icon( - _getNodeIcon(contact.type), - color: Colors.white, - size: 20, - ), - ), - ), - ), - ); + final overlapsMode = settings.mapShowOverlaps && !_isBuildingPathTrace; + final selectedKey = selectedContact?.publicKeyHex; + final items = contacts.where((c) => c.publicKeyHex != selectedKey).toList(); - markers.add(marker); + void addNode(Contact contact, {bool dot = false}) { + markers.add(_nodeMarker(contact, overlapsMode: overlapsMode, dot: dot)); if (showLabels) { markers.add( _buildNodeLabelMarker( point: LatLng(contact.latitude!, contact.longitude!), - label: settings.mapShowOverlaps && !_isBuildingPathTrace + label: overlapsMode ? "${contact.publicKeyHex.substring(0, 2)}:${contact.name}" : contact.name, ), @@ -1098,9 +1226,196 @@ class _MapScreenState extends State { } } + if (_zoom >= _clusterOffZoom || overlapsMode || _isBuildingPathTrace) { + for (final contact in items) { + addNode(contact); + } + } else { + // Grid clustering: bucket markers into ~64px screen cells at the + // current zoom; cells with 2+ nodes render as a numbered cluster. + final cellDeg = 360.0 / (256.0 * pow(2.0, _zoom)) * 64.0; + final cells = >{}; + for (final contact in items) { + final key = + '${(contact.latitude! / cellDeg).floor()}:${(contact.longitude! / cellDeg).floor()}'; + (cells[key] ??= []).add(contact); + } + for (final cell in cells.values) { + if (cell.length == 1) { + addNode(cell.first, dot: true); + } else { + markers.add(_clusterMarker(cell)); + } + } + } + + // Selected node always renders individually on top, even when its + // neighbors are clustered or it is filtered out. + if (selectedContact != null && selectedContact.hasLocation) { + markers.add( + _nodeMarker( + selectedContact, + overlapsMode: overlapsMode, + selected: true, + ), + ); + markers.add( + _buildNodeLabelMarker( + point: LatLng(selectedContact.latitude!, selectedContact.longitude!), + label: selectedContact.name, + ), + ); + } + return markers; } + Marker _nodeMarker( + Contact contact, { + bool overlapsMode = false, + bool dot = false, + bool selected = false, + }) { + final age = _ageOf(contact); + final baseColor = overlapsMode + ? MapPalette.batteryLow + : _markerColor(contact); + final stale = age == _NodeAge.stale; + final online = age == _NodeAge.online; + final batteryLow = _isBatteryLow(contact); + final size = selected ? 46.0 : (dot ? 22.0 : 40.0); + return Marker( + point: LatLng(contact.latitude!, contact.longitude!), + width: size, + height: size, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onLongPress: () => + _isBuildingPathTrace ? _showNodeInfo(context, contact) : null, + onTap: () => _isBuildingPathTrace + ? _addToPath(context, contact) + : _selectNode(contact), + child: Center( + child: dot && !selected + ? Container( + width: 15, + height: 15, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: baseColor, + border: Border.all( + color: MapPalette.markerOutline, + width: 2, + ), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 6, + offset: Offset(0, 2), + ), + ], + ), + ) + : _buildNodeMarkerWidget( + color: baseColor, + icon: _getNodeIcon(contact.type), + selected: selected, + stale: stale, + online: online, + batteryLow: batteryLow, + ), + ), + ), + ); + } + + Marker _clusterMarker(List members) { + final count = members.length; + double lat = 0, lon = 0; + var online = 0; + for (final m in members) { + lat += m.latitude!; + lon += m.longitude!; + if (_ageOf(m) == _NodeAge.online) online++; + } + final center = LatLng(lat / count, lon / count); + final size = count >= 50 + ? 54.0 + : count >= 16 + ? 50.0 + : count >= 6 + ? 46.0 + : 42.0; + return Marker( + point: center, + width: size, + height: size, + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => _zoomToCluster(members), + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.cluster, + border: Border.all(color: MapPalette.markerOutline, width: 3), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), + ), + ], + ), + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '$count', + style: MeshTheme.mono( + fontSize: count >= 100 ? 11.5 : 13.5, + fontWeight: FontWeight.w800, + color: Colors.white, + ), + ), + if (online > 0) + Container( + width: 7, + height: 7, + margin: const EdgeInsets.only(top: 1), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MapPalette.online, + border: Border.all(color: Colors.white, width: 1), + ), + ), + ], + ), + ), + ), + ); + } + + void _zoomToCluster(List members) { + HapticFeedback.selectionClick(); + var minLat = double.infinity, maxLat = -double.infinity; + var minLon = double.infinity, maxLon = -double.infinity; + for (final m in members) { + minLat = min(minLat, m.latitude!); + maxLat = max(maxLat, m.latitude!); + minLon = min(minLon, m.longitude!); + maxLon = max(maxLon, m.longitude!); + } + _mapController.fitCamera( + CameraFit.bounds( + bounds: LatLngBounds(LatLng(minLat, minLon), LatLng(maxLat, maxLon)), + padding: const EdgeInsets.all(72), + maxZoom: 16, + ), + ); + } + Marker _buildNodeLabelMarker({required LatLng point, required String label}) { return Marker( point: point, @@ -1115,18 +1430,26 @@ class _MapScreenState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 4, + offset: Offset(0, 1), + ), + ], ), alignment: Alignment.center, child: Text( label, maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontSize: 11, - fontWeight: FontWeight.w500, + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, ), ), ), @@ -1139,18 +1462,44 @@ class _MapScreenState extends State { Color _getNodeColor(int type) { switch (type) { case advTypeChat: - return Colors.blue; + return MapPalette.selected; case advTypeRepeater: - return Colors.green; + return MapPalette.repeater; case advTypeRoom: - return Colors.purple; + return MapPalette.router; case advTypeSensor: - return Colors.orange; + return MapPalette.sensor; default: - return Colors.grey; + return MapPalette.offline; } } + Color _markerColor(Contact contact) { + switch (contact.type) { + case advTypeRepeater: + return MapPalette.repeater; + case advTypeRoom: + return MapPalette.router; + case advTypeSensor: + return MapPalette.sensor; + default: + return _ageColor(_ageOf(contact)); + } + } + + bool _isBatteryLow(Contact contact) { + if (contact.type != advTypeRepeater) return false; + final connector = context.read(); + final millivolts = connector.getRepeaterBatteryMillivolts( + contact.publicKeyHex, + ); + if (millivolts == null) return false; + final chemistry = context + .read() + .batteryChemistryForRepeater(contact.publicKeyHex); + return estimateBatteryPercentFromMillivolts(millivolts, chemistry) <= 20; + } + IconData _getNodeIcon(int type) { switch (type) { case advTypeChat: @@ -1166,211 +1515,862 @@ class _MapScreenState extends State { } } - Widget _buildLegend( - List contacts, - List contactsWithLocation, - settings, - int markerCount, - int guessedCount, - ) { - final filteredContacts = _filterContactsBySettings( - contacts, - settings, - noLocations: false, - ); - final filteredContactsAll = _filterContactsBySettings( - contacts, - settings, - noLocations: true, - ); - - final nodeCount = filteredContacts.length; - final nodeCountAll = filteredContactsAll.length; - - return Positioned( - top: 16, - right: 16, - child: Card( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - InkWell( - borderRadius: BorderRadius.circular(12), - onTap: () { - setState(() { - _legendExpanded = !_legendExpanded; - }); - }, - child: Padding( - padding: const EdgeInsets.fromLTRB(12, 10, 12, 10), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.map_nodesCount( - nodeCount + - (settings.mapShowGuessedLocations - ? guessedCount - : 0), - ), - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - Row( - children: [ - Icon( - Icons.location_on, - size: 16, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - Text( - ": $nodeCount", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - ], - ), - Row( - children: [ - Icon( - Icons.wrong_location, - size: 16, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - Text( - ": ${nodeCountAll - nodeCount}", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - ], - ), - Row( - children: [ - Icon( - Icons.add_outlined, - size: 16, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - Text( - ": $nodeCountAll", - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 14, - ), - ), - ], - ), - Text( - context.l10n.map_pinsCount(markerCount), - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 12, - ), - ), - ], - ), - const SizedBox(width: 8), - AnimatedRotation( - turns: _legendExpanded ? 0.5 : 0, - duration: const Duration(milliseconds: 200), - child: const Icon(Icons.expand_more, size: 20), - ), - ], - ), - ), + Widget _buildNodeMarkerWidget({ + required Color color, + required IconData icon, + bool selected = false, + bool stale = false, + bool online = false, + bool batteryLow = false, + }) { + final statusColor = batteryLow + ? MapPalette.batteryLow + : online + ? MapPalette.online + : stale + ? MapPalette.offline + : MapPalette.stale; + return Stack( + clipBehavior: Clip.none, + alignment: Alignment.center, + children: [ + Container( + width: selected ? 44 : 36, + height: selected ? 44 : 36, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: selected ? MapPalette.selected : color, + border: Border.all( + color: MapPalette.markerOutline, + width: selected ? 3 : 2.5, ), - AnimatedCrossFade( - firstChild: const SizedBox.shrink(), - secondChild: Padding( - padding: const EdgeInsets.fromLTRB(12, 0, 12, 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const SizedBox(height: 6), - _buildLegendItem( - Icons.person, - context.l10n.map_chat, - Colors.blue, - ), - _buildLegendItem( - Icons.router, - context.l10n.map_repeater, - Colors.green, - ), - _buildLegendItem( - Icons.meeting_room, - context.l10n.map_room, - Colors.purple, - ), - _buildLegendItem( - Icons.sensors, - context.l10n.map_sensor, - Colors.orange, - ), - _buildLegendItem( - Icons.flag, - context.l10n.map_pinDm, - Colors.blue, - ), - _buildLegendItem( - Icons.flag, - context.l10n.map_pinPrivate, - Colors.purple, - ), - _buildLegendItem( - Icons.flag, - context.l10n.map_pinPublic, - Colors.orange, - ), - if (settings.mapShowGuessedLocations && guessedCount > 0) - _buildLegendItem( - Icons.not_listed_location, - context.l10n.map_guessedLocation, - Colors.grey, - ), - ], - ), + boxShadow: [ + const BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), - crossFadeState: _legendExpanded - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - duration: const Duration(milliseconds: 200), - ), - ], + if (selected) + BoxShadow( + color: MapPalette.selected.withValues(alpha: 0.75), + blurRadius: 14, + spreadRadius: 3, + ), + ], + ), + alignment: Alignment.center, + child: Icon(icon, color: Colors.white, size: selected ? 22 : 19), ), - ), + Positioned( + right: selected ? -1 : -2, + bottom: selected ? 0 : -2, + child: Container( + width: batteryLow ? 16 : (selected ? 13 : 12), + height: batteryLow ? 16 : (selected ? 13 : 12), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: statusColor, + border: Border.all(color: MapPalette.panelDark, width: 2), + ), + alignment: Alignment.center, + child: batteryLow + ? const Icon(Icons.battery_alert, size: 10, color: Colors.white) + : null, + ), + ), + ], ); } Widget _buildLegendItem(IconData icon, String label, Color color) { return Padding( - padding: const EdgeInsets.symmetric(vertical: 1.0), + padding: const EdgeInsets.symmetric(vertical: 1.5), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Icon(icon, size: 16, color: color), + Icon(icon, size: 15, color: color), const SizedBox(width: 8), - Text(label, style: const TextStyle(fontSize: 12)), + Expanded( + child: Text( + label, + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: MapPalette.textSecondary, + ), + overflow: TextOverflow.ellipsis, + ), + ), ], ), ); } + Color _ageColor(_NodeAge age) { + switch (age) { + case _NodeAge.online: + return MapPalette.online; + case _NodeAge.recent: + return MapPalette.stale; + case _NodeAge.stale: + return MapPalette.textMuted; + } + } + + String _ageLabel(_NodeAge age) { + switch (age) { + case _NodeAge.online: + return context.l10n.map_online; + case _NodeAge.recent: + return context.l10n.map_recent; + case _NodeAge.stale: + return context.l10n.map_stale; + } + } + + Widget _buildTopOverlay( + BuildContext context, { + required MeshCoreConnector connector, + required AppSettingsService settingsService, + required List allContacts, + required List<_GuessedLocation> guessedLocations, + required int visibleCount, + required int onlineCount, + required int repeaterCount, + required int hiddenCount, + required int pinCount, + }) { + final settings = settingsService.settings; + final hasQuery = _searchQuery.trim().isNotEmpty; + return Positioned( + top: 8, + left: 12, + right: 12, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Expanded( + child: Material( + color: MapPalette.panelDark, + shape: StadiumBorder( + side: const BorderSide(color: MapPalette.border), + ), + clipBehavior: Clip.antiAlias, + child: TextField( + controller: _searchController, + focusNode: _searchFocus, + decoration: InputDecoration( + hintText: context.l10n.map_searchHint, + hintStyle: const TextStyle( + color: MapPalette.textSecondary, + ), + prefixIcon: const Icon( + Icons.search, + size: 20, + color: MapPalette.textPrimary, + ), + suffixIcon: hasQuery + ? IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.close, size: 18), + onPressed: () { + setState(() { + _searchQuery = ''; + _searchController.clear(); + }); + }, + ) + : null, + filled: false, + border: InputBorder.none, + enabledBorder: InputBorder.none, + focusedBorder: InputBorder.none, + isDense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: 4, + vertical: 12, + ), + ), + style: const TextStyle( + fontSize: 14, + color: MapPalette.textPrimary, + fontWeight: FontWeight.w600, + ), + cursorColor: MapPalette.selected, + onChanged: (value) { + setState(() => _searchQuery = value); + }, + ), + ), + ), + const SizedBox(width: 8), + Material( + color: MapPalette.panelDark, + shape: StadiumBorder( + side: const BorderSide(color: MapPalette.border), + ), + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: () => setState(() => _statsExpanded = !_statsExpanded), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 11, + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon( + Icons.hub, + size: 15, + color: MapPalette.selected, + ), + const SizedBox(width: 6), + Text( + '$visibleCount', + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, + ), + ), + const SizedBox(width: 2), + AnimatedRotation( + turns: _statsExpanded ? 0.5 : 0, + duration: const Duration(milliseconds: 200), + child: const Icon( + Icons.expand_more, + size: 16, + color: MapPalette.textPrimary, + ), + ), + ], + ), + ), + ), + ), + ], + ), + 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, + ), + ), + ]; + + 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) + Align( + alignment: Alignment.centerRight, + child: _buildStatsCard( + context, + settings: settings, + visibleCount: visibleCount, + onlineCount: onlineCount, + repeaterCount: repeaterCount, + hiddenCount: hiddenCount, + pinCount: pinCount, + guessedCount: guessedLocations.length, + ), + ), + ], + ), + ); + } + + 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: Material( + color: selected + ? Color.alphaBlend( + accent.withValues(alpha: 0.34), + MapPalette.panelDark, + ) + : MapPalette.panelDark, + shape: StadiumBorder( + side: BorderSide( + color: selected ? accent : MapPalette.border, + width: selected ? 1.5 : 1, + ), + ), + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: () { + HapticFeedback.selectionClick(); + onTap(); + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 7), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (selected) ...[ + const Icon( + Icons.check, + size: 13, + color: MapPalette.textPrimary, + ), + const SizedBox(width: 4), + ], + Text( + label, + style: TextStyle( + fontSize: 12.5, + fontWeight: FontWeight.w600, + color: selected + ? MapPalette.textPrimary + : MapPalette.textSecondary, + ), + ), + ], + ), + ), + ), + ), + ); + } + + Widget _buildSearchResults( + BuildContext context, + List allContacts, + List<_GuessedLocation> guessedLocations, + ) { + final query = _searchQuery.trim().toLowerCase(); + final matches = + allContacts.where((c) => matchesContactQuery(c, query)).toList() + ..sort((a, b) { + if (a.hasLocation != b.hasLocation) { + return a.hasLocation ? -1 : 1; + } + return b.lastSeen.compareTo(a.lastSeen); + }); + final results = matches.take(8).toList(); + return Container( + margin: const EdgeInsets.only(top: 6), + constraints: const BoxConstraints(maxHeight: 300), + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 10, + offset: Offset(0, 4), + ), + ], + ), + child: results.isEmpty + ? Padding( + padding: const EdgeInsets.all(16), + child: Text( + context.l10n.map_noResults, + style: const TextStyle( + color: MapPalette.textSecondary, + fontSize: 13, + ), + ), + ) + : ListView.separated( + shrinkWrap: true, + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: results.length, + separatorBuilder: (_, _) => + const Divider(height: 1, color: MapPalette.border), + itemBuilder: (context, index) { + final c = results[index]; + final color = _getNodeColor(c.type); + return InkWell( + onTap: () => _onSearchResultTap(c, guessedLocations), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: Row( + children: [ + Icon(_getNodeIcon(c.type), size: 18, color: color), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + c.name, + style: const TextStyle( + fontSize: 13.5, + fontWeight: FontWeight.w600, + color: MapPalette.textPrimary, + ), + overflow: TextOverflow.ellipsis, + ), + Text( + c.publicKeyHex.substring(0, 12), + style: MeshTheme.mono( + fontSize: 10.5, + color: MapPalette.textSecondary, + ), + ), + ], + ), + ), + if (c.hasLocation) + Icon( + Icons.chevron_right, + size: 18, + color: MapPalette.textSecondary, + ) + else + Text( + context.l10n.map_noGps.toUpperCase(), + style: MeshTheme.accentLabel( + color: MapPalette.textMuted, + fontSize: 8.5, + ), + ), + ], + ), + ), + ); + }, + ), + ); + } + + void _onSearchResultTap( + Contact contact, + List<_GuessedLocation> guessedLocations, + ) { + if (contact.hasLocation) { + _selectNode(contact); + _mapController.move( + LatLng(contact.latitude!, contact.longitude!), + max(_zoom, 14), + ); + return; + } + _GuessedLocation? guess; + for (final g in guessedLocations) { + if (g.contact.publicKeyHex == contact.publicKeyHex) { + guess = g; + break; + } + } + if (guess != null) { + _selectNode(contact, guessedPosition: guess.position); + _mapController.move(guess.position, max(_zoom, 13)); + } else { + setState(() { + _searchQuery = ''; + _searchController.clear(); + _searchFocus.unfocus(); + }); + _showNodeInfo(context, contact); + } + } + + Widget _buildStatsCard( + BuildContext context, { + required dynamic settings, + required int visibleCount, + required int onlineCount, + required int repeaterCount, + required int hiddenCount, + required int pinCount, + required int guessedCount, + }) { + return Container( + margin: const EdgeInsets.only(top: 6), + width: 230, + padding: const EdgeInsets.fromLTRB(14, 12, 14, 12), + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 10, + offset: Offset(0, 4), + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + _statRow(context.l10n.map_visible, visibleCount, MapPalette.selected), + _statRow(context.l10n.map_online, onlineCount, MapPalette.online), + _statRow( + context.l10n.map_repeaters, + repeaterCount, + MapPalette.repeater, + ), + _statRow(context.l10n.map_hidden, hiddenCount, MapPalette.offline), + _statRow(context.l10n.map_markers, pinCount, MapPalette.shared), + const Divider(height: 16, color: MapPalette.border), + _buildLegendItem( + Icons.person, + context.l10n.map_chat, + MapPalette.selected, + ), + _buildLegendItem( + Icons.router, + context.l10n.map_repeater, + MapPalette.repeater, + ), + _buildLegendItem( + Icons.meeting_room, + context.l10n.map_room, + MapPalette.router, + ), + _buildLegendItem( + Icons.sensors, + context.l10n.map_sensor, + MapPalette.sensor, + ), + _buildLegendItem( + Icons.flag, + context.l10n.map_pinDm, + MapPalette.shared, + ), + if (settings.mapShowGuessedLocations && guessedCount > 0) + _buildLegendItem( + Icons.not_listed_location, + context.l10n.map_guessedLocation, + MapPalette.textMuted, + ), + ], + ), + ); + } + + Widget _statRow(String label, int value, Color color) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 2), + child: Row( + children: [ + Container( + width: 7, + height: 7, + decoration: BoxDecoration(shape: BoxShape.circle, color: color), + ), + const SizedBox(width: 8), + Expanded( + child: Text( + label, + style: TextStyle(fontSize: 12.5, color: MapPalette.textSecondary), + overflow: TextOverflow.ellipsis, + ), + ), + Text( + '$value', + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, + ), + ), + ], + ), + ); + } + + Widget _buildSelectedNodeCard( + BuildContext context, + Contact contact, + MeshCoreConnector connector, + ) { + final color = _markerColor(contact); + final age = _ageOf(contact); + final pos = contact.hasLocation + ? LatLng(contact.latitude!, contact.longitude!) + : _selectedGuessPos; + return Positioned( + left: 12, + right: 12, + bottom: 12, + child: TweenAnimationBuilder( + tween: Tween(begin: 1, end: 0), + duration: const Duration(milliseconds: 220), + curve: Curves.easeOutCubic, + builder: (context, t, child) => Transform.translate( + offset: Offset(0, 32 * t), + child: Opacity(opacity: 1 - t, child: child), + ), + child: MeshCard( + margin: EdgeInsets.zero, + padding: const EdgeInsets.fromLTRB(14, 12, 8, 12), + color: MapPalette.panelDark, + borderColor: MapPalette.border, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AvatarCircle( + name: contact.name, + size: 38, + color: color, + icon: _getNodeIcon(contact.type), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Flexible( + child: Text( + contact.name, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w700, + color: MapPalette.textPrimary, + ), + overflow: TextOverflow.ellipsis, + ), + ), + if (contact.isFavorite) ...[ + const SizedBox(width: 4), + const Icon( + Icons.star, + size: 14, + color: MapPalette.stale, + ), + ], + ], + ), + const SizedBox(height: 3), + Row( + children: [ + StatusChip( + label: _ageLabel(age), + color: _ageColor(age), + fontSize: 9.5, + pulse: age == _NodeAge.online, + ), + const SizedBox(width: 6), + Flexible( + child: Text( + contact.typeLabel(context.l10n), + style: const TextStyle( + fontSize: 11.5, + color: MapPalette.textSecondary, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ], + ), + ), + if (pos != null) + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.center_focus_strong, size: 20), + tooltip: context.l10n.map_centerOnNode, + onPressed: () => _mapController.move(pos, max(_zoom, 15)), + ), + IconButton( + color: MapPalette.textPrimary, + icon: const Icon(Icons.close, size: 20), + onPressed: _clearSelection, + ), + ], + ), + const SizedBox(height: 8), + Wrap( + spacing: 14, + runSpacing: 4, + children: [ + _miniMeta( + context.l10n.map_lastSeen, + _formatLastSeen(contact.lastSeen), + ), + _miniMeta( + context.l10n.map_path, + contact.pathLabel(context.l10n), + ), + _miniMeta('ID', contact.publicKeyHex.substring(0, 12)), + if (pos != null) + _miniMeta( + context.l10n.map_location, + '${contact.hasLocation ? '' : '~'}${pos.latitude.toStringAsFixed(5)}, ${pos.longitude.toStringAsFixed(5)}', + ), + ], + ), + const SizedBox(height: 10), + Row( + children: [ + ..._selectedNodeActions(context, contact, connector), + TextButton( + style: TextButton.styleFrom( + foregroundColor: MapPalette.selected, + ), + onPressed: () => _showNodeInfo( + context, + contact, + guessedPosition: contact.hasLocation + ? null + : _selectedGuessPos, + ), + child: Text(context.l10n.map_details), + ), + ], + ), + ], + ), + ), + ), + ); + } + + Widget _miniMeta(String label, String value) { + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + label.toUpperCase(), + style: MeshTheme.accentLabel( + color: MapPalette.textMuted, + fontSize: 8, + ), + ), + const SizedBox(height: 1), + Text( + value, + style: MeshTheme.mono(fontSize: 11.5, color: MapPalette.textPrimary), + ), + ], + ); + } + + List _selectedNodeActions( + BuildContext context, + Contact contact, + MeshCoreConnector connector, + ) { + Widget action(String label, IconData icon, VoidCallback onPressed) { + return Padding( + padding: const EdgeInsets.only(right: 8), + child: FilledButton.icon( + style: FilledButton.styleFrom( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), + visualDensity: VisualDensity.compact, + ), + onPressed: onPressed, + icon: Icon(icon, size: 16), + label: Text(label, style: const TextStyle(fontSize: 12.5)), + ), + ); + } + + switch (contact.type) { + case advTypeChat: + return [ + action(context.l10n.contacts_openChat, Icons.chat_bubble_outline, () { + if (!contact.isActive) { + connector.importDiscoveredContact(contact); + } + final unread = connector.getUnreadCountForContactKey( + contact.publicKeyHex, + ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ChatScreen(contact: contact, initialUnreadCount: unread), + ), + ); + }), + ]; + case advTypeRepeater: + return [ + action(context.l10n.map_manageRepeater, Icons.cell_tower, () { + if (!contact.isActive) { + connector.importDiscoveredContact(contact); + } + _showRepeaterLogin(context, contact); + }), + ]; + case advTypeRoom: + return [ + action(context.l10n.map_joinRoom, Icons.meeting_room, () { + if (!contact.isActive) { + connector.importDiscoveredContact(contact); + } + _showRoomLogin(context, contact); + }), + ]; + default: + return const []; + } + } + List<_SharedMarker> _collectSharedMarkers(MeshCoreConnector connector) { // Build a _SharedMarker per message (history empty), grouped by dedupe key. // Afterwards pick the latest per key and fill its history from older ones. @@ -1468,8 +2468,8 @@ class _MapScreenState extends State { Marker _buildSharedMarker(_SharedMarker marker) { final markerColor = marker.isChannel - ? (marker.isPublicChannel ? Colors.orange : Colors.purple) - : Colors.blue; + ? (marker.isPublicChannel ? MapPalette.cluster : MapPalette.router) + : MapPalette.shared; return Marker( point: marker.position, width: 60, @@ -1487,20 +2487,22 @@ class _MapScreenState extends State { child: Column( children: [ Container( - padding: const EdgeInsets.all(6), + width: 36, + height: 36, decoration: BoxDecoration( - color: markerColor, shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), - boxShadow: [ + color: markerColor, + border: Border.all(color: MapPalette.markerOutline, width: 2.5), + boxShadow: const [ BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + color: MapPalette.markerShadow, + blurRadius: 8, + offset: Offset(0, 3), ), ], ), - child: const Icon(Icons.flag, color: Colors.white, size: 20), + alignment: Alignment.center, + child: const Icon(Icons.flag, color: Colors.white, size: 19), ), ], ), @@ -1560,9 +2562,8 @@ class _MapScreenState extends State { LatLng? guessedPosition, }) { final connector = context.read(); - showModalBottomSheet( - context: context, - showDragHandle: true, + showMeshSheet( + context, builder: (sheetContext) { final actions = []; if (contact.type == advTypeChat) { @@ -1619,58 +2620,53 @@ class _MapScreenState extends State { ); } return SafeArea( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetHeader( + title: contact.name, + subtitle: contact.typeLabel(context.l10n), + trailing: Icon( + _getNodeIcon(contact.type), + color: _getNodeColor(contact.type), + size: 20, + ), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - _getNodeIcon(contact.type), - color: _getNodeColor(contact.type), + _buildInfoRow( + context.l10n.map_path, + contact.pathLabel(context.l10n), ), - const SizedBox(width: 8), - Expanded(child: SelectableText(contact.name)), + if (contact.hasLocation) + _buildInfoRow( + context.l10n.map_location, + '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', + ) + else if (guessedPosition != null) + _buildInfoRow( + context.l10n.map_estLocation, + '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', + ), + _buildInfoRow( + context.l10n.map_lastSeen, + _formatLastSeen(contact.lastSeen), + ), + _buildInfoRow( + context.l10n.map_publicKey, + contact.publicKeyHex, + ), + const SizedBox(height: 16), + ...actions, ], ), - const SizedBox(height: 8), - _buildInfoRow( - context.l10n.map_type, - contact.typeLabel(context.l10n), - ), - _buildInfoRow( - context.l10n.map_path, - contact.pathLabel(context.l10n), - ), - if (contact.hasLocation) - _buildInfoRow( - context.l10n.map_location, - '${contact.latitude!.toStringAsFixed(6)}, ${contact.longitude!.toStringAsFixed(6)}', - ) - else if (guessedPosition != null) - _buildInfoRow( - context.l10n.map_estLocation, - '~${guessedPosition.latitude.toStringAsFixed(6)}, ${guessedPosition.longitude.toStringAsFixed(6)}', - ), - _buildInfoRow( - context.l10n.map_lastSeen, - _formatLastSeen(contact.lastSeen), - ), - _buildInfoRow( - context.l10n.map_publicKey, - contact.publicKeyHex, - ), - const SizedBox(height: 16), - ...actions, - TextButton( - onPressed: () => Navigator.pop(sheetContext), - child: Text(context.l10n.common_close), - ), - ], - ), + ), + ], ), ), ); @@ -1798,7 +2794,13 @@ class _MapScreenState extends State { ), ), const SizedBox(height: 2), - SelectableText(value, style: const TextStyle(fontSize: 14)), + SelectableText( + value, + style: MeshTheme.mono( + fontSize: 13, + color: Theme.of(context).colorScheme.onSurface, + ), + ), ], ), ); @@ -2057,7 +3059,9 @@ class _MapScreenState extends State { return ListTile( leading: Icon( isPublic ? Icons.public : Icons.tag, - color: isPublic ? Colors.orange : Colors.blue, + color: isPublic + ? MapPalette.cluster + : MapPalette.repeater, ), title: Text(label), onTap: () async { @@ -2115,164 +3119,205 @@ class _MapScreenState extends State { return result ?? false; } - void _showFilterDialog( + void _showFilterSheet( BuildContext context, AppSettingsService settingsService, ) { - showDialog( - context: context, - builder: (dialogContext) => AlertDialog( - title: Text(context.l10n.map_filterNodes), - contentPadding: const EdgeInsets.fromLTRB(24, 20, 24, 0), - content: SingleChildScrollView( - child: Consumer( + showMeshSheet( + context, + builder: (sheetContext) => StatefulBuilder( + builder: (sheetContext, setSheetState) { + return Consumer( builder: (consumerContext, service, child) { final settings = service.settings; - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - context.l10n.map_nodeTypes, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(height: 8), - CheckboxListTile( - title: Text(context.l10n.map_chatNodes), - value: settings.mapShowChatNodes, - onChanged: (value) { - service.setMapShowChatNodes(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_repeaters), - value: settings.mapShowRepeaters, - onChanged: (value) { - service.setMapShowRepeaters(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_otherNodes), - value: settings.mapShowOtherNodes, - onChanged: (value) { - service.setMapShowOtherNodes(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_showGuessedLocations), - value: settings.mapShowGuessedLocations, - onChanged: (value) { - service.setMapShowGuessedLocations(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_showDiscoveryContacts), - value: settings.mapShowDiscoveryContacts, - onChanged: (value) { - service.setMapShowDiscoveryContacts(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - CheckboxListTile( - title: Text(context.l10n.map_showOverlaps), - value: settings.mapShowOverlaps, - onChanged: (value) { - service.setMapShowOverlaps(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), + final scheme = Theme.of(sheetContext).colorScheme; - const SizedBox(height: 16), - Text( - context.l10n.map_keyPrefix, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, + Widget freshnessChip(_Freshness value, String label) { + final selected = _freshness == value; + final accent = switch (value) { + _Freshness.all => MapPalette.selected, + _Freshness.online => MapPalette.online, + _Freshness.recent => MapPalette.stale, + _Freshness.stale => MapPalette.offline, + }; + return FilterChip( + label: Text(label), + selected: selected, + showCheckmark: true, + checkmarkColor: accent, + backgroundColor: scheme.surfaceContainerLow, + selectedColor: Color.alphaBlend( + accent.withValues(alpha: 0.22), + scheme.surfaceContainerHigh, + ), + side: BorderSide( + color: selected ? accent : scheme.outline, + width: selected ? 1.5 : 1, + ), + labelStyle: TextStyle( + color: selected + ? scheme.onSurface + : scheme.onSurfaceVariant, + fontWeight: selected ? FontWeight.w700 : FontWeight.w600, + ), + onSelected: (_) { + setSheetState(() {}); + setState(() => _freshness = value); + }, + ); + } + + return SafeArea( + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.sizeOf(sheetContext).height * 0.8, + ), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetHeader( + title: sheetContext.l10n.map_filterNodes, + ), + SectionHeader(sheetContext.l10n.map_activity), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Wrap( + spacing: 8, + runSpacing: 4, + children: [ + freshnessChip( + _Freshness.all, + sheetContext.l10n.time_allTime, + ), + freshnessChip( + _Freshness.online, + sheetContext.l10n.map_online, + ), + freshnessChip( + _Freshness.recent, + sheetContext.l10n.map_recent, + ), + freshnessChip( + _Freshness.stale, + sheetContext.l10n.map_stale, + ), + ], + ), + ), + SectionHeader( + sheetContext.l10n.map_lastSeenTime, + trailing: Text( + _getTimeFilterLabel(settings.mapTimeFilterHours), + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: Slider( + value: _hoursToSliderValue( + settings.mapTimeFilterHours, + ), + min: 0, + max: 100, + divisions: 100, + onChanged: (value) { + final hours = _sliderValueToHours(value); + service.setMapTimeFilterHours(hours); + }, + ), + ), + SectionHeader(sheetContext.l10n.map_nodeTypes), + SwitchListTile( + title: Text(sheetContext.l10n.map_chatNodes), + value: settings.mapShowChatNodes, + dense: true, + onChanged: (value) => + service.setMapShowChatNodes(value), + ), + SwitchListTile( + title: Text(sheetContext.l10n.map_repeaters), + value: settings.mapShowRepeaters, + dense: true, + onChanged: (value) => + service.setMapShowRepeaters(value), + ), + SwitchListTile( + title: Text(sheetContext.l10n.map_otherNodes), + value: settings.mapShowOtherNodes, + dense: true, + onChanged: (value) => + service.setMapShowOtherNodes(value), + ), + SectionHeader(sheetContext.l10n.map_markers), + SwitchListTile( + title: Text(sheetContext.l10n.map_showSharedMarkers), + value: settings.mapShowMarkers, + dense: true, + onChanged: (value) => + service.setMapShowMarkers(value), + ), + SwitchListTile( + title: Text( + sheetContext.l10n.map_showGuessedLocations, + ), + value: settings.mapShowGuessedLocations, + dense: true, + onChanged: (value) => + service.setMapShowGuessedLocations(value), + ), + SwitchListTile( + title: Text( + sheetContext.l10n.map_showDiscoveryContacts, + ), + value: settings.mapShowDiscoveryContacts, + dense: true, + onChanged: (value) => + service.setMapShowDiscoveryContacts(value), + ), + SwitchListTile( + title: Text(sheetContext.l10n.map_showOverlaps), + value: settings.mapShowOverlaps, + dense: true, + onChanged: (value) => + service.setMapShowOverlaps(value), + ), + SectionHeader(sheetContext.l10n.map_keyPrefix), + SwitchListTile( + title: Text(sheetContext.l10n.map_filterByKeyPrefix), + value: settings.mapKeyPrefixEnabled, + dense: true, + onChanged: (value) => + service.setMapKeyPrefixEnabled(value), + ), + Padding( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 20), + child: TextFormField( + initialValue: settings.mapKeyPrefix, + enabled: settings.mapKeyPrefixEnabled, + decoration: InputDecoration( + labelText: sheetContext.l10n.map_publicKeyPrefix, + hintText: + sheetContext.l10n.map_publicKeyPrefixHint, + isDense: true, + ), + style: MeshTheme.mono(fontSize: 13), + onChanged: (value) => + service.setMapKeyPrefix(value), + ), + ), + ], ), ), - const SizedBox(height: 8), - CheckboxListTile( - title: Text(context.l10n.map_filterByKeyPrefix), - value: settings.mapKeyPrefixEnabled, - onChanged: (value) { - service.setMapKeyPrefixEnabled(value ?? false); - }, - contentPadding: EdgeInsets.zero, - ), - TextFormField( - initialValue: settings.mapKeyPrefix, - enabled: settings.mapKeyPrefixEnabled, - decoration: InputDecoration( - labelText: context.l10n.map_publicKeyPrefix, - hintText: context.l10n.map_publicKeyPrefixHint, - border: const OutlineInputBorder(), - isDense: true, - ), - onChanged: (value) { - service.setMapKeyPrefix(value); - }, - ), - const SizedBox(height: 16), - Text( - context.l10n.map_markers, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(height: 8), - CheckboxListTile( - title: Text(context.l10n.map_showSharedMarkers), - value: settings.mapShowMarkers, - onChanged: (value) { - service.setMapShowMarkers(value ?? true); - }, - contentPadding: EdgeInsets.zero, - ), - const SizedBox(height: 16), - Text( - context.l10n.map_lastSeenTime, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 16, - ), - ), - const SizedBox(height: 8), - Text( - _getTimeFilterLabel(settings.mapTimeFilterHours), - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - Slider( - value: _hoursToSliderValue(settings.mapTimeFilterHours), - min: 0, - max: 100, - divisions: 100, - onChanged: (value) { - final hours = _sliderValueToHours(value); - service.setMapTimeFilterHours(hours); - }, - ), - ], + ), ); }, - ), - ), - actions: [ - TextButton( - onPressed: () => Navigator.pop(dialogContext), - child: Text(context.l10n.common_close), - ), - ], + ); + }, ), ); } @@ -2385,110 +3430,129 @@ class _MapScreenState extends State { top: 16, left: 16, right: 16, - child: Card( - child: Padding( - padding: const EdgeInsets.all(12.0), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - l10n.contacts_pathTrace, - style: TextStyle(fontWeight: FontWeight.bold), - ), - if (_pathTrace.isEmpty) const SizedBox(height: 8), - if (_pathTrace.isEmpty) - Text(l10n.map_tapToAdd, style: TextStyle(fontSize: 12)), - const SizedBox(height: 6), - if (_pathTrace.isNotEmpty) + child: DecoratedBox( + decoration: BoxDecoration( + color: MapPalette.panelDark, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MapPalette.border), + boxShadow: const [ + BoxShadow( + color: MapPalette.markerShadow, + blurRadius: 10, + offset: Offset(0, 4), + ), + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ Text( - "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", - style: TextStyle( - fontSize: 12, - color: Theme.of(context).colorScheme.onSurfaceVariant, + l10n.contacts_pathTrace, + style: TextStyle(fontWeight: FontWeight.bold), + ), + if (_pathTrace.isEmpty) const SizedBox(height: 8), + if (_pathTrace.isEmpty) + Text(l10n.map_tapToAdd, style: TextStyle(fontSize: 12)), + const SizedBox(height: 6), + if (_pathTrace.isNotEmpty) + Text( + "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", + style: MeshTheme.mono( + fontSize: 12, + color: MapPalette.textSecondary, + ), + ), + SelectableText( + _pathTrace + .map((b) => b.toRadixString(16).padLeft(2, '0')) + .join(','), + style: MeshTheme.mono( + fontSize: 18, + fontWeight: FontWeight.w700, + color: MapPalette.selected, ), ), - SelectableText( - _pathTrace - .map((b) => b.toRadixString(16).padLeft(2, '0')) - .join(','), - style: TextStyle(fontSize: 18), - ), - // const SizedBox(height: 6), - Wrap( - alignment: WrapAlignment.center, - spacing: 1, - runSpacing: 1, - children: [ - if (_pathTrace.isNotEmpty) - IconButton( - onPressed: () { - final hashW = context - .read() - .pathHashByteWidth; - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: l10n.contacts_pathTrace, - path: Uint8List.fromList(_pathTrace), - pathHashByteWidth: hashW, - pathContacts: _pathTraceContacts, + // const SizedBox(height: 6), + Wrap( + alignment: WrapAlignment.center, + spacing: 1, + runSpacing: 1, + children: [ + if (_pathTrace.isNotEmpty) + IconButton( + onPressed: () { + final hashW = context + .read() + .pathHashByteWidth; + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PathTraceMapScreen( + title: l10n.contacts_pathTrace, + path: Uint8List.fromList(_pathTrace), + pathHashByteWidth: hashW, + pathContacts: _pathTraceContacts, + ), ), - ), - ); - setState(() { - _isBuildingPathTrace = false; - }); - }, - tooltip: l10n.map_runTrace, - icon: const Icon(Icons.arrow_forward_outlined), - ), - if (_pathTrace.isNotEmpty) - IconButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PathTraceMapScreen( - title: l10n.contacts_pathTrace, - path: Uint8List.fromList(_pathTrace), - flipPathAround: true, + ); + setState(() { + _isBuildingPathTrace = false; + }); + }, + tooltip: l10n.map_runTrace, + icon: const Icon(Icons.arrow_forward_outlined), + ), + if (_pathTrace.isNotEmpty) + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PathTraceMapScreen( + title: l10n.contacts_pathTrace, + path: Uint8List.fromList(_pathTrace), + flipPathAround: true, + ), ), - ), - ); - setState(() { - _isBuildingPathTrace = false; - }); - }, - tooltip: l10n.map_runTraceWithReturnPath, - icon: const Icon(Icons.replay), - ), - if (_pathTrace.isNotEmpty) - IconButton( - onPressed: _removePath, - tooltip: l10n.map_removeLast, - icon: const Icon(Icons.undo), - ), - if (_pathTrace.isEmpty) - IconButton( - onPressed: () { - setState(() { - _isBuildingPathTrace = false; - _pathTrace.clear(); - _points.clear(); - _polylines.clear(); - }); - showDismissibleSnackBar( - context, - content: Text(l10n.map_pathTraceCancelled), - ); - }, - tooltip: l10n.common_cancel, - icon: const Icon(Icons.close), - ), - ], - ), - ], + ); + setState(() { + _isBuildingPathTrace = false; + }); + }, + tooltip: l10n.map_runTraceWithReturnPath, + icon: const Icon(Icons.replay), + ), + if (_pathTrace.isNotEmpty) + IconButton( + onPressed: _removePath, + tooltip: l10n.map_removeLast, + icon: const Icon(Icons.undo), + ), + if (_pathTrace.isEmpty) + IconButton( + onPressed: () { + setState(() { + _isBuildingPathTrace = false; + _pathTrace.clear(); + _points.clear(); + _polylines.clear(); + }); + showDismissibleSnackBar( + context, + content: Text(l10n.map_pathTraceCancelled), + ); + }, + tooltip: l10n.common_cancel, + icon: const Icon(Icons.close), + ), + ], + ), + ], + ), ), ), ), @@ -2496,6 +3560,10 @@ class _MapScreenState extends State { } } +enum _NodeAge { online, recent, stale } + +enum _Freshness { all, online, recent, stale } + class _GuessedLocation { final Contact contact; final LatLng position; diff --git a/lib/screens/neighbors_screen.dart b/lib/screens/neighbors_screen.dart index c34af7f1..d043fbfe 100644 --- a/lib/screens/neighbors_screen.dart +++ b/lib/screens/neighbors_screen.dart @@ -9,9 +9,10 @@ import '../models/path_selection.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/repeater_command_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/routing_sheet.dart'; -import '../widgets/snr_indicator.dart'; import '../helpers/snack_bar_builder.dart'; class NeighborsScreen extends StatefulWidget { @@ -321,7 +322,7 @@ class _NeighborsScreenState extends State { child: RefreshIndicator( onRefresh: _loadNeighbors, child: ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.fromLTRB(16, 8, 16, 24), children: [ if (!_isLoaded && !_hasData && @@ -330,9 +331,7 @@ class _NeighborsScreenState extends State { if (_isLoaded || _hasData && !(_parsedNeighbors == null || _parsedNeighbors!.isEmpty)) - _buildNeighborsInfoCard( - "${l10n.repeater_neighbors} - $_neighborCount", - ), + _buildNeighborsList(connector), ], ), ), @@ -340,81 +339,100 @@ class _NeighborsScreenState extends State { ); } - Widget _buildNeighborsInfoCard(String title) { - final connector = Provider.of(context, listen: false); - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( + Widget _buildNeighborsList(MeshCoreConnector connector) { + final l10n = context.l10n; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader( + '${l10n.repeater_neighbors} — $_neighborCount', + padding: const EdgeInsets.fromLTRB(4, 8, 4, 10), + ), + for (var i = 0; i < _parsedNeighbors!.length; i++) + ListEntrance( + index: i, + child: _buildNeighborRow( + _parsedNeighbors![i], + connector.currentSf, + ), + ), + ], + ); + } + + Widget _buildNeighborRow(Map data, int? spreadingFactor) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + final Contact? contact = data['contact'] as Contact?; + final double snr = data['snr'] as double; + final int lastHeardSeconds = data['lastHeard'] as int; + + final name = contact != null + ? contact.name + : l10n.neighbors_unknownContact( + '<${pubKeyToHex(data['publicKey'] as Uint8List)}>', + ); + + final snrColor = MeshTheme.snrColor(snr, blocked: false); + final heardLabel = l10n.neighbors_heardAgo( + fmtDuration(lastHeardSeconds + 0.0), + ); + + return MeshCard( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + margin: const EdgeInsets.symmetric(vertical: 4), + child: Row( + children: [ + AvatarCircle( + name: name, + size: 40, + color: contact != null ? MeshPalette.warn : scheme.onSurfaceVariant, + icon: contact != null ? Icons.cell_tower : Icons.device_unknown, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), Text( - title, + name, + maxLines: 1, + overflow: TextOverflow.ellipsis, style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w500, + fontSize: 15, + ), + ), + const SizedBox(height: 2), + Text( + heardLabel, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), ), ], ), - const Divider(), - for (final entry in _parsedNeighbors!.asMap().entries) - _buildInfoRow( - entry.value['contact'] != null - ? entry.value['contact'].name - : context.l10n.neighbors_unknownContact( - "<${pubKeyToHex(entry.value['publicKey'])}>", - ), - context.l10n.neighbors_heardAgo( - fmtDuration(entry.value['lastHeard'] + 0.0), + ), + const SizedBox(width: 10), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisSize: MainAxisSize.min, + children: [ + SignalBars(snr: snr, height: 16), + const SizedBox(height: 4), + Text( + '${snr.toStringAsFixed(1)} dB', + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w600, + color: snrColor, ), - entry.value['snr'], - connector.currentSf, ), - ], - ), - ), - ); - } - - Widget _buildInfoRow( - String label, - String value, - double snr, - int? spreadingFactor, - ) { - final snrUi = snrUiFromSNR(snr, spreadingFactor); - return Padding( - padding: const EdgeInsets.symmetric(vertical: 3), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - label, - style: const TextStyle(fontWeight: FontWeight.w500), - ), - subtitle: Text(value), - trailing: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(snrUi.icon, color: snrUi.color, size: 18.0), - Text( - snrUi.text, - style: TextStyle(fontSize: 10, color: snrUi.color), - ), - ], - ), - ), + ], ), ], ), diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index 99bc4deb..d955b30b 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -10,31 +10,21 @@ import 'package:meshcore_open/connector/meshcore_protocol.dart'; import 'package:meshcore_open/l10n/l10n.dart'; import 'package:meshcore_open/models/app_settings.dart'; import 'package:meshcore_open/models/contact.dart'; +import 'package:meshcore_open/models/display_path.dart'; +import 'package:meshcore_open/models/path_history.dart'; +import 'package:meshcore_open/models/path_playback.dart'; import 'package:meshcore_open/services/app_settings_service.dart'; import 'package:meshcore_open/services/map_tile_cache_service.dart'; +import 'package:meshcore_open/services/path_history_service.dart'; import 'package:meshcore_open/utils/app_logger.dart'; +import 'package:meshcore_open/widgets/path_map_ui.dart'; import 'package:meshcore_open/widgets/snr_indicator.dart'; +import 'package:meshcore_open/widgets/themed_map_tile_layer.dart'; import 'package:provider/provider.dart'; +import '../theme/mesh_theme.dart'; -double getPathDistanceMeters(List points) { - if (points.length <= 1) return 0.0; - - double distanceMeters = 0.0; - final distanceCalculator = Distance(); - - for (int i = 0; i < points.length - 1; i++) { - distanceMeters += distanceCalculator(points[i], points[i + 1]); - } - - return distanceMeters; -} - -String formatDistance(double distanceMeters, {required bool isImperial}) { - if (isImperial) { - return '(${(distanceMeters / 1609.34).toStringAsFixed(2)} mi)'; - } - return '(${(distanceMeters / 1000).toStringAsFixed(2)} km)'; -} +export 'package:meshcore_open/widgets/path_map_ui.dart' + show formatDistance, getPathDistanceMeters; class PathTraceData { final Uint8List pathData; @@ -74,7 +64,8 @@ class PathTraceMapScreen extends StatefulWidget { State createState() => _PathTraceMapScreenState(); } -class _PathTraceMapScreenState extends State { +class _PathTraceMapScreenState extends State + with SingleTickerProviderStateMixin { static const double _labelZoomThreshold = 8.5; static const double _mapMinZoom = 2.0; static const double _mapMaxZoom = 18.0; @@ -107,6 +98,18 @@ class _PathTraceMapScreenState extends State { // endpoint inference so it matches the path that was actually traced. Uint8List _tracedPath = Uint8List(0); + // Packet-flow animation + multi-path view state. + late final PathPlaybackController _playback; + PathHistoryService? _pathHistory; + PathViewMode _viewMode = PathViewMode.single; + List _displayPaths = []; + List _primaryOutboundHops = []; + String _selectedPathId = 'primary'; + final Set _hiddenPathIds = {}; + bool _panelCollapsed = false; + bool _animationEnabled = true; + bool _followPacket = false; + String _formatPathPrefixes(Uint8List pathBytes) { return pathBytes .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) @@ -116,18 +119,51 @@ class _PathTraceMapScreenState extends State { @override void initState() { super.initState(); + _playback = PathPlaybackController(this); + _playback.addListener(_followPacketCamera); + _pathHistory = context.read(); + _pathHistory!.addListener(_onPathHistoryChanged); _setupFrameListener(); _doPathTrace(); } @override void dispose() { + _pathHistory?.removeListener(_onPathHistoryChanged); + _playback.dispose(); _mapController.dispose(); _frameSubscription?.cancel(); _timeoutTimer?.cancel(); super.dispose(); } + void _onPathHistoryChanged() { + if (!mounted || !_hasData) return; + setState(() { + _rebuildDisplayPaths(context.read()); + }); + } + + /// Keeps the camera centered on the packet while the follow lock is on. + void _followPacketCamera() { + if (!_followPacket || + !_animationEnabled || + !_playback.started || + !_playback.hasPath || + !mounted || + !_hasData) { + return; + } + _mapController.move(_playback.position, _mapController.camera.zoom); + } + + void _toggleFollowPacket() { + setState(() { + _followPacket = !_followPacket; + }); + _followPacketCamera(); + } + bool _isDesktopPlatform(TargetPlatform platform) { return platform == TargetPlatform.linux || platform == TargetPlatform.windows || @@ -164,27 +200,34 @@ class _PathTraceMapScreenState extends State { return Positioned( top: 16, left: 16, - child: Card( - elevation: 4, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - IconButton( - icon: const Icon(Icons.add), - tooltip: context.l10n.map_zoomIn, - onPressed: () => _zoomMapBy(1), - ), - IconButton( - icon: const Icon(Icons.remove), - tooltip: context.l10n.map_zoomOut, - onPressed: () => _zoomMapBy(-1), - ), - IconButton( - icon: const Icon(Icons.my_location), - tooltip: context.l10n.map_centerMap, - onPressed: _resetMapView, - ), - ], + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.90), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + IconButton( + icon: const Icon(Icons.add), + tooltip: context.l10n.map_zoomIn, + onPressed: () => _zoomMapBy(1), + ), + IconButton( + icon: const Icon(Icons.remove), + tooltip: context.l10n.map_zoomOut, + onPressed: () => _zoomMapBy(-1), + ), + IconButton( + icon: const Icon(Icons.my_location), + tooltip: context.l10n.map_centerMap, + onPressed: _resetMapView, + ), + ], + ), ), ), ); @@ -249,6 +292,7 @@ class _PathTraceMapScreenState extends State { } Future _doPathTrace() async { + _playback.stop(); if (mounted) { setState(() { _isLoading = true; @@ -542,6 +586,8 @@ class _PathTraceMapScreenState extends State { '${context.l10n.pathTrace_you},${_formatPathPrefixes(_traceData!.pathData)}', ); _pathDistanceMeters = getPathDistanceMeters(_points); + _primaryOutboundHops = _outboundHops(pathData); + _rebuildDisplayPaths(connector); }); } catch (e) { appLogger.error( @@ -557,6 +603,252 @@ class _PathTraceMapScreenState extends State { } } + /// Outbound hop bytes of the traced path, mirroring the round-trip + /// dedup logic used when building [_points]. + List _outboundHops(Uint8List pathData) { + final hops = []; + int hopLast = 0; + int hopLastLast = 0; + for (final hop in pathData) { + if (hop == hopLastLast && widget.flipPathAround) break; + hops.add(hop); + hopLastLast = hopLast; + hopLast = hop; + } + return hops; + } + + Contact? _contactForHop(int hop, MeshCoreConnector connector) { + final traced = _traceData?.pathContacts[hop]; + if (traced != null) return traced; + for (final c in connector.allContactsUnfiltered) { + if (c.type != advTypeChat && + c.publicKey.isNotEmpty && + c.publicKey[0] == hop) { + return c; + } + } + return null; + } + + LatLng? _inferredPositionForHop(int hop, MeshCoreConnector connector) { + final cached = _inferredHopPositions[hop]; + if (cached != null) return cached; + final peers = connector.contacts + .where((c) => c.hasLocation && c.path.isNotEmpty && c.path.last == hop) + .toList(); + if (peers.isEmpty) return null; + final lat = + peers.map((c) => c.latitude!).reduce((a, b) => a + b) / peers.length; + final lon = + peers.map((c) => c.longitude!).reduce((a, b) => a + b) / peers.length; + final pos = LatLng(lat, lon); + _inferredHopPositions[hop] = pos; + return pos; + } + + /// Rebuilds the renderable paths: the traced path as primary plus up to + /// four distinct alternates from the target contact's path history. + void _rebuildDisplayPaths(MeshCoreConnector connector) { + final paths = []; + final primary = _buildDisplayPath( + id: 'primary', + label: context.l10n.pathMap_primary, + color: kPrimaryPathColor, + isPrimary: true, + hops: _primaryOutboundHops, + connector: connector, + ); + if (primary != null) paths.add(primary); + + final target = widget.targetContact; + final history = _pathHistory; + if (target != null && history != null) { + final seen = {_primaryOutboundHops.join(',')}; + var altIndex = 0; + for (final record in history.getRecentPaths(target.publicKeyHex)) { + if (record.pathBytes.isEmpty) continue; + if (!seen.add(record.pathBytes.join(','))) continue; + if (altIndex >= kAlternatePathColors.length) break; + final alt = _buildDisplayPath( + id: 'alt-${record.pathBytes.join('-')}', + label: context.l10n.pathMap_alternate(altIndex + 1), + color: kAlternatePathColors[altIndex], + isPrimary: false, + hops: record.pathBytes, + record: record, + connector: connector, + ); + if (alt != null) { + paths.add(alt); + altIndex++; + } + } + } + + _displayPaths = paths; + _hiddenPathIds.removeWhere((id) => !paths.any((p) => p.id == id)); + if (!paths.any((p) => p.id == _selectedPathId)) { + _selectedPathId = paths.isNotEmpty ? paths.first.id : 'primary'; + } + if (paths.length < 2) _viewMode = PathViewMode.single; + _syncPlaybackToSelection(); + } + + DisplayPath? _buildDisplayPath({ + required String id, + required String label, + required Color color, + required bool isPrimary, + required List hops, + required MeshCoreConnector connector, + PathRecord? record, + }) { + final selfLat = connector.selfLatitude; + final selfLon = connector.selfLongitude; + if (selfLat == null || selfLon == null) return null; + + final points = [LatLng(selfLat, selfLon)]; + final labels = [context.l10n.pathTrace_you]; + final confirmed = [true]; + final hopOrdinals = [-1]; + final gapBefore = [false]; + int gpsConfirmedHops = 0; + int unresolvedHops = 0; + bool pendingGap = false; + + for (var i = 0; i < hops.length; i++) { + final hop = hops[i]; + final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final contact = _contactForHop(hop, connector); + LatLng? pos; + var isGps = false; + if (contact != null && contact.hasLocation) { + pos = LatLng(contact.latitude!, contact.longitude!); + isGps = true; + gpsConfirmedHops++; + } else { + pos = _inferredPositionForHop(hop, connector); + } + if (pos == null) { + unresolvedHops++; + pendingGap = true; + continue; + } + points.add(pos); + labels.add(contact?.name ?? '~$hex'); + confirmed.add(isGps); + hopOrdinals.add(i); + gapBefore.add(pendingGap); + pendingGap = false; + } + + // Append the chat-target endpoint the same way the traced path does. + final target = widget.targetContact; + final targetPos = _targetContactPosition; + final hasTargetEndpoint = + target != null && target.type == advTypeChat && targetPos != null; + if (hasTargetEndpoint) { + points.add(targetPos); + labels.add(target.name); + confirmed.add(!_targetContactIsGuessed); + hopOrdinals.add(hops.length); + gapBefore.add(pendingGap); + pendingGap = false; + } + + if (points.length < 2) return null; + + final segmentEstimated = []; + final rowForSegment = []; + for (var i = 0; i < points.length - 1; i++) { + segmentEstimated.add( + !confirmed[i] || !confirmed[i + 1] || gapBefore[i + 1], + ); + rowForSegment.add(hopOrdinals[i + 1] < 0 ? 0 : hopOrdinals[i + 1]); + } + + return DisplayPath( + id: id, + label: label, + color: color, + isPrimary: isPrimary, + hopBytes: List.from(hops), + points: points, + pointLabels: labels, + pointConfirmed: confirmed, + segmentEstimated: segmentEstimated, + rowForSegment: rowForSegment, + totalTransmissions: hops.length + (hasTargetEndpoint ? 1 : 0), + hasTargetEndpoint: hasTargetEndpoint, + gpsConfirmedHops: gpsConfirmedHops, + unresolvedHops: unresolvedHops, + distanceMeters: getPathDistanceMeters(points), + record: record, + ); + } + + DisplayPath? get _selectedPath { + if (_displayPaths.isEmpty) return null; + return _displayPaths.firstWhere( + (p) => p.id == _selectedPathId, + orElse: () => _displayPaths.first, + ); + } + + List get _visiblePaths { + if (_viewMode == PathViewMode.single) { + final selected = _selectedPath; + return selected != null ? [selected] : const []; + } + return _displayPaths + .where((p) => !_hiddenPathIds.contains(p.id)) + .toList(); + } + + /// Updates the playback path, but only when the selected path's geometry + /// actually changed, so unrelated path-history updates don't reset a + /// running animation. + void _syncPlaybackToSelection() { + final points = _selectedPath?.points ?? const []; + if (points.length == _playback.points.length) { + var same = true; + for (var i = 0; i < points.length; i++) { + if (points[i] != _playback.points[i]) { + same = false; + break; + } + } + if (same) return; + } + _playback.setPath(points); + } + + void _selectPath(DisplayPath path) { + setState(() { + _selectedPathId = path.id; + _hiddenPathIds.remove(path.id); + _syncPlaybackToSelection(); + }); + } + + void _togglePathVisibility(DisplayPath path) { + setState(() { + if (!_hiddenPathIds.remove(path.id)) { + _hiddenPathIds.add(path.id); + if (path.id == _selectedPathId) { + final visible = _displayPaths.where( + (p) => !_hiddenPathIds.contains(p.id), + ); + if (visible.isNotEmpty) { + _selectedPathId = visible.first.id; + _syncPlaybackToSelection(); + } + } + } + }); + } + @override Widget build(BuildContext context) { return Consumer( @@ -564,23 +856,12 @@ class _PathTraceMapScreenState extends State { final settings = context.watch().settings; final isImperial = settings.unitSystem == UnitSystem.imperial; final tileCache = context.read(); + final scheme = Theme.of(context).colorScheme; return Scaffold( appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - FittedBox( - fit: BoxFit.scaleDown, - child: Text( - widget.title, - style: const TextStyle(fontSize: 24), - ), - ), - ], - ), - centerTitle: false, + title: Text(widget.title), + centerTitle: true, actions: [ IconButton( icon: _isLoading @@ -604,10 +885,14 @@ class _PathTraceMapScreenState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - if (_isLoading) const CircularProgressIndicator(), + if (_isLoading) + CircularProgressIndicator(color: MeshPalette.blue), const SizedBox(height: 16), if (!_isLoading && _failed2Loaded) - Text(context.l10n.pathTrace_notAvailable), + Text( + context.l10n.pathTrace_notAvailable, + style: TextStyle(color: scheme.onSurfaceVariant), + ), ], ), ), @@ -615,25 +900,33 @@ class _PathTraceMapScreenState extends State { _buildMapPathTrace(context, tileCache, _targetContact), if (_hasData && _isDesktopPlatform(defaultTargetPlatform)) _buildDesktopMapControls(), + if (_hasData && _displayPaths.length > 1) + PathViewModeToggle( + mode: _viewMode, + onChanged: (mode) => setState(() => _viewMode = mode), + ), if (_points.isEmpty && !_hasData && !_isLoading && !_failed2Loaded) Center( - child: Card( - color: Theme.of( - context, - ).colorScheme.surface.withValues(alpha: 0.9), + child: DecoratedBox( + decoration: BoxDecoration( + color: scheme.surfaceContainerLow, + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: scheme.outlineVariant), + ), child: Padding( - padding: EdgeInsets.all(12), + padding: const EdgeInsets.all(12), child: Text( context.l10n.channelPath_noRepeaterLocations, + style: TextStyle(color: scheme.onSurfaceVariant), ), ), ), ), if (_hasData) - _buildLegendCard(context, _traceData!, isImperial), + _buildBottomPanel(context, _traceData!, isImperial), ], ), ), @@ -676,28 +969,33 @@ class _PathTraceMapScreenState extends State { child: Container( width: 35, height: 35, - padding: const EdgeInsets.all(4), decoration: BoxDecoration( - color: hasGps - ? Colors.green - : Colors.orange.withValues(alpha: 0.75), shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), + color: hasGps + ? MeshPalette.signal.withValues(alpha: 0.18) + : MeshPalette.warn.withValues(alpha: 0.18), + border: Border.all( + color: hasGps + ? MeshPalette.signal.withValues(alpha: 0.7) + : MeshPalette.warn.withValues(alpha: 0.7), + width: 1.5, + ), boxShadow: [ BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + color: hasGps + ? MeshPalette.signal.withValues(alpha: 0.3) + : MeshPalette.warn.withValues(alpha: 0.3), + blurRadius: 5, ), ], ), alignment: Alignment.center, child: Text( hasGps ? label : '~$label', - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: hasGps ? MeshPalette.signal : MeshPalette.warn, ), ), ), @@ -716,6 +1014,17 @@ class _PathTraceMapScreenState extends State { hopLast = hop; } + _addEndpointMarkers(markers, showLabels: showLabels, target: target); + + return markers; + } + + /// Self and target endpoint markers, shared by single and combined views. + void _addEndpointMarkers( + List markers, { + required bool showLabels, + required Contact? target, + }) { final selfLat = context.read().selfLatitude; final selfLon = context.read().selfLongitude; if (selfLat != null && selfLon != null) { @@ -729,26 +1038,27 @@ class _PathTraceMapScreenState extends State { child: Container( width: 35, height: 35, - padding: const EdgeInsets.all(4), decoration: BoxDecoration( - color: Colors.blue, shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), + color: MeshPalette.blue.withValues(alpha: 0.18), + border: Border.all( + color: MeshPalette.blue.withValues(alpha: 0.7), + width: 2, + ), boxShadow: [ BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + color: MeshPalette.blue.withValues(alpha: 0.35), + blurRadius: 6, ), ], ), alignment: Alignment.center, child: Text( context.l10n.pathTrace_you, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 12, + style: MeshTheme.mono( + fontSize: 9, + fontWeight: FontWeight.w700, + color: MeshPalette.blue, ), ), ), @@ -779,23 +1089,32 @@ class _PathTraceMapScreenState extends State { child: Container( width: 35, height: 35, - padding: const EdgeInsets.all(4), decoration: BoxDecoration( - color: isGuessed - ? Colors.purple.withValues(alpha: 0.55) - : Colors.red, shape: BoxShape.circle, - border: Border.all(color: Colors.white, width: 2), + color: isGuessed + ? MeshPalette.magenta.withValues(alpha: 0.18) + : MeshPalette.alert.withValues(alpha: 0.18), + border: Border.all( + color: isGuessed + ? MeshPalette.magenta.withValues(alpha: 0.7) + : MeshPalette.alert.withValues(alpha: 0.7), + width: 1.5, + ), boxShadow: [ BoxShadow( - color: Colors.black.withValues(alpha: 0.3), - blurRadius: 4, - offset: const Offset(0, 2), + color: isGuessed + ? MeshPalette.magenta.withValues(alpha: 0.3) + : MeshPalette.alert.withValues(alpha: 0.3), + blurRadius: 5, ), ], ), alignment: Alignment.center, - child: const Icon(Icons.person, color: Colors.white, size: 18), + child: Icon( + Icons.person, + color: isGuessed ? MeshPalette.magenta : MeshPalette.alert, + size: 18, + ), ), ), ), @@ -809,10 +1128,133 @@ class _PathTraceMapScreenState extends State { ); } } + } + + /// Markers for the union of hops across all visible paths, with a badge on + /// repeaters used by more than one path. + List _buildCombinedHopMarkers({ + required bool showLabels, + required Contact? target, + }) { + final connector = context.read(); + final markers = []; + + // Hop byte -> paths that use it, in display order. + final hopPaths = >{}; + for (final path in _visiblePaths) { + for (final hop in path.hopBytes) { + final list = hopPaths.putIfAbsent(hop, () => []); + if (!list.contains(path)) list.add(path); + } + } + + for (final entry in hopPaths.entries) { + final hop = entry.key; + final paths = entry.value; + final contact = _contactForHop(hop, connector); + final hasGps = contact != null && contact.hasLocation; + final point = hasGps + ? LatLng(contact.latitude!, contact.longitude!) + : _inferredPositionForHop(hop, connector); + if (point == null) continue; + final label = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final baseColor = hasGps ? MeshPalette.signal : MeshPalette.warn; + final shared = paths.length > 1; + + markers.add( + Marker( + point: point, + width: 48, + height: 48, + child: GestureDetector( + onTap: () => _showSharedNodeSheet(hop, contact, paths), + child: Stack( + alignment: Alignment.center, + children: [ + Container( + width: 35, + height: 35, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: baseColor.withValues(alpha: 0.18), + border: Border.all( + color: baseColor.withValues(alpha: 0.7), + width: shared ? 2.5 : 1.5, + ), + boxShadow: [ + BoxShadow( + color: baseColor.withValues(alpha: 0.3), + blurRadius: 5, + ), + ], + ), + alignment: Alignment.center, + child: Text( + hasGps ? label : '~$label', + style: MeshTheme.mono( + fontSize: 10, + fontWeight: FontWeight.w700, + color: baseColor, + ), + ), + ), + if (shared) + Positioned( + top: 0, + right: 0, + child: Container( + width: 17, + height: 17, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: MeshPalette.bg1, + border: Border.all(color: MeshPalette.line3), + ), + alignment: Alignment.center, + child: Text( + '${paths.length}', + style: MeshTheme.mono( + fontSize: 9, + fontWeight: FontWeight.w700, + color: MeshPalette.ink, + ), + ), + ), + ), + ], + ), + ), + ), + ); + if (showLabels) { + markers.add( + _buildNodeLabelMarker( + point: point, + label: contact?.name ?? '~$label', + ), + ); + } + } + + _addEndpointMarkers(markers, showLabels: showLabels, target: target); return markers; } + void _showSharedNodeSheet( + int hop, + Contact? contact, + List paths, + ) { + final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + showSharedNodeSheet( + context, + title: '$hex: ${contact?.name ?? context.l10n.channelPath_unknownRepeater}', + paths: paths, + onSelect: _selectPath, + ); + } + Marker _buildNodeLabelMarker({required LatLng point, required String label}) { return Marker( point: point, @@ -827,18 +1269,19 @@ class _PathTraceMapScreenState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( - color: Colors.black54, - borderRadius: BorderRadius.circular(8), + color: MeshPalette.bg.withValues(alpha: 0.82), + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: MeshPalette.line, width: 0.5), ), alignment: Alignment.center, child: Text( label, maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - color: Colors.white, - fontSize: 11, + style: MeshTheme.mono( + fontSize: 10, fontWeight: FontWeight.w500, + color: MeshPalette.ink2, ), ), ), @@ -941,8 +1384,15 @@ class _PathTraceMapScreenState extends State { minZoom: _mapMinZoom, maxZoom: _mapMaxZoom, onPositionChanged: (camera, hasGesture) { + if (!mounted) return; + // A manual pan/zoom releases the follow lock. + if (hasGesture && _followPacket) { + setState(() { + _followPacket = false; + }); + } final shouldShow = camera.zoom >= _labelZoomThreshold; - if (shouldShow != _showNodeLabels && mounted) { + if (shouldShow != _showNodeLabels) { setState(() { _showNodeLabels = shouldShow; }); @@ -950,14 +1400,23 @@ class _PathTraceMapScreenState extends State { }, ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: MapTileCacheService.userAgentPackageName, - maxZoom: 19, + ThemedMapTileLayer(tileCache: tileCache), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + final lines = _buildDisplayPolylines(); + if (lines.isEmpty) return const SizedBox.shrink(); + return PolylineLayer(polylines: lines); + }, ), - if (_polylines.isNotEmpty) PolylineLayer(polylines: _polylines), - if (_traceData!.pathData.isNotEmpty) + if (_viewMode == PathViewMode.combined) + MarkerLayer( + markers: _buildCombinedHopMarkers( + showLabels: _showNodeLabels, + target: target, + ), + ) + else if (_traceData!.pathData.isNotEmpty) MarkerLayer( markers: _buildHopMarkers( _traceData!.pathData, @@ -965,25 +1424,70 @@ class _PathTraceMapScreenState extends State { target: target, ), ), + AnimatedBuilder( + animation: _playback, + builder: (context, _) { + final markers = _buildPacketMarkers(); + if (markers.isEmpty) return const SizedBox.shrink(); + return MarkerLayer(markers: markers); + }, + ), ], ); } - Widget _colorDot(Color color) => Container( - width: 10, - height: 10, - decoration: BoxDecoration(color: color, shape: BoxShape.circle), - ); + /// Polylines for the visible paths. While the packet animation is running, + /// the selected path's base line is dimmed and the traversed portion plus + /// the active segment are redrawn brightly by the playback overlay. + List _buildDisplayPolylines() { + final visible = _visiblePaths; + if (_displayPaths.isEmpty) return List.of(_polylines); + if (visible.isEmpty) return const []; - Widget _buildLegendCard( + final selected = _selectedPath; + final animating = + _animationEnabled && _playback.started && _playback.hasPath; + + final lines = buildMultiPathPolylines( + visible: visible, + selected: selected, + combined: _viewMode == PathViewMode.combined, + animating: animating, + ); + if (animating && selected != null) { + lines.addAll(buildPacketTrailPolylines(_playback, selected.color)); + } + return lines; + } + + List _buildPacketMarkers() { + final selected = _selectedPath; + if (!_animationEnabled || selected == null) return const []; + return buildPacketMarkers(_playback, selected.color); + } + + Widget _buildBottomPanel( BuildContext context, PathTraceData pathTraceData, bool isImperial, ) { final l10n = context.l10n; - final maxHeight = MediaQuery.of(context).size.height * 0.35; - final estimatedHeight = 72.0 + (pathTraceData.pathData.length * 56.0); - final cardHeight = max(96.0, min(maxHeight, estimatedHeight)); + final selected = _selectedPath; + final combined = _viewMode == PathViewMode.combined; + final maxHeight = + MediaQuery.of(context).size.height * (combined ? 0.45 : 0.35); + + double cardHeight; + if (_panelCollapsed) { + cardHeight = 128; + } else { + final summaryHeight = combined ? 34.0 + _displayPaths.length * 36.0 : 0; + final hopRows = combined + ? (selected?.totalTransmissions ?? 0) + : pathTraceData.pathData.length + 1; + final estimatedHeight = 132.0 + summaryHeight + hopRows * 56.0; + cardHeight = max(176.0, min(maxHeight, estimatedHeight)); + } return Positioned( left: 16, @@ -991,107 +1495,276 @@ class _PathTraceMapScreenState extends State { bottom: 16, child: SizedBox( height: cardHeight, - child: Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '${l10n.channelPath_repeaterHops} ${formatDistance(_pathDistanceMeters, isImperial: isImperial)}', - style: const TextStyle(fontWeight: FontWeight.w600), - ), - const SizedBox(height: 6), - Row( - children: [ - _colorDot(Colors.green), - const SizedBox(width: 4), - Text( - l10n.pathTrace_legendGpsConfirmed, - style: const TextStyle(fontSize: 11), - ), - const SizedBox(width: 12), - _colorDot(Colors.orange), - const SizedBox(width: 4), - Text( - l10n.pathTrace_legendInferred, - style: const TextStyle(fontSize: 11), - ), - ], - ), - ], - ), - ), - const Divider(height: 1), - Expanded( - child: pathTraceData.pathData.isEmpty - ? Center( - child: Text(l10n.channelPath_noHopDetailsAvailable), - ) - : Scrollbar( - child: ListView.separated( - padding: const EdgeInsets.symmetric(vertical: 4), - itemCount: pathTraceData.pathData.length + 1, - separatorBuilder: (_, _) => const Divider(height: 1), - itemBuilder: (context, index) { - final snrUi = snrUiFromSNR( - index < pathTraceData.snrData.length - ? pathTraceData.snrData[index] - : null, - context.read().currentSf, - ); - return Column( - children: [ - ListTile( - leading: - index >= pathTraceData.snrData.length / 2 - ? Icon(Icons.call_received) - : Icon(Icons.call_made), - title: Text( - formatDirectionText(pathTraceData, index), - style: const TextStyle(fontSize: 14), - ), - subtitle: Text( - formatDirectionSubText( - pathTraceData, - index, - ), - style: const TextStyle(fontSize: 14), - ), - trailing: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - snrUi.icon, - color: snrUi.color, - size: 18.0, - ), - Text( - snrUi.text, - style: TextStyle( - fontSize: 10, - color: snrUi.color, - ), - ), - ], - ), - onTap: () { - // Handle item tap - }, - ), - ], - ); - }, + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.95), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all(color: MeshPalette.line2), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(MeshRadii.md), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(12, 8, 4, 0), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '${l10n.channelPath_repeaterHops} ${formatDistance(selected?.distanceMeters ?? _pathDistanceMeters, isImperial: isImperial)}', + style: MeshTheme.mono( + fontWeight: FontWeight.w600, + fontSize: 13, + color: MeshPalette.ink, + ), + ), + const SizedBox(height: 4), + PathMiniLegend(combined: combined), + ], ), ), - ), - ], + IconButton( + visualDensity: VisualDensity.compact, + icon: Icon( + _panelCollapsed + ? Icons.expand_less + : Icons.expand_more, + size: 20, + ), + tooltip: _panelCollapsed + ? l10n.pathMap_expandPanel + : l10n.pathMap_collapsePanel, + onPressed: () => setState( + () => _panelCollapsed = !_panelCollapsed, + ), + ), + ], + ), + ), + PathAnimationControls( + playback: _playback, + selected: selected, + animationEnabled: _animationEnabled, + onToggleAnimation: () => setState(() { + _animationEnabled = !_animationEnabled; + if (!_animationEnabled) _playback.stop(); + }), + followEnabled: _followPacket, + onToggleFollow: _toggleFollowPacket, + ), + if (!_panelCollapsed) ...[ + if (selected != null && selected.unresolvedHops > 0) + Padding( + padding: const EdgeInsets.fromLTRB(12, 0, 12, 4), + child: Text( + l10n.pathMap_partialAnimation(selected.unresolvedHops), + style: TextStyle( + fontSize: 10.5, + color: MeshPalette.warn, + ), + ), + ), + if (combined) + PathSummaryList( + paths: _displayPaths, + selectedId: _selectedPathId, + hiddenIds: _hiddenPathIds, + isImperial: isImperial, + onSelect: _selectPath, + onToggleVisibility: _togglePathVisibility, + onShowAll: () => setState(_hiddenPathIds.clear), + ), + const Divider(height: 1), + Expanded(child: _buildHopList(pathTraceData, selected)), + ], + ], + ), ), ), ), ); } + + Widget _buildHopList(PathTraceData pathTraceData, DisplayPath? selected) { + final useSnrList = + _viewMode == PathViewMode.single && (selected?.isPrimary ?? true); + return ValueListenableBuilder( + valueListenable: _playback.activeSegment, + builder: (context, activeSegment, _) { + int highlightRow = -1; + if (_animationEnabled && + selected != null && + activeSegment >= 0 && + activeSegment < selected.rowForSegment.length) { + highlightRow = selected.rowForSegment[activeSegment]; + } + if (useSnrList) { + return _buildSnrHopList(pathTraceData, highlightRow); + } + if (selected == null) { + return Center( + child: Text(context.l10n.channelPath_noHopDetailsAvailable), + ); + } + return _buildGenericHopList(selected, pathTraceData, highlightRow); + }, + ); + } + + Widget _buildSnrHopList(PathTraceData pathTraceData, int highlightRow) { + final l10n = context.l10n; + if (pathTraceData.pathData.isEmpty) { + return Center(child: Text(l10n.channelPath_noHopDetailsAvailable)); + } + return Scrollbar( + child: ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: pathTraceData.pathData.length + 1, + separatorBuilder: (_, _) => const Divider(height: 1), + itemBuilder: (context, index) { + final snrUi = snrUiFromSNR( + index < pathTraceData.snrData.length + ? pathTraceData.snrData[index] + : null, + context.read().currentSf, + ); + return ListTile( + tileColor: index == highlightRow + ? kPrimaryPathColor.withValues(alpha: 0.14) + : null, + leading: index >= pathTraceData.snrData.length / 2 + ? Icon(Icons.call_received) + : Icon(Icons.call_made), + title: Text( + formatDirectionText(pathTraceData, index), + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink), + ), + subtitle: Text( + formatDirectionSubText(pathTraceData, index), + style: MeshTheme.mono(fontSize: 12, color: MeshPalette.ink3), + ), + trailing: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(snrUi.icon, color: snrUi.color, size: 18.0), + Text( + snrUi.text, + style: MeshTheme.mono(fontSize: 10, color: snrUi.color), + ), + ], + ), + ); + }, + ), + ); + } + + Widget _buildGenericHopList( + DisplayPath path, + PathTraceData pathTraceData, + int highlightRow, + ) { + final connector = context.read(); + final l10n = context.l10n; + + final hopUseCount = {}; + if (_viewMode == PathViewMode.combined) { + for (final p in _visiblePaths) { + for (final hop in p.hopBytes.toSet()) { + hopUseCount.update(hop, (v) => v + 1, ifAbsent: () => 1); + } + } + } + + return Scrollbar( + child: ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + itemCount: path.totalTransmissions, + separatorBuilder: (_, _) => const Divider(height: 1), + itemBuilder: (context, index) { + String title; + String subtitle; + Widget? trailing; + if (index < path.hopBytes.length) { + final hop = path.hopBytes[index]; + final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final contact = _contactForHop(hop, connector); + title = contact != null + ? '$hex: ${contact.name}' + : '$hex: ${l10n.channelPath_unknownRepeater}'; + final hasGps = contact != null && contact.hasLocation; + final inferred = + !hasGps && _inferredPositionForHop(hop, connector) != null; + final status = hasGps + ? l10n.pathTrace_legendGpsConfirmed + : inferred + ? l10n.pathTrace_legendInferred + : l10n.pathMap_noLocation; + final sharedCount = hopUseCount[hop] ?? 0; + subtitle = sharedCount > 1 + ? '$status · ${l10n.pathMap_sharedNodeCount(sharedCount)}' + : status; + if (path.isPrimary && index < pathTraceData.snrData.length) { + final snrUi = snrUiFromSNR( + pathTraceData.snrData[index], + connector.currentSf, + ); + trailing = Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(snrUi.icon, color: snrUi.color, size: 18.0), + Text( + snrUi.text, + style: MeshTheme.mono(fontSize: 10, color: snrUi.color), + ), + ], + ); + } + } else { + title = widget.targetContact?.name ?? ''; + subtitle = _targetContactIsGuessed + ? l10n.pathTrace_legendInferred + : l10n.pathTrace_legendGpsConfirmed; + } + return ListTile( + dense: true, + tileColor: index == highlightRow + ? path.color.withValues(alpha: 0.14) + : null, + leading: Container( + width: 26, + height: 26, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all(color: path.color, width: 1.5), + ), + alignment: Alignment.center, + child: Text( + '${index + 1}', + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w700, + color: path.color, + ), + ), + ), + title: Text( + title, + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink), + ), + subtitle: Text( + subtitle, + style: MeshTheme.mono(fontSize: 11, color: MeshPalette.ink3), + ), + trailing: trailing, + ); + }, + ), + ); + } } diff --git a/lib/screens/repeater_cli_screen.dart b/lib/screens/repeater_cli_screen.dart index 80269061..5ed1b4eb 100644 --- a/lib/screens/repeater_cli_screen.dart +++ b/lib/screens/repeater_cli_screen.dart @@ -1,11 +1,12 @@ import 'dart:async'; -import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/debug_frame_viewer.dart'; import '../services/repeater_command_service.dart'; import '../widgets/routing_sheet.dart'; @@ -34,7 +35,6 @@ class _RepeaterCliScreenState extends State { StreamSubscription? _frameSubscription; RepeaterCommandService? _commandService; - // Common commands for quick access late final List> _quickCommands = [ {'labelKey': 'advertise', 'command': 'advert'}, {'labelKey': 'getName', 'command': 'get name'}, @@ -67,12 +67,8 @@ class _RepeaterCliScreenState extends State { void _setupMessageListener() { final connector = Provider.of(context, listen: false); - - // Listen for incoming text messages from the repeater _frameSubscription = connector.receivedFrames.listen((frame) { if (frame.isEmpty) return; - - // Check if it's a text message response if (frame[0] == respCodeContactMsgRecv || frame[0] == respCodeContactMsgRecvV3) { _handleTextMessageResponse(frame); @@ -102,12 +98,7 @@ class _RepeaterCliScreenState extends State { final parsed = parseContactMessageText(frame); if (parsed == null) return; if (!_matchesRepeaterPrefix(parsed.senderPrefix)) return; - - // Notify command service of response (for retry handling) _commandService?.handleResponse(widget.repeater, parsed.text); - - // Note: The command service will handle the response via the Future - // We don't need to add it to history here anymore as _sendCommand will do it } bool _matchesRepeaterPrefix(Uint8List prefix) { @@ -131,7 +122,6 @@ class _RepeaterCliScreenState extends State { }); }); - // Show debug info if requested if (showDebug && mounted) { final frame = buildSendCliCommandFrame( widget.repeater.publicKey, @@ -144,7 +134,6 @@ class _RepeaterCliScreenState extends State { ); } - // Send CLI command to repeater with retry try { if (_commandService != null) { final connector = Provider.of( @@ -157,7 +146,6 @@ class _RepeaterCliScreenState extends State { command, retries: 1, ); - if (mounted) { setState(() { _commandHistory.add({ @@ -184,7 +172,6 @@ class _RepeaterCliScreenState extends State { _historyIndex = -1; _commandFocusNode.requestFocus(); - // Auto-scroll to bottom Future.delayed(const Duration(milliseconds: 100), () { if (_scrollController.hasClients) { _scrollController.animateTo( @@ -239,36 +226,46 @@ class _RepeaterCliScreenState extends State { }); } + String _quickCommandLabel(String key) { + final l10n = context.l10n; + switch (key) { + case 'getName': + return l10n.repeater_cliQuickGetName; + case 'getRadio': + return l10n.repeater_cliQuickGetRadio; + case 'getTx': + return l10n.repeater_cliQuickGetTx; + case 'neighbors': + return l10n.repeater_cliQuickNeighbors; + case 'version': + return l10n.repeater_cliQuickVersion; + case 'advertise': + return l10n.repeater_cliQuickAdvertise; + case 'clock': + return l10n.repeater_cliQuickClock; + case 'clock sync': + return l10n.repeater_cliQuickClockSync; + case 'discovery': + return l10n.repeater_cliQuickDiscovery; + default: + return key; + } + } + @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final repeater = _resolveRepeater(connector); final isFloodMode = repeater.pathOverride == -1; return Scaffold( + backgroundColor: MeshPalette.bg, appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - l10n.repeater_cliTitle, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ], - ), - centerTitle: false, + backgroundColor: MeshPalette.bg1, + title: Text(l10n.repeater_cliTitle), + centerTitle: true, actions: [ IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), @@ -317,93 +314,181 @@ class _RepeaterCliScreenState extends State { ), body: Column( children: [ - _buildQuickCommandsBar(), - const Divider(height: 1), + // Quick commands bar + Container( + color: MeshPalette.bg1, + padding: const EdgeInsets.fromLTRB(8, 6, 8, 6), + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: _quickCommands.map((cmd) { + final label = _quickCommandLabel(cmd['labelKey']!); + return Padding( + padding: const EdgeInsets.only(right: 6), + child: ActionChip( + label: Text( + label, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w600, + color: MeshPalette.blue, + ), + ), + backgroundColor: MeshPalette.blueBg, + side: const BorderSide(color: MeshPalette.blueLine), + visualDensity: VisualDensity.compact, + onPressed: () => _useQuickCommand(cmd['command']!), + ), + ); + }).toList(), + ), + ), + ), + Divider(height: 1, color: MeshPalette.line), + + // Output area Expanded( child: _commandHistory.isEmpty ? _buildEmptyState() : _buildCommandHistory(), ), - const Divider(height: 1), - _buildCommandInput(), + + Divider(height: 1, color: MeshPalette.line), + + // Command input + Container( + color: MeshPalette.bg1, + padding: const EdgeInsets.fromLTRB(8, 8, 8, 8), + child: SafeArea( + child: Row( + children: [ + IconButton( + icon: Icon( + Icons.arrow_upward, + size: 18, + color: scheme.onSurfaceVariant, + ), + tooltip: l10n.repeater_previousCommand, + onPressed: () => _navigateHistory(true), + visualDensity: VisualDensity.compact, + ), + IconButton( + icon: Icon( + Icons.arrow_downward, + size: 18, + color: scheme.onSurfaceVariant, + ), + tooltip: l10n.repeater_nextCommand, + onPressed: () => _navigateHistory(false), + visualDensity: VisualDensity.compact, + ), + const SizedBox(width: 4), + Expanded( + child: TextField( + controller: _commandController, + focusNode: _commandFocusNode, + style: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.ink, + ), + decoration: InputDecoration( + hintText: context.l10n.repeater_enterCommandHint, + hintStyle: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.ink4, + ), + prefixText: '> ', + prefixStyle: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.blue, + fontWeight: FontWeight.w700, + ), + filled: true, + fillColor: MeshPalette.bg2, + contentPadding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 10, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: const BorderSide( + color: MeshPalette.line2, + ), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: const BorderSide( + color: MeshPalette.line2, + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + borderSide: const BorderSide( + color: MeshPalette.blue, + width: 1.5, + ), + ), + ), + textInputAction: TextInputAction.send, + onSubmitted: (_) => _sendCommand(), + ), + ), + const SizedBox(width: 6), + Material( + color: MeshPalette.blue.withValues(alpha: 0.15), + shape: const CircleBorder( + side: BorderSide(color: MeshPalette.blueLine), + ), + child: InkWell( + customBorder: const CircleBorder(), + onTap: () { + HapticFeedback.lightImpact(); + _sendCommand(); + }, + child: const Padding( + padding: EdgeInsets.all(10), + child: Icon( + Icons.send, + size: 18, + color: MeshPalette.blue, + ), + ), + ), + ), + ], + ), + ), + ), ], ), ); } - Widget _buildQuickCommandsBar() { - return Container( - padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8), - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: _quickCommands.map((cmd) { - final label = _quickCommandLabel(cmd['labelKey']!); - return Padding( - padding: const EdgeInsets.only(right: 8), - child: ActionChip( - label: Text(label), - onPressed: () => _useQuickCommand(cmd['command']!), - avatar: const Icon(Icons.play_arrow, size: 16), - ), - ); - }).toList(), - ), - ), - ); - } - - String _quickCommandLabel(String key) { - final l10n = context.l10n; - switch (key) { - case 'getName': - return l10n.repeater_cliQuickGetName; - case 'getRadio': - return l10n.repeater_cliQuickGetRadio; - case 'getTx': - return l10n.repeater_cliQuickGetTx; - case 'neighbors': - return l10n.repeater_cliQuickNeighbors; - case 'version': - return l10n.repeater_cliQuickVersion; - case 'advertise': - return l10n.repeater_cliQuickAdvertise; - case 'clock': - return l10n.repeater_cliQuickClock; - case 'clock sync': - return l10n.repeater_cliQuickClockSync; - case 'discovery': - return l10n.repeater_cliQuickDiscovery; - default: - return key; - } - } - Widget _buildEmptyState() { final l10n = context.l10n; return Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon( + const Icon( Icons.terminal, - size: 64, - color: Theme.of(context).colorScheme.onSurfaceVariant, + size: 48, + color: MeshPalette.ink4, ), - const SizedBox(height: 16), + const SizedBox(height: 12), Text( l10n.repeater_noCommandsSent, - style: TextStyle( - fontSize: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + style: MeshTheme.mono( + fontSize: 13, + color: MeshPalette.ink3, ), ), - const SizedBox(height: 8), + const SizedBox(height: 4), Text( l10n.repeater_typeCommandOrUseQuick, - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, + style: const TextStyle( + fontSize: 12, + color: MeshPalette.ink4, ), ), ], @@ -414,49 +499,41 @@ class _RepeaterCliScreenState extends State { Widget _buildCommandHistory() { return ListView.builder( controller: _scrollController, - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), itemCount: _commandHistory.length, itemBuilder: (context, index) { final entry = _commandHistory[index]; final isCommand = entry['type'] == 'command'; return Padding( - padding: const EdgeInsets.only(bottom: 12), + padding: const EdgeInsets.only(bottom: 2), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - padding: const EdgeInsets.all(6), - decoration: BoxDecoration( - color: isCommand - ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.secondaryContainer, - borderRadius: BorderRadius.circular(4), - ), - child: Icon( - isCommand ? Icons.chevron_right : Icons.arrow_back, - size: 16, - color: isCommand - ? Theme.of(context).colorScheme.onPrimaryContainer - : Theme.of(context).colorScheme.onSecondaryContainer, + // Gutter prefix + SizedBox( + width: 20, + child: Text( + isCommand ? '>' : ' ', + style: MeshTheme.mono( + fontSize: 12, + fontWeight: FontWeight.w700, + color: isCommand + ? MeshPalette.blue + : MeshPalette.ink3, + ), ), ), - const SizedBox(width: 12), + const SizedBox(width: 6), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SelectableText( - entry['text']!, - style: TextStyle( - fontFamily: 'monospace', - fontSize: 13, - color: isCommand - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.onSurface, - ), - ), - ], + child: SelectableText( + entry['text']!, + style: MeshTheme.mono( + fontSize: 12.5, + color: isCommand + ? MeshPalette.blue + : MeshPalette.ink, + ), ), ), ], @@ -466,54 +543,6 @@ class _RepeaterCliScreenState extends State { ); } - Widget _buildCommandInput() { - final l10n = context.l10n; - return Container( - padding: const EdgeInsets.all(12), - color: Theme.of(context).colorScheme.surface, - child: SafeArea( - child: Row( - children: [ - IconButton( - icon: const Icon(Icons.arrow_upward, size: 20), - tooltip: l10n.repeater_previousCommand, - onPressed: () => _navigateHistory(true), - ), - IconButton( - icon: const Icon(Icons.arrow_downward, size: 20), - tooltip: l10n.repeater_nextCommand, - onPressed: () => _navigateHistory(false), - ), - const SizedBox(width: 8), - Expanded( - child: TextField( - controller: _commandController, - focusNode: _commandFocusNode, - decoration: InputDecoration( - hintText: l10n.repeater_enterCommandHint, - border: const OutlineInputBorder(), - contentPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 12, - ), - prefixText: '> ', - ), - style: const TextStyle(fontFamily: 'monospace'), - textInputAction: TextInputAction.send, - onSubmitted: (_) => _sendCommand(), - ), - ), - const SizedBox(width: 8), - IconButton.filled( - icon: const Icon(Icons.send), - onPressed: _sendCommand, - ), - ], - ), - ), - ); - } - void _applyHelpCommand(String command) { _commandController.text = command; _commandController.selection = TextSelection.fromPosition( @@ -530,522 +559,156 @@ class _RepeaterCliScreenState extends State { void _showCommandHelp(BuildContext context) { final l10n = context.l10n; final generalCommands = [ - _CommandHelpEntry( - command: 'advert', - description: l10n.repeater_cliHelpAdvert, - ), - _CommandHelpEntry( - command: 'reboot', - description: l10n.repeater_cliHelpReboot, - ), - _CommandHelpEntry( - command: 'clock', - description: l10n.repeater_cliHelpClock, - ), - _CommandHelpEntry( - command: 'password {new-password}', - description: l10n.repeater_cliHelpPassword, - ), - _CommandHelpEntry( - command: 'ver', - description: l10n.repeater_cliHelpVersion, - ), - _CommandHelpEntry( - command: 'clear stats', - description: l10n.repeater_cliHelpClearStats, - ), - _CommandHelpEntry( - command: 'poweroff', - description: l10n.repeater_cliHelpPowerOff, - ), - _CommandHelpEntry( - command: 'shutdown', - description: l10n.repeater_cliHelpPowerOff, - ), - _CommandHelpEntry( - command: 'clkreboot', - description: l10n.repeater_cliHelpClkReboot, - ), - _CommandHelpEntry( - command: 'advert.zerohop', - description: l10n.repeater_cliHelpAdvertZeroHop, - ), - _CommandHelpEntry( - command: 'start ota', - description: l10n.repeater_cliHelpStartOta, - ), - _CommandHelpEntry( - command: 'time {epoch-seconds}', - description: l10n.repeater_cliHelpTime, - ), - _CommandHelpEntry( - command: 'board', - description: l10n.repeater_cliHelpBoard, - ), - _CommandHelpEntry( - command: 'discover.neighbors', - description: l10n.repeater_cliHelpDiscoverNeighbors, - ), - _CommandHelpEntry( - command: 'powersaving', - description: l10n.repeater_cliHelpPowersaving, - ), - _CommandHelpEntry( - command: 'powersaving {on|off}', - description: l10n.repeater_cliHelpPowersavingOnOff, - ), - _CommandHelpEntry( - command: 'erase', - description: l10n.repeater_cliHelpErase, - ), - _CommandHelpEntry( - command: 'stats-packets', - description: l10n.repeater_cliHelpStatsPackets, - ), - _CommandHelpEntry( - command: 'stats-radio', - description: l10n.repeater_cliHelpStatsRadio, - ), - _CommandHelpEntry( - command: 'stats-core', - description: l10n.repeater_cliHelpStatsCore, - ), + _CommandHelpEntry(command: 'advert', description: l10n.repeater_cliHelpAdvert), + _CommandHelpEntry(command: 'reboot', description: l10n.repeater_cliHelpReboot), + _CommandHelpEntry(command: 'clock', description: l10n.repeater_cliHelpClock), + _CommandHelpEntry(command: 'password {new-password}', description: l10n.repeater_cliHelpPassword), + _CommandHelpEntry(command: 'ver', description: l10n.repeater_cliHelpVersion), + _CommandHelpEntry(command: 'clear stats', description: l10n.repeater_cliHelpClearStats), + _CommandHelpEntry(command: 'poweroff', description: l10n.repeater_cliHelpPowerOff), + _CommandHelpEntry(command: 'shutdown', description: l10n.repeater_cliHelpPowerOff), + _CommandHelpEntry(command: 'clkreboot', description: l10n.repeater_cliHelpClkReboot), + _CommandHelpEntry(command: 'advert.zerohop', description: l10n.repeater_cliHelpAdvertZeroHop), + _CommandHelpEntry(command: 'start ota', description: l10n.repeater_cliHelpStartOta), + _CommandHelpEntry(command: 'time {epoch-seconds}', description: l10n.repeater_cliHelpTime), + _CommandHelpEntry(command: 'board', description: l10n.repeater_cliHelpBoard), + _CommandHelpEntry(command: 'discover.neighbors', description: l10n.repeater_cliHelpDiscoverNeighbors), + _CommandHelpEntry(command: 'powersaving', description: l10n.repeater_cliHelpPowersaving), + _CommandHelpEntry(command: 'powersaving {on|off}', description: l10n.repeater_cliHelpPowersavingOnOff), + _CommandHelpEntry(command: 'erase', description: l10n.repeater_cliHelpErase), + _CommandHelpEntry(command: 'stats-packets', description: l10n.repeater_cliHelpStatsPackets), + _CommandHelpEntry(command: 'stats-radio', description: l10n.repeater_cliHelpStatsRadio), + _CommandHelpEntry(command: 'stats-core', description: l10n.repeater_cliHelpStatsCore), ]; final settingsCommands = [ - _CommandHelpEntry( - command: 'set af {air-time-factor}', - description: l10n.repeater_cliHelpSetAf, - ), - _CommandHelpEntry( - command: 'set tx {tx-power-dbm}', - description: l10n.repeater_cliHelpSetTx, - ), - _CommandHelpEntry( - command: 'set repeat {on|off}', - description: l10n.repeater_cliHelpSetRepeat, - ), - _CommandHelpEntry( - command: 'set allow.read.only {on|off}', - description: l10n.repeater_cliHelpSetAllowReadOnly, - ), - _CommandHelpEntry( - command: 'set flood.max {max-hops}', - description: l10n.repeater_cliHelpSetFloodMax, - ), - _CommandHelpEntry( - command: 'set int.thresh {db}', - description: l10n.repeater_cliHelpSetIntThresh, - ), - _CommandHelpEntry( - command: 'set agc.reset.interval {seconds}', - description: l10n.repeater_cliHelpSetAgcResetInterval, - ), - _CommandHelpEntry( - command: 'set multi.acks {0|1}', - description: l10n.repeater_cliHelpSetMultiAcks, - ), - _CommandHelpEntry( - command: 'set advert.interval {minutes}', - description: l10n.repeater_cliHelpSetAdvertInterval, - ), - _CommandHelpEntry( - command: 'set flood.advert.interval {hours}', - description: l10n.repeater_cliHelpSetFloodAdvertInterval, - ), - _CommandHelpEntry( - command: 'set guest.password {guess-password}', - description: l10n.repeater_cliHelpSetGuestPassword, - ), - _CommandHelpEntry( - command: 'set name {name}', - description: l10n.repeater_cliHelpSetName, - ), - _CommandHelpEntry( - command: 'set lat {latitude}', - description: l10n.repeater_cliHelpSetLat, - ), - _CommandHelpEntry( - command: 'set lon {longitude}', - description: l10n.repeater_cliHelpSetLon, - ), - _CommandHelpEntry( - command: 'set radio {freq},{bw},{sf},{cr}', - description: l10n.repeater_cliHelpSetRadio, - ), - _CommandHelpEntry( - command: 'set rxdelay {base}', - description: l10n.repeater_cliHelpSetRxDelay, - ), - _CommandHelpEntry( - command: 'set txdelay {factor}', - description: l10n.repeater_cliHelpSetTxDelay, - ), - _CommandHelpEntry( - command: 'set direct.txdelay {factor}', - description: l10n.repeater_cliHelpSetDirectTxDelay, - ), - _CommandHelpEntry( - command: 'set bridge.enabled {on|off}', - description: l10n.repeater_cliHelpSetBridgeEnabled, - ), - _CommandHelpEntry( - command: 'set bridge.delay {0-10000}', - description: l10n.repeater_cliHelpSetBridgeDelay, - ), - _CommandHelpEntry( - command: 'set bridge.source {rx|tx}', - description: l10n.repeater_cliHelpSetBridgeSource, - ), - _CommandHelpEntry( - command: 'set bridge.baud {speed}', - description: l10n.repeater_cliHelpSetBridgeBaud, - ), - _CommandHelpEntry( - command: 'set bridge.secret {shared-secret}', - description: l10n.repeater_cliHelpSetBridgeSecret, - ), - _CommandHelpEntry( - command: 'set adc.multiplier {factor}', - description: l10n.repeater_cliHelpSetAdcMultiplier, - ), - _CommandHelpEntry( - command: 'tempradio {freq},{bw},{sf},{cr},{minutes}', - description: l10n.repeater_cliHelpTempRadio, - ), - _CommandHelpEntry( - command: 'setperm {pubkey-hex} {permissions}', - description: l10n.repeater_cliHelpSetPerm, - ), - _CommandHelpEntry( - command: 'set dutycycle {1-100}', - description: l10n.repeater_cliHelpSetDutyCycle, - ), - _CommandHelpEntry( - command: 'set prv.key {hex}', - description: l10n.repeater_cliHelpSetPrvKey, - ), - _CommandHelpEntry( - command: 'set radio.rxgain {on|off}', - description: l10n.repeater_cliHelpSetRadioRxGain, - ), - _CommandHelpEntry( - command: 'set owner.info {text}', - description: l10n.repeater_cliHelpSetOwnerInfo, - ), - _CommandHelpEntry( - command: 'set path.hash.mode {0|1|2}', - description: l10n.repeater_cliHelpSetPathHashMode, - ), - _CommandHelpEntry( - command: 'set loop.detect {off|minimal|moderate|strict}', - description: l10n.repeater_cliHelpSetLoopDetect, - ), - _CommandHelpEntry( - command: 'set freq {mhz}', - description: l10n.repeater_cliHelpSetFreq, - ), - _CommandHelpEntry( - command: 'set bridge.channel {1-14}', - description: l10n.repeater_cliHelpSetBridgeChannel, - ), + _CommandHelpEntry(command: 'set af {air-time-factor}', description: l10n.repeater_cliHelpSetAf), + _CommandHelpEntry(command: 'set tx {tx-power-dbm}', description: l10n.repeater_cliHelpSetTx), + _CommandHelpEntry(command: 'set repeat {on|off}', description: l10n.repeater_cliHelpSetRepeat), + _CommandHelpEntry(command: 'set allow.read.only {on|off}', description: l10n.repeater_cliHelpSetAllowReadOnly), + _CommandHelpEntry(command: 'set flood.max {max-hops}', description: l10n.repeater_cliHelpSetFloodMax), + _CommandHelpEntry(command: 'set int.thresh {db}', description: l10n.repeater_cliHelpSetIntThresh), + _CommandHelpEntry(command: 'set agc.reset.interval {seconds}', description: l10n.repeater_cliHelpSetAgcResetInterval), + _CommandHelpEntry(command: 'set multi.acks {0|1}', description: l10n.repeater_cliHelpSetMultiAcks), + _CommandHelpEntry(command: 'set advert.interval {minutes}', description: l10n.repeater_cliHelpSetAdvertInterval), + _CommandHelpEntry(command: 'set flood.advert.interval {hours}', description: l10n.repeater_cliHelpSetFloodAdvertInterval), + _CommandHelpEntry(command: 'set guest.password {guess-password}', description: l10n.repeater_cliHelpSetGuestPassword), + _CommandHelpEntry(command: 'set name {name}', description: l10n.repeater_cliHelpSetName), + _CommandHelpEntry(command: 'set lat {latitude}', description: l10n.repeater_cliHelpSetLat), + _CommandHelpEntry(command: 'set lon {longitude}', description: l10n.repeater_cliHelpSetLon), + _CommandHelpEntry(command: 'set radio {freq},{bw},{sf},{cr}', description: l10n.repeater_cliHelpSetRadio), + _CommandHelpEntry(command: 'set rxdelay {base}', description: l10n.repeater_cliHelpSetRxDelay), + _CommandHelpEntry(command: 'set txdelay {factor}', description: l10n.repeater_cliHelpSetTxDelay), + _CommandHelpEntry(command: 'set direct.txdelay {factor}', description: l10n.repeater_cliHelpSetDirectTxDelay), + _CommandHelpEntry(command: 'set bridge.enabled {on|off}', description: l10n.repeater_cliHelpSetBridgeEnabled), + _CommandHelpEntry(command: 'set bridge.delay {0-10000}', description: l10n.repeater_cliHelpSetBridgeDelay), + _CommandHelpEntry(command: 'set bridge.source {rx|tx}', description: l10n.repeater_cliHelpSetBridgeSource), + _CommandHelpEntry(command: 'set bridge.baud {speed}', description: l10n.repeater_cliHelpSetBridgeBaud), + _CommandHelpEntry(command: 'set bridge.secret {shared-secret}', description: l10n.repeater_cliHelpSetBridgeSecret), + _CommandHelpEntry(command: 'set adc.multiplier {factor}', description: l10n.repeater_cliHelpSetAdcMultiplier), + _CommandHelpEntry(command: 'tempradio {freq},{bw},{sf},{cr},{minutes}', description: l10n.repeater_cliHelpTempRadio), + _CommandHelpEntry(command: 'setperm {pubkey-hex} {permissions}', description: l10n.repeater_cliHelpSetPerm), + _CommandHelpEntry(command: 'set dutycycle {1-100}', description: l10n.repeater_cliHelpSetDutyCycle), + _CommandHelpEntry(command: 'set prv.key {hex}', description: l10n.repeater_cliHelpSetPrvKey), + _CommandHelpEntry(command: 'set radio.rxgain {on|off}', description: l10n.repeater_cliHelpSetRadioRxGain), + _CommandHelpEntry(command: 'set owner.info {text}', description: l10n.repeater_cliHelpSetOwnerInfo), + _CommandHelpEntry(command: 'set path.hash.mode {0|1|2}', description: l10n.repeater_cliHelpSetPathHashMode), + _CommandHelpEntry(command: 'set loop.detect {off|minimal|moderate|strict}', description: l10n.repeater_cliHelpSetLoopDetect), + _CommandHelpEntry(command: 'set freq {mhz}', description: l10n.repeater_cliHelpSetFreq), + _CommandHelpEntry(command: 'set bridge.channel {1-14}', description: l10n.repeater_cliHelpSetBridgeChannel), ]; final bridgeCommands = [ - _CommandHelpEntry( - command: 'get bridge.type', - description: l10n.repeater_cliHelpGetBridgeType, - ), + _CommandHelpEntry(command: 'get bridge.type', description: l10n.repeater_cliHelpGetBridgeType), ]; final loggingCommands = [ - _CommandHelpEntry( - command: 'log start', - description: l10n.repeater_cliHelpLogStart, - ), - _CommandHelpEntry( - command: 'log stop', - description: l10n.repeater_cliHelpLogStop, - ), - _CommandHelpEntry( - command: 'log erase', - description: l10n.repeater_cliHelpLogErase, - ), + _CommandHelpEntry(command: 'log start', description: l10n.repeater_cliHelpLogStart), + _CommandHelpEntry(command: 'log stop', description: l10n.repeater_cliHelpLogStop), + _CommandHelpEntry(command: 'log erase', description: l10n.repeater_cliHelpLogErase), ]; final neighborCommands = [ - _CommandHelpEntry( - command: 'neighbors', - description: l10n.repeater_cliHelpNeighbors, - ), - _CommandHelpEntry( - command: 'neighbor.remove {pubkey-prefix}', - description: l10n.repeater_cliHelpNeighborRemove, - ), + _CommandHelpEntry(command: 'neighbors', description: l10n.repeater_cliHelpNeighbors), + _CommandHelpEntry(command: 'neighbor.remove {pubkey-prefix}', description: l10n.repeater_cliHelpNeighborRemove), ]; final regionCommands = [ - _CommandHelpEntry( - command: 'region', - description: l10n.repeater_cliHelpRegion, - ), - _CommandHelpEntry( - command: 'region load', - description: l10n.repeater_cliHelpRegionLoad, - ), - _CommandHelpEntry( - command: 'region get {* | name-prefix}', - description: l10n.repeater_cliHelpRegionGet, - ), - _CommandHelpEntry( - command: 'region put {name} {* | parent-name-prefix}', - description: l10n.repeater_cliHelpRegionPut, - ), - _CommandHelpEntry( - command: 'region remove {name}', - description: l10n.repeater_cliHelpRegionRemove, - ), - _CommandHelpEntry( - command: 'region allowf {* | name-prefix}', - description: l10n.repeater_cliHelpRegionAllowf, - ), - _CommandHelpEntry( - command: 'region denyf {* | name-prefix}', - description: l10n.repeater_cliHelpRegionDenyf, - ), - _CommandHelpEntry( - command: 'region home', - description: l10n.repeater_cliHelpRegionHome, - ), - _CommandHelpEntry( - command: 'region home {* | name-prefix}', - description: l10n.repeater_cliHelpRegionHomeSet, - ), - _CommandHelpEntry( - command: 'region save', - description: l10n.repeater_cliHelpRegionSave, - ), - _CommandHelpEntry( - command: 'region default', - description: l10n.repeater_cliHelpRegionDefault, - ), - _CommandHelpEntry( - command: 'region default {* | name-prefix | }', - description: l10n.repeater_cliHelpRegionDefaultSet, - ), - _CommandHelpEntry( - command: 'region list allowed', - description: l10n.repeater_cliHelpRegionListAllowed, - ), - _CommandHelpEntry( - command: 'region list denied', - description: l10n.repeater_cliHelpRegionListDenied, - ), + _CommandHelpEntry(command: 'region', description: l10n.repeater_cliHelpRegion), + _CommandHelpEntry(command: 'region load', description: l10n.repeater_cliHelpRegionLoad), + _CommandHelpEntry(command: 'region get {* | name-prefix}', description: l10n.repeater_cliHelpRegionGet), + _CommandHelpEntry(command: 'region put {name} {* | parent-name-prefix}', description: l10n.repeater_cliHelpRegionPut), + _CommandHelpEntry(command: 'region remove {name}', description: l10n.repeater_cliHelpRegionRemove), + _CommandHelpEntry(command: 'region allowf {* | name-prefix}', description: l10n.repeater_cliHelpRegionAllowf), + _CommandHelpEntry(command: 'region denyf {* | name-prefix}', description: l10n.repeater_cliHelpRegionDenyf), + _CommandHelpEntry(command: 'region home', description: l10n.repeater_cliHelpRegionHome), + _CommandHelpEntry(command: 'region home {* | name-prefix}', description: l10n.repeater_cliHelpRegionHomeSet), + _CommandHelpEntry(command: 'region save', description: l10n.repeater_cliHelpRegionSave), + _CommandHelpEntry(command: 'region default', description: l10n.repeater_cliHelpRegionDefault), + _CommandHelpEntry(command: 'region default {* | name-prefix | }', description: l10n.repeater_cliHelpRegionDefaultSet), + _CommandHelpEntry(command: 'region list allowed', description: l10n.repeater_cliHelpRegionListAllowed), + _CommandHelpEntry(command: 'region list denied', description: l10n.repeater_cliHelpRegionListDenied), ]; final getCommands = [ - _CommandHelpEntry( - command: 'get name', - description: l10n.repeater_cliHelpGetName, - ), - _CommandHelpEntry( - command: 'get role', - description: l10n.repeater_cliHelpGetRole, - ), - _CommandHelpEntry( - command: 'get public.key', - description: l10n.repeater_cliHelpGetPublicKey, - ), - _CommandHelpEntry( - command: 'get prv.key', - description: l10n.repeater_cliHelpGetPrvKey, - ), - _CommandHelpEntry( - command: 'get repeat', - description: l10n.repeater_cliHelpGetRepeat, - ), - _CommandHelpEntry( - command: 'get tx', - description: l10n.repeater_cliHelpGetTx, - ), - _CommandHelpEntry( - command: 'get freq', - description: l10n.repeater_cliHelpGetFreq, - ), - _CommandHelpEntry( - command: 'get radio', - description: l10n.repeater_cliHelpGetRadio, - ), - _CommandHelpEntry( - command: 'get radio.rxgain', - description: l10n.repeater_cliHelpGetRadioRxGain, - ), - _CommandHelpEntry( - command: 'get af', - description: l10n.repeater_cliHelpGetAf, - ), - _CommandHelpEntry( - command: 'get dutycycle', - description: l10n.repeater_cliHelpGetDutyCycle, - ), - _CommandHelpEntry( - command: 'get int.thresh', - description: l10n.repeater_cliHelpGetIntThresh, - ), - _CommandHelpEntry( - command: 'get agc.reset.interval', - description: l10n.repeater_cliHelpGetAgcResetInterval, - ), - _CommandHelpEntry( - command: 'get multi.acks', - description: l10n.repeater_cliHelpGetMultiAcks, - ), - _CommandHelpEntry( - command: 'get allow.read.only', - description: l10n.repeater_cliHelpGetAllowReadOnly, - ), - _CommandHelpEntry( - command: 'get advert.interval', - description: l10n.repeater_cliHelpGetAdvertInterval, - ), - _CommandHelpEntry( - command: 'get flood.advert.interval', - description: l10n.repeater_cliHelpGetFloodAdvertInterval, - ), - _CommandHelpEntry( - command: 'get guest.password', - description: l10n.repeater_cliHelpGetGuestPassword, - ), - _CommandHelpEntry( - command: 'get lat', - description: l10n.repeater_cliHelpGetLat, - ), - _CommandHelpEntry( - command: 'get lon', - description: l10n.repeater_cliHelpGetLon, - ), - _CommandHelpEntry( - command: 'get rxdelay', - description: l10n.repeater_cliHelpGetRxDelay, - ), - _CommandHelpEntry( - command: 'get txdelay', - description: l10n.repeater_cliHelpGetTxDelay, - ), - _CommandHelpEntry( - command: 'get direct.txdelay', - description: l10n.repeater_cliHelpGetDirectTxDelay, - ), - _CommandHelpEntry( - command: 'get flood.max', - description: l10n.repeater_cliHelpGetFloodMax, - ), - _CommandHelpEntry( - command: 'get owner.info', - description: l10n.repeater_cliHelpGetOwnerInfo, - ), - _CommandHelpEntry( - command: 'get path.hash.mode', - description: l10n.repeater_cliHelpGetPathHashMode, - ), - _CommandHelpEntry( - command: 'get loop.detect', - description: l10n.repeater_cliHelpGetLoopDetect, - ), - _CommandHelpEntry( - command: 'get acl', - description: l10n.repeater_cliHelpGetAcl, - ), - _CommandHelpEntry( - command: 'get bridge.enabled', - description: l10n.repeater_cliHelpGetBridgeEnabled, - ), - _CommandHelpEntry( - command: 'get bridge.delay', - description: l10n.repeater_cliHelpGetBridgeDelay, - ), - _CommandHelpEntry( - command: 'get bridge.source', - description: l10n.repeater_cliHelpGetBridgeSource, - ), - _CommandHelpEntry( - command: 'get bridge.baud', - description: l10n.repeater_cliHelpGetBridgeBaud, - ), - _CommandHelpEntry( - command: 'get bridge.channel', - description: l10n.repeater_cliHelpGetBridgeChannel, - ), - _CommandHelpEntry( - command: 'get bridge.secret', - description: l10n.repeater_cliHelpGetBridgeSecret, - ), - _CommandHelpEntry( - command: 'get bootloader.ver', - description: l10n.repeater_cliHelpGetBootloaderVer, - ), - _CommandHelpEntry( - command: 'get adc.multiplier', - description: l10n.repeater_cliHelpGetAdcMultiplier, - ), + _CommandHelpEntry(command: 'get name', description: l10n.repeater_cliHelpGetName), + _CommandHelpEntry(command: 'get role', description: l10n.repeater_cliHelpGetRole), + _CommandHelpEntry(command: 'get public.key', description: l10n.repeater_cliHelpGetPublicKey), + _CommandHelpEntry(command: 'get prv.key', description: l10n.repeater_cliHelpGetPrvKey), + _CommandHelpEntry(command: 'get repeat', description: l10n.repeater_cliHelpGetRepeat), + _CommandHelpEntry(command: 'get tx', description: l10n.repeater_cliHelpGetTx), + _CommandHelpEntry(command: 'get freq', description: l10n.repeater_cliHelpGetFreq), + _CommandHelpEntry(command: 'get radio', description: l10n.repeater_cliHelpGetRadio), + _CommandHelpEntry(command: 'get radio.rxgain', description: l10n.repeater_cliHelpGetRadioRxGain), + _CommandHelpEntry(command: 'get af', description: l10n.repeater_cliHelpGetAf), + _CommandHelpEntry(command: 'get dutycycle', description: l10n.repeater_cliHelpGetDutyCycle), + _CommandHelpEntry(command: 'get int.thresh', description: l10n.repeater_cliHelpGetIntThresh), + _CommandHelpEntry(command: 'get agc.reset.interval', description: l10n.repeater_cliHelpGetAgcResetInterval), + _CommandHelpEntry(command: 'get multi.acks', description: l10n.repeater_cliHelpGetMultiAcks), + _CommandHelpEntry(command: 'get allow.read.only', description: l10n.repeater_cliHelpGetAllowReadOnly), + _CommandHelpEntry(command: 'get advert.interval', description: l10n.repeater_cliHelpGetAdvertInterval), + _CommandHelpEntry(command: 'get flood.advert.interval', description: l10n.repeater_cliHelpGetFloodAdvertInterval), + _CommandHelpEntry(command: 'get guest.password', description: l10n.repeater_cliHelpGetGuestPassword), + _CommandHelpEntry(command: 'get lat', description: l10n.repeater_cliHelpGetLat), + _CommandHelpEntry(command: 'get lon', description: l10n.repeater_cliHelpGetLon), + _CommandHelpEntry(command: 'get rxdelay', description: l10n.repeater_cliHelpGetRxDelay), + _CommandHelpEntry(command: 'get txdelay', description: l10n.repeater_cliHelpGetTxDelay), + _CommandHelpEntry(command: 'get direct.txdelay', description: l10n.repeater_cliHelpGetDirectTxDelay), + _CommandHelpEntry(command: 'get flood.max', description: l10n.repeater_cliHelpGetFloodMax), + _CommandHelpEntry(command: 'get owner.info', description: l10n.repeater_cliHelpGetOwnerInfo), + _CommandHelpEntry(command: 'get path.hash.mode', description: l10n.repeater_cliHelpGetPathHashMode), + _CommandHelpEntry(command: 'get loop.detect', description: l10n.repeater_cliHelpGetLoopDetect), + _CommandHelpEntry(command: 'get acl', description: l10n.repeater_cliHelpGetAcl), + _CommandHelpEntry(command: 'get bridge.enabled', description: l10n.repeater_cliHelpGetBridgeEnabled), + _CommandHelpEntry(command: 'get bridge.delay', description: l10n.repeater_cliHelpGetBridgeDelay), + _CommandHelpEntry(command: 'get bridge.source', description: l10n.repeater_cliHelpGetBridgeSource), + _CommandHelpEntry(command: 'get bridge.baud', description: l10n.repeater_cliHelpGetBridgeBaud), + _CommandHelpEntry(command: 'get bridge.channel', description: l10n.repeater_cliHelpGetBridgeChannel), + _CommandHelpEntry(command: 'get bridge.secret', description: l10n.repeater_cliHelpGetBridgeSecret), + _CommandHelpEntry(command: 'get bootloader.ver', description: l10n.repeater_cliHelpGetBootloaderVer), + _CommandHelpEntry(command: 'get adc.multiplier', description: l10n.repeater_cliHelpGetAdcMultiplier), ]; final powerMgmtCommands = [ - _CommandHelpEntry( - command: 'get pwrmgt.support', - description: l10n.repeater_cliHelpGetPwrMgtSupport, - ), - _CommandHelpEntry( - command: 'get pwrmgt.source', - description: l10n.repeater_cliHelpGetPwrMgtSource, - ), - _CommandHelpEntry( - command: 'get pwrmgt.bootreason', - description: l10n.repeater_cliHelpGetPwrMgtBootReason, - ), - _CommandHelpEntry( - command: 'get pwrmgt.bootmv', - description: l10n.repeater_cliHelpGetPwrMgtBootMv, - ), + _CommandHelpEntry(command: 'get pwrmgt.support', description: l10n.repeater_cliHelpGetPwrMgtSupport), + _CommandHelpEntry(command: 'get pwrmgt.source', description: l10n.repeater_cliHelpGetPwrMgtSource), + _CommandHelpEntry(command: 'get pwrmgt.bootreason', description: l10n.repeater_cliHelpGetPwrMgtBootReason), + _CommandHelpEntry(command: 'get pwrmgt.bootmv', description: l10n.repeater_cliHelpGetPwrMgtBootMv), ]; final sensorCommands = [ - _CommandHelpEntry( - command: 'sensor get {key}', - description: l10n.repeater_cliHelpSensorGet, - ), - _CommandHelpEntry( - command: 'sensor set {key} {value}', - description: l10n.repeater_cliHelpSensorSet, - ), - _CommandHelpEntry( - command: 'sensor list [start]', - description: l10n.repeater_cliHelpSensorList, - ), + _CommandHelpEntry(command: 'sensor get {key}', description: l10n.repeater_cliHelpSensorGet), + _CommandHelpEntry(command: 'sensor set {key} {value}', description: l10n.repeater_cliHelpSensorSet), + _CommandHelpEntry(command: 'sensor list [start]', description: l10n.repeater_cliHelpSensorList), ]; final gpsCommands = [ _CommandHelpEntry(command: 'gps', description: l10n.repeater_cliHelpGps), - _CommandHelpEntry( - command: 'gps {on|off}', - description: l10n.repeater_cliHelpGpsOnOff, - ), - _CommandHelpEntry( - command: 'gps sync', - description: l10n.repeater_cliHelpGpsSync, - ), - _CommandHelpEntry( - command: 'gps setloc', - description: l10n.repeater_cliHelpGpsSetLoc, - ), - _CommandHelpEntry( - command: 'gps advert', - description: l10n.repeater_cliHelpGpsAdvert, - ), - _CommandHelpEntry( - command: 'gps advert {none|share|prefs}', - description: l10n.repeater_cliHelpGpsAdvertSet, - ), + _CommandHelpEntry(command: 'gps {on|off}', description: l10n.repeater_cliHelpGpsOnOff), + _CommandHelpEntry(command: 'gps sync', description: l10n.repeater_cliHelpGpsSync), + _CommandHelpEntry(command: 'gps setloc', description: l10n.repeater_cliHelpGpsSetLoc), + _CommandHelpEntry(command: 'gps advert', description: l10n.repeater_cliHelpGpsAdvert), + _CommandHelpEntry(command: 'gps advert {none|share|prefs}', description: l10n.repeater_cliHelpGpsAdvertSet), ]; showDialog( @@ -1057,64 +720,27 @@ class _RepeaterCliScreenState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - l10n.repeater_commandsListNote, - style: const TextStyle(fontSize: 13), - ), + Text(l10n.repeater_commandsListNote, style: const TextStyle(fontSize: 13)), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_general, - generalCommands, - ), + _buildHelpSection(context, l10n.repeater_general, generalCommands), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_getCategory, - getCommands, - ), + _buildHelpSection(context, l10n.repeater_getCategory, getCommands), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_settingsCategory, - settingsCommands, - ), + _buildHelpSection(context, l10n.repeater_settingsCategory, settingsCommands), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_powerMgmt, - powerMgmtCommands, - ), + _buildHelpSection(context, l10n.repeater_powerMgmt, powerMgmtCommands), const SizedBox(height: 16), _buildHelpSection(context, l10n.repeater_sensors, sensorCommands), const SizedBox(height: 16), _buildHelpSection(context, l10n.repeater_bridge, bridgeCommands), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_logging, - loggingCommands, - ), + _buildHelpSection(context, l10n.repeater_logging, loggingCommands), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_neighborsRepeaterOnly, - neighborCommands, - ), + _buildHelpSection(context, l10n.repeater_neighborsRepeaterOnly, neighborCommands), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_regionManagementRepeaterOnly, - regionCommands, - note: l10n.repeater_regionNote, - ), + _buildHelpSection(context, l10n.repeater_regionManagementRepeaterOnly, regionCommands, note: l10n.repeater_regionNote), const SizedBox(height: 16), - _buildHelpSection( - context, - l10n.repeater_gpsManagement, - gpsCommands, - note: l10n.repeater_gpsNote, - ), + _buildHelpSection(context, l10n.repeater_gpsManagement, gpsCommands, note: l10n.repeater_gpsNote), ], ), ), @@ -1134,16 +760,14 @@ class _RepeaterCliScreenState extends State { List<_CommandHelpEntry> commands, { String? note, }) { + final scheme = Theme.of(context).colorScheme; return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - title, - style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16), - ), + Text(title, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15)), if (note != null) ...[ - const SizedBox(height: 6), - Text(note, style: const TextStyle(fontSize: 12)), + const SizedBox(height: 4), + Text(note, style: TextStyle(fontSize: 11, color: scheme.onSurfaceVariant)), ], const SizedBox(height: 8), ...commands.map((entry) => _buildHelpCommandCard(context, entry)), @@ -1152,39 +776,35 @@ class _RepeaterCliScreenState extends State { } Widget _buildHelpCommandCard(BuildContext context, _CommandHelpEntry entry) { - final colorScheme = Theme.of(context).colorScheme; + final scheme = Theme.of(context).colorScheme; return Card( elevation: 0, - margin: const EdgeInsets.only(bottom: 8), - color: colorScheme.surfaceContainerHighest, + margin: const EdgeInsets.only(bottom: 6), + color: scheme.surfaceContainerHighest, shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - side: BorderSide(color: colorScheme.outlineVariant), + borderRadius: BorderRadius.circular(MeshRadii.sm), + side: BorderSide(color: scheme.outlineVariant), ), child: InkWell( - borderRadius: BorderRadius.circular(8), + borderRadius: BorderRadius.circular(MeshRadii.sm), onTap: () => _applyHelpCommand(entry.command), child: Padding( - padding: const EdgeInsets.all(12), + padding: const EdgeInsets.all(10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( entry.command, - style: TextStyle( - fontFamily: 'monospace', - fontSize: 13, - fontWeight: FontWeight.bold, - color: colorScheme.onSurfaceVariant, + style: MeshTheme.mono( + fontSize: 12, + fontWeight: FontWeight.w600, + color: MeshPalette.blue, ), ), - const SizedBox(height: 6), + const SizedBox(height: 4), Text( entry.description, - style: TextStyle( - fontSize: 12, - color: colorScheme.onSurfaceVariant, - ), + style: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant), ), ], ), @@ -1197,6 +817,5 @@ class _RepeaterCliScreenState extends State { class _CommandHelpEntry { final String command; final String description; - const _CommandHelpEntry({required this.command, required this.description}); } diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index 2aebcf03..bbdec602 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -1,10 +1,13 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:meshcore_open/connector/meshcore_protocol.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../l10n/contact_localization.dart'; import '../services/app_settings_service.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import 'repeater_status_screen.dart'; import 'repeater_cli_screen.dart'; import 'repeater_settings_screen.dart'; @@ -26,189 +29,157 @@ class RepeaterHubScreen extends StatelessWidget { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final settingsService = context.watch(); final chemistry = settingsService.batteryChemistryForRepeater( repeater.publicKeyHex, ); + return Scaffold( appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - if (isAdmin) - Text( - repeater.type == advTypeRepeater - ? l10n.repeater_management - : l10n.room_management, - ), - if (!isAdmin) - Text( - repeater.type == advTypeRepeater - ? l10n.repeater_guest - : l10n.room_guest, - ), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ), - ], + title: Text( + repeater.type == advTypeRepeater + ? (isAdmin ? l10n.repeater_management : l10n.repeater_guest) + : (isAdmin ? l10n.room_management : l10n.room_guest), ), - centerTitle: false, + centerTitle: true, ), body: SafeArea( top: false, child: ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.only(bottom: 24), children: [ - // Repeater info card - Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( + // ── Identity card ───────────────────────────────────────────── + Padding( + padding: const EdgeInsets.fromLTRB(16, 20, 16, 4), + child: MeshCard( + margin: EdgeInsets.zero, + padding: const EdgeInsets.all(20), + child: Row( children: [ - CircleAvatar( - radius: 40, - backgroundColor: Theme.of( - context, - ).colorScheme.tertiaryContainer, - child: Icon( - Icons.cell_tower, - size: 40, - color: Theme.of( - context, - ).colorScheme.onTertiaryContainer, - ), + AvatarCircle( + name: repeater.name, + size: 52, + color: MeshPalette.warn, + icon: Icons.cell_tower, ), - const SizedBox(height: 16), - Text( - repeater.name, - style: const TextStyle( - fontSize: 24, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 8), - Text( - repeater.shortPubKeyHex, - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - const SizedBox(height: 8), - Text( - repeater.pathLabel(context.l10n), - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - if (repeater.hasLocation) ...[ - const SizedBox(height: 4), - Row( - mainAxisAlignment: MainAxisAlignment.center, + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - Icons.location_on, - size: 14, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, - ), - const SizedBox(width: 4), Text( - '${repeater.latitude?.toStringAsFixed(4)}, ${repeater.longitude?.toStringAsFixed(4)}', - style: TextStyle( - fontSize: 12, - color: Theme.of( - context, - ).colorScheme.onSurfaceVariant, + repeater.name, + style: Theme.of(context) + .textTheme + .titleMedium + ?.copyWith(fontWeight: FontWeight.w700), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 2), + Text( + repeater.shortPubKeyHex, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, ), ), + const SizedBox(height: 4), + Text( + repeater.pathLabel(l10n), + style: Theme.of(context) + .textTheme + .bodySmall + ?.copyWith(color: scheme.onSurfaceVariant), + ), + if (repeater.hasLocation) ...[ + const SizedBox(height: 2), + Row( + children: [ + Icon( + Icons.location_on, + size: 12, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 3), + Expanded( + child: Text( + '${repeater.latitude?.toStringAsFixed(4)}, ' + '${repeater.longitude?.toStringAsFixed(4)}', + style: MeshTheme.mono( + fontSize: 10, + color: scheme.onSurfaceVariant, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ], ], ), - ], + ), + StatusChip( + label: isAdmin ? 'ADMIN' : 'GUEST', + color: isAdmin ? MeshPalette.blue : scheme.onSurfaceVariant, + ), ], ), ), ), - const SizedBox(height: 24), - if (isAdmin) - Card( - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - const Icon(Icons.battery_full), - const SizedBox(width: 10), - Expanded( - child: Text( - l10n.appSettings_batteryChemistry, - style: const TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - ), - ), - ), - ], - ), - const SizedBox(height: 12), - DropdownButtonFormField( - initialValue: chemistry, - isExpanded: true, - decoration: const InputDecoration( - border: UnderlineInputBorder(), - isDense: true, - ), - onChanged: (value) { - if (value == null) return; - settingsService.setBatteryChemistryForRepeater( - repeater.publicKeyHex, - value, - ); - }, - items: [ - DropdownMenuItem( - value: 'nmc', - child: Text(l10n.appSettings_batteryNmc), - ), - DropdownMenuItem( - value: 'lifepo4', - child: Text(l10n.appSettings_batteryLifepo4), - ), - DropdownMenuItem( - value: 'lipo', - child: Text(l10n.appSettings_batteryLipo), - ), - ], - ), - ], + + // ── Battery chemistry (admin only) ───────────────────────────── + if (isAdmin) ...[ + SectionHeader(l10n.appSettings_batteryChemistry), + MeshCard( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + padding: const EdgeInsets.fromLTRB(14, 10, 14, 14), + child: DropdownButtonFormField( + initialValue: chemistry, + isExpanded: true, + decoration: InputDecoration( + prefixIcon: const Icon(Icons.battery_full, size: 18), + labelText: l10n.appSettings_batteryChemistry, ), + onChanged: (value) { + if (value == null) return; + settingsService.setBatteryChemistryForRepeater( + repeater.publicKeyHex, + value, + ); + }, + items: [ + DropdownMenuItem( + value: 'nmc', + child: Text(l10n.appSettings_batteryNmc), + ), + DropdownMenuItem( + value: 'lifepo4', + child: Text(l10n.appSettings_batteryLifepo4), + ), + DropdownMenuItem( + value: 'lipo', + child: Text(l10n.appSettings_batteryLipo), + ), + ], ), ), - const SizedBox(height: 24), - Text( - isAdmin - ? l10n.repeater_managementTools - : l10n.repeater_guestTools, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ], + + // ── Tools ────────────────────────────────────────────────────── + SectionHeader( + isAdmin ? l10n.repeater_managementTools : l10n.repeater_guestTools, ), - const SizedBox(height: 16), - // Status button - _buildManagementCard( - context, + + _HubActionTile( + index: 0, icon: Icons.analytics, title: l10n.repeater_status, subtitle: l10n.repeater_statusSubtitle, - color: Theme.of(context).colorScheme.primary, + accentColor: MeshPalette.blue, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -220,15 +191,15 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), - const SizedBox(height: 16), - // Telemetry button - _buildManagementCard( - context, + + _HubActionTile( + index: 1, icon: Icons.bar_chart_sharp, title: l10n.repeater_telemetry, subtitle: l10n.repeater_telemetrySubtitle, - color: Theme.of(context).colorScheme.secondary, + accentColor: MeshPalette.magenta, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -237,16 +208,34 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), - if (isAdmin) const SizedBox(height: 12), - // CLI button - if (isAdmin) - _buildManagementCard( - context, + + _HubActionTile( + index: 2, + icon: Icons.group, + title: l10n.repeater_neighbors, + subtitle: l10n.repeater_neighborsSubtitle, + accentColor: MeshPalette.signal, + onTap: () { + HapticFeedback.selectionClick(); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + NeighborsScreen(repeater: repeater, password: password), + ), + ); + }, + ), + + if (isAdmin) ...[ + _HubActionTile( + index: 3, icon: Icons.terminal, title: l10n.repeater_cli, subtitle: l10n.repeater_cliSubtitle, - color: Theme.of(context).colorScheme.tertiary, + accentColor: MeshPalette.warn, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -258,34 +247,14 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), - const SizedBox(height: 12), - // Neighbors button - _buildManagementCard( - context, - icon: Icons.group, - title: l10n.repeater_neighbors, - subtitle: l10n.repeater_neighborsSubtitle, - color: Theme.of(context).colorScheme.tertiary, - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - NeighborsScreen(repeater: repeater, password: password), - ), - ); - }, - ), - if (isAdmin) const SizedBox(height: 12), - // Settings button - if (isAdmin) - _buildManagementCard( - context, + _HubActionTile( + index: 4, icon: Icons.settings, title: l10n.repeater_settings, subtitle: l10n.repeater_settingsSubtitle, - color: Theme.of(context).colorScheme.error, + accentColor: MeshPalette.alert, onTap: () { + HapticFeedback.selectionClick(); Navigator.push( context, MaterialPageRoute( @@ -297,66 +266,82 @@ class RepeaterHubScreen extends StatelessWidget { ); }, ), + ], ], ), ), ); } +} - Widget _buildManagementCard( - BuildContext context, { - required IconData icon, - required String title, - required String subtitle, - required Color color, - required VoidCallback onTap, - }) { - return Card( - elevation: 2, - child: InkWell( +class _HubActionTile extends StatelessWidget { + final int index; + final IconData icon; + final String title; + final String subtitle; + final Color accentColor; + final VoidCallback onTap; + + const _HubActionTile({ + required this.index, + required this.icon, + required this.title, + required this.subtitle, + required this.accentColor, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return ListEntrance( + index: index, + child: MeshCard( onTap: onTap, - borderRadius: BorderRadius.circular(12), - child: Padding( - padding: const EdgeInsets.all(16), - child: Row( - children: [ - Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: color.withValues(alpha: 0.1), - borderRadius: BorderRadius.circular(12), - ), - child: Icon(icon, color: color, size: 32), - ), - const SizedBox(width: 16), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - const SizedBox(height: 4), - Text( - subtitle, - style: TextStyle( - fontSize: 14, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], + child: Row( + children: [ + Container( + width: 44, + height: 44, + decoration: BoxDecoration( + color: accentColor.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.md), + border: Border.all( + color: accentColor.withValues(alpha: 0.3), ), ), - Icon( - Icons.chevron_right, - color: Theme.of(context).colorScheme.onSurfaceVariant, + alignment: Alignment.center, + child: Icon(icon, size: 22, color: accentColor), + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: TextStyle( + fontSize: 12.5, + color: scheme.onSurfaceVariant, + ), + ), + ], ), - ], - ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 20, + ), + ], ), ), ); diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index e04cfb70..30675e58 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -8,6 +8,8 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/repeater_command_service.dart'; import '../services/storage_service.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; @@ -1003,39 +1005,6 @@ class _RepeaterSettingsScreenState extends State { } } - Widget _buildSectionHeader({ - required IconData icon, - required String title, - String? tooltip, - bool isRefreshing = false, - VoidCallback? onRefresh, - }) { - return Row( - children: [ - Icon(icon, color: Theme.of(context).textTheme.headlineSmall?.color), - const SizedBox(width: 8), - Text( - title, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - if (onRefresh != null) ...[ - const Spacer(), - IconButton( - icon: isRefreshing - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh), - onPressed: isRefreshing ? null : onRefresh, - tooltip: tooltip, - ), - ], - ], - ); - } - Widget _buildInlineRefreshButton({ required bool isRefreshing, required VoidCallback onRefresh, @@ -1067,21 +1036,8 @@ class _RepeaterSettingsScreenState extends State { return Scaffold( appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text(l10n.repeater_settingsTitle), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - ), - ], - ), - centerTitle: false, + title: Text(l10n.repeater_settingsTitle), + centerTitle: true, actions: [ IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), @@ -1102,27 +1058,17 @@ class _RepeaterSettingsScreenState extends State { child: _isLoading && _nameController.text.isEmpty ? const Center(child: CircularProgressIndicator()) : ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.only(bottom: 32), children: [ _buildBasicSettingsCard(), - const SizedBox(height: 16), _buildRadioSettingsCard(), - const SizedBox(height: 16), _buildLocationSettingsCard(), - const SizedBox(height: 16), _buildFeatureTogglesCard(), - const SizedBox(height: 16), _buildNetworkHealthCard(), - const SizedBox(height: 16), _buildAdvertisementSettingsCard(), - const SizedBox(height: 16), _buildOwnerInfoCard(), - const SizedBox(height: 16), _buildActionsCard(), - const SizedBox(height: 16), _buildAdvancedCard(), - const SizedBox(height: 32), - const Divider(), const SizedBox(height: 16), _buildDangerZoneCard(), ], @@ -1133,363 +1079,350 @@ class _RepeaterSettingsScreenState extends State { Widget _buildBasicSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.settings, - title: l10n.repeater_basicSettings, - tooltip: l10n.repeater_refreshBasicSettings, - isRefreshing: _refreshingBasic, - onRefresh: _refreshBasicSettings, - ), - const Divider(), - TextField( - controller: _nameController, - decoration: InputDecoration( - labelText: l10n.repeater_repeaterName, - helperText: l10n.repeater_repeaterNameHelper, - border: const OutlineInputBorder(), + final refreshButton = _refreshingBasic + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: _refreshBasicSettings, + tooltip: l10n.repeater_refreshBasicSettings, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_basicSettings, trailing: refreshButton), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: _nameController, + decoration: InputDecoration( + labelText: l10n.repeater_repeaterName, + helperText: l10n.repeater_repeaterNameHelper, + ), + onChanged: (_) => _markChanged(_SettingField.name), ), - onChanged: (_) => _markChanged(_SettingField.name), - ), - const SizedBox(height: 16), - TextField( - controller: _passwordController, - decoration: InputDecoration( - labelText: l10n.repeater_adminPassword, - helperText: l10n.repeater_adminPasswordHelper, - border: const OutlineInputBorder(), + const SizedBox(height: 12), + TextField( + controller: _passwordController, + decoration: InputDecoration( + labelText: l10n.repeater_adminPassword, + helperText: l10n.repeater_adminPasswordHelper, + ), + obscureText: true, + onChanged: (_) => _flagHasChanges(), ), - obscureText: true, - onChanged: (_) => _flagHasChanges(), - ), - const SizedBox(height: 16), - TextField( - controller: _guestPasswordController, - decoration: InputDecoration( - labelText: l10n.repeater_guestPassword, - helperText: l10n.repeater_guestPasswordHelper, - border: const OutlineInputBorder(), + const SizedBox(height: 12), + TextField( + controller: _guestPasswordController, + decoration: InputDecoration( + labelText: l10n.repeater_guestPassword, + helperText: l10n.repeater_guestPasswordHelper, + ), + obscureText: true, + onChanged: (_) => _flagHasChanges(), ), - obscureText: true, - onChanged: (_) => _flagHasChanges(), - ), - ], + ], + ), ), - ), + ], ); } Widget _buildRadioSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.radio, - title: l10n.repeater_radioSettings, - tooltip: l10n.repeater_refreshRadioSettings, - isRefreshing: _refreshingRadio, - onRefresh: _refreshRadioSettings, - ), - const Divider(), - TextField( - controller: _freqController, - decoration: InputDecoration( - labelText: l10n.repeater_frequencyMhz, - helperText: l10n.repeater_frequencyHelper, - border: const OutlineInputBorder(), - suffixText: 'MHz', + final refreshButton = _refreshingRadio + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: _refreshRadioSettings, + tooltip: l10n.repeater_refreshRadioSettings, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_radioSettings, trailing: refreshButton), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: _freqController, + decoration: InputDecoration( + labelText: l10n.repeater_frequencyMhz, + helperText: l10n.repeater_frequencyHelper, + suffixText: 'MHz', + ), + keyboardType: const TextInputType.numberWithOptions( + decimal: true, + ), + onChanged: (_) => _markChanged(_SettingField.radio), ), - keyboardType: const TextInputType.numberWithOptions( - decimal: true, - ), - onChanged: (_) => _markChanged(_SettingField.radio), - ), - const SizedBox(height: 16), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TextField( - controller: _txPowerController, - decoration: InputDecoration( - labelText: l10n.repeater_txPower, - helperText: l10n.repeater_txPowerHelper, - border: const OutlineInputBorder(), - suffixText: 'dBm', + const SizedBox(height: 12), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _txPowerController, + decoration: InputDecoration( + labelText: l10n.repeater_txPower, + helperText: l10n.repeater_txPowerHelper, + suffixText: 'dBm', + ), + keyboardType: TextInputType.number, + onChanged: (_) => _markChanged(_SettingField.txPower), ), - keyboardType: TextInputType.number, - onChanged: (_) => _markChanged(_SettingField.txPower), ), + _buildInlineRefreshButton( + isRefreshing: _refreshingTxPower, + onRefresh: _refreshTxPower, + tooltip: l10n.repeater_refreshTxPower, + ), + ], + ), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _bandwidth, + decoration: InputDecoration( + labelText: l10n.repeater_bandwidth, ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingTxPower, - onRefresh: _refreshTxPower, - tooltip: l10n.repeater_refreshTxPower, + items: _bandwidthOptions.map((bw) { + return DropdownMenuItem( + value: bw, + child: Text(_formatBandwidthLabel(bw)), + ); + }).toList(), + onChanged: (value) { + if (value != null) { + setState(() { + _bandwidth = value; + }); + _markChanged(_SettingField.radio); + } + }, + ), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _spreadingFactor, + decoration: InputDecoration( + labelText: l10n.repeater_spreadingFactor, ), - ], - ), - const SizedBox(height: 16), - DropdownButtonFormField( - initialValue: _bandwidth, - decoration: InputDecoration( - labelText: l10n.repeater_bandwidth, - border: const OutlineInputBorder(), + items: _spreadingFactorOptions.map((sf) { + return DropdownMenuItem(value: sf, child: Text('SF$sf')); + }).toList(), + onChanged: (value) { + if (value != null) { + setState(() { + _spreadingFactor = value; + }); + _markChanged(_SettingField.radio); + } + }, ), - items: _bandwidthOptions.map((bw) { - return DropdownMenuItem( - value: bw, - child: Text(_formatBandwidthLabel(bw)), - ); - }).toList(), - onChanged: (value) { - if (value != null) { - setState(() { - _bandwidth = value; - }); - _markChanged(_SettingField.radio); - } - }, - ), - const SizedBox(height: 16), - DropdownButtonFormField( - initialValue: _spreadingFactor, - decoration: InputDecoration( - labelText: l10n.repeater_spreadingFactor, - border: const OutlineInputBorder(), + const SizedBox(height: 12), + DropdownButtonFormField( + initialValue: _codingRate, + decoration: InputDecoration( + labelText: l10n.repeater_codingRate, + ), + items: _codingRateOptions.map((cr) { + return DropdownMenuItem(value: cr, child: Text('4/$cr')); + }).toList(), + onChanged: (value) { + if (value != null) { + setState(() { + _codingRate = value; + }); + _markChanged(_SettingField.radio); + } + }, ), - items: _spreadingFactorOptions.map((sf) { - return DropdownMenuItem(value: sf, child: Text('SF$sf')); - }).toList(), - onChanged: (value) { - if (value != null) { - setState(() { - _spreadingFactor = value; - }); - _markChanged(_SettingField.radio); - } - }, - ), - const SizedBox(height: 16), - DropdownButtonFormField( - initialValue: _codingRate, - decoration: InputDecoration( - labelText: l10n.repeater_codingRate, - border: const OutlineInputBorder(), + const SizedBox(height: 4), + _buildFeatureToggleRow( + title: l10n.repeater_rxGain, + subtitle: l10n.repeater_rxGainHelper, + value: _rxGainBoosted, + isRefreshing: _refreshingRxGain, + onChanged: (v) { + setState(() => _rxGainBoosted = v); + _markChanged(_SettingField.rxGain); + }, + onRefresh: _refreshRxGain, + refreshTooltip: l10n.repeater_refreshRxGain, ), - items: _codingRateOptions.map((cr) { - return DropdownMenuItem(value: cr, child: Text('4/$cr')); - }).toList(), - onChanged: (value) { - if (value != null) { - setState(() { - _codingRate = value; - }); - _markChanged(_SettingField.radio); - } - }, - ), - const SizedBox(height: 8), - _buildFeatureToggleRow( - title: l10n.repeater_rxGain, - subtitle: l10n.repeater_rxGainHelper, - value: _rxGainBoosted, - isRefreshing: _refreshingRxGain, - onChanged: (v) { - setState(() => _rxGainBoosted = v); - _markChanged(_SettingField.rxGain); - }, - onRefresh: _refreshRxGain, - refreshTooltip: l10n.repeater_refreshRxGain, - ), - ], + ], + ), ), - ), + ], ); } Widget _buildLocationSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.location_on, - title: l10n.repeater_locationSettings, - ), - const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TextField( - controller: _latController, - decoration: InputDecoration( - labelText: l10n.repeater_latitude, - helperText: l10n.repeater_latitudeHelper, - errorText: _latInvalid - ? l10n.settings_locationInvalid - : null, - border: const OutlineInputBorder(), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_locationSettings), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _latController, + decoration: InputDecoration( + labelText: l10n.repeater_latitude, + helperText: l10n.repeater_latitudeHelper, + errorText: _latInvalid + ? l10n.settings_locationInvalid + : null, + ), + keyboardType: const TextInputType.numberWithOptions( + decimal: true, + signed: true, + ), + onChanged: (value) { + _markChanged(_SettingField.lat); + final invalid = !_isValidCoordinate(value, 90); + if (invalid != _latInvalid) { + setState(() => _latInvalid = invalid); + } + }, ), - keyboardType: const TextInputType.numberWithOptions( - decimal: true, - signed: true, - ), - onChanged: (value) { - _markChanged(_SettingField.lat); - final invalid = !_isValidCoordinate(value, 90); - if (invalid != _latInvalid) { - setState(() => _latInvalid = invalid); - } - }, ), - ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingLat, - onRefresh: _refreshLat, - tooltip: l10n.repeater_latitude, - ), - ], - ), - const SizedBox(height: 16), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: TextField( - controller: _lonController, - decoration: InputDecoration( - labelText: l10n.repeater_longitude, - helperText: l10n.repeater_longitudeHelper, - errorText: _lonInvalid - ? l10n.settings_locationInvalid - : null, - border: const OutlineInputBorder(), - ), - keyboardType: const TextInputType.numberWithOptions( - decimal: true, - signed: true, - ), - onChanged: (value) { - _markChanged(_SettingField.lon); - final invalid = !_isValidCoordinate(value, 180); - if (invalid != _lonInvalid) { - setState(() => _lonInvalid = invalid); - } - }, + _buildInlineRefreshButton( + isRefreshing: _refreshingLat, + onRefresh: _refreshLat, + tooltip: l10n.repeater_latitude, ), - ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingLon, - onRefresh: _refreshLon, - tooltip: l10n.repeater_longitude, - ), - ], - ), - ], + ], + ), + const SizedBox(height: 12), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _lonController, + decoration: InputDecoration( + labelText: l10n.repeater_longitude, + helperText: l10n.repeater_longitudeHelper, + errorText: _lonInvalid + ? l10n.settings_locationInvalid + : null, + ), + keyboardType: const TextInputType.numberWithOptions( + decimal: true, + signed: true, + ), + onChanged: (value) { + _markChanged(_SettingField.lon); + final invalid = !_isValidCoordinate(value, 180); + if (invalid != _lonInvalid) { + setState(() => _lonInvalid = invalid); + } + }, + ), + ), + _buildInlineRefreshButton( + isRefreshing: _refreshingLon, + onRefresh: _refreshLon, + tooltip: l10n.repeater_longitude, + ), + ], + ), + ], + ), ), - ), + ], ); } Widget _buildFeatureTogglesCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.toggle_on, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_features, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildFeatureToggleRow( - title: l10n.repeater_packetForwarding, - subtitle: l10n.repeater_packetForwardingSubtitle, - value: _repeatEnabled, - isRefreshing: _refreshingRepeat, - onChanged: (value) { - setState(() { - _repeatEnabled = value; - }); - _markChanged(_SettingField.repeat); - }, - onRefresh: _refreshRepeat, - refreshTooltip: l10n.repeater_refreshPacketForwarding, - ), - _buildFeatureToggleRow( - title: l10n.repeater_guestAccess, - subtitle: l10n.repeater_guestAccessSubtitle, - value: _allowReadOnly, - isRefreshing: _refreshingAllowReadOnly, - onChanged: (value) { - setState(() { - _allowReadOnly = value; - }); - _markChanged(_SettingField.allowReadOnly); - }, - onRefresh: _refreshAllowReadOnly, - refreshTooltip: l10n.repeater_refreshGuestAccess, - ), - _buildFeatureToggleRow( - title: l10n.repeater_multiAcks, - subtitle: l10n.repeater_multiAcksSubtitle, - value: _multiAcks, - isRefreshing: _refreshingMultiAcks, - onChanged: (v) { - setState(() => _multiAcks = v); - _markChanged(_SettingField.multiAcks); - }, - onRefresh: _refreshMultiAcks, - refreshTooltip: l10n.repeater_refreshMultiAcks, - ), - SwitchListTile( - title: Text(l10n.repeater_clockSyncAfterLogin), - subtitle: Text(l10n.repeater_clockSyncAfterLoginSubtitle), - value: _autoClockSyncAfterLogin, - onChanged: (value) async { - setState(() { - _autoClockSyncAfterLogin = value; - }); - await _storage.setRepeaterAutoClockSyncAfterLoginEnabled( - widget.repeater.publicKeyHex, - value, - ); - }, - contentPadding: EdgeInsets.zero, - ), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_features), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildFeatureToggleRow( + title: l10n.repeater_packetForwarding, + subtitle: l10n.repeater_packetForwardingSubtitle, + value: _repeatEnabled, + isRefreshing: _refreshingRepeat, + onChanged: (value) { + setState(() { + _repeatEnabled = value; + }); + _markChanged(_SettingField.repeat); + }, + onRefresh: _refreshRepeat, + refreshTooltip: l10n.repeater_refreshPacketForwarding, + ), + _buildFeatureToggleRow( + title: l10n.repeater_guestAccess, + subtitle: l10n.repeater_guestAccessSubtitle, + value: _allowReadOnly, + isRefreshing: _refreshingAllowReadOnly, + onChanged: (value) { + setState(() { + _allowReadOnly = value; + }); + _markChanged(_SettingField.allowReadOnly); + }, + onRefresh: _refreshAllowReadOnly, + refreshTooltip: l10n.repeater_refreshGuestAccess, + ), + _buildFeatureToggleRow( + title: l10n.repeater_multiAcks, + subtitle: l10n.repeater_multiAcksSubtitle, + value: _multiAcks, + isRefreshing: _refreshingMultiAcks, + onChanged: (v) { + setState(() => _multiAcks = v); + _markChanged(_SettingField.multiAcks); + }, + onRefresh: _refreshMultiAcks, + refreshTooltip: l10n.repeater_refreshMultiAcks, + ), + SwitchListTile( + title: Text(l10n.repeater_clockSyncAfterLogin), + subtitle: Text(l10n.repeater_clockSyncAfterLoginSubtitle), + value: _autoClockSyncAfterLogin, + onChanged: (value) async { + setState(() { + _autoClockSyncAfterLogin = value; + }); + await _storage.setRepeaterAutoClockSyncAfterLoginEnabled( + widget.repeater.publicKeyHex, + value, + ); + }, + contentPadding: EdgeInsets.zero, + ), + ], + ), ), - ), + ], ); } @@ -1531,388 +1464,370 @@ class _RepeaterSettingsScreenState extends State { Widget _buildAdvertisementSettingsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.broadcast_on_personal, - title: l10n.repeater_advertisementSettings, - ), - const Divider(), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_localAdvertInterval), - subtitle: Text( - l10n.repeater_localAdvertIntervalMinutes(_advertInterval), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_advertisementSettings), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_localAdvertInterval), + subtitle: Text( + l10n.repeater_localAdvertIntervalMinutes(_advertInterval), + ), + trailing: Switch( + value: _advertEnable, + onChanged: (value) { + setState(() { + _advertInterval = value ? 60 : 0; + _advertEnable = value; + }); + _markChanged(_SettingField.advertInterval); + }, + ), + contentPadding: EdgeInsets.zero, ), - trailing: Switch( - value: _advertEnable, - onChanged: (value) { + ), + IconButton( + icon: _refreshingAdvertInterval + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingAdvertInterval + ? null + : _refreshAdvertInterval, + tooltip: l10n.repeater_localAdvertInterval, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _advertInterval == 0 + ? 60.toDouble() + : _advertInterval.toDouble(), + min: 60, + max: 240, + divisions: 18, + label: l10n.repeater_localAdvertIntervalMinutes(_advertInterval), + onChanged: _advertEnable + ? (value) { setState(() { - _advertInterval = value ? 60 : 0; - _advertEnable = value; + _advertInterval = value.toInt(); }); _markChanged(_SettingField.advertInterval); - }, - ), - contentPadding: EdgeInsets.zero, - ), - ), - IconButton( - icon: _refreshingAdvertInterval - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingAdvertInterval - ? null - : _refreshAdvertInterval, - tooltip: l10n.repeater_localAdvertInterval, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _advertInterval == 0 - ? 60.toDouble() - : _advertInterval.toDouble(), - min: 60, - max: 240, - divisions: 18, - label: l10n.repeater_localAdvertIntervalMinutes(_advertInterval), - onChanged: _advertEnable - ? (value) { - setState(() { - _advertInterval = value.toInt(); - }); - _markChanged(_SettingField.advertInterval); - } - : null, - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_floodAdvertInterval), - subtitle: Text( - l10n.repeater_floodAdvertIntervalHours( - _floodAdvertInterval, + } + : null, + ), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_floodAdvertInterval), + subtitle: Text( + l10n.repeater_floodAdvertIntervalHours( + _floodAdvertInterval, + ), ), + trailing: Switch( + value: _floodAdvertEnable, + onChanged: (value) { + setState(() { + _floodAdvertInterval = value ? 3 : 0; + _floodAdvertEnable = value; + }); + _markChanged(_SettingField.floodAdvertInterval); + }, + ), + contentPadding: EdgeInsets.zero, ), - trailing: Switch( - value: _floodAdvertEnable, - onChanged: (value) { + ), + IconButton( + icon: _refreshingFloodAdvertInterval + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingFloodAdvertInterval + ? null + : _refreshFloodAdvertInterval, + tooltip: l10n.repeater_floodAdvertInterval, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _floodAdvertInterval == 0 + ? 3.toDouble() + : _floodAdvertInterval.toDouble(), + min: 3, + max: 168, + divisions: 165, + label: l10n.repeater_floodAdvertIntervalHours( + _floodAdvertInterval, + ), + onChanged: _floodAdvertEnable + ? (value) { setState(() { - _floodAdvertInterval = value ? 3 : 0; - _floodAdvertEnable = value; + _floodAdvertInterval = value.toInt(); }); _markChanged(_SettingField.floodAdvertInterval); - }, - ), - contentPadding: EdgeInsets.zero, - ), - ), - IconButton( - icon: _refreshingFloodAdvertInterval - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingFloodAdvertInterval - ? null - : _refreshFloodAdvertInterval, - tooltip: l10n.repeater_floodAdvertInterval, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _floodAdvertInterval == 0 - ? 3.toDouble() - : _floodAdvertInterval.toDouble(), - min: 3, - max: 168, - divisions: 165, - label: l10n.repeater_floodAdvertIntervalHours( - _floodAdvertInterval, + } + : null, ), - onChanged: _floodAdvertEnable - ? (value) { - setState(() { - _floodAdvertInterval = value.toInt(); - }); - _markChanged(_SettingField.floodAdvertInterval); - } - : null, - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_floodMax), - subtitle: Text(l10n.repeater_floodMaxHelper), - trailing: Text( - '$_floodMax', - style: const TextStyle(fontWeight: FontWeight.bold), + const SizedBox(height: 8), + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_floodMax), + subtitle: Text(l10n.repeater_floodMaxHelper), + trailing: Text( + '$_floodMax', + style: const TextStyle(fontWeight: FontWeight.bold), + ), + contentPadding: EdgeInsets.zero, ), - contentPadding: EdgeInsets.zero, ), - ), - IconButton( - icon: _refreshingFloodMax - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingFloodMax ? null : _refreshFloodMax, - tooltip: l10n.repeater_floodMax, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _floodMax.toDouble(), - min: 0, - max: 64, - divisions: 64, - label: '$_floodMax', - onChanged: (v) { - setState(() => _floodMax = v.toInt()); - _markChanged(_SettingField.floodMax); - }, - ), - ], + IconButton( + icon: _refreshingFloodMax + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingFloodMax ? null : _refreshFloodMax, + tooltip: l10n.repeater_floodMax, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _floodMax.toDouble(), + min: 0, + max: 64, + divisions: 64, + label: '$_floodMax', + onChanged: (v) { + setState(() => _floodMax = v.toInt()); + _markChanged(_SettingField.floodMax); + }, + ), + ], + ), ), - ), + ], ); } Widget _buildNetworkHealthCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.health_and_safety, - title: l10n.repeater_networkHealth, - ), - const Divider(), - Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: DropdownButtonFormField( - initialValue: _loopDetect, - decoration: InputDecoration( - labelText: l10n.repeater_loopDetect, - helperText: l10n.repeater_loopDetectHelper, - helperMaxLines: 3, - border: const OutlineInputBorder(), + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_networkHealth), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: DropdownButtonFormField( + initialValue: _loopDetect, + decoration: InputDecoration( + labelText: l10n.repeater_loopDetect, + helperText: l10n.repeater_loopDetectHelper, + helperMaxLines: 3, + ), + items: [ + DropdownMenuItem( + value: 'off', + child: Text(l10n.repeater_loopDetectOff), + ), + DropdownMenuItem( + value: 'minimal', + child: Text(l10n.repeater_loopDetectMinimal), + ), + DropdownMenuItem( + value: 'moderate', + child: Text(l10n.repeater_loopDetectModerate), + ), + DropdownMenuItem( + value: 'strict', + child: Text(l10n.repeater_loopDetectStrict), + ), + ], + onChanged: (v) { + if (v != null) { + setState(() => _loopDetect = v); + _markChanged(_SettingField.loopDetect); + } + }, ), - items: [ - DropdownMenuItem( - value: 'off', - child: Text(l10n.repeater_loopDetectOff), - ), - DropdownMenuItem( - value: 'minimal', - child: Text(l10n.repeater_loopDetectMinimal), - ), - DropdownMenuItem( - value: 'moderate', - child: Text(l10n.repeater_loopDetectModerate), - ), - DropdownMenuItem( - value: 'strict', - child: Text(l10n.repeater_loopDetectStrict), - ), - ], - onChanged: (v) { - if (v != null) { - setState(() => _loopDetect = v); - _markChanged(_SettingField.loopDetect); - } - }, ), - ), - const SizedBox(width: 8), - _buildInlineRefreshButton( - isRefreshing: _refreshingLoopDetect, - onRefresh: _refreshLoopDetect, - tooltip: l10n.repeater_loopDetect, - ), - ], - ), - const SizedBox(height: 16), - Row( - children: [ - Expanded( - child: ListTile( - title: Text(l10n.repeater_dutyCycle), - subtitle: Text(l10n.repeater_dutyCycleHelper), - trailing: Text( - l10n.repeater_dutyCyclePercent(_dutyCycle), - style: const TextStyle(fontWeight: FontWeight.bold), + _buildInlineRefreshButton( + isRefreshing: _refreshingLoopDetect, + onRefresh: _refreshLoopDetect, + tooltip: l10n.repeater_loopDetect, + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: ListTile( + title: Text(l10n.repeater_dutyCycle), + subtitle: Text(l10n.repeater_dutyCycleHelper), + trailing: Text( + l10n.repeater_dutyCyclePercent(_dutyCycle), + style: const TextStyle(fontWeight: FontWeight.bold), + ), + contentPadding: EdgeInsets.zero, ), - contentPadding: EdgeInsets.zero, ), - ), - IconButton( - icon: _refreshingDutyCycle - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: _refreshingDutyCycle ? null : _refreshDutyCycle, - tooltip: l10n.repeater_dutyCycle, - visualDensity: VisualDensity.compact, - ), - ], - ), - Slider( - value: _dutyCycle.toDouble(), - min: 1, - max: 100, - divisions: 99, - label: l10n.repeater_dutyCyclePercent(_dutyCycle), - onChanged: (v) { - setState(() => _dutyCycle = v.toInt()); - _markChanged(_SettingField.dutyCycle); - }, - ), - ], + IconButton( + icon: _refreshingDutyCycle + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh, size: 20), + onPressed: _refreshingDutyCycle ? null : _refreshDutyCycle, + tooltip: l10n.repeater_dutyCycle, + visualDensity: VisualDensity.compact, + ), + ], + ), + Slider( + value: _dutyCycle.toDouble(), + min: 1, + max: 100, + divisions: 99, + label: l10n.repeater_dutyCyclePercent(_dutyCycle), + onChanged: (v) { + setState(() => _dutyCycle = v.toInt()); + _markChanged(_SettingField.dutyCycle); + }, + ), + ], + ), ), - ), + ], ); } Widget _buildOwnerInfoCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildSectionHeader( - icon: Icons.person_outline, - title: l10n.repeater_ownerInfo, - tooltip: l10n.repeater_refreshOwnerInfo, - isRefreshing: _refreshingOwnerInfo, - onRefresh: _refreshOwnerInfo, + final refreshButton = _refreshingOwnerInfo + ? const SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: _refreshOwnerInfo, + tooltip: l10n.repeater_refreshOwnerInfo, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + ); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_ownerInfo, trailing: refreshButton), + MeshCard( + child: TextField( + controller: _ownerInfoController, + decoration: InputDecoration( + labelText: l10n.repeater_ownerInfo, + helperText: l10n.repeater_ownerInfoHelper, + helperMaxLines: 3, ), - const Divider(), - TextField( - controller: _ownerInfoController, - decoration: InputDecoration( - labelText: l10n.repeater_ownerInfo, - helperText: l10n.repeater_ownerInfoHelper, - helperMaxLines: 3, - border: const OutlineInputBorder(), - ), - maxLines: 4, - minLines: 2, - onChanged: (_) => _markChanged(_SettingField.ownerInfo), - ), - ], + maxLines: 4, + minLines: 2, + onChanged: (_) => _markChanged(_SettingField.ownerInfo), + ), ), - ), + ], ); } Widget _buildActionsCard() { final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.flash_on, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_actionsTitle, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - ListTile( - leading: const Icon(Icons.podcasts), - title: Text(l10n.repeater_sendAdvert), - subtitle: Text(l10n.repeater_sendAdvertSubtitle), - enabled: !_runningAction, - onTap: _runningAction - ? null - : () => _runAction('advert', l10n.repeater_sendAdvert), - contentPadding: EdgeInsets.zero, - ), - ListTile( - leading: const Icon(Icons.cell_tower), - title: Text(l10n.repeater_sendAdvertZeroHop), - subtitle: Text(l10n.repeater_sendAdvertZeroHopSubtitle), - enabled: !_runningAction, - onTap: _runningAction - ? null - : () => _runAction( - 'advert.zerohop', - l10n.repeater_sendAdvertZeroHop, - ), - contentPadding: EdgeInsets.zero, - ), - ListTile( - leading: const Icon(Icons.access_time), - title: Text(l10n.repeater_clockSync), - subtitle: Text(l10n.repeater_clockSyncSubtitle), - enabled: !_runningAction, - onTap: _runningAction - ? null - : () => _runAction('clock sync', l10n.repeater_clockSync), - contentPadding: EdgeInsets.zero, - ), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(l10n.repeater_actionsTitle), + MeshCard( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + leading: const Icon(Icons.podcasts), + title: Text(l10n.repeater_sendAdvert), + subtitle: Text(l10n.repeater_sendAdvertSubtitle), + enabled: !_runningAction, + onTap: _runningAction + ? null + : () => _runAction('advert', l10n.repeater_sendAdvert), + contentPadding: EdgeInsets.zero, + ), + ListTile( + leading: const Icon(Icons.cell_tower), + title: Text(l10n.repeater_sendAdvertZeroHop), + subtitle: Text(l10n.repeater_sendAdvertZeroHopSubtitle), + enabled: !_runningAction, + onTap: _runningAction + ? null + : () => _runAction( + 'advert.zerohop', + l10n.repeater_sendAdvertZeroHop, + ), + contentPadding: EdgeInsets.zero, + ), + ListTile( + leading: const Icon(Icons.access_time), + title: Text(l10n.repeater_clockSync), + subtitle: Text(l10n.repeater_clockSyncSubtitle), + enabled: !_runningAction, + onTap: _runningAction + ? null + : () => _runAction('clock sync', l10n.repeater_clockSync), + contentPadding: EdgeInsets.zero, + ), + ], + ), ), - ), + ], ); } Widget _buildAdvancedCard() { final l10n = context.l10n; - return Card( + return MeshCard( child: ExpansionTile( leading: const Icon(Icons.tune), title: Text( l10n.repeater_advancedSettings, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600), ), subtitle: Text(l10n.repeater_advancedSettingsSubtitle), - childrenPadding: const EdgeInsets.fromLTRB(16, 12, 16, 16), + childrenPadding: const EdgeInsets.fromLTRB(0, 8, 0, 4), children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -1924,7 +1839,6 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_pathHashMode, helperText: l10n.repeater_pathHashModeHelper, helperMaxLines: 5, - border: const OutlineInputBorder(), ), items: const [ DropdownMenuItem(value: 0, child: Text('0')), @@ -1939,7 +1853,6 @@ class _RepeaterSettingsScreenState extends State { }, ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingPathHashMode, onRefresh: _refreshPathHashMode, @@ -1947,7 +1860,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1958,7 +1871,6 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_txDelay, helperText: l10n.repeater_txDelayHelper, helperMaxLines: 3, - border: const OutlineInputBorder(), ), keyboardType: const TextInputType.numberWithOptions( decimal: true, @@ -1966,7 +1878,6 @@ class _RepeaterSettingsScreenState extends State { onChanged: (_) => _markChanged(_SettingField.txDelay), ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingTxDelay, onRefresh: _refreshTxDelay, @@ -1974,7 +1885,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -1985,7 +1896,6 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_directTxDelay, helperText: l10n.repeater_directTxDelayHelper, helperMaxLines: 3, - border: const OutlineInputBorder(), ), keyboardType: const TextInputType.numberWithOptions( decimal: true, @@ -1993,7 +1903,6 @@ class _RepeaterSettingsScreenState extends State { onChanged: (_) => _markChanged(_SettingField.directTxDelay), ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingDirectTxDelay, onRefresh: _refreshDirectTxDelay, @@ -2001,7 +1910,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -2012,13 +1921,11 @@ class _RepeaterSettingsScreenState extends State { labelText: l10n.repeater_intThresh, helperText: l10n.repeater_intThreshHelper, helperMaxLines: 3, - border: const OutlineInputBorder(), ), keyboardType: TextInputType.number, onChanged: (_) => _markChanged(_SettingField.intThresh), ), ), - const SizedBox(width: 8), _buildInlineRefreshButton( isRefreshing: _refreshingIntThresh, onRefresh: _refreshIntThresh, @@ -2026,7 +1933,7 @@ class _RepeaterSettingsScreenState extends State { ), ], ), - const SizedBox(height: 16), + const SizedBox(height: 12), Row( children: [ Expanded( @@ -2077,85 +1984,72 @@ class _RepeaterSettingsScreenState extends State { Widget _buildDangerZoneCard() { final l10n = context.l10n; - final colorScheme = Theme.of(context).colorScheme; - return Card( - color: colorScheme.errorContainer, - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon(Icons.warning, color: colorScheme.onErrorContainer), - const SizedBox(width: 8), - Text( - l10n.repeater_dangerZone, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: colorScheme.onErrorContainer, - ), - ), - ], - ), - const Divider(), - ListTile( - leading: Icon(Icons.refresh, color: colorScheme.onErrorContainer), - title: Text( - l10n.repeater_rebootRepeater, - style: TextStyle(color: colorScheme.onErrorContainer), - ), - subtitle: Text( - l10n.repeater_rebootRepeaterSubtitle, - style: TextStyle( - color: colorScheme.onErrorContainer.withValues(alpha: 0.8), + return MeshCard( + color: MeshPalette.alertBg, + borderColor: MeshPalette.alertLine, + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Icon(Icons.warning, color: MeshPalette.alert), + const SizedBox(width: 8), + Text( + l10n.repeater_dangerZone, + style: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.w700, + color: MeshPalette.alert, ), ), - onTap: () => _confirmAction( - l10n.repeater_rebootRepeater, - l10n.repeater_rebootRepeaterConfirm, - () => _sendDangerCommand('reboot'), + ], + ), + const Divider(height: 20, color: MeshPalette.alertLine), + ListTile( + leading: const Icon(Icons.refresh, color: MeshPalette.alert), + title: Text( + l10n.repeater_rebootRepeater, + style: const TextStyle(color: MeshPalette.alert), + ), + subtitle: Text( + l10n.repeater_rebootRepeaterSubtitle, + style: const TextStyle( + color: MeshPalette.warnDim, ), ), - // Regenerate identity key - hidden until fully implemented - // ListTile( - // leading: Icon(Icons.vpn_key, color: colorScheme.onErrorContainer), - // title: Text('Regenerate Identity Key', style: TextStyle(color: colorScheme.onErrorContainer)), - // subtitle: Text( - // 'Generate new public/private key pair', - // style: TextStyle(color: colorScheme.onErrorContainer.withValues(alpha: 0.8)), - // ), - // onTap: () => _confirmAction( - // 'Regenerate Identity', - // 'This will generate a new identity for the repeater. Continue?', - // () => _sendDangerCommand('regen key'), - // ), - // ), - ListTile( - leading: Icon( - Icons.delete_forever, - color: colorScheme.onErrorContainer, - ), - title: Text( - l10n.repeater_eraseFileSystem, - style: TextStyle(color: colorScheme.onErrorContainer), - ), - subtitle: Text( - l10n.repeater_eraseFileSystemSubtitle, - style: TextStyle( - color: colorScheme.onErrorContainer.withValues(alpha: 0.8), - ), - ), - onTap: () => _confirmAction( - l10n.repeater_eraseFileSystem, - l10n.repeater_eraseFileSystemConfirm, - () => _sendDangerCommand('erase'), - isDestructive: true, + onTap: () => _confirmAction( + l10n.repeater_rebootRepeater, + l10n.repeater_rebootRepeaterConfirm, + () => _sendDangerCommand('reboot'), + ), + contentPadding: EdgeInsets.zero, + ), + // Regenerate identity key - hidden until fully implemented + ListTile( + leading: const Icon( + Icons.delete_forever, + color: MeshPalette.alert, + ), + title: Text( + l10n.repeater_eraseFileSystem, + style: const TextStyle(color: MeshPalette.alert), + ), + subtitle: Text( + l10n.repeater_eraseFileSystemSubtitle, + style: const TextStyle( + color: MeshPalette.warnDim, ), ), - ], - ), + onTap: () => _confirmAction( + l10n.repeater_eraseFileSystem, + l10n.repeater_eraseFileSystemConfirm, + () => _sendDangerCommand('erase'), + isDestructive: true, + ), + contentPadding: EdgeInsets.zero, + ), + ], ), ); } diff --git a/lib/screens/repeater_status_screen.dart b/lib/screens/repeater_status_screen.dart index f121605d..080d5b7f 100644 --- a/lib/screens/repeater_status_screen.dart +++ b/lib/screens/repeater_status_screen.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; @@ -10,7 +11,9 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../services/app_settings_service.dart'; import '../services/repeater_command_service.dart'; +import '../theme/mesh_theme.dart'; import '../utils/battery_utils.dart'; +import '../widgets/mesh_ui.dart'; import '../widgets/routing_sheet.dart'; import '../helpers/snack_bar_builder.dart'; @@ -64,8 +67,6 @@ class _RepeaterStatusScreenState extends State { final connector = Provider.of(context, listen: false); _commandService = RepeaterCommandService(connector); _setupMessageListener(); - // Defer until after the first frame so any notifyListeners() triggered - // during preparePathForContactSend doesn't fire mid-build. WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) _loadStatus(); }); @@ -81,12 +82,8 @@ class _RepeaterStatusScreenState extends State { void _setupMessageListener() { final connector = Provider.of(context, listen: false); - - // Listen for incoming text messages from the repeater _frameSubscription = connector.receivedFrames.listen((frame) { if (frame.isEmpty) return; - - // Check if it's a text message response if (frame[0] == pushCodeStatusResponse) { _handleStatusResponse(frame); } else if (frame[0] == respCodeContactMsgRecv || @@ -118,11 +115,7 @@ class _RepeaterStatusScreenState extends State { final parsed = parseContactMessageText(frame); if (parsed == null) return; if (!_matchesRepeaterPrefix(parsed.senderPrefix)) return; - - // Notify command service of response (for retry handling) _commandService?.handleResponse(widget.repeater, parsed.text); - - // Parse status responses _parseStatusResponse(parsed.text); _recordStatusResult(true); } @@ -131,7 +124,6 @@ class _RepeaterStatusScreenState extends State { if (frame.length < 8) return; final prefix = frame.sublist(2, 8); if (!_matchesRepeaterPrefix(prefix)) return; - if (frame.length < _statusResponseBytes) return; final data = ByteData.sublistView( @@ -254,14 +246,9 @@ class _RepeaterStatusScreenState extends State { _dupFlood = _asInt(data['dup_flood']); _dupDirect = _asInt(data['dup_direct']); } - } catch (_) { - // Ignore parse failures for non-JSON responses. - } - } - - if (mounted) { - setState(() {}); + } catch (_) {} } + if (mounted) setState(() {}); } Future _loadStatus() async { @@ -302,9 +289,7 @@ class _RepeaterStatusScreenState extends State { var messageBytes = frame.length >= _statusResponseBytes ? frame.length : _statusResponseBytes; - if (messageBytes < maxFrameSize) { - messageBytes = maxFrameSize; - } + if (messageBytes < maxFrameSize) messageBytes = maxFrameSize; final timeoutMs = connector.calculateTimeout( pathLength: pathLengthValue, messageBytes: messageBytes, @@ -312,9 +297,7 @@ class _RepeaterStatusScreenState extends State { _statusTimeout?.cancel(); _statusTimeout = Timer(Duration(milliseconds: timeoutMs), () { if (!mounted) return; - setState(() { - _isLoading = false; - }); + setState(() => _isLoading = false); showDismissibleSnackBar( context, content: Text(context.l10n.repeater_statusRequestTimeout), @@ -324,10 +307,7 @@ class _RepeaterStatusScreenState extends State { }); } catch (e) { if (mounted) { - setState(() { - _isLoading = false; - }); - + setState(() => _isLoading = false); showDismissibleSnackBar( context, content: Text(context.l10n.repeater_errorLoadingStatus(e.toString())), @@ -347,214 +327,6 @@ class _RepeaterStatusScreenState extends State { _pendingStatusSelection = null; } - @override - Widget build(BuildContext context) { - final l10n = context.l10n; - final connector = context.watch(); - final repeater = _resolveRepeater(connector); - final isFloodMode = repeater.pathOverride == -1; - - return Scaffold( - appBar: AppBar( - title: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - l10n.repeater_statusTitle, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - repeater.name, - style: const TextStyle( - fontSize: 14, - fontWeight: FontWeight.normal, - ), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ], - ), - centerTitle: false, - actions: [ - IconButton( - icon: Icon(isFloodMode ? Icons.waves : Icons.route), - tooltip: l10n.repeater_routingMode, - onPressed: () => - ContactRoutingSheet.show(context, contact: repeater), - ), - IconButton( - icon: _isLoading - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh), - onPressed: _isLoading ? null : _loadStatus, - tooltip: l10n.repeater_refresh, - ), - ], - ), - body: SafeArea( - top: false, - child: RefreshIndicator( - onRefresh: _loadStatus, - child: ListView( - padding: const EdgeInsets.all(16), - children: [ - _buildSystemInfoCard(), - const SizedBox(height: 16), - _buildRadioStatsCard(), - const SizedBox(height: 16), - _buildPacketStatsCard(), - ], - ), - ), - ), - ); - } - - Widget _buildSystemInfoCard() { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_systemInformation, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildInfoRow(l10n.repeater_battery, _batteryText()), - _buildInfoRow(l10n.repeater_clockAtLogin, _clockText()), - _buildInfoRow(l10n.repeater_uptime, _formatDuration(_uptimeSecs)), - _buildInfoRow(l10n.repeater_queueLength, _formatValue(_queueLen)), - _buildInfoRow(l10n.repeater_debugFlags, _formatValue(_debugFlags)), - ], - ), - ), - ); - } - - Widget _buildRadioStatsCard() { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.radio, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_radioStatistics, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildInfoRow( - l10n.repeater_lastRssi, - _formatValue(_lastRssi, suffix: ' dB'), - ), - _buildInfoRow(l10n.repeater_lastSnr, _formatSnr(_lastSnr)), - _buildInfoRow( - l10n.repeater_noiseFloor, - _formatValue(_noiseFloor, suffix: ' dB'), - ), - _buildInfoRow(l10n.repeater_txAirtime, _formatDuration(_txAirSecs)), - _buildInfoRow(l10n.repeater_rxAirtime, _formatDuration(_rxAirSecs)), - ], - ), - ), - ); - } - - Widget _buildPacketStatsCard() { - final l10n = context.l10n; - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.analytics, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.repeater_packetStatistics, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildInfoRow(l10n.repeater_sent, _packetTxText()), - _buildInfoRow(l10n.repeater_received, _packetRxText()), - _buildInfoRow(l10n.repeater_duplicates, _duplicateText()), - _buildInfoRow(l10n.repeater_chanUtil, _chanUtilText()), - ], - ), - ), - ); - } - - Widget _buildInfoRow(String label, String value) { - return Padding( - padding: const EdgeInsets.symmetric(vertical: 6), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Text( - label, - style: TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, - fontWeight: FontWeight.w500, - ), - ), - ), - const SizedBox(width: 8), - Text( - value, - style: const TextStyle(fontWeight: FontWeight.w400), - textAlign: TextAlign.end, - ), - ], - ), - ); - } - int? _asInt(dynamic value) { if (value == null) return null; if (value is int) return value; @@ -661,4 +433,218 @@ class _RepeaterStatusScreenState extends State { if (snr == null) return '—'; return snr.toStringAsFixed(2); } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final connector = context.watch(); + final repeater = _resolveRepeater(connector); + final isFloodMode = repeater.pathOverride == -1; + + return Scaffold( + appBar: AppBar( + title: Text(l10n.repeater_statusTitle), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(isFloodMode ? Icons.waves : Icons.route), + tooltip: l10n.repeater_routingMode, + onPressed: () => + ContactRoutingSheet.show(context, contact: repeater), + ), + IconButton( + icon: _isLoading + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.refresh), + onPressed: _isLoading ? null : _loadStatus, + tooltip: l10n.repeater_refresh, + ), + ], + ), + body: SafeArea( + top: false, + child: RefreshIndicator( + onRefresh: _loadStatus, + child: _isLoading && _batteryMv == null + ? const Center(child: CircularProgressIndicator()) + : _buildBody(l10n, repeater.name), + ), + ), + ); + } + + Widget _buildBody(dynamic l10n, String name) { + final scheme = Theme.of(context).colorScheme; + return ListView( + padding: const EdgeInsets.only(bottom: 24), + children: [ + // ── System ───────────────────────────────────────────────────────── + SectionHeader(l10n.repeater_systemInformation), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _buildStatGrid([ + _StatItem( + icon: Icons.battery_std, + label: l10n.repeater_battery, + value: _batteryText(), + color: _batteryColor(), + ), + _StatItem( + icon: Icons.timer_outlined, + label: l10n.repeater_uptime, + value: _formatDuration(_uptimeSecs), + color: MeshPalette.blue, + ), + _StatItem( + icon: Icons.schedule, + label: l10n.repeater_clockAtLogin, + value: _clockText(), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.inbox, + label: l10n.repeater_queueLength, + value: _formatValue(_queueLen), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.bug_report_outlined, + label: l10n.repeater_debugFlags, + value: _formatValue(_debugFlags), + color: _debugFlags != null && _debugFlags! > 0 + ? MeshPalette.warn + : scheme.onSurfaceVariant, + ), + ]), + ), + + // ── Radio ────────────────────────────────────────────────────────── + SectionHeader(l10n.repeater_radioStatistics), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _buildStatGrid([ + _StatItem( + icon: Icons.signal_cellular_alt, + label: l10n.repeater_lastRssi, + value: _formatValue(_lastRssi, suffix: ' dB'), + color: MeshPalette.blue, + ), + _StatItem( + icon: Icons.waves, + label: l10n.repeater_lastSnr, + value: _formatSnr(_lastSnr), + color: MeshTheme.snrColor(_lastSnr, blocked: false), + ), + _StatItem( + icon: Icons.noise_control_off, + label: l10n.repeater_noiseFloor, + value: _formatValue(_noiseFloor, suffix: ' dB'), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.upload, + label: l10n.repeater_txAirtime, + value: _formatDuration(_txAirSecs), + color: MeshPalette.warn, + ), + _StatItem( + icon: Icons.download, + label: l10n.repeater_rxAirtime, + value: _formatDuration(_rxAirSecs), + color: MeshPalette.signal, + ), + ]), + ), + + // ── Packets ──────────────────────────────────────────────────────── + SectionHeader(l10n.repeater_packetStatistics), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _buildStatGrid([ + _StatItem( + icon: Icons.send, + label: l10n.repeater_sent, + value: _packetTxText(), + color: MeshPalette.blue, + ), + _StatItem( + icon: Icons.call_received, + label: l10n.repeater_received, + value: _packetRxText(), + color: MeshPalette.signal, + ), + _StatItem( + icon: Icons.content_copy, + label: l10n.repeater_duplicates, + value: _duplicateText(), + color: scheme.onSurfaceVariant, + ), + _StatItem( + icon: Icons.percent, + label: l10n.repeater_chanUtil, + value: _chanUtilText(), + color: _chanUtil != null && _chanUtil! > 80 + ? MeshPalette.alert + : _chanUtil != null && _chanUtil! > 50 + ? MeshPalette.warn + : MeshPalette.signal, + ), + ]), + ), + const SizedBox(height: 8), + ], + ); + } + + Color _batteryColor() { + final connector = context.watch(); + final batteryMv = + connector.getRepeaterBatteryMillivolts(widget.repeater.publicKeyHex) ?? + _batteryMv; + if (batteryMv == null) return Theme.of(context).colorScheme.onSurfaceVariant; + final percent = estimateBatteryPercentFromMillivolts( + batteryMv, + _batteryChemistry(), + ); + if (percent < 20) return MeshPalette.alert; + if (percent < 40) return MeshPalette.warn; + return MeshPalette.signal; + } + + Widget _buildStatGrid(List<_StatItem> items) { + return GridView.count( + crossAxisCount: 2, + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + mainAxisSpacing: 8, + crossAxisSpacing: 8, + childAspectRatio: 2.2, + children: items + .map((item) => StatTile( + icon: item.icon, + label: item.label, + value: item.value, + color: item.color, + )) + .toList(), + ); + } +} + +class _StatItem { + final IconData icon; + final String label; + final String value; + final Color color; + + const _StatItem({ + required this.icon, + required this.label, + required this.value, + required this.color, + }); } diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index 1fd2c53c..212ab819 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import '../utils/platform_info.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; import 'package:provider/provider.dart'; @@ -7,10 +8,12 @@ import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; import '../services/linux_ble_error_classifier.dart'; +import '../theme/mesh_theme.dart'; import '../utils/app_logger.dart'; import '../widgets/adaptive_app_bar_title.dart'; import '../widgets/device_tile.dart'; import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; import 'tcp_screen.dart'; @@ -136,12 +139,21 @@ class _ScannerScreenState extends State { builder: (context, connector, child) { return Column( children: [ - // Bluetooth off warning - if (_bluetoothState == BluetoothAdapterState.off) - _bluetoothOffWarning(context), + // Bluetooth off warning — slides in/out with AnimatedSize + AnimatedSize( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOut, + child: _bluetoothState == BluetoothAdapterState.off + ? _BluetoothOffBanner( + onEnable: PlatformInfo.isAndroid + ? () => FlutterBluePlus.turnOn() + : null, + ) + : const SizedBox.shrink(), + ), - // Status bar - _buildStatusBar(context, connector), + // Connection status header + _ConnectionStatusHeader(connector: connector), // Device list Expanded(child: _buildDeviceList(context, connector)), @@ -158,14 +170,31 @@ class _ScannerScreenState extends State { return FloatingActionButton.extended( heroTag: 'scanner_ble_action', - onPressed: isBluetoothOff ? null : () => _toggleScan(connector), - icon: isScanning - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.bluetooth_searching), + onPressed: isBluetoothOff + ? null + : () { + HapticFeedback.lightImpact(); + _toggleScan(connector); + }, + icon: AnimatedSwitcher( + duration: const Duration(milliseconds: 220), + transitionBuilder: (child, anim) => + ScaleTransition(scale: anim, child: child), + child: isScanning + ? SizedBox( + key: const ValueKey('scanning'), + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Theme.of(context).colorScheme.onPrimary, + ), + ) + : const Icon( + Icons.bluetooth_searching, + key: ValueKey('idle'), + ), + ), label: Text( isScanning ? context.l10n.scanner_stop @@ -189,51 +218,6 @@ class _ScannerScreenState extends State { } } - Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { - String statusText; - Color statusColor; - - final l10n = context.l10n; - switch (connector.state) { - case MeshCoreConnectionState.scanning: - statusText = l10n.scanner_scanning; - statusColor = Colors.blue; - break; - case MeshCoreConnectionState.connecting: - statusText = l10n.scanner_connecting; - statusColor = Colors.orange; - break; - case MeshCoreConnectionState.connected: - statusText = l10n.scanner_connectedTo(connector.deviceDisplayName); - statusColor = Colors.green; - break; - case MeshCoreConnectionState.disconnecting: - statusText = l10n.scanner_disconnecting; - statusColor = Colors.orange; - break; - case MeshCoreConnectionState.disconnected: - statusText = l10n.scanner_notConnected; - statusColor = Colors.grey; - break; - } - - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - color: statusColor.withValues(alpha: 0.1), - child: Row( - children: [ - Icon(Icons.circle, size: 12, color: statusColor), - const SizedBox(width: 8), - Text( - statusText, - style: TextStyle(color: statusColor, fontWeight: FontWeight.w500), - ), - ], - ), - ); - } - Widget _buildDeviceList(BuildContext context, MeshCoreConnector connector) { if (connector.scanResults.isEmpty) { final isBluetoothOff = _bluetoothState == BluetoothAdapterState.off; @@ -251,7 +235,10 @@ class _ScannerScreenState extends State { action: (isBluetoothOff || isScanning) ? null : FilledButton.icon( - onPressed: () => _toggleScan(connector), + onPressed: () { + HapticFeedback.lightImpact(); + _toggleScan(connector); + }, icon: const Icon(Icons.bluetooth_searching), label: Text(context.l10n.scanner_scan), ), @@ -259,19 +246,21 @@ class _ScannerScreenState extends State { } final isConnecting = connector.state == MeshCoreConnectionState.connecting; - return ListView.separated( - padding: const EdgeInsets.all(8), + return ListView.builder( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 96), itemCount: connector.scanResults.length, - separatorBuilder: (context, index) => const Divider(), itemBuilder: (context, index) { final result = connector.scanResults[index]; final deviceId = result.device.remoteId.toString(); - return DeviceTile( - scanResult: result, - isConnecting: isConnecting && _connectingDeviceId == deviceId, - onTap: isConnecting - ? null - : () => _connectToDevice(context, connector, result), + return ListEntrance( + index: index, + child: DeviceTile( + scanResult: result, + isConnecting: isConnecting && _connectingDeviceId == deviceId, + onTap: isConnecting + ? null + : () => _connectToDevice(context, connector, result), + ), ); }, ); @@ -413,47 +402,117 @@ class _ScannerScreenState extends State { ); return pin; } +} - Widget _bluetoothOffWarning(BuildContext context) { - final errorColor = Theme.of(context).colorScheme.error; - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16), - color: errorColor.withValues(alpha: 0.15), +// ── Private sub-widgets ──────────────────────────────────────────────────── + +/// Bluetooth-off warning banner — styled as an alert MeshCard. +class _BluetoothOffBanner extends StatelessWidget { + final VoidCallback? onEnable; + + const _BluetoothOffBanner({this.onEnable}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + color: scheme.error.withValues(alpha: 0.08), + borderColor: scheme.error.withValues(alpha: 0.35), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), child: Row( children: [ - Icon(Icons.bluetooth_disabled, size: 24, color: errorColor), - const SizedBox(width: 12), + Icon(Icons.bluetooth_disabled, size: 20, color: scheme.error), + const SizedBox(width: 10), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ Text( context.l10n.scanner_bluetoothOff, style: TextStyle( - color: errorColor, + color: scheme.error, fontWeight: FontWeight.w600, - fontSize: 14, + fontSize: 13.5, ), ), - const SizedBox(height: 4), + const SizedBox(height: 2), Text( context.l10n.scanner_bluetoothOffMessage, style: TextStyle( - color: errorColor.withValues(alpha: 0.85), + color: scheme.error.withValues(alpha: 0.8), fontSize: 12, ), ), ], ), ), - if (PlatformInfo.isAndroid) + if (onEnable != null) ...[ + const SizedBox(width: 8), TextButton( - onPressed: () => FlutterBluePlus.turnOn(), + onPressed: onEnable, child: Text(context.l10n.scanner_enableBluetooth), ), + ], ], ), ); } } + +/// Connection status header with AnimatedSwitcher between states. +class _ConnectionStatusHeader extends StatelessWidget { + final MeshCoreConnector connector; + + const _ConnectionStatusHeader({required this.connector}); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + + final (String label, Color color, bool pulse) = switch (connector.state) { + MeshCoreConnectionState.scanning => ( + l10n.scanner_scanning, + MeshPalette.blue, + true, + ), + MeshCoreConnectionState.connecting => ( + l10n.scanner_connecting, + MeshPalette.warn, + true, + ), + MeshCoreConnectionState.connected => ( + l10n.scanner_connectedTo(connector.deviceDisplayName), + MeshPalette.signal, + false, + ), + MeshCoreConnectionState.disconnecting => ( + l10n.scanner_disconnecting, + MeshPalette.warn, + true, + ), + MeshCoreConnectionState.disconnected => ( + l10n.scanner_notConnected, + scheme.onSurfaceVariant, + false, + ), + }; + + return Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: Align( + key: ValueKey(connector.state), + alignment: Alignment.centerLeft, + child: StatusChip( + label: label, + color: color, + pulse: pulse, + ), + ), + ), + ); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index b6eefb05..3d12016a 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -10,8 +10,10 @@ import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; import '../models/radio_settings.dart'; import '../services/app_debug_log_service.dart'; +import '../theme/mesh_theme.dart'; import '../widgets/app_bar.dart'; import '../helpers/snack_bar_builder.dart'; +import '../widgets/mesh_ui.dart'; import 'app_settings_screen.dart'; import 'app_debug_log_screen.dart'; import 'ble_debug_log_screen.dart'; @@ -69,6 +71,7 @@ class _SettingsScreenState extends State { indicators: false, subtitle: false, ), + centerTitle: true, bottom: const SyncProgressAppBarBottom(), ), body: SafeArea( @@ -76,21 +79,81 @@ class _SettingsScreenState extends State { child: Consumer( builder: (context, connector, child) { return ListView( - padding: const EdgeInsets.all(16), + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), children: [ - _buildDeviceInfoCard(context, connector), - const SizedBox(height: 16), - _buildAppSettingsCard(context), - const SizedBox(height: 16), - _buildNodeSettingsCard(context, connector), - const SizedBox(height: 16), - _buildActionsCard(context, connector), - const SizedBox(height: 16), - _buildDebugCard(context), - const SizedBox(height: 16), - _buildExportCard(connector), - const SizedBox(height: 16), - _buildAboutCard(context), + // IDENTITY section + SectionHeader(l10n.settings_deviceInfo), + MeshCard( + padding: EdgeInsets.zero, + child: _buildIdentityCardContent(context, connector), + ), + + // NODE section + SectionHeader(l10n.settings_nodeSettings), + MeshCard( + padding: EdgeInsets.zero, + child: _buildNodeCardContent(context, connector), + ), + + // LOCATION section + SectionHeader(l10n.settings_location), + MeshCard( + padding: EdgeInsets.zero, + child: _buildLocationCardContent(context, connector), + ), + + // APP SETTINGS + SectionHeader(l10n.settings_appSettings), + MeshCard( + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => const AppSettingsScreen(), + ), + ), + child: _buildNavTileContent( + context, + icon: Icons.settings_outlined, + title: l10n.settings_appSettings, + subtitle: l10n.settings_appSettingsSubtitle, + ), + ), + + // ACTIONS section + SectionHeader(l10n.settings_actions), + MeshCard( + padding: EdgeInsets.zero, + child: _buildActionsCardContent(context, connector), + ), + + // EXPORT section + SectionHeader(l10n.settings_gpxExportRepeaters), + MeshCard( + padding: EdgeInsets.zero, + child: _buildExportCardContent(context, connector), + ), + + // DEBUG section + SectionHeader(l10n.settings_debug), + MeshCard( + padding: EdgeInsets.zero, + child: _buildDebugCardContent(context), + ), + + // ABOUT + SectionHeader(l10n.settings_about), + MeshCard( + onTap: () => _showAbout(context), + child: _buildNavTileContent( + context, + icon: Icons.info_outline, + title: l10n.settings_about, + subtitle: l10n.settings_aboutVersion( + _appVersion.isEmpty ? l10n.common_loading : _appVersion, + ), + showChevron: false, + ), + ), ], ); }, @@ -99,91 +162,217 @@ class _SettingsScreenState extends State { ); } - Widget _buildDeviceInfoCard( + Widget _buildNavTileContent( + BuildContext context, { + required IconData icon, + required String title, + required String subtitle, + bool showChevron = true, + }) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + return Row( + children: [ + Icon(icon, size: 20, color: scheme.onSurfaceVariant), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + if (showChevron) + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], + ); + } + + Widget _buildIdentityCardContent( BuildContext context, MeshCoreConnector connector, ) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; - return Card( + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Header row: device name + status chip + expand toggle + InkWell( + onTap: () { + setState(() { + _deviceInfoExpanded = !_deviceInfoExpanded; + }); + }, + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 14, 16, 14), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + connector.deviceDisplayName, + style: MeshTheme.mono( + fontSize: 16, + fontWeight: FontWeight.w700, + color: scheme.onSurface, + ), + ), + const SizedBox(height: 4), + StatusChip( + label: connector.isConnected + ? l10n.common_connected + : l10n.common_disconnected, + color: connector.isConnected + ? MeshPalette.blue + : scheme.onSurfaceVariant, + pulse: connector.isConnected, + ), + ], + ), + ), + AnimatedRotation( + turns: _deviceInfoExpanded ? 0.5 : 0, + duration: const Duration(milliseconds: 200), + child: Icon( + Icons.expand_more, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ), + + // Expandable detail rows + AnimatedSize( + duration: const Duration(milliseconds: 200), + alignment: Alignment.topCenter, + child: _deviceInfoExpanded + ? Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Divider(height: 1), + const SizedBox(height: 10), + _infoRow( + context, + label: l10n.settings_infoId, + value: connector.deviceIdLabel, + ), + _buildBatteryInfoRow(context, connector), + if (connector.selfName != null) + _infoRow( + context, + label: l10n.settings_nodeName, + value: connector.selfName!, + ), + if (connector.selfPublicKey != null) + _infoRow( + context, + label: l10n.settings_infoPublicKey, + value: + '${pubKeyToHex(connector.selfPublicKey!).substring(0, 16)}...', + mono: true, + ), + _infoRow( + context, + label: l10n.settings_infoContactsCount, + value: '${connector.contacts.length}', + ), + _infoRow( + context, + label: l10n.settings_infoChannelCount, + value: '${connector.channels.length}', + ), + ], + ), + ) + : const SizedBox.shrink(), + ), + ], + ); + } + + Widget _infoRow( + BuildContext context, { + required String label, + required String value, + bool mono = false, + Widget? leading, + Color? valueColor, + VoidCallback? onTap, + }) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + final content = Padding( + padding: const EdgeInsets.symmetric(vertical: 6), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - borderRadius: BorderRadius.circular(12), - onTap: () { - setState(() { - _deviceInfoExpanded = !_deviceInfoExpanded; - }); - }, - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 16), - child: Row( - children: [ - Expanded( - child: Text( - l10n.settings_deviceInfo, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - AnimatedRotation( - turns: _deviceInfoExpanded ? 0.5 : 0, - duration: const Duration(milliseconds: 200), - child: const Icon(Icons.expand_more), - ), - ], + Row( + children: [ + if (leading != null) ...[leading, const SizedBox(width: 6)], + Text( + label, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + fontWeight: FontWeight.w500, + ), ), - ), + ], ), - - AnimatedCrossFade( - firstChild: const SizedBox.shrink(), - secondChild: Padding( - padding: const EdgeInsets.fromLTRB(16, 0, 16, 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - _buildInfoRow( - l10n.settings_infoName, - connector.deviceDisplayName, + const SizedBox(height: 2), + mono + ? Text( + value, + style: MeshTheme.mono( + fontSize: 13, + fontWeight: FontWeight.w500, + color: valueColor ?? scheme.onSurface, ), - _buildInfoRow(l10n.settings_infoId, connector.deviceIdLabel), - _buildInfoRow( - l10n.settings_infoStatus, - connector.isConnected - ? l10n.common_connected - : l10n.common_disconnected, + ) + : Text( + value, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + color: valueColor, ), - _buildBatteryInfoRow(context, connector), - if (connector.selfName != null) - _buildInfoRow(l10n.settings_nodeName, connector.selfName!), - if (connector.selfPublicKey != null) - _buildInfoRow( - l10n.settings_infoPublicKey, - '${pubKeyToHex(connector.selfPublicKey!).substring(0, 16)}...', - ), - _buildInfoRow( - l10n.settings_infoContactsCount, - '${connector.contacts.length}', - ), - _buildInfoRow( - l10n.settings_infoChannelCount, - '${connector.channels.length}', - ), - ], - ), - ), - crossFadeState: _deviceInfoExpanded - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - duration: const Duration(milliseconds: 200), - ), + ), ], ), ); + + if (onTap != null) { + return InkWell( + borderRadius: BorderRadius.circular(MeshRadii.xs), + onTap: onTap, + child: content, + ); + } + return content; } Widget _buildBatteryInfoRow( @@ -194,7 +383,6 @@ class _SettingsScreenState extends State { final percent = connector.batteryPercent; final millivolts = connector.batteryMillivolts; - // figure out display value final String displayValue; if (millivolts == null) { displayValue = l10n.common_notAvailable; @@ -226,10 +414,11 @@ class _SettingsScreenState extends State { valueColor = null; } - return _buildInfoRow( - l10n.settings_infoBattery, - displayValue, - leading: Icon(icon, size: 18, color: iconColor), + return _infoRow( + context, + label: l10n.settings_infoBattery, + value: displayValue, + leading: Icon(icon, size: 14, color: iconColor), valueColor: valueColor, onTap: millivolts != null ? () { @@ -241,260 +430,279 @@ class _SettingsScreenState extends State { ); } - Widget _buildAppSettingsCard(BuildContext context) { - final l10n = context.l10n; - return Card( - child: ListTile( - leading: const Icon(Icons.settings_outlined), - title: Text(l10n.settings_appSettings), - subtitle: Text(l10n.settings_appSettingsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => const AppSettingsScreen()), - ); - }, - ), - ); - } - - Widget _buildNodeSettingsCard( + Widget _buildNodeCardContent( BuildContext context, MeshCoreConnector connector, ) { final l10n = context.l10n; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - l10n.settings_nodeSettings, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.person_outline), - title: Text(l10n.settings_nodeName), - subtitle: Text(connector.selfName ?? l10n.settings_nodeNameNotSet), - trailing: const Icon(Icons.chevron_right), - onTap: () => _editNodeName(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.radio), - title: Text(l10n.settings_radioSettings), - subtitle: Text(l10n.settings_radioSettingsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _showRadioSettings(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.sensors_outlined), - title: Text(l10n.radioStats_settingsTile), - subtitle: Text(l10n.radioStats_settingsSubtitle), - trailing: const Icon(Icons.chevron_right), - enabled: - connector.isConnected && connector.supportsCompanionRadioStats, - onTap: () => pushCompanionRadioStatsScreen(context), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.location_on_outlined), - title: Text(l10n.settings_location), - subtitle: Text(l10n.settings_locationSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _editLocation(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.group_add_outlined), - title: Text(l10n.settings_contactSettings), - subtitle: Text(l10n.settings_contactSettingsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _editAutoAddConfig(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.visibility_off_outlined), - title: Text(l10n.settings_privacy), - subtitle: Text(l10n.settings_privacySubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () => _privacySettings(context, connector), - ), - ], - ), - ); - } - - Widget _buildActionsCard(BuildContext context, MeshCoreConnector connector) { - final l10n = context.l10n; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - l10n.settings_actions, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: Icon( - Icons.delete_outline, - color: Theme.of(context).colorScheme.error, - ), - title: Text(l10n.settings_deleteAllPaths), - subtitle: Text( - l10n.settings_deleteAllPathsSubtitle, - style: TextStyle(color: Theme.of(context).colorScheme.error), - ), - onTap: () => _confirmDeleteAllPaths(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.sync), - title: Text(l10n.settings_syncTime), - subtitle: Text(l10n.settings_syncTimeSubtitle), - onTap: () => _syncTime(context, connector), - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.refresh), - title: Text(l10n.settings_refreshContacts), - subtitle: Text(l10n.settings_refreshContactsSubtitle), - onTap: () => connector.getContacts(), - ), - const Divider(height: 1), - ListTile( - leading: Icon( - Icons.restart_alt, - color: Theme.of(context).colorScheme.tertiary, - ), - title: Text(l10n.settings_rebootDevice), - subtitle: Text(l10n.settings_rebootDeviceSubtitle), - onTap: () => _confirmReboot(context, connector), - ), - ], - ), - ); - } - - Widget _buildAboutCard(BuildContext context) { - final l10n = context.l10n; - return Card( - child: ListTile( - leading: const Icon(Icons.info_outline), - title: Text(l10n.settings_about), - subtitle: Text( - l10n.settings_aboutVersion( - _appVersion.isEmpty ? l10n.common_loading : _appVersion, - ), + return Column( + children: [ + _tappableTile( + context, + icon: Icons.person_outline, + title: l10n.settings_nodeName, + subtitle: connector.selfName ?? l10n.settings_nodeNameNotSet, + onTap: () => _editNodeName(context, connector), ), - onTap: () => _showAbout(context), - ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.radio, + title: l10n.settings_radioSettings, + subtitle: l10n.settings_radioSettingsSubtitle, + onTap: () => _showRadioSettings(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.sensors_outlined, + title: l10n.radioStats_settingsTile, + subtitle: l10n.radioStats_settingsSubtitle, + onTap: connector.isConnected && connector.supportsCompanionRadioStats + ? () => pushCompanionRadioStatsScreen(context) + : null, + ), + ], ); } - Widget _buildDebugCard(BuildContext context) { + Widget _buildLocationCardContent( + BuildContext context, + MeshCoreConnector connector, + ) { final l10n = context.l10n; - return Card( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), - child: Text( - l10n.settings_debug, - style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ), - ListTile( - leading: const Icon(Icons.bluetooth_outlined), - title: Text(l10n.settings_companionDebugLog), - subtitle: Text(l10n.settings_companionDebugLogSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const BleDebugLogScreen(), - ), - ); - }, - ), - const Divider(height: 1), - ListTile( - leading: const Icon(Icons.code_outlined), - title: Text(l10n.settings_appDebugLog), - subtitle: Text(l10n.settings_appDebugLogSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => const AppDebugLogScreen(), - ), - ); - }, - ), - ], - ), + return Column( + children: [ + _tappableTile( + context, + icon: Icons.location_on_outlined, + title: l10n.settings_location, + subtitle: l10n.settings_locationSubtitle, + onTap: () => _editLocation(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.group_add_outlined, + title: l10n.settings_contactSettings, + subtitle: l10n.settings_contactSettingsSubtitle, + onTap: () => _editAutoAddConfig(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.visibility_off_outlined, + title: l10n.settings_privacy, + subtitle: l10n.settings_privacySubtitle, + onTap: () => _privacySettings(context, connector), + ), + ], ); } - Widget _buildInfoRow( - String label, - String value, { - Widget? leading, - Color? valueColor, - VoidCallback? onTap, - }) { - final theme = Theme.of(context); + Widget _buildActionsCardContent( + BuildContext context, + MeshCoreConnector connector, + ) { + final l10n = context.l10n; + return Column( + children: [ + _tappableTile( + context, + icon: Icons.sync, + title: l10n.settings_syncTime, + subtitle: l10n.settings_syncTimeSubtitle, + onTap: () => _syncTime(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.refresh, + title: l10n.settings_refreshContacts, + subtitle: l10n.settings_refreshContactsSubtitle, + onTap: () => connector.getContacts(), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.restart_alt, + title: l10n.settings_rebootDevice, + subtitle: l10n.settings_rebootDeviceSubtitle, + titleColor: MeshPalette.warn, + iconColor: MeshPalette.warn, + onTap: () => _confirmReboot(context, connector), + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.delete_outline, + title: l10n.settings_deleteAllPaths, + subtitle: l10n.settings_deleteAllPathsSubtitle, + titleColor: MeshPalette.alert, + iconColor: MeshPalette.alert, + onTap: () => _confirmDeleteAllPaths(context, connector), + ), + ], + ); + } - final row = Padding( - padding: const EdgeInsets.symmetric(vertical: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - if (leading != null) ...[leading, const SizedBox(width: 8)], - Expanded( - child: Text( - label, - style: theme.textTheme.bodySmall?.copyWith( - color: theme.colorScheme.onSurfaceVariant, - fontWeight: FontWeight.w500, - ), - ), + Widget _buildExportCardContent( + BuildContext context, + MeshCoreConnector connector, + ) { + final l10n = context.l10n; + return Column( + children: [ + _tappableTile( + context, + icon: Icons.download_outlined, + title: l10n.settings_gpxExportRepeaters, + subtitle: l10n.settings_gpxExportRepeatersSubtitle, + onTap: () async { + final exporter = GpxExport(connector); + exporter.addRepeaters(); + _gpxExport( + exporter, + l10n.map_repeater, + l10n.settings_gpxExportRepeatersRoom, + 'meshcore_repeaters_', + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + ); + }, + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.download_outlined, + title: l10n.settings_gpxExportContacts, + subtitle: l10n.settings_gpxExportContactsSubtitle, + onTap: () async { + final exporter = GpxExport(connector); + exporter.addContacts(); + _gpxExport( + exporter, + l10n.map_repeater, + l10n.settings_gpxExportChat, + 'meshcore_contacts_', + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + ); + }, + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.download_outlined, + title: l10n.settings_gpxExportAll, + subtitle: l10n.settings_gpxExportAllSubtitle, + onTap: () async { + final exporter = GpxExport(connector); + exporter.addAll(); + _gpxExport( + exporter, + l10n.map_repeater, + l10n.settings_gpxExportAllContacts, + 'meshcore_all_', + l10n.settings_gpxExportShareText, + l10n.settings_gpxExportShareSubject, + ); + }, + ), + ], + ); + } + + Widget _buildDebugCardContent(BuildContext context) { + final l10n = context.l10n; + return Column( + children: [ + _tappableTile( + context, + icon: Icons.bluetooth_outlined, + title: l10n.settings_companionDebugLog, + subtitle: l10n.settings_companionDebugLogSubtitle, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const BleDebugLogScreen(), + ), + ); + }, + ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.code_outlined, + title: l10n.settings_appDebugLog, + subtitle: l10n.settings_appDebugLogSubtitle, + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const AppDebugLogScreen(), + ), + ); + }, + ), + ], + ); + } + + Widget _tappableTile( + BuildContext context, { + required IconData icon, + required String title, + required String subtitle, + VoidCallback? onTap, + Color? titleColor, + Color? iconColor, + }) { + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + final effectiveIconColor = iconColor ?? scheme.onSurfaceVariant; + + return InkWell( + onTap: onTap, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon(icon, size: 20, color: effectiveIconColor), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + color: titleColor, + ), + ), + const SizedBox(height: 2), + Text( + subtitle, + style: textTheme.bodySmall?.copyWith( + color: titleColor != null + ? titleColor.withValues(alpha: 0.7) + : scheme.onSurfaceVariant, + ), + ), + ], ), - ], - ), - const SizedBox(height: 4), - Text( - value, - style: theme.textTheme.bodyLarge?.copyWith( - color: valueColor, - fontWeight: FontWeight.w500, ), - ), - ], + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], + ), ), ); - - if (onTap != null) { - return InkWell( - borderRadius: BorderRadius.circular(6), - onTap: onTap, - child: row, - ); - } - - return row; } void _editNodeName(BuildContext context, MeshCoreConnector connector) { @@ -837,70 +1045,6 @@ class _SettingsScreenState extends State { } } - Widget _buildExportCard(MeshCoreConnector connector) { - final l10n = context.l10n; - return Card( - child: Column( - children: [ - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(l10n.settings_gpxExportRepeaters), - subtitle: Text(l10n.settings_gpxExportRepeatersSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () async { - final exporter = GpxExport(connector); - exporter.addRepeaters(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportRepeatersRoom, - "meshcore_repeaters_", - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(l10n.settings_gpxExportContacts), - subtitle: Text(l10n.settings_gpxExportContactsSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () async { - final exporter = GpxExport(connector); - exporter.addContacts(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportChat, - "meshcore_contacts_", - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ListTile( - leading: const Icon(Icons.download_outlined), - title: Text(l10n.settings_gpxExportAll), - subtitle: Text(l10n.settings_gpxExportAllSubtitle), - trailing: const Icon(Icons.chevron_right), - onTap: () async { - final exporter = GpxExport(connector); - exporter.addAll(); - _gpxExport( - exporter, - l10n.map_repeater, - l10n.settings_gpxExportAllContacts, - "meshcore_all_", - l10n.settings_gpxExportShareText, - l10n.settings_gpxExportShareSubject, - ); - }, - ), - ], - ), - ); - } - void _editAutoAddConfig(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; bool autoAddChat = false; @@ -933,7 +1077,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddChat = value); }, ), - SizedBox(height: 8), + const SizedBox(height: 8), FeatureToggleRow( title: l10n.contactsSettings_autoAddRepeatersTitle, subtitle: l10n.contactsSettings_autoAddRepeatersSubtitle, @@ -942,7 +1086,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddRepeater = value); }, ), - SizedBox(height: 8), + const SizedBox(height: 8), FeatureToggleRow( title: l10n.contactsSettings_autoAddRoomServersTitle, subtitle: l10n.contactsSettings_autoAddRoomServersSubtitle, @@ -951,7 +1095,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddRoomServer = value); }, ), - SizedBox(height: 8), + const SizedBox(height: 8), FeatureToggleRow( title: l10n.contactsSettings_autoAddSensorsTitle, subtitle: l10n.contactsSettings_autoAddSensorsSubtitle, @@ -960,7 +1104,7 @@ class _SettingsScreenState extends State { setDialogState(() => autoAddSensor = value); }, ), - Divider(height: 4), + const Divider(height: 4), FeatureToggleRow( title: l10n.contactsSettings_overwriteOldestTitle, subtitle: l10n.contactsSettings_overwriteOldestSubtitle, diff --git a/lib/screens/tcp_screen.dart b/lib/screens/tcp_screen.dart index 517b39a6..cbed0277 100644 --- a/lib/screens/tcp_screen.dart +++ b/lib/screens/tcp_screen.dart @@ -1,13 +1,16 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; import '../services/app_settings_service.dart'; +import '../theme/mesh_theme.dart'; import '../utils/platform_info.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; import 'usb_screen.dart'; @@ -95,15 +98,32 @@ class _TcpScreenState extends State { final isConnecting = connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.tcp; - // A running BLE scan must not block TCP connect: connectTcp() stops - // any active scan before connecting, so the only reason to disable - // the button is a TCP connect already in flight. - final isButtonDisabled = isConnecting; - return Column( + // Connect is only available from a fully disconnected state — + // scanning, connecting, or an active session must settle first. + final isButtonDisabled = + connector.state != MeshCoreConnectionState.disconnected; + return ListView( + padding: const EdgeInsets.only(bottom: 32), children: [ - _buildStatusBar(context, connector), - _buildTransportLinks(context), + // Status header Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: Align( + key: ValueKey(connector.state), + alignment: Alignment.centerLeft, + child: _buildStatusChip(context, connector), + ), + ), + ), + + // Transport switcher + _buildTransportLinks(context), + + // Connection form + const SectionHeader('TCP / IP'), + MeshCard( padding: const EdgeInsets.all(16), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, @@ -113,7 +133,6 @@ class _TcpScreenState extends State { decoration: InputDecoration( labelText: context.l10n.tcpHostLabel, hintText: context.l10n.tcpHostHint, - border: const OutlineInputBorder(), ), enabled: !isConnecting, keyboardType: TextInputType.url, @@ -124,7 +143,6 @@ class _TcpScreenState extends State { decoration: InputDecoration( labelText: context.l10n.tcpPortLabel, hintText: context.l10n.tcpPortHint, - border: const OutlineInputBorder(), ), enabled: !isConnecting, keyboardType: TextInputType.number, @@ -132,7 +150,12 @@ class _TcpScreenState extends State { const SizedBox(height: 16), FilledButton.icon( key: const Key('tcp_connect_button'), - onPressed: isButtonDisabled ? null : _connectTcp, + onPressed: isButtonDisabled + ? null + : () { + HapticFeedback.lightImpact(); + _connectTcp(); + }, icon: isConnecting ? const SizedBox( width: 18, @@ -151,6 +174,39 @@ class _TcpScreenState extends State { ], ), ), + + // Last used endpoint + if (connector.activeTcpEndpoint != null && + connector.isTcpTransportConnected) ...[ + const SectionHeader('CONNECTED TO'), + MeshCard( + padding: const EdgeInsets.symmetric( + horizontal: 14, + vertical: 10, + ), + child: Row( + children: [ + Icon( + Icons.lan, + size: 16, + color: Theme.of(context).colorScheme.primary, + ), + const SizedBox(width: 10), + Expanded( + child: Text( + connector.activeTcpEndpoint!, + style: MeshTheme.mono( + fontSize: 13, + color: Theme.of(context).colorScheme.onSurface, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + ), + ], ], ); }, @@ -159,6 +215,40 @@ class _TcpScreenState extends State { ); } + Widget _buildStatusChip(BuildContext context, MeshCoreConnector connector) { + final l10n = context.l10n; + + if (connector.isTcpTransportConnected) { + return StatusChip( + label: l10n.scanner_connectedTo( + connector.activeTcpEndpoint ?? 'TCP', + ), + color: MeshPalette.signal, + ); + } else if (connector.state == MeshCoreConnectionState.connecting && + connector.activeTransport == MeshCoreTransportType.tcp) { + return StatusChip( + label: l10n.tcpStatus_connectingTo( + '${_hostController.text}:${_portController.text}', + ), + color: MeshPalette.warn, + pulse: true, + ); + } else if (connector.state == MeshCoreConnectionState.disconnecting && + connector.activeTransport == MeshCoreTransportType.tcp) { + return StatusChip( + label: l10n.scanner_disconnecting, + color: MeshPalette.warn, + pulse: true, + ); + } else { + return StatusChip( + label: l10n.tcpStatus_notConnected, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ); + } + } + Widget _buildTransportLinks(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), @@ -186,52 +276,6 @@ class _TcpScreenState extends State { ); } - Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { - final l10n = context.l10n; - String statusText; - Color statusColor; - - if (connector.isTcpTransportConnected) { - statusText = l10n.scanner_connectedTo( - connector.activeTcpEndpoint ?? 'TCP', - ); - statusColor = Colors.green; - } else if (connector.state == MeshCoreConnectionState.connecting && - connector.activeTransport == MeshCoreTransportType.tcp) { - statusText = l10n.tcpStatus_connectingTo( - '${_hostController.text}:${_portController.text}', - ); - statusColor = Colors.orange; - } else if (connector.state == MeshCoreConnectionState.disconnecting && - connector.activeTransport == MeshCoreTransportType.tcp) { - statusText = l10n.scanner_disconnecting; - statusColor = Colors.orange; - } else { - statusText = l10n.tcpStatus_notConnected; - statusColor = Theme.of(context).colorScheme.onSurfaceVariant; - } - - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - color: statusColor.withValues(alpha: 0.1), - child: Row( - children: [ - Icon(Icons.circle, size: 12, color: statusColor), - const SizedBox(width: 8), - Expanded( - child: Text( - statusText, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle(color: statusColor, fontWeight: FontWeight.w500), - ), - ), - ], - ), - ); - } - Future _connectTcp() async { if (_connector.state == MeshCoreConnectionState.connecting || _connector.state == MeshCoreConnectionState.connected || diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index 4559adac..7087bd2c 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -19,6 +19,8 @@ import '../utils/battery_utils.dart'; import '../helpers/snack_bar_builder.dart'; import '../widgets/sync_progress_overlay.dart'; import '../widgets/telemetry_location_map.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; class TelemetryScreen extends StatefulWidget { final Contact contact; @@ -319,6 +321,7 @@ class _TelemetryScreenState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final settings = context.watch().settings; final isImperialUnits = settings.unitSystem == UnitSystem.imperial; @@ -387,7 +390,7 @@ class _TelemetryScreenState extends State { l10n.telemetry_noData, style: TextStyle( fontSize: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, ), ), ), @@ -415,34 +418,21 @@ class _TelemetryScreenState extends State { int channel, bool isImperialUnits, ) { - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Icon( - Icons.info_outline, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - title, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - for (final entry in channelData.entries) - _buildTelemetryField(entry, channel, isImperialUnits), - ], + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader(title, padding: const EdgeInsets.fromLTRB(16, 16, 16, 8)), + MeshCard( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + for (final entry in channelData.entries) + _buildTelemetryField(entry, channel, isImperialUnits), + ], + ), ), - ), + ], ); } @@ -601,30 +591,19 @@ class _TelemetryScreenState extends State { final l10n = context.l10n; final counterText = _autoRefreshCounterText(); - return Card( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Row( - children: [ - Icon( - Icons.autorenew, - color: Theme.of(context).textTheme.headlineSmall?.color, - ), - const SizedBox(width: 8), - Text( - l10n.common_autoRefresh, - style: const TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ], - ), - const Divider(), - _buildAutoRefreshNumberField( + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SectionHeader( + l10n.common_autoRefresh, + padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + ), + MeshCard( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _buildAutoRefreshNumberField( controller: _autoRefreshIntervalController, label: l10n.common_interval, min: _autoRefreshMinIntervalSeconds, @@ -684,6 +663,7 @@ class _TelemetryScreenState extends State { ], ), ), + ], ); } @@ -913,6 +893,7 @@ class _TelemetryScreenState extends State { } Widget _buildInfoRow(String label, String value) { + final scheme = Theme.of(context).colorScheme; return Padding( padding: const EdgeInsets.symmetric(vertical: 6), child: Row( @@ -922,7 +903,8 @@ class _TelemetryScreenState extends State { child: Text( label, style: TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, + fontSize: 13, fontWeight: FontWeight.w500, ), ), @@ -930,7 +912,10 @@ class _TelemetryScreenState extends State { const SizedBox(width: 8), Text( value, - style: const TextStyle(fontWeight: FontWeight.w400), + style: MeshTheme.mono( + fontSize: 13, + color: scheme.onSurface, + ), textAlign: TextAlign.end, ), ], diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index ec551c6f..5b42767b 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -6,10 +6,13 @@ import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; import '../utils/app_logger.dart'; import '../utils/platform_info.dart'; import '../utils/usb_port_labels.dart'; import '../widgets/adaptive_app_bar_title.dart'; +import '../widgets/empty_state.dart'; +import '../widgets/mesh_ui.dart'; import '../helpers/snack_bar_builder.dart'; import 'channels_screen.dart'; import 'tcp_screen.dart'; @@ -97,9 +100,27 @@ class _UsbScreenState extends State { child: Consumer( builder: (context, connector, child) { return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - _buildStatusBar(context, connector), + // Status header + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 4), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + child: Align( + key: ValueKey( + '${connector.state}_$_isLoadingPorts', + ), + alignment: Alignment.centerLeft, + child: _buildStatusChip(context, connector), + ), + ), + ), + + // Transport switcher _buildTransportLinks(context), + + // Port list Expanded(child: _buildPortList(context, connector)), ], ); @@ -132,6 +153,52 @@ class _UsbScreenState extends State { ); } + Widget _buildStatusChip(BuildContext context, MeshCoreConnector connector) { + final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; + + if (_isLoadingPorts) { + return StatusChip( + label: l10n.usbStatus_searching, + color: scheme.primary, + pulse: true, + ); + } else if (connector.isUsbTransportConnected) { + switch (connector.state) { + case MeshCoreConnectionState.connected: + return StatusChip( + label: l10n.scanner_connectedTo( + connector.activeUsbPortDisplayLabel ?? 'USB', + ), + color: MeshPalette.signal, + ); + case MeshCoreConnectionState.disconnecting: + return StatusChip( + label: l10n.scanner_disconnecting, + color: MeshPalette.warn, + pulse: true, + ); + default: + return StatusChip( + label: l10n.usbStatus_notConnected, + color: scheme.onSurfaceVariant, + ); + } + } else if (connector.state == MeshCoreConnectionState.connecting && + connector.activeTransport == MeshCoreTransportType.usb) { + return StatusChip( + label: l10n.usbStatus_connecting, + color: MeshPalette.warn, + pulse: true, + ); + } else { + return StatusChip( + label: l10n.usbStatus_notConnected, + color: scheme.onSurfaceVariant, + ); + } + } + Widget _buildTransportLinks(BuildContext context) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), @@ -159,105 +226,20 @@ class _UsbScreenState extends State { ); } - Widget _buildStatusBar(BuildContext context, MeshCoreConnector connector) { - final l10n = context.l10n; - String statusText; - Color statusColor; - - if (_isLoadingPorts) { - statusText = l10n.usbStatus_searching; - statusColor = Theme.of(context).colorScheme.primary; - } else if (connector.isUsbTransportConnected) { - switch (connector.state) { - case MeshCoreConnectionState.connected: - statusText = l10n.scanner_connectedTo( - connector.activeUsbPortDisplayLabel ?? 'USB', - ); - statusColor = Colors.green; - case MeshCoreConnectionState.disconnecting: - statusText = l10n.scanner_disconnecting; - statusColor = Colors.orange; - default: - statusText = l10n.usbStatus_notConnected; - statusColor = Theme.of(context).colorScheme.onSurfaceVariant; - } - } else if (connector.state == MeshCoreConnectionState.connecting && - connector.activeTransport == MeshCoreTransportType.usb) { - statusText = l10n.usbStatus_connecting; - statusColor = Colors.orange; - } else { - statusText = l10n.usbStatus_notConnected; - statusColor = Theme.of(context).colorScheme.onSurfaceVariant; - } - - return Container( - width: double.infinity, - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - color: statusColor.withValues(alpha: 0.1), - child: Row( - children: [ - Icon(Icons.circle, size: 12, color: statusColor), - const SizedBox(width: 8), - Expanded( - child: Text( - statusText, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle(color: statusColor, fontWeight: FontWeight.w500), - ), - ), - ], - ), - ); - } - Widget _buildPortList(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; if (_isLoadingPorts) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.usb, - size: 64, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - const SizedBox(height: 16), - Text( - l10n.usbStatus_searching, - style: TextStyle( - fontSize: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], - ), + return EmptyState( + icon: Icons.usb, + title: l10n.usbStatus_searching, ); } if (_ports.isEmpty) { - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon( - Icons.usb, - size: 64, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - const SizedBox(height: 16), - Text( - l10n.usbScreenEmptyState, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ], - ), + return EmptyState( + icon: Icons.usb, + title: l10n.usbScreenEmptyState, ); } @@ -265,10 +247,9 @@ class _UsbScreenState extends State { connector.state == MeshCoreConnectionState.connecting && connector.activeTransport == MeshCoreTransportType.usb; - return ListView.separated( - padding: const EdgeInsets.all(8), + return ListView.builder( + padding: const EdgeInsets.only(bottom: 32), itemCount: _ports.length, - separatorBuilder: (context, index) => const Divider(), itemBuilder: (context, index) { final port = _ports[index]; final displayName = friendlyUsbPortName(port); @@ -276,15 +257,50 @@ class _UsbScreenState extends State { final showRawName = rawName != displayName && !rawName.startsWith('web:'); - return ListTile( - leading: const Icon(Icons.usb), - title: Text( - displayName, - style: const TextStyle(fontWeight: FontWeight.w500), + return ListEntrance( + index: index, + child: MeshCard( + padding: EdgeInsets.zero, + child: ListTile( + onTap: isConnecting + ? null + : () { + HapticFeedback.selectionClick(); + _connectPort(port); + }, + leading: AvatarCircle( + name: displayName, + size: 40, + icon: Icons.usb, + color: Theme.of(context).colorScheme.primary, + ), + title: Text( + displayName, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + color: Theme.of(context).colorScheme.onSurface, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + subtitle: showRawName + ? Text( + rawName, + style: MeshTheme.mono( + fontSize: 11, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ) + : null, + trailing: Icon( + Icons.chevron_right, + size: 18, + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), ), - subtitle: showRawName ? Text(rawName) : null, - trailing: const Icon(Icons.chevron_right), - onTap: isConnecting ? null : () => _connectPort(port), ); }, ); diff --git a/lib/theme/mesh_theme.dart b/lib/theme/mesh_theme.dart index 00b92ec0..fcb15b1b 100644 --- a/lib/theme/mesh_theme.dart +++ b/lib/theme/mesh_theme.dart @@ -1,47 +1,48 @@ +import 'package:flutter/cupertino.dart' show CupertinoPageTransitionsBuilder; import 'package:flutter/material.dart'; -/// MeshCore palette — cool slate dark theme with sky-blue accents. +/// MeshCore palette — high-contrast slate surfaces with sky-blue accents. class MeshPalette { MeshPalette._(); - // Surfaces (cool near-black, slate undertone) - static const bg = Color(0xFF101417); - static const bg1 = Color(0xFF161B1F); - static const bg2 = Color(0xFF1D242A); - static const bg3 = Color(0xFF28313A); - static const bg4 = Color(0xFF344049); + // Surfaces shared with the map overlays and navigation. + static const bg = Color(0xFF0B1220); + static const bg1 = Color(0xFF0F172A); + static const bg2 = Color(0xFF162033); + static const bg3 = Color(0xFF1E293B); + static const bg4 = Color(0xFF334155); // Lines - static const line = Color(0xFF222B31); - static const line2 = Color(0xFF344049); - static const line3 = Color(0xFF485762); + static const line = Color(0xFF1E293B); + static const line2 = Color(0xFF334155); + static const line3 = Color(0xFF475569); // Ink - static const ink = Color(0xFFE9EEF3); - static const ink2 = Color(0xFFB5C0C9); - static const ink3 = Color(0xFF7C8A95); - static const ink4 = Color(0xFF556470); + static const ink = Color(0xFFF8FAFC); + static const ink2 = Color(0xFFCBD5E1); + static const ink3 = Color(0xFF94A3B8); + static const ink4 = Color(0xFF64748B); // Signal-quality green (used only for SNR coloring, not UI chrome) - static const signal = Color(0xFF7BEFA8); - static const signalDim = Color(0xFF4DC580); + static const signal = Color(0xFF22C55E); + static const signalDim = Color(0xFF16A34A); - // Warn (ember) - static const warn = Color(0xFFFFA552); - static const warnDim = Color(0xFFC27E3C); - static const warnBg = Color(0x1CFFA552); - static const warnLine = Color(0x4DFFA552); + // Warn + static const warn = Color(0xFFF59E0B); + static const warnDim = Color(0xFFD97706); + static const warnBg = Color(0x1FF59E0B); + static const warnLine = Color(0x66F59E0B); - // Alert (coral) - static const alert = Color(0xFFFF6A5C); - static const alertBg = Color(0x1CFF6A5C); - static const alertLine = Color(0x52FF6A5C); + // Alert + static const alert = Color(0xFFEF4444); + static const alertBg = Color(0x1FEF4444); + static const alertLine = Color(0x66EF4444); - // Blue (sky) — primary accent - static const blue = Color(0xFF7FCBF5); - static const blueDim = Color(0xFF4A9CC9); - static const blueBg = Color(0x1C7FCBF5); - static const blueLine = Color(0x477FCBF5); + // Blue — primary map/app accent + static const blue = Color(0xFF0EA5E9); + static const blueDim = Color(0xFF0284C7); + static const blueBg = Color(0x290EA5E9); + static const blueLine = Color(0x800EA5E9); // Magenta static const magenta = Color(0xFFDE7FDB); @@ -49,9 +50,9 @@ class MeshPalette { static const magentaLine = Color(0x47DE7FDB); // Me bubble (dusk blue) - static const me = Color(0xFF1B2C3D); - static const meBorder = Color(0xFF2C4A66); - static const meInk = Color(0xFFDCE9F5); + static const me = Color(0xFF0C4A6E); + static const meBorder = Color(0xFF0369A1); + static const meInk = Color(0xFFF0F9FF); // ── Light variant (used when user explicitly picks light theme) static const lightBg = Color(0xFFF4F6F8); @@ -64,6 +65,51 @@ class MeshPalette { static const lightBlue = Color(0xFF2F6EA8); } +/// High-contrast semantic colors for UI rendered over variable map tiles. +class MapPalette { + MapPalette._(); + + static const online = Color(0xFF22C55E); + static const offline = Color(0xFF6B7280); + static const stale = Color(0xFFF59E0B); + static const repeater = Color(0xFF2563EB); + static const router = Color(0xFF7C3AED); + static const batteryLow = Color(0xFFEF4444); + static const cluster = Color(0xFFF97316); + static const selected = Color(0xFF0EA5E9); + static const sensor = Color(0xFF0F766E); + static const shared = Color(0xFF0369A1); + + static const panelLight = Color(0xF0FFFFFF); + static const panelDark = Color(0xF50B1220); + static const textPrimary = Color(0xFFF8FAFC); + static const textSecondary = Color(0xFFCBD5E1); + static const textMuted = Color(0xFF94A3B8); + static const border = Color(0x5264758B); + static const markerOutline = Colors.white; + static const markerShadow = Color(0xB3000000); +} + +/// High-contrast colors for line-of-sight maps and elevation profiles. +class LosPalette { + LosPalette._(); + + static const terrain = Color(0xFFA3E635); + static const beam = Color(0xFF38BDF8); + static const horizon = Color(0xFFFBBF24); + static const blocked = Color(0xFFEF4444); + static const marginal = Color(0xFFF59E0B); + static const clear = Color(0xFF22C55E); + static const selected = Color(0xFF0EA5E9); + static const chartBackground = Color(0xFF0B1220); + static const panelDark = Color(0xF00F172A); + static const panelLight = Color(0xF5FFFFFF); + static const text = Color(0xFFF8FAFC); + static const textMuted = Color(0xFFCBD5E1); + static const border = Color(0x5264758B); + static const shadow = Color(0x99000000); +} + /// Named font stacks — Flutter falls back to system fonts when the named /// family isn't installed, keeping things working without bundled assets. class MeshFonts { @@ -72,6 +118,7 @@ class MeshFonts { static const sans = 'Inter'; static const mono = 'JetBrains Mono'; static const display = 'Instrument Serif'; + static const emoji = 'Noto Color Emoji'; static const List sansFallback = [ 'system-ui', @@ -93,6 +140,11 @@ class MeshFonts { 'Times New Roman', 'serif', ]; + static const List emojiFallback = [ + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Noto Emoji', + ]; } /// Radii used consistently across the app. @@ -113,21 +165,21 @@ class MeshTheme { static ThemeData dark() { const scheme = ColorScheme.dark( primary: MeshPalette.blue, - onPrimary: Color(0xFF0A1A26), - primaryContainer: MeshPalette.blueBg, - onPrimaryContainer: MeshPalette.blue, + onPrimary: Colors.white, + primaryContainer: Color(0xFF075985), + onPrimaryContainer: Colors.white, secondary: MeshPalette.magenta, - onSecondary: Color(0xFF201020), + onSecondary: Colors.white, secondaryContainer: Color(0xFF331A33), - onSecondaryContainer: MeshPalette.magenta, + onSecondaryContainer: Colors.white, tertiary: MeshPalette.warn, - onTertiary: Color(0xFF1F1206), - tertiaryContainer: Color(0xFF3A2710), - onTertiaryContainer: Color(0xFFFFC58A), + onTertiary: Color(0xFF0B1220), + tertiaryContainer: Color(0xFF78350F), + onTertiaryContainer: Colors.white, error: MeshPalette.alert, - onError: Color(0xFF1A0A08), - errorContainer: MeshPalette.alertBg, - onErrorContainer: MeshPalette.alert, + onError: Colors.white, + errorContainer: Color(0xFF7F1D1D), + onErrorContainer: Colors.white, surface: MeshPalette.bg, onSurface: MeshPalette.ink, surfaceContainerLowest: MeshPalette.bg, @@ -334,9 +386,9 @@ class MeshTheme { padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), ), navigationBarTheme: NavigationBarThemeData( - backgroundColor: scheme.surfaceContainerLow, + backgroundColor: scheme.surface, surfaceTintColor: Colors.transparent, - indicatorColor: scheme.primary.withValues(alpha: 0.14), + indicatorColor: scheme.primary, indicatorShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(MeshRadii.md), ), @@ -348,13 +400,13 @@ class MeshTheme { fontSize: 10, fontWeight: selected ? FontWeight.w700 : FontWeight.w500, letterSpacing: 0.1, - color: selected ? scheme.primary : scheme.onSurfaceVariant, + color: selected ? scheme.onPrimary : scheme.onSurfaceVariant, ); }), iconTheme: WidgetStateProperty.resolveWith((states) { final selected = states.contains(WidgetState.selected); return IconThemeData( - color: selected ? scheme.primary : scheme.onSurfaceVariant, + color: selected ? scheme.onPrimary : scheme.onSurfaceVariant, size: 22, ); }), @@ -393,6 +445,106 @@ class MeshTheme { ), iconTheme: IconThemeData(color: scheme.onSurfaceVariant, size: 22), splashFactory: InkSparkle.splashFactory, + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: FadeForwardsPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + TargetPlatform.linux: FadeForwardsPageTransitionsBuilder(), + TargetPlatform.macOS: FadeForwardsPageTransitionsBuilder(), + TargetPlatform.windows: FadeForwardsPageTransitionsBuilder(), + }, + ), + segmentedButtonTheme: SegmentedButtonThemeData( + style: SegmentedButton.styleFrom( + selectedBackgroundColor: scheme.primary.withValues(alpha: 0.16), + selectedForegroundColor: scheme.primary, + side: BorderSide(color: scheme.outlineVariant), + textStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 13, + fontWeight: FontWeight.w600, + ), + ), + ), + switchTheme: SwitchThemeData( + thumbColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) + ? scheme.onPrimary + : scheme.onSurfaceVariant, + ), + trackColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) + ? scheme.primary + : scheme.surfaceContainerHighest, + ), + trackOutlineColor: WidgetStateProperty.resolveWith( + (states) => states.contains(WidgetState.selected) + ? Colors.transparent + : scheme.outline, + ), + ), + sliderTheme: SliderThemeData( + activeTrackColor: scheme.primary, + inactiveTrackColor: scheme.surfaceContainerHighest, + thumbColor: scheme.primary, + overlayColor: scheme.primary.withValues(alpha: 0.12), + valueIndicatorColor: scheme.surfaceContainerHighest, + valueIndicatorTextStyle: TextStyle( + fontFamily: MeshFonts.mono, + fontFamilyFallback: MeshFonts.monoFallback, + color: scheme.onSurface, + fontSize: 12, + ), + trackHeight: 3, + ), + tabBarTheme: TabBarThemeData( + labelColor: scheme.primary, + unselectedLabelColor: scheme.onSurfaceVariant, + indicatorColor: scheme.primary, + dividerColor: scheme.outlineVariant, + labelStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 13.5, + fontWeight: FontWeight.w700, + ), + unselectedLabelStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 13.5, + fontWeight: FontWeight.w500, + ), + ), + progressIndicatorTheme: ProgressIndicatorThemeData( + color: scheme.primary, + linearTrackColor: scheme.surfaceContainerHigh, + circularTrackColor: Colors.transparent, + ), + tooltipTheme: TooltipThemeData( + decoration: BoxDecoration( + color: scheme.surfaceContainerHighest, + borderRadius: BorderRadius.circular(MeshRadii.sm), + border: Border.all(color: scheme.outline), + ), + textStyle: TextStyle(color: scheme.onSurface, fontSize: 12), + ), + filledButtonTheme: FilledButtonThemeData( + style: FilledButton.styleFrom( + backgroundColor: scheme.primary, + foregroundColor: scheme.onPrimary, + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(MeshRadii.pill), + ), + textStyle: const TextStyle( + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontWeight: FontWeight.w600, + fontSize: 14, + ), + ), + ), ); } @@ -443,6 +595,16 @@ class MeshTheme { ); } + /// Color-emoji style with platform fallbacks and stable vertical metrics. + static TextStyle emoji({double fontSize = 28}) { + return TextStyle( + fontFamily: MeshFonts.emoji, + fontFamilyFallback: MeshFonts.emojiFallback, + fontSize: fontSize, + height: 1, + ); + } + /// Color-code an SNR value for consistency across the app. static Color snrColor(num? snr, {required bool blocked}) { if (blocked) return MeshPalette.alert; diff --git a/lib/widgets/battery_indicator.dart b/lib/widgets/battery_indicator.dart index ccea59dd..9a74d7d5 100644 --- a/lib/widgets/battery_indicator.dart +++ b/lib/widgets/battery_indicator.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../connector/meshcore_connector.dart'; +import '../theme/mesh_theme.dart'; class BatteryUi { final IconData icon; @@ -10,19 +11,19 @@ class BatteryUi { BatteryUi batteryUiForPercent(int? percent) { if (percent == null) { - return const BatteryUi(Icons.battery_unknown, Colors.grey); + return const BatteryUi(Icons.battery_unknown, null); } final p = percent.clamp(0, 100); return switch (p) { - <= 5 => const BatteryUi(Icons.battery_alert, Colors.redAccent), - <= 15 => const BatteryUi(Icons.battery_0_bar, Colors.redAccent), - <= 30 => const BatteryUi(Icons.battery_1_bar, Colors.orange), - <= 45 => const BatteryUi(Icons.battery_2_bar, Colors.amber), - <= 60 => const BatteryUi(Icons.battery_3_bar, Colors.lightGreen), - <= 80 => const BatteryUi(Icons.battery_5_bar, Colors.green), - _ => const BatteryUi(Icons.battery_full, Colors.green), + <= 5 => const BatteryUi(Icons.battery_alert, MeshPalette.alert), + <= 15 => const BatteryUi(Icons.battery_0_bar, MeshPalette.alert), + <= 30 => const BatteryUi(Icons.battery_1_bar, MeshPalette.warn), + <= 45 => const BatteryUi(Icons.battery_2_bar, MeshPalette.warn), + <= 60 => const BatteryUi(Icons.battery_3_bar, null), + <= 80 => const BatteryUi(Icons.battery_5_bar, null), + _ => const BatteryUi(Icons.battery_full, MeshPalette.signal), }; } @@ -76,9 +77,9 @@ class _BatteryIndicatorState extends State { Flexible( child: Text( displayText, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.w500, + style: MeshTheme.mono( + fontSize: 11, + fontWeight: FontWeight.w600, color: batteryUi.color, ), maxLines: 1, diff --git a/lib/widgets/device_tile.dart b/lib/widgets/device_tile.dart index 9012128c..ef0f5441 100644 --- a/lib/widgets/device_tile.dart +++ b/lib/widgets/device_tile.dart @@ -1,9 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_blue_plus/flutter_blue_plus.dart'; + import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; +import 'mesh_ui.dart'; import 'signal_ui.dart'; -/// A reusable tile widget for displaying a MeshCore device in a list +/// A MeshCard-based row for displaying a scanned BLE device. +/// Shows an AvatarCircle (router icon, deterministic hue from device name), +/// device name, mono MAC address, mono RSSI dBm, and SignalBars on the right. +/// While connecting, shows a small progress ring instead of signal bars. class DeviceTile extends StatelessWidget { final ScanResult scanResult; final VoidCallback? onTap; @@ -23,27 +30,10 @@ class DeviceTile extends StatelessWidget { final name = device.platformName.isNotEmpty ? device.platformName : scanResult.advertisementData.advName; + final displayName = name.isNotEmpty ? name : context.l10n.common_unknownDevice; + final mac = device.remoteId.toString(); + final scheme = Theme.of(context).colorScheme; - return ListTile( - enabled: onTap != null || isConnecting, - leading: _buildSignalIcon(rssi), - title: Text( - name.isNotEmpty ? name : context.l10n.common_unknownDevice, - style: const TextStyle(fontWeight: FontWeight.w500), - ), - subtitle: Text(device.remoteId.toString()), - trailing: isConnecting - ? const SizedBox( - width: 20, - height: 20, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : null, - onTap: onTap, - ); - } - - Widget _buildSignalIcon(int rssi) { final tier = rssi >= -60 ? 0 : rssi >= -70 @@ -55,15 +45,77 @@ class DeviceTile extends StatelessWidget { : 4; final signalUi = signalUiForStrengthTier(tier); - return Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(signalUi.icon, color: signalUi.color), - Text( - '$rssi dBm', - style: TextStyle(fontSize: 10, color: signalUi.color), - ), - ], + return MeshCard( + onTap: onTap == null + ? null + : () { + HapticFeedback.selectionClick(); + onTap!(); + }, + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), + child: Row( + children: [ + AvatarCircle( + name: displayName, + size: 42, + icon: Icons.router, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + displayName, + style: Theme.of(context).textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + color: scheme.onSurface, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + const SizedBox(height: 3), + Text( + mac, + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + const SizedBox(width: 12), + if (isConnecting) + SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + color: scheme.primary, + ), + ) + else + Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Icon(signalUi.icon, size: 16, color: signalUi.color), + const SizedBox(height: 3), + Text( + '$rssi dBm', + style: MeshTheme.mono( + fontSize: 10, + color: signalUi.color, + ), + ), + ], + ), + ], + ), ); } } diff --git a/lib/widgets/elements_ui.dart b/lib/widgets/elements_ui.dart index 0c462499..55d930db 100644 --- a/lib/widgets/elements_ui.dart +++ b/lib/widgets/elements_ui.dart @@ -29,31 +29,68 @@ class FeatureToggleRow extends StatefulWidget { class _FeatureToggleRow extends State { @override Widget build(BuildContext context) { - return Row( - children: [ - Expanded( - child: SwitchListTile( - title: Text(widget.title), - subtitle: Text(widget.subtitle), - value: widget.value, - onChanged: widget.onChanged, - contentPadding: EdgeInsets.zero, + final scheme = Theme.of(context).colorScheme; + final textTheme = Theme.of(context).textTheme; + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.title, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + widget.subtitle, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), ), - ), - if (widget.hasRefreshing) - IconButton( - icon: widget.isRefreshing - ? const SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator(strokeWidth: 2), - ) - : const Icon(Icons.refresh, size: 20), - onPressed: widget.isRefreshing ? null : widget.onRefresh, - tooltip: widget.refreshTooltip, - visualDensity: VisualDensity.compact, + const SizedBox(width: 8), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Switch( + value: widget.value, + onChanged: widget.onChanged, + ), + if (widget.hasRefreshing) ...[ + const SizedBox(width: 4), + widget.isRefreshing + ? SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 1.8, + color: scheme.primary, + ), + ) + : IconButton( + icon: const Icon(Icons.refresh, size: 18), + onPressed: widget.onRefresh, + tooltip: widget.refreshTooltip, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + constraints: const BoxConstraints( + minWidth: 32, + minHeight: 32, + ), + ), + ], + ], ), - ], + ], + ), ); } } diff --git a/lib/widgets/emoji_picker.dart b/lib/widgets/emoji_picker.dart index 87fd1c9c..3a8fdf79 100644 --- a/lib/widgets/emoji_picker.dart +++ b/lib/widgets/emoji_picker.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../l10n/app_localizations.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class EmojiPicker extends StatelessWidget { final Function(String) onEmojiSelected; @@ -257,7 +258,11 @@ class EmojiPicker extends StatelessWidget { ), child: Text( emoji, - style: const TextStyle(fontSize: 28), + style: MeshTheme.emoji(), + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), ), ), ), @@ -298,7 +303,12 @@ class EmojiPicker extends StatelessWidget { child: Center( child: Text( emojis[index], - style: const TextStyle(fontSize: 28), + style: MeshTheme.emoji(), + textHeightBehavior: + const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + ), ), ), ), diff --git a/lib/widgets/empty_state.dart b/lib/widgets/empty_state.dart index 718c1c44..2f0c9847 100644 --- a/lib/widgets/empty_state.dart +++ b/lib/widgets/empty_state.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; /// A centered empty state display with icon, title, and optional subtitle/action. -class EmptyState extends StatelessWidget { +/// Features a tinted icon circle, fade+slide entrance animation, and clear +/// typography hierarchy using the MeshCore design system. +class EmptyState extends StatefulWidget { final IconData icon; final String title; final String? subtitle; @@ -15,29 +17,97 @@ class EmptyState extends StatelessWidget { this.action, }); + @override + State createState() => _EmptyStateState(); +} + +class _EmptyStateState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 420), + ); + late final CurvedAnimation _curve = CurvedAnimation( + parent: _controller, + curve: Curves.easeOutCubic, + ); + + @override + void initState() { + super.initState(); + _controller.forward(); + } + + @override + void dispose() { + _curve.dispose(); + _controller.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { - final onSurfaceVariant = Theme.of(context).colorScheme.onSurfaceVariant; - return Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Icon(icon, size: 64, color: onSurfaceVariant.withValues(alpha: 0.6)), - const SizedBox(height: 16), - Text(title, style: TextStyle(fontSize: 16, color: onSurfaceVariant)), - if (subtitle != null) ...[ - const SizedBox(height: 8), - Text( - subtitle!, - style: TextStyle( - fontSize: 14, - color: onSurfaceVariant.withValues(alpha: 0.8), - ), - textAlign: TextAlign.center, + final scheme = Theme.of(context).colorScheme; + return FadeTransition( + opacity: _curve, + child: SlideTransition( + position: Tween( + begin: const Offset(0, 0.06), + end: Offset.zero, + ).animate(_curve), + child: Center( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 40), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + width: 80, + height: 80, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.primary.withValues(alpha: 0.08), + border: Border.all( + color: scheme.primary.withValues(alpha: 0.18), + width: 1.5, + ), + ), + child: Icon( + widget.icon, + size: 36, + color: scheme.onSurfaceVariant, + ), + ), + const SizedBox(height: 20), + Text( + widget.title, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + color: scheme.onSurface, + letterSpacing: -0.1, + ), + textAlign: TextAlign.center, + ), + if (widget.subtitle != null) ...[ + const SizedBox(height: 8), + Text( + widget.subtitle!, + style: TextStyle( + fontSize: 13.5, + color: scheme.onSurfaceVariant, + height: 1.45, + ), + textAlign: TextAlign.center, + ), + ], + if (widget.action != null) ...[ + const SizedBox(height: 28), + widget.action!, + ], + ], ), - ], - if (action != null) ...[const SizedBox(height: 24), action!], - ], + ), + ), ), ); } diff --git a/lib/widgets/jump_to_bottom_button.dart b/lib/widgets/jump_to_bottom_button.dart index 3f6d96e2..6eab28a9 100644 --- a/lib/widgets/jump_to_bottom_button.dart +++ b/lib/widgets/jump_to_bottom_button.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; + import '../helpers/chat_scroll_controller.dart'; +import '../theme/mesh_theme.dart'; class JumpToBottomButton extends StatelessWidget { final ChatScrollController scrollController; @@ -8,6 +10,7 @@ class JumpToBottomButton extends StatelessWidget { @override Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; return ValueListenableBuilder( valueListenable: scrollController.showJumpToBottom, builder: (context, show, _) { @@ -15,9 +18,36 @@ class JumpToBottomButton extends StatelessWidget { return Positioned( right: 16, bottom: 16, - child: FloatingActionButton.small( - onPressed: scrollController.jumpToBottom, - child: const Icon(Icons.keyboard_arrow_down), + child: Material( + color: Colors.transparent, + child: InkWell( + onTap: scrollController.jumpToBottom, + borderRadius: BorderRadius.circular(MeshRadii.pill), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: scheme.surfaceContainerHigh.withValues(alpha: 0.92), + border: Border.all( + color: scheme.outlineVariant, + width: 1, + ), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.18), + blurRadius: 8, + offset: const Offset(0, 2), + ), + ], + ), + child: Icon( + Icons.keyboard_arrow_down, + size: 22, + color: scheme.primary, + ), + ), + ), ), ); }, diff --git a/lib/widgets/mesh_ui.dart b/lib/widgets/mesh_ui.dart new file mode 100644 index 00000000..bfbe679f --- /dev/null +++ b/lib/widgets/mesh_ui.dart @@ -0,0 +1,643 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +import '../theme/mesh_theme.dart'; + +/// MeshCore shared design kit. +/// +/// Building blocks used across all screens so the app reads as one product: +/// [SectionHeader], [MeshCard], [StatusChip], [StatTile], [AvatarCircle], +/// [SignalBars], [RouteChip], [PulseDot], [BottomSheetHeader] + +/// [showMeshSheet], [ErrorRetryCard], and [ListEntrance]. + +/// Small-caps mono section label, optionally with a trailing widget. +class SectionHeader extends StatelessWidget { + final String label; + final Widget? trailing; + final EdgeInsetsGeometry padding; + + const SectionHeader( + this.label, { + super.key, + this.trailing, + this.padding = const EdgeInsets.fromLTRB(16, 20, 16, 8), + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: padding, + child: Row( + children: [ + Expanded( + child: Text( + label.toUpperCase(), + style: MeshTheme.accentLabel(color: scheme.onSurfaceVariant), + overflow: TextOverflow.ellipsis, + ), + ), + ?trailing, + ], + ), + ); + } +} + +/// Bordered surface card with press feedback. The standard container for +/// grouped content and tappable list entries. +class MeshCard extends StatelessWidget { + final Widget child; + final VoidCallback? onTap; + final VoidCallback? onLongPress; + final EdgeInsetsGeometry padding; + final EdgeInsetsGeometry margin; + final Color? color; + final Color? borderColor; + final double radius; + + const MeshCard({ + super.key, + required this.child, + this.onTap, + this.onLongPress, + this.padding = const EdgeInsets.all(14), + this.margin = const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + this.color, + this.borderColor, + this.radius = MeshRadii.md, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final shape = RoundedRectangleBorder( + borderRadius: BorderRadius.circular(radius), + side: BorderSide(color: borderColor ?? scheme.outlineVariant), + ); + return Padding( + padding: margin, + child: Material( + color: color ?? scheme.surfaceContainerLow, + shape: shape, + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: onTap, + onLongPress: onLongPress == null + ? null + : () { + HapticFeedback.selectionClick(); + onLongPress!(); + }, + child: Padding(padding: padding, child: child), + ), + ), + ); + } +} + +/// Tinted pill chip for statuses: a dot or icon plus a short label. +class StatusChip extends StatelessWidget { + final String label; + final Color color; + final IconData? icon; + final bool pulse; + final double fontSize; + + const StatusChip({ + super.key, + required this.label, + required this.color, + this.icon, + this.pulse = false, + this.fontSize = 11.5, + }); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 4), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: color.withValues(alpha: 0.3)), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (icon != null) + Icon(icon, size: fontSize + 2, color: color) + else + PulseDot(color: color, size: 7, animate: pulse), + const SizedBox(width: 5), + Flexible( + child: Text( + label, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: MeshTheme.mono( + fontSize: fontSize, + fontWeight: FontWeight.w600, + color: color, + ), + ), + ), + ], + ), + ); + } +} + +/// Compact metric tile: icon, mono value (+ optional unit), small label. +class StatTile extends StatelessWidget { + final IconData icon; + final String label; + final String value; + final String? unit; + final Color? color; + final VoidCallback? onTap; + + const StatTile({ + super.key, + required this.icon, + required this.label, + required this.value, + this.unit, + this.color, + this.onTap, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final accent = color ?? scheme.primary; + return MeshCard( + onTap: onTap, + margin: EdgeInsets.zero, + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Icon(icon, size: 14, color: accent), + const SizedBox(width: 6), + Expanded( + child: Text( + label.toUpperCase(), + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 9, + ), + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + const SizedBox(height: 6), + Text.rich( + TextSpan( + text: value, + style: MeshTheme.mono( + fontSize: 17, + fontWeight: FontWeight.w600, + color: scheme.onSurface, + ), + children: [ + if (unit != null) + TextSpan( + text: ' $unit', + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ); + } +} + +/// Initials avatar with a deterministic per-name hue, or a fixed [color] +/// for node-type coloring. Optional [icon] replaces initials. +class AvatarCircle extends StatelessWidget { + final String name; + final double size; + final Color? color; + final IconData? icon; + + const AvatarCircle({ + super.key, + required this.name, + this.size = 40, + this.color, + this.icon, + }); + + static const _hues = [ + MeshPalette.blue, + MeshPalette.magenta, + MeshPalette.signal, + MeshPalette.warn, + Color(0xFF8FA8F0), + Color(0xFF6FD9CE), + ]; + + Color _colorFor(String s) { + var h = 0; + for (final c in s.codeUnits) { + h = (h * 31 + c) & 0x7fffffff; + } + return _hues[h % _hues.length]; + } + + @override + Widget build(BuildContext context) { + final accent = color ?? _colorFor(name); + final initials = _initials(name); + return Container( + width: size, + height: size, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: accent.withValues(alpha: 0.14), + border: Border.all(color: accent.withValues(alpha: 0.4)), + ), + alignment: Alignment.center, + child: icon != null + ? Icon(icon, size: size * 0.5, color: accent) + : Text( + initials, + style: MeshTheme.mono( + fontSize: size * 0.36, + fontWeight: FontWeight.w700, + color: accent, + ), + ), + ); + } + + static String _initials(String name) { + final words = name + .trim() + .split(RegExp(r'\s+')) + .where((w) => w.isNotEmpty) + .toList(); + if (words.isEmpty) return '?'; + if (words.length == 1) { + return words.first.characters.take(2).toString().toUpperCase(); + } + return (words.first.characters.take(1).toString() + + words[1].characters.take(1).toString()) + .toUpperCase(); + } +} + +/// Four-bar signal strength indicator driven by an SNR value (dB), colored +/// with the shared [MeshTheme.snrColor] ramp. +class SignalBars extends StatelessWidget { + final double? snr; + final double height; + + const SignalBars({super.key, required this.snr, this.height = 14}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final color = MeshTheme.snrColor(snr, blocked: false); + final active = snr == null + ? 0 + : snr! > 0 + ? 4 + : snr! > -5 + ? 3 + : snr! > -12 + ? 2 + : 1; + return Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.end, + children: List.generate(4, (i) { + final on = i < active; + return Container( + width: 3, + height: height * (0.4 + i * 0.2), + margin: const EdgeInsets.only(right: 2), + decoration: BoxDecoration( + color: on ? color : scheme.outlineVariant, + borderRadius: BorderRadius.circular(1), + ), + ); + }), + ); + } +} + +/// Chip describing how a message was routed: direct (with hop count) vs flood. +class RouteChip extends StatelessWidget { + final bool isDirect; + final int? hops; + + const RouteChip({super.key, required this.isDirect, this.hops}); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + final label = isDirect + ? (hops == null || hops == 0 ? 'DIRECT' : '$hops HOP${hops == 1 ? '' : 'S'}') + : 'FLOOD'; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: scheme.surfaceContainerHigh, + borderRadius: BorderRadius.circular(MeshRadii.xs), + border: Border.all(color: scheme.outlineVariant), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + isDirect ? Icons.trending_flat : Icons.podcasts, + size: 11, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 3), + Text( + label, + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 8.5, + ), + ), + ], + ), + ); + } +} + +/// Small status dot, optionally with a soft breathing animation. +class PulseDot extends StatefulWidget { + final Color color; + final double size; + final bool animate; + + const PulseDot({ + super.key, + required this.color, + this.size = 8, + this.animate = false, + }); + + @override + State createState() => _PulseDotState(); +} + +class _PulseDotState extends State + with SingleTickerProviderStateMixin { + // Created eagerly: a lazy `late final` initializer would run on first + // access — which can be dispose(), where ticker creation throws. + late final AnimationController _controller; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 1400), + ); + if (widget.animate) _controller.repeat(reverse: true); + } + + @override + void didUpdateWidget(PulseDot old) { + super.didUpdateWidget(old); + if (widget.animate && !_controller.isAnimating) { + _controller.repeat(reverse: true); + } else if (!widget.animate && _controller.isAnimating) { + _controller.stop(); + _controller.value = 0; + } + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return FadeTransition( + opacity: widget.animate + ? Tween(begin: 0.35, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeInOut), + ) + : const AlwaysStoppedAnimation(1.0), + child: Container( + width: widget.size, + height: widget.size, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: widget.color, + boxShadow: [ + BoxShadow( + color: widget.color.withValues(alpha: 0.45), + blurRadius: widget.size * 0.7, + ), + ], + ), + ), + ); + } +} + +/// Standard modal sheet header: drag handle, title, optional subtitle and +/// trailing action, and a close button. +class BottomSheetHeader extends StatelessWidget { + final String title; + final String? subtitle; + final Widget? trailing; + + const BottomSheetHeader({ + super.key, + required this.title, + this.subtitle, + this.trailing, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return Padding( + padding: const EdgeInsets.fromLTRB(20, 8, 8, 4), + child: Column( + children: [ + Container( + width: 36, + height: 4, + margin: const EdgeInsets.only(bottom: 10), + decoration: BoxDecoration( + color: scheme.outline, + borderRadius: BorderRadius.circular(2), + ), + ), + Row( + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: Theme.of(context).textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w700, + letterSpacing: -0.2, + ), + ), + if (subtitle != null) + Text( + subtitle!, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ?trailing, + IconButton( + icon: const Icon(Icons.close, size: 20), + onPressed: () => Navigator.of(context).maybePop(), + ), + ], + ), + ], + ), + ); + } +} + +/// Shows a modal bottom sheet with the app-standard shape, scroll behavior +/// and safe-area handling. Pair the content with [BottomSheetHeader]. +Future showMeshSheet( + BuildContext context, { + required WidgetBuilder builder, + bool isScrollControlled = true, +}) { + return showModalBottomSheet( + context: context, + isScrollControlled: isScrollControlled, + useSafeArea: true, + showDragHandle: false, + builder: (context) => Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.viewInsetsOf(context).bottom, + ), + child: builder(context), + ), + ); +} + +/// Inline error surface with an optional retry action. +class ErrorRetryCard extends StatelessWidget { + final String message; + final VoidCallback? onRetry; + final String? retryLabel; + + const ErrorRetryCard({ + super.key, + required this.message, + this.onRetry, + this.retryLabel, + }); + + @override + Widget build(BuildContext context) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + color: scheme.error.withValues(alpha: 0.08), + borderColor: scheme.error.withValues(alpha: 0.35), + child: Row( + children: [ + Icon(Icons.error_outline, color: scheme.error, size: 20), + const SizedBox(width: 10), + Expanded( + child: Text( + message, + style: TextStyle(color: scheme.error, fontSize: 13), + ), + ), + if (onRetry != null) + TextButton( + onPressed: onRetry, + child: Text(retryLabel ?? 'Retry'), + ), + ], + ), + ); + } +} + +/// Staggered fade + slide entrance for list items. Wrap each item and pass +/// its [index]; animation only plays once per widget lifecycle. +class ListEntrance extends StatefulWidget { + final int index; + final Widget child; + + const ListEntrance({super.key, required this.index, required this.child}); + + @override + State createState() => _ListEntranceState(); +} + +class _ListEntranceState extends State + with SingleTickerProviderStateMixin { + // Created eagerly: a lazy `late final` initializer would run on first + // access — which can be dispose(), where ticker creation throws. + late final AnimationController _controller; + late final CurvedAnimation _curve; + + @override + void initState() { + super.initState(); + _controller = AnimationController( + vsync: this, + duration: const Duration(milliseconds: 280), + ); + _curve = CurvedAnimation( + parent: _controller, + curve: Curves.easeOutCubic, + ); + final delay = Duration(milliseconds: 24 * widget.index.clamp(0, 12)); + Future.delayed(delay, () { + if (mounted) _controller.forward(); + }); + } + + @override + void dispose() { + _curve.dispose(); + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return FadeTransition( + opacity: _curve, + child: SlideTransition( + position: Tween( + begin: const Offset(0, 0.04), + end: Offset.zero, + ).animate(_curve), + child: widget.child, + ), + ); + } +} diff --git a/lib/widgets/message_status_icon.dart b/lib/widgets/message_status_icon.dart index cf9cd7d6..1d2bbd45 100644 --- a/lib/widgets/message_status_icon.dart +++ b/lib/widgets/message_status_icon.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class MessageStatusIcon extends StatefulWidget { final bool isAcked; @@ -71,7 +72,11 @@ class _MessageStatusIconState extends State if (widget.isFailed) { return Semantics( label: l10n.messageStatus_failed, - child: Icon(Icons.cancel, size: size, color: colorScheme.error), + child: Icon( + Icons.cancel, + size: size, + color: colorScheme.error, + ), ); } @@ -92,7 +97,10 @@ class _MessageStatusIconState extends State : widget.isAcked ? l10n.messageStatus_delivered : l10n.messageStatus_sent; - final Color color = delivered ? colorScheme.tertiary : baseColor; + // Use palette colors: tertiary (warn/amber) for acked/repeated, base for sent. + final Color color = delivered + ? MeshPalette.signal.withValues(alpha: 0.9) + : baseColor; return Semantics( label: label, diff --git a/lib/widgets/path_map_ui.dart b/lib/widgets/path_map_ui.dart new file mode 100644 index 00000000..cfd3672e --- /dev/null +++ b/lib/widgets/path_map_ui.dart @@ -0,0 +1,659 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; +import 'package:latlong2/latlong.dart'; + +import '../l10n/l10n.dart'; +import '../models/display_path.dart'; +import '../models/path_playback.dart'; +import '../theme/mesh_theme.dart'; + +/// Shared UI for the path map screens (live path trace and received-message +/// path map): packet-flow animation overlays, single/combined view toggle, +/// playback controls, and the multi-path summary/legend. + +enum PathViewMode { single, combined } + +const Color kPrimaryPathColor = Colors.blueAccent; +const List kAlternatePathColors = [ + Color(0xFF8B5CF6), // purple + MeshPalette.signal, // green + MeshPalette.warn, // amber + MeshPalette.magenta, +]; + +double getPathDistanceMeters(List points) { + if (points.length <= 1) return 0.0; + + double distanceMeters = 0.0; + final distanceCalculator = Distance(); + + for (int i = 0; i < points.length - 1; i++) { + distanceMeters += distanceCalculator(points[i], points[i + 1]); + } + + return distanceMeters; +} + +String formatDistance(double distanceMeters, {required bool isImperial}) { + if (isImperial) { + return '(${(distanceMeters / 1609.34).toStringAsFixed(2)} mi)'; + } + return '(${(distanceMeters / 1000).toStringAsFixed(2)} km)'; +} + +String formatLastObserved(BuildContext context, DateTime timestamp) { + final l10n = context.l10n; + final diff = DateTime.now().difference(timestamp); + if (diff.isNegative || diff.inMinutes < 5) return l10n.contacts_lastSeenNow; + if (diff.inMinutes < 60) return l10n.contacts_lastSeenMinsAgo(diff.inMinutes); + if (diff.inHours < 24) { + return diff.inHours == 1 + ? l10n.contacts_lastSeenHourAgo + : l10n.contacts_lastSeenHoursAgo(diff.inHours); + } + return diff.inDays == 1 + ? l10n.contacts_lastSeenDayAgo + : l10n.contacts_lastSeenDaysAgo(diff.inDays); +} + +/// Polylines for the visible paths: shared-segment halos (combined view), +/// dashed runs for estimated segments, dimming for unfocused paths and for +/// the selected path while its packet animation is running. +List buildMultiPathPolylines({ + required List visible, + required DisplayPath? selected, + required bool combined, + required bool animating, +}) { + final lines = []; + + if (combined && visible.length > 1) { + final counts = {}; + for (final path in visible) { + for (var i = 0; i < path.points.length - 1; i++) { + counts.update( + _segmentKey(path.points[i], path.points[i + 1]), + (v) => v + 1, + ifAbsent: () => 1, + ); + } + } + final drawn = {}; + for (final path in visible) { + for (var i = 0; i < path.points.length - 1; i++) { + final key = _segmentKey(path.points[i], path.points[i + 1]); + if ((counts[key] ?? 0) < 2 || !drawn.add(key)) continue; + lines.add( + Polyline( + points: [path.points[i], path.points[i + 1]], + strokeWidth: 11, + color: Colors.white.withValues(alpha: 0.22), + ), + ); + } + } + } + + void addPath(DisplayPath path, {required bool isSelected}) { + final dimmedByFocus = combined && !isSelected; + final alpha = dimmedByFocus ? 0.38 : (isSelected && animating ? 0.30 : 1.0); + final width = isSelected ? 5.0 : 3.0; + var i = 0; + while (i < path.segmentEstimated.length) { + final dashed = path.segmentEstimated[i]; + var j = i; + while (j < path.segmentEstimated.length && + path.segmentEstimated[j] == dashed) { + j++; + } + lines.add( + Polyline( + points: path.points.sublist(i, j + 1), + strokeWidth: width, + color: path.color.withValues(alpha: alpha), + pattern: dashed + ? StrokePattern.dashed(segments: const [10, 7]) + : const StrokePattern.solid(), + ), + ); + i = j; + } + } + + for (final path in visible) { + if (path.id != selected?.id) addPath(path, isSelected: false); + } + if (selected != null && visible.any((p) => p.id == selected.id)) { + addPath(selected, isSelected: true); + } + + return lines; +} + +String _segmentKey(LatLng a, LatLng b) { + final ka = + '${a.latitude.toStringAsFixed(6)},${a.longitude.toStringAsFixed(6)}'; + final kb = + '${b.latitude.toStringAsFixed(6)},${b.longitude.toStringAsFixed(6)}'; + return ka.compareTo(kb) <= 0 ? '$ka|$kb' : '$kb|$ka'; +} + +/// Bright traversed portion plus the glow on the active segment. +List buildPacketTrailPolylines( + PathPlaybackController playback, + Color color, +) { + if (!playback.started || !playback.hasPath) return const []; + final seg = playback.currentSegment; + final traversed = [ + ...playback.points.take(seg + 1), + playback.position, + ]; + return [ + Polyline( + points: [playback.points[seg], playback.position], + strokeWidth: 8, + color: Colors.white.withValues(alpha: 0.45), + ), + Polyline(points: traversed, strokeWidth: 5, color: color), + ]; +} + +/// The moving packet dot and the pulse ring at the hop it just reached. +List buildPacketMarkers( + PathPlaybackController playback, + Color color, +) { + if (!playback.started || !playback.hasPath) return const []; + final markers = []; + + final dwell = playback.dwellProgress; + if (dwell != null) { + final reached = playback.points[playback.reachedPointIndex]; + markers.add( + Marker( + point: reached, + width: 56, + height: 56, + child: IgnorePointer( + child: Center( + child: Container( + width: 24 + 28 * dwell, + height: 24 + 28 * dwell, + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: color.withValues(alpha: 1.0 - dwell), + width: 3, + ), + ), + ), + ), + ), + ), + ); + } + + markers.add( + Marker( + point: playback.position, + width: 24, + height: 24, + child: IgnorePointer( + child: Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + color: color, + border: Border.all(color: Colors.white, width: 2), + boxShadow: [ + BoxShadow( + color: color.withValues(alpha: 0.7), + blurRadius: 12, + spreadRadius: 2, + ), + ], + ), + ), + ), + ), + ); + + return markers; +} + +/// Bottom sheet listing the paths that pass through a shared node. +void showSharedNodeSheet( + BuildContext context, { + required String title, + required List paths, + required ValueChanged onSelect, +}) { + final l10n = context.l10n; + showModalBottomSheet( + context: context, + builder: (sheetContext) => SafeArea( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 4), + child: Text( + title, + style: MeshTheme.mono( + fontSize: 14, + fontWeight: FontWeight.w700, + color: MeshPalette.ink, + ), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Text( + l10n.pathMap_sharedNodeCount(paths.length), + style: TextStyle(fontSize: 12, color: MeshPalette.ink3), + ), + ), + const SizedBox(height: 8), + for (final path in paths) + ListTile( + dense: true, + leading: _colorDot(path.color), + title: Text( + path.label, + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink), + ), + trailing: Text( + l10n.pathMap_hopCount(path.totalTransmissions), + style: MeshTheme.mono(fontSize: 11, color: MeshPalette.ink3), + ), + onTap: () { + Navigator.pop(sheetContext); + onSelect(path); + }, + ), + const SizedBox(height: 8), + ], + ), + ), + ); +} + +Widget _colorDot(Color color) => Container( + width: 10, + height: 10, + decoration: BoxDecoration(color: color, shape: BoxShape.circle), +); + +/// Floating Single/Combined toggle for the top of a path map Stack. +class PathViewModeToggle extends StatelessWidget { + final PathViewMode mode; + final ValueChanged onChanged; + + const PathViewModeToggle({ + super.key, + required this.mode, + required this.onChanged, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Positioned( + top: 12, + left: 0, + right: 0, + child: Center( + child: DecoratedBox( + decoration: BoxDecoration( + color: MeshPalette.bg1.withValues(alpha: 0.92), + borderRadius: BorderRadius.circular(MeshRadii.pill), + ), + child: SegmentedButton( + style: const ButtonStyle( + visualDensity: VisualDensity(horizontal: -3, vertical: -3), + ), + showSelectedIcon: false, + segments: [ + ButtonSegment( + value: PathViewMode.single, + label: Text(l10n.pathMap_viewSingle), + ), + ButtonSegment( + value: PathViewMode.combined, + label: Text(l10n.pathMap_viewCombined), + ), + ], + selected: {mode}, + onSelectionChanged: (selection) => onChanged(selection.first), + ), + ), + ), + ); + } +} + +/// Compact playback control row: animation toggle, step/play/replay buttons, +/// follow-packet lock, speed chip, and the live "Hop x of y · from → to" +/// label. +class PathAnimationControls extends StatelessWidget { + final PathPlaybackController playback; + final DisplayPath? selected; + final bool animationEnabled; + final VoidCallback onToggleAnimation; + final bool followEnabled; + final VoidCallback onToggleFollow; + + const PathAnimationControls({ + super.key, + required this.playback, + required this.selected, + required this.animationEnabled, + required this.onToggleAnimation, + required this.followEnabled, + required this.onToggleFollow, + }); + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: playback, + builder: (context, _) { + final l10n = context.l10n; + final enabled = animationEnabled && playback.hasPath; + final path = selected; + String? hopLabel; + if (animationEnabled && + playback.started && + playback.hasPath && + path != null) { + final seg = playback.currentSegment; + final row = seg < path.rowForSegment.length + ? path.rowForSegment[seg] + : 0; + final from = path.pointLabels[seg]; + final to = path.pointLabels[seg + 1]; + hopLabel = + '${l10n.pathMap_hopOf(row + 1, path.totalTransmissions)} · $from → $to'; + } + + Widget controlButton({ + required IconData icon, + required String tooltip, + VoidCallback? onPressed, + Color? color, + }) => IconButton( + icon: Icon(icon, size: 20, color: color), + tooltip: tooltip, + onPressed: onPressed, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: 34, minHeight: 34), + ); + + return Padding( + padding: const EdgeInsets.fromLTRB(4, 0, 12, 2), + child: Row( + children: [ + controlButton( + icon: Icons.animation, + tooltip: animationEnabled + ? l10n.pathMap_animationOff + : l10n.pathMap_animationOn, + color: animationEnabled ? MeshPalette.blue : MeshPalette.ink4, + onPressed: onToggleAnimation, + ), + controlButton( + icon: Icons.skip_previous, + tooltip: l10n.pathMap_stepBack, + onPressed: enabled && playback.started + ? playback.stepBack + : null, + ), + controlButton( + icon: playback.playing ? Icons.pause : Icons.play_arrow, + tooltip: playback.playing ? l10n.pathMap_pause : l10n.pathMap_play, + onPressed: enabled ? playback.togglePlay : null, + ), + controlButton( + icon: Icons.skip_next, + tooltip: l10n.pathMap_stepForward, + onPressed: enabled ? playback.stepForward : null, + ), + controlButton( + icon: Icons.replay, + tooltip: l10n.pathMap_replay, + onPressed: enabled ? playback.replay : null, + ), + controlButton( + icon: followEnabled ? Icons.lock : Icons.lock_open, + tooltip: followEnabled + ? l10n.pathMap_unfollowPacket + : l10n.pathMap_followPacket, + color: followEnabled ? MeshPalette.blue : null, + onPressed: enabled ? onToggleFollow : null, + ), + TextButton( + onPressed: enabled ? playback.cycleSpeed : null, + style: TextButton.styleFrom( + visualDensity: VisualDensity.compact, + padding: const EdgeInsets.symmetric(horizontal: 6), + minimumSize: const Size(36, 30), + ), + child: Text( + playback.speed == 0.5 ? '0.5×' : '${playback.speed.toInt()}×', + style: MeshTheme.mono(fontSize: 12), + ), + ), + Expanded( + child: Text( + hopLabel ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.right, + style: MeshTheme.mono( + fontSize: 10.5, + color: MeshPalette.ink2, + ), + ), + ), + ], + ), + ); + }, + ); + } +} + +/// Marker/line style legend swatches. +class PathMiniLegend extends StatelessWidget { + final bool combined; + final bool showInferred; + + const PathMiniLegend({ + super.key, + required this.combined, + this.showInferred = true, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + Widget item(Widget swatch, String text) => Row( + mainAxisSize: MainAxisSize.min, + children: [ + swatch, + const SizedBox(width: 4), + Text(text, style: TextStyle(fontSize: 11, color: MeshPalette.ink3)), + ], + ); + Widget dashSample() => Row( + mainAxisSize: MainAxisSize.min, + children: [ + for (var i = 0; i < 3; i++) + Container( + width: 5, + height: 3, + margin: const EdgeInsets.only(right: 2), + color: MeshPalette.ink3, + ), + ], + ); + return Wrap( + spacing: 12, + runSpacing: 2, + children: [ + item(_colorDot(MeshPalette.signal), l10n.pathTrace_legendGpsConfirmed), + if (showInferred) + item(_colorDot(MeshPalette.warn), l10n.pathTrace_legendInferred), + if (combined) ...[ + item( + Container( + width: 14, + height: 6, + decoration: BoxDecoration( + color: Colors.white.withValues(alpha: 0.35), + borderRadius: BorderRadius.circular(3), + ), + ), + l10n.pathMap_legendShared, + ), + item(dashSample(), l10n.pathMap_legendEstimated), + ], + ], + ); + } +} + +/// "Observed paths: N" header plus one selectable row per path with hop +/// count, distance, GPS-confirmed count, last-observed time, and an eye +/// toggle for visibility. +class PathSummaryList extends StatelessWidget { + final List paths; + final String selectedId; + final Set hiddenIds; + final bool isImperial; + final ValueChanged onSelect; + final ValueChanged onToggleVisibility; + final VoidCallback onShowAll; + + const PathSummaryList({ + super.key, + required this.paths, + required this.selectedId, + required this.hiddenIds, + required this.isImperial, + required this.onSelect, + required this.onToggleVisibility, + required this.onShowAll, + }); + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(12, 2, 12, 0), + child: Row( + children: [ + Text( + l10n.pathMap_observedPaths(paths.length), + style: MeshTheme.accentLabel(color: MeshPalette.ink3), + ), + const Spacer(), + if (hiddenIds.isNotEmpty) + TextButton( + onPressed: onShowAll, + style: TextButton.styleFrom( + visualDensity: VisualDensity.compact, + padding: const EdgeInsets.symmetric(horizontal: 8), + minimumSize: const Size(0, 26), + ), + child: Text( + l10n.pathMap_showAllPaths, + style: const TextStyle(fontSize: 11), + ), + ), + ], + ), + ), + for (final path in paths) _buildRow(context, path), + const SizedBox(height: 4), + ], + ); + } + + Widget _buildRow(BuildContext context, DisplayPath path) { + final l10n = context.l10n; + final isSelected = path.id == selectedId; + final hidden = hiddenIds.contains(path.id); + final timestamp = path.record?.timestamp; + final parts = [ + '${l10n.pathMap_hopCount(path.totalTransmissions)} ${formatDistance(path.distanceMeters, isImperial: isImperial)}', + l10n.pathMap_gpsCount(path.gpsConfirmedHops, path.hopBytes.length), + if (timestamp != null) formatLastObserved(context, timestamp), + ]; + + return InkWell( + onTap: () => onSelect(path), + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 1), + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + decoration: BoxDecoration( + color: isSelected ? MeshPalette.bg3 : Colors.transparent, + borderRadius: BorderRadius.circular(MeshRadii.sm), + ), + child: Row( + children: [ + Opacity( + opacity: hidden ? 0.45 : 1, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + _colorDot(path.color), + const SizedBox(width: 8), + Text( + path.label, + style: MeshTheme.mono( + fontSize: 12, + fontWeight: isSelected + ? FontWeight.w700 + : FontWeight.w500, + color: MeshPalette.ink, + ), + ), + ], + ), + ), + const SizedBox(width: 8), + Expanded( + child: Opacity( + opacity: hidden ? 0.45 : 1, + child: Text( + parts.join(' · '), + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: MeshTheme.mono(fontSize: 10.5, color: MeshPalette.ink3), + ), + ), + ), + IconButton( + icon: Icon( + hidden ? Icons.visibility_off : Icons.visibility, + size: 16, + color: hidden ? MeshPalette.ink4 : MeshPalette.ink3, + ), + tooltip: hidden ? l10n.pathMap_showPath : l10n.pathMap_hidePath, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + constraints: const BoxConstraints(minWidth: 30, minHeight: 30), + onPressed: () => onToggleVisibility(path), + ), + ], + ), + ), + ); + } +} diff --git a/lib/widgets/quick_switch_bar.dart b/lib/widgets/quick_switch_bar.dart index bcb4781f..90b90b40 100644 --- a/lib/widgets/quick_switch_bar.dart +++ b/lib/widgets/quick_switch_bar.dart @@ -2,12 +2,14 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class QuickSwitchBar extends StatelessWidget { final int selectedIndex; final ValueChanged onDestinationSelected; final int contactsUnreadCount; final int channelsUnreadCount; + final bool highContrast; const QuickSwitchBar({ super.key, @@ -15,6 +17,7 @@ class QuickSwitchBar extends StatelessWidget { required this.onDestinationSelected, this.contactsUnreadCount = 0, this.channelsUnreadCount = 0, + this.highContrast = false, }); @override @@ -22,6 +25,14 @@ class QuickSwitchBar extends StatelessWidget { final theme = Theme.of(context); final colorScheme = theme.colorScheme; final labelStyle = theme.textTheme.labelMedium ?? const TextStyle(); + final background = highContrast ? MapPalette.panelDark : Colors.transparent; + final selectedColor = highContrast + ? MapPalette.textPrimary + : colorScheme.onPrimary; + final unselectedColor = highContrast + ? MapPalette.textSecondary + : colorScheme.onSurfaceVariant; + final indicator = highContrast ? MapPalette.selected : colorScheme.primary; return SizedBox( width: double.infinity, @@ -31,9 +42,11 @@ class QuickSwitchBar extends StatelessWidget { filter: ImageFilter.blur(sigmaX: 14, sigmaY: 14), child: DecoratedBox( decoration: BoxDecoration( - color: Colors.transparent, + color: background, border: Border.all( - color: colorScheme.outlineVariant.withValues(alpha: 0.4), + color: highContrast + ? MapPalette.border + : colorScheme.outlineVariant.withValues(alpha: 0.4), ), ), child: NavigationBarTheme( @@ -41,22 +54,18 @@ class QuickSwitchBar extends StatelessWidget { backgroundColor: Colors.transparent, surfaceTintColor: Colors.transparent, shadowColor: Colors.transparent, - indicatorColor: colorScheme.primaryContainer, + indicatorColor: indicator, labelTextStyle: WidgetStateProperty.resolveWith((states) { final isSelected = states.contains(WidgetState.selected); return labelStyle.copyWith( fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500, - color: isSelected - ? colorScheme.onPrimaryContainer - : colorScheme.onSurfaceVariant, + color: isSelected ? selectedColor : unselectedColor, ); }), iconTheme: WidgetStateProperty.resolveWith((states) { final isSelected = states.contains(WidgetState.selected); return IconThemeData( - color: isSelected - ? colorScheme.onPrimaryContainer - : colorScheme.onSurfaceVariant, + color: isSelected ? selectedColor : unselectedColor, ); }), ), diff --git a/lib/widgets/radio_stats_entry.dart b/lib/widgets/radio_stats_entry.dart index d5fbc670..aab7c4de 100644 --- a/lib/widgets/radio_stats_entry.dart +++ b/lib/widgets/radio_stats_entry.dart @@ -7,6 +7,9 @@ import 'package:meshcore_open/l10n/l10n.dart'; import 'package:meshcore_open/screens/companion_radio_stats_screen.dart'; import 'package:provider/provider.dart'; +import '../theme/mesh_theme.dart'; +import 'mesh_ui.dart'; + void pushCompanionRadioStatsScreen(BuildContext context) { Navigator.push( context, @@ -140,12 +143,12 @@ class AirActivityDotState extends State { @override Widget build(BuildContext context) { - final scheme = Theme.of(context).colorScheme; final on = widget.active && _blink; - return Icon( - Icons.circle, - size: 12, - color: on ? scheme.primary : scheme.outline, + final scheme = Theme.of(context).colorScheme; + return PulseDot( + color: on ? MeshPalette.blue : scheme.outline, + size: 11, + animate: false, ); } } diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 5b45037d..207bbe5d 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -9,6 +9,8 @@ import '../l10n/contact_localization.dart'; import '../services/storage_service.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../utils/app_logger.dart'; import 'routing_sheet.dart'; @@ -269,26 +271,40 @@ class _RepeaterLoginDialogState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final repeater = _resolveRepeater(connector); final isFloodMode = repeater.pathOverride == -1; return AlertDialog( title: Row( children: [ - Icon(Icons.cell_tower, color: Theme.of(context).colorScheme.tertiary), - const SizedBox(width: 8), + AvatarCircle( + name: repeater.name, + size: 40, + color: MeshPalette.warn, + icon: Icons.cell_tower, + ), + const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(l10n.login_repeaterLogin), + Text( + l10n.login_repeaterLogin, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), Text( repeater.name, style: TextStyle( - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.normal, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), @@ -319,14 +335,14 @@ class _RepeaterLoginDialogState extends State { Icon( Icons.error, size: 18, - color: Theme.of(context).colorScheme.error, + color: scheme.error, ), const SizedBox(width: 8), Expanded( child: Text( _loginError!, style: TextStyle( - color: Theme.of(context).colorScheme.error, + color: scheme.error, fontSize: 13, ), ), @@ -341,7 +357,6 @@ class _RepeaterLoginDialogState extends State { decoration: InputDecoration( labelText: l10n.login_password, hintText: l10n.login_enterPassword, - border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.lock), suffixIcon: IconButton( icon: Icon( @@ -390,9 +405,9 @@ class _RepeaterLoginDialogState extends State { children: [ Text( l10n.login_routing, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 11, ), ), const Spacer(), @@ -421,7 +436,7 @@ class _RepeaterLoginDialogState extends State { Icons.auto_mode, size: 20, color: !isFloodMode - ? Theme.of(context).primaryColor + ? scheme.primary : null, ), const SizedBox(width: 8), @@ -444,7 +459,7 @@ class _RepeaterLoginDialogState extends State { Icons.waves, size: 20, color: isFloodMode - ? Theme.of(context).primaryColor + ? scheme.primary : null, ), const SizedBox(width: 8), @@ -468,7 +483,7 @@ class _RepeaterLoginDialogState extends State { repeater.pathLabel(context.l10n), style: TextStyle( fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, ), ), const SizedBox(height: 8), @@ -502,7 +517,7 @@ class _RepeaterLoginDialogState extends State { height: 16, child: CircularProgressIndicator( strokeWidth: 2, - color: Theme.of(context).colorScheme.onPrimary, + color: scheme.onPrimary, ), ), const SizedBox(width: 12), diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index a6475cfb..34a3f994 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -10,6 +10,8 @@ import '../l10n/contact_localization.dart'; import '../services/storage_service.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../theme/mesh_theme.dart'; +import '../widgets/mesh_ui.dart'; import '../utils/app_logger.dart'; import '../helpers/snack_bar_builder.dart'; import 'routing_sheet.dart'; @@ -226,26 +228,40 @@ class _RoomLoginDialogState extends State { @override Widget build(BuildContext context) { final l10n = context.l10n; + final scheme = Theme.of(context).colorScheme; final connector = context.watch(); final repeater = _resolveRepeater(connector); final isFloodMode = repeater.pathOverride == -1; return AlertDialog( title: Row( children: [ - Icon(Icons.group, color: Theme.of(context).colorScheme.secondary), - const SizedBox(width: 8), + AvatarCircle( + name: repeater.name, + size: 40, + color: MeshPalette.magenta, + icon: Icons.group, + ), + const SizedBox(width: 12), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(l10n.login_roomLogin), + Text( + l10n.login_roomLogin, + style: const TextStyle( + fontSize: 16, + fontWeight: FontWeight.w700, + ), + ), Text( repeater.name, style: TextStyle( - fontSize: 14, + fontSize: 13, fontWeight: FontWeight.normal, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), @@ -275,7 +291,6 @@ class _RoomLoginDialogState extends State { decoration: InputDecoration( labelText: l10n.login_password, hintText: l10n.login_enterPassword, - border: const OutlineInputBorder(), prefixIcon: const Icon(Icons.lock), suffixIcon: IconButton( icon: Icon( @@ -319,9 +334,9 @@ class _RoomLoginDialogState extends State { children: [ Text( l10n.login_routing, - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, + style: MeshTheme.accentLabel( + color: scheme.onSurfaceVariant, + fontSize: 11, ), ), const Spacer(), @@ -350,7 +365,7 @@ class _RoomLoginDialogState extends State { Icons.auto_mode, size: 20, color: !isFloodMode - ? Theme.of(context).primaryColor + ? scheme.primary : null, ), const SizedBox(width: 8), @@ -373,7 +388,7 @@ class _RoomLoginDialogState extends State { Icons.waves, size: 20, color: isFloodMode - ? Theme.of(context).primaryColor + ? scheme.primary : null, ), const SizedBox(width: 8), @@ -397,7 +412,7 @@ class _RoomLoginDialogState extends State { repeater.pathLabel(context.l10n), style: TextStyle( fontSize: 11, - color: Theme.of(context).colorScheme.onSurfaceVariant, + color: scheme.onSurfaceVariant, ), ), const SizedBox(height: 8), @@ -431,7 +446,7 @@ class _RoomLoginDialogState extends State { height: 16, child: CircularProgressIndicator( strokeWidth: 2, - color: Theme.of(context).colorScheme.onPrimary, + color: scheme.onPrimary, ), ), const SizedBox(width: 12), diff --git a/lib/widgets/signal_ui.dart b/lib/widgets/signal_ui.dart index e0e05111..0edcb9af 100644 --- a/lib/widgets/signal_ui.dart +++ b/lib/widgets/signal_ui.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import '../theme/mesh_theme.dart'; class SignalUi { final IconData icon; @@ -12,27 +13,27 @@ SignalUi signalUiForStrengthTier(int tier) { case 0: return const SignalUi( icon: Icons.signal_cellular_4_bar, - color: Colors.green, + color: MeshPalette.signal, ); case 1: return const SignalUi( icon: Icons.signal_cellular_alt, - color: Colors.lightGreen, + color: MeshPalette.signalDim, ); case 2: return const SignalUi( icon: Icons.signal_cellular_alt_2_bar, - color: Colors.amber, + color: MeshPalette.warn, ); case 3: return const SignalUi( icon: Icons.signal_cellular_alt_1_bar, - color: Colors.orange, + color: MeshPalette.warnDim, ); default: return const SignalUi( icon: Icons.signal_cellular_alt_1_bar, - color: Colors.red, + color: MeshPalette.alert, ); } } diff --git a/lib/widgets/snr_indicator.dart b/lib/widgets/snr_indicator.dart index 21efffd1..f57776de 100644 --- a/lib/widgets/snr_indicator.dart +++ b/lib/widgets/snr_indicator.dart @@ -5,6 +5,8 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; +import '../theme/mesh_theme.dart'; +import 'mesh_ui.dart'; import 'signal_ui.dart'; Contact? _getRepeaterPrefixMatchNearLocation( @@ -218,10 +220,6 @@ class _SNRIndicatorState extends State { separatorBuilder: (_, _) => const Divider(height: 1), itemBuilder: (context, index) { final repeater = directBestRepeaters[index]; - final snrUi = snrUiFromSNR( - repeater.snr, - widget.connector.currentSf, - ); final allContacts = widget.connector.allContacts; final selfLat = widget.connector.selfLatitude; @@ -242,22 +240,47 @@ class _SNRIndicatorState extends State { ); final name = contact?.name; + final hex = repeater.pubkeyFirstByte + .toRadixString(16) + .padLeft(2, '0'); + final snrColor = MeshTheme.snrColor( + repeater.snr, + blocked: false, + ); - return Column( - children: [ - ListTile( - leading: Icon(snrUi.icon, color: snrUi.color), - title: Text( - name ?? - repeater.pubkeyFirstByte - .toRadixString(16) - .padLeft(2, '0'), + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 10, + ), + child: Row( + children: [ + AvatarCircle( + name: name ?? hex, + size: 36, + color: snrColor, ), - subtitle: Text( - 'SNR: ${repeater.snr.toStringAsFixed(1)} dB\n${l10n.snrIndicator_lastSeen}: ${_formatLastUpdated(repeater.lastUpdated)}', + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + name ?? hex, + style: Theme.of(context).textTheme.bodyMedium, + ), + Text( + '${repeater.snr.toStringAsFixed(1)} dB • ${_formatLastUpdated(repeater.lastUpdated)}', + style: MeshTheme.mono( + fontSize: 11, + color: snrColor, + ), + ), + ], + ), ), - ), - ], + ], + ), ); }, ), diff --git a/lib/widgets/telemetry_location_map.dart b/lib/widgets/telemetry_location_map.dart index a73fb640..f8983c04 100644 --- a/lib/widgets/telemetry_location_map.dart +++ b/lib/widgets/telemetry_location_map.dart @@ -11,6 +11,7 @@ import '../models/app_settings.dart'; import '../models/contact.dart'; import '../services/app_settings_service.dart'; import '../services/map_tile_cache_service.dart'; +import 'themed_map_tile_layer.dart'; class TelemetryLocationMap extends StatefulWidget { final double latitude; @@ -114,13 +115,7 @@ class _TelemetryLocationMapState extends State { ), ), children: [ - TileLayer( - urlTemplate: kMapTileUrlTemplate, - tileProvider: tileCache.tileProvider, - userAgentPackageName: - MapTileCacheService.userAgentPackageName, - maxZoom: 19, - ), + ThemedMapTileLayer(tileCache: tileCache), MarkerLayer( markers: [ ...contacts.map(_buildContactMarker), diff --git a/lib/widgets/themed_map_tile_layer.dart b/lib/widgets/themed_map_tile_layer.dart new file mode 100644 index 00000000..c6d2eaad --- /dev/null +++ b/lib/widgets/themed_map_tile_layer.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; + +import '../services/map_tile_cache_service.dart'; + +/// Shared cached map tiles with an automatic dark-mode treatment. +/// +/// The dark style transforms the existing OpenStreetMap raster tiles, so light +/// and dark maps share the same offline cache and network requests. +class ThemedMapTileLayer extends StatelessWidget { + final MapTileCacheService tileCache; + final double opacity; + + const ThemedMapTileLayer({ + super.key, + required this.tileCache, + this.opacity = 1, + }); + + static const ColorFilter _darkMapFilter = ColorFilter.matrix([ + -0.0850, + -0.2861, + -0.0289, + 0, + 120, + -0.0957, + -0.3218, + -0.0325, + 0, + 140, + -0.1169, + -0.3934, + -0.0397, + 0, + 170, + 0, + 0, + 0, + 1, + 0, + ]); + + @override + Widget build(BuildContext context) { + Widget layer = TileLayer( + urlTemplate: kMapTileUrlTemplate, + tileProvider: tileCache.tileProvider, + userAgentPackageName: MapTileCacheService.userAgentPackageName, + maxZoom: 19, + ); + + if (Theme.of(context).brightness == Brightness.dark) { + layer = ColorFiltered(colorFilter: _darkMapFilter, child: layer); + } + if (opacity < 1) { + layer = Opacity(opacity: opacity, child: layer); + } + return layer; + } +} diff --git a/lib/widgets/unread_badge.dart b/lib/widgets/unread_badge.dart index 424cb6f5..1cf5c1d6 100644 --- a/lib/widgets/unread_badge.dart +++ b/lib/widgets/unread_badge.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import '../theme/mesh_theme.dart'; + class UnreadBadge extends StatelessWidget { final int count; @@ -9,17 +11,18 @@ class UnreadBadge extends StatelessWidget { Widget build(BuildContext context) { final display = count > 9999 ? '9999+' : count.toString(); return Container( - padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2), decoration: BoxDecoration( - color: Colors.redAccent, - borderRadius: BorderRadius.circular(10), + color: MeshPalette.blue.withValues(alpha: 0.18), + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: MeshPalette.blue.withValues(alpha: 0.45)), ), child: Text( display, - style: const TextStyle( - color: Colors.white, + style: MeshTheme.mono( fontSize: 11, - fontWeight: FontWeight.w600, + fontWeight: FontWeight.w700, + color: MeshPalette.blue, ), ), ); diff --git a/lib/widgets/unread_divider.dart b/lib/widgets/unread_divider.dart index f9ebd1d0..d238b1a1 100644 --- a/lib/widgets/unread_divider.dart +++ b/lib/widgets/unread_divider.dart @@ -1,30 +1,49 @@ import 'package:flutter/material.dart'; import '../l10n/l10n.dart'; +import '../theme/mesh_theme.dart'; class UnreadDivider extends StatelessWidget { const UnreadDivider({super.key}); @override Widget build(BuildContext context) { - final color = Theme.of(context).colorScheme.primary; + final scheme = Theme.of(context).colorScheme; + final color = scheme.primary; return Padding( - padding: const EdgeInsets.symmetric(vertical: 8), + padding: const EdgeInsets.symmetric(vertical: 10), child: Row( children: [ - Expanded(child: Divider(color: color)), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), + Expanded( + child: Container( + height: 1, + color: color.withValues(alpha: 0.25), + ), + ), + const SizedBox(width: 10), + Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.12), + borderRadius: BorderRadius.circular(MeshRadii.pill), + border: Border.all(color: color.withValues(alpha: 0.35)), + ), child: Text( context.l10n.chat_newMessages, - style: TextStyle( + style: MeshTheme.mono( + fontSize: 10.5, + fontWeight: FontWeight.w600, color: color, - fontSize: 12, - fontWeight: FontWeight.w500, ), ), ), - Expanded(child: Divider(color: color)), + const SizedBox(width: 10), + Expanded( + child: Container( + height: 1, + color: color.withValues(alpha: 0.25), + ), + ), ], ), ); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 93e46829..379e36fa 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST flserial - jni ) set(PLUGIN_BUNDLED_LIBRARIES) diff --git a/untranslated.json b/untranslated.json index 9e26dfee..c1e57a13 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,698 @@ -{} \ No newline at end of file +{ + "bg": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "de": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "es": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "fr": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "hu": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "it": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "ja": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "ko": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "nl": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "pl": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "pt": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "ru": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "sk": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "sl": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "sv": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "uk": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ], + + "zh": [ + "map_searchHint", + "map_activity", + "map_online", + "map_recent", + "map_stale", + "map_visible", + "map_hidden", + "map_centerOnNode", + "map_details", + "map_noGps", + "map_noResults", + "pathMap_viewSingle", + "pathMap_viewCombined", + "pathMap_play", + "pathMap_pause", + "pathMap_replay", + "pathMap_stepBack", + "pathMap_stepForward", + "pathMap_animationOn", + "pathMap_animationOff", + "pathMap_hopOf", + "pathMap_observedPaths", + "pathMap_primary", + "pathMap_alternate", + "pathMap_hopCount", + "pathMap_gpsCount", + "pathMap_legendShared", + "pathMap_legendEstimated", + "pathMap_sharedNodeCount", + "pathMap_partialAnimation", + "pathMap_showAllPaths", + "pathMap_hidePath", + "pathMap_showPath", + "pathMap_collapsePanel", + "pathMap_expandPanel", + "pathMap_noLocation", + "pathMap_followPacket", + "pathMap_unfollowPacket" + ] +} diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 533a1712..f02857f4 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,7 +11,6 @@ list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_FFI_PLUGIN_LIST flserial flutter_local_notifications_windows - jni ) set(PLUGIN_BUNDLED_LIBRARIES) From 3707acb12458908da925787d0dec1856e3b3fcaa Mon Sep 17 00:00:00 2001 From: zjs81 Date: Fri, 12 Jun 2026 22:55:41 -0700 Subject: [PATCH 33/36] Refactor code structure and remove redundant sections for improved readability and maintainability --- BUGS_FOUND.md | 362 ++++++++++++++++++ lib/connector/meshcore_connector.dart | 34 +- lib/connector/meshcore_connector_usb.dart | 1 + lib/l10n/app_en.arb | 1 + lib/l10n/app_localizations.dart | 6 + lib/l10n/app_localizations_bg.dart | 4 + lib/l10n/app_localizations_de.dart | 4 + lib/l10n/app_localizations_en.dart | 4 + lib/l10n/app_localizations_es.dart | 4 + lib/l10n/app_localizations_fr.dart | 4 + lib/l10n/app_localizations_hu.dart | 4 + lib/l10n/app_localizations_it.dart | 4 + lib/l10n/app_localizations_ja.dart | 4 + lib/l10n/app_localizations_ko.dart | 4 + lib/l10n/app_localizations_nl.dart | 4 + lib/l10n/app_localizations_pl.dart | 4 + lib/l10n/app_localizations_pt.dart | 4 + lib/l10n/app_localizations_ru.dart | 4 + lib/l10n/app_localizations_sk.dart | 4 + lib/l10n/app_localizations_sl.dart | 4 + lib/l10n/app_localizations_sv.dart | 4 + lib/l10n/app_localizations_uk.dart | 4 + lib/l10n/app_localizations_zh.dart | 4 + lib/models/app_settings.dart | 8 +- lib/screens/app_settings_screen.dart | 2 +- lib/screens/chat_screen.dart | 34 +- lib/screens/map_screen.dart | 398 ++++++++++++++++++-- lib/screens/scanner_screen.dart | 9 + lib/screens/settings_screen.dart | 28 +- lib/screens/usb_screen.dart | 14 + lib/services/notification_service.dart | 44 ++- lib/services/usb_serial_service_native.dart | 3 + lib/services/usb_serial_service_web.dart | 59 ++- untranslated.json | 17 + 34 files changed, 1008 insertions(+), 84 deletions(-) create mode 100644 BUGS_FOUND.md diff --git a/BUGS_FOUND.md b/BUGS_FOUND.md new file mode 100644 index 00000000..7553b192 --- /dev/null +++ b/BUGS_FOUND.md @@ -0,0 +1,362 @@ +# MeshCore Open — Bugs Found (Web build, manual QA) + +Session: 2026-06-12 · Build served at `http://localhost:42751/` (Flutter web, debug/DDC) · Browser: Chrome + +Each entry: **Severity** · where · what · repro · expected. + +--- + +## Status +Fixes for BUG-1..4 applied on 2026-06-12 (analyze clean). **BUG-2/3 VERIFIED FIXED live:** USB device `VID:239A PID:8029` now connects on web — console shows `Open: vendorId=0x239a uartBridge=false (DTR left default)` → `Got SELF_INFO` → `connectUsb: complete`, no "device has been lost". Continuing to test the now-reachable connected screens. See "Fixes applied" at the bottom. + +## Open bugs + +### BUG-1 · Medium · USB connect — raw browser exception leaked to UI on picker cancel +- **Where:** "Connect over USB" screen (`usb_screen.dart`), tap **Select a USB device** → Web Serial port picker → dismiss/cancel without choosing a port. +- **What:** A red error snackbar shows the raw browser API string: `NotFoundError: Failed to execute 'requestPort' on 'Serial': No port selected by the user.` +- **Why it's a bug:** (1) Cancelling the port picker is a normal user action, not an error — it should be silent (or a neutral "No device selected" message), not a red error toast. (2) Even for real failures, leaking a raw JS `DOMException` string is poor UX. The catch handler should map known cases (user cancellation) and present friendly copy. +- **Expected:** Cancelling shows nothing or an info-level message; the UI never prints raw exception text. +- **Root cause (confirmed in source):** `usb_screen.dart:396 _friendlyErrorMessage()` maps `PlatformException`/`StateError`/etc., but the web cancel path throws a JS `DOMException` (`NotFoundError`) that matches none of the branches, so it falls through to `return error.toString();` (line 441). A friendly `l10n.usbErrorNoDeviceSelected` string already exists (line 428) but is only matched for a native `StateError` containing `'No USB serial device selected'`, not the web DOMException. Fix: detect the web no-port-selected case and route it to the existing friendly string (or suppress entirely). + +### BUG-2 · HIGH · Web USB connect fails with misleading "Timed out waiting for SELF_INFO" — read-pump error is dropped by a subscription race +- **Where:** `usb_serial_service_web.dart` + `meshcore_connector.dart connectUsb()`. Repro: on web (Chrome), connect to a USB serial device (observed with `Web Serial Device VID:239A PID:8029`, an Adafruit/nRF52840 board). +- **Observed (console, happens every attempt):** + 1. Port opens OK: `USB serial opened port=Web Serial Device (VID:239A PID:8029)` + 2. **Immediately:** `_pumpReads error: NetworkError: The device has been lost.` → `_pumpReads: ended` — the read stream dies the instant it opens. + 3. Connect logic ignores that and proceeds: `requesting device info…`, writes TX frames, `ChannelSync Starting sync for 40 channels`. + 4. Nothing can ever be read back → SELF_INFO + ChannelSync retry/timeout for ~7s. + 5. Ends with `USB connection error: Bad state: Timed out waiting for SELF_INFO during connect` → disconnect. User sees a generic timeout error, not the real cause. +- **Root cause (confirmed in source):** a **subscription-timing race on a broadcast stream**: + - `_frameController` is `StreamController.broadcast()` (`usb_serial_service_web.dart:24-25`). Broadcast streams **do not buffer** — events emitted with no listener attached are silently discarded. + - `_usbManager.connect()` starts `_pumpReads()` fire-and-forget (`usb_serial_service_web.dart:114`). On this device `_pumpReads` errors instantly and calls `_addFrameError()` (line 387/393). + - But `connectUsb()` attaches its error listener **only after** `await Future.delayed(200ms)` (`meshcore_connector.dart:1609`), then `frameStream.listen(onError: → disconnect(), onDone: → disconnect())` (lines 1610-1620). The read-pump error fired during that 200ms gap, so the `onError → disconnect` fail-fast path **never runs**. + - With the safety net disarmed, connect falls through to `_waitForSelfInfo` (3s) + retry (3s) and throws the misleading `Timed out waiting for SELF_INFO during connect` (line 1647). +- **Expected:** A read-stream failure during connect should abort immediately with the real cause ("USB device disconnected / lost"), not a 7-second generic SELF_INFO timeout. +- **Fix directions:** attach the `frameStream` listener (or otherwise observe transport health) *before* the read pump can emit — i.e. before/at port-open, not 200ms later; OR latch the last transport error in the service and have `connectUsb` check it; OR make connect race `_waitForSelfInfo` against a transport-error future. Remove/justify the unconditional 200ms delay that opens the race window. + +### BUG-3 · Likely device-level root cause for BUG-2 · DTR assertion may reset/lose nRF52840 (Adafruit, VID 0x239A) boards +- **Where:** `usb_serial_service_web.dart:285-295 _openPort()`. +- **What:** Immediately after `open()`, the code asserts `setSignals({dataTerminalReady:true, requestToSend:false})` with the comment *"Prevent ESP32 USB-CDC reset"*. That logic is tuned for ESP32. On Adafruit nRF52840 boards (VID `0x239A`, as seen here, PID `0x8029`), toggling DTR is associated with the bootloader/reset line and can cause the device to re-enumerate/reset — which plausibly produces the immediate `NetworkError: The device has been lost.` seen in BUG-2. +- **Status:** Strong hypothesis, not yet isolated (would need to test connecting with the `setSignals` call removed/varied for this board). Flagging because the device class that fails (nRF52840/Adafruit) is exactly the one where DTR semantics differ from ESP32. +- **Expected:** USB serial open should work for nRF52840-class MeshCore boards on web, or DTR handling should be conditional per device/VID. + +### BUG-4 · Medium · BLE "Scan" on web (no Bluetooth adapter / unsupported) gives zero feedback +- **Where:** Scanner screen (`scanner_screen.dart`). Repro: on web with no BLE module (or any web build, since `flutter_blue_plus` doesn't support web), tap **Scan**. +- **What:** Nothing happens — no spinner, no "scanning" state, no error toast, no "Bluetooth unavailable on web" message. The button just sits there and status stays "Not connected". (Confirmed by user: "its not connecting on chrome and my computer doesn't have a ble module".) +- **Expected:** Either disable/hide BLE scan on web (the app already gates non-Chrome via `ChromeRequiredScreen`; Chrome+web still can't use `flutter_blue_plus`), or show a clear "Bluetooth isn't available in the browser — use USB or TCP" message. Silent no-op leaves the user stuck. + +### BUG-5 · Low/Medium · Notifications never work until manually enabled; every incoming message logs an error +- **Where:** `notification_service.dart` — `show()` calls at lines 201/248/306/394/593 are made without ensuring notification permission was granted. +- **What (observed in console while connected):** repeated `Failed to show channel notification: Bad state: FlutterLocalNotifications.show(): You must request notifications permissions first` and the same for advert/message notifications. Each incoming channel message / advert triggers one. +- **Why:** permission is only ever requested from `app_settings_screen.dart:239` (when the user interacts with that setting). If the user never visits it, `requestPermissions()` is never called, so `show()` throws on web (and would on Android 13+ with denied permission). The errors are swallowed by `try/catch` (no crash), but notifications silently never fire and the log fills with errors. +- **Expected:** request notification permission during init / on first connect (or check `areNotificationsEnabled()` and skip `show()` when not granted) instead of calling `show()` unconditionally and relying on a caught exception per message. + +### OBS-1 · RESOLVED (not a bug) · USB-on-web connection dropped after ~4 min (`device has been lost`) +- **What:** At 9:25:13 the read pump errored `NetworkError: The device has been lost.` → `USB transport error` → clean auto-disconnect back to the scanner. +- **Cause:** confirmed by user — they physically dropped/disconnected the radio. So this was a real physical disconnect, NOT a Web Serial stability issue. Positive finding: the app (with the BUG-2 fix) handled an abrupt physical disconnect cleanly and returned to the scanner. + +### BUG-6 · Medium · Battery Chemistry setting permanently disabled on USB (and TCP) connections +- **Where:** App Settings → BATTERY → Battery Chemistry. `app_settings_screen.dart:610-611` gates the control on `connector.deviceId != null`; `meshcore_connector.dart` only ever assigns `_deviceId` in the **BLE** connect path (`_deviceId = device.remoteId.toString()`, line 1839, right after `_activeTransport = bluetooth`). +- **What:** When connected over USB (verified) — and by the same logic TCP — `connector.deviceId` is `null`, so the Battery Chemistry dropdown shows the subtitle "Connect to a device to choose" and is disabled, even though the device is fully connected (header shows `088EDAA0 · Connected`, radio stats live). +- **Why it matters:** USB/TCP users can never set per-device battery chemistry, so the battery percentage indicator uses the wrong voltage curve for their pack. Also user-confusing ("connect first" while connected). +- **Note:** The `088EDAA0` shown throughout the UI is a node/public-key-derived identifier, distinct from `_deviceId` (the BLE remoteId). The battery setting keys off the BLE-only `_deviceId`. +- **Fix direction:** populate a stable per-device identifier in the USB/TCP connect paths (e.g. the node public-key prefix already used for storage scoping), or key battery chemistry off that same node identity rather than the BLE remoteId. + +### BUG-7 · Low/Medium · Node Name can be saved empty (no validation) +- **Where:** Settings → Node Name dialog, `settings_screen.dart:708-744 _editNodeName()`. +- **What:** Clearing the field leaves the **Save** button enabled; the handler (line 728-740) calls `connector.setNodeName(controller.text)` directly with no `trim()`/empty check. An empty or whitespace-only name can be written to the device, leaving the node nameless on the mesh (others see a blank contact). Reproduced: cleared field → "0/31", Save still active. (Did not actually save.) +- **Compare:** the Radio Settings dialog correctly disables Save on invalid input — Node Name should do the same. +- **Expected:** disable Save (or show an error) when the trimmed name is empty. + +### OBS-2 · Watch · Auto-reconnect to cached Web Serial port fails after a physical drop (stale handle) +- **What:** After physical disconnects, the app auto-retries the cached port (`web:port:1`) and fails with `NetworkError: Failed to execute 'open' on 'SerialPort': Failed to open serial port` (seen at 9:26:44, 9:34:23, 9:34:53, ~30s apart). It does eventually recover (header shows Connected again), but the cached `SerialPort` handle is often stale right after an OS-level drop. +- **Note:** the native USB service explicitly documents this class of problem and avoids caching the serial handle (`_freshSerial()` comment, `usb_serial_service_native.dart:47-50`). The web service caches the port object (`_authorizedPortsByKey`), so reopen-after-drop is more fragile. Partly environmental here (user was physically re-plugging), so logged as an observation, not a confirmed bug. Worth confirming the web reconnect path discards/re-requests the port on `open()` failure rather than retry-looping on a dead handle. + +--- + +## Notes / non-bugs +- **Radio Settings validation works:** out-of-range frequency (`9999`) shows "Invalid frequency (300-2500 MHz)" and disables Save. Good. +- **Graceful disconnect verified:** when the USB transport drops, the app auto-navigates back to the scanner and shows "Not connected" — matches the intended "handle disconnection gracefully" behavior. +- **Channel sync starts before handshake completes:** `ChannelSync Starting sync for 40 channels` fires during connect before `SELF_INFO` is confirmed (console 9:07:54). Likely harmless given BUG-2 masks it, but worth confirming the initial-sync pipeline shouldn't wait for SELF_INFO first. +- First load on `localhost:39107` rendered a blank white page and the URL later resolved to `localhost:42751`. This appears to be a dev-server startup/port artifact (the Flutter view never mounted on the first port), not an app bug. Flagging only in case the port hop is intentional behavior worth confirming. + +--- + +## Fixes applied (2026-06-12) + +- **BUG-3 (device-lost root cause):** `usb_serial_service_web.dart _openPort()` now only asserts `setSignals(DTR=true)` for known USB-UART bridge VIDs (`_uartBridgeVendorIds`: CP210x `0x10C4`, CH340 `0x1A86`, FTDI `0x0403`, PL2303 `0x067B`). Native-USB-CDC boards (nRF52840/Adafruit `0x239A`, etc.) are left untouched, since toggling DTR re-enumerates them. Added a debug log line reporting the detected vendorId and whether DTR was asserted. (The native service already documented this exact NRF52/DTR behavior — confirms the hypothesis.) +- **BUG-2 (dropped read-pump error / misleading timeout):** + - `usb_serial_service_web.dart _pumpReads()` now flips `_status = disconnected` and latches `_lastError` when the read loop dies unexpectedly, instead of leaving the service reporting "connected". + - Added `lastError` getter to both web + native `UsbSerialService` and to `MeshCoreUsbManager`. + - `meshcore_connector.dart connectUsb()` now checks `_usbManager.isConnected` right after the 200ms settle delay (before waiting on SELF_INFO) and throws a clear `USB device disconnected during connect: ` using the latched error — failing in ~200ms with the real reason instead of ~7s with a generic SELF_INFO timeout. +- **BUG-1 (raw exception on picker cancel):** `usb_screen.dart` added `_isUserCancelledPortPicker()`; `_showError()` now returns silently for picker cancellation (matches the web `requestPort`/"No port selected" DOMException and the native StateError) instead of showing a red toast with raw text. +- **BUG-4 (silent BLE scan on web):** `scanner_screen.dart _toggleScan()` now short-circuits on web and shows `scanner_bluetoothWebUnsupported` ("Bluetooth isn't available in the browser. Connect over USB instead.") instead of silently no-opping. New l10n key added to `app_en.arb` and regenerated for all locales (English fallback; pending auto-translation). + +## Fixes applied — round 2 (2026-06-12) + +- **BUG-5 (notifications never fire / error spam):** `notification_service.dart` added `_ensureCanNotify()` — caches whether the platform can actually post notifications and is now the gate on all four `show()` entry points (message/advert/channel/batch-summary). Returns false on web (the plugin has no web backend, so `show()` always threw) and honors `areNotificationsEnabled()` on Android 13+. `requestPermissions()` now refreshes the cache so enabling from settings takes effect immediately. The `cancel()` paths still use `_ensureInitialized()` (unchanged). Net: no more per-message error spam; notifications post when actually permitted. +- **BUG-6 (battery chemistry disabled on USB/TCP):** added `MeshCoreConnector.batteryDeviceKey` — returns the BLE remoteId when present (preserves existing BLE-keyed settings) and falls back to the node public key (`selfPublicKeyHex`) on USB/TCP. Both the internal `_batteryChemistryForDevice()` and the App Settings UI (`app_settings_screen.dart`) now key off `batteryDeviceKey` instead of the BLE-only `connector.deviceId`. Battery chemistry is now selectable on USB/TCP, and the battery-% curve is correct for those connections. +- **BUG-7 (empty node name savable):** `settings_screen.dart _editNodeName()` Save button is now wrapped in a `ListenableBuilder` on the text controller and is disabled (`onPressed: null`) when the trimmed name is empty; the handler saves the trimmed value. Mirrors the Radio Settings dialog's validation behavior. + +All four files analyze clean. Pending live re-verification after hot restart (BUG-5: no notification errors in console; BUG-6: Battery Chemistry enabled while on USB). + +--- + +## Suggestions / further work (2026-06-12) + +### Follow-ons directly implied by the fixes +1. **Audit other per-device features for the same BLE-only gap (BUG-6 was probably not alone).** `_deviceId` is set only in the BLE connect path; anything keyed off `connector.deviceId` or `_device?.remoteId` is silently BLE-only on USB/TCP. Grep those usages and verify each works on USB/TCP, or migrate them to `batteryDeviceKey` / `selfPublicKeyHex`. +2. **Battery-chemistry key inconsistency (tradeoff in my BUG-6 fix).** I kept BLE = remoteId and USB/TCP = public key to avoid wiping saved BLE settings. Consequence: the *same physical radio* gets two different chemistry settings depending on transport. Cleaner long-term: key everything off `selfPublicKeyHex` (the canonical per-radio identity used for all other scoped storage) with a one-time migration of existing BLE-keyed values. +3. **Web reconnect should discard a stale port handle (OBS-2).** After a physical drop, auto-reconnect retry-loops on the cached `SerialPort` with `Failed to execute 'open'` before recovering. The native service deliberately avoids caching the handle (`_freshSerial()` comment). On `open()` failure the web service should drop the cached port from `_authorizedPortsByKey` and re-request (or prompt) instead of retrying a dead handle. +4. **DTR allowlist may need expansion (caveat on my BUG-3 fix).** I now assert DTR only for known UART-bridge VIDs (CP210x/CH340/FTDI/PL2303). A future board with an unlisted bridge chip won't get DTR and could reset on open. Consider a per-board config or a user-visible "hold DTR" toggle as a fallback as more hardware is tested. +5. **On web, the notification toggles are ON but inert** (same spirit as BUG-4). Now that `_ensureCanNotify()` correctly skips web, the four NOTIFICATIONS switches in App Settings still read as enabled while doing nothing in-browser. Grey them out / annotate "not available in browser" on web. Also `requestPermissions()` still returns `true` on web (fallback `return true`), which is misleading to its callers. + +### Robustness / architecture +6. **The connect handshake rides on a `broadcast()` stream + an unconditional 200ms delay** — the exact combo that caused BUG-2. My fix (status flip + liveness check) closes the connect race, but any consumer that subscribes late can still miss early frames/errors. Consider readiness signaling instead of the magic delay, and/or buffering the first frames during connect. + +### UX polish observed +7. **Two "Scan" buttons on the scanner empty state** (center button + bottom-right FAB) — redundant. +8. **Verify destructive actions confirm before acting.** I intentionally did NOT trigger "Clear Chat", "Delete All Paths", "Reboot Device", or "Manage Repeater" (not my device). Worth confirming each has a confirmation dialog. +9. **Telemetry screen** had no obvious "request once" affordance — only autorefresh (interval 20 / qty 10 / Enable). A manual one-shot refresh would help. + +### Coverage gaps (NOT tested this session — unverified) +- Repeater management (hub / CLI / settings / status), Line-of-Sight, Path-Trace map, Community QR scanner. +- Discovery & Neighbors screens, Map cache screen, Debug log screens. +- TCP transport (no TCP device available), USB on native (Android/desktop), on-device translation (LLM). +- Contacts search/sort/filter, channel add/reorder, GPX export. + +--- + +## Styling observations (2026-06-12) +Caveat: only viewed **dark mode** in a **wide desktop browser** (~1298px). Light mode and narrow/mobile widths not assessed. + +**The color system is good — credit where due.** `mesh_theme.dart` is a coherent, semantic palette ("high-contrast slate surfaces with sky-blue accents"): slate surface ramp (`0B1220`→`334155`), sky-blue accent (`0EA5E9`), signal-green reserved for SNR only (`22C55E`), amber warn, red alert, magenta node type, a full ink ramp, and a separate light ramp. Not a generic default-Material look. (Note: the CLAUDE.md claim that MeshPalette/MeshTheme is "not currently wired" is **stale** — `main.dart:204-205` wires `MeshTheme.light()/.dark()`.) + +**Issues are layout/responsiveness, not color:** +1. **No max-width constraint on web/desktop (biggest one).** No `ConstrainedBox`/`maxWidth` in `main.dart`; the app is mobile-first and stretches edge-to-edge on a wide window — chat input spans the full ~1300px, list rows are very wide, chat bubbles hug the far edges, settings rows stretch across. Recommend a centered max-width content column (phone-like, ~480–600px) or responsive breakpoints for the web build. +2. **App-bar title alignment is inconsistent.** Main tab screens (Channels/Contacts/Map) use left-aligned titles with a device-id subtitle; detail screens use `centerTitle: true` (23 files) or `AdaptiveAppBarTitle`. Reads slightly inconsistent screen-to-screen — worth one deliberate rule. +3. **Tall-viewport chat spacing.** Bottom-anchored chat leaves a large empty area at the top on a tall window (related to #1 — no height/width framing for big viewports). +4. **Minor:** map node-detail sheet stacked over the older bottom info bar (z-order overlap); the two redundant Scan buttons are also a visual duplication; verify disabled-control contrast is legible (the pre-fix battery dropdown was quite dim). +5. **Unverified:** light theme polish (light ramp exists in the palette but wasn't viewed). + +--- + +# Retry & Path-Selection Analysis (2026-06-12, code review vs firmware) + +Static review of the ACK/retry/path-selection pipeline (`message_retry_service.dart`, `path_history_service.dart`, `timeout_prediction_service.dart`, connector wiring) cross-checked against the MeshCore C++ firmware at `/mnt/Gaming/meshcore/MeshCore`. Verified against actual firmware source, not just docs. + +**What's correct (verified):** +- **ACK-hash algorithm matches the firmware exactly.** Client `computeExpectedAckHash` (`message_retry_service.dart:104-136`) = `SHA256(timestamp[4 LE] ‖ (attempt&3) ‖ text ‖ sender_pubkey[32])`, first 4 bytes as LE uint32. Firmware `BaseChatMesh.cpp:413-419` builds `temp[0..3]=timestamp`, `temp[4]=attempt&3`, `temp[5..]=text` (null *not* hashed — length passed is `5+text_len`), hashed with `self_id.pub_key`. Byte order and endianness round-trip correctly (`RESP_CODE_SENT`/`PUSH_CODE_SEND_CONFIRMED` both LE uint32, `meshcore_connector.dart:5265-5409`). +- **Retry is entirely the client's job** — firmware `sendMessage` sends once, no retry loop. Correct division of responsibility. +- **Per-contact in-flight serialization** (`_sendQueue`, `message_retry_service.dart:174-208`) is the right idea — see RETRY-1 for why it's not *sufficient*. + +## Open findings + +### RETRY-1 · Medium · Per-contact in-flight cap doesn't protect the firmware's *global* 8-entry ACK table +- **Where:** `message_retry_service.dart:174-183` (one in-flight message *per contact*) vs firmware `examples/companion_radio/MyMesh.h:248-250` + `MyMesh.cpp:1100-1103`. +- **What:** The firmware's `expected_ack_table` is a **single global circular buffer of 8 entries** with a global `next_ack_idx`, shared across *all* contacts. The client only guarantees ≤1 in-flight *per contact*, so messaging **9+ contacts concurrently** (e.g. several active conversations whose retries overlap, or a broadcast-style burst) puts >8 entries in flight. The firmware then overwrites the oldest slot (`next_ack_idx = (next_ack_idx+1) % 8`) with no rejection — the evicted message's ACK expectation is silently dropped. +- **Consequence:** the evicted send never produces a `PUSH_CODE_SEND_CONFIRMED`, so the client times out and retries a message the radio already sent (wasted airtime), and can mark as **failed** a message that actually delivered. +- **The code comment is misleading:** `message_retry_service.dart:173-174` says serialization exists "to avoid overflowing the firmware's 8-entry expected_ack_table" — but a per-contact cap does not bound the global table. +- **Fix:** enforce a **global** concurrent-in-flight cap (≤8, ideally ~6 for headroom) across all contacts, not just per-contact; or track `next_ack_idx` pressure and back-pressure new sends. + +### RETRY-2 · Medium · Firmware's reported `est_timeout` is silently discarded +- **Where:** `meshcore_connector.dart calculateTimeout()` (4379-4408); `message_retry_service.dart:405-415`. +- **What:** `RESP_CODE_SENT` carries the device's own `est_timeout` (firmware `MyMesh.cpp:1106-1110`, computed from real `getEstAirtimeFor(...)`). It's parsed into `timeoutMs` and passed to `updateMessageFromSent` as the default `actualTimeout`. But `config.calculateTimeout` is **always** set, so the device value is immediately overwritten on every message — and when the ML model has no data, `calculateTimeout` returns `physicsMax` (line 4407), **never the device-provided value**. +- **Why it's a bug:** the docstring at `message_retry_service.dart:405` ("prefer ML prediction, then device-provided, then physics fallback") describes a tier that doesn't exist — device-provided is never used. The physics fallback re-derives the firmware's flood/direct formulas, but `_estimateAirtimeMs` falls back to a hard-coded **50 ms** when radio params (freq/bw/sf/cr) aren't yet known (`meshcore_connector.dart:4341-...`), which can diverge sharply from the device's actual airtime estimate (e.g. SF12). The device already did this math correctly with the real airtime. +- **Fix:** use the device `timeoutMs` as the fallback when ML is unavailable, and as the clamp ceiling when ML is present — it's strictly better information than a 50 ms guess. + +### RETRY-3 · Medium · Premature ML timeouts can delete good routes (timeout floor too low + aggressive weight decay) +- **Where:** `meshcore_connector.dart _physicsMinTimeout` (≈4360-4375); `message_retry_service.dart:491-538`; `path_history_service.dart:131-141`. +- **What:** For direct paths the timeout floor is `airtime*(hops+1)` — it omits the firmware's base (`SEND_TIMEOUT_BASE_MILLIS=500`) and per-hop processing terms (`6*airtime+250` per hop). So an ML prediction clamps as low as that floor, well under the firmware's own `500 + (6*airtime+250)*hops`. When the timer fires before an ACK could realistically return, `_handleTimeout` records a **false failure** → `recordPathResult(success:false)` decrements `routeWeight` by 0.5. A fresh path starts at weight 1.0, so **two** false timeouts drive it to ≤0 and `removePathRecord` deletes it (`path_history_service.dart:136-140`). Net: an overly tight timeout estimator actively erodes the learned route table — the opposite of what the ML system is for. +- **Fix:** raise the direct-path min floor to include the firmware base + per-hop terms (don't let ML clamp below a physically plausible RTT); and require more evidence (e.g. a higher failure count, or a confirmed `MSG_SEND` with no ACK over multiple attempts) before deleting a route rather than after two timer fires. + +### RETRY-4 · Low · `handleAckReceived` fallback computes a bogus `attemptIndex` +- **Where:** `message_retry_service.dart:613-626` (fallback branch), uses `expectedHashes.indexOf(expectedHash)` as the attempt index. +- **What:** `_expectedAckHashes[messageId]` is de-duplicated on insert (line 401), and because both firmware and client mask `attempt & 0x03`, attempts 0/4/8 (and 1/5/9, …) hash to the **same** value. So the list index is neither the real attempt number nor stable. The derived `matchedAttemptIndex` is only used to pick which attempt's `PathSelection` gets credited for the delivery — so the impact is limited to path-attribution accuracy on the fallback path (the primary `_ackHashToMessageId` mapping carries the correct snapshot). Low severity, but the value is simply wrong. +- **Fix:** store the attempt index alongside each expected hash (or just reuse the snapshot in `_ackHashToMessageId`) instead of inferring it from a list position. + +### RETRY-5 · Low · ML model feeds flood as `pathLength = -1`, polluting the linear coefficient +- **Where:** `timeout_prediction_service.dart:59-98` (observation), `161-200` (training). +- **What:** Flood deliveries are recorded with `pathLength: -1` **and** `isFlood: true`, then both are fed as features into a single global OLS regressor. A linear term that sees hop counts of `-1, 0, 1, 2, 3, …` with a discontinuity at the flood case distorts the `pathLength` coefficient; the `isFlood` dummy only partially compensates (it shifts the intercept, not the slope). Direct-path timeout predictions are therefore biased by flood observations and vice-versa. +- **Fix:** train separate flood vs direct models, or set `pathLength = 0` (or a dedicated flood feature only) when `isFlood`, so the hop-count slope is learned from direct paths alone. + +### RETRY-6 · Low / verify · ACK hash is computed over SMAZ-transformed text — the sent frame must use byte-identical text +- **Where:** `message_retry_service.dart:328-351` — hash uses `prepareContactOutboundText(contact, text)` (SMAZ-encoded), but `config.sendMessage(contact, message.text, …)` is handed the **raw** text; correctness depends on `_sendMessageDirect`/`buildSendTextMsgFrame` applying the *exact same* SMAZ transform downstream. +- **Why it matters:** if those two paths ever diverge, or if a message exceeds the firmware's `MAX_TEXT_LEN = 160` and gets truncated device-side, the receiver hashes different bytes than the client predicted → the ACK never matches → the message retries to `failed` even though it was delivered. This is a silent, hard-to-diagnose failure mode. +- **Fix:** compute the hash from the *same* byte buffer that is actually framed and sent (single source of truth), and add a unit test that asserts hash-over-frame-text == expected ACK hash, including a >160-byte/SMAZ case. + +## Observations (heuristics, not correctness bugs) +- **Flood path attribution credits a path the send didn't use.** On a successful *flood* delivery, `_recordPathResult` (`meshcore_connector.dart:1309-1354`) boosts the weight of `contact.path` (the device's *current* path) even though the message was flooded, not routed over that path. It's a reasonable "the ACK probably came back this way" heuristic, but (a) it inflates weight on an unexercised route, and (b) it reads `contact.path` which the path-return packet triggered by this very ACK may have just mutated (hence the `unawaited(getContactByKey(...))` re-fetch — a race the code papers over). Worth documenting as a heuristic and considering attributing only when the device path is confirmed fresh. +- **`calculateDefaultTimeout` (`message_retry_service.dart:713-719`)** appears to be legacy/unused by the active retry path (which always goes through `config.calculateTimeout`). If dead, remove it to avoid confusion about which timeout logic is authoritative. + +## How the system could be improved +1. **Single global in-flight budget tied to the firmware's table size.** Replace the per-contact gate with a global semaphore of N (≤8) outstanding ACKs, with a small reserve. This directly models the firmware constraint and eliminates RETRY-1. +2. **Make the device timeout authoritative, ML advisory.** Use the firmware's `est_timeout` as the baseline (it has the real airtime), and let the ML model only *widen* it when history shows this contact/path is consistently slower. Never let ML clamp below a physically plausible RTT (fixes RETRY-2 + RETRY-3). +3. **Decouple "timed out" from "route failed."** A timeout is weak evidence (could be transient congestion). Track per-path *consecutive* failures and only decay/delete a route after repeated, independent failures — or after the firmware reports a genuine send failure. Add hysteresis so one slow ACK doesn't erase a known-good route. +4. **Separate latency models per route class** (flood vs direct, and ideally per hop-count bucket), or add the airtime estimate itself as a feature so the model learns a multiplier rather than re-deriving physics. Fixes RETRY-5 and makes predictions interpretable. +5. **One source of truth for outbound bytes.** Frame the message once, compute the ACK hash from those exact bytes, and reject/queue anything that would exceed `MAX_TEXT_LEN` *before* sending (rather than discovering it via never-arriving ACKs). Fixes RETRY-6. +6. **Confidence-based path selection.** `_scorePathRecord` weights reliability 0.45 / latency 0.25 / freshness 0.1 / routeWeight 0.2 with hard-coded constants. Consider surfacing these as tunables (some already are via `appSettings`) and using a Wilson lower-bound on the success ratio instead of the current `(s+1)/(n+2)` Laplace estimate, so a 1/1 path isn't ranked above a 20/22 path purely on the smoothed mean. +7. **Bound the late-ACK grace + 15-min mapping cleanup explicitly.** `handleAckReceived` cleans `_ackHashToMessageId` older than 15 min on every ACK (`message_retry_service.dart:589-599`); combined with the 30 s post-failure grace timer and `attempt&3` hash reuse, it's worth a test that a delivered-after-failed message resolves exactly once and never double-advances the send queue. + + +### Possible ML issues + + 1. High: training/prediction mismatch for secondsSinceLastRx. + _lastRxTime is reset when the ACK frame arrives, then the observation is recorded, making this feature effectively zero. Prediction measures it before + sending. + lib/connector/meshcore_connector.dart:3867 + + 3. Medium: incorrect message-size input. + Retry prediction and training use message.text.length, not UTF-8/transformed payload bytes. Unicode and compressed messages therefore receive incorrect + airtime inputs. + lib/services/message_retry_service.dart:405 + lib/services/message_retry_service.dart:669 + + 4. Medium: stale per-contact statistics. + Old observations are removed from the 100-item model window, but never removed from _contactStats. The global model adapts while contact averages remain + lifetime averages. + lib/services/timeout_prediction_service.dart:76 + + 5. Medium: model is underconstrained. + Ordinary linear regression starts with only 10 samples and up to four features, without outlier rejection or validation. Physics clamping limits damage, + but unstable predictions are still likely. + + 6. Low: pending observations may not persist. + dispose() cancels the delayed save without flushing it. + lib/services/timeout_prediction_service.dart:216 +--- + +# ACK & Message-Delivery Analysis (2026-06-12, code review vs firmware) + +Focused pass on ACK matching and message delivery (sending + receiving), cross-checked against the MeshCore firmware at `/mnt/Gaming/meshcore/MeshCore`. Companion of the earlier "Retry & Path-Selection" section — this one is about whether messages reliably reach `delivered`/`failed` and aren't lost or double-shown. + +**Verified correct (recording these to close earlier open questions):** +- **ACK-hash text consistency holds.** `prepareContactOutboundText` (SMAZ / Cyr2Lat) transforms the text, and the *same* transformed bytes are used both for the wire frame (`buildSendTextMsgFrame`, `meshcore_connector.dart:~1113`) and for the expected-ack hash (`message_retry_service.dart:328-338`). The firmware hashes the raw received text bytes (SMAZ is opaque to it), so both sides agree. This resolves the RETRY-6 "verify" concern (the >160-byte truncation guard is still worth adding). +- **Connect-time queue drain exists.** `_startPostChannelInitialQueuedMessageSync` (`meshcore_connector.dart:3835`) plus the `respCodeEndOfContacts` handler (`:3936-3941`) proactively call `syncQueuedMessages(force:true)` after the SELF_INFO→channels→contacts pipeline, so messages that arrived while disconnected are pulled on reconnect — not solely dependent on a live `PUSH_CODE_MSG_WAITING` tickle. +- **Firmware de-dups inbound packets.** `SimpleMeshTables::hasSeen` keeps a 160-entry packet-hash seen-table (`src/helpers/SimpleMeshTables.h:34-53`), so the same on-air packet arriving via multiple flood paths is dropped, not delivered twice. +- **Channel sends do reach `sent`.** `_handleOk` promotes the pending channel message on the firmware's generic OK (`meshcore_connector.dart:5370`), and the echo-heard path promotes it again (`:5990`). (So the "stuck pending on success" worry is unfounded — but see DELIVERY-1 for the error path.) + +## Open findings + +### DELIVERY-1 · Medium · A rejected (or lost-response) channel send is stuck "pending" forever +- **Where:** `_handleErrorFrame` (`meshcore_connector.dart:4007-4024`); `ChannelMessageStatus` has only `{pending, sent, failed}` and nothing ever sets `failed` for a channel message. +- **What:** When the firmware answers a `cmdSendChannelTxtMsg` with an error frame (e.g. `ERR_CODE_NOT_FOUND` for an unknown/unconfigured channel — firmware `MyMesh.cpp:1131-1135` writes an err frame on failure), the handler removes the message from `_pendingChannelSentQueue` (line 4023) **but never marks the message `failed`**. The same happens if the OK/ERR response is simply lost. Result: the bubble shows "pending/sending" indefinitely with no error, and there is no retry or timeout to resolve it. +- **Contrast:** direct messages have a full timeout→retry→`failed` path; channel messages have *no* failure path at all. +- **Fix:** in `_handleErrorFrame`, set the matching channel message to `failed` (mirror `_markPendingChannelMessageSentById`). Optionally add a short watchdog so a channel send with no OK/ERR within N seconds flips `pending`→`failed`. + +### DELIVERY-2 · Medium · Firmware offline queue (16) silently drops *contact* messages on overflow +- **Where:** firmware `examples/companion_radio/MyMesh.cpp:219-255` (`addToOfflineQueue`), `MyMesh.h:240` (`OFFLINE_QUEUE_SIZE 16`). +- **What:** Inbound messages are buffered in a 16-slot queue and tickled to the app via `PUSH_CODE_MSG_WAITING`. On overflow the firmware evicts the oldest **channel** message to make room; if all 16 queued entries are **contact/direct** messages, the new message is **silently dropped** — no error, no notification to the app. +- **Consequence:** a burst of direct messages while the app is backgrounded/slow/disconnected can lose messages with zero indication. The client drains in a loop on tickle and on connect (good), but it cannot recover a message the firmware already discarded. +- **Fix (client side):** drain as fast as possible — the current one-at-a-time request/response loop (`_requestNextQueuedMessage`) round-trips per message; consider keeping the pump saturated. There's no app-side way to detect the drop, so also worth raising upstream (a queue-overflow counter in firmware stats would let the app warn the user). + +### DELIVERY-3 · Low/Medium · Inbound contact-message de-dup can drop a *legitimate* message +- **Where:** `_handleIncomingMessage` de-dup (`meshcore_connector.dart:~4759-4772`): skips an incoming message if a message with the same `(timestampSeconds, text)` exists in the last 10 messages from that sender. +- **What:** Timestamps are second-resolution, so two genuinely distinct messages with identical text within the same second (e.g. sending "ok" twice) collide and the second is silently dropped. The firmware already de-dups true on-air duplicates at the packet-hash layer (see "verified correct"), so this app-layer heuristic is largely redundant *and* introduces a real (if uncommon) data-loss path; it also only looks back 10 messages, so a re-delivered queued message after a longer gap can slip through as a "new" duplicate. +- **Fix:** lean on the firmware's packet identity instead of `(timestamp,text)`, or narrow the heuristic (e.g. only treat as duplicate within a very short window AND when flagged as a flood repeat), so identical-text messages aren't lost. + +### DELIVERY-4 · Low · ACK match is 4-byte-hash-only, no sender identity, against a *global* 8-slot table +- **Where:** firmware `processAck` (`MyMesh.cpp:411-427`) — `memcmp(data, &expected_ack_table[i].ack, 4)` over 8 slots, clears the slot to 0 on first match. +- **What:** matching uses only the first 4 hash bytes with no check that the ACK came from the intended recipient, against the same global 8-entry circular table called out in RETRY-1. So (a) >8 concurrent in-flight sends evict a slot → that message never gets `PUSH_CODE_SEND_CONFIRMED` → client retries/false-fails; (b) a ~1/2^32-per-concurrent-send chance of a cross-message false confirm. Duplicate ACKs are handled safely (slot cleared after first match; the random 6th ACK byte doesn't affect the 4-byte compare). Low severity on its own; the real lever is RETRY-1's recommended **global** in-flight cap (≤8). + +### DELIVERY-5 · Info · Round-trip time is measured from queueing, not transmission +- **Where:** firmware `trip_time = getMillis() - expected_ack_table[i].msg_sent` (`MyMesh.cpp:417`), where `msg_sent` is stamped when the message is enqueued (`:1100`). +- **What:** the `tripTimeMs` the app receives (and feeds the ML timeout model) includes the firmware's TX-queue wait when the radio is busy, so observations are inflated under load. Compounds the ML-input issues already logged (RETRY-5 / the ML notes above). Not a delivery bug, but it skews timeout prediction. + +### DELIVERY-6 · Low / verify · Command/CLI sends use `expected_ack = 0` — must not ride the ACK retry path +- **Where:** firmware sets `expected_ack = 0` for `TXT_TYPE_CLI_DATA` and the recipient sends no ACK (`MyMesh.cpp:1088-1110`, `BaseChatMesh.cpp:244-252`); `RESP_CODE_SENT` then carries a zero hash. +- **What:** if any client path routes a CLI/repeater command through `MessageRetryService` (which computes a *non-zero* expected hash and waits for `PUSH_CODE_SEND_CONFIRMED`), it would never match → spurious retries and a false "failed". Need to confirm the repeater-CLI/command path is separate from the text-message ACK machinery (the connector does call `_recordPathResult` for "repeater command results" — worth tracing that it isn't also arming an ACK wait). +- **Fix/verify:** ensure command sends bypass the expected-ack/retry tracking entirely, or special-case `expected_ack == 0` in `updateMessageFromSent` as "no ACK expected → mark sent, don't wait". + +--- + +# Live Log Analysis — "JC Room Server" session (2026-06-12) + +Real device log (BLE/USB, auto route rotation ON) sending to a multi-hop room server. This is a near-perfect live reproduction of RETRY-2, RETRY-3, and RETRY-5. The ACK *matching* is correct (every `RESP_CODE_SENT` matches its message); what's broken is **timeout estimation and path rotation** — the app declares failures and retries messages that are actually still in flight. + +### Evidence by symptom + +1. **Flood timeout = 151 seconds (RETRY-5, live).** + `raw prediction=100638ms for pathLength=-1 → ML timeout 150959ms`. Feeding `pathLength=-1` into the linear model makes the flood case extrapolate off a cliff; the `.clamp(physicsMin, physicsMax)` didn't help because the flood `physicsMax` (`500 + 16·airtime`) was also huge. A message that falls back to flood effectively hangs for ~2.5 minutes. + - Also seen: `raw prediction=-3467ms for pathLength=1, messageBytes=172` — a **negative** predicted time. Discarded by the `<=0` guard, but proves the OLS model is unstable/underconstrained (matches the ML notes). + +2. **Premature timeouts on a working route (RETRY-3, live).** + `"Its going well"` was **delivered in 16037ms**, but attempt 0/1 used timeouts of **14420ms / 10240ms** — shorter than the real round-trip — so they fired `Timeout → retrying` before the ACK could return. The `g:` message `delivered ... in 9418ms` arrived *after* a retry had already been scheduled. Messages that are genuinely in flight are being declared failed. + +3. **Device `est_timeout` ignored (RETRY-2, live).** + Every send gets a clean `RESP_CODE_SENT` (which carries the firmware's own `est_timeout`), but the app overrides it with the runaway ML value. The device's estimate would have been far saner than both the 10s (too short) and 151s (too long) ML outputs. + +4. **Path rotation never converges.** + Single message, per-retry path: `pathLength 3 → 2 → 1 → 2 → -1(flood)`; timeout target swings `25s → 19s → 13s → 19s → 151s`. Routes that just delivered (`g:` over 2 hops) are abandoned on the next message. On a 2-5 hop room server on a congested channel, the thrash never settles. + +5. **Retries congest the channel.** + `Radio quiet for 3037ms`, `Post-inbound backoff: waiting 14808ms` — channel is busy. Backoffs (`1/2/4/8s`) are far shorter than the 19-34s timeouts, so retries stack onto a multi-hop path and reduce delivery odds. + +6. **`attempt & 3` hash reuse visible.** `"I have some really c..."` attempt 0 and attempt 4 both expect `b8bfa902`; `"JC you around?"` reuses `b2074391`. Attempts 0/4 are indistinguishable on the wire (RETRY-4 / masking). + +7. **Room login runs a separate, untracked ACK path (relates to DELIVERY-6).** `No pending message found for ACK hash: b0023dab` ×5 during `[RoomLogin]` — login sends with an expected ACK that `MessageRetryService` never registered, so every login confirm logs as unmatched. Login has its own 26s timeout/retry and eventually succeeds. + +### Highest-impact fix (from this log) +Fix the timeout side: **stop feeding flood as `pathLength=-1`, hard-cap the ML output (≈30-45s), and fall back to the device's `est_timeout` instead of the runaway ML value.** That alone kills the 151s hang and the premature retries. Contained to `timeout_prediction_service.dart` + `calculateTimeout` in `meshcore_connector.dart`. + +--- + +# Design Proposal — Replace the timeout regressor; split timeout from loss (2026-06-12) + +Outcome of analyzing the JC Room Server log: the OLS `LinearRegressor` in `timeout_prediction_service.dart` is the wrong tool, and it's conflating two separate questions. This sketches the replacement before any code changes. + +## The core insight (why this isn't TCP, and what that implies) + +This is slow, **lossy** multi-hop radio: a message can be lost on a forward hop (never reaches the recipient) or delivered-but-the-ACK-return-is-lost. Two consequences drive the whole design: + +1. **On a lossy link, a longer timeout recovers nothing — only a retry does.** The timeout is your *time-to-retry*. Loss is the common outcome to a distant (5-hop) node, so inflating the timeout (e.g. the observed 151 s flood value) just maximizes idle time before the one action that helps. The right timeout is **the tightest value that still covers a realistically *successful* round-trip** (~P90–95 of success RTT), then give up and retry. +2. **The latency model is already blind to loss.** `recordObservation` is only called from `handleAckReceived` — i.e. only on success. Lost messages produce no sample. So the regressor estimates "time of a *successful* round-trip" (same data an EWMA would use), just with extrapolation/negative/explosion failure modes on top. Modeling loss for real would require censored-data/survival analysis, which is far heavier than needed. + +**Conclusion:** stop using one fragile latency regressor to answer both "how long to wait" and "is this route any good." Split them. + +## Part A — Timeout: physics-anchored, capped, adaptive RTT (replaces the OLS model) + +Drop `ml_algo` / `ml_dataframe`. Keep the existing `predictTimeout` / `recordObservation` interface so `calculateTimeout` and the connector wiring are untouched; swap the internals. + +Per **route class** = (hop count, flood-vs-direct); shared across contacts since data is sparse. + +``` +// baseline from physics (deterministic, generalizes to unseen hop/byte combos +// from sample #1). Use the LoRa airtime formula already in the connector, or the +// device's est_timeout from RESP_CODE_SENT (RETRY-2). +base = physicsEstimate(hops, bytes, sf, bw, cr) + +// learn only a BOUNDED multiplicative overhead from real successes (congestion, +// per-hop processing). EWMA, clamped so it can never explode or go negative. +on success(sample, hops, bytes): + ratio = sample / physicsEstimate(hops, bytes, ...) + f[class] = (1-α)·f[class] + α·clamp(ratio, 0.5, 4.0) // α≈0.125 + v[class] = (1-β)·v[class] + β·|f[class] - ratio| // β≈0.25 (deviation) + +predictTimeout(hops, bytes): + est = base · f[class] + return clamp(est + 4·v[class]·base, physicsMin, HARD_MAX) // HARD_MAX ≈ 30–45 s +``` + +Properties this fixes, by construction: +- **No 151 s / no negatives** — output is `physics × bounded factor + bounded variance`, hard-capped. +- **No flood discontinuity** — flood is its own class with its own factor, never `pathLength = -1` on a shared axis (kills RETRY-5). +- **No cold start** — seed `f=1`, `v=0`; the physics/device baseline is sensible from message #1; observations only refine the factor (removes the "need 10 samples" gate). +- **Variance is the timeout's whole point** — `est + k·deviation` is a calibrated high-percentile wait, so genuinely-in-flight messages aren't cut off early (kills RETRY-3), while staying tight enough that lost messages retry promptly. +- **Drops two dependencies**, ~15 lines, debuggable. + +Also remove the dead/broken `secSinceRx` feature (recorded ≈0; see ML notes) and feed transformed/UTF-8 payload bytes, not `text.length`. + +## Part B — Loss: route reliability drives retry / reroute / flood (data already exists) + +The "is this path even working" question belongs to `PathHistoryService`, which already tracks `successCount` / `failureCount` / `routeWeight` per path. Treat that as a Bernoulli delivery-probability estimate (Wilson or Beta lower bound on success rate) and use it for the *decision*, not the timeout: + +- **High-confidence working route** → keep using it; on a single timeout, retry the *same* path once (the ACK return may just have been lost) before changing anything. +- **Degrading route** (success rate dropping) → switch to the next-best ranked path rather than hammering a dying one. +- **No confident route / repeated failures** → flood to rediscover, then pin the rediscovered path (don't immediately rotate off it — the log shows good routes being abandoned the next message). + +This replaces the current "rotate the path on every retry" churn (which made the timeout target swing 25 s→19 s→13 s→19 s→151 s and never converged) with: **pin a working route; only re-route/flood when reliability says the route is actually bad.** + +## Sequencing +1. Part A first (self-contained, biggest visible win — kills the 151 s hang and premature retries; removes ml_algo). Same public interface, so low blast radius. +2. Then Part B (path-decision policy), which also subsumes much of the separate "location-change brittleness" work — a route that stops delivering after you move is just a route whose reliability dropped. diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 579d8257..1bff354a 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -328,6 +328,20 @@ class MeshCoreConnector extends ChangeNotifier { String? get deviceId => _deviceId; String get deviceIdLabel => _deviceId ?? 'Unknown'; + /// Stable per-radio key for transport-agnostic per-device settings such as + /// battery chemistry. On BLE this is the existing remoteId (so previously + /// saved settings are preserved); on USB/TCP — where there is no BLE + /// remoteId — it falls back to the node's public key, which identifies the + /// same physical radio across transports. Null until a device identity is + /// known. + String? get batteryDeviceKey { + if (_deviceId != null) return _deviceId; + if (_selfPublicKey != null && _selfPublicKey!.isNotEmpty) { + return selfPublicKeyHex; + } + return null; + } + MeshCoreTransportType get activeTransport => _activeTransport; String? get activeUsbPort => _usbManager.activePortKey; String? get activeUsbPortDisplayLabel => _usbManager.activePortDisplayLabel; @@ -493,7 +507,7 @@ class MeshCoreConnector extends ChangeNotifier { } String _batteryChemistryForDevice() { - final deviceId = _device?.remoteId.toString(); + final deviceId = batteryDeviceKey; if (deviceId == null || _appSettingsService == null) return 'nmc'; return _appSettingsService!.batteryChemistryForDevice(deviceId); } @@ -1607,6 +1621,20 @@ class MeshCoreConnector extends ChangeNotifier { await stopScan(); } await Future.delayed(const Duration(milliseconds: 200)); + + // The read pump can fail the instant the port opens (e.g. a device that + // re-enumerates on open). That error is emitted on a broadcast stream + // before the listener below attaches, so it would otherwise be lost and + // the connect would stall until the SELF_INFO timeout. Check transport + // liveness directly and abort fast with the real cause. + if (!_usbManager.isConnected) { + final cause = _usbManager.lastError; + throw StateError( + 'USB device disconnected during connect' + '${cause == null ? '' : ': $cause'}', + ); + } + _usbFrameSubscription = _usbManager.frameStream.listen( _handleFrame, onError: (error, stackTrace) { @@ -5737,7 +5765,9 @@ class MeshCoreConnector extends ChangeNotifier { ) { if (!isRoomServer) return null; if (!msg.isOutgoing) { - final senderContact = _contacts.cast().firstWhere( + // Saved contacts first, then discovery-only nodes, so reaction matching + // resolves the author's name even when they haven't been saved. + final senderContact = allContactsUnfiltered.cast().firstWhere( (c) => c != null && _matchesPrefix(c.publicKey, msg.fourByteRoomContactKey), diff --git a/lib/connector/meshcore_connector_usb.dart b/lib/connector/meshcore_connector_usb.dart index 56718bc2..7e44798a 100644 --- a/lib/connector/meshcore_connector_usb.dart +++ b/lib/connector/meshcore_connector_usb.dart @@ -19,6 +19,7 @@ class MeshCoreUsbManager { String? get activePortKey => _activePortKey; String? get activePortDisplayLabel => _activePortLabel ?? _activePortKey; bool get isConnected => _service.isConnected; + Object? get lastError => _service.lastError; Stream get frameStream => _service.frameStream; // --- Configuration --- diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 37308ba5..705caecb 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -143,6 +143,7 @@ "scanner_chromeRequired": "Chrome Browser Required", "scanner_chromeRequiredMessage": "This web application requires Google Chrome or a Chromium-based browser for Bluetooth support.", "scanner_enableBluetooth": "Enable Bluetooth", + "scanner_bluetoothWebUnsupported": "Bluetooth isn't available in the browser. Connect over USB instead.", "device_quickSwitch": "Quick switch", "device_meshcore": "MeshCore", "settings_title": "Settings", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 8b513be5..cd19b2a7 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -694,6 +694,12 @@ abstract class AppLocalizations { /// **'Enable Bluetooth'** String get scanner_enableBluetooth; + /// No description provided for @scanner_bluetoothWebUnsupported. + /// + /// In en, this message translates to: + /// **'Bluetooth isn\'t available in the browser. Connect over USB instead.'** + String get scanner_bluetoothWebUnsupported; + /// No description provided for @device_quickSwitch. /// /// In en, this message translates to: diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 48d0ea2a..69e165ec 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -318,6 +318,10 @@ class AppLocalizationsBg extends AppLocalizations { @override String get scanner_enableBluetooth => 'Активирайте Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Бързо превключване'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index 10cc0baf..0b6e5833 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -321,6 +321,10 @@ class AppLocalizationsDe extends AppLocalizations { @override String get scanner_enableBluetooth => 'Bluetooth aktivieren'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Schnelles Umschalten'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index f851b914..39cf3727 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -315,6 +315,10 @@ class AppLocalizationsEn extends AppLocalizations { @override String get scanner_enableBluetooth => 'Enable Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Quick switch'; diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index c6e8ad2f..ef47ff3f 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -319,6 +319,10 @@ class AppLocalizationsEs extends AppLocalizations { @override String get scanner_enableBluetooth => 'Habilitar Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Cambiar rápidamente'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 3fd7839d..46f8cf2f 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -321,6 +321,10 @@ class AppLocalizationsFr extends AppLocalizations { @override String get scanner_enableBluetooth => 'Activer le Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Basculement rapide'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 0a09c402..01c06a91 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -318,6 +318,10 @@ class AppLocalizationsHu extends AppLocalizations { @override String get scanner_enableBluetooth => 'Engedje be a Bluetooth funkciót'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Gyors váltás'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index b748de9e..de44f72f 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -321,6 +321,10 @@ class AppLocalizationsIt extends AppLocalizations { @override String get scanner_enableBluetooth => 'Abilita il Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Passa velocemente'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 150fef5f..0e6f5922 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -308,6 +308,10 @@ class AppLocalizationsJa extends AppLocalizations { @override String get scanner_enableBluetooth => 'Bluetoothを有効にする'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => '素早い切り替え'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 783990cc..302ff925 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -307,6 +307,10 @@ class AppLocalizationsKo extends AppLocalizations { @override String get scanner_enableBluetooth => '블루투스 활성화'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => '빠른 전환'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 087a0204..9a8f1615 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -317,6 +317,10 @@ class AppLocalizationsNl extends AppLocalizations { @override String get scanner_enableBluetooth => 'Activeer Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Snelle overschakeling'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index ae102624..2ec5378b 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -322,6 +322,10 @@ class AppLocalizationsPl extends AppLocalizations { @override String get scanner_enableBluetooth => 'Włącz Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Szybka zmiana'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index 55dccf17..3eae0e3c 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -320,6 +320,10 @@ class AppLocalizationsPt extends AppLocalizations { @override String get scanner_enableBluetooth => 'Ative o Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Mudar rapidamente'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index a66e99d4..b61320c9 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -320,6 +320,10 @@ class AppLocalizationsRu extends AppLocalizations { @override String get scanner_enableBluetooth => 'Включите Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Быстрое переключение'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 349c4c6e..71286d55 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -319,6 +319,10 @@ class AppLocalizationsSk extends AppLocalizations { @override String get scanner_enableBluetooth => 'Povolte Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Rýchle prepínač'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index f79b0d2e..8f09c5ce 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -318,6 +318,10 @@ class AppLocalizationsSl extends AppLocalizations { @override String get scanner_enableBluetooth => 'Omogočite Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Hitro preklop'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index 8a354354..4a281eef 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -316,6 +316,10 @@ class AppLocalizationsSv extends AppLocalizations { @override String get scanner_enableBluetooth => 'Aktivera Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Snabb växling'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 8379a505..6471e563 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -319,6 +319,10 @@ class AppLocalizationsUk extends AppLocalizations { @override String get scanner_enableBluetooth => 'Увімкніть Bluetooth'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => 'Швидке перемикання'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index d2643bd9..9add4a3e 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -305,6 +305,10 @@ class AppLocalizationsZh extends AppLocalizations { @override String get scanner_enableBluetooth => '启用蓝牙'; + @override + String get scanner_bluetoothWebUnsupported => + 'Bluetooth isn\'t available in the browser. Connect over USB instead.'; + @override String get device_quickSwitch => '快速切换'; diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index 6995b6ed..3fd0d05f 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -141,7 +141,7 @@ class AppSettings { this.mapKeyPrefix = '', this.mapShowMarkers = true, this.mapShowGuessedLocations = true, - this.enableMessageTracing = false, + this.enableMessageTracing = true, this.mapCacheBounds, this.mapCacheMinZoom = 10, this.mapCacheMaxZoom = 15, @@ -149,7 +149,7 @@ class AppSettings { this.notifyOnNewMessage = true, this.notifyOnNewChannelMessage = true, this.notifyOnNewAdvert = true, - this.autoRouteRotationEnabled = false, + this.autoRouteRotationEnabled = true, this.maxRouteWeight = 5.0, this.initialRouteWeight = 3.0, this.routeWeightSuccessIncrement = 0.5, @@ -264,7 +264,7 @@ class AppSettings { mapShowMarkers: json['map_show_markers'] as bool? ?? true, mapShowGuessedLocations: json['map_show_guessed_locations'] as bool? ?? true, - enableMessageTracing: json['enable_message_tracing'] as bool? ?? false, + enableMessageTracing: json['enable_message_tracing'] as bool? ?? true, mapCacheBounds: (json['map_cache_bounds'] as Map?)?.map( (key, value) => MapEntry(key.toString(), (value as num).toDouble()), ), @@ -276,7 +276,7 @@ class AppSettings { json['notify_on_new_channel_message'] as bool? ?? true, notifyOnNewAdvert: json['notify_on_new_advert'] as bool? ?? true, autoRouteRotationEnabled: - json['auto_route_rotation_enabled'] as bool? ?? false, + json['auto_route_rotation_enabled'] as bool? ?? true, maxRouteWeight: (json['max_route_weight'] as num?)?.toDouble() ?? 5.0, initialRouteWeight: (json['initial_route_weight'] as num?)?.toDouble() ?? 3.0, diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 3d3af8b9..5c8258ad 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -607,7 +607,7 @@ class AppSettingsScreen extends StatelessWidget { AppSettingsService settingsService, MeshCoreConnector connector, ) { - final deviceId = connector.deviceId; + final deviceId = connector.batteryDeviceKey; final isConnected = connector.isConnected && deviceId != null; final selection = isConnected ? settingsService.batteryChemistryForDevice(deviceId) diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 3b0a2441..5bdd0fdc 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -381,12 +381,14 @@ class _ChatScreenState extends State { } final messageIndex = index; Contact contact = _resolveContact(connector); + final bool isRoom = contact.type == advTypeRoom; final message = reversedMessages[messageIndex]; String fourByteHex = ''; - if (contact.type == advTypeRoom) { + Contact? roomAuthor; + if (isRoom) { // Room-server messages carry the original author's 4-byte prefix // separately from message.text; use it only for resolving the name. - contact = _resolveContactFrom4Bytes( + roomAuthor = _resolveContactFrom4Bytes( connector, message.fourByteRoomContactKey.isEmpty ? Uint8List.fromList([0, 0, 0, 0]) @@ -396,6 +398,9 @@ class _ChatScreenState extends State { .map((b) => b.toRadixString(16).padLeft(2, '0')) .join() .toUpperCase(); + // Only adopt the author identity when we actually know them; never + // fall back to the room server's own name as the sender. + if (roomAuthor != null) contact = roomAuthor; } return Builder( @@ -403,11 +408,12 @@ class _ChatScreenState extends State { final textScale = context.select( (service) => service.scale, ); - final resolvedContact = _resolveContact(connector); final bubble = _MessageBubble( message: message, - senderName: resolvedContact.type == advTypeRoom - ? "${contact.name} [$fourByteHex]" + senderName: isRoom + ? (roomAuthor != null + ? "${roomAuthor.name} [$fourByteHex]" + : "[$fourByteHex]") : contact.name, sourceId: widget.contact.publicKeyHex, textScale: textScale, @@ -755,13 +761,17 @@ class _ChatScreenState extends State { return connector.contacts[_resolveContactIndex]; } - Contact _resolveContactFrom4Bytes( + Contact? _resolveContactFrom4Bytes( MeshCoreConnector connector, Uint8List key4Bytes, ) { - return connector.contacts.firstWhere( - (c) => listEquals(c.publicKey.sublist(0, 4), key4Bytes.sublist(0, 4)), - orElse: () => widget.contact, + // Match against saved contacts first, then nodes only seen via discovery — + // a room poster you haven't saved may still be in the discovered list. + return connector.allContactsUnfiltered.cast().firstWhere( + (c) => + c != null && + listEquals(c.publicKey.sublist(0, 4), key4Bytes.sublist(0, 4)), + orElse: () => null, ); } @@ -1049,7 +1059,11 @@ class _ChatScreenState extends State { if (message.isOutgoing) { senderName = connector.selfName ?? context.l10n.chat_me; } else if (_resolveContact(connector).type == advTypeRoom) { - senderName = "${contact.name} [$fourByteHex]"; + // An unresolved author leaves `contact` as the room server itself; show + // only the prefix rather than mislabeling the post with the room's name. + senderName = contact.type == advTypeRoom + ? "[$fourByteHex]" + : "${contact.name} [$fourByteHex]"; } else { senderName = _resolveContact(connector).name; } diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index f14a1820..3f57dfac 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -1,4 +1,3 @@ -import 'dart:collection'; import 'dart:math'; import 'package:flutter/foundation.dart'; @@ -94,6 +93,11 @@ class _MapScreenState extends State { String _searchQuery = ''; List<_GuessedLocation> _cachedGuessedLocations = []; String _guessedLocationsCacheKey = ''; + int? _sharedMarkersCacheSignature; + Locale? _sharedMarkersCacheLocale; + List<_SharedMarker> _cachedSharedMarkers = const []; + _NodeMarkersCacheKey? _nodeMarkersCacheKey; + List _cachedNodeMarkers = const []; @override void dispose() { @@ -283,11 +287,23 @@ class _MapScreenState extends State { @override Widget build(BuildContext context) { - return Consumer3( - builder: (context, connector, settingsService, pathHistory, child) { + return Builder( + builder: (context) { + final connectorSnapshot = context + .select( + _MapConnectorSnapshot.fromConnector, + ); + final connector = connectorSnapshot.connector; + final settings = context.select( + (service) => service.settings, + ); + final pathHistoryVersion = context.select( + (service) => service.version, + ); + final settingsService = context.read(); + final pathHistory = context.read(); final tileCache = context.read(); final isDesktop = _isDesktopPlatform(defaultTargetPlatform); - final settings = settingsService.settings; final allContacts = connector.allContacts; final contacts = settings.mapShowDiscoveryContacts @@ -296,7 +312,10 @@ class _MapScreenState extends State { final highlightPosition = widget.highlightPosition; final sharedMarkers = settings.mapShowMarkers - ? _collectSharedMarkers(connector) + ? _collectSharedMarkers( + connector, + connectorSnapshot.markerSignature, + ) .where( (marker) => !_hiddenMarkerIds.contains(marker.id) && @@ -347,9 +366,17 @@ class _MapScreenState extends State { .where((c) => c.hasLocation) .toList(); + // Guessed markers represent the same node types as known-location + // markers, so apply the node-type filters before estimating positions. + final guessCandidates = _filterContactsBySettings( + filteredByKeyPrefix, + settings, + noLocations: true, + ); + // Compute guessed locations with caching final maxRangeKm = _estimateLoRaRangeKm(connector); - final filteredKeys = filteredByKeyPrefix + final filteredKeys = guessCandidates .map((c) => '${c.publicKeyHex}:${c.path.join("-")}') .join(','); final anchorKeys = allContactsWithLocation @@ -359,12 +386,12 @@ class _MapScreenState extends State { ) .join(','); final cacheKey = - '$filteredKeys|$anchorKeys|${pathHistory.version}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; + '$filteredKeys|$anchorKeys|$pathHistoryVersion:${connector.currentFreqHz}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; if (cacheKey != _guessedLocationsCacheKey) { _guessedLocationsCacheKey = cacheKey; _cachedGuessedLocations = settings.mapShowGuessedLocations ? _computeGuessedLocations( - filteredByKeyPrefix, + guessCandidates, allContactsWithLocation, pathHistory, maxRangeKm, @@ -759,9 +786,21 @@ class _MapScreenState extends State { guessedLocations, showLabels: _showNodeLabels, ), - ..._buildNodeMarkers( + ..._buildNodeMarkersCached( visibleContacts, settings, + connectorSnapshot.contactsSignature, + connectorSnapshot.batterySignature, + _freshness, + settings.mapTimeFilterHours, + settings.mapKeyPrefixEnabled, + settings.mapKeyPrefix, + settings.mapShowDiscoveryContacts, + Object.hashAllUnordered( + settings.batteryChemistryByRepeaterId.entries.map( + (entry) => Object.hash(entry.key, entry.value), + ), + ), showLabels: _showNodeLabels, selectedContact: selectedContact, ), @@ -873,6 +912,59 @@ class _MapScreenState extends State { ); } + List _buildNodeMarkersCached( + List contacts, + AppSettings settings, + int contactsSignature, + int batterySignature, + _Freshness freshness, + double timeFilterHours, + bool keyPrefixEnabled, + String keyPrefix, + bool showDiscoveryContacts, + int batteryChemistrySignature, { + required bool showLabels, + Contact? selectedContact, + }) { + final visibleContactsSignature = Object.hashAll( + contacts.map( + (contact) => + Object.hash(_mapContactSignature(contact), _ageOf(contact)), + ), + ); + final key = _NodeMarkersCacheKey( + contactsSignature: contactsSignature, + visibleContactsSignature: visibleContactsSignature, + batterySignature: batterySignature, + freshness: freshness, + timeFilterHours: timeFilterHours, + keyPrefixEnabled: keyPrefixEnabled, + keyPrefix: keyPrefix, + showDiscoveryContacts: showDiscoveryContacts, + batteryChemistrySignature: batteryChemistrySignature, + showLabels: showLabels, + selectedKey: selectedContact?.publicKeyHex, + zoom: _zoom, + overlapsMode: settings.mapShowOverlaps, + showRepeaters: settings.mapShowRepeaters, + showChatNodes: settings.mapShowChatNodes, + showOtherNodes: settings.mapShowOtherNodes, + isBuildingPathTrace: _isBuildingPathTrace, + ); + if (key != _nodeMarkersCacheKey) { + _nodeMarkersCacheKey = key; + _cachedNodeMarkers = List.unmodifiable( + _buildNodeMarkers( + contacts, + settings, + showLabels: showLabels, + selectedContact: selectedContact, + ), + ); + } + return _cachedNodeMarkers; + } + List<_GuessedLocation> _computeGuessedLocations( List allContacts, List withLocation, @@ -1146,17 +1238,18 @@ class _MapScreenState extends State { }) { List filtered = []; bool addContact = false; + for (final contact in contacts) { addContact = false; if (!contact.hasLocation && !noLocations) { continue; } - // Apply node type filters + // Apply node type filters. The overlaps toggle is purely a visual + // highlight (applied in _buildNodeMarkers) and no longer affects which + // nodes are shown. if (contact.type == advTypeRepeater && - (settings.mapShowRepeaters || - _isBuildingPathTrace || - settings.mapShowOverlaps)) { + (settings.mapShowRepeaters || _isBuildingPathTrace)) { addContact = true; } if (contact.type == advTypeChat && @@ -1165,9 +1258,7 @@ class _MapScreenState extends State { } if (contact.type != advTypeChat && contact.type != advTypeRepeater && - (settings.mapShowOtherNodes || - _isBuildingPathTrace || - settings.mapShowOverlaps)) { + (settings.mapShowOtherNodes || _isBuildingPathTrace)) { addContact = true; } @@ -1175,25 +1266,6 @@ class _MapScreenState extends State { addContact = false; } - if (settings.mapShowOverlaps) { - final hasOverlap = contacts - .where( - (c) => - c.publicKeyHex != contact.publicKeyHex && - c.publicKey.first == contact.publicKey.first && - (c.type == advTypeRepeater || c.type == advTypeRoom) && - (contact.type == advTypeRepeater || - contact.type == advTypeRoom), - ) - .firstOrNull; - - if (hasOverlap == null && - settings.mapShowOverlaps && - !_isBuildingPathTrace) { - addContact = false; - } - } - if (addContact) { filtered.add(contact); } @@ -1212,13 +1284,34 @@ class _MapScreenState extends State { final selectedKey = selectedContact?.publicKeyHex; final items = contacts.where((c) => c.publicKeyHex != selectedKey).toList(); + // Key-prefix overlaps are a visual highlight only: flag the repeaters/rooms + // whose first key byte collides with another repeater/room on the map. + final overlapPrefixes = {}; + if (overlapsMode) { + final counts = {}; + for (final contact in contacts) { + if (contact.type == advTypeRepeater || contact.type == advTypeRoom) { + final prefix = contact.publicKey.first; + counts[prefix] = (counts[prefix] ?? 0) + 1; + } + } + counts.forEach((prefix, count) { + if (count > 1) overlapPrefixes.add(prefix); + }); + } + bool isOverlap(Contact contact) => + overlapsMode && + (contact.type == advTypeRepeater || contact.type == advTypeRoom) && + overlapPrefixes.contains(contact.publicKey.first); + void addNode(Contact contact, {bool dot = false}) { - markers.add(_nodeMarker(contact, overlapsMode: overlapsMode, dot: dot)); + final overlap = isOverlap(contact); + markers.add(_nodeMarker(contact, overlapsMode: overlap, dot: dot)); if (showLabels) { markers.add( _buildNodeLabelMarker( point: LatLng(contact.latitude!, contact.longitude!), - label: overlapsMode + label: overlap ? "${contact.publicKeyHex.substring(0, 2)}:${contact.name}" : contact.name, ), @@ -1255,7 +1348,7 @@ class _MapScreenState extends State { markers.add( _nodeMarker( selectedContact, - overlapsMode: overlapsMode, + overlapsMode: isOverlap(selectedContact), selected: true, ), ); @@ -2371,7 +2464,16 @@ class _MapScreenState extends State { } } - List<_SharedMarker> _collectSharedMarkers(MeshCoreConnector connector) { + List<_SharedMarker> _collectSharedMarkers( + MeshCoreConnector connector, + int markerSignature, + ) { + final locale = Localizations.localeOf(context); + if (_sharedMarkersCacheSignature == markerSignature && + _sharedMarkersCacheLocale == locale) { + return _cachedSharedMarkers; + } + // Build a _SharedMarker per message (history empty), grouped by dedupe key. // Afterwards pick the latest per key and fill its history from older ones. final updatesByKey = >{}; @@ -2463,7 +2565,10 @@ class _MapScreenState extends State { }); markers.sort((a, b) => b.timestamp.compareTo(a.timestamp)); - return markers; + _sharedMarkersCacheSignature = markerSignature; + _sharedMarkersCacheLocale = locale; + _cachedSharedMarkers = List.unmodifiable(markers); + return _cachedSharedMarkers; } Marker _buildSharedMarker(_SharedMarker marker) { @@ -3564,6 +3669,219 @@ enum _NodeAge { online, recent, stale } enum _Freshness { all, online, recent, stale } +int _bytesSignature(Iterable? bytes) { + if (bytes == null) return 0; + return Object.hashAll(bytes); +} + +int _mapContactSignature(Contact contact) { + return Object.hash( + contact.publicKeyHex, + contact.name, + contact.type, + contact.flags, + contact.pathLength, + _bytesSignature(contact.path), + contact.pathOverride, + _bytesSignature(contact.pathOverrideBytes), + contact.latitude, + contact.longitude, + contact.lastSeen.millisecondsSinceEpoch, + contact.lastMessageAt.millisecondsSinceEpoch, + contact.isActive, + contact.wasPulled, + ); +} + +class _MapConnectorSnapshot { + final MeshCoreConnector connector; + final int contactsSignature; + final int markerSignature; + final int batterySignature; + final int uiSignature; + + const _MapConnectorSnapshot({ + required this.connector, + required this.contactsSignature, + required this.markerSignature, + required this.batterySignature, + required this.uiSignature, + }); + + factory _MapConnectorSnapshot.fromConnector(MeshCoreConnector connector) { + final allContacts = connector.allContacts; + final contactsSignature = Object.hashAll( + allContacts.map(_mapContactSignature), + ); + final batterySignature = Object.hashAll( + allContacts + .where((contact) => contact.type == advTypeRepeater) + .map( + (contact) => Object.hash( + contact.publicKeyHex, + connector.getRepeaterBatteryMillivolts(contact.publicKeyHex), + ), + ), + ); + + final markerParts = [connector.selfName]; + for (final contact in connector.contacts) { + markerParts.add(contact.publicKeyHex); + markerParts.add(contact.name); + for (final message in connector.getMessages(contact)) { + if (!message.text.trimLeft().startsWith('m:')) continue; + markerParts.add( + Object.hash( + message.messageId, + message.text, + message.timestamp.millisecondsSinceEpoch, + message.isOutgoing, + ), + ); + } + } + for (final channel in connector.channels) { + markerParts.add( + Object.hash( + channel.index, + channel.name, + channel.isPublicChannel, + channel.isEmpty, + ), + ); + for (final message in connector.getChannelMessages(channel)) { + if (!message.text.trimLeft().startsWith('m:')) continue; + markerParts.add( + Object.hash( + message.messageId, + message.text, + message.senderName, + message.timestamp.millisecondsSinceEpoch, + ), + ); + } + } + + return _MapConnectorSnapshot( + connector: connector, + contactsSignature: contactsSignature, + markerSignature: Object.hashAll(markerParts), + batterySignature: batterySignature, + uiSignature: Object.hash( + connector.isConnected, + connector.selfLatitude, + connector.selfLongitude, + connector.currentFreqHz, + connector.currentBwHz, + connector.currentSf, + connector.currentTxPower, + connector.getTotalContactsUnreadCount(), + connector.getTotalChannelsUnreadCount(), + ), + ); + } + + @override + bool operator ==(Object other) { + return other is _MapConnectorSnapshot && + contactsSignature == other.contactsSignature && + markerSignature == other.markerSignature && + batterySignature == other.batterySignature && + uiSignature == other.uiSignature; + } + + @override + int get hashCode => Object.hash( + contactsSignature, + markerSignature, + batterySignature, + uiSignature, + ); +} + +class _NodeMarkersCacheKey { + final int contactsSignature; + final int visibleContactsSignature; + final int batterySignature; + final _Freshness freshness; + final double timeFilterHours; + final bool keyPrefixEnabled; + final String keyPrefix; + final bool showDiscoveryContacts; + final int batteryChemistrySignature; + final bool showLabels; + final String? selectedKey; + final double zoom; + final bool overlapsMode; + final bool showRepeaters; + final bool showChatNodes; + final bool showOtherNodes; + final bool isBuildingPathTrace; + + const _NodeMarkersCacheKey({ + required this.contactsSignature, + required this.visibleContactsSignature, + required this.batterySignature, + required this.freshness, + required this.timeFilterHours, + required this.keyPrefixEnabled, + required this.keyPrefix, + required this.showDiscoveryContacts, + required this.batteryChemistrySignature, + required this.showLabels, + required this.selectedKey, + required this.zoom, + required this.overlapsMode, + required this.showRepeaters, + required this.showChatNodes, + required this.showOtherNodes, + required this.isBuildingPathTrace, + }); + + @override + bool operator ==(Object other) { + return other is _NodeMarkersCacheKey && + contactsSignature == other.contactsSignature && + visibleContactsSignature == other.visibleContactsSignature && + batterySignature == other.batterySignature && + freshness == other.freshness && + timeFilterHours == other.timeFilterHours && + keyPrefixEnabled == other.keyPrefixEnabled && + keyPrefix == other.keyPrefix && + showDiscoveryContacts == other.showDiscoveryContacts && + batteryChemistrySignature == other.batteryChemistrySignature && + showLabels == other.showLabels && + selectedKey == other.selectedKey && + zoom == other.zoom && + overlapsMode == other.overlapsMode && + showRepeaters == other.showRepeaters && + showChatNodes == other.showChatNodes && + showOtherNodes == other.showOtherNodes && + isBuildingPathTrace == other.isBuildingPathTrace; + } + + @override + int get hashCode => Object.hash( + contactsSignature, + visibleContactsSignature, + batterySignature, + freshness, + timeFilterHours, + keyPrefixEnabled, + keyPrefix, + showDiscoveryContacts, + batteryChemistrySignature, + showLabels, + selectedKey, + zoom, + overlapsMode, + showRepeaters, + showChatNodes, + showOtherNodes, + isBuildingPathTrace, + ); +} + class _GuessedLocation { final Contact contact; final LatLng position; diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index 212ab819..84be2df6 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -207,6 +207,15 @@ class _ScannerScreenState extends State { } void _toggleScan(MeshCoreConnector connector) { + if (PlatformInfo.isWeb) { + // flutter_blue_plus has no web backend, so a BLE scan silently no-ops in + // the browser. Tell the user instead of leaving them staring at a button. + showDismissibleSnackBar( + context, + content: Text(context.l10n.scanner_bluetoothWebUnsupported), + ); + return; + } if (connector.state == MeshCoreConnectionState.scanning) { connector.stopScan(); } else { diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 3d12016a..81346f5f 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -725,18 +725,26 @@ class _SettingsScreenState extends State { onPressed: () => Navigator.pop(context), child: Text(l10n.common_cancel), ), - TextButton( - onPressed: () async { - Navigator.pop(context); - await connector.setNodeName(controller.text); - await connector.refreshDeviceInfo(); - if (!context.mounted) return; - showDismissibleSnackBar( - context, - content: Text(l10n.settings_nodeNameUpdated), + ListenableBuilder( + listenable: controller, + builder: (context, _) { + final name = controller.text.trim(); + return TextButton( + onPressed: name.isEmpty + ? null + : () async { + Navigator.pop(context); + await connector.setNodeName(name); + await connector.refreshDeviceInfo(); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(l10n.settings_nodeNameUpdated), + ); + }, + child: Text(l10n.common_save), ); }, - child: Text(l10n.common_save), ), ], ), diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index 5b42767b..0e40da64 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -386,6 +386,10 @@ class _UsbScreenState extends State { void _showError(Object error) { if (!mounted) return; + // Cancelling the browser's serial port picker is a normal user action, not + // an error — don't show a scary red toast (and never leak the raw + // DOMException text). + if (_isUserCancelledPortPicker(error)) return; showDismissibleSnackBar( context, content: Text(_friendlyErrorMessage(error)), @@ -393,6 +397,16 @@ class _UsbScreenState extends State { ); } + bool _isUserCancelledPortPicker(Object error) { + if (error is StateError && + error.message.contains('No USB serial device selected')) { + return true; + } + final text = error.toString(); + return text.contains('No port selected by the user') || + text.contains("Failed to execute 'requestPort'"); + } + String _friendlyErrorMessage(Object error) { final l10n = context.l10n; diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index 36027917..b148c95d 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -114,6 +114,36 @@ class NotificationService { return _isInitialized; } + // Cached "are we allowed to post notifications" result. Null = not yet + // determined. Avoids calling _notifications.show() when it would only throw + // "You must request notifications permissions first" (every web build, and + // Android 13+ before the user grants the permission). + bool? _canNotify; + + Future _ensureCanNotify() async { + if (!await _ensureInitialized()) return false; + final cached = _canNotify; + if (cached != null) return cached; + + // flutter_local_notifications has no web backend, so show() always throws. + // Skip silently instead of logging an error per incoming message. + if (kIsWeb) return _canNotify = false; + + // On Android 13+ notifications require an explicit grant; reflect the real + // OS state so we don't spam failed show() calls when denied. + final androidPlugin = _notifications + .resolvePlatformSpecificImplementation< + AndroidFlutterLocalNotificationsPlugin + >(); + if (androidPlugin != null) { + final enabled = await androidPlugin.areNotificationsEnabled(); + return _canNotify = enabled ?? false; + } + + // iOS/macOS request permission during initialize(); desktop has no gate. + return _canNotify = true; + } + Future requestPermissions() async { if (!_isInitialized) { await initialize(); @@ -126,7 +156,8 @@ class NotificationService { >(); if (androidPlugin != null) { final granted = await androidPlugin.requestNotificationsPermission(); - return granted ?? false; + _canNotify = granted ?? false; + return _canNotify!; } // iOS permissions are requested during initialization @@ -140,7 +171,8 @@ class NotificationService { badge: true, sound: true, ); - return granted ?? false; + _canNotify = granted ?? false; + return _canNotify!; } return true; @@ -165,7 +197,7 @@ class NotificationService { String? contactId, int? badgeCount, }) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; final androidDetails = AndroidNotificationDetails( 'messages', @@ -215,7 +247,7 @@ class NotificationService { required String contactType, String? contactId, }) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; const androidDetails = AndroidNotificationDetails( 'adverts', @@ -265,7 +297,7 @@ class NotificationService { int? channelIndex, int? badgeCount, }) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; final androidDetails = AndroidNotificationDetails( 'channel_messages', @@ -545,7 +577,7 @@ class NotificationService { } Future _showBatchSummary(List<_PendingNotification> batch) async { - if (!await _ensureInitialized()) return; + if (!await _ensureCanNotify()) return; // Group by type final messages = batch diff --git a/lib/services/usb_serial_service_native.dart b/lib/services/usb_serial_service_native.dart index 9c8af85e..1976de94 100644 --- a/lib/services/usb_serial_service_native.dart +++ b/lib/services/usb_serial_service_native.dart @@ -33,12 +33,14 @@ class UsbSerialService { String? _connectedPortLabel; FlSerial? _serial; AppDebugLogService? _debugLogService; + Object? _lastError; UsbSerialStatus get status => _status; String? get activePortKey => _connectedPortKey; String? get activePortDisplayLabel => _connectedPortLabel ?? _connectedPortKey; Stream get frameStream => _frameController.stream; + Object? get lastError => _lastError; bool get _useAndroidUsbHost => !kIsWeb && defaultTargetPlatform == TargetPlatform.android; bool get _useDesktopFlSerial => @@ -434,6 +436,7 @@ class UsbSerialService { } void _addFrameError(Object error, [StackTrace? stackTrace]) { + _lastError = error; if (_frameController.isClosed) { return; } diff --git a/lib/services/usb_serial_service_web.dart b/lib/services/usb_serial_service_web.dart index 5261308d..2429187a 100644 --- a/lib/services/usb_serial_service_web.dart +++ b/lib/services/usb_serial_service_web.dart @@ -15,6 +15,18 @@ class UsbSerialService { static const Map _knownUsbNames = { '2886:1667': 'Seeed Wio Tracker L1', }; + + /// USB-to-UART bridge chips whose hardware auto-reset circuit requires DTR + /// to be held asserted after open (otherwise the MCU resets). Native-USB-CDC + /// boards (nRF52840/Adafruit 0x239A, Espressif native 0x303A, Seeed 0x2886) + /// tie DTR to the bootloader/reset line, so asserting it re-enumerates and + /// drops the device ("The device has been lost"); they must be left alone. + static const Set _uartBridgeVendorIds = { + 0x10C4, // Silicon Labs CP210x + 0x1A86, // QinHeng CH340 / CH9102 + 0x0403, // FTDI + 0x067B, // Prolific PL2303 + }; static final Map _deviceNamesByPortKey = {}; static final Map _baseLabelsByPortKey = {}; static final Map _authorizedPortsByKey = @@ -34,12 +46,14 @@ class UsbSerialService { String _requestPortLabel = 'Choose USB Device'; String _fallbackDeviceName = 'Web Serial Device'; AppDebugLogService? _debugLogService; + Object? _lastError; UsbSerialStatus get status => _status; String? get activePortKey => _connectedPortKey; String? get activePortDisplayLabel => _connectedPortName ?? _connectedPortKey; Stream get frameStream => _frameController.stream; bool get isConnected => _status == UsbSerialStatus.connected; + Object? get lastError => _lastError; JSObject get _navigator => JSObject.fromInteropObject(web.window.navigator); bool get _isSupported => _navigator.has('serial'); @@ -74,6 +88,7 @@ class UsbSerialService { } _status = UsbSerialStatus.connecting; + _lastError = null; _frameDecoder.reset(); try { @@ -282,16 +297,30 @@ class UsbSerialService { ..['flowControl'] = 'none'.toJS; await port.callMethod>('open'.toJS, options).toDart; - // Prevent ESP32 USB-CDC reset: hold DTR=true, RTS=false after open. - try { - final signals = JSObject() - ..['dataTerminalReady'] = true.toJS - ..['requestToSend'] = false.toJS; - await port - .callMethod>('setSignals'.toJS, signals) - .toDart; - } catch (_) { - // setSignals may not be supported on all browsers/devices. + // Only UART-bridge chips (CP210x/CH340/FTDI/PL2303) need DTR held high to + // avoid the auto-reset circuit firing on open. Native-USB-CDC boards + // (e.g. nRF52840/Adafruit) tie DTR to the reset line — toggling it there + // re-enumerates the device and Web Serial reports "The device has been + // lost". Leave their signals untouched. + final vendorId = _portInfo(port)?.usbVendorId; + final isUartBridge = + vendorId != null && _uartBridgeVendorIds.contains(vendorId); + _debugLogService?.info( + 'Open: vendorId=${vendorId == null ? 'unknown' : '0x${vendorId.toRadixString(16)}'} ' + 'uartBridge=$isUartBridge (DTR ${isUartBridge ? 'asserted' : 'left default'})', + tag: 'USB Serial', + ); + if (isUartBridge) { + try { + final signals = JSObject() + ..['dataTerminalReady'] = true.toJS + ..['requestToSend'] = false.toJS; + await port + .callMethod>('setSignals'.toJS, signals) + .toDart; + } catch (_) { + // setSignals may not be supported on all browsers/devices. + } } } @@ -384,13 +413,21 @@ class UsbSerialService { } catch (error, stackTrace) { _debugLogService?.error('_pumpReads error: $error', tag: 'USB Serial'); if (_status == UsbSerialStatus.connected) { + // The transport is dead — reflect that in status immediately so a + // concurrent connect handshake fails fast instead of waiting for a + // SELF_INFO that can never arrive. + _status = UsbSerialStatus.disconnected; + _lastError = error; _addFrameError(error, stackTrace); } } finally { _debugLogService?.info('_pumpReads: ended', tag: 'USB Serial'); _releaseLock(reader); if (_status == UsbSerialStatus.connected && identical(reader, _reader)) { - _addFrameError(StateError('USB serial connection closed')); + _status = UsbSerialStatus.disconnected; + final closedError = StateError('USB serial connection closed'); + _lastError = closedError; + _addFrameError(closedError); } } } diff --git a/untranslated.json b/untranslated.json index c1e57a13..9e0501e8 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1,5 +1,6 @@ { "bg": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -41,6 +42,7 @@ ], "de": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -82,6 +84,7 @@ ], "es": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -123,6 +126,7 @@ ], "fr": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -164,6 +168,7 @@ ], "hu": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -205,6 +210,7 @@ ], "it": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -246,6 +252,7 @@ ], "ja": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -287,6 +294,7 @@ ], "ko": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -328,6 +336,7 @@ ], "nl": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -369,6 +378,7 @@ ], "pl": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -410,6 +420,7 @@ ], "pt": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -451,6 +462,7 @@ ], "ru": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -492,6 +504,7 @@ ], "sk": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -533,6 +546,7 @@ ], "sl": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -574,6 +588,7 @@ ], "sv": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -615,6 +630,7 @@ ], "uk": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", @@ -656,6 +672,7 @@ ], "zh": [ + "scanner_bluetoothWebUnsupported", "map_searchHint", "map_activity", "map_online", From 5ea6b17b16b541978cb5b085f9b4a535d0a53bed Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 13 Jun 2026 00:36:45 -0700 Subject: [PATCH 34/36] feat: enhance MeshCoreConnector with improved timeout calculation and path resolution; add PathHopResolver for better contact resolution --- lib/connector/meshcore_connector.dart | 212 ++++++++++++---- lib/helpers/path_hop_resolver.dart | 70 ++++++ lib/screens/channel_message_path_screen.dart | 251 ++++++++----------- lib/screens/discovery_screen.dart | 46 ++-- lib/services/message_retry_service.dart | 58 ++++- lib/services/path_history_service.dart | 4 +- lib/services/timeout_prediction_service.dart | 28 ++- test/helpers/path_hop_resolver_test.dart | 94 +++++++ 8 files changed, 529 insertions(+), 234 deletions(-) create mode 100644 lib/helpers/path_hop_resolver.dart create mode 100644 test/helpers/path_hop_resolver_test.dart diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 1bff354a..ef9a9e24 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -208,6 +208,9 @@ class MeshCoreConnector extends ChangeNotifier { // Intentionally global (not per-contact): tracks overall network activity. // Frequent RX from any source indicates a busy network with more collisions. DateTime _lastRxTime = DateTime.now(); + // Snapshot of _lastRxTime taken before the ACK frame updates it, so that + // onDeliveryObserved records the pre-ACK elapsed time (matching prediction). + DateTime _lastRxBeforeFrame = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastRadioRxTime = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastContactMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastChannelMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0); @@ -945,11 +948,17 @@ class MeshCoreConnector extends ChangeNotifier { updateMessage: _updateMessage, clearContactPath: clearContactPath, setContactPath: setContactPath, - calculateTimeout: (pathLength, messageBytes, {String? contactKey}) => - calculateTimeout( + calculateTimeout: + ( + pathLength, + messageBytes, { + String? contactKey, + int? deviceTimeoutMs, + }) => calculateTimeout( pathLength: pathLength, messageBytes: messageBytes, contactKey: contactKey, + deviceTimeoutMs: deviceTimeoutMs, ), getSelfPublicKey: () => _selfPublicKey, prepareContactOutboundText: prepareContactOutboundText, @@ -965,7 +974,9 @@ class MeshCoreConnector extends ChangeNotifier { recentSelections: recentSelections, ), onDeliveryObserved: (contactKey, pathLength, messageBytes, tripTimeMs) { - final secSinceRx = DateTime.now().difference(_lastRxTime).inSeconds; + final secSinceRx = DateTime.now() + .difference(_lastRxBeforeFrame) + .inSeconds; _timeoutPredictionService?.recordObservation( contactKey: contactKey, pathLength: pathLength, @@ -2683,41 +2694,62 @@ class MeshCoreConnector extends ChangeNotifier { Uint8List data, { String? channelSendQueueId, bool expectsGenericAck = false, + bool waitForGenericAck = false, }) async { if (!isConnected) { throw Exception("Not connected to a MeshCore device"); } _bleDebugLogService?.logFrame(data, outgoing: true); - if (_activeTransport == MeshCoreTransportType.usb) { - await _usbManager.write(data); - // Brief pause so the device firmware can process each frame before the - // next arrives. Without this, rapid-fire frames over USB can cause the - // device to miss responses (especially on reconnect). - await Future.delayed(const Duration(milliseconds: 10)); - } else if (_activeTransport == MeshCoreTransportType.tcp) { - await _tcpConnector.write(data); - } else { - if (_rxCharacteristic == null) { - throw Exception("MeshCore RX characteristic not available"); - } - // Prefer write without response when supported; fall back to write with response. - final properties = _rxCharacteristic!.properties; - final canWriteWithoutResponse = properties.writeWithoutResponse; - final canWriteWithResponse = properties.write; - if (!canWriteWithoutResponse && !canWriteWithResponse) { - throw Exception("MeshCore RX characteristic does not support write"); - } - await _rxCharacteristic!.write( - data.toList(), - withoutResponse: canWriteWithoutResponse, - ); - } - _trackPendingGenericAck( + final pendingAck = _trackPendingGenericAck( data, channelSendQueueId: channelSendQueueId, - expectsGenericAck: expectsGenericAck, + expectsGenericAck: expectsGenericAck || waitForGenericAck, + waitForAck: waitForGenericAck, ); + + try { + if (_activeTransport == MeshCoreTransportType.usb) { + await _usbManager.write(data); + // Brief pause so the device firmware can process each frame before the + // next arrives. Without this, rapid-fire frames over USB can cause the + // device to miss responses (especially on reconnect). + await Future.delayed(const Duration(milliseconds: 10)); + } else if (_activeTransport == MeshCoreTransportType.tcp) { + await _tcpConnector.write(data); + } else { + if (_rxCharacteristic == null) { + throw Exception("MeshCore RX characteristic not available"); + } + // Prefer write without response when supported; fall back to write with response. + final properties = _rxCharacteristic!.properties; + final canWriteWithoutResponse = properties.writeWithoutResponse; + final canWriteWithResponse = properties.write; + if (!canWriteWithoutResponse && !canWriteWithResponse) { + throw Exception("MeshCore RX characteristic does not support write"); + } + await _rxCharacteristic!.write( + data.toList(), + withoutResponse: canWriteWithoutResponse, + ); + } + } catch (_) { + if (pendingAck != null) { + _pendingGenericAckQueue.remove(pendingAck); + } + rethrow; + } + + if (pendingAck?.completer != null) { + try { + await pendingAck!.completer!.future.timeout(const Duration(seconds: 5)); + } on TimeoutException { + _pendingGenericAckQueue.remove(pendingAck); + throw TimeoutException( + 'Timed out waiting for firmware acknowledgement', + ); + } + } } Future requestBatteryStatus({bool force = false}) async { @@ -2949,6 +2981,17 @@ class MeshCoreConnector extends ChangeNotifier { }) async { if (!isConnected || text.isEmpty) return; + final outboundBytes = utf8.encode( + prepareContactOutboundText(contact, text), + ); + if (outboundBytes.length > maxTextPayloadBytes) { + debugPrint( + 'sendMessage: dropping overlong message ' + '(${outboundBytes.length} > $maxTextPayloadBytes bytes)', + ); + return; + } + // Check if this is a reaction - apply locally with pending status and route through retry service final reactionInfo = ReactionHelper.parseReaction(text); if (reactionInfo != null) { @@ -3419,9 +3462,11 @@ class MeshCoreConnector extends ChangeNotifier { notifyListeners(); } - Future importDiscoveredContact(Contact contact) async { - if (!isConnected) return; + Future importDiscoveredContact(Contact contact) async { + if (!isConnected) return false; + // Manual saves must bypass the firmware's auto-add discovery policy. + // CMD_IMPORT_CONTACT replays an advert and may remain discovery-only. await sendFrame( buildUpdateContactPathFrame( contact.publicKey, @@ -3434,6 +3479,7 @@ class MeshCoreConnector extends ChangeNotifier { lon: contact.longitude, lastModified: contact.lastSeen, ), + waitForGenericAck: true, ); // Update the discovered contact to mark it as active (imported) @@ -3459,6 +3505,8 @@ class MeshCoreConnector extends ChangeNotifier { ), ); notifyListeners(); + unawaited(_persistDiscoveredContacts()); + return true; } Future clearContactPath(Contact contact) async { @@ -3864,6 +3912,7 @@ class MeshCoreConnector extends ChangeNotifier { void _handleFrame(List data) { if (data.isEmpty) return; + _lastRxBeforeFrame = _lastRxTime; _lastRxTime = DateTime.now(); final frame = Uint8List.fromList(data); @@ -4016,11 +4065,15 @@ class MeshCoreConnector extends ChangeNotifier { } final failedAck = _pendingGenericAckQueue.removeAt(0); + failedAck.completer?.completeError( + Exception('Firmware rejected command with error code $errCode'), + ); if (failedAck.commandCode != cmdSendChannelTxtMsg || failedAck.channelSendQueueId == null) { return; } _pendingChannelSentQueue.remove(failedAck.channelSendQueueId); + _markPendingChannelMessageFailedById(failedAck.channelSendQueueId!); } void _handlePathUpdated(Uint8List frame) { @@ -4370,16 +4423,28 @@ class MeshCoreConnector extends ChangeNotifier { // Same as max for flood — firmware uses a single formula return 500 + (16 * airtime); } else { - return airtime * (pathLength + 1); + // Include firmware base (500ms) and per-hop processing (6*airtime+250) + // so ML cannot clamp below a physically plausible round-trip. + return 500 + ((airtime * 6 + 250) * pathLength); } } + /// Hard ceiling on any ML-derived or physics-fallback timeout (ms). + /// Prevents the flood formula (500 + 16·airtime at SF12 ≈ 150s) and an + /// unstable OLS model from producing multi-minute waits. + static const int _hardMaxTimeoutMs = 45000; + /// Calculate timeout for a message based on radio settings and path length. /// Returns timeout in milliseconds, considering number of hops. + /// + /// [deviceTimeoutMs] is the firmware's own est_timeout from RESP_CODE_SENT. + /// When ML is absent it is used as the fallback (clamped to physicsMin). + /// When ML is present it is used as an additional ceiling alongside physicsMax. int calculateTimeout({ required int pathLength, int messageBytes = 100, String? contactKey, + int? deviceTimeoutMs, }) { final airtime = _estimateAirtimeMs(messageBytes); final physicsMin = _physicsMinTimeout(pathLength, airtime); @@ -4394,17 +4459,26 @@ class MeshCoreConnector extends ChangeNotifier { secondsSinceLastRx: secSinceRx, ); if (mlTimeout != null) { + // Use device est_timeout as an additional ceiling when available — + // the firmware computed it from real airtime, so it's better than + // a physics guess built on a 50 ms fallback. + final ceiling = deviceTimeoutMs != null && deviceTimeoutMs > physicsMin + ? deviceTimeoutMs.clamp(physicsMin, _hardMaxTimeoutMs) + : physicsMax; if (pathLength < 0) { // Flood: trust ML, only enforce firmware formula as floor if (mlTimeout < physicsMin) { - return physicsMin; + return physicsMin.clamp(0, _hardMaxTimeoutMs); } } - return mlTimeout.clamp(physicsMin, physicsMax); + return mlTimeout.clamp(physicsMin, ceiling).clamp(0, _hardMaxTimeoutMs); } - // No ML data — use firmware formula - return physicsMax; + // No ML data — prefer device est_timeout (it used real airtime), then physics. + if (deviceTimeoutMs != null && deviceTimeoutMs > 0) { + return deviceTimeoutMs.clamp(physicsMin, _hardMaxTimeoutMs); + } + return physicsMax.clamp(0, _hardMaxTimeoutMs); } void _handleContact(Uint8List frame, {bool isContact = true}) { @@ -4760,14 +4834,11 @@ class MeshCoreConnector extends ChangeNotifier { final existing = _conversations[message.senderKeyHex]; final incomingTimestamp = message.timestamp.millisecondsSinceEpoch; if (existing != null && existing.isNotEmpty) { - final startIndex = existing.length > 10 ? existing.length - 10 : 0; - for (int i = existing.length - 1; i >= startIndex; i--) { - final recent = existing[i]; - if (!recent.isOutgoing && - recent.timestamp.millisecondsSinceEpoch == incomingTimestamp && - recent.text == message.text) { - return; - } + final last = existing.last; + if (!last.isOutgoing && + last.timestamp.millisecondsSinceEpoch == incomingTimestamp && + last.text == message.text) { + return; } } } @@ -5351,12 +5422,37 @@ class MeshCoreConnector extends ChangeNotifier { return false; } + void _markPendingChannelMessageFailedById(String messageId) { + for (final entry in _channelMessages.entries) { + final channelMessages = entry.value; + for (int i = channelMessages.length - 1; i >= 0; i--) { + final message = channelMessages[i]; + if (message.messageId != messageId) { + continue; + } + if (!message.isOutgoing || + message.status != ChannelMessageStatus.pending) { + return; + } + channelMessages[i] = message.copyWith( + status: ChannelMessageStatus.failed, + ); + unawaited( + _channelMessageStore.saveChannelMessages(entry.key, channelMessages), + ); + notifyListeners(); + return; + } + } + } + void _handleOk() { if (_pendingGenericAckQueue.isEmpty) { return; } final pendingAck = _pendingGenericAckQueue.removeAt(0); + pendingAck.completer?.complete(); if (pendingAck.commandCode != cmdSendChannelTxtMsg || pendingAck.channelSendQueueId == null) { return; @@ -6188,18 +6284,25 @@ class MeshCoreConnector extends ChangeNotifier { _scheduleReconnect(); } - void _trackPendingGenericAck( + _PendingCommandAck? _trackPendingGenericAck( Uint8List data, { String? channelSendQueueId, required bool expectsGenericAck, + required bool waitForAck, }) { - if (!expectsGenericAck || data.isEmpty) return; - _pendingGenericAckQueue.add( - _PendingCommandAck( - commandCode: data[0], - channelSendQueueId: channelSendQueueId, - ), + if (!expectsGenericAck || data.isEmpty) return null; + final pendingAck = _PendingCommandAck( + commandCode: data[0], + channelSendQueueId: channelSendQueueId, + completer: waitForAck ? Completer() : null, ); + if (pendingAck.completer != null) { + // sendFrame awaits this future after transport I/O; attach an error + // handler immediately in case USB returns an error response first. + unawaited(pendingAck.completer!.future.catchError((_) {})); + } + _pendingGenericAckQueue.add(pendingAck); + return pendingAck; } String _nextReactionSendQueueId() { @@ -6733,6 +6836,11 @@ class _RepeaterAckContext { class _PendingCommandAck { final int commandCode; final String? channelSendQueueId; + final Completer? completer; - _PendingCommandAck({required this.commandCode, this.channelSendQueueId}); + _PendingCommandAck({ + required this.commandCode, + this.channelSendQueueId, + this.completer, + }); } diff --git a/lib/helpers/path_hop_resolver.dart b/lib/helpers/path_hop_resolver.dart new file mode 100644 index 00000000..19f26001 --- /dev/null +++ b/lib/helpers/path_hop_resolver.dart @@ -0,0 +1,70 @@ +import 'package:latlong2/latlong.dart'; + +import '../connector/meshcore_protocol.dart'; +import '../models/contact.dart'; + +class PathHopResolver { + const PathHopResolver._(); + + static List resolve({ + required List pathBytes, + required List contacts, + LatLng? endpoint, + bool resolveFromEnd = false, + }) { + final candidatesByPrefix = >{}; + for (final contact in contacts) { + if (contact.publicKey.isEmpty) continue; + if (contact.type != advTypeRepeater && contact.type != advTypeRoom) { + continue; + } + candidatesByPrefix + .putIfAbsent(contact.publicKey.first, () => []) + .add(contact); + } + for (final candidates in candidatesByPrefix.values) { + candidates.sort((a, b) => b.lastSeen.compareTo(a.lastSeen)); + } + + final resolved = List.filled(pathBytes.length, null); + final indexes = resolveFromEnd + ? List.generate(pathBytes.length, (i) => pathBytes.length - 1 - i) + : List.generate(pathBytes.length, (i) => i); + final distance = Distance(); + var previousPosition = endpoint; + + for (final index in indexes) { + final candidates = candidatesByPrefix[pathBytes[index]]; + if (candidates == null || candidates.isEmpty) continue; + + var bestIndex = 0; + if (previousPosition != null && candidates.length > 1) { + double? nearestDistance; + for (var i = 0; i < candidates.length; i++) { + final position = _positionOf(candidates[i]); + if (position == null) continue; + final candidateDistance = distance(previousPosition, position); + if (nearestDistance == null || candidateDistance < nearestDistance) { + nearestDistance = candidateDistance; + bestIndex = i; + } + } + } + + final contact = candidates.removeAt(bestIndex); + resolved[index] = contact; + previousPosition = _positionOf(contact) ?? previousPosition; + } + + return resolved; + } + + static LatLng? _positionOf(Contact contact) { + if (!contact.hasLocation || + contact.latitude == null || + contact.longitude == null) { + return null; + } + return LatLng(contact.latitude!, contact.longitude!); + } +} diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index 13bc0c3c..c46c413a 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -8,9 +8,9 @@ import 'package:meshcore_open/screens/path_trace_map.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; +import '../helpers/path_hop_resolver.dart'; import '../services/map_tile_cache_service.dart'; import '../services/app_settings_service.dart'; -import '../connector/meshcore_protocol.dart'; import '../l10n/app_localizations.dart'; import '../l10n/l10n.dart'; import '../models/channel_message.dart'; @@ -46,7 +46,12 @@ class ChannelMessagePathScreen extends StatelessWidget { final primaryPath = !channelMessage && !message.isOutgoing ? Uint8List.fromList(primaryPathTmp.reversed.toList()) : primaryPathTmp; - final hops = _buildPathHops(primaryPath, connector, l10n); + final hops = _buildPathHops( + primaryPath, + connector, + l10n, + resolveFromEnd: !message.isOutgoing, + ); final hasHopDetails = primaryPath.isNotEmpty; final observedLabel = _formatObservedHops( primaryPath.length, @@ -808,7 +813,12 @@ class _ChannelMessagePathMapScreenState // Match on the unoriented bytes — observedPaths stores them as // recorded, while selectedPath may be reversed for display. final selectedIndex = _indexForPath(selectedPathTmp, observedPaths); - final hops = _buildPathHops(selectedPath, connector, context.l10n); + final hops = _buildPathHops( + selectedPath, + connector, + context.l10n, + resolveFromEnd: !widget.message.isOutgoing, + ); // Renderable paths for the animation and combined view. final entries = <_ObservedPathEntry>[]; @@ -816,7 +826,12 @@ class _ChannelMessagePathMapScreenState final oriented = _orientPath(observedPaths[i].pathBytes); final pathHops = i == selectedIndex ? hops - : _buildPathHops(oriented, connector, context.l10n); + : _buildPathHops( + oriented, + connector, + context.l10n, + resolveFromEnd: !widget.message.isOutgoing, + ); final display = _buildDisplayPath( index: i, isPrimary: observedPaths[i].isPrimary, @@ -967,8 +982,7 @@ class _ChannelMessagePathMapScreenState lines = buildMultiPathPolylines( visible: visibleDisplays, selected: selectedDisplay, - combined: - effectiveMode == PathViewMode.combined, + combined: effectiveMode == PathViewMode.combined, animating: animating, ); if (animating && selectedDisplay != null) { @@ -1498,17 +1512,14 @@ class _ChannelMessagePathMapScreenState IconButton( visualDensity: VisualDensity.compact, icon: Icon( - _panelCollapsed - ? Icons.expand_less - : Icons.expand_more, + _panelCollapsed ? Icons.expand_less : Icons.expand_more, size: 20, ), tooltip: _panelCollapsed ? l10n.pathMap_expandPanel : l10n.pathMap_collapsePanel, - onPressed: () => setState( - () => _panelCollapsed = !_panelCollapsed, - ), + onPressed: () => + setState(() => _panelCollapsed = !_panelCollapsed), ), ], ), @@ -1559,11 +1570,7 @@ class _ChannelMessagePathMapScreenState ), const Divider(height: 1), Expanded( - child: _buildHopListView( - hops, - selectedDisplay, - hopUseCount, - ), + child: _buildHopListView(hops, selectedDisplay, hopUseCount), ), ], ], @@ -1610,78 +1617,71 @@ class _ChannelMessagePathMapScreenState : isFocused ? MeshPalette.blueBg : Colors.transparent, - padding: const EdgeInsets.symmetric( - horizontal: 12, - vertical: 8, - ), - child: Row( - children: [ - Container( - width: 28, - height: 28, - decoration: BoxDecoration( - color: MeshPalette.blueDim.withValues( - alpha: 0.3, - ), - shape: BoxShape.circle, - border: Border.all( - color: MeshPalette.blueDim.withValues( - alpha: 0.5, - ), - ), - ), - alignment: Alignment.center, - child: Text( - hop.index.toString(), - style: const TextStyle( - color: Colors.white, - fontSize: 11, - fontWeight: FontWeight.w700, - ), - ), - ), - const SizedBox(width: 10), - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text( - hop.displayLabel, - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 13, - ), - overflow: TextOverflow.ellipsis, - ), - Text( - [ - hop.hasLocation - ? '${hop.position!.latitude.toStringAsFixed(5)}, ' - '${hop.position!.longitude.toStringAsFixed(5)}' - : context - .l10n - .channelPath_noLocationData, - if (sharedCount > 1) - context.l10n.pathMap_sharedNodeCount( - sharedCount, - ), - ].join(' · '), - style: MeshTheme.mono( - fontSize: 10, - color: MeshPalette.ink3, - ), - overflow: TextOverflow.ellipsis, - ), - ], - ), - ), - ], - ), + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + child: Row( + children: [ + Container( + width: 28, + height: 28, + decoration: BoxDecoration( + color: MeshPalette.blueDim.withValues(alpha: 0.3), + shape: BoxShape.circle, + border: Border.all( + color: MeshPalette.blueDim.withValues(alpha: 0.5), + ), + ), + alignment: Alignment.center, + child: Text( + hop.index.toString(), + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w700, + ), + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + hop.displayLabel, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 13, ), - ); - }, - ); + overflow: TextOverflow.ellipsis, + ), + Text( + [ + hop.hasLocation + ? '${hop.position!.latitude.toStringAsFixed(5)}, ' + '${hop.position!.longitude.toStringAsFixed(5)}' + : context.l10n.channelPath_noLocationData, + if (sharedCount > 1) + context.l10n.pathMap_sharedNodeCount( + sharedCount, + ), + ].join(' · '), + style: MeshTheme.mono( + fontSize: 10, + color: MeshPalette.ink3, + ), + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ], + ), + ), + ); + }, + ); }, ); } @@ -1743,76 +1743,25 @@ class _ObservedPath { List<_PathHop> _buildPathHops( Uint8List pathBytes, MeshCoreConnector connector, - AppLocalizations l10n, -) { + AppLocalizations l10n, { + bool resolveFromEnd = false, +}) { if (pathBytes.isEmpty) return const []; - final candidatesByPrefix = >{}; - final allContacts = connector.allContacts; - for (final contact in allContacts) { - if (contact.publicKey.isEmpty) continue; - if (contact.type != advTypeRepeater && contact.type != advTypeRoom) { - continue; - } - final prefix = contact.publicKey.first; - candidatesByPrefix.putIfAbsent(prefix, () => []).add(contact); - } - for (final candidates in candidatesByPrefix.values) { - candidates.sort((a, b) => b.lastSeen.compareTo(a.lastSeen)); - } - final startPoint = + final endpoint = (connector.selfLatitude != null && connector.selfLongitude != null) ? LatLng(connector.selfLatitude!, connector.selfLongitude!) : null; - var previousPosition = startPoint; - final distance = Distance(); - var lastDistance = 0.0; - var bestDistance = 0.0; + final resolvedContacts = PathHopResolver.resolve( + pathBytes: pathBytes, + contacts: connector.allContacts, + endpoint: endpoint, + resolveFromEnd: resolveFromEnd, + ); + final hops = <_PathHop>[]; for (var i = 0; i < pathBytes.length; i++) { - final searchPoint = i == 0 ? startPoint : previousPosition; - final candidates = candidatesByPrefix[pathBytes[i]]; - Contact? contact; - if (candidates != null && candidates.isNotEmpty) { - var bestIndex = 0; - if (searchPoint != null) { - bestDistance = double.infinity; - for (var j = 0; j < candidates.length; j++) { - final candidate = candidates[j]; - if (!candidate.hasLocation || - candidate.latitude == null || - candidate.longitude == null) { - continue; - } - final currentDistance = distance( - searchPoint, - LatLng(candidate.latitude!, candidate.longitude!), - ); - if (currentDistance < bestDistance) { - bestDistance = currentDistance; - bestIndex = j; - } - } - } - contact = candidates.removeAt(bestIndex); - if (candidates.isEmpty) { - candidatesByPrefix.remove(pathBytes[i]); - } - } - + final contact = resolvedContacts[i]; final resolvedPosition = _resolvePosition(contact); - if (resolvedPosition != null) { - previousPosition = resolvedPosition; - } - // If the best candidate is much farther than the previous hop, it's likely not the correct match. - if (lastDistance + bestDistance > 50000 && - candidates != null && - candidates.isNotEmpty) { - i--; - lastDistance = bestDistance; - continue; - } - lastDistance = bestDistance; - hops.add( _PathHop( index: i + 1, diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index 8fb4cf95..415562c3 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -176,18 +176,32 @@ class _DiscoveryScreenState extends State { return ListEntrance( index: index, child: MeshCard( - onTap: () { - connector.importDiscoveredContact(contact); - showDismissibleSnackBar( - context, - content: Text( - context.l10n.discoveredContacts_contactAdded, - ), - action: SnackBarAction( - label: context.l10n.common_undo, - onPressed: () => connector.removeContact(contact), - ), - ); + onTap: () async { + try { + final imported = await connector.importDiscoveredContact(contact); + if (!context.mounted) return; + if (!imported) { + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + return; + } + showDismissibleSnackBar( + context, + content: Text(context.l10n.discoveredContacts_contactAdded), + action: SnackBarAction( + label: context.l10n.common_undo, + onPressed: () => connector.removeContact(contact), + ), + ); + } catch (_) { + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(context.l10n.contacts_contactImportFailed), + ); + } }, onLongPress: () => _showContactContextMenu(contact, connector), padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), @@ -247,7 +261,9 @@ class _DiscoveryScreenState extends State { Icon( Icons.location_on, size: 13, - color: scheme.onSurfaceVariant.withValues(alpha: 0.55), + color: scheme.onSurfaceVariant.withValues( + alpha: 0.55, + ), ), ], if (contact.rawPacket != null) ...[ @@ -255,7 +271,9 @@ class _DiscoveryScreenState extends State { Icon( Icons.cell_tower, size: 13, - color: scheme.onSurfaceVariant.withValues(alpha: 0.55), + color: scheme.onSurfaceVariant.withValues( + alpha: 0.55, + ), ), ], ], diff --git a/lib/services/message_retry_service.dart b/lib/services/message_retry_service.dart index a15b9c7d..56341598 100644 --- a/lib/services/message_retry_service.dart +++ b/lib/services/message_retry_service.dart @@ -39,8 +39,12 @@ class RetryServiceConfig { final void Function(Message) updateMessage; final Function(Contact)? clearContactPath; final Function(Contact, Uint8List, int)? setContactPath; - final int Function(int pathLength, int messageBytes, {String? contactKey})? - calculateTimeout; + final int Function( + int pathLength, + int messageBytes, { + String? contactKey, + int? deviceTimeoutMs, + })? calculateTimeout; final Uint8List? Function()? getSelfPublicKey; final String Function(Contact, String)? prepareContactOutboundText; final AppSettingsService? appSettingsService; @@ -74,6 +78,12 @@ class RetryServiceConfig { class MessageRetryService extends ChangeNotifier { static const int maxAckHistorySize = 100; + + /// Global cap on concurrent in-flight messages across ALL contacts. + /// The firmware's expected_ack_table is a single 8-entry circular buffer + /// shared globally; cap at 6 to leave two slots of headroom. + static const int _maxGlobalInFlight = 6; + int _maxRetries = 5; int get maxRetries => _maxRetries; @@ -170,8 +180,9 @@ class MessageRetryService extends ChangeNotifier { _config?.addMessage(contact.publicKeyHex, message); - // Queue per contact — only one message in-flight at a time to avoid - // overflowing the firmware's 8-entry expected_ack_table. + // Queue per contact — one message in-flight per contact at a time, and + // bounded globally by _maxGlobalInFlight across all contacts so we never + // overflow the firmware's 8-entry global expected_ack_table. final contactKey = contact.publicKeyHex; _sendQueue[contactKey] ??= []; _sendQueue[contactKey]!.add(messageId); @@ -184,6 +195,11 @@ class MessageRetryService extends ChangeNotifier { } void _sendNextForContact(String contactKey) { + // Enforce the global in-flight cap before starting a new send. + // The firmware's expected_ack_table is a single 8-entry circular buffer + // shared across all contacts; exceeding it silently evicts an older slot. + if (_activeMessages.length >= _maxGlobalInFlight) return; + final queue = _sendQueue[contactKey]; if (queue == null) return; @@ -211,7 +227,16 @@ class MessageRetryService extends ChangeNotifier { if (_resolvedMessages.contains(messageId)) return; _resolvedMessages.add(messageId); _activeMessages.remove(messageId); + // Pump this contact's queue first, then any other contacts that are waiting. _sendNextForContact(contactKey); + for (final key in _sendQueue.keys) { + if (key == contactKey) continue; + if (_activeMessages.length >= _maxGlobalInFlight) break; + final queue = _sendQueue[key]; + if (queue != null && queue.isNotEmpty) { + _sendNextForContact(key); + } + } } PathSelection? _selectPathForAttempt(Message message, Contact contact) { @@ -352,6 +377,10 @@ class MessageRetryService extends ChangeNotifier { } bool updateMessageFromSent(int ackHash, int timeoutMs) { + // Firmware sets expected_ack = 0 for CLI/command sends (TXT_TYPE_CLI_DATA). + // No ACK will ever be issued for these, so arming a retry timer is wrong. + if (ackHash == 0) return false; + final config = _config; if (config == null) return false; @@ -404,13 +433,19 @@ class MessageRetryService extends ChangeNotifier { // Calculate timeout: prefer ML prediction, then device-provided, then physics fallback final pathLengthValue = message.pathLength ?? contact.pathLength; + final outboundTextForTimeout = + config.prepareContactOutboundText?.call(contact, message.text) ?? + message.text; + final messageBytesForTimeout = + utf8.encode(outboundTextForTimeout).length; int actualTimeout = timeoutMs; if (config.calculateTimeout != null) { actualTimeout = config.calculateTimeout!( pathLengthValue, - message.text.length, + messageBytesForTimeout, contactKey: contact.publicKeyHex, + deviceTimeoutMs: timeoutMs > 0 ? timeoutMs : null, ); } @@ -617,7 +652,6 @@ class MessageRetryService extends ChangeNotifier { for (final expectedHash in expectedHashes) { if (expectedHash == ackHash) { matchedMessageId = messageId; - matchedAttemptIndex = expectedHashes.indexOf(expectedHash); break; } } @@ -669,10 +703,18 @@ class MessageRetryService extends ChangeNotifier { if (config?.onDeliveryObserved != null && tripTimeMs > 0 && message.pathLength != null) { - config!.onDeliveryObserved!( + final outboundTextForObserved = + config!.prepareContactOutboundText?.call( + contact, + message.text, + ) ?? + message.text; + final messageBytesForObserved = + utf8.encode(outboundTextForObserved).length; + config.onDeliveryObserved!( contact.publicKeyHex, message.pathLength!, - message.text.length, + messageBytesForObserved, tripTimeMs, ); } diff --git a/lib/services/path_history_service.dart b/lib/services/path_history_service.dart index fc81c565..7a61e3f6 100644 --- a/lib/services/path_history_service.dart +++ b/lib/services/path_history_service.dart @@ -134,10 +134,12 @@ class PathHistoryService extends ChangeNotifier { newWeight = (currentWeight + successIncrement).clamp(0.0, maxWeight); } else { newWeight = currentWeight - failureDecrement; - if (newWeight <= 0) { + if (newWeight <= 0 && failureCount >= 3) { removePathRecord(contactPubKeyHex, selection.pathBytes); return; } + // Keep the record with a small floor weight until we have enough evidence + newWeight = newWeight.clamp(0.1, maxWeight); } _addPathRecord( diff --git a/lib/services/timeout_prediction_service.dart b/lib/services/timeout_prediction_service.dart index d92ca643..f007e51c 100644 --- a/lib/services/timeout_prediction_service.dart +++ b/lib/services/timeout_prediction_service.dart @@ -63,12 +63,15 @@ class TimeoutPredictionService extends ChangeNotifier { required int tripTimeMs, int secondsSinceLastRx = 0, }) { + final isFlood = pathLength < 0; final observation = DeliveryObservation( contactKey: contactKey, - pathLength: pathLength, + // Clamp to 0 for flood so the hop-count slope is learned from direct paths + // only; isFlood carries the flood signal as a separate feature. + pathLength: isFlood ? 0 : pathLength, messageBytes: messageBytes, secondsSinceLastRx: secondsSinceLastRx, - isFlood: pathLength < 0, + isFlood: isFlood, deliveryMs: tripTimeMs, timestamp: DateTime.now(), ); @@ -76,11 +79,12 @@ class TimeoutPredictionService extends ChangeNotifier { _observations.add(observation); if (_observations.length > maxObservations) { _observations.removeAt(0); + _rebuildContactStats(); + } else { + _contactStats.putIfAbsent(contactKey, () => _ContactStats()); + _contactStats[contactKey]!.add(tripTimeMs.toDouble()); } - _contactStats.putIfAbsent(contactKey, () => _ContactStats()); - _contactStats[contactKey]!.add(tripTimeMs.toDouble()); - _observationsSinceLastTrain++; if (_observationsSinceLastTrain >= _retrainInterval && _observations.length >= minObservations) { @@ -108,11 +112,14 @@ class TimeoutPredictionService extends ChangeNotifier { try { if (_activeFeatures.isEmpty) return null; + final flood = pathLength < 0; final allFeatures = { - 'pathLength': pathLength.toDouble(), + // Clamp to 0 for flood — mirrors recordObservation so training and + // prediction see the same pathLength values; isFlood carries the signal. + 'pathLength': flood ? 0.0 : pathLength.toDouble(), 'messageBytes': messageBytes.toDouble(), 'secSinceRx': secondsSinceLastRx.toDouble(), - 'isFlood': pathLength < 0 ? 1.0 : 0.0, + 'isFlood': flood ? 1.0 : 0.0, }; final row = _activeFeatures.map((f) => allFeatures[f]!).toList(); @@ -164,7 +171,9 @@ class TimeoutPredictionService extends ChangeNotifier { // (ml_algo's OLS produces all-zero coefficients for singular matrices) final allNames = ['pathLength', 'messageBytes', 'secSinceRx', 'isFlood']; final allExtractors = [ - (o) => o.pathLength.toDouble(), + // pathLength is already clamped to >=0 in recordObservation, but guard + // here as well for any observations loaded from older persisted data. + (o) => o.pathLength < 0 ? 0.0 : o.pathLength.toDouble(), (o) => o.messageBytes.toDouble(), (o) => o.secondsSinceLastRx.toDouble(), (o) => o.isFlood ? 1.0 : 0.0, @@ -215,6 +224,9 @@ class TimeoutPredictionService extends ChangeNotifier { @override void dispose() { + if (_persistTimer?.isActive == true) { + _storage?.saveDeliveryObservations(_observations); + } _persistTimer?.cancel(); super.dispose(); } diff --git a/test/helpers/path_hop_resolver_test.dart b/test/helpers/path_hop_resolver_test.dart new file mode 100644 index 00000000..8e903bc6 --- /dev/null +++ b/test/helpers/path_hop_resolver_test.dart @@ -0,0 +1,94 @@ +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:latlong2/latlong.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/helpers/path_hop_resolver.dart'; +import 'package:meshcore_open/models/contact.dart'; + +Contact _contact({ + required int prefix, + required String name, + required double latitude, + required double longitude, + DateTime? lastSeen, +}) { + return Contact( + publicKey: Uint8List(32)..first = prefix, + name: name, + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + latitude: latitude, + longitude: longitude, + lastSeen: lastSeen ?? DateTime.utc(2026), + ); +} + +void main() { + test('received paths resolve hash conflicts from the receiver backward', () { + final nearReceiver = _contact( + prefix: 0xAA, + name: 'Near receiver', + latitude: 0, + longitude: 0.1, + ); + final nearPreviousHop = _contact( + prefix: 0xBB, + name: 'Near previous hop', + latitude: 0, + longitude: 1.1, + ); + final wrongConflict = _contact( + prefix: 0xBB, + name: 'Near receiver but wrong', + latitude: 0, + longitude: 0.2, + ); + final previousHop = _contact( + prefix: 0xCC, + name: 'Previous hop', + latitude: 0, + longitude: 1, + ); + + final resolved = PathHopResolver.resolve( + pathBytes: const [0xBB, 0xCC, 0xAA], + contacts: [nearReceiver, nearPreviousHop, wrongConflict, previousHop], + endpoint: const LatLng(0, 0), + resolveFromEnd: true, + ); + + expect(resolved.map((contact) => contact?.name), [ + 'Near previous hop', + 'Previous hop', + 'Near receiver', + ]); + }); + + test('falls back to the most recently seen conflict without locations', () { + final older = Contact( + publicKey: Uint8List(32)..first = 0xAA, + name: 'Older', + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + lastSeen: DateTime.utc(2025), + ); + final newer = Contact( + publicKey: Uint8List(32)..first = 0xAA, + name: 'Newer', + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + lastSeen: DateTime.utc(2026), + ); + + final resolved = PathHopResolver.resolve( + pathBytes: const [0xAA], + contacts: [older, newer], + ); + + expect(resolved.single?.name, 'Newer'); + }); +} From 7da4e683847be614984c5544c9bbd692004fb396 Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 13 Jun 2026 00:38:00 -0700 Subject: [PATCH 35/36] remove md --- BUGS_FOUND.md | 362 -------------------------------------------------- 1 file changed, 362 deletions(-) delete mode 100644 BUGS_FOUND.md diff --git a/BUGS_FOUND.md b/BUGS_FOUND.md deleted file mode 100644 index 7553b192..00000000 --- a/BUGS_FOUND.md +++ /dev/null @@ -1,362 +0,0 @@ -# MeshCore Open — Bugs Found (Web build, manual QA) - -Session: 2026-06-12 · Build served at `http://localhost:42751/` (Flutter web, debug/DDC) · Browser: Chrome - -Each entry: **Severity** · where · what · repro · expected. - ---- - -## Status -Fixes for BUG-1..4 applied on 2026-06-12 (analyze clean). **BUG-2/3 VERIFIED FIXED live:** USB device `VID:239A PID:8029` now connects on web — console shows `Open: vendorId=0x239a uartBridge=false (DTR left default)` → `Got SELF_INFO` → `connectUsb: complete`, no "device has been lost". Continuing to test the now-reachable connected screens. See "Fixes applied" at the bottom. - -## Open bugs - -### BUG-1 · Medium · USB connect — raw browser exception leaked to UI on picker cancel -- **Where:** "Connect over USB" screen (`usb_screen.dart`), tap **Select a USB device** → Web Serial port picker → dismiss/cancel without choosing a port. -- **What:** A red error snackbar shows the raw browser API string: `NotFoundError: Failed to execute 'requestPort' on 'Serial': No port selected by the user.` -- **Why it's a bug:** (1) Cancelling the port picker is a normal user action, not an error — it should be silent (or a neutral "No device selected" message), not a red error toast. (2) Even for real failures, leaking a raw JS `DOMException` string is poor UX. The catch handler should map known cases (user cancellation) and present friendly copy. -- **Expected:** Cancelling shows nothing or an info-level message; the UI never prints raw exception text. -- **Root cause (confirmed in source):** `usb_screen.dart:396 _friendlyErrorMessage()` maps `PlatformException`/`StateError`/etc., but the web cancel path throws a JS `DOMException` (`NotFoundError`) that matches none of the branches, so it falls through to `return error.toString();` (line 441). A friendly `l10n.usbErrorNoDeviceSelected` string already exists (line 428) but is only matched for a native `StateError` containing `'No USB serial device selected'`, not the web DOMException. Fix: detect the web no-port-selected case and route it to the existing friendly string (or suppress entirely). - -### BUG-2 · HIGH · Web USB connect fails with misleading "Timed out waiting for SELF_INFO" — read-pump error is dropped by a subscription race -- **Where:** `usb_serial_service_web.dart` + `meshcore_connector.dart connectUsb()`. Repro: on web (Chrome), connect to a USB serial device (observed with `Web Serial Device VID:239A PID:8029`, an Adafruit/nRF52840 board). -- **Observed (console, happens every attempt):** - 1. Port opens OK: `USB serial opened port=Web Serial Device (VID:239A PID:8029)` - 2. **Immediately:** `_pumpReads error: NetworkError: The device has been lost.` → `_pumpReads: ended` — the read stream dies the instant it opens. - 3. Connect logic ignores that and proceeds: `requesting device info…`, writes TX frames, `ChannelSync Starting sync for 40 channels`. - 4. Nothing can ever be read back → SELF_INFO + ChannelSync retry/timeout for ~7s. - 5. Ends with `USB connection error: Bad state: Timed out waiting for SELF_INFO during connect` → disconnect. User sees a generic timeout error, not the real cause. -- **Root cause (confirmed in source):** a **subscription-timing race on a broadcast stream**: - - `_frameController` is `StreamController.broadcast()` (`usb_serial_service_web.dart:24-25`). Broadcast streams **do not buffer** — events emitted with no listener attached are silently discarded. - - `_usbManager.connect()` starts `_pumpReads()` fire-and-forget (`usb_serial_service_web.dart:114`). On this device `_pumpReads` errors instantly and calls `_addFrameError()` (line 387/393). - - But `connectUsb()` attaches its error listener **only after** `await Future.delayed(200ms)` (`meshcore_connector.dart:1609`), then `frameStream.listen(onError: → disconnect(), onDone: → disconnect())` (lines 1610-1620). The read-pump error fired during that 200ms gap, so the `onError → disconnect` fail-fast path **never runs**. - - With the safety net disarmed, connect falls through to `_waitForSelfInfo` (3s) + retry (3s) and throws the misleading `Timed out waiting for SELF_INFO during connect` (line 1647). -- **Expected:** A read-stream failure during connect should abort immediately with the real cause ("USB device disconnected / lost"), not a 7-second generic SELF_INFO timeout. -- **Fix directions:** attach the `frameStream` listener (or otherwise observe transport health) *before* the read pump can emit — i.e. before/at port-open, not 200ms later; OR latch the last transport error in the service and have `connectUsb` check it; OR make connect race `_waitForSelfInfo` against a transport-error future. Remove/justify the unconditional 200ms delay that opens the race window. - -### BUG-3 · Likely device-level root cause for BUG-2 · DTR assertion may reset/lose nRF52840 (Adafruit, VID 0x239A) boards -- **Where:** `usb_serial_service_web.dart:285-295 _openPort()`. -- **What:** Immediately after `open()`, the code asserts `setSignals({dataTerminalReady:true, requestToSend:false})` with the comment *"Prevent ESP32 USB-CDC reset"*. That logic is tuned for ESP32. On Adafruit nRF52840 boards (VID `0x239A`, as seen here, PID `0x8029`), toggling DTR is associated with the bootloader/reset line and can cause the device to re-enumerate/reset — which plausibly produces the immediate `NetworkError: The device has been lost.` seen in BUG-2. -- **Status:** Strong hypothesis, not yet isolated (would need to test connecting with the `setSignals` call removed/varied for this board). Flagging because the device class that fails (nRF52840/Adafruit) is exactly the one where DTR semantics differ from ESP32. -- **Expected:** USB serial open should work for nRF52840-class MeshCore boards on web, or DTR handling should be conditional per device/VID. - -### BUG-4 · Medium · BLE "Scan" on web (no Bluetooth adapter / unsupported) gives zero feedback -- **Where:** Scanner screen (`scanner_screen.dart`). Repro: on web with no BLE module (or any web build, since `flutter_blue_plus` doesn't support web), tap **Scan**. -- **What:** Nothing happens — no spinner, no "scanning" state, no error toast, no "Bluetooth unavailable on web" message. The button just sits there and status stays "Not connected". (Confirmed by user: "its not connecting on chrome and my computer doesn't have a ble module".) -- **Expected:** Either disable/hide BLE scan on web (the app already gates non-Chrome via `ChromeRequiredScreen`; Chrome+web still can't use `flutter_blue_plus`), or show a clear "Bluetooth isn't available in the browser — use USB or TCP" message. Silent no-op leaves the user stuck. - -### BUG-5 · Low/Medium · Notifications never work until manually enabled; every incoming message logs an error -- **Where:** `notification_service.dart` — `show()` calls at lines 201/248/306/394/593 are made without ensuring notification permission was granted. -- **What (observed in console while connected):** repeated `Failed to show channel notification: Bad state: FlutterLocalNotifications.show(): You must request notifications permissions first` and the same for advert/message notifications. Each incoming channel message / advert triggers one. -- **Why:** permission is only ever requested from `app_settings_screen.dart:239` (when the user interacts with that setting). If the user never visits it, `requestPermissions()` is never called, so `show()` throws on web (and would on Android 13+ with denied permission). The errors are swallowed by `try/catch` (no crash), but notifications silently never fire and the log fills with errors. -- **Expected:** request notification permission during init / on first connect (or check `areNotificationsEnabled()` and skip `show()` when not granted) instead of calling `show()` unconditionally and relying on a caught exception per message. - -### OBS-1 · RESOLVED (not a bug) · USB-on-web connection dropped after ~4 min (`device has been lost`) -- **What:** At 9:25:13 the read pump errored `NetworkError: The device has been lost.` → `USB transport error` → clean auto-disconnect back to the scanner. -- **Cause:** confirmed by user — they physically dropped/disconnected the radio. So this was a real physical disconnect, NOT a Web Serial stability issue. Positive finding: the app (with the BUG-2 fix) handled an abrupt physical disconnect cleanly and returned to the scanner. - -### BUG-6 · Medium · Battery Chemistry setting permanently disabled on USB (and TCP) connections -- **Where:** App Settings → BATTERY → Battery Chemistry. `app_settings_screen.dart:610-611` gates the control on `connector.deviceId != null`; `meshcore_connector.dart` only ever assigns `_deviceId` in the **BLE** connect path (`_deviceId = device.remoteId.toString()`, line 1839, right after `_activeTransport = bluetooth`). -- **What:** When connected over USB (verified) — and by the same logic TCP — `connector.deviceId` is `null`, so the Battery Chemistry dropdown shows the subtitle "Connect to a device to choose" and is disabled, even though the device is fully connected (header shows `088EDAA0 · Connected`, radio stats live). -- **Why it matters:** USB/TCP users can never set per-device battery chemistry, so the battery percentage indicator uses the wrong voltage curve for their pack. Also user-confusing ("connect first" while connected). -- **Note:** The `088EDAA0` shown throughout the UI is a node/public-key-derived identifier, distinct from `_deviceId` (the BLE remoteId). The battery setting keys off the BLE-only `_deviceId`. -- **Fix direction:** populate a stable per-device identifier in the USB/TCP connect paths (e.g. the node public-key prefix already used for storage scoping), or key battery chemistry off that same node identity rather than the BLE remoteId. - -### BUG-7 · Low/Medium · Node Name can be saved empty (no validation) -- **Where:** Settings → Node Name dialog, `settings_screen.dart:708-744 _editNodeName()`. -- **What:** Clearing the field leaves the **Save** button enabled; the handler (line 728-740) calls `connector.setNodeName(controller.text)` directly with no `trim()`/empty check. An empty or whitespace-only name can be written to the device, leaving the node nameless on the mesh (others see a blank contact). Reproduced: cleared field → "0/31", Save still active. (Did not actually save.) -- **Compare:** the Radio Settings dialog correctly disables Save on invalid input — Node Name should do the same. -- **Expected:** disable Save (or show an error) when the trimmed name is empty. - -### OBS-2 · Watch · Auto-reconnect to cached Web Serial port fails after a physical drop (stale handle) -- **What:** After physical disconnects, the app auto-retries the cached port (`web:port:1`) and fails with `NetworkError: Failed to execute 'open' on 'SerialPort': Failed to open serial port` (seen at 9:26:44, 9:34:23, 9:34:53, ~30s apart). It does eventually recover (header shows Connected again), but the cached `SerialPort` handle is often stale right after an OS-level drop. -- **Note:** the native USB service explicitly documents this class of problem and avoids caching the serial handle (`_freshSerial()` comment, `usb_serial_service_native.dart:47-50`). The web service caches the port object (`_authorizedPortsByKey`), so reopen-after-drop is more fragile. Partly environmental here (user was physically re-plugging), so logged as an observation, not a confirmed bug. Worth confirming the web reconnect path discards/re-requests the port on `open()` failure rather than retry-looping on a dead handle. - ---- - -## Notes / non-bugs -- **Radio Settings validation works:** out-of-range frequency (`9999`) shows "Invalid frequency (300-2500 MHz)" and disables Save. Good. -- **Graceful disconnect verified:** when the USB transport drops, the app auto-navigates back to the scanner and shows "Not connected" — matches the intended "handle disconnection gracefully" behavior. -- **Channel sync starts before handshake completes:** `ChannelSync Starting sync for 40 channels` fires during connect before `SELF_INFO` is confirmed (console 9:07:54). Likely harmless given BUG-2 masks it, but worth confirming the initial-sync pipeline shouldn't wait for SELF_INFO first. -- First load on `localhost:39107` rendered a blank white page and the URL later resolved to `localhost:42751`. This appears to be a dev-server startup/port artifact (the Flutter view never mounted on the first port), not an app bug. Flagging only in case the port hop is intentional behavior worth confirming. - ---- - -## Fixes applied (2026-06-12) - -- **BUG-3 (device-lost root cause):** `usb_serial_service_web.dart _openPort()` now only asserts `setSignals(DTR=true)` for known USB-UART bridge VIDs (`_uartBridgeVendorIds`: CP210x `0x10C4`, CH340 `0x1A86`, FTDI `0x0403`, PL2303 `0x067B`). Native-USB-CDC boards (nRF52840/Adafruit `0x239A`, etc.) are left untouched, since toggling DTR re-enumerates them. Added a debug log line reporting the detected vendorId and whether DTR was asserted. (The native service already documented this exact NRF52/DTR behavior — confirms the hypothesis.) -- **BUG-2 (dropped read-pump error / misleading timeout):** - - `usb_serial_service_web.dart _pumpReads()` now flips `_status = disconnected` and latches `_lastError` when the read loop dies unexpectedly, instead of leaving the service reporting "connected". - - Added `lastError` getter to both web + native `UsbSerialService` and to `MeshCoreUsbManager`. - - `meshcore_connector.dart connectUsb()` now checks `_usbManager.isConnected` right after the 200ms settle delay (before waiting on SELF_INFO) and throws a clear `USB device disconnected during connect: ` using the latched error — failing in ~200ms with the real reason instead of ~7s with a generic SELF_INFO timeout. -- **BUG-1 (raw exception on picker cancel):** `usb_screen.dart` added `_isUserCancelledPortPicker()`; `_showError()` now returns silently for picker cancellation (matches the web `requestPort`/"No port selected" DOMException and the native StateError) instead of showing a red toast with raw text. -- **BUG-4 (silent BLE scan on web):** `scanner_screen.dart _toggleScan()` now short-circuits on web and shows `scanner_bluetoothWebUnsupported` ("Bluetooth isn't available in the browser. Connect over USB instead.") instead of silently no-opping. New l10n key added to `app_en.arb` and regenerated for all locales (English fallback; pending auto-translation). - -## Fixes applied — round 2 (2026-06-12) - -- **BUG-5 (notifications never fire / error spam):** `notification_service.dart` added `_ensureCanNotify()` — caches whether the platform can actually post notifications and is now the gate on all four `show()` entry points (message/advert/channel/batch-summary). Returns false on web (the plugin has no web backend, so `show()` always threw) and honors `areNotificationsEnabled()` on Android 13+. `requestPermissions()` now refreshes the cache so enabling from settings takes effect immediately. The `cancel()` paths still use `_ensureInitialized()` (unchanged). Net: no more per-message error spam; notifications post when actually permitted. -- **BUG-6 (battery chemistry disabled on USB/TCP):** added `MeshCoreConnector.batteryDeviceKey` — returns the BLE remoteId when present (preserves existing BLE-keyed settings) and falls back to the node public key (`selfPublicKeyHex`) on USB/TCP. Both the internal `_batteryChemistryForDevice()` and the App Settings UI (`app_settings_screen.dart`) now key off `batteryDeviceKey` instead of the BLE-only `connector.deviceId`. Battery chemistry is now selectable on USB/TCP, and the battery-% curve is correct for those connections. -- **BUG-7 (empty node name savable):** `settings_screen.dart _editNodeName()` Save button is now wrapped in a `ListenableBuilder` on the text controller and is disabled (`onPressed: null`) when the trimmed name is empty; the handler saves the trimmed value. Mirrors the Radio Settings dialog's validation behavior. - -All four files analyze clean. Pending live re-verification after hot restart (BUG-5: no notification errors in console; BUG-6: Battery Chemistry enabled while on USB). - ---- - -## Suggestions / further work (2026-06-12) - -### Follow-ons directly implied by the fixes -1. **Audit other per-device features for the same BLE-only gap (BUG-6 was probably not alone).** `_deviceId` is set only in the BLE connect path; anything keyed off `connector.deviceId` or `_device?.remoteId` is silently BLE-only on USB/TCP. Grep those usages and verify each works on USB/TCP, or migrate them to `batteryDeviceKey` / `selfPublicKeyHex`. -2. **Battery-chemistry key inconsistency (tradeoff in my BUG-6 fix).** I kept BLE = remoteId and USB/TCP = public key to avoid wiping saved BLE settings. Consequence: the *same physical radio* gets two different chemistry settings depending on transport. Cleaner long-term: key everything off `selfPublicKeyHex` (the canonical per-radio identity used for all other scoped storage) with a one-time migration of existing BLE-keyed values. -3. **Web reconnect should discard a stale port handle (OBS-2).** After a physical drop, auto-reconnect retry-loops on the cached `SerialPort` with `Failed to execute 'open'` before recovering. The native service deliberately avoids caching the handle (`_freshSerial()` comment). On `open()` failure the web service should drop the cached port from `_authorizedPortsByKey` and re-request (or prompt) instead of retrying a dead handle. -4. **DTR allowlist may need expansion (caveat on my BUG-3 fix).** I now assert DTR only for known UART-bridge VIDs (CP210x/CH340/FTDI/PL2303). A future board with an unlisted bridge chip won't get DTR and could reset on open. Consider a per-board config or a user-visible "hold DTR" toggle as a fallback as more hardware is tested. -5. **On web, the notification toggles are ON but inert** (same spirit as BUG-4). Now that `_ensureCanNotify()` correctly skips web, the four NOTIFICATIONS switches in App Settings still read as enabled while doing nothing in-browser. Grey them out / annotate "not available in browser" on web. Also `requestPermissions()` still returns `true` on web (fallback `return true`), which is misleading to its callers. - -### Robustness / architecture -6. **The connect handshake rides on a `broadcast()` stream + an unconditional 200ms delay** — the exact combo that caused BUG-2. My fix (status flip + liveness check) closes the connect race, but any consumer that subscribes late can still miss early frames/errors. Consider readiness signaling instead of the magic delay, and/or buffering the first frames during connect. - -### UX polish observed -7. **Two "Scan" buttons on the scanner empty state** (center button + bottom-right FAB) — redundant. -8. **Verify destructive actions confirm before acting.** I intentionally did NOT trigger "Clear Chat", "Delete All Paths", "Reboot Device", or "Manage Repeater" (not my device). Worth confirming each has a confirmation dialog. -9. **Telemetry screen** had no obvious "request once" affordance — only autorefresh (interval 20 / qty 10 / Enable). A manual one-shot refresh would help. - -### Coverage gaps (NOT tested this session — unverified) -- Repeater management (hub / CLI / settings / status), Line-of-Sight, Path-Trace map, Community QR scanner. -- Discovery & Neighbors screens, Map cache screen, Debug log screens. -- TCP transport (no TCP device available), USB on native (Android/desktop), on-device translation (LLM). -- Contacts search/sort/filter, channel add/reorder, GPX export. - ---- - -## Styling observations (2026-06-12) -Caveat: only viewed **dark mode** in a **wide desktop browser** (~1298px). Light mode and narrow/mobile widths not assessed. - -**The color system is good — credit where due.** `mesh_theme.dart` is a coherent, semantic palette ("high-contrast slate surfaces with sky-blue accents"): slate surface ramp (`0B1220`→`334155`), sky-blue accent (`0EA5E9`), signal-green reserved for SNR only (`22C55E`), amber warn, red alert, magenta node type, a full ink ramp, and a separate light ramp. Not a generic default-Material look. (Note: the CLAUDE.md claim that MeshPalette/MeshTheme is "not currently wired" is **stale** — `main.dart:204-205` wires `MeshTheme.light()/.dark()`.) - -**Issues are layout/responsiveness, not color:** -1. **No max-width constraint on web/desktop (biggest one).** No `ConstrainedBox`/`maxWidth` in `main.dart`; the app is mobile-first and stretches edge-to-edge on a wide window — chat input spans the full ~1300px, list rows are very wide, chat bubbles hug the far edges, settings rows stretch across. Recommend a centered max-width content column (phone-like, ~480–600px) or responsive breakpoints for the web build. -2. **App-bar title alignment is inconsistent.** Main tab screens (Channels/Contacts/Map) use left-aligned titles with a device-id subtitle; detail screens use `centerTitle: true` (23 files) or `AdaptiveAppBarTitle`. Reads slightly inconsistent screen-to-screen — worth one deliberate rule. -3. **Tall-viewport chat spacing.** Bottom-anchored chat leaves a large empty area at the top on a tall window (related to #1 — no height/width framing for big viewports). -4. **Minor:** map node-detail sheet stacked over the older bottom info bar (z-order overlap); the two redundant Scan buttons are also a visual duplication; verify disabled-control contrast is legible (the pre-fix battery dropdown was quite dim). -5. **Unverified:** light theme polish (light ramp exists in the palette but wasn't viewed). - ---- - -# Retry & Path-Selection Analysis (2026-06-12, code review vs firmware) - -Static review of the ACK/retry/path-selection pipeline (`message_retry_service.dart`, `path_history_service.dart`, `timeout_prediction_service.dart`, connector wiring) cross-checked against the MeshCore C++ firmware at `/mnt/Gaming/meshcore/MeshCore`. Verified against actual firmware source, not just docs. - -**What's correct (verified):** -- **ACK-hash algorithm matches the firmware exactly.** Client `computeExpectedAckHash` (`message_retry_service.dart:104-136`) = `SHA256(timestamp[4 LE] ‖ (attempt&3) ‖ text ‖ sender_pubkey[32])`, first 4 bytes as LE uint32. Firmware `BaseChatMesh.cpp:413-419` builds `temp[0..3]=timestamp`, `temp[4]=attempt&3`, `temp[5..]=text` (null *not* hashed — length passed is `5+text_len`), hashed with `self_id.pub_key`. Byte order and endianness round-trip correctly (`RESP_CODE_SENT`/`PUSH_CODE_SEND_CONFIRMED` both LE uint32, `meshcore_connector.dart:5265-5409`). -- **Retry is entirely the client's job** — firmware `sendMessage` sends once, no retry loop. Correct division of responsibility. -- **Per-contact in-flight serialization** (`_sendQueue`, `message_retry_service.dart:174-208`) is the right idea — see RETRY-1 for why it's not *sufficient*. - -## Open findings - -### RETRY-1 · Medium · Per-contact in-flight cap doesn't protect the firmware's *global* 8-entry ACK table -- **Where:** `message_retry_service.dart:174-183` (one in-flight message *per contact*) vs firmware `examples/companion_radio/MyMesh.h:248-250` + `MyMesh.cpp:1100-1103`. -- **What:** The firmware's `expected_ack_table` is a **single global circular buffer of 8 entries** with a global `next_ack_idx`, shared across *all* contacts. The client only guarantees ≤1 in-flight *per contact*, so messaging **9+ contacts concurrently** (e.g. several active conversations whose retries overlap, or a broadcast-style burst) puts >8 entries in flight. The firmware then overwrites the oldest slot (`next_ack_idx = (next_ack_idx+1) % 8`) with no rejection — the evicted message's ACK expectation is silently dropped. -- **Consequence:** the evicted send never produces a `PUSH_CODE_SEND_CONFIRMED`, so the client times out and retries a message the radio already sent (wasted airtime), and can mark as **failed** a message that actually delivered. -- **The code comment is misleading:** `message_retry_service.dart:173-174` says serialization exists "to avoid overflowing the firmware's 8-entry expected_ack_table" — but a per-contact cap does not bound the global table. -- **Fix:** enforce a **global** concurrent-in-flight cap (≤8, ideally ~6 for headroom) across all contacts, not just per-contact; or track `next_ack_idx` pressure and back-pressure new sends. - -### RETRY-2 · Medium · Firmware's reported `est_timeout` is silently discarded -- **Where:** `meshcore_connector.dart calculateTimeout()` (4379-4408); `message_retry_service.dart:405-415`. -- **What:** `RESP_CODE_SENT` carries the device's own `est_timeout` (firmware `MyMesh.cpp:1106-1110`, computed from real `getEstAirtimeFor(...)`). It's parsed into `timeoutMs` and passed to `updateMessageFromSent` as the default `actualTimeout`. But `config.calculateTimeout` is **always** set, so the device value is immediately overwritten on every message — and when the ML model has no data, `calculateTimeout` returns `physicsMax` (line 4407), **never the device-provided value**. -- **Why it's a bug:** the docstring at `message_retry_service.dart:405` ("prefer ML prediction, then device-provided, then physics fallback") describes a tier that doesn't exist — device-provided is never used. The physics fallback re-derives the firmware's flood/direct formulas, but `_estimateAirtimeMs` falls back to a hard-coded **50 ms** when radio params (freq/bw/sf/cr) aren't yet known (`meshcore_connector.dart:4341-...`), which can diverge sharply from the device's actual airtime estimate (e.g. SF12). The device already did this math correctly with the real airtime. -- **Fix:** use the device `timeoutMs` as the fallback when ML is unavailable, and as the clamp ceiling when ML is present — it's strictly better information than a 50 ms guess. - -### RETRY-3 · Medium · Premature ML timeouts can delete good routes (timeout floor too low + aggressive weight decay) -- **Where:** `meshcore_connector.dart _physicsMinTimeout` (≈4360-4375); `message_retry_service.dart:491-538`; `path_history_service.dart:131-141`. -- **What:** For direct paths the timeout floor is `airtime*(hops+1)` — it omits the firmware's base (`SEND_TIMEOUT_BASE_MILLIS=500`) and per-hop processing terms (`6*airtime+250` per hop). So an ML prediction clamps as low as that floor, well under the firmware's own `500 + (6*airtime+250)*hops`. When the timer fires before an ACK could realistically return, `_handleTimeout` records a **false failure** → `recordPathResult(success:false)` decrements `routeWeight` by 0.5. A fresh path starts at weight 1.0, so **two** false timeouts drive it to ≤0 and `removePathRecord` deletes it (`path_history_service.dart:136-140`). Net: an overly tight timeout estimator actively erodes the learned route table — the opposite of what the ML system is for. -- **Fix:** raise the direct-path min floor to include the firmware base + per-hop terms (don't let ML clamp below a physically plausible RTT); and require more evidence (e.g. a higher failure count, or a confirmed `MSG_SEND` with no ACK over multiple attempts) before deleting a route rather than after two timer fires. - -### RETRY-4 · Low · `handleAckReceived` fallback computes a bogus `attemptIndex` -- **Where:** `message_retry_service.dart:613-626` (fallback branch), uses `expectedHashes.indexOf(expectedHash)` as the attempt index. -- **What:** `_expectedAckHashes[messageId]` is de-duplicated on insert (line 401), and because both firmware and client mask `attempt & 0x03`, attempts 0/4/8 (and 1/5/9, …) hash to the **same** value. So the list index is neither the real attempt number nor stable. The derived `matchedAttemptIndex` is only used to pick which attempt's `PathSelection` gets credited for the delivery — so the impact is limited to path-attribution accuracy on the fallback path (the primary `_ackHashToMessageId` mapping carries the correct snapshot). Low severity, but the value is simply wrong. -- **Fix:** store the attempt index alongside each expected hash (or just reuse the snapshot in `_ackHashToMessageId`) instead of inferring it from a list position. - -### RETRY-5 · Low · ML model feeds flood as `pathLength = -1`, polluting the linear coefficient -- **Where:** `timeout_prediction_service.dart:59-98` (observation), `161-200` (training). -- **What:** Flood deliveries are recorded with `pathLength: -1` **and** `isFlood: true`, then both are fed as features into a single global OLS regressor. A linear term that sees hop counts of `-1, 0, 1, 2, 3, …` with a discontinuity at the flood case distorts the `pathLength` coefficient; the `isFlood` dummy only partially compensates (it shifts the intercept, not the slope). Direct-path timeout predictions are therefore biased by flood observations and vice-versa. -- **Fix:** train separate flood vs direct models, or set `pathLength = 0` (or a dedicated flood feature only) when `isFlood`, so the hop-count slope is learned from direct paths alone. - -### RETRY-6 · Low / verify · ACK hash is computed over SMAZ-transformed text — the sent frame must use byte-identical text -- **Where:** `message_retry_service.dart:328-351` — hash uses `prepareContactOutboundText(contact, text)` (SMAZ-encoded), but `config.sendMessage(contact, message.text, …)` is handed the **raw** text; correctness depends on `_sendMessageDirect`/`buildSendTextMsgFrame` applying the *exact same* SMAZ transform downstream. -- **Why it matters:** if those two paths ever diverge, or if a message exceeds the firmware's `MAX_TEXT_LEN = 160` and gets truncated device-side, the receiver hashes different bytes than the client predicted → the ACK never matches → the message retries to `failed` even though it was delivered. This is a silent, hard-to-diagnose failure mode. -- **Fix:** compute the hash from the *same* byte buffer that is actually framed and sent (single source of truth), and add a unit test that asserts hash-over-frame-text == expected ACK hash, including a >160-byte/SMAZ case. - -## Observations (heuristics, not correctness bugs) -- **Flood path attribution credits a path the send didn't use.** On a successful *flood* delivery, `_recordPathResult` (`meshcore_connector.dart:1309-1354`) boosts the weight of `contact.path` (the device's *current* path) even though the message was flooded, not routed over that path. It's a reasonable "the ACK probably came back this way" heuristic, but (a) it inflates weight on an unexercised route, and (b) it reads `contact.path` which the path-return packet triggered by this very ACK may have just mutated (hence the `unawaited(getContactByKey(...))` re-fetch — a race the code papers over). Worth documenting as a heuristic and considering attributing only when the device path is confirmed fresh. -- **`calculateDefaultTimeout` (`message_retry_service.dart:713-719`)** appears to be legacy/unused by the active retry path (which always goes through `config.calculateTimeout`). If dead, remove it to avoid confusion about which timeout logic is authoritative. - -## How the system could be improved -1. **Single global in-flight budget tied to the firmware's table size.** Replace the per-contact gate with a global semaphore of N (≤8) outstanding ACKs, with a small reserve. This directly models the firmware constraint and eliminates RETRY-1. -2. **Make the device timeout authoritative, ML advisory.** Use the firmware's `est_timeout` as the baseline (it has the real airtime), and let the ML model only *widen* it when history shows this contact/path is consistently slower. Never let ML clamp below a physically plausible RTT (fixes RETRY-2 + RETRY-3). -3. **Decouple "timed out" from "route failed."** A timeout is weak evidence (could be transient congestion). Track per-path *consecutive* failures and only decay/delete a route after repeated, independent failures — or after the firmware reports a genuine send failure. Add hysteresis so one slow ACK doesn't erase a known-good route. -4. **Separate latency models per route class** (flood vs direct, and ideally per hop-count bucket), or add the airtime estimate itself as a feature so the model learns a multiplier rather than re-deriving physics. Fixes RETRY-5 and makes predictions interpretable. -5. **One source of truth for outbound bytes.** Frame the message once, compute the ACK hash from those exact bytes, and reject/queue anything that would exceed `MAX_TEXT_LEN` *before* sending (rather than discovering it via never-arriving ACKs). Fixes RETRY-6. -6. **Confidence-based path selection.** `_scorePathRecord` weights reliability 0.45 / latency 0.25 / freshness 0.1 / routeWeight 0.2 with hard-coded constants. Consider surfacing these as tunables (some already are via `appSettings`) and using a Wilson lower-bound on the success ratio instead of the current `(s+1)/(n+2)` Laplace estimate, so a 1/1 path isn't ranked above a 20/22 path purely on the smoothed mean. -7. **Bound the late-ACK grace + 15-min mapping cleanup explicitly.** `handleAckReceived` cleans `_ackHashToMessageId` older than 15 min on every ACK (`message_retry_service.dart:589-599`); combined with the 30 s post-failure grace timer and `attempt&3` hash reuse, it's worth a test that a delivered-after-failed message resolves exactly once and never double-advances the send queue. - - -### Possible ML issues - - 1. High: training/prediction mismatch for secondsSinceLastRx. - _lastRxTime is reset when the ACK frame arrives, then the observation is recorded, making this feature effectively zero. Prediction measures it before - sending. - lib/connector/meshcore_connector.dart:3867 - - 3. Medium: incorrect message-size input. - Retry prediction and training use message.text.length, not UTF-8/transformed payload bytes. Unicode and compressed messages therefore receive incorrect - airtime inputs. - lib/services/message_retry_service.dart:405 - lib/services/message_retry_service.dart:669 - - 4. Medium: stale per-contact statistics. - Old observations are removed from the 100-item model window, but never removed from _contactStats. The global model adapts while contact averages remain - lifetime averages. - lib/services/timeout_prediction_service.dart:76 - - 5. Medium: model is underconstrained. - Ordinary linear regression starts with only 10 samples and up to four features, without outlier rejection or validation. Physics clamping limits damage, - but unstable predictions are still likely. - - 6. Low: pending observations may not persist. - dispose() cancels the delayed save without flushing it. - lib/services/timeout_prediction_service.dart:216 ---- - -# ACK & Message-Delivery Analysis (2026-06-12, code review vs firmware) - -Focused pass on ACK matching and message delivery (sending + receiving), cross-checked against the MeshCore firmware at `/mnt/Gaming/meshcore/MeshCore`. Companion of the earlier "Retry & Path-Selection" section — this one is about whether messages reliably reach `delivered`/`failed` and aren't lost or double-shown. - -**Verified correct (recording these to close earlier open questions):** -- **ACK-hash text consistency holds.** `prepareContactOutboundText` (SMAZ / Cyr2Lat) transforms the text, and the *same* transformed bytes are used both for the wire frame (`buildSendTextMsgFrame`, `meshcore_connector.dart:~1113`) and for the expected-ack hash (`message_retry_service.dart:328-338`). The firmware hashes the raw received text bytes (SMAZ is opaque to it), so both sides agree. This resolves the RETRY-6 "verify" concern (the >160-byte truncation guard is still worth adding). -- **Connect-time queue drain exists.** `_startPostChannelInitialQueuedMessageSync` (`meshcore_connector.dart:3835`) plus the `respCodeEndOfContacts` handler (`:3936-3941`) proactively call `syncQueuedMessages(force:true)` after the SELF_INFO→channels→contacts pipeline, so messages that arrived while disconnected are pulled on reconnect — not solely dependent on a live `PUSH_CODE_MSG_WAITING` tickle. -- **Firmware de-dups inbound packets.** `SimpleMeshTables::hasSeen` keeps a 160-entry packet-hash seen-table (`src/helpers/SimpleMeshTables.h:34-53`), so the same on-air packet arriving via multiple flood paths is dropped, not delivered twice. -- **Channel sends do reach `sent`.** `_handleOk` promotes the pending channel message on the firmware's generic OK (`meshcore_connector.dart:5370`), and the echo-heard path promotes it again (`:5990`). (So the "stuck pending on success" worry is unfounded — but see DELIVERY-1 for the error path.) - -## Open findings - -### DELIVERY-1 · Medium · A rejected (or lost-response) channel send is stuck "pending" forever -- **Where:** `_handleErrorFrame` (`meshcore_connector.dart:4007-4024`); `ChannelMessageStatus` has only `{pending, sent, failed}` and nothing ever sets `failed` for a channel message. -- **What:** When the firmware answers a `cmdSendChannelTxtMsg` with an error frame (e.g. `ERR_CODE_NOT_FOUND` for an unknown/unconfigured channel — firmware `MyMesh.cpp:1131-1135` writes an err frame on failure), the handler removes the message from `_pendingChannelSentQueue` (line 4023) **but never marks the message `failed`**. The same happens if the OK/ERR response is simply lost. Result: the bubble shows "pending/sending" indefinitely with no error, and there is no retry or timeout to resolve it. -- **Contrast:** direct messages have a full timeout→retry→`failed` path; channel messages have *no* failure path at all. -- **Fix:** in `_handleErrorFrame`, set the matching channel message to `failed` (mirror `_markPendingChannelMessageSentById`). Optionally add a short watchdog so a channel send with no OK/ERR within N seconds flips `pending`→`failed`. - -### DELIVERY-2 · Medium · Firmware offline queue (16) silently drops *contact* messages on overflow -- **Where:** firmware `examples/companion_radio/MyMesh.cpp:219-255` (`addToOfflineQueue`), `MyMesh.h:240` (`OFFLINE_QUEUE_SIZE 16`). -- **What:** Inbound messages are buffered in a 16-slot queue and tickled to the app via `PUSH_CODE_MSG_WAITING`. On overflow the firmware evicts the oldest **channel** message to make room; if all 16 queued entries are **contact/direct** messages, the new message is **silently dropped** — no error, no notification to the app. -- **Consequence:** a burst of direct messages while the app is backgrounded/slow/disconnected can lose messages with zero indication. The client drains in a loop on tickle and on connect (good), but it cannot recover a message the firmware already discarded. -- **Fix (client side):** drain as fast as possible — the current one-at-a-time request/response loop (`_requestNextQueuedMessage`) round-trips per message; consider keeping the pump saturated. There's no app-side way to detect the drop, so also worth raising upstream (a queue-overflow counter in firmware stats would let the app warn the user). - -### DELIVERY-3 · Low/Medium · Inbound contact-message de-dup can drop a *legitimate* message -- **Where:** `_handleIncomingMessage` de-dup (`meshcore_connector.dart:~4759-4772`): skips an incoming message if a message with the same `(timestampSeconds, text)` exists in the last 10 messages from that sender. -- **What:** Timestamps are second-resolution, so two genuinely distinct messages with identical text within the same second (e.g. sending "ok" twice) collide and the second is silently dropped. The firmware already de-dups true on-air duplicates at the packet-hash layer (see "verified correct"), so this app-layer heuristic is largely redundant *and* introduces a real (if uncommon) data-loss path; it also only looks back 10 messages, so a re-delivered queued message after a longer gap can slip through as a "new" duplicate. -- **Fix:** lean on the firmware's packet identity instead of `(timestamp,text)`, or narrow the heuristic (e.g. only treat as duplicate within a very short window AND when flagged as a flood repeat), so identical-text messages aren't lost. - -### DELIVERY-4 · Low · ACK match is 4-byte-hash-only, no sender identity, against a *global* 8-slot table -- **Where:** firmware `processAck` (`MyMesh.cpp:411-427`) — `memcmp(data, &expected_ack_table[i].ack, 4)` over 8 slots, clears the slot to 0 on first match. -- **What:** matching uses only the first 4 hash bytes with no check that the ACK came from the intended recipient, against the same global 8-entry circular table called out in RETRY-1. So (a) >8 concurrent in-flight sends evict a slot → that message never gets `PUSH_CODE_SEND_CONFIRMED` → client retries/false-fails; (b) a ~1/2^32-per-concurrent-send chance of a cross-message false confirm. Duplicate ACKs are handled safely (slot cleared after first match; the random 6th ACK byte doesn't affect the 4-byte compare). Low severity on its own; the real lever is RETRY-1's recommended **global** in-flight cap (≤8). - -### DELIVERY-5 · Info · Round-trip time is measured from queueing, not transmission -- **Where:** firmware `trip_time = getMillis() - expected_ack_table[i].msg_sent` (`MyMesh.cpp:417`), where `msg_sent` is stamped when the message is enqueued (`:1100`). -- **What:** the `tripTimeMs` the app receives (and feeds the ML timeout model) includes the firmware's TX-queue wait when the radio is busy, so observations are inflated under load. Compounds the ML-input issues already logged (RETRY-5 / the ML notes above). Not a delivery bug, but it skews timeout prediction. - -### DELIVERY-6 · Low / verify · Command/CLI sends use `expected_ack = 0` — must not ride the ACK retry path -- **Where:** firmware sets `expected_ack = 0` for `TXT_TYPE_CLI_DATA` and the recipient sends no ACK (`MyMesh.cpp:1088-1110`, `BaseChatMesh.cpp:244-252`); `RESP_CODE_SENT` then carries a zero hash. -- **What:** if any client path routes a CLI/repeater command through `MessageRetryService` (which computes a *non-zero* expected hash and waits for `PUSH_CODE_SEND_CONFIRMED`), it would never match → spurious retries and a false "failed". Need to confirm the repeater-CLI/command path is separate from the text-message ACK machinery (the connector does call `_recordPathResult` for "repeater command results" — worth tracing that it isn't also arming an ACK wait). -- **Fix/verify:** ensure command sends bypass the expected-ack/retry tracking entirely, or special-case `expected_ack == 0` in `updateMessageFromSent` as "no ACK expected → mark sent, don't wait". - ---- - -# Live Log Analysis — "JC Room Server" session (2026-06-12) - -Real device log (BLE/USB, auto route rotation ON) sending to a multi-hop room server. This is a near-perfect live reproduction of RETRY-2, RETRY-3, and RETRY-5. The ACK *matching* is correct (every `RESP_CODE_SENT` matches its message); what's broken is **timeout estimation and path rotation** — the app declares failures and retries messages that are actually still in flight. - -### Evidence by symptom - -1. **Flood timeout = 151 seconds (RETRY-5, live).** - `raw prediction=100638ms for pathLength=-1 → ML timeout 150959ms`. Feeding `pathLength=-1` into the linear model makes the flood case extrapolate off a cliff; the `.clamp(physicsMin, physicsMax)` didn't help because the flood `physicsMax` (`500 + 16·airtime`) was also huge. A message that falls back to flood effectively hangs for ~2.5 minutes. - - Also seen: `raw prediction=-3467ms for pathLength=1, messageBytes=172` — a **negative** predicted time. Discarded by the `<=0` guard, but proves the OLS model is unstable/underconstrained (matches the ML notes). - -2. **Premature timeouts on a working route (RETRY-3, live).** - `"Its going well"` was **delivered in 16037ms**, but attempt 0/1 used timeouts of **14420ms / 10240ms** — shorter than the real round-trip — so they fired `Timeout → retrying` before the ACK could return. The `g:` message `delivered ... in 9418ms` arrived *after* a retry had already been scheduled. Messages that are genuinely in flight are being declared failed. - -3. **Device `est_timeout` ignored (RETRY-2, live).** - Every send gets a clean `RESP_CODE_SENT` (which carries the firmware's own `est_timeout`), but the app overrides it with the runaway ML value. The device's estimate would have been far saner than both the 10s (too short) and 151s (too long) ML outputs. - -4. **Path rotation never converges.** - Single message, per-retry path: `pathLength 3 → 2 → 1 → 2 → -1(flood)`; timeout target swings `25s → 19s → 13s → 19s → 151s`. Routes that just delivered (`g:` over 2 hops) are abandoned on the next message. On a 2-5 hop room server on a congested channel, the thrash never settles. - -5. **Retries congest the channel.** - `Radio quiet for 3037ms`, `Post-inbound backoff: waiting 14808ms` — channel is busy. Backoffs (`1/2/4/8s`) are far shorter than the 19-34s timeouts, so retries stack onto a multi-hop path and reduce delivery odds. - -6. **`attempt & 3` hash reuse visible.** `"I have some really c..."` attempt 0 and attempt 4 both expect `b8bfa902`; `"JC you around?"` reuses `b2074391`. Attempts 0/4 are indistinguishable on the wire (RETRY-4 / masking). - -7. **Room login runs a separate, untracked ACK path (relates to DELIVERY-6).** `No pending message found for ACK hash: b0023dab` ×5 during `[RoomLogin]` — login sends with an expected ACK that `MessageRetryService` never registered, so every login confirm logs as unmatched. Login has its own 26s timeout/retry and eventually succeeds. - -### Highest-impact fix (from this log) -Fix the timeout side: **stop feeding flood as `pathLength=-1`, hard-cap the ML output (≈30-45s), and fall back to the device's `est_timeout` instead of the runaway ML value.** That alone kills the 151s hang and the premature retries. Contained to `timeout_prediction_service.dart` + `calculateTimeout` in `meshcore_connector.dart`. - ---- - -# Design Proposal — Replace the timeout regressor; split timeout from loss (2026-06-12) - -Outcome of analyzing the JC Room Server log: the OLS `LinearRegressor` in `timeout_prediction_service.dart` is the wrong tool, and it's conflating two separate questions. This sketches the replacement before any code changes. - -## The core insight (why this isn't TCP, and what that implies) - -This is slow, **lossy** multi-hop radio: a message can be lost on a forward hop (never reaches the recipient) or delivered-but-the-ACK-return-is-lost. Two consequences drive the whole design: - -1. **On a lossy link, a longer timeout recovers nothing — only a retry does.** The timeout is your *time-to-retry*. Loss is the common outcome to a distant (5-hop) node, so inflating the timeout (e.g. the observed 151 s flood value) just maximizes idle time before the one action that helps. The right timeout is **the tightest value that still covers a realistically *successful* round-trip** (~P90–95 of success RTT), then give up and retry. -2. **The latency model is already blind to loss.** `recordObservation` is only called from `handleAckReceived` — i.e. only on success. Lost messages produce no sample. So the regressor estimates "time of a *successful* round-trip" (same data an EWMA would use), just with extrapolation/negative/explosion failure modes on top. Modeling loss for real would require censored-data/survival analysis, which is far heavier than needed. - -**Conclusion:** stop using one fragile latency regressor to answer both "how long to wait" and "is this route any good." Split them. - -## Part A — Timeout: physics-anchored, capped, adaptive RTT (replaces the OLS model) - -Drop `ml_algo` / `ml_dataframe`. Keep the existing `predictTimeout` / `recordObservation` interface so `calculateTimeout` and the connector wiring are untouched; swap the internals. - -Per **route class** = (hop count, flood-vs-direct); shared across contacts since data is sparse. - -``` -// baseline from physics (deterministic, generalizes to unseen hop/byte combos -// from sample #1). Use the LoRa airtime formula already in the connector, or the -// device's est_timeout from RESP_CODE_SENT (RETRY-2). -base = physicsEstimate(hops, bytes, sf, bw, cr) - -// learn only a BOUNDED multiplicative overhead from real successes (congestion, -// per-hop processing). EWMA, clamped so it can never explode or go negative. -on success(sample, hops, bytes): - ratio = sample / physicsEstimate(hops, bytes, ...) - f[class] = (1-α)·f[class] + α·clamp(ratio, 0.5, 4.0) // α≈0.125 - v[class] = (1-β)·v[class] + β·|f[class] - ratio| // β≈0.25 (deviation) - -predictTimeout(hops, bytes): - est = base · f[class] - return clamp(est + 4·v[class]·base, physicsMin, HARD_MAX) // HARD_MAX ≈ 30–45 s -``` - -Properties this fixes, by construction: -- **No 151 s / no negatives** — output is `physics × bounded factor + bounded variance`, hard-capped. -- **No flood discontinuity** — flood is its own class with its own factor, never `pathLength = -1` on a shared axis (kills RETRY-5). -- **No cold start** — seed `f=1`, `v=0`; the physics/device baseline is sensible from message #1; observations only refine the factor (removes the "need 10 samples" gate). -- **Variance is the timeout's whole point** — `est + k·deviation` is a calibrated high-percentile wait, so genuinely-in-flight messages aren't cut off early (kills RETRY-3), while staying tight enough that lost messages retry promptly. -- **Drops two dependencies**, ~15 lines, debuggable. - -Also remove the dead/broken `secSinceRx` feature (recorded ≈0; see ML notes) and feed transformed/UTF-8 payload bytes, not `text.length`. - -## Part B — Loss: route reliability drives retry / reroute / flood (data already exists) - -The "is this path even working" question belongs to `PathHistoryService`, which already tracks `successCount` / `failureCount` / `routeWeight` per path. Treat that as a Bernoulli delivery-probability estimate (Wilson or Beta lower bound on success rate) and use it for the *decision*, not the timeout: - -- **High-confidence working route** → keep using it; on a single timeout, retry the *same* path once (the ACK return may just have been lost) before changing anything. -- **Degrading route** (success rate dropping) → switch to the next-best ranked path rather than hammering a dying one. -- **No confident route / repeated failures** → flood to rediscover, then pin the rediscovered path (don't immediately rotate off it — the log shows good routes being abandoned the next message). - -This replaces the current "rotate the path on every retry" churn (which made the timeout target swing 25 s→19 s→13 s→19 s→151 s and never converged) with: **pin a working route; only re-route/flood when reliability says the route is actually bad.** - -## Sequencing -1. Part A first (self-contained, biggest visible win — kills the 151 s hang and premature retries; removes ml_algo). Same public interface, so low blast radius. -2. Then Part B (path-decision policy), which also subsumes much of the separate "location-change brittleness" work — a route that stops delivering after you move is just a route whose reliability dropped. From becfbedc99b8e64bf415007af9c176c392833f7e Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 13 Jun 2026 00:39:13 -0700 Subject: [PATCH 36/36] format files --- lib/screens/app_settings_screen.dart | 307 ++++---- lib/screens/channels_screen.dart | 104 +-- lib/screens/community_qr_scanner_screen.dart | 263 ++++--- lib/screens/companion_radio_stats_screen.dart | 5 +- lib/screens/contacts_screen.dart | 7 +- lib/screens/neighbors_screen.dart | 5 +- lib/screens/path_trace_map.dart | 12 +- lib/screens/repeater_cli_screen.dart | 699 ++++++++++++++---- lib/screens/repeater_hub_screen.dart | 26 +- lib/screens/repeater_settings_screen.dart | 25 +- lib/screens/repeater_status_screen.dart | 17 +- lib/screens/scanner_screen.dart | 46 +- lib/screens/settings_screen.dart | 12 +- lib/screens/tcp_screen.dart | 4 +- lib/screens/telemetry_screen.dart | 119 ++- lib/screens/usb_screen.dart | 14 +- lib/services/message_retry_service.dart | 16 +- lib/widgets/device_tile.dart | 15 +- lib/widgets/elements_ui.dart | 5 +- lib/widgets/jump_to_bottom_button.dart | 5 +- lib/widgets/mesh_ui.dart | 18 +- lib/widgets/message_status_icon.dart | 6 +- lib/widgets/path_map_ui.dart | 14 +- lib/widgets/repeater_login_dialog.dart | 19 +- lib/widgets/room_login_dialog.dart | 8 +- lib/widgets/unread_divider.dart | 10 +- 26 files changed, 1040 insertions(+), 741 deletions(-) diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index 5c8258ad..e54687c9 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -30,87 +30,103 @@ class AppSettingsScreen extends StatelessWidget { ), body: SafeArea( top: false, - child: Consumer3( - builder: ( - context, - settingsService, - connector, - translationService, - child, - ) { - return ListView( - padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), - children: [ - // APPEARANCE - SectionHeader(context.l10n.appSettings_appearance), - MeshCard( - padding: EdgeInsets.zero, - child: _buildAppearanceContent(context, settingsService), - ), - - // NOTIFICATIONS - SectionHeader(context.l10n.appSettings_notifications), - MeshCard( - padding: EdgeInsets.zero, - child: _buildNotificationsContent(context, settingsService), - ), - - // MESSAGING - SectionHeader(context.l10n.appSettings_messaging), - MeshCard( - padding: EdgeInsets.zero, - child: _buildMessagingContent(context, settingsService), - ), - - // BATTERY - SectionHeader(context.l10n.appSettings_battery), - MeshCard( - padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), - child: _buildBatteryContent( + child: + Consumer3< + AppSettingsService, + MeshCoreConnector, + TranslationService + >( + builder: + ( context, settingsService, connector, - ), - ), + translationService, + child, + ) { + return ListView( + padding: const EdgeInsets.fromLTRB(0, 8, 0, 24), + children: [ + // APPEARANCE + SectionHeader(context.l10n.appSettings_appearance), + MeshCard( + padding: EdgeInsets.zero, + child: _buildAppearanceContent( + context, + settingsService, + ), + ), - // MAP - SectionHeader(context.l10n.appSettings_mapDisplay), - MeshCard( - padding: EdgeInsets.zero, - child: _buildMapContent(context, settingsService), - ), + // NOTIFICATIONS + SectionHeader(context.l10n.appSettings_notifications), + MeshCard( + padding: EdgeInsets.zero, + child: _buildNotificationsContent( + context, + settingsService, + ), + ), - // TRANSLATION (non-web only) - if (!kIsWeb) ...[ - SectionHeader(context.l10n.translation_title), - MeshCard( - padding: EdgeInsets.zero, - child: _buildTranslationContent( - context, - settingsService, - translationService, - ), - ), - ], + // MESSAGING + SectionHeader(context.l10n.appSettings_messaging), + MeshCard( + padding: EdgeInsets.zero, + child: _buildMessagingContent( + context, + settingsService, + ), + ), - // CYR2LAT - SectionHeader(context.l10n.channels_cyr2latSettingsHeading), - MeshCard( - padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), - child: _buildCyr2LatContent(context, settingsService), - ), + // BATTERY + SectionHeader(context.l10n.appSettings_battery), + MeshCard( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: _buildBatteryContent( + context, + settingsService, + connector, + ), + ), - // DEBUG - SectionHeader(context.l10n.appSettings_debugCard), - MeshCard( - padding: EdgeInsets.zero, - child: _buildDebugContent(context, settingsService), - ), - ], - ); - }, - ), + // MAP + SectionHeader(context.l10n.appSettings_mapDisplay), + MeshCard( + padding: EdgeInsets.zero, + child: _buildMapContent(context, settingsService), + ), + + // TRANSLATION (non-web only) + if (!kIsWeb) ...[ + SectionHeader(context.l10n.translation_title), + MeshCard( + padding: EdgeInsets.zero, + child: _buildTranslationContent( + context, + settingsService, + translationService, + ), + ), + ], + + // CYR2LAT + SectionHeader( + context.l10n.channels_cyr2latSettingsHeading, + ), + MeshCard( + padding: const EdgeInsets.fromLTRB(16, 4, 16, 16), + child: _buildCyr2LatContent(context, settingsService), + ), + + // DEBUG + SectionHeader(context.l10n.appSettings_debugCard), + MeshCard( + padding: EdgeInsets.zero, + child: _buildDebugContent(context, settingsService), + ), + ], + ); + }, + ), ), ); } @@ -317,8 +333,7 @@ class AppSettingsScreen extends StatelessWidget { ), value: settingsService.settings.notifyOnNewChannelMessage, onChanged: notifEnabled - ? (value) => - settingsService.setNotifyOnNewChannelMessage(value) + ? (value) => settingsService.setNotifyOnNewChannelMessage(value) : null, ), const Divider(height: 1, indent: 16), @@ -367,9 +382,7 @@ class AppSettingsScreen extends StatelessWidget { ), secondary: const Icon(Icons.refresh_outlined, size: 20), title: Text(context.l10n.appSettings_clearPathOnMaxRetry), - subtitle: Text( - context.l10n.appSettings_clearPathOnMaxRetrySubtitle, - ), + subtitle: Text(context.l10n.appSettings_clearPathOnMaxRetrySubtitle), value: settingsService.settings.clearPathOnMaxRetry, onChanged: (value) { settingsService.setClearPathOnMaxRetry(value); @@ -472,9 +485,7 @@ class AppSettingsScreen extends StatelessWidget { min: 0.5, max: 5.0, divisions: 9, - label: settingsService - .settings - .initialRouteWeight + label: settingsService.settings.initialRouteWeight .toStringAsFixed(1), onChanged: (value) => settingsService.setInitialRouteWeight(value), @@ -485,9 +496,7 @@ class AppSettingsScreen extends StatelessWidget { const Divider(height: 1), ListTile( title: Text( - context - .l10n - .appSettings_routeWeightSuccessIncrement, + context.l10n.appSettings_routeWeightSuccessIncrement, ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -517,9 +526,7 @@ class AppSettingsScreen extends StatelessWidget { const Divider(height: 1), ListTile( title: Text( - context - .l10n - .appSettings_routeWeightFailureDecrement, + context.l10n.appSettings_routeWeightFailureDecrement, ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -548,9 +555,7 @@ class AppSettingsScreen extends StatelessWidget { ), const Divider(height: 1), ListTile( - title: Text( - context.l10n.appSettings_maxMessageRetries, - ), + title: Text(context.l10n.appSettings_maxMessageRetries), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -560,16 +565,12 @@ class AppSettingsScreen extends StatelessWidget { .appSettings_maxMessageRetriesSubtitle, ), Slider( - value: settingsService - .settings - .maxMessageRetries + value: settingsService.settings.maxMessageRetries .toDouble(), min: 2, max: 10, divisions: 8, - label: settingsService - .settings - .maxMessageRetries + label: settingsService.settings.maxMessageRetries .toString(), onChanged: (value) => settingsService .setMaxMessageRetries(value.toInt()), @@ -590,9 +591,7 @@ class AppSettingsScreen extends StatelessWidget { ), secondary: const Icon(Icons.location_searching, size: 20), title: Text(context.l10n.appSettings_enableMessageTracing), - subtitle: Text( - context.l10n.appSettings_enableMessageTracingSubtitle, - ), + subtitle: Text(context.l10n.appSettings_enableMessageTracingSubtitle), value: settingsService.settings.enableMessageTracing, onChanged: (value) { settingsService.setEnableMessageTracing(value); @@ -765,9 +764,7 @@ class AppSettingsScreen extends StatelessWidget { settingsService.settings.mapTimeFilterHours == 0 ? context.l10n.appSettings_timeFilterShowAll : context.l10n.appSettings_timeFilterShowLast( - settingsService - .settings - .mapTimeFilterHours + settingsService.settings.mapTimeFilterHours .toInt(), ), style: textTheme.bodySmall?.copyWith( @@ -925,15 +922,17 @@ class AppSettingsScreen extends StatelessWidget { title: Text( context.l10n.translation_autoIncomingTitle, style: TextStyle( - color: - translationEnabled ? null : Theme.of(context).disabledColor, + color: translationEnabled + ? null + : Theme.of(context).disabledColor, ), ), subtitle: Text( context.l10n.translation_autoIncomingSubtitle, style: TextStyle( - color: - translationEnabled ? null : Theme.of(context).disabledColor, + color: translationEnabled + ? null + : Theme.of(context).disabledColor, ), ), value: settings.autoTranslateIncomingMessages, @@ -955,15 +954,17 @@ class AppSettingsScreen extends StatelessWidget { title: Text( context.l10n.translation_composerTitle, style: TextStyle( - color: - translationEnabled ? null : Theme.of(context).disabledColor, + color: translationEnabled + ? null + : Theme.of(context).disabledColor, ), ), subtitle: Text( context.l10n.translation_composerSubtitle, style: TextStyle( - color: - translationEnabled ? null : Theme.of(context).disabledColor, + color: translationEnabled + ? null + : Theme.of(context).disabledColor, ), ), value: settings.composerTranslationEnabled, @@ -973,17 +974,12 @@ class AppSettingsScreen extends StatelessWidget { ), const Divider(height: 1, indent: 16), InkWell( - onTap: () => - _showTranslationLanguageDialog(context, settingsService), + onTap: () => _showTranslationLanguageDialog(context, settingsService), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), child: Row( children: [ - Icon( - Icons.language, - size: 20, - color: scheme.onSurfaceVariant, - ), + Icon(Icons.language, size: 20, color: scheme.onSurfaceVariant), const SizedBox(width: 12), Expanded( child: Column( @@ -1106,7 +1102,8 @@ class AppSettingsScreen extends StatelessWidget { ClipRRect( borderRadius: BorderRadius.circular(2), child: LinearProgressIndicator( - value: translationService.downloadFileName == + value: + translationService.downloadFileName == 'Merging chunks...' ? null : translationService.downloadProgress, @@ -1151,8 +1148,7 @@ class AppSettingsScreen extends StatelessWidget { const SizedBox(width: 12), Expanded( child: InkWell( - borderRadius: - BorderRadius.circular(MeshRadii.xs), + borderRadius: BorderRadius.circular(MeshRadii.xs), onTap: () => settingsService .setTranslationSelectedModelId(model.id), child: Column( @@ -1194,9 +1190,7 @@ class AppSettingsScreen extends StatelessWidget { const SizedBox(height: 8), Text( translationService.lastError!, - style: TextStyle( - color: Theme.of(context).colorScheme.error, - ), + style: TextStyle(color: Theme.of(context).colorScheme.error), ), ], ], @@ -1373,8 +1367,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageEn, value: 'en', - selected: - settingsService.settings.languageOverride == 'en', + selected: settingsService.settings.languageOverride == 'en', onTap: () { settingsService.setLanguageOverride('en'); Navigator.pop(ctx); @@ -1384,8 +1377,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageFr, value: 'fr', - selected: - settingsService.settings.languageOverride == 'fr', + selected: settingsService.settings.languageOverride == 'fr', onTap: () { settingsService.setLanguageOverride('fr'); Navigator.pop(ctx); @@ -1395,8 +1387,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageEs, value: 'es', - selected: - settingsService.settings.languageOverride == 'es', + selected: settingsService.settings.languageOverride == 'es', onTap: () { settingsService.setLanguageOverride('es'); Navigator.pop(ctx); @@ -1406,8 +1397,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageDe, value: 'de', - selected: - settingsService.settings.languageOverride == 'de', + selected: settingsService.settings.languageOverride == 'de', onTap: () { settingsService.setLanguageOverride('de'); Navigator.pop(ctx); @@ -1417,8 +1407,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languagePl, value: 'pl', - selected: - settingsService.settings.languageOverride == 'pl', + selected: settingsService.settings.languageOverride == 'pl', onTap: () { settingsService.setLanguageOverride('pl'); Navigator.pop(ctx); @@ -1428,8 +1417,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageSl, value: 'sl', - selected: - settingsService.settings.languageOverride == 'sl', + selected: settingsService.settings.languageOverride == 'sl', onTap: () { settingsService.setLanguageOverride('sl'); Navigator.pop(ctx); @@ -1439,8 +1427,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languagePt, value: 'pt', - selected: - settingsService.settings.languageOverride == 'pt', + selected: settingsService.settings.languageOverride == 'pt', onTap: () { settingsService.setLanguageOverride('pt'); Navigator.pop(ctx); @@ -1450,8 +1437,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageIt, value: 'it', - selected: - settingsService.settings.languageOverride == 'it', + selected: settingsService.settings.languageOverride == 'it', onTap: () { settingsService.setLanguageOverride('it'); Navigator.pop(ctx); @@ -1461,8 +1447,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageZh, value: 'zh', - selected: - settingsService.settings.languageOverride == 'zh', + selected: settingsService.settings.languageOverride == 'zh', onTap: () { settingsService.setLanguageOverride('zh'); Navigator.pop(ctx); @@ -1472,8 +1457,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageSv, value: 'sv', - selected: - settingsService.settings.languageOverride == 'sv', + selected: settingsService.settings.languageOverride == 'sv', onTap: () { settingsService.setLanguageOverride('sv'); Navigator.pop(ctx); @@ -1483,8 +1467,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageNl, value: 'nl', - selected: - settingsService.settings.languageOverride == 'nl', + selected: settingsService.settings.languageOverride == 'nl', onTap: () { settingsService.setLanguageOverride('nl'); Navigator.pop(ctx); @@ -1494,8 +1477,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageSk, value: 'sk', - selected: - settingsService.settings.languageOverride == 'sk', + selected: settingsService.settings.languageOverride == 'sk', onTap: () { settingsService.setLanguageOverride('sk'); Navigator.pop(ctx); @@ -1505,8 +1487,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageBg, value: 'bg', - selected: - settingsService.settings.languageOverride == 'bg', + selected: settingsService.settings.languageOverride == 'bg', onTap: () { settingsService.setLanguageOverride('bg'); Navigator.pop(ctx); @@ -1516,8 +1497,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageRu, value: 'ru', - selected: - settingsService.settings.languageOverride == 'ru', + selected: settingsService.settings.languageOverride == 'ru', onTap: () { settingsService.setLanguageOverride('ru'); Navigator.pop(ctx); @@ -1527,8 +1507,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageUk, value: 'uk', - selected: - settingsService.settings.languageOverride == 'uk', + selected: settingsService.settings.languageOverride == 'uk', onTap: () { settingsService.setLanguageOverride('uk'); Navigator.pop(ctx); @@ -1538,8 +1517,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageHu, value: 'hu', - selected: - settingsService.settings.languageOverride == 'hu', + selected: settingsService.settings.languageOverride == 'hu', onTap: () { settingsService.setLanguageOverride('hu'); Navigator.pop(ctx); @@ -1549,8 +1527,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageJa, value: 'ja', - selected: - settingsService.settings.languageOverride == 'ja', + selected: settingsService.settings.languageOverride == 'ja', onTap: () { settingsService.setLanguageOverride('ja'); Navigator.pop(ctx); @@ -1560,8 +1537,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_languageKo, value: 'ko', - selected: - settingsService.settings.languageOverride == 'ko', + selected: settingsService.settings.languageOverride == 'ko', onTap: () { settingsService.setLanguageOverride('ko'); Navigator.pop(ctx); @@ -1660,8 +1636,7 @@ class AppSettingsScreen extends StatelessWidget { ctx, label: context.l10n.appSettings_unitsMetric, value: UnitSystem.metric, - selected: - settingsService.settings.unitSystem == UnitSystem.metric, + selected: settingsService.settings.unitSystem == UnitSystem.metric, onTap: () { settingsService.setUnitSystem(UnitSystem.metric); Navigator.pop(ctx); @@ -1874,9 +1849,7 @@ class AppSettingsScreen extends StatelessWidget { if (nameController.text.isEmpty) { showDismissibleSnackBar( context, - content: Text( - context.l10n.settings_cyr2latProfileNameEmpty, - ), + content: Text(context.l10n.settings_cyr2latProfileNameEmpty), ); return; } @@ -1964,9 +1937,7 @@ class AppSettingsScreen extends StatelessWidget { if (nameController.text.isEmpty) { showDismissibleSnackBar( context, - content: Text( - context.l10n.settings_cyr2latProfileNameEmpty, - ), + content: Text(context.l10n.settings_cyr2latProfileNameEmpty), ); return; } diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index 080eef8e..94bbd65e 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -462,7 +462,9 @@ class _ChannelsScreenState extends State color: MeshPalette.magenta, shape: BoxShape.circle, border: Border.all( - color: Theme.of(context).colorScheme.surfaceContainerLow, + color: Theme.of( + context, + ).colorScheme.surfaceContainerLow, width: 2, ), ), @@ -488,9 +490,8 @@ class _ChannelsScreenState extends State Expanded( child: Text( channelLabel, - style: Theme.of(context).textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w500, - ), + style: Theme.of(context).textTheme.bodyMedium + ?.copyWith(fontWeight: FontWeight.w500), maxLines: 1, overflow: TextOverflow.ellipsis, ), @@ -544,8 +545,7 @@ class _ChannelsScreenState extends State ), const SizedBox(width: 4), ], - if (unreadCount > 0) - UnreadBadge(count: unreadCount), + if (unreadCount > 0) UnreadBadge(count: unreadCount), ], ), ], @@ -806,12 +806,8 @@ class _ChannelsScreenState extends State return MeshCard( margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), - borderColor: isSelected && enabled - ? MeshPalette.blueLine - : null, - color: isSelected && enabled - ? MeshPalette.blueBg - : null, + borderColor: isSelected && enabled ? MeshPalette.blueLine : null, + color: isSelected && enabled ? MeshPalette.blueBg : null, onTap: enabled ? () { setSheetState(() { @@ -828,7 +824,9 @@ class _ChannelsScreenState extends State name: title, size: 38, color: enabled - ? (isSelected ? MeshPalette.blue : cardScheme.onSurfaceVariant) + ? (isSelected + ? MeshPalette.blue + : cardScheme.onSurfaceVariant) : cardScheme.outline, icon: icon, ), @@ -840,17 +838,21 @@ class _ChannelsScreenState extends State children: [ Text( title, - style: Theme.of(sheetContext).textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w500, - color: enabled ? null : cardScheme.outline, - ), + style: Theme.of(sheetContext).textTheme.bodyMedium + ?.copyWith( + fontWeight: FontWeight.w500, + color: enabled ? null : cardScheme.outline, + ), ), const SizedBox(height: 2), Text( subtitle, - style: Theme.of(sheetContext).textTheme.bodySmall?.copyWith( - color: enabled ? cardScheme.onSurfaceVariant : cardScheme.outline, - ), + style: Theme.of(sheetContext).textTheme.bodySmall + ?.copyWith( + color: enabled + ? cardScheme.onSurfaceVariant + : cardScheme.outline, + ), maxLines: 2, overflow: TextOverflow.ellipsis, ), @@ -860,7 +862,9 @@ class _ChannelsScreenState extends State if (enabled) Icon( Icons.chevron_right, - color: isSelected ? MeshPalette.blue : cardScheme.onSurfaceVariant, + color: isSelected + ? MeshPalette.blue + : cardScheme.onSurfaceVariant, size: 20, ), ], @@ -998,9 +1002,7 @@ class _ChannelsScreenState extends State showDismissibleSnackBar( context, content: Text( - sheetContext - .l10n - .channels_pskMustBe32Hex, + sheetContext.l10n.channels_pskMustBe32Hex, ), ); return; @@ -1313,9 +1315,7 @@ class _ChannelsScreenState extends State addPublicChannel = value ?? true; }); }, - title: Text( - sheetContext.l10n.community_addPublicChannel, - ), + title: Text(sheetContext.l10n.community_addPublicChannel), subtitle: Text( sheetContext.l10n.community_addPublicChannelHint, ), @@ -1418,9 +1418,7 @@ class _ChannelsScreenState extends State maxChildSize: 0.95, builder: (_, scrollController) => Column( children: [ - BottomSheetHeader( - title: sheetContext.l10n.channels_addChannel, - ), + BottomSheetHeader(title: sheetContext.l10n.channels_addChannel), Expanded( child: ListView( controller: scrollController, @@ -1519,7 +1517,9 @@ class _ChannelsScreenState extends State builder: (_, scrollController) => Column( children: [ BottomSheetHeader( - title: sheetContext.l10n.channels_editChannelTitle(channel.index), + title: sheetContext.l10n.channels_editChannelTitle( + channel.index, + ), ), Expanded( child: ListView( @@ -1569,7 +1569,9 @@ class _ChannelsScreenState extends State ), SwitchListTile( contentPadding: EdgeInsets.zero, - title: Text(sheetContext.l10n.channels_cyr2latCompression), + title: Text( + sheetContext.l10n.channels_cyr2latCompression, + ), subtitle: Text( sheetContext.l10n.channels_cyr2latCompressionDscr, ), @@ -1592,14 +1594,14 @@ class _ChannelsScreenState extends State .channels_cyr2latSettingsSubheading, border: const OutlineInputBorder(), ), - items: appSettingsService.settings.cyr2latProfiles.map(( - profile, - ) { - return DropdownMenuItem( - value: profile.id, - child: Text(profile.name), - ); - }).toList(), + items: appSettingsService.settings.cyr2latProfiles + .map((profile) { + return DropdownMenuItem( + value: profile.id, + child: Text(profile.name), + ); + }) + .toList(), onChanged: (value) => setSheetState(() { selectedCyr2LatProfileId = value; }), @@ -1633,14 +1635,20 @@ class _ChannelsScreenState extends State } on FormatException { showDismissibleSnackBar( sheetContext, - content: Text(sheetContext.l10n.channels_pskMustBe32Hex), + content: Text( + sheetContext.l10n.channels_pskMustBe32Hex, + ), ); return; } Navigator.pop(sheetContext); try { - await connector.setChannel(channel.index, name, psk); + await connector.setChannel( + channel.index, + name, + psk, + ); await connector.setChannelSmazEnabled( channel.index, smazEnabled, @@ -1656,7 +1664,9 @@ class _ChannelsScreenState extends State if (!context.mounted) return; showDismissibleSnackBar( context, - content: Text(context.l10n.channels_channelUpdated(name)), + content: Text( + context.l10n.channels_channelUpdated(name), + ), ); } catch (e, st) { debugPrint(st.toString()); @@ -1732,7 +1742,9 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.common_delete, - style: TextStyle(color: Theme.of(dialogContext).colorScheme.error), + style: TextStyle( + color: Theme.of(dialogContext).colorScheme.error, + ), ), ), ], @@ -1975,7 +1987,9 @@ class _ChannelsScreenState extends State }, child: Text( dialogContext.l10n.community_delete, - style: TextStyle(color: Theme.of(dialogContext).colorScheme.error), + style: TextStyle( + color: Theme.of(dialogContext).colorScheme.error, + ), ), ), ], diff --git a/lib/screens/community_qr_scanner_screen.dart b/lib/screens/community_qr_scanner_screen.dart index c7941900..77321573 100644 --- a/lib/screens/community_qr_scanner_screen.dart +++ b/lib/screens/community_qr_scanner_screen.dart @@ -109,10 +109,7 @@ class _CommunityQrScannerScreenState extends State { ), child: Text( context.l10n.community_scanInstructions, - style: const TextStyle( - color: MeshPalette.ink2, - fontSize: 13, - ), + style: const TextStyle(color: MeshPalette.ink2, fontSize: 13), textAlign: TextAlign.center, ), ), @@ -185,61 +182,61 @@ class _CommunityQrScannerScreenState extends State { builder: (sheetContext) { final sheetScheme = Theme.of(sheetContext).colorScheme; return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - BottomSheetHeader(title: context.l10n.community_alreadyMember), - Padding( - padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), - child: Text( - context.l10n.community_alreadyMemberMessage(community.name), - style: TextStyle(color: sheetScheme.onSurfaceVariant), + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + BottomSheetHeader(title: context.l10n.community_alreadyMember), + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), + child: Text( + context.l10n.community_alreadyMemberMessage(community.name), + style: TextStyle(color: sheetScheme.onSurfaceVariant), + ), ), - ), - MeshCard( - child: Row( - children: [ - const Icon( - Icons.groups, - color: MeshPalette.magenta, - size: 32, - ), - const SizedBox(width: 14), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - community.name, - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 15, - ), - ), - Text( - 'ID: ${community.shortCommunityId}...', - style: MeshTheme.mono( - fontSize: 11.5, - color: sheetScheme.onSurfaceVariant, - ), - ), - ], + MeshCard( + child: Row( + children: [ + const Icon( + Icons.groups, + color: MeshPalette.magenta, + size: 32, ), - ), - ], + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + community.name, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + Text( + 'ID: ${community.shortCommunityId}...', + style: MeshTheme.mono( + fontSize: 11.5, + color: sheetScheme.onSurfaceVariant, + ), + ), + ], + ), + ), + ], + ), ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: FilledButton( - onPressed: () { - Navigator.pop(sheetContext); - Navigator.pop(context); - }, - child: Text(context.l10n.common_ok), + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: FilledButton( + onPressed: () { + Navigator.pop(sheetContext); + Navigator.pop(context); + }, + child: Text(context.l10n.common_ok), + ), ), - ), - ], + ], ); }, ); @@ -258,90 +255,90 @@ class _CommunityQrScannerScreenState extends State { builder: (sheetContext, setSheetState) { final joinScheme = Theme.of(sheetContext).colorScheme; return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - BottomSheetHeader(title: context.l10n.community_joinTitle), - Padding( - padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), - child: Text( - context.l10n.community_joinConfirmation(community.name), - style: TextStyle(color: joinScheme.onSurfaceVariant), + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + BottomSheetHeader(title: context.l10n.community_joinTitle), + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 4), + child: Text( + context.l10n.community_joinConfirmation(community.name), + style: TextStyle(color: joinScheme.onSurfaceVariant), + ), ), - ), - MeshCard( - child: Row( - children: [ - AvatarCircle( - name: community.name, - icon: Icons.groups, - color: MeshPalette.magenta, - size: 44, - ), - const SizedBox(width: 14), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - community.name, - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 15, + MeshCard( + child: Row( + children: [ + AvatarCircle( + name: community.name, + icon: Icons.groups, + color: MeshPalette.magenta, + size: 44, + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + community.name, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), ), - ), - Text( - 'ID: ${community.shortCommunityId}...', - style: MeshTheme.mono( - fontSize: 11.5, - color: joinScheme.onSurfaceVariant, + Text( + 'ID: ${community.shortCommunityId}...', + style: MeshTheme.mono( + fontSize: 11.5, + color: joinScheme.onSurfaceVariant, + ), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), - ), - CheckboxListTile( - value: addPublicChannel, - onChanged: (value) { - setSheetState(() { - addPublicChannel = value ?? true; - }); - }, - title: Text(context.l10n.community_addPublicChannel), - subtitle: Text(context.l10n.community_addPublicChannelHint), - controlAffinity: ListTileControlAffinity.leading, - contentPadding: const EdgeInsets.symmetric(horizontal: 16), - ), - Padding( - padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), - child: Row( - children: [ - Expanded( - child: OutlinedButton( - onPressed: () { - completer.complete(false); - Navigator.pop(sheetContext); - }, - child: Text(context.l10n.common_cancel), - ), - ), - const SizedBox(width: 12), - Expanded( - child: FilledButton( - onPressed: () { - completer.complete(true); - Navigator.pop(sheetContext); - }, - child: Text(context.l10n.community_join), - ), - ), - ], + CheckboxListTile( + value: addPublicChannel, + onChanged: (value) { + setSheetState(() { + addPublicChannel = value ?? true; + }); + }, + title: Text(context.l10n.community_addPublicChannel), + subtitle: Text(context.l10n.community_addPublicChannelHint), + controlAffinity: ListTileControlAffinity.leading, + contentPadding: const EdgeInsets.symmetric(horizontal: 16), ), - ), - ], + Padding( + padding: const EdgeInsets.fromLTRB(16, 8, 16, 16), + child: Row( + children: [ + Expanded( + child: OutlinedButton( + onPressed: () { + completer.complete(false); + Navigator.pop(sheetContext); + }, + child: Text(context.l10n.common_cancel), + ), + ), + const SizedBox(width: 12), + Expanded( + child: FilledButton( + onPressed: () { + completer.complete(true); + Navigator.pop(sheetContext); + }, + child: Text(context.l10n.community_join), + ), + ), + ], + ), + ), + ], ); }, ), diff --git a/lib/screens/companion_radio_stats_screen.dart b/lib/screens/companion_radio_stats_screen.dart index a36a2a6c..f7d8f46e 100644 --- a/lib/screens/companion_radio_stats_screen.dart +++ b/lib/screens/companion_radio_stats_screen.dart @@ -139,10 +139,7 @@ class _CompanionRadioStatsScreenState extends State { stats.lastSnrDb.toStringAsFixed(1), ), Icons.signal_cellular_alt, - MeshTheme.snrColor( - stats.lastSnrDb, - blocked: false, - ), + MeshTheme.snrColor(stats.lastSnrDb, blocked: false), ), ], ), diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index 69fb67e0..44ec78d2 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -1574,7 +1574,8 @@ class _ContactTile extends StatelessWidget { case advTypeSensor: return const Color(0xFF4ACCC4); // teal default: - return MeshPalette.blue; // chat — AvatarCircle handles deterministic hue + return MeshPalette + .blue; // chat — AvatarCircle handles deterministic hue } } @@ -1662,7 +1663,9 @@ class _ContactTile extends StatelessWidget { Icon( Icons.location_on, size: 13, - color: scheme.onSurfaceVariant.withValues(alpha: 0.55), + color: scheme.onSurfaceVariant.withValues( + alpha: 0.55, + ), ), ], ], diff --git a/lib/screens/neighbors_screen.dart b/lib/screens/neighbors_screen.dart index d043fbfe..529a00dd 100644 --- a/lib/screens/neighbors_screen.dart +++ b/lib/screens/neighbors_screen.dart @@ -351,10 +351,7 @@ class _NeighborsScreenState extends State { for (var i = 0; i < _parsedNeighbors!.length; i++) ListEntrance( index: i, - child: _buildNeighborRow( - _parsedNeighbors![i], - connector.currentSf, - ), + child: _buildNeighborRow(_parsedNeighbors![i], connector.currentSf), ), ], ); diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index d955b30b..2eebdc71 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -801,9 +801,7 @@ class _PathTraceMapScreenState extends State final selected = _selectedPath; return selected != null ? [selected] : const []; } - return _displayPaths - .where((p) => !_hiddenPathIds.contains(p.id)) - .toList(); + return _displayPaths.where((p) => !_hiddenPathIds.contains(p.id)).toList(); } /// Updates the playback path, but only when the selected path's geometry @@ -1249,7 +1247,8 @@ class _PathTraceMapScreenState extends State final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); showSharedNodeSheet( context, - title: '$hex: ${contact?.name ?? context.l10n.channelPath_unknownRepeater}', + title: + '$hex: ${contact?.name ?? context.l10n.channelPath_unknownRepeater}', paths: paths, onSelect: _selectPath, ); @@ -1539,9 +1538,8 @@ class _PathTraceMapScreenState extends State tooltip: _panelCollapsed ? l10n.pathMap_expandPanel : l10n.pathMap_collapsePanel, - onPressed: () => setState( - () => _panelCollapsed = !_panelCollapsed, - ), + onPressed: () => + setState(() => _panelCollapsed = !_panelCollapsed), ), ], ), diff --git a/lib/screens/repeater_cli_screen.dart b/lib/screens/repeater_cli_screen.dart index 5ed1b4eb..5024f334 100644 --- a/lib/screens/repeater_cli_screen.dart +++ b/lib/screens/repeater_cli_screen.dart @@ -470,26 +470,16 @@ class _RepeaterCliScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Icon( - Icons.terminal, - size: 48, - color: MeshPalette.ink4, - ), + const Icon(Icons.terminal, size: 48, color: MeshPalette.ink4), const SizedBox(height: 12), Text( l10n.repeater_noCommandsSent, - style: MeshTheme.mono( - fontSize: 13, - color: MeshPalette.ink3, - ), + style: MeshTheme.mono(fontSize: 13, color: MeshPalette.ink3), ), const SizedBox(height: 4), Text( l10n.repeater_typeCommandOrUseQuick, - style: const TextStyle( - fontSize: 12, - color: MeshPalette.ink4, - ), + style: const TextStyle(fontSize: 12, color: MeshPalette.ink4), ), ], ), @@ -518,9 +508,7 @@ class _RepeaterCliScreenState extends State { style: MeshTheme.mono( fontSize: 12, fontWeight: FontWeight.w700, - color: isCommand - ? MeshPalette.blue - : MeshPalette.ink3, + color: isCommand ? MeshPalette.blue : MeshPalette.ink3, ), ), ), @@ -530,9 +518,7 @@ class _RepeaterCliScreenState extends State { entry['text']!, style: MeshTheme.mono( fontSize: 12.5, - color: isCommand - ? MeshPalette.blue - : MeshPalette.ink, + color: isCommand ? MeshPalette.blue : MeshPalette.ink, ), ), ), @@ -559,156 +545,522 @@ class _RepeaterCliScreenState extends State { void _showCommandHelp(BuildContext context) { final l10n = context.l10n; final generalCommands = [ - _CommandHelpEntry(command: 'advert', description: l10n.repeater_cliHelpAdvert), - _CommandHelpEntry(command: 'reboot', description: l10n.repeater_cliHelpReboot), - _CommandHelpEntry(command: 'clock', description: l10n.repeater_cliHelpClock), - _CommandHelpEntry(command: 'password {new-password}', description: l10n.repeater_cliHelpPassword), - _CommandHelpEntry(command: 'ver', description: l10n.repeater_cliHelpVersion), - _CommandHelpEntry(command: 'clear stats', description: l10n.repeater_cliHelpClearStats), - _CommandHelpEntry(command: 'poweroff', description: l10n.repeater_cliHelpPowerOff), - _CommandHelpEntry(command: 'shutdown', description: l10n.repeater_cliHelpPowerOff), - _CommandHelpEntry(command: 'clkreboot', description: l10n.repeater_cliHelpClkReboot), - _CommandHelpEntry(command: 'advert.zerohop', description: l10n.repeater_cliHelpAdvertZeroHop), - _CommandHelpEntry(command: 'start ota', description: l10n.repeater_cliHelpStartOta), - _CommandHelpEntry(command: 'time {epoch-seconds}', description: l10n.repeater_cliHelpTime), - _CommandHelpEntry(command: 'board', description: l10n.repeater_cliHelpBoard), - _CommandHelpEntry(command: 'discover.neighbors', description: l10n.repeater_cliHelpDiscoverNeighbors), - _CommandHelpEntry(command: 'powersaving', description: l10n.repeater_cliHelpPowersaving), - _CommandHelpEntry(command: 'powersaving {on|off}', description: l10n.repeater_cliHelpPowersavingOnOff), - _CommandHelpEntry(command: 'erase', description: l10n.repeater_cliHelpErase), - _CommandHelpEntry(command: 'stats-packets', description: l10n.repeater_cliHelpStatsPackets), - _CommandHelpEntry(command: 'stats-radio', description: l10n.repeater_cliHelpStatsRadio), - _CommandHelpEntry(command: 'stats-core', description: l10n.repeater_cliHelpStatsCore), + _CommandHelpEntry( + command: 'advert', + description: l10n.repeater_cliHelpAdvert, + ), + _CommandHelpEntry( + command: 'reboot', + description: l10n.repeater_cliHelpReboot, + ), + _CommandHelpEntry( + command: 'clock', + description: l10n.repeater_cliHelpClock, + ), + _CommandHelpEntry( + command: 'password {new-password}', + description: l10n.repeater_cliHelpPassword, + ), + _CommandHelpEntry( + command: 'ver', + description: l10n.repeater_cliHelpVersion, + ), + _CommandHelpEntry( + command: 'clear stats', + description: l10n.repeater_cliHelpClearStats, + ), + _CommandHelpEntry( + command: 'poweroff', + description: l10n.repeater_cliHelpPowerOff, + ), + _CommandHelpEntry( + command: 'shutdown', + description: l10n.repeater_cliHelpPowerOff, + ), + _CommandHelpEntry( + command: 'clkreboot', + description: l10n.repeater_cliHelpClkReboot, + ), + _CommandHelpEntry( + command: 'advert.zerohop', + description: l10n.repeater_cliHelpAdvertZeroHop, + ), + _CommandHelpEntry( + command: 'start ota', + description: l10n.repeater_cliHelpStartOta, + ), + _CommandHelpEntry( + command: 'time {epoch-seconds}', + description: l10n.repeater_cliHelpTime, + ), + _CommandHelpEntry( + command: 'board', + description: l10n.repeater_cliHelpBoard, + ), + _CommandHelpEntry( + command: 'discover.neighbors', + description: l10n.repeater_cliHelpDiscoverNeighbors, + ), + _CommandHelpEntry( + command: 'powersaving', + description: l10n.repeater_cliHelpPowersaving, + ), + _CommandHelpEntry( + command: 'powersaving {on|off}', + description: l10n.repeater_cliHelpPowersavingOnOff, + ), + _CommandHelpEntry( + command: 'erase', + description: l10n.repeater_cliHelpErase, + ), + _CommandHelpEntry( + command: 'stats-packets', + description: l10n.repeater_cliHelpStatsPackets, + ), + _CommandHelpEntry( + command: 'stats-radio', + description: l10n.repeater_cliHelpStatsRadio, + ), + _CommandHelpEntry( + command: 'stats-core', + description: l10n.repeater_cliHelpStatsCore, + ), ]; final settingsCommands = [ - _CommandHelpEntry(command: 'set af {air-time-factor}', description: l10n.repeater_cliHelpSetAf), - _CommandHelpEntry(command: 'set tx {tx-power-dbm}', description: l10n.repeater_cliHelpSetTx), - _CommandHelpEntry(command: 'set repeat {on|off}', description: l10n.repeater_cliHelpSetRepeat), - _CommandHelpEntry(command: 'set allow.read.only {on|off}', description: l10n.repeater_cliHelpSetAllowReadOnly), - _CommandHelpEntry(command: 'set flood.max {max-hops}', description: l10n.repeater_cliHelpSetFloodMax), - _CommandHelpEntry(command: 'set int.thresh {db}', description: l10n.repeater_cliHelpSetIntThresh), - _CommandHelpEntry(command: 'set agc.reset.interval {seconds}', description: l10n.repeater_cliHelpSetAgcResetInterval), - _CommandHelpEntry(command: 'set multi.acks {0|1}', description: l10n.repeater_cliHelpSetMultiAcks), - _CommandHelpEntry(command: 'set advert.interval {minutes}', description: l10n.repeater_cliHelpSetAdvertInterval), - _CommandHelpEntry(command: 'set flood.advert.interval {hours}', description: l10n.repeater_cliHelpSetFloodAdvertInterval), - _CommandHelpEntry(command: 'set guest.password {guess-password}', description: l10n.repeater_cliHelpSetGuestPassword), - _CommandHelpEntry(command: 'set name {name}', description: l10n.repeater_cliHelpSetName), - _CommandHelpEntry(command: 'set lat {latitude}', description: l10n.repeater_cliHelpSetLat), - _CommandHelpEntry(command: 'set lon {longitude}', description: l10n.repeater_cliHelpSetLon), - _CommandHelpEntry(command: 'set radio {freq},{bw},{sf},{cr}', description: l10n.repeater_cliHelpSetRadio), - _CommandHelpEntry(command: 'set rxdelay {base}', description: l10n.repeater_cliHelpSetRxDelay), - _CommandHelpEntry(command: 'set txdelay {factor}', description: l10n.repeater_cliHelpSetTxDelay), - _CommandHelpEntry(command: 'set direct.txdelay {factor}', description: l10n.repeater_cliHelpSetDirectTxDelay), - _CommandHelpEntry(command: 'set bridge.enabled {on|off}', description: l10n.repeater_cliHelpSetBridgeEnabled), - _CommandHelpEntry(command: 'set bridge.delay {0-10000}', description: l10n.repeater_cliHelpSetBridgeDelay), - _CommandHelpEntry(command: 'set bridge.source {rx|tx}', description: l10n.repeater_cliHelpSetBridgeSource), - _CommandHelpEntry(command: 'set bridge.baud {speed}', description: l10n.repeater_cliHelpSetBridgeBaud), - _CommandHelpEntry(command: 'set bridge.secret {shared-secret}', description: l10n.repeater_cliHelpSetBridgeSecret), - _CommandHelpEntry(command: 'set adc.multiplier {factor}', description: l10n.repeater_cliHelpSetAdcMultiplier), - _CommandHelpEntry(command: 'tempradio {freq},{bw},{sf},{cr},{minutes}', description: l10n.repeater_cliHelpTempRadio), - _CommandHelpEntry(command: 'setperm {pubkey-hex} {permissions}', description: l10n.repeater_cliHelpSetPerm), - _CommandHelpEntry(command: 'set dutycycle {1-100}', description: l10n.repeater_cliHelpSetDutyCycle), - _CommandHelpEntry(command: 'set prv.key {hex}', description: l10n.repeater_cliHelpSetPrvKey), - _CommandHelpEntry(command: 'set radio.rxgain {on|off}', description: l10n.repeater_cliHelpSetRadioRxGain), - _CommandHelpEntry(command: 'set owner.info {text}', description: l10n.repeater_cliHelpSetOwnerInfo), - _CommandHelpEntry(command: 'set path.hash.mode {0|1|2}', description: l10n.repeater_cliHelpSetPathHashMode), - _CommandHelpEntry(command: 'set loop.detect {off|minimal|moderate|strict}', description: l10n.repeater_cliHelpSetLoopDetect), - _CommandHelpEntry(command: 'set freq {mhz}', description: l10n.repeater_cliHelpSetFreq), - _CommandHelpEntry(command: 'set bridge.channel {1-14}', description: l10n.repeater_cliHelpSetBridgeChannel), + _CommandHelpEntry( + command: 'set af {air-time-factor}', + description: l10n.repeater_cliHelpSetAf, + ), + _CommandHelpEntry( + command: 'set tx {tx-power-dbm}', + description: l10n.repeater_cliHelpSetTx, + ), + _CommandHelpEntry( + command: 'set repeat {on|off}', + description: l10n.repeater_cliHelpSetRepeat, + ), + _CommandHelpEntry( + command: 'set allow.read.only {on|off}', + description: l10n.repeater_cliHelpSetAllowReadOnly, + ), + _CommandHelpEntry( + command: 'set flood.max {max-hops}', + description: l10n.repeater_cliHelpSetFloodMax, + ), + _CommandHelpEntry( + command: 'set int.thresh {db}', + description: l10n.repeater_cliHelpSetIntThresh, + ), + _CommandHelpEntry( + command: 'set agc.reset.interval {seconds}', + description: l10n.repeater_cliHelpSetAgcResetInterval, + ), + _CommandHelpEntry( + command: 'set multi.acks {0|1}', + description: l10n.repeater_cliHelpSetMultiAcks, + ), + _CommandHelpEntry( + command: 'set advert.interval {minutes}', + description: l10n.repeater_cliHelpSetAdvertInterval, + ), + _CommandHelpEntry( + command: 'set flood.advert.interval {hours}', + description: l10n.repeater_cliHelpSetFloodAdvertInterval, + ), + _CommandHelpEntry( + command: 'set guest.password {guess-password}', + description: l10n.repeater_cliHelpSetGuestPassword, + ), + _CommandHelpEntry( + command: 'set name {name}', + description: l10n.repeater_cliHelpSetName, + ), + _CommandHelpEntry( + command: 'set lat {latitude}', + description: l10n.repeater_cliHelpSetLat, + ), + _CommandHelpEntry( + command: 'set lon {longitude}', + description: l10n.repeater_cliHelpSetLon, + ), + _CommandHelpEntry( + command: 'set radio {freq},{bw},{sf},{cr}', + description: l10n.repeater_cliHelpSetRadio, + ), + _CommandHelpEntry( + command: 'set rxdelay {base}', + description: l10n.repeater_cliHelpSetRxDelay, + ), + _CommandHelpEntry( + command: 'set txdelay {factor}', + description: l10n.repeater_cliHelpSetTxDelay, + ), + _CommandHelpEntry( + command: 'set direct.txdelay {factor}', + description: l10n.repeater_cliHelpSetDirectTxDelay, + ), + _CommandHelpEntry( + command: 'set bridge.enabled {on|off}', + description: l10n.repeater_cliHelpSetBridgeEnabled, + ), + _CommandHelpEntry( + command: 'set bridge.delay {0-10000}', + description: l10n.repeater_cliHelpSetBridgeDelay, + ), + _CommandHelpEntry( + command: 'set bridge.source {rx|tx}', + description: l10n.repeater_cliHelpSetBridgeSource, + ), + _CommandHelpEntry( + command: 'set bridge.baud {speed}', + description: l10n.repeater_cliHelpSetBridgeBaud, + ), + _CommandHelpEntry( + command: 'set bridge.secret {shared-secret}', + description: l10n.repeater_cliHelpSetBridgeSecret, + ), + _CommandHelpEntry( + command: 'set adc.multiplier {factor}', + description: l10n.repeater_cliHelpSetAdcMultiplier, + ), + _CommandHelpEntry( + command: 'tempradio {freq},{bw},{sf},{cr},{minutes}', + description: l10n.repeater_cliHelpTempRadio, + ), + _CommandHelpEntry( + command: 'setperm {pubkey-hex} {permissions}', + description: l10n.repeater_cliHelpSetPerm, + ), + _CommandHelpEntry( + command: 'set dutycycle {1-100}', + description: l10n.repeater_cliHelpSetDutyCycle, + ), + _CommandHelpEntry( + command: 'set prv.key {hex}', + description: l10n.repeater_cliHelpSetPrvKey, + ), + _CommandHelpEntry( + command: 'set radio.rxgain {on|off}', + description: l10n.repeater_cliHelpSetRadioRxGain, + ), + _CommandHelpEntry( + command: 'set owner.info {text}', + description: l10n.repeater_cliHelpSetOwnerInfo, + ), + _CommandHelpEntry( + command: 'set path.hash.mode {0|1|2}', + description: l10n.repeater_cliHelpSetPathHashMode, + ), + _CommandHelpEntry( + command: 'set loop.detect {off|minimal|moderate|strict}', + description: l10n.repeater_cliHelpSetLoopDetect, + ), + _CommandHelpEntry( + command: 'set freq {mhz}', + description: l10n.repeater_cliHelpSetFreq, + ), + _CommandHelpEntry( + command: 'set bridge.channel {1-14}', + description: l10n.repeater_cliHelpSetBridgeChannel, + ), ]; final bridgeCommands = [ - _CommandHelpEntry(command: 'get bridge.type', description: l10n.repeater_cliHelpGetBridgeType), + _CommandHelpEntry( + command: 'get bridge.type', + description: l10n.repeater_cliHelpGetBridgeType, + ), ]; final loggingCommands = [ - _CommandHelpEntry(command: 'log start', description: l10n.repeater_cliHelpLogStart), - _CommandHelpEntry(command: 'log stop', description: l10n.repeater_cliHelpLogStop), - _CommandHelpEntry(command: 'log erase', description: l10n.repeater_cliHelpLogErase), + _CommandHelpEntry( + command: 'log start', + description: l10n.repeater_cliHelpLogStart, + ), + _CommandHelpEntry( + command: 'log stop', + description: l10n.repeater_cliHelpLogStop, + ), + _CommandHelpEntry( + command: 'log erase', + description: l10n.repeater_cliHelpLogErase, + ), ]; final neighborCommands = [ - _CommandHelpEntry(command: 'neighbors', description: l10n.repeater_cliHelpNeighbors), - _CommandHelpEntry(command: 'neighbor.remove {pubkey-prefix}', description: l10n.repeater_cliHelpNeighborRemove), + _CommandHelpEntry( + command: 'neighbors', + description: l10n.repeater_cliHelpNeighbors, + ), + _CommandHelpEntry( + command: 'neighbor.remove {pubkey-prefix}', + description: l10n.repeater_cliHelpNeighborRemove, + ), ]; final regionCommands = [ - _CommandHelpEntry(command: 'region', description: l10n.repeater_cliHelpRegion), - _CommandHelpEntry(command: 'region load', description: l10n.repeater_cliHelpRegionLoad), - _CommandHelpEntry(command: 'region get {* | name-prefix}', description: l10n.repeater_cliHelpRegionGet), - _CommandHelpEntry(command: 'region put {name} {* | parent-name-prefix}', description: l10n.repeater_cliHelpRegionPut), - _CommandHelpEntry(command: 'region remove {name}', description: l10n.repeater_cliHelpRegionRemove), - _CommandHelpEntry(command: 'region allowf {* | name-prefix}', description: l10n.repeater_cliHelpRegionAllowf), - _CommandHelpEntry(command: 'region denyf {* | name-prefix}', description: l10n.repeater_cliHelpRegionDenyf), - _CommandHelpEntry(command: 'region home', description: l10n.repeater_cliHelpRegionHome), - _CommandHelpEntry(command: 'region home {* | name-prefix}', description: l10n.repeater_cliHelpRegionHomeSet), - _CommandHelpEntry(command: 'region save', description: l10n.repeater_cliHelpRegionSave), - _CommandHelpEntry(command: 'region default', description: l10n.repeater_cliHelpRegionDefault), - _CommandHelpEntry(command: 'region default {* | name-prefix | }', description: l10n.repeater_cliHelpRegionDefaultSet), - _CommandHelpEntry(command: 'region list allowed', description: l10n.repeater_cliHelpRegionListAllowed), - _CommandHelpEntry(command: 'region list denied', description: l10n.repeater_cliHelpRegionListDenied), + _CommandHelpEntry( + command: 'region', + description: l10n.repeater_cliHelpRegion, + ), + _CommandHelpEntry( + command: 'region load', + description: l10n.repeater_cliHelpRegionLoad, + ), + _CommandHelpEntry( + command: 'region get {* | name-prefix}', + description: l10n.repeater_cliHelpRegionGet, + ), + _CommandHelpEntry( + command: 'region put {name} {* | parent-name-prefix}', + description: l10n.repeater_cliHelpRegionPut, + ), + _CommandHelpEntry( + command: 'region remove {name}', + description: l10n.repeater_cliHelpRegionRemove, + ), + _CommandHelpEntry( + command: 'region allowf {* | name-prefix}', + description: l10n.repeater_cliHelpRegionAllowf, + ), + _CommandHelpEntry( + command: 'region denyf {* | name-prefix}', + description: l10n.repeater_cliHelpRegionDenyf, + ), + _CommandHelpEntry( + command: 'region home', + description: l10n.repeater_cliHelpRegionHome, + ), + _CommandHelpEntry( + command: 'region home {* | name-prefix}', + description: l10n.repeater_cliHelpRegionHomeSet, + ), + _CommandHelpEntry( + command: 'region save', + description: l10n.repeater_cliHelpRegionSave, + ), + _CommandHelpEntry( + command: 'region default', + description: l10n.repeater_cliHelpRegionDefault, + ), + _CommandHelpEntry( + command: 'region default {* | name-prefix | }', + description: l10n.repeater_cliHelpRegionDefaultSet, + ), + _CommandHelpEntry( + command: 'region list allowed', + description: l10n.repeater_cliHelpRegionListAllowed, + ), + _CommandHelpEntry( + command: 'region list denied', + description: l10n.repeater_cliHelpRegionListDenied, + ), ]; final getCommands = [ - _CommandHelpEntry(command: 'get name', description: l10n.repeater_cliHelpGetName), - _CommandHelpEntry(command: 'get role', description: l10n.repeater_cliHelpGetRole), - _CommandHelpEntry(command: 'get public.key', description: l10n.repeater_cliHelpGetPublicKey), - _CommandHelpEntry(command: 'get prv.key', description: l10n.repeater_cliHelpGetPrvKey), - _CommandHelpEntry(command: 'get repeat', description: l10n.repeater_cliHelpGetRepeat), - _CommandHelpEntry(command: 'get tx', description: l10n.repeater_cliHelpGetTx), - _CommandHelpEntry(command: 'get freq', description: l10n.repeater_cliHelpGetFreq), - _CommandHelpEntry(command: 'get radio', description: l10n.repeater_cliHelpGetRadio), - _CommandHelpEntry(command: 'get radio.rxgain', description: l10n.repeater_cliHelpGetRadioRxGain), - _CommandHelpEntry(command: 'get af', description: l10n.repeater_cliHelpGetAf), - _CommandHelpEntry(command: 'get dutycycle', description: l10n.repeater_cliHelpGetDutyCycle), - _CommandHelpEntry(command: 'get int.thresh', description: l10n.repeater_cliHelpGetIntThresh), - _CommandHelpEntry(command: 'get agc.reset.interval', description: l10n.repeater_cliHelpGetAgcResetInterval), - _CommandHelpEntry(command: 'get multi.acks', description: l10n.repeater_cliHelpGetMultiAcks), - _CommandHelpEntry(command: 'get allow.read.only', description: l10n.repeater_cliHelpGetAllowReadOnly), - _CommandHelpEntry(command: 'get advert.interval', description: l10n.repeater_cliHelpGetAdvertInterval), - _CommandHelpEntry(command: 'get flood.advert.interval', description: l10n.repeater_cliHelpGetFloodAdvertInterval), - _CommandHelpEntry(command: 'get guest.password', description: l10n.repeater_cliHelpGetGuestPassword), - _CommandHelpEntry(command: 'get lat', description: l10n.repeater_cliHelpGetLat), - _CommandHelpEntry(command: 'get lon', description: l10n.repeater_cliHelpGetLon), - _CommandHelpEntry(command: 'get rxdelay', description: l10n.repeater_cliHelpGetRxDelay), - _CommandHelpEntry(command: 'get txdelay', description: l10n.repeater_cliHelpGetTxDelay), - _CommandHelpEntry(command: 'get direct.txdelay', description: l10n.repeater_cliHelpGetDirectTxDelay), - _CommandHelpEntry(command: 'get flood.max', description: l10n.repeater_cliHelpGetFloodMax), - _CommandHelpEntry(command: 'get owner.info', description: l10n.repeater_cliHelpGetOwnerInfo), - _CommandHelpEntry(command: 'get path.hash.mode', description: l10n.repeater_cliHelpGetPathHashMode), - _CommandHelpEntry(command: 'get loop.detect', description: l10n.repeater_cliHelpGetLoopDetect), - _CommandHelpEntry(command: 'get acl', description: l10n.repeater_cliHelpGetAcl), - _CommandHelpEntry(command: 'get bridge.enabled', description: l10n.repeater_cliHelpGetBridgeEnabled), - _CommandHelpEntry(command: 'get bridge.delay', description: l10n.repeater_cliHelpGetBridgeDelay), - _CommandHelpEntry(command: 'get bridge.source', description: l10n.repeater_cliHelpGetBridgeSource), - _CommandHelpEntry(command: 'get bridge.baud', description: l10n.repeater_cliHelpGetBridgeBaud), - _CommandHelpEntry(command: 'get bridge.channel', description: l10n.repeater_cliHelpGetBridgeChannel), - _CommandHelpEntry(command: 'get bridge.secret', description: l10n.repeater_cliHelpGetBridgeSecret), - _CommandHelpEntry(command: 'get bootloader.ver', description: l10n.repeater_cliHelpGetBootloaderVer), - _CommandHelpEntry(command: 'get adc.multiplier', description: l10n.repeater_cliHelpGetAdcMultiplier), + _CommandHelpEntry( + command: 'get name', + description: l10n.repeater_cliHelpGetName, + ), + _CommandHelpEntry( + command: 'get role', + description: l10n.repeater_cliHelpGetRole, + ), + _CommandHelpEntry( + command: 'get public.key', + description: l10n.repeater_cliHelpGetPublicKey, + ), + _CommandHelpEntry( + command: 'get prv.key', + description: l10n.repeater_cliHelpGetPrvKey, + ), + _CommandHelpEntry( + command: 'get repeat', + description: l10n.repeater_cliHelpGetRepeat, + ), + _CommandHelpEntry( + command: 'get tx', + description: l10n.repeater_cliHelpGetTx, + ), + _CommandHelpEntry( + command: 'get freq', + description: l10n.repeater_cliHelpGetFreq, + ), + _CommandHelpEntry( + command: 'get radio', + description: l10n.repeater_cliHelpGetRadio, + ), + _CommandHelpEntry( + command: 'get radio.rxgain', + description: l10n.repeater_cliHelpGetRadioRxGain, + ), + _CommandHelpEntry( + command: 'get af', + description: l10n.repeater_cliHelpGetAf, + ), + _CommandHelpEntry( + command: 'get dutycycle', + description: l10n.repeater_cliHelpGetDutyCycle, + ), + _CommandHelpEntry( + command: 'get int.thresh', + description: l10n.repeater_cliHelpGetIntThresh, + ), + _CommandHelpEntry( + command: 'get agc.reset.interval', + description: l10n.repeater_cliHelpGetAgcResetInterval, + ), + _CommandHelpEntry( + command: 'get multi.acks', + description: l10n.repeater_cliHelpGetMultiAcks, + ), + _CommandHelpEntry( + command: 'get allow.read.only', + description: l10n.repeater_cliHelpGetAllowReadOnly, + ), + _CommandHelpEntry( + command: 'get advert.interval', + description: l10n.repeater_cliHelpGetAdvertInterval, + ), + _CommandHelpEntry( + command: 'get flood.advert.interval', + description: l10n.repeater_cliHelpGetFloodAdvertInterval, + ), + _CommandHelpEntry( + command: 'get guest.password', + description: l10n.repeater_cliHelpGetGuestPassword, + ), + _CommandHelpEntry( + command: 'get lat', + description: l10n.repeater_cliHelpGetLat, + ), + _CommandHelpEntry( + command: 'get lon', + description: l10n.repeater_cliHelpGetLon, + ), + _CommandHelpEntry( + command: 'get rxdelay', + description: l10n.repeater_cliHelpGetRxDelay, + ), + _CommandHelpEntry( + command: 'get txdelay', + description: l10n.repeater_cliHelpGetTxDelay, + ), + _CommandHelpEntry( + command: 'get direct.txdelay', + description: l10n.repeater_cliHelpGetDirectTxDelay, + ), + _CommandHelpEntry( + command: 'get flood.max', + description: l10n.repeater_cliHelpGetFloodMax, + ), + _CommandHelpEntry( + command: 'get owner.info', + description: l10n.repeater_cliHelpGetOwnerInfo, + ), + _CommandHelpEntry( + command: 'get path.hash.mode', + description: l10n.repeater_cliHelpGetPathHashMode, + ), + _CommandHelpEntry( + command: 'get loop.detect', + description: l10n.repeater_cliHelpGetLoopDetect, + ), + _CommandHelpEntry( + command: 'get acl', + description: l10n.repeater_cliHelpGetAcl, + ), + _CommandHelpEntry( + command: 'get bridge.enabled', + description: l10n.repeater_cliHelpGetBridgeEnabled, + ), + _CommandHelpEntry( + command: 'get bridge.delay', + description: l10n.repeater_cliHelpGetBridgeDelay, + ), + _CommandHelpEntry( + command: 'get bridge.source', + description: l10n.repeater_cliHelpGetBridgeSource, + ), + _CommandHelpEntry( + command: 'get bridge.baud', + description: l10n.repeater_cliHelpGetBridgeBaud, + ), + _CommandHelpEntry( + command: 'get bridge.channel', + description: l10n.repeater_cliHelpGetBridgeChannel, + ), + _CommandHelpEntry( + command: 'get bridge.secret', + description: l10n.repeater_cliHelpGetBridgeSecret, + ), + _CommandHelpEntry( + command: 'get bootloader.ver', + description: l10n.repeater_cliHelpGetBootloaderVer, + ), + _CommandHelpEntry( + command: 'get adc.multiplier', + description: l10n.repeater_cliHelpGetAdcMultiplier, + ), ]; final powerMgmtCommands = [ - _CommandHelpEntry(command: 'get pwrmgt.support', description: l10n.repeater_cliHelpGetPwrMgtSupport), - _CommandHelpEntry(command: 'get pwrmgt.source', description: l10n.repeater_cliHelpGetPwrMgtSource), - _CommandHelpEntry(command: 'get pwrmgt.bootreason', description: l10n.repeater_cliHelpGetPwrMgtBootReason), - _CommandHelpEntry(command: 'get pwrmgt.bootmv', description: l10n.repeater_cliHelpGetPwrMgtBootMv), + _CommandHelpEntry( + command: 'get pwrmgt.support', + description: l10n.repeater_cliHelpGetPwrMgtSupport, + ), + _CommandHelpEntry( + command: 'get pwrmgt.source', + description: l10n.repeater_cliHelpGetPwrMgtSource, + ), + _CommandHelpEntry( + command: 'get pwrmgt.bootreason', + description: l10n.repeater_cliHelpGetPwrMgtBootReason, + ), + _CommandHelpEntry( + command: 'get pwrmgt.bootmv', + description: l10n.repeater_cliHelpGetPwrMgtBootMv, + ), ]; final sensorCommands = [ - _CommandHelpEntry(command: 'sensor get {key}', description: l10n.repeater_cliHelpSensorGet), - _CommandHelpEntry(command: 'sensor set {key} {value}', description: l10n.repeater_cliHelpSensorSet), - _CommandHelpEntry(command: 'sensor list [start]', description: l10n.repeater_cliHelpSensorList), + _CommandHelpEntry( + command: 'sensor get {key}', + description: l10n.repeater_cliHelpSensorGet, + ), + _CommandHelpEntry( + command: 'sensor set {key} {value}', + description: l10n.repeater_cliHelpSensorSet, + ), + _CommandHelpEntry( + command: 'sensor list [start]', + description: l10n.repeater_cliHelpSensorList, + ), ]; final gpsCommands = [ _CommandHelpEntry(command: 'gps', description: l10n.repeater_cliHelpGps), - _CommandHelpEntry(command: 'gps {on|off}', description: l10n.repeater_cliHelpGpsOnOff), - _CommandHelpEntry(command: 'gps sync', description: l10n.repeater_cliHelpGpsSync), - _CommandHelpEntry(command: 'gps setloc', description: l10n.repeater_cliHelpGpsSetLoc), - _CommandHelpEntry(command: 'gps advert', description: l10n.repeater_cliHelpGpsAdvert), - _CommandHelpEntry(command: 'gps advert {none|share|prefs}', description: l10n.repeater_cliHelpGpsAdvertSet), + _CommandHelpEntry( + command: 'gps {on|off}', + description: l10n.repeater_cliHelpGpsOnOff, + ), + _CommandHelpEntry( + command: 'gps sync', + description: l10n.repeater_cliHelpGpsSync, + ), + _CommandHelpEntry( + command: 'gps setloc', + description: l10n.repeater_cliHelpGpsSetLoc, + ), + _CommandHelpEntry( + command: 'gps advert', + description: l10n.repeater_cliHelpGpsAdvert, + ), + _CommandHelpEntry( + command: 'gps advert {none|share|prefs}', + description: l10n.repeater_cliHelpGpsAdvertSet, + ), ]; showDialog( @@ -720,27 +1072,64 @@ class _RepeaterCliScreenState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(l10n.repeater_commandsListNote, style: const TextStyle(fontSize: 13)), + Text( + l10n.repeater_commandsListNote, + style: const TextStyle(fontSize: 13), + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_general, generalCommands), + _buildHelpSection( + context, + l10n.repeater_general, + generalCommands, + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_getCategory, getCommands), + _buildHelpSection( + context, + l10n.repeater_getCategory, + getCommands, + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_settingsCategory, settingsCommands), + _buildHelpSection( + context, + l10n.repeater_settingsCategory, + settingsCommands, + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_powerMgmt, powerMgmtCommands), + _buildHelpSection( + context, + l10n.repeater_powerMgmt, + powerMgmtCommands, + ), const SizedBox(height: 16), _buildHelpSection(context, l10n.repeater_sensors, sensorCommands), const SizedBox(height: 16), _buildHelpSection(context, l10n.repeater_bridge, bridgeCommands), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_logging, loggingCommands), + _buildHelpSection( + context, + l10n.repeater_logging, + loggingCommands, + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_neighborsRepeaterOnly, neighborCommands), + _buildHelpSection( + context, + l10n.repeater_neighborsRepeaterOnly, + neighborCommands, + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_regionManagementRepeaterOnly, regionCommands, note: l10n.repeater_regionNote), + _buildHelpSection( + context, + l10n.repeater_regionManagementRepeaterOnly, + regionCommands, + note: l10n.repeater_regionNote, + ), const SizedBox(height: 16), - _buildHelpSection(context, l10n.repeater_gpsManagement, gpsCommands, note: l10n.repeater_gpsNote), + _buildHelpSection( + context, + l10n.repeater_gpsManagement, + gpsCommands, + note: l10n.repeater_gpsNote, + ), ], ), ), @@ -764,10 +1153,16 @@ class _RepeaterCliScreenState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15)), + Text( + title, + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15), + ), if (note != null) ...[ const SizedBox(height: 4), - Text(note, style: TextStyle(fontSize: 11, color: scheme.onSurfaceVariant)), + Text( + note, + style: TextStyle(fontSize: 11, color: scheme.onSurfaceVariant), + ), ], const SizedBox(height: 8), ...commands.map((entry) => _buildHelpCommandCard(context, entry)), diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index bbdec602..ab15e01e 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -70,9 +70,7 @@ class RepeaterHubScreen extends StatelessWidget { children: [ Text( repeater.name, - style: Theme.of(context) - .textTheme - .titleMedium + style: Theme.of(context).textTheme.titleMedium ?.copyWith(fontWeight: FontWeight.w700), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -88,9 +86,7 @@ class RepeaterHubScreen extends StatelessWidget { const SizedBox(height: 4), Text( repeater.pathLabel(l10n), - style: Theme.of(context) - .textTheme - .bodySmall + style: Theme.of(context).textTheme.bodySmall ?.copyWith(color: scheme.onSurfaceVariant), ), if (repeater.hasLocation) ...[ @@ -122,7 +118,9 @@ class RepeaterHubScreen extends StatelessWidget { ), StatusChip( label: isAdmin ? 'ADMIN' : 'GUEST', - color: isAdmin ? MeshPalette.blue : scheme.onSurfaceVariant, + color: isAdmin + ? MeshPalette.blue + : scheme.onSurfaceVariant, ), ], ), @@ -169,7 +167,9 @@ class RepeaterHubScreen extends StatelessWidget { // ── Tools ────────────────────────────────────────────────────── SectionHeader( - isAdmin ? l10n.repeater_managementTools : l10n.repeater_guestTools, + isAdmin + ? l10n.repeater_managementTools + : l10n.repeater_guestTools, ), _HubActionTile( @@ -306,9 +306,7 @@ class _HubActionTile extends StatelessWidget { decoration: BoxDecoration( color: accentColor.withValues(alpha: 0.12), borderRadius: BorderRadius.circular(MeshRadii.md), - border: Border.all( - color: accentColor.withValues(alpha: 0.3), - ), + border: Border.all(color: accentColor.withValues(alpha: 0.3)), ), alignment: Alignment.center, child: Icon(icon, size: 22, color: accentColor), @@ -336,11 +334,7 @@ class _HubActionTile extends StatelessWidget { ], ), ), - Icon( - Icons.chevron_right, - color: scheme.onSurfaceVariant, - size: 20, - ), + Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 20), ], ), ), diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index 30675e58..dca0d7f4 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -1196,9 +1196,7 @@ class _RepeaterSettingsScreenState extends State { const SizedBox(height: 12), DropdownButtonFormField( initialValue: _bandwidth, - decoration: InputDecoration( - labelText: l10n.repeater_bandwidth, - ), + decoration: InputDecoration(labelText: l10n.repeater_bandwidth), items: _bandwidthOptions.map((bw) { return DropdownMenuItem( value: bw, @@ -1478,7 +1476,9 @@ class _RepeaterSettingsScreenState extends State { child: ListTile( title: Text(l10n.repeater_localAdvertInterval), subtitle: Text( - l10n.repeater_localAdvertIntervalMinutes(_advertInterval), + l10n.repeater_localAdvertIntervalMinutes( + _advertInterval, + ), ), trailing: Switch( value: _advertEnable, @@ -1516,7 +1516,9 @@ class _RepeaterSettingsScreenState extends State { min: 60, max: 240, divisions: 18, - label: l10n.repeater_localAdvertIntervalMinutes(_advertInterval), + label: l10n.repeater_localAdvertIntervalMinutes( + _advertInterval, + ), onChanged: _advertEnable ? (value) { setState(() { @@ -2014,9 +2016,7 @@ class _RepeaterSettingsScreenState extends State { ), subtitle: Text( l10n.repeater_rebootRepeaterSubtitle, - style: const TextStyle( - color: MeshPalette.warnDim, - ), + style: const TextStyle(color: MeshPalette.warnDim), ), onTap: () => _confirmAction( l10n.repeater_rebootRepeater, @@ -2027,19 +2027,14 @@ class _RepeaterSettingsScreenState extends State { ), // Regenerate identity key - hidden until fully implemented ListTile( - leading: const Icon( - Icons.delete_forever, - color: MeshPalette.alert, - ), + leading: const Icon(Icons.delete_forever, color: MeshPalette.alert), title: Text( l10n.repeater_eraseFileSystem, style: const TextStyle(color: MeshPalette.alert), ), subtitle: Text( l10n.repeater_eraseFileSystemSubtitle, - style: const TextStyle( - color: MeshPalette.warnDim, - ), + style: const TextStyle(color: MeshPalette.warnDim), ), onTap: () => _confirmAction( l10n.repeater_eraseFileSystem, diff --git a/lib/screens/repeater_status_screen.dart b/lib/screens/repeater_status_screen.dart index 080d5b7f..42c97fa5 100644 --- a/lib/screens/repeater_status_screen.dart +++ b/lib/screens/repeater_status_screen.dart @@ -605,7 +605,8 @@ class _RepeaterStatusScreenState extends State { final batteryMv = connector.getRepeaterBatteryMillivolts(widget.repeater.publicKeyHex) ?? _batteryMv; - if (batteryMv == null) return Theme.of(context).colorScheme.onSurfaceVariant; + if (batteryMv == null) + return Theme.of(context).colorScheme.onSurfaceVariant; final percent = estimateBatteryPercentFromMillivolts( batteryMv, _batteryChemistry(), @@ -624,12 +625,14 @@ class _RepeaterStatusScreenState extends State { crossAxisSpacing: 8, childAspectRatio: 2.2, children: items - .map((item) => StatTile( - icon: item.icon, - label: item.label, - value: item.value, - color: item.color, - )) + .map( + (item) => StatTile( + icon: item.icon, + label: item.label, + value: item.value, + color: item.color, + ), + ) .toList(), ); } diff --git a/lib/screens/scanner_screen.dart b/lib/screens/scanner_screen.dart index 84be2df6..a8c83723 100644 --- a/lib/screens/scanner_screen.dart +++ b/lib/screens/scanner_screen.dart @@ -482,30 +482,30 @@ class _ConnectionStatusHeader extends StatelessWidget { final (String label, Color color, bool pulse) = switch (connector.state) { MeshCoreConnectionState.scanning => ( - l10n.scanner_scanning, - MeshPalette.blue, - true, - ), + l10n.scanner_scanning, + MeshPalette.blue, + true, + ), MeshCoreConnectionState.connecting => ( - l10n.scanner_connecting, - MeshPalette.warn, - true, - ), + l10n.scanner_connecting, + MeshPalette.warn, + true, + ), MeshCoreConnectionState.connected => ( - l10n.scanner_connectedTo(connector.deviceDisplayName), - MeshPalette.signal, - false, - ), + l10n.scanner_connectedTo(connector.deviceDisplayName), + MeshPalette.signal, + false, + ), MeshCoreConnectionState.disconnecting => ( - l10n.scanner_disconnecting, - MeshPalette.warn, - true, - ), + l10n.scanner_disconnecting, + MeshPalette.warn, + true, + ), MeshCoreConnectionState.disconnected => ( - l10n.scanner_notConnected, - scheme.onSurfaceVariant, - false, - ), + l10n.scanner_notConnected, + scheme.onSurfaceVariant, + false, + ), }; return Padding( @@ -515,11 +515,7 @@ class _ConnectionStatusHeader extends StatelessWidget { child: Align( key: ValueKey(connector.state), alignment: Alignment.centerLeft, - child: StatusChip( - label: label, - color: color, - pulse: pulse, - ), + child: StatusChip(label: label, color: color, pulse: pulse), ), ), ); diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index 81346f5f..ef7ae08e 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -196,11 +196,7 @@ class _SettingsScreenState extends State { ), ), if (showChevron) - Icon( - Icons.chevron_right, - color: scheme.onSurfaceVariant, - size: 16, - ), + Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 16), ], ); } @@ -694,11 +690,7 @@ class _SettingsScreenState extends State { ], ), ), - Icon( - Icons.chevron_right, - color: scheme.onSurfaceVariant, - size: 16, - ), + Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 16), ], ), ), diff --git a/lib/screens/tcp_screen.dart b/lib/screens/tcp_screen.dart index cbed0277..85ac929f 100644 --- a/lib/screens/tcp_screen.dart +++ b/lib/screens/tcp_screen.dart @@ -220,9 +220,7 @@ class _TcpScreenState extends State { if (connector.isTcpTransportConnected) { return StatusChip( - label: l10n.scanner_connectedTo( - connector.activeTcpEndpoint ?? 'TCP', - ), + label: l10n.scanner_connectedTo(connector.activeTcpEndpoint ?? 'TCP'), color: MeshPalette.signal, ); } else if (connector.state == MeshCoreConnectionState.connecting && diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index 7087bd2c..fafa68f2 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -604,66 +604,68 @@ class _TelemetryScreenState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ _buildAutoRefreshNumberField( - controller: _autoRefreshIntervalController, - label: l10n.common_interval, - min: _autoRefreshMinIntervalSeconds, - max: _autoRefreshMaxIntervalSeconds, - fallback: _autoRefreshIntervalSeconds, - ), - const SizedBox(height: 12), - _buildAutoRefreshNumberField( - controller: _autoRefreshQuantityController, - label: l10n.telemetry_autoFetchQuantity, - min: _autoRefreshMinQuantity, - max: _autoRefreshMaxQuantity, - fallback: _autoRefreshDefaultQuantity, - ), - if (counterText != null) ...[ - const SizedBox(height: 12), - Text( - counterText, - textAlign: TextAlign.center, - style: TextStyle( - color: _autoRefreshLastAttemptFailed - ? Theme.of(context).colorScheme.error - : null, - fontWeight: FontWeight.w600, - ), + controller: _autoRefreshIntervalController, + label: l10n.common_interval, + min: _autoRefreshMinIntervalSeconds, + max: _autoRefreshMaxIntervalSeconds, + fallback: _autoRefreshIntervalSeconds, ), - ], - const SizedBox(height: 12), - FilledButton( - onPressed: _isLoading && !_isAutoRefreshEnabled - ? null - : _toggleAutoRefresh, - child: _isAutoRefreshEnabled - ? SizedBox( - width: double.infinity, - height: 20, - child: Stack( - alignment: Alignment.center, - children: [ - Center(child: Text(l10n.common_disable)), - Positioned( - right: 0, - child: SizedBox( - width: 18, - height: 18, - child: CircularProgressIndicator( - strokeWidth: 2, - color: Theme.of(context).colorScheme.onPrimary, + const SizedBox(height: 12), + _buildAutoRefreshNumberField( + controller: _autoRefreshQuantityController, + label: l10n.telemetry_autoFetchQuantity, + min: _autoRefreshMinQuantity, + max: _autoRefreshMaxQuantity, + fallback: _autoRefreshDefaultQuantity, + ), + if (counterText != null) ...[ + const SizedBox(height: 12), + Text( + counterText, + textAlign: TextAlign.center, + style: TextStyle( + color: _autoRefreshLastAttemptFailed + ? Theme.of(context).colorScheme.error + : null, + fontWeight: FontWeight.w600, + ), + ), + ], + const SizedBox(height: 12), + FilledButton( + onPressed: _isLoading && !_isAutoRefreshEnabled + ? null + : _toggleAutoRefresh, + child: _isAutoRefreshEnabled + ? SizedBox( + width: double.infinity, + height: 20, + child: Stack( + alignment: Alignment.center, + children: [ + Center(child: Text(l10n.common_disable)), + Positioned( + right: 0, + child: SizedBox( + width: 18, + height: 18, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Theme.of( + context, + ).colorScheme.onPrimary, + ), ), ), - ), - ], - ), - ) - : Text(l10n.common_enable), - ), - ], + ], + ), + ) + : Text(l10n.common_enable), + ), + ], + ), ), - ), - ], + ], ); } @@ -912,10 +914,7 @@ class _TelemetryScreenState extends State { const SizedBox(width: 8), Text( value, - style: MeshTheme.mono( - fontSize: 13, - color: scheme.onSurface, - ), + style: MeshTheme.mono(fontSize: 13, color: scheme.onSurface), textAlign: TextAlign.end, ), ], diff --git a/lib/screens/usb_screen.dart b/lib/screens/usb_screen.dart index 0e40da64..9bd5a5ca 100644 --- a/lib/screens/usb_screen.dart +++ b/lib/screens/usb_screen.dart @@ -108,9 +108,7 @@ class _UsbScreenState extends State { child: AnimatedSwitcher( duration: const Duration(milliseconds: 300), child: Align( - key: ValueKey( - '${connector.state}_$_isLoadingPorts', - ), + key: ValueKey('${connector.state}_$_isLoadingPorts'), alignment: Alignment.centerLeft, child: _buildStatusChip(context, connector), ), @@ -230,17 +228,11 @@ class _UsbScreenState extends State { final l10n = context.l10n; if (_isLoadingPorts) { - return EmptyState( - icon: Icons.usb, - title: l10n.usbStatus_searching, - ); + return EmptyState(icon: Icons.usb, title: l10n.usbStatus_searching); } if (_ports.isEmpty) { - return EmptyState( - icon: Icons.usb, - title: l10n.usbScreenEmptyState, - ); + return EmptyState(icon: Icons.usb, title: l10n.usbScreenEmptyState); } final isConnecting = diff --git a/lib/services/message_retry_service.dart b/lib/services/message_retry_service.dart index 56341598..50ec64d9 100644 --- a/lib/services/message_retry_service.dart +++ b/lib/services/message_retry_service.dart @@ -44,7 +44,8 @@ class RetryServiceConfig { int messageBytes, { String? contactKey, int? deviceTimeoutMs, - })? calculateTimeout; + })? + calculateTimeout; final Uint8List? Function()? getSelfPublicKey; final String Function(Contact, String)? prepareContactOutboundText; final AppSettingsService? appSettingsService; @@ -436,8 +437,7 @@ class MessageRetryService extends ChangeNotifier { final outboundTextForTimeout = config.prepareContactOutboundText?.call(contact, message.text) ?? message.text; - final messageBytesForTimeout = - utf8.encode(outboundTextForTimeout).length; + final messageBytesForTimeout = utf8.encode(outboundTextForTimeout).length; int actualTimeout = timeoutMs; if (config.calculateTimeout != null) { @@ -704,13 +704,11 @@ class MessageRetryService extends ChangeNotifier { tripTimeMs > 0 && message.pathLength != null) { final outboundTextForObserved = - config!.prepareContactOutboundText?.call( - contact, - message.text, - ) ?? + config!.prepareContactOutboundText?.call(contact, message.text) ?? message.text; - final messageBytesForObserved = - utf8.encode(outboundTextForObserved).length; + final messageBytesForObserved = utf8 + .encode(outboundTextForObserved) + .length; config.onDeliveryObserved!( contact.publicKeyHex, message.pathLength!, diff --git a/lib/widgets/device_tile.dart b/lib/widgets/device_tile.dart index ef0f5441..3763b78a 100644 --- a/lib/widgets/device_tile.dart +++ b/lib/widgets/device_tile.dart @@ -30,7 +30,9 @@ class DeviceTile extends StatelessWidget { final name = device.platformName.isNotEmpty ? device.platformName : scanResult.advertisementData.advName; - final displayName = name.isNotEmpty ? name : context.l10n.common_unknownDevice; + final displayName = name.isNotEmpty + ? name + : context.l10n.common_unknownDevice; final mac = device.remoteId.toString(); final scheme = Theme.of(context).colorScheme; @@ -55,11 +57,7 @@ class DeviceTile extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), child: Row( children: [ - AvatarCircle( - name: displayName, - size: 42, - icon: Icons.router, - ), + AvatarCircle(name: displayName, size: 42, icon: Icons.router), const SizedBox(width: 12), Expanded( child: Column( @@ -107,10 +105,7 @@ class DeviceTile extends StatelessWidget { const SizedBox(height: 3), Text( '$rssi dBm', - style: MeshTheme.mono( - fontSize: 10, - color: signalUi.color, - ), + style: MeshTheme.mono(fontSize: 10, color: signalUi.color), ), ], ), diff --git a/lib/widgets/elements_ui.dart b/lib/widgets/elements_ui.dart index 55d930db..a4995c73 100644 --- a/lib/widgets/elements_ui.dart +++ b/lib/widgets/elements_ui.dart @@ -60,10 +60,7 @@ class _FeatureToggleRow extends State { Row( mainAxisSize: MainAxisSize.min, children: [ - Switch( - value: widget.value, - onChanged: widget.onChanged, - ), + Switch(value: widget.value, onChanged: widget.onChanged), if (widget.hasRefreshing) ...[ const SizedBox(width: 4), widget.isRefreshing diff --git a/lib/widgets/jump_to_bottom_button.dart b/lib/widgets/jump_to_bottom_button.dart index 6eab28a9..5ce25542 100644 --- a/lib/widgets/jump_to_bottom_button.dart +++ b/lib/widgets/jump_to_bottom_button.dart @@ -29,10 +29,7 @@ class JumpToBottomButton extends StatelessWidget { decoration: BoxDecoration( shape: BoxShape.circle, color: scheme.surfaceContainerHigh.withValues(alpha: 0.92), - border: Border.all( - color: scheme.outlineVariant, - width: 1, - ), + border: Border.all(color: scheme.outlineVariant, width: 1), boxShadow: [ BoxShadow( color: Colors.black.withValues(alpha: 0.18), diff --git a/lib/widgets/mesh_ui.dart b/lib/widgets/mesh_ui.dart index bfbe679f..797af7a7 100644 --- a/lib/widgets/mesh_ui.dart +++ b/lib/widgets/mesh_ui.dart @@ -350,7 +350,9 @@ class RouteChip extends StatelessWidget { Widget build(BuildContext context) { final scheme = Theme.of(context).colorScheme; final label = isDirect - ? (hops == null || hops == 0 ? 'DIRECT' : '$hops HOP${hops == 1 ? '' : 'S'}') + ? (hops == null || hops == 0 + ? 'DIRECT' + : '$hops HOP${hops == 1 ? '' : 'S'}') : 'FLOOD'; return Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), @@ -536,9 +538,7 @@ Future showMeshSheet( useSafeArea: true, showDragHandle: false, builder: (context) => Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.viewInsetsOf(context).bottom, - ), + padding: EdgeInsets.only(bottom: MediaQuery.viewInsetsOf(context).bottom), child: builder(context), ), ); @@ -574,10 +574,7 @@ class ErrorRetryCard extends StatelessWidget { ), ), if (onRetry != null) - TextButton( - onPressed: onRetry, - child: Text(retryLabel ?? 'Retry'), - ), + TextButton(onPressed: onRetry, child: Text(retryLabel ?? 'Retry')), ], ), ); @@ -610,10 +607,7 @@ class _ListEntranceState extends State vsync: this, duration: const Duration(milliseconds: 280), ); - _curve = CurvedAnimation( - parent: _controller, - curve: Curves.easeOutCubic, - ); + _curve = CurvedAnimation(parent: _controller, curve: Curves.easeOutCubic); final delay = Duration(milliseconds: 24 * widget.index.clamp(0, 12)); Future.delayed(delay, () { if (mounted) _controller.forward(); diff --git a/lib/widgets/message_status_icon.dart b/lib/widgets/message_status_icon.dart index 1d2bbd45..c1971c15 100644 --- a/lib/widgets/message_status_icon.dart +++ b/lib/widgets/message_status_icon.dart @@ -72,11 +72,7 @@ class _MessageStatusIconState extends State if (widget.isFailed) { return Semantics( label: l10n.messageStatus_failed, - child: Icon( - Icons.cancel, - size: size, - color: colorScheme.error, - ), + child: Icon(Icons.cancel, size: size, color: colorScheme.error), ); } diff --git a/lib/widgets/path_map_ui.dart b/lib/widgets/path_map_ui.dart index cfd3672e..333301e0 100644 --- a/lib/widgets/path_map_ui.dart +++ b/lib/widgets/path_map_ui.dart @@ -160,10 +160,7 @@ List buildPacketTrailPolylines( } /// The moving packet dot and the pulse ring at the hop it just reached. -List buildPacketMarkers( - PathPlaybackController playback, - Color color, -) { +List buildPacketMarkers(PathPlaybackController playback, Color color) { if (!playback.started || !playback.hasPath) return const []; final markers = []; @@ -412,7 +409,9 @@ class PathAnimationControls extends StatelessWidget { ), controlButton( icon: playback.playing ? Icons.pause : Icons.play_arrow, - tooltip: playback.playing ? l10n.pathMap_pause : l10n.pathMap_play, + tooltip: playback.playing + ? l10n.pathMap_pause + : l10n.pathMap_play, onPressed: enabled ? playback.togglePlay : null, ), controlButton( @@ -635,7 +634,10 @@ class PathSummaryList extends StatelessWidget { parts.join(' · '), maxLines: 1, overflow: TextOverflow.ellipsis, - style: MeshTheme.mono(fontSize: 10.5, color: MeshPalette.ink3), + style: MeshTheme.mono( + fontSize: 10.5, + color: MeshPalette.ink3, + ), ), ), ), diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 207bbe5d..56834455 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -332,19 +332,12 @@ class _RepeaterLoginDialogState extends State { Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Icon( - Icons.error, - size: 18, - color: scheme.error, - ), + Icon(Icons.error, size: 18, color: scheme.error), const SizedBox(width: 8), Expanded( child: Text( _loginError!, - style: TextStyle( - color: scheme.error, - fontSize: 13, - ), + style: TextStyle(color: scheme.error, fontSize: 13), ), ), ], @@ -435,9 +428,7 @@ class _RepeaterLoginDialogState extends State { Icon( Icons.auto_mode, size: 20, - color: !isFloodMode - ? scheme.primary - : null, + color: !isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( @@ -458,9 +449,7 @@ class _RepeaterLoginDialogState extends State { Icon( Icons.waves, size: 20, - color: isFloodMode - ? scheme.primary - : null, + color: isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index 34a3f994..a5e2555b 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -364,9 +364,7 @@ class _RoomLoginDialogState extends State { Icon( Icons.auto_mode, size: 20, - color: !isFloodMode - ? scheme.primary - : null, + color: !isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( @@ -387,9 +385,7 @@ class _RoomLoginDialogState extends State { Icon( Icons.waves, size: 20, - color: isFloodMode - ? scheme.primary - : null, + color: isFloodMode ? scheme.primary : null, ), const SizedBox(width: 8), Text( diff --git a/lib/widgets/unread_divider.dart b/lib/widgets/unread_divider.dart index d238b1a1..4de05b32 100644 --- a/lib/widgets/unread_divider.dart +++ b/lib/widgets/unread_divider.dart @@ -15,10 +15,7 @@ class UnreadDivider extends StatelessWidget { child: Row( children: [ Expanded( - child: Container( - height: 1, - color: color.withValues(alpha: 0.25), - ), + child: Container(height: 1, color: color.withValues(alpha: 0.25)), ), const SizedBox(width: 10), Container( @@ -39,10 +36,7 @@ class UnreadDivider extends StatelessWidget { ), const SizedBox(width: 10), Expanded( - child: Container( - height: 1, - color: color.withValues(alpha: 0.25), - ), + child: Container(height: 1, color: color.withValues(alpha: 0.25)), ), ], ),