diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..a54dadad --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +github: [zjs81] +custom: + - "https://paypal.me/zjs82" diff --git a/README.md b/README.md index acf1215a..8c2096c5 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ MeshCore Open is a cross-platform mobile application for communicating with Mesh - **Live Map View**: Real-time visualization of mesh network nodes on an interactive map - **Node Filtering**: Filter by node type (chat, repeater, sensor) and time range - **Location Sharing**: Share GPS coordinates and custom markers with contacts -- **Offline Maps**: Download map tiles for offline use in remote areas +- **Offline Maps**: Download map tiles for offline use in remote areas (with [StadiaMaps](https://stadiamaps.com/pricing/) Free Subscription API-Key) - **MGRS Coordinates**: Support for Military Grid Reference System coordinate format ### Device Management @@ -224,6 +224,10 @@ Messages are transmitted as binary frames using a custom protocol optimized for This is an open-source project. Contributions are welcome! +## SWHID and Archive badge +[![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/zjs81/meshcore-open/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/zjs81/meshcore-open) +[![SWH](https://archive.softwareheritage.org/badge/swh:1:dir:d37a80b06359730864150ad2aeadd46cce9abd55/)](https://archive.softwareheritage.org/swh:1:dir:d37a80b06359730864150ad2aeadd46cce9abd55;origin=https://github.com/zjs81/meshcore-open;visit=swh:1:snp:47656c4b55ab40a689ff8d2f045196725f05096b;anchor=swh:1:rev:0fe250230905fdd05dbedc0f546736990beacf53) + ### Development Guidelines - Follow the Flutter style guide diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 4ff626f2..5a533139 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -22,7 +22,7 @@ + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index f9ecda0f..dd58900e 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 08a0eeda..1c752ac2 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml new file mode 100644 index 00000000..1f4b7d7b --- /dev/null +++ b/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #9F9D95 + \ No newline at end of file diff --git a/assets/fonts/Inter-OFL.txt b/assets/fonts/Inter-OFL.txt new file mode 100644 index 00000000..21f6aff9 --- /dev/null +++ b/assets/fonts/Inter-OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/fonts/Inter.ttf b/assets/fonts/Inter.ttf new file mode 100644 index 00000000..047c92f6 Binary files /dev/null and b/assets/fonts/Inter.ttf differ diff --git a/assets/fonts/InterItalic.ttf b/assets/fonts/InterItalic.ttf new file mode 100644 index 00000000..c1775784 Binary files /dev/null and b/assets/fonts/InterItalic.ttf differ diff --git a/assets/fonts/JetBrainsMono-OFL.txt b/assets/fonts/JetBrainsMono-OFL.txt new file mode 100644 index 00000000..821a3dac --- /dev/null +++ b/assets/fonts/JetBrainsMono-OFL.txt @@ -0,0 +1,93 @@ +Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/fonts/JetBrainsMono.ttf b/assets/fonts/JetBrainsMono.ttf new file mode 100644 index 00000000..aa310be8 Binary files /dev/null and b/assets/fonts/JetBrainsMono.ttf differ diff --git a/assets/icons/ic_foreground.png b/assets/icons/ic_foreground.png new file mode 100644 index 00000000..3e3e115b Binary files /dev/null and b/assets/icons/ic_foreground.png differ diff --git a/documentation/README.md b/documentation/README.md index 13670134..a3700fc6 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -14,7 +14,8 @@ MeshCore Open is an open-source Flutter client for MeshCore LoRa mesh networking 8. [Notifications](notifications.md) - System notifications, unread badges, and notification preferences 9. [Repeater Management](repeater-management.md) - Repeater hub, status, CLI, telemetry, and neighbors 10. [Additional Features](additional-features.md) - GIF picker, localization, debug logs, SMAZ compression, and more -11. [BLE Protocol & Data Layer](ble-protocol.md) - Technical reference for the communication protocol and data architecture +11. [Routing Paths](routing-paths.md) - Path encoding, validation, device capability detection, and storage +12. [BLE Protocol & Data Layer](ble-protocol.md) - Technical reference for the communication protocol and data architecture ## App Overview diff --git a/documentation/additional-features.md b/documentation/additional-features.md index 997c2c11..6aeb37ed 100644 --- a/documentation/additional-features.md +++ b/documentation/additional-features.md @@ -183,7 +183,7 @@ An ML-based service that predicts expected delivery timeouts: - Applies a **1.5x safety margin** to raw predictions (the actual timeout issued is 1.5× the model's predicted delivery time) - Features with zero variance are automatically excluded from training - Blends per-contact statistics with ML predictions -- Falls back to `3000 + 3000 × pathLength` ms when insufficient data +- Falls back to `3000 + 3000 × pathLength` ms when insufficient data. Note: `pathLength` here refers to the stored hop count in the app's model/storage (number of hops), not the on-air encoded byte length. - Observations are persisted to storage via a 2-second debounced timer (observations within 2s of app termination may be lost) --- diff --git a/documentation/ble-protocol.md b/documentation/ble-protocol.md index 9e72b459..e5ca6972 100644 --- a/documentation/ble-protocol.md +++ b/documentation/ble-protocol.md @@ -120,6 +120,8 @@ On unexpected disconnection, auto-reconnect with exponential backoff: | 40 | CMD_GET_CUSTOM_VAR | Get custom variables | | 41 | CMD_SET_CUSTOM_VAR | Set a custom variable | | 50 | CMD_SEND_BINARY_REQ | Send binary request | +| 54 | CMD_SET_FLOOD_SCOPE | Set flood routing scope (v8+) | +| 55 | CMD_SEND_CONTROL_DATA | Send control data (e.g. zero-hop discovery, v8+) | | 56 | CMD_GET_STATS | Request companion radio stats | | 57 | CMD_SEND_ANON_REQ | Send anonymous request | | 58 | CMD_SET_AUTO_ADD_CONFIG | Set auto-add configuration | @@ -162,6 +164,7 @@ On unexpected disconnection, auto-reconnect with exponential backoff: | 0x8A | PUSH_CODE_NEW_ADVERT | New node discovered | | 0x8B | PUSH_CODE_TELEMETRY_RESPONSE | Sensor telemetry data | | 0x8C | PUSH_CODE_BINARY_RESPONSE | Binary data response | +| 0x8E | PUSH_CODE_CONTROL_DATA | Control data push (e.g. zero-hop discovery response) | ## Data Models diff --git a/documentation/routing-paths.md b/documentation/routing-paths.md new file mode 100644 index 00000000..56b4867f --- /dev/null +++ b/documentation/routing-paths.md @@ -0,0 +1,79 @@ +# Routing Paths + +This page covers how MeshCore Open represents, selects, validates, and stores routing paths in the UI and data layer. + +## Path Routing + +MeshCore supports variable-length multi-byte routing paths so the app can scale from small meshes to very large node sets. + +### Hash Width and Multi-Byte Paths + +The device capability determines the hash width (number of bytes per hop): + +| Width | Max Unique Nodes | Typical Use | +|-------|-----------------|-------------| +| 1 byte | 256 | Single-byte node IDs | +| 2 bytes | 65,536 | Medium meshes | +| 3 bytes | 16.7M | Large networks | +| 4 bytes | 4.3G | Very large meshes / future-proofing | + +### Device Capability Detection + +On device connection, the app reads the firmware capability to set `pathHashByteWidth`: + +```dart +// Read from device info response (offset 81) +final modeRaw = firmwareBytes.length >= 82 + ? (firmwareBytes[81] & 0xFF) + : 0; +final mode = modeRaw.clamp(0, 3); +_pathHashByteWidth = mode + 1; // 1, 2, 3, or 4 bytes per hop +``` + +The connector reads a single-mode byte and clamps to `0..3`, so the supported hop width is `1..4` bytes. UI code also clamps widths when rendering (typically to `1..4`) so 4-byte hops are handled end-to-end in the current codebase. + +### Path Data Structure + +Paths in messages and storage consist of: + + - **`pathLength` (model/storage)**: Hop count (number of hops). Negative values (e.g. `-1`) are used as a flood sentinel. + - **On-air `path_len` byte**: A packed byte that encodes hop count + hash width and is decoded into `pathLength` + `pathBytes` when parsing frames. + - **`pathBytes`**: Raw bytes of the path (concatenated hop prefixes), grouped by `pathHashByteWidth`. + - **`hopCount`**: Derived display value computed from bytes and width: `(byteCount + hashByteWidth - 1) ~/ hashByteWidth`. + - **Example**: With `pathHashByteWidth=2`, a 3-hop path has 6 bytes (`pathBytes.length = 6`) and `pathLength = 3`: + - `pathBytes = [0xA1, 0xA2, 0xB1, 0xB2, 0xC1, 0xC2]` + - Hops: `[0xA1A2]`, `[0xB1B2]`, `[0xC1C2]` + +### Hop Count Calculation + +Convert path byte length to hop count: + +```dart +int hopCount = (byteCount + hashByteWidth - 1) ~/ hashByteWidth; +``` + +Use this consistently when displaying hop counts in UI. Do not treat `pathLength` as a hop count when the path uses multi-byte hop hashes. + +### Path Usage in Different Message Types + +- **Direct messages**: Extract path from decrypted payload to trace sender route. +- **Channel messages**: Decrypt hop-by-hop routing chain from payload; the header carries the encoded byte length for the path blob, not the derived hop count. +- **Contact storage**: Path length in byte 32, raw path bytes in bytes 33-96, grouped by detected `pathHashByteWidth`. + +### UI Hop Count Display + +⚠️ **Important**: In screens like "Channel Message Path", prefer the actual decoded `pathBytes` hop count over `pathLength` metadata: + +```dart +// Preferred: use actual observed path length +final effectiveHopCount = (pathBytes.length + width - 1) ~/ width; + +// Avoid: using encoded byte length as if it were a hop count +// pathLength is bytes; converting it twice causes inflated counts +``` + +Example scenario: +- Radio header reports `pathLength: 32` bytes +- Decoded path bytes: `[0xAB, 0xCD]` (2 bytes = 1 hop with width=2) +- **Display**: "1 hop" (from `pathBytes`), not "32 hops" (which would double-count the encoded length) + diff --git a/documentation/settings.md b/documentation/settings.md index a2f4192a..8567cf4c 100644 --- a/documentation/settings.md +++ b/documentation/settings.md @@ -52,7 +52,7 @@ These settings are sent directly to the connected device firmware. ### Radio Settings Opens a dialog pre-populated with the device's current radio settings. Contains: -- **Preset dropdown**: Regional presets — selecting a preset immediately fills all fields below. Includes presets for Australia, Australia (Narrow), Australia SA WA QLD, Czech Republic, EU 433MHz, EU/UK (Long Range), EU/UK (Medium Range), EU/UK (Narrow), New Zealand, New Zealand (Narrow), Portugal 433, Portugal 869, numerous Russia city presets, Switzerland, USA Arizona, USA/Canada, and Vietnam +- **Preset dropdown**: Regional presets — selecting a preset immediately fills all fields below. Includes presets for Australia, Australia (Narrow), Australia (Mid), Australia SA WA QLD, Czech Republic, EU 433MHz, EU/UK (Long Range), EU/UK (Medium Range), EU/UK (Narrow), New Zealand, New Zealand (Narrow), Portugal 433, Portugal 869, numerous Russia city presets, Switzerland, USA Arizona, USA/Canada, and Vietnam - **Frequency** (MHz): Free text, validated 300–2500 MHz - **Bandwidth**: Dropdown (7.8 / 10.4 / 15.6 / 20.8 / 31.25 / 41.7 / 62.5 / 125 / 250 / 500 kHz) - **Spreading Factor**: SF5–SF12 @@ -129,6 +129,10 @@ A dedicated sub-screen for app-level preferences (nothing here is sent to the de - **Show Other Nodes**: Toggle room/sensor markers - **Time Filter**: All time / Last 1h / Last 6h / Last 24h / Last week - **Units**: Metric / Imperial +- **Raster Tile Source**: Sets the MAP theme and with that from where to get the map tile data: + - OpenStreetMap (Auto/Standard/Dark) is provided by the free OpenStreetMap tile server. (Can only be used for live view or already cached.) + - Stamen Terrain / AlidadeSmooth Dark / Outdoors / OSM Bright are [StadiaMaps.com raster tile maps](https://stadiamaps.com/products/maps/interactive-basemaps/) for which you can choose an Hosted Endpoint (Worldwide / Europe hosted) and have to provide the API key to your subscription. (You can cache these maps for offline Map usage.) + There will be no account provided by meshcore-open. You will have to get you own subscription. StadiaMaps offers a [free](https://stadiamaps.com/pricing/) subscription to download up to 200'000 Standart Raster Basemap tiles. - **Offline Map Cache**: Navigate to tile download screen ### Translation diff --git a/ios/ExportOptions.plist b/ios/ExportOptions.plist new file mode 100644 index 00000000..aadd0dac --- /dev/null +++ b/ios/ExportOptions.plist @@ -0,0 +1,16 @@ + + + + + method + app-store-connect + teamID + X74VJ4UAST + signingStyle + automatic + uploadSymbols + + destination + export + + diff --git a/ios/Podfile.lock b/ios/Podfile.lock index b0e98ca4..bc43ea0c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,73 +1,21 @@ PODS: - Flutter (1.0.0) - - flutter_blue_plus_darwin (0.0.2): - - Flutter - - FlutterMacOS - flutter_foreground_task (0.0.1): - Flutter - - flutter_local_notifications (0.0.1): - - Flutter - - mobile_scanner (7.0.0): - - Flutter - - FlutterMacOS - - package_info_plus (0.4.5): - - Flutter - - share_plus (0.0.1): - - Flutter - - shared_preferences_foundation (0.0.1): - - Flutter - - FlutterMacOS - - sqflite_darwin (0.0.4): - - Flutter - - FlutterMacOS - - url_launcher_ios (0.0.1): - - Flutter DEPENDENCIES: - Flutter (from `Flutter`) - - flutter_blue_plus_darwin (from `.symlinks/plugins/flutter_blue_plus_darwin/darwin`) - flutter_foreground_task (from `.symlinks/plugins/flutter_foreground_task/ios`) - - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`) - - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - - share_plus (from `.symlinks/plugins/share_plus/ios`) - - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) - - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) EXTERNAL SOURCES: Flutter: :path: Flutter - flutter_blue_plus_darwin: - :path: ".symlinks/plugins/flutter_blue_plus_darwin/darwin" flutter_foreground_task: :path: ".symlinks/plugins/flutter_foreground_task/ios" - flutter_local_notifications: - :path: ".symlinks/plugins/flutter_local_notifications/ios" - mobile_scanner: - :path: ".symlinks/plugins/mobile_scanner/darwin" - package_info_plus: - :path: ".symlinks/plugins/package_info_plus/ios" - share_plus: - :path: ".symlinks/plugins/share_plus/ios" - shared_preferences_foundation: - :path: ".symlinks/plugins/shared_preferences_foundation/darwin" - sqflite_darwin: - :path: ".symlinks/plugins/sqflite_darwin/darwin" - url_launcher_ios: - :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 - flutter_blue_plus_darwin: 20a08bfeaa0f7804d524858d3d8744bcc1b6dbc3 flutter_foreground_task: a159d2c2173b33699ddb3e6c2a067045d7cebb89 - flutter_local_notifications: a5a732f069baa862e728d839dd2ebb904737effb - mobile_scanner: 9157936403f5a0644ca3779a38ff8404c5434a93 - package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 - share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a - shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb - sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 - url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b PODFILE CHECKSUM: e42b502c78c33aa1ed9d42eaea8960ce2139504b diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 7bf9b4cd..52009fe5 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -52,6 +53,7 @@ 718BC7DCCFC5C370705C12E5 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -67,6 +69,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, 9A698254711B63C3940A64CB /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -85,6 +88,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, @@ -180,13 +184,15 @@ 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, F0D7F2413C6E4B7A9B1C2D3E /* Fix Native Asset Minimum OS */, - B788CEDB957A87EE8AC593BB /* [CP] Copy Pods Resources */, ); buildRules = ( ); dependencies = ( ); name = Runner; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; @@ -220,6 +226,9 @@ Base, ); mainGroup = 97C146E51CF9000F007C117D; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, + ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectRoot = ""; @@ -283,39 +292,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - B788CEDB957A87EE8AC593BB /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - F0D7F2413C6E4B7A9B1C2D3E /* Fix Native Asset Minimum OS */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}", - ); - name = "Fix Native Asset Minimum OS"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "set -e\nFRAMEWORKS_DIR=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nMIN_OS=\"${IPHONEOS_DEPLOYMENT_TARGET}\"\nif [ ! -d \"$FRAMEWORKS_DIR\" ] || [ -z \"$MIN_OS\" ]; then\n exit 0\nfi\nfind \"$FRAMEWORKS_DIR\" -maxdepth 2 -name Info.plist | while read -r plist; do\n bundle_id=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' \"$plist\" 2>/dev/null || true)\n case \"$bundle_id\" in\n io.flutter.flutter.native-assets.*)\n /usr/libexec/PlistBuddy -c \"Set :MinimumOSVersion $MIN_OS\" \"$plist\" 2>/dev/null || \\\n /usr/libexec/PlistBuddy -c \"Add :MinimumOSVersion string $MIN_OS\" \"$plist\"\n ;;\n esac\ndone\n"; - }; DE3B2E091393835C0B38492E /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -338,6 +314,22 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; + F0D7F2413C6E4B7A9B1C2D3E /* Fix Native Asset Minimum OS */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}", + ); + name = "Fix Native Asset Minimum OS"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "set -e\nFRAMEWORKS_DIR=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nMIN_OS=\"${IPHONEOS_DEPLOYMENT_TARGET}\"\nif [ ! -d \"$FRAMEWORKS_DIR\" ] || [ -z \"$MIN_OS\" ]; then\n exit 0\nfi\nfind \"$FRAMEWORKS_DIR\" -maxdepth 2 -name Info.plist | while read -r plist; do\n bundle_id=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIdentifier' \"$plist\" 2>/dev/null || true)\n case \"$bundle_id\" in\n io.flutter.flutter.native-assets.*)\n /usr/libexec/PlistBuddy -c \"Set :MinimumOSVersion $MIN_OS\" \"$plist\" 2>/dev/null || \\\n /usr/libexec/PlistBuddy -c \"Add :MinimumOSVersion string $MIN_OS\" \"$plist\"\n ;;\n esac\ndone\n"; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -446,7 +438,9 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = X74VJ4UAST; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -625,7 +619,9 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = X74VJ4UAST; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -647,7 +643,9 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + DEVELOPMENT_TEAM = X74VJ4UAST; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -696,6 +694,20 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; } diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e3773d42..c3fedb29 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -5,6 +5,24 @@ + + + + + + + + + + pubkeyPrefix; + int pathHashWidth; + String? contactKeyHex; double snr; DateTime lastUpdated; DirectRepeater({ - required this.pubkeyFirstByte, + required List pubkeyPrefix, + required this.pathHashWidth, + this.contactKeyHex, required this.snr, DateTime? lastUpdated, - }) : lastUpdated = lastUpdated ?? DateTime.now(); + }) : pubkeyPrefix = List.unmodifiable(pubkeyPrefix), + lastUpdated = lastUpdated ?? DateTime.now(); - void update(double newSNR) { + String get pubkeyPrefixHex => pubkeyPrefix + .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) + .join(); + + bool matchesPrefix(List prefix) { + return pubkeyPrefix.length == prefix.length && + listEquals(pubkeyPrefix, prefix); + } + + bool matchesPathStart(List pathBytes, int pathHashByteWidth) { + final width = pathHashByteWidth.clamp(1, 4).toInt(); + if (pathBytes.length < width || pubkeyPrefix.length != width) { + return false; + } + return listEquals(pubkeyPrefix, pathBytes.sublist(0, width)); + } + + void update( + double newSNR, { + List? pubkeyPrefix, + int? pathHashWidth, + String? contactKeyHex, + }) { snr = newSNR; + if (pubkeyPrefix != null && + pubkeyPrefix.length >= this.pubkeyPrefix.length) { + this.pubkeyPrefix = List.unmodifiable(pubkeyPrefix); + } + if (pathHashWidth != null && pathHashWidth >= this.pathHashWidth) { + this.pathHashWidth = pathHashWidth; + } + this.contactKeyHex ??= contactKeyHex; lastUpdated = DateTime.now(); } @@ -125,6 +162,12 @@ class MeshCoreConnector extends ChangeNotifier { // Message windowing to limit memory usage static const int _messageWindowSize = 200; + // Cap on discovered (non-contact) nodes retained in memory. Adverts arrive + // continuously from the whole mesh, so without a bound this list grows for + // as long as the app stays connected. When full, the stalest node (oldest + // lastSeen) is evicted to make room for a newly heard one. + static const int _maxDiscoveredContacts = 500; + MeshCoreConnectionState _state = MeshCoreConnectionState.disconnected; BluetoothDevice? _device; BluetoothCharacteristic? _rxCharacteristic; @@ -214,6 +257,9 @@ class MeshCoreConnector extends ChangeNotifier { DateTime _lastRadioRxTime = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastContactMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0); DateTime _lastChannelMsgRxTime = DateTime.fromMillisecondsSinceEpoch(0); + DateTime _lastZeroHopAdvertAt = DateTime.fromMillisecondsSinceEpoch(0); + double? _lastZeroHopAdvertLatitude; + double? _lastZeroHopAdvertLongitude; static const int _radioQuietMs = 3000; static const int _radioQuietMaxWaitMs = 3000; @@ -266,6 +312,10 @@ class MeshCoreConnector extends ChangeNotifier { // Serializes path operations (setContactPath/clearContactPath) to prevent // interleaved async calls from leaving in-memory state inconsistent with device. Future _pathOpLock = Future.value(); + // Flood scope is a global firmware setting, so scoped channel sends must not + // overlap or a message may inherit another channel's region. + Future _channelScopedSendLock = Future.value(); + static const Duration _commandAckTimeout = Duration(seconds: 5); Map? _currentCustomVars; /// Maps repeater pubkey-prefix hex (12 hex chars = first 6 bytes) → the @@ -297,6 +347,7 @@ class MeshCoreConnector extends ChangeNotifier { final MessageStore _messageStore = MessageStore(); final ChannelOrderStore _channelOrderStore = ChannelOrderStore(); final ChannelSettingsStore _channelSettingsStore = ChannelSettingsStore(); + final ChannelRegionStore _channelRegionStore = ChannelRegionStore(); final ContactSettingsStore _contactSettingsStore = ContactSettingsStore(); final ContactStore _contactStore = ContactStore(); final ContactDiscoveryStore _discoveryContactStore = ContactDiscoveryStore(); @@ -306,6 +357,7 @@ class MeshCoreConnector extends ChangeNotifier { final Map _channelSmazEnabled = {}; final Map _channelCyr2LatEnabled = {}; final Map _channelCyr2LatProfileId = {}; + final Map _channelRegions = {}; bool _lastSentWasCliCommand = false; // Track if last sent message was a CLI command final Map _contactSmazEnabled = {}; @@ -724,6 +776,14 @@ class MeshCoreConnector extends ChangeNotifier { return _contactSmazEnabled[contactKeyHex] ?? false; } + bool hasChannelRegion(int channelIndex) { + return (_channelRegions[channelIndex] ?? '').isNotEmpty; + } + + Region getChannelRegion(int channelIndex) { + return _channelRegions[channelIndex] ?? ''; + } + void ensureContactSmazSettingLoaded(String contactKeyHex) { _ensureContactSmazSettingLoaded(contactKeyHex); } @@ -877,6 +937,14 @@ class MeshCoreConnector extends ChangeNotifier { notifyListeners(); } + Future setChannelRegion(int channelIndex, String region) async { + // Update in-memory state and notify synchronously so the UI reflects the + // change immediately; persistence happens in the background. + _channelRegions[channelIndex] = region; + notifyListeners(); + await _channelRegionStore.saveRegion(channelIndex, region); + } + Future _loadChannelOrder() async { _channelOrder = await _channelOrderStore.loadChannelOrder(); _applyChannelOrder(); @@ -1027,6 +1095,13 @@ class MeshCoreConnector extends ChangeNotifier { Future _loadDiscoveredContactCache() async { final cached = await _discoveryContactStore.loadContacts(); + // Trim a previously-saved oversized list down to the freshest entries so a + // device that grew unbounded before the cap existed recovers on load. + if (cached.length > _maxDiscoveredContacts) { + cached.sort((a, b) => b.lastSeen.compareTo(a.lastSeen)); + cached.removeRange(_maxDiscoveredContacts, cached.length); + unawaited(_discoveryContactStore.saveContacts(cached)); + } _discoveredContacts ..clear() ..addAll(cached); @@ -1035,11 +1110,13 @@ class MeshCoreConnector extends ChangeNotifier { Future loadChannelSettings({int? maxChannels}) async { _channelSmazEnabled.clear(); _channelCyr2LatEnabled.clear(); + _channelRegions.clear(); final channelCount = maxChannels ?? _maxChannels; for (int i = 0; i < channelCount; i++) { _channelSmazEnabled[i] = await _channelSettingsStore.loadSmazEnabled(i); _channelCyr2LatEnabled[i] = await _channelSettingsStore .loadCyr2LatEnabled(i); + _channelRegions[i] = await _channelRegionStore.loadRegion(i); } } @@ -2517,6 +2594,8 @@ class MeshCoreConnector extends ChangeNotifier { _selfName = null; _selfLatitude = null; _selfLongitude = null; + _lastZeroHopAdvertLatitude = null; + _lastZeroHopAdvertLongitude = null; _awaitingSelfInfo = false; _webInitialHandshakeRequestSent = false; _selfInfoRetryTimer?.cancel(); @@ -2683,6 +2762,8 @@ class MeshCoreConnector extends ChangeNotifier { _selfName = null; _selfLatitude = null; _selfLongitude = null; + _lastZeroHopAdvertLatitude = null; + _lastZeroHopAdvertLongitude = null; _clientRepeat = null; _rememberedNonRepeatRadioState = null; _firmwareVerCode = null; @@ -2863,7 +2944,32 @@ class MeshCoreConnector extends ChangeNotifier { Future setPathHashMode(int mode) async { if (!isConnected) return; - await sendFrame(buildSetPathHashModeFrame(mode.clamp(0, 2))); + final clampedMode = mode.clamp(0, 3).toInt(); + await sendFrame(buildSetPathHashModeFrame(clampedMode)); + final nextWidth = clampedMode + 1; + if (_pathHashByteWidth != nextWidth) { + _pathHashByteWidth = nextWidth; + _directRepeaters.clear(); + notifyListeners(); + } + } + + bool _isPathLenValidForCurrentMode(int pathLen, List pathBytes) { + return _isPathLenValidForMode(pathLen, pathBytes, _pathHashByteWidth); + } + + int? _encodePathLenForCurrentMode(int pathLen, List pathBytes) { + if (pathLen < 0 || pathLen == 0xFF) return pathLen; + if (!_isPathLenValidForCurrentMode(pathLen, pathBytes)) { + appLogger.warn( + 'Invalid path_len for mode: pathLen=$pathLen, ' + 'bytesLen=${pathBytes.length}, width=$_pathHashByteWidth', + tag: 'Connector', + ); + return null; + } + final mode = (_pathHashByteWidth - 1) & 0x03; + return (pathLen & 0x3F) | (mode << 6); } Future refreshDeviceInfo() async { @@ -3080,11 +3186,15 @@ class MeshCoreConnector extends ChangeNotifier { try { if (!isConnected) return; + final encodedPathLen = _encodePathLenForCurrentMode(pathLen, customPath); + if (encodedPathLen == null) { + return; + } await sendFrame( buildUpdateContactPathFrame( contact.publicKey, customPath, - pathLen, + encodedPathLen, type: contact.type, flags: contact.flags, name: contact.name, @@ -3100,7 +3210,7 @@ class MeshCoreConnector extends ChangeNotifier { ); if (idx != -1) { _contacts[idx] = _contacts[idx].copyWith( - pathLength: customPath.length, + pathLength: pathLen, path: customPath, ); notifyListeners(); @@ -3141,11 +3251,16 @@ class MeshCoreConnector extends ChangeNotifier { : (updatedFlags & ~contactFlagTeleEnv)) : updatedFlags; + final encodedPathLen = _encodePathLenForCurrentMode( + latestContact.pathLength, + latestContact.path, + ); + if (encodedPathLen == null) return; await sendFrame( buildUpdateContactPathFrame( latestContact.publicKey, latestContact.path, - latestContact.pathLength, + encodedPathLen, type: latestContact.type, flags: updatedFlags, name: latestContact.name, @@ -3228,6 +3343,18 @@ class MeshCoreConnector extends ChangeNotifier { tag: 'Connector', ); + if (pathLen != null && + pathLen >= 0 && + !_isPathLenValidForCurrentMode(pathLen, pathBytes ?? Uint8List(0))) { + appLogger.warn( + 'setPathOverride: invalid path for ${contact.name}: ' + 'pathLen=$pathLen, bytesLen=${pathBytes?.length ?? 0}, ' + 'width=$_pathHashByteWidth', + tag: 'Connector', + ); + return; + } + // Update contact with new path override _contacts[index] = _contacts[index].copyWith( pathOverride: pathLen, @@ -3403,12 +3530,15 @@ class MeshCoreConnector extends ChangeNotifier { // Send the reaction to the device (don't add as a visible message) final reactionQueueId = _nextReactionSendQueueId(); _pendingChannelSentQueue.add(reactionQueueId); - await _waitForRadioQuiet(lastInboundRxTime: _lastChannelMsgRxTime); - await sendFrame( - buildSendChannelTextMsgFrame(channel.index, text), - channelSendQueueId: reactionQueueId, - expectsGenericAck: true, - ); + await _runScopedChannelSend(() async { + await _waitForRadioQuiet(lastInboundRxTime: _lastChannelMsgRxTime); + await _sendFrameAndWaitForCommandAck( + buildSendChannelTextMsgFrame(channel.index, text), + channelSendQueueId: reactionQueueId, + expectsGenericAck: true, + successCode: respCodeSent, + ); + }, region: getChannelRegion(channel.index)); return; } @@ -3425,12 +3555,97 @@ class MeshCoreConnector extends ChangeNotifier { notifyListeners(); final outboundText = prepareChannelOutboundText(channel.index, text); - await _waitForRadioQuiet(lastInboundRxTime: _lastChannelMsgRxTime); - await sendFrame( - buildSendChannelTextMsgFrame(channel.index, outboundText), - channelSendQueueId: message.messageId, - expectsGenericAck: true, - ); + await _runScopedChannelSend(() async { + await _waitForRadioQuiet(lastInboundRxTime: _lastChannelMsgRxTime); + await _sendFrameAndWaitForCommandAck( + buildSendChannelTextMsgFrame(channel.index, outboundText), + channelSendQueueId: message.messageId, + expectsGenericAck: true, + successCode: respCodeSent, + ); + }, region: getChannelRegion(channel.index)); + } + + Future _runScopedChannelSend( + Future Function() action, { + required String region, + }) async { + final prev = _channelScopedSendLock; + final completer = Completer(); + _channelScopedSendLock = completer.future; + await prev; + + try { + // Only touch the global flood scope for region-scoped channels. Plain + // channels send exactly as before, which also stays compatible with + // firmware that predates CMD_SET_FLOOD_SCOPE. The lock is still held so an + // unscoped send can't interleave with (and inherit the scope of) a + // concurrent scoped send. + if (region.isEmpty) { + await action(); + return; + } + await _sendFrameAndWaitForCommandAck(buildSetFloodScopeFrame(region)); + try { + await action(); + } finally { + if (isConnected) { + await _sendFrameAndWaitForCommandAck(buildSetFloodScopeFrame('')); + } + } + } finally { + completer.complete(); + } + } + + // Sends [data] and resolves once the device replies. [successCode] is the + // response code that signals success for this frame: SET_FLOOD_SCOPE replies + // with RESP_CODE_OK, whereas a channel text send replies with RESP_CODE_SENT. + // Waiting for the text send's RESP_CODE_SENT before the scope is reset + // guarantees the firmware has already built the packet with the active scope. + Future _sendFrameAndWaitForCommandAck( + Uint8List data, { + String? channelSendQueueId, + bool expectsGenericAck = false, + int successCode = respCodeOk, + }) async { + final completer = Completer(); + late final StreamSubscription subscription; + late final Timer timeout; + + void complete() { + if (!completer.isCompleted) completer.complete(); + } + + void completeError(Object error) { + if (!completer.isCompleted) completer.completeError(error); + } + + subscription = receivedFrames.listen((frame) { + if (frame.isEmpty) return; + if (frame[0] == successCode) { + complete(); + } else if (frame[0] == respCodeErr) { + final errCode = frame.length > 1 ? frame[1] : -1; + completeError(Exception('Command failed with error code $errCode')); + } + }); + + timeout = Timer(_commandAckTimeout, () { + completeError(TimeoutException('Command ACK timed out')); + }); + + try { + await sendFrame( + data, + channelSendQueueId: channelSendQueueId, + expectsGenericAck: expectsGenericAck, + ); + await completer.future; + } finally { + timeout.cancel(); + await subscription.cancel(); + } } Future removeContact(Contact contact) async { @@ -3487,11 +3702,16 @@ class MeshCoreConnector extends ChangeNotifier { // Manual saves must bypass the firmware's auto-add discovery policy. // CMD_IMPORT_CONTACT replays an advert and may remain discovery-only. + final encodedPathLen = _encodePathLenForCurrentMode( + contact.pathLength, + contact.path, + ); + if (encodedPathLen == null) return false; await sendFrame( buildUpdateContactPathFrame( contact.publicKey, contact.path, - contact.pathLength, + encodedPathLen, type: contact.type, flags: contact.flags, name: contact.name, @@ -3703,6 +3923,11 @@ class MeshCoreConnector extends ChangeNotifier { Future sendSelfAdvert({bool flood = true}) async { if (!isConnected) return; await sendFrame(buildSendSelfAdvertFrame(flood: flood)); + if (!flood) { + _lastZeroHopAdvertAt = DateTime.now(); + _lastZeroHopAdvertLatitude = _selfLatitude; + _lastZeroHopAdvertLongitude = _selfLongitude; + } } Future rebootDevice() async { @@ -4037,6 +4262,9 @@ class MeshCoreConnector extends ChangeNotifier { case pushCodePathUpdated: _handlePathUpdated(frame); break; + case pushCodeControlData: + // Optional feature-specific services listen to receivedFrames directly. + break; case pushCodeLoginSuccess: _handleLoginSuccess(frame); break; @@ -4163,6 +4391,42 @@ class MeshCoreConnector extends ChangeNotifier { tag: 'Connector', ); } + + const locationChangeEpsilon = 2.25e-4; // ~25 meters in degrees. + final lastAdvertLatitude = _lastZeroHopAdvertLatitude; + final lastAdvertLongitude = _lastZeroHopAdvertLongitude; + final currentLatitude = _selfLatitude; + final currentLongitude = _selfLongitude; + final latChanged = + lastAdvertLatitude != null && + currentLatitude != null && + (currentLatitude - lastAdvertLatitude).abs() >= locationChangeEpsilon; + final lonChanged = + lastAdvertLongitude != null && + currentLongitude != null && + (currentLongitude - lastAdvertLongitude).abs() >= locationChangeEpsilon; + final gpsSampleChanged = + hasValidLocation(currentLatitude, currentLongitude) && + (!hasValidLocation(lastAdvertLatitude, lastAdvertLongitude) || + latChanged || + lonChanged); + final effectiveGpsIntervalSeconds = + _appSettingsService?.resolvedGpsIntervalSeconds(_currentCustomVars) ?? + 0; + final timeSinceLastZeroHopAdvert = DateTime.now().difference( + _lastZeroHopAdvertAt, + ); + final shouldAutoSendZeroHopAdvert = + (gpsSampleChanged || (_clientRepeat ?? false)) && + _advertLocPolicy == 1 && + (_appSettingsService?.settings.autoSendZeroHopAdvertOnGpsUpdate ?? + false) && + effectiveGpsIntervalSeconds > 0 && + timeSinceLastZeroHopAdvert.inSeconds >= effectiveGpsIntervalSeconds; + if (shouldAutoSendZeroHopAdvert) { + unawaited(sendSelfAdvert(flood: false)); + } + final selfName = _selfName?.trim(); if (_activeTransport == MeshCoreTransportType.usb && selfName != null && @@ -4183,6 +4447,7 @@ class MeshCoreConnector extends ChangeNotifier { _messageStore.setPublicKeyHex = selfPublicKeyHex; _channelOrderStore.setPublicKeyHex = selfPublicKeyHex; _channelSettingsStore.setPublicKeyHex = selfPublicKeyHex; + _channelRegionStore.setPublicKeyHex = selfPublicKeyHex; _contactSettingsStore.setPublicKeyHex = selfPublicKeyHex; _contactStore.setPublicKeyHex = selfPublicKeyHex; _channelStore.setPublicKeyHex = selfPublicKeyHex; @@ -4220,12 +4485,16 @@ class MeshCoreConnector extends ChangeNotifier { _clientRepeat = frame[80] != 0; } // Path hash mode v10+ (byte 81): width = mode + 1 byte(s) per hop + final previousPathHashByteWidth = _pathHashByteWidth; if (frame.length >= 82) { - final mode = (frame[81] & 0xFF).clamp(0, 2); + final mode = (frame[81] & 0xFF).clamp(0, 3); _pathHashByteWidth = mode + 1; } else { _pathHashByteWidth = 1; } + if (_pathHashByteWidth != previousPathHashByteWidth) { + _directRepeaters.clear(); + } // Firmware reports MAX_CONTACTS / 2 for v3+ device info. final reportedContacts = frame[2]; @@ -4743,6 +5012,7 @@ class MeshCoreConnector extends ChangeNotifier { String senderName, DateTime timestamp, { Uint8List? pathBytes, + int? pathHashWidth, bool notify = false, }) { final normalized = senderName.trim().toLowerCase(); @@ -4766,7 +5036,11 @@ class MeshCoreConnector extends ChangeNotifier { for (var i = 0; i < _contacts.length; i++) { final contact = _contacts[i]; if (contact.type != advTypeChat) continue; - if (_pathMatchesContact(pathBytes, contact.publicKey)) { + if (_pathMatchesContact( + pathBytes, + contact.publicKey, + pathHashWidth: pathHashWidth, + )) { matches.add(i); } } @@ -4783,8 +5057,12 @@ class MeshCoreConnector extends ChangeNotifier { } } - bool _pathMatchesContact(Uint8List pathBytes, Uint8List publicKey) { - final w = _pathHashByteWidth; + bool _pathMatchesContact( + Uint8List pathBytes, + Uint8List publicKey, { + int? pathHashWidth, + }) { + final w = pathHashWidth ?? _pathHashByteWidth; if (pathBytes.isEmpty || publicKey.length < w) return false; for (int i = 0; i + w <= pathBytes.length; i += w) { final prefix = pathBytes.sublist(i, i + w); @@ -5006,7 +5284,7 @@ class MeshCoreConnector extends ChangeNotifier { isOutgoing: false, isCli: isCli, status: MessageStatus.delivered, - pathLength: pathLength == 0xFF ? 0 : pathLength, + pathLength: pathLength == 0xFF ? -1 : (pathLength & 0x3F), pathBytes: Uint8List(0), fourByteRoomContactKey: roomAuthorPrefix, ); @@ -5239,6 +5517,7 @@ class MeshCoreConnector extends ChangeNotifier { message.senderName, message.timestamp, pathBytes: message.pathBytes, + pathHashWidth: message.pathHashWidth, ); final isNew = _addChannelMessage(message.channelIndex!, message); _maybeIncrementChannelUnread(message, isNew: isNew); @@ -5316,6 +5595,7 @@ class MeshCoreConnector extends ChangeNotifier { isOutgoing: false, status: ChannelMessageStatus.sent, pathLength: packet.isFlood ? packet.hopCount : 0, + pathHashWidth: packet.pathHashWidth, pathBytes: packet.pathBytes, channelIndex: channel.index, packetHash: pktHash, @@ -5325,6 +5605,7 @@ class MeshCoreConnector extends ChangeNotifier { parsed.senderName, message.timestamp, pathBytes: message.pathBytes, + pathHashWidth: message.pathHashWidth, ); final isNew = _addChannelMessage(channel.index, message); _maybeIncrementChannelUnread(message, isNew: isNew); @@ -6068,6 +6349,7 @@ class MeshCoreConnector extends ChangeNotifier { repeats: message.repeats, repeatCount: message.repeatCount, pathLength: message.pathLength, + pathHashWidth: message.pathHashWidth, pathBytes: message.pathBytes, pathVariants: message.pathVariants, channelIndex: message.channelIndex, @@ -6104,6 +6386,7 @@ class MeshCoreConnector extends ChangeNotifier { messages[existingIndex] = existing.copyWith( repeatCount: newRepeatCount, pathLength: mergedPathLength, + pathHashWidth: existing.pathHashWidth ?? processedMessage.pathHashWidth, pathBytes: mergedPathBytes, pathVariants: mergedPathVariants, packetHash: existing.packetHash ?? processedMessage.packetHash, @@ -6475,6 +6758,7 @@ class MeshCoreConnector extends ChangeNotifier { //final payloadVer = (header >> 6) & 0x03; final pathLenRaw = packet.readByte(); final pathByteLen = _decodePathByteLen(pathLenRaw); + final pathHashWidth = _decodePathHashWidth(pathLenRaw); final pathBytes = packet.readBytes(pathByteLen); final payload = packet.readBytes(packet.remaining); @@ -6485,6 +6769,7 @@ class MeshCoreConnector extends ChangeNotifier { rawPacket, payload, pathBytes, + pathHashWidth, routeType, snr, ); @@ -6497,6 +6782,86 @@ class MeshCoreConnector extends ChangeNotifier { } } + void importContact(Uint8List frame) { + final packet = BufferReader(frame); + int payloadType = 0; + Uint8List pathBytes = Uint8List(0); + int pathHashWidth = 1; + 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); + pathHashWidth = _decodePathHashWidth(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 ~/ pathHashWidth), + // Store hop order reversed for easier outgoing messages; keep bytes + // inside each multi-byte hop in their original order. + path: _reversePathByHop(pathBytes, pathHashWidth), + 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; @@ -6512,6 +6877,7 @@ class MeshCoreConnector extends ChangeNotifier { Uint8List rawPacket, Uint8List payload, Uint8List path, + int pathHashWidth, int routeType, double snr, ) { @@ -6570,10 +6936,10 @@ class MeshCoreConnector extends ChangeNotifier { publicKey: publicKey, name: name, type: type, - pathLength: path.length, - path: Uint8List.fromList( - path.reversed.toList(), - ), // Store path in reverse for easier use in outgoing messages + pathLength: path.isEmpty ? -1 : (path.length ~/ pathHashWidth), + // Store hop order reversed for easier outgoing messages; keep bytes + // inside each multi-byte hop in their original order. + path: _reversePathByHop(path, pathHashWidth), latitude: latitude, longitude: longitude, lastSeen: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000), @@ -6592,7 +6958,12 @@ class MeshCoreConnector extends ChangeNotifier { } else { _handleDiscovery(newContact, rawPacket); } - _updateDirectRepeater(newContact, snr, path); + _updateDirectRepeater( + newContact, + snr, + path, + pathHashWidth: pathHashWidth, + ); return; } @@ -6616,8 +6987,8 @@ class MeshCoreConnector extends ChangeNotifier { latitude: hasLocation ? latitude : existing.latitude, longitude: hasLocation ? longitude : existing.longitude, name: hasName ? name : existing.name, - path: Uint8List.fromList(path.reversed.toList()), - pathLength: path.length, + path: _reversePathByHop(path, pathHashWidth), + pathLength: path.isEmpty ? -1 : (path.length ~/ pathHashWidth), lastMessageAt: mergedLastMessageAt, lastSeen: DateTime.fromMillisecondsSinceEpoch(timestamp * 1000), pathOverride: existing.pathOverride, // Preserve user's path choice @@ -6630,7 +7001,12 @@ class MeshCoreConnector extends ChangeNotifier { _pathHistoryService!.handlePathUpdated(_contacts[existingIndex]); } - _updateDirectRepeater(_contacts[existingIndex], snr, path); + _updateDirectRepeater( + _contacts[existingIndex], + snr, + path, + pathHashWidth: pathHashWidth, + ); appLogger.info( 'After merge: pathOverride=${_contacts[existingIndex].pathOverride}, devicePath=${_contacts[existingIndex].pathLength}', @@ -6639,10 +7015,42 @@ class MeshCoreConnector extends ChangeNotifier { } } - void _updateDirectRepeater(Contact contact, double snr, Uint8List path) { - final pubkeyFirstByte = path.isNotEmpty - ? path.last - : contact.publicKey.first; + void _updateDirectRepeater( + Contact contact, + double snr, + Uint8List path, { + required int pathHashWidth, + }) { + final hashWidth = pathHashWidth.clamp(1, 4).toInt(); + if (path.isNotEmpty && path.length < hashWidth) { + return; + } + final pathStartIndex = path.isNotEmpty ? path.length - hashWidth : 0; + final publicKeyPrefixEnd = math + .min(hashWidth, contact.publicKey.length) + .toInt(); + final pubkeyPrefix = path.isNotEmpty + ? path.sublist(pathStartIndex) + : contact.publicKey.sublist(0, publicKeyPrefixEnd); + final contactKeyHex = _resolveDirectRepeaterContactKeyHex( + contact, + pubkeyPrefix, + path.isEmpty, + ); + final knownRepeaters = contactKeyHex == null + ? _directRepeaters + .where( + (r) => + r.contactKeyHex != null && + _contactKeyMatchesPrefix(r.contactKeyHex!, pubkeyPrefix), + ) + .toList() + : const []; + final knownRepeater = knownRepeaters.length == 1 + ? knownRepeaters.first + : null; + final effectiveContactKeyHex = + contactKeyHex ?? knownRepeater?.contactKeyHex; _directRepeaters.removeWhere((r) => r.isStale()); @@ -6653,9 +7061,25 @@ class MeshCoreConnector extends ChangeNotifier { return; } - final isTracked = _directRepeaters.where( - (r) => r.pubkeyFirstByte == pubkeyFirstByte, - ); + final isTracked = _directRepeaters.where((r) { + if (knownRepeater != null) { + return identical(r, knownRepeater); + } + if (effectiveContactKeyHex != null) { + return r.contactKeyHex == effectiveContactKeyHex || + (r.contactKeyHex == null && + _contactKeyMatchesPrefix( + effectiveContactKeyHex, + r.pubkeyPrefix, + )); + } + if (r.contactKeyHex == null && + r.pathHashWidth == hashWidth && + r.matchesPrefix(pubkeyPrefix)) { + return true; + } + return false; + }).toList(); final sortedRepeaters = List.from(_directRepeaters) ..sort((a, b) => b.snr.compareTo(a.snr)); @@ -6671,15 +7095,70 @@ class MeshCoreConnector extends ChangeNotifier { if (isTracked.isNotEmpty) { final repeater = isTracked.first; - repeater.update(snr); + repeater.update( + snr, + pubkeyPrefix: pubkeyPrefix, + pathHashWidth: hashWidth, + contactKeyHex: effectiveContactKeyHex, + ); + if (effectiveContactKeyHex != null) { + _directRepeaters.removeWhere( + (r) => + !identical(r, repeater) && + (r.contactKeyHex == effectiveContactKeyHex || + (r.contactKeyHex == null && + _contactKeyMatchesPrefix( + effectiveContactKeyHex, + r.pubkeyPrefix, + ))), + ); + } } else if (_directRepeaters.length < 5) { _directRepeaters.add( - DirectRepeater(pubkeyFirstByte: pubkeyFirstByte, snr: snr), + DirectRepeater( + pubkeyPrefix: pubkeyPrefix, + pathHashWidth: hashWidth, + contactKeyHex: effectiveContactKeyHex, + snr: snr, + ), ); } notifyListeners(); } + String? _resolveDirectRepeaterContactKeyHex( + Contact contact, + List pubkeyPrefix, + bool pathIsEmpty, + ) { + if (pathIsEmpty && + (contact.type == advTypeRepeater || contact.type == advTypeRoom)) { + return contact.publicKeyHex; + } + + final prefixMatches = allContacts + .where( + (c) => + (c.type == advTypeRepeater || c.type == advTypeRoom) && + _contactKeyMatchesPrefix(c.publicKeyHex, pubkeyPrefix), + ) + .toList(); + if (prefixMatches.length == 1) { + return prefixMatches.first.publicKeyHex; + } + + return null; + } + + bool _contactKeyMatchesPrefix(String contactKeyHex, List pubkeyPrefix) { + // Normalize both sides to upper-case hex to avoid case-sensitive mismatches. + final normalizedPrefixHex = pubkeyPrefix + .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) + .join(); + final normalizedContactKeyHex = contactKeyHex.toUpperCase(); + return normalizedContactKeyHex.startsWith(normalizedPrefixHex); + } + void _handleAutoAddConfig(Uint8List frame) { final reader = BufferReader(frame); try { @@ -6741,6 +7220,10 @@ class MeshCoreConnector extends ChangeNotifier { isActive: addActive, flags: 0, ); + + if (_discoveredContacts.length >= _maxDiscoveredContacts) { + _evictStalestDiscoveredContact(); + } _discoveredContacts.add(disContact); unawaited(_persistDiscoveredContacts()); @@ -6758,6 +7241,19 @@ class MeshCoreConnector extends ChangeNotifier { } } + void _evictStalestDiscoveredContact() { + if (_discoveredContacts.isEmpty) return; + var stalestIndex = 0; + for (int i = 1; i < _discoveredContacts.length; i++) { + if (_discoveredContacts[i].lastSeen.isBefore( + _discoveredContacts[stalestIndex].lastSeen, + )) { + stalestIndex = i; + } + } + _discoveredContacts.removeAt(stalestIndex); + } + void removeAllDiscoveredContacts() { _discoveredContacts.clear(); unawaited(_persistDiscoveredContacts()); @@ -6802,13 +7298,42 @@ const int _payloadTypeGroupText = 0x05; const int _cipherMacSize = 2; /// Decodes the firmware's encoded path_len byte into actual byte length. -/// Bits 0-5: hash count (0-63), Bits 6-7: hash size code (0=1byte, 1=2bytes, 2=3bytes). +/// Bits 0-5: hash count (0-63), Bits 6-7: hash size code (0=1byte ... 3=4bytes). int _decodePathByteLen(int pathLenRaw) { + if (pathLenRaw == 0xFF || pathLenRaw == 0) return 0; final hashCount = pathLenRaw & 63; - final hashSize = ((pathLenRaw >> 6) & 0x03) + 1; + final hashSize = _decodePathHashWidth(pathLenRaw); return hashCount * hashSize; } +int _decodePathHashWidth(int pathLenRaw) { + if (pathLenRaw == 0xFF) return 1; + return ((pathLenRaw >> 6) & 0x03) + 1; +} + +bool _isPathLenValidForMode( + int pathLen, + List pathBytes, + int pathHashWidth, +) { + if (pathLen < 0 || pathLen > 0x3F) return false; + final width = pathHashWidth.clamp(1, 4).toInt(); + final maxHopCountByBytes = maxPathSize ~/ width; + if (pathLen > maxHopCountByBytes) return false; + return pathBytes.length <= maxPathSize && pathBytes.length == pathLen * width; +} + +Uint8List _reversePathByHop(Uint8List pathBytes, int pathHashWidth) { + if (pathBytes.isEmpty) return Uint8List(0); + final width = pathHashWidth.clamp(1, 4).toInt(); + final reversed = []; + for (var i = pathBytes.length; i > 0; i -= width) { + final start = (i - width).clamp(0, pathBytes.length).toInt(); + reversed.addAll(pathBytes.sublist(start, i)); + } + return Uint8List.fromList(reversed); +} + class _RawPacket { final int header; final int routeType; @@ -6832,6 +7357,7 @@ class _RawPacket { routeType == _routeFlood || routeType == _routeTransportFlood; int get hopCount => pathLenRaw & 63; + int get pathHashWidth => ((pathLenRaw >> 6) & 0x03) + 1; } class _ParsedText { diff --git a/lib/connector/meshcore_protocol.dart b/lib/connector/meshcore_protocol.dart index 7b594894..82c9473d 100644 --- a/lib/connector/meshcore_protocol.dart +++ b/lib/connector/meshcore_protocol.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'dart:typed_data'; +import 'package:crypto/crypto.dart' as crypto; import 'package:flutter/widgets.dart'; // Buffer Reader - sequential binary data reader with pointer tracking @@ -206,6 +207,8 @@ const int cmdSendTelemetryReq = 39; const int cmdGetCustomVar = 40; const int cmdSetCustomVar = 41; const int cmdSendBinaryReq = 50; +const int cmdSetFloodScope = 54; +const int cmdSendControlData = 55; const int cmdGetStats = 56; const int cmdSendAnonReq = 57; const int cmdSetAutoAddConfig = 58; @@ -230,6 +233,12 @@ Uint8List buildTelemetryBinaryPayload() { return Uint8List.fromList([reqTypeGetTelemetry, 0x00, 0x00, 0x00, 0x00]); } +const int anonReqTypeRegions = 0x01; + +// Control data sub-types used by MeshCore discovery packets. +const int controlSubtypeDiscoverReq = 0x08; +const int controlSubtypeDiscoverResp = 0x09; + // Repeater response codes const int respServerLoginOk = 0; @@ -272,6 +281,7 @@ const int pushCodeTraceData = 0x89; const int pushCodeNewAdvert = 0x8A; const int pushCodeTelemetryResponse = 0x8B; const int pushCodeBinaryResponse = 0x8C; +const int pushCodeControlData = 0x8E; // Contact/advertisement types const int advTypeChat = 1; @@ -577,9 +587,9 @@ Uint8List buildGetStatsFrame(int statsType) { return Uint8List.fromList([cmdGetStats, statsType & 0xFF]); } -/// Path hash width on air: [61][0][mode], mode 0..2 → (mode+1) bytes per hop hash. +/// Path hash width on air: [61][0][mode], mode 0..3 → (mode+1) bytes per hop hash. Uint8List buildSetPathHashModeFrame(int mode) { - final m = mode.clamp(0, 2); + final m = mode.clamp(0, 3).toInt(); return Uint8List.fromList([cmdSetPathHashMode, 0, m]); } @@ -866,6 +876,67 @@ Uint8List buildSendBinaryReq(Uint8List repeaterPubKey, {Uint8List? payload}) { return writer.toBytes(); } +Uint8List buildSendControlDataFrame(Uint8List payload) { + final writer = BufferWriter(); + writer.writeByte(cmdSendControlData); + writer.writeBytes(payload); + return writer.toBytes(); +} + +Uint8List buildDiscoveryRequestPayload( + int tag, { + bool prefixOnly = false, + int typeMask = 1 << advTypeRepeater, +}) { + final writer = BufferWriter(); + // The high bit must be set for CMD_SEND_CONTROL_DATA; DISCOVER_REQ uses + // subtype 0x8, with the low bit selecting short/full public keys in replies. + writer.writeByte( + (controlSubtypeDiscoverReq << 4) | (prefixOnly ? 0x01 : 0x00), + ); + writer.writeByte(typeMask); + writer.writeUInt32LE(tag); + writer.writeUInt32LE(0); // since=0 asks nearby nodes for any recent advert. + return writer.toBytes(); +} + +Uint8List _reversePathByHop(Uint8List path, int pathHashWidth) { + if (path.isEmpty) return Uint8List(0); + final width = pathHashWidth.clamp(1, 4).toInt(); + if (path.length % width != 0) { + return Uint8List.fromList(path.reversed.toList()); + } + + final reversed = Uint8List(path.length); + final hops = path.length ~/ width; + for (var i = 0; i < hops; i++) { + final from = (hops - 1 - i) * width; + reversed.setRange(i * width, (i + 1) * width, path, from); + } + return reversed; +} + +// Build CMD_SEND_ANON_REQ frame. +// Payload format for regions: [anon_req_type][reply_path_len][reply_path...]. +Uint8List buildSendAnonReqFrame( + Uint8List repeaterPubKey, { + required int requestType, + Uint8List? replyPath, + int replyHopCount = 0, + int pathHashWidth = pathHashSize, +}) { + final width = pathHashWidth.clamp(1, 4).toInt(); + final path = replyPath ?? Uint8List(0); + final encodedPathLen = ((width - 1) << 6) | (replyHopCount & 0x3F); + final writer = BufferWriter(); + writer.writeByte(cmdSendAnonReq); + writer.writeBytes(repeaterPubKey); + writer.writeByte(requestType); + writer.writeByte(encodedPathLen); + writer.writeBytes(_reversePathByHop(path, width)); + return writer.toBytes(); +} + //Build a trace request frame //[cmd][tag x4][auth x4][flag][payload] Uint8List buildTraceReq(int tag, int auth, int flag, {Uint8List? payload}) { @@ -960,3 +1031,18 @@ Uint8List buildSendTelemetryReq(Uint8List? pubKey) { } return writer.toBytes(); } + +//Build CMD_SET_FLOOD_SCOPE +// Format: [cmd][scope] +Uint8List buildSetFloodScopeFrame(String region) { + if (region == '') { + // reset scope + return Uint8List.fromList([cmdSetFloodScope, 0]); + } + + final name = region.startsWith('#') ? region : '#$region'; + final hash = crypto.sha256.convert(utf8.encode(name)).bytes; + final scope = Uint8List.fromList(hash.sublist(0, 16)); + + return Uint8List.fromList([cmdSetFloodScope, 0, ...scope]); +} diff --git a/lib/helpers/link_handler.dart b/lib/helpers/link_handler.dart index c2eae294..980369da 100644 --- a/lib/helpers/link_handler.dart +++ b/lib/helpers/link_handler.dart @@ -1,3 +1,4 @@ +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_linkify/flutter_linkify.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -20,6 +21,7 @@ class LinkHandler { required String text, required TextStyle style, TextStyle? linkStyle, + VoidCallback? onSecondaryTap, }) { final effectiveLinkStyle = linkStyle ?? defaultLinkStyle(context, style); const options = LinkifyOptions(humanize: false, defaultToHttps: false); @@ -27,7 +29,7 @@ class LinkHandler { void onOpen(LinkableElement link) => handleLinkTap(context, link.url); if (PlatformInfo.isDesktop) { - return SelectableLinkify( + final linkify = SelectableLinkify( text: text, style: style, linkStyle: effectiveLinkStyle, @@ -35,6 +37,14 @@ class LinkHandler { linkifiers: linkifiers, onOpen: onOpen, ); + if (onSecondaryTap == null) return linkify; + return Listener( + onPointerDown: (event) { + if (event.buttons & kSecondaryMouseButton != 0) onSecondaryTap(); + }, + behavior: HitTestBehavior.translucent, + child: linkify, + ); } return Linkify( text: text, diff --git a/lib/helpers/path_helper.dart b/lib/helpers/path_helper.dart index bd599c00..198f0530 100644 --- a/lib/helpers/path_helper.dart +++ b/lib/helpers/path_helper.dart @@ -1,5 +1,7 @@ -import '../models/contact.dart'; +import 'package:flutter/foundation.dart'; + import '../connector/meshcore_protocol.dart'; +import '../models/contact.dart'; class PathHelper { static String formatPathHex(List pathBytes) { @@ -12,10 +14,17 @@ class PathHelper { return byte.toRadixString(16).padLeft(2, '0').toUpperCase(); } + static String formatHopHex(List hopBytes) { + return hopBytes + .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) + .join(); + } + static String? hopName(int byte, List allContacts) { final matches = allContacts .where( (c) => + c.publicKey.isNotEmpty && c.publicKey.first == byte && (c.type == advTypeRepeater || c.type == advTypeRoom), ) @@ -25,12 +34,58 @@ class PathHelper { return matches.map((c) => c.name).join(' | '); } + static List splitPathBytes( + List pathBytes, + int hashByteWidth, + ) { + if (pathBytes.isEmpty) return const []; + + final width = hashByteWidth.clamp(1, 4).toInt(); + final hops = []; + for (int i = 0; i < pathBytes.length; i += width) { + final endIdx = (i + width).clamp(0, pathBytes.length).toInt(); + final hopBytes = pathBytes.sublist(i, endIdx); + if (hopBytes.isNotEmpty) { + hops.add(Uint8List.fromList(hopBytes)); + } + } + return hops; + } + + /// Resolves path bytes to contact names, supporting multi-byte hash widths. + /// + /// Groups path bytes according to [hashByteWidth]: + /// - 1: Single byte per hop (256 unique nodes) + /// - 2: Two bytes per hop (65K unique nodes) + /// - 3: Three bytes per hop (16M unique nodes) + /// - 4: Four bytes per hop (4.3G unique nodes) static String resolvePathNames( List pathBytes, List allContacts, + int hashByteWidth, ) { - return pathBytes - .map((b) => hopName(b, allContacts) ?? hopHex(b)) - .join(' \u2192 '); + if (pathBytes.isEmpty) return ''; + + final parts = []; + + for (final hopBytes in splitPathBytes(pathBytes, hashByteWidth)) { + final hex = formatHopHex(hopBytes); + + final matches = allContacts.where((c) { + if (c.publicKey.length < hopBytes.length) return false; + if (c.type != advTypeRepeater && c.type != advTypeRoom) return false; + return listEquals(c.publicKey.sublist(0, hopBytes.length), hopBytes); + }).toList(); + + if (matches.isEmpty) { + parts.add(hex); + } else if (matches.length == 1) { + parts.add(matches.first.name); + } else { + parts.add(matches.map((c) => c.name).join(' | ')); + } + } + + return parts.join(' \u2192 '); } } diff --git a/lib/helpers/path_hop_resolver.dart b/lib/helpers/path_hop_resolver.dart index 19f26001..b17f7b56 100644 --- a/lib/helpers/path_hop_resolver.dart +++ b/lib/helpers/path_hop_resolver.dart @@ -1,6 +1,7 @@ import 'package:latlong2/latlong.dart'; import '../connector/meshcore_protocol.dart'; +import 'path_helper.dart'; import '../models/contact.dart'; class PathHopResolver { @@ -11,30 +12,35 @@ class PathHopResolver { required List contacts, LatLng? endpoint, bool resolveFromEnd = false, + int pathHashByteWidth = 1, }) { - final candidatesByPrefix = >{}; + final width = pathHashByteWidth.clamp(1, 4).toInt(); + final candidatesByPrefix = >{}; for (final contact in contacts) { - if (contact.publicKey.isEmpty) continue; + if (contact.publicKey.length < width) continue; if (contact.type != advTypeRepeater && contact.type != advTypeRoom) { continue; } - candidatesByPrefix - .putIfAbsent(contact.publicKey.first, () => []) - .add(contact); + final prefix = PathHelper.formatHopHex( + contact.publicKey.sublist(0, width), + ); + candidatesByPrefix.putIfAbsent(prefix, () => []).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 hops = PathHelper.splitPathBytes(pathBytes, width); + final resolved = List.filled(hops.length, null); final indexes = resolveFromEnd - ? List.generate(pathBytes.length, (i) => pathBytes.length - 1 - i) - : List.generate(pathBytes.length, (i) => i); + ? List.generate(hops.length, (i) => hops.length - 1 - i) + : List.generate(hops.length, (i) => i); final distance = Distance(); var previousPosition = endpoint; for (final index in indexes) { - final candidates = candidatesByPrefix[pathBytes[index]]; + final candidates = + candidatesByPrefix[PathHelper.formatHopHex(hops[index])]; if (candidates == null || candidates.isEmpty) continue; var bestIndex = 0; diff --git a/lib/l10n/app_bg.arb b/lib/l10n/app_bg.arb index c9542ebf..0c93dc1f 100644 --- a/lib/l10n/app_bg.arb +++ b/lib/l10n/app_bg.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Невалидна ширина или дължина.", "settings_latitude": "Широчина", "settings_longitude": "Дължина", + "settings_autoZeroHopAdvertOnGpsUpdate": "Автоматична zero-hop обява при GPS обновяване", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Когато GPS местоположението се промени, изпрати zero-hop обява (изисква местоположение в обявата).", "settings_privacyMode": "Режим на поверителност", "settings_privacyModeSubtitle": "Скриване на име/местоположение в рекламите", "settings_privacyModeToggle": "Активирайте режим на поверителност, за да скриете името и местоположението си в рекламите.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Последни 6 часа", "appSettings_last24Hours": "Последно 24 часа", "appSettings_lastWeek": "Миналата седмица", + "appSettings_rasterTileSource": "Източник на растерни плочки", + "appSettings_stadiaEndpoint": "Крайна точка на Stadia", + "appSettings_stadiaApiKey": "API ключ за Stadia", + "appSettings_stadiaApiKeyRequired": "Задължително за използване на Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Конфигурирано: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Въведете своя API ключ за Stadia Maps. Приложението го използва за заявки за растерни плочки.", "appSettings_offlineMapCache": "Кеш на офлайн карти", "appSettings_noAreaSelected": "Няма избрана област", "appSettings_areaSelectedZoom": "Избрана е област (мащаб {minZoom}-{maxZoom})", @@ -769,6 +784,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "Север {north}, Юг {south}, Изток {east}, Запад {west}", "@mapCache_boundsLabel": { "placeholders": { diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arb index 7e8bdd85..94000dd9 100644 --- a/lib/l10n/app_de.arb +++ b/lib/l10n/app_de.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Ungültiger Breiten- oder Längengrad.", "settings_latitude": "Breitengrad", "settings_longitude": "Längengrad", + "settings_autoZeroHopAdvertOnGpsUpdate": "Automatische Zero-Hop-Ankündigung bei GPS-Update", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Wenn sich der GPS-Standort ändert, eine Zero-Hop-Ankündigung senden (erfordert Standort in der Ankündigung).", "settings_privacyMode": "Privatsphärenmodus", "settings_privacyModeSubtitle": "Name und Standort in Ankündigungen verbergen", "settings_privacyModeToggle": "Privatsphärenmodus aktivieren, um Namen und Standort in Ankündigungen zu verbergen.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Letzte 6 Stunden", "appSettings_last24Hours": "Letzte 24 Stunden", "appSettings_lastWeek": "Letzte Woche", + "appSettings_rasterTileSource": "Quelle für Rasterkacheln", + "appSettings_stadiaEndpoint": "Stadia-Endpunkt", + "appSettings_stadiaApiKey": "Stadia-API-Schlüssel", + "appSettings_stadiaApiKeyRequired": "Für die Nutzung von Stadia Maps erforderlich", + "appSettings_stadiaApiKeyConfigured": "Konfiguriert: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Geben Sie Ihren Stadia-Maps-API-Schlüssel ein. Die App verwendet ihn für Rasterkachel-Anfragen.", "appSettings_offlineMapCache": "Offline-Karten-Cache", "appSettings_noAreaSelected": "Kein Bereich ausgewählt", "appSettings_areaSelectedZoom": "Bereich ausgewählt (Zoom {minZoom}-{maxZoom})", @@ -791,6 +806,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -2523,6 +2588,13 @@ "settings_companionDebugLog": "Debug-Protokoll für die Begleitsoftware", "settings_companionDebugLogSubtitle": "BLE/TCP/USB-Befehle, Antworten und Rohdaten", "repeater_chanUtil": "Nutzung des Kanals", + "@settings_deleteRegionConfirm": { + "placeholders": { + "region": { + "type": "String" + } + } + }, "@routing_lastWorked": { "placeholders": { "when": { @@ -2530,6 +2602,27 @@ } } }, + "@channels_regionSetTo": { + "placeholders": { + "region": { + "type": "String", + "example": "de-mitte" + } + } + }, + "settings_regionSettings": "Regionen", + "settings_regionSettingsSubtitle": "Gespeicherte Regionen verwalten", + "settings_regionManagement_screenTitle": "Regions-Verwaltung", + "settings_regionNameHint": "Regions-Namen eingeben", + "settings_regionAddRegion": "Region hinzufügen", + "settings_regionDeleted": "Region entfernt", + "settings_regionName": "Regions-Name", + "settings_deleteRegion": "Region entfernen", + "settings_deleteRegionConfirm": "Region \"{region}\" aus der Liste entfernen?", + "channels_regionNotSet": "Region: keine", + "channels_regionSetTo": "Region: {region}", + "channels_regionSelect_Title": "Region auswählen", + "channels_clearRegion": "Region zurücksetzen", "@routing_deliveryCounts": { "placeholders": { "successes": { diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index e42c24cf..32fdeb9f 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -158,6 +158,25 @@ "settings_radioSettings": "Radio Settings", "settings_radioSettingsSubtitle": "Frequency, power, spreading factor", "settings_radioSettingsUpdated": "Radio settings updated", + "settings_regionSettings": "Regions", + "settings_regionSettingsSubtitle": "Manage stored regions", + "settings_regionManagement_screenTitle": "Region Management", + "settings_regionNameHint": "Enter region name", + "settings_regionAddRegion": "Add region", + "settings_regionFetchRegions": "Fetch regions from repeaters", + "settings_regionFetchRegionsFail": "No regions were found", + "settings_regionFetchRegionsAlreadyExists": "This region has already been added", + "settings_regionName": "Region Name", + "settings_regionDeleted": "Region deleted", + "settings_deleteRegion": "Delete Region", + "settings_deleteRegionConfirm": "Remove \"{region}\" from region list?", + "@settings_deleteRegionConfirm": { + "placeholders": { + "region": { + "type": "String" + } + } + }, "settings_location": "Location", "settings_locationSubtitle": "GPS coordinates", "settings_locationUpdated": "Location and GPS settings updated", @@ -187,6 +206,8 @@ "settings_telemetryEnvironmentMode": "Telemetry Environment Mode", "settings_advertLocation": "Advert Location", "settings_advertLocationSubtitle": "Include location in advert.", + "settings_autoZeroHopAdvertOnGpsUpdate": "Auto Zero-Hop Advert On GPS Update", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "When GPS location changes, send a zero-hop advert (requires Advert Location).", "settings_multiAck": "Multi-ACKs", "settings_telemetryModeUpdated": "Telemetry mode updated", "settings_actions": "Actions", @@ -271,6 +292,10 @@ "appSettings_languageBg": "Български", "appSettings_languageRu": "Русский", "appSettings_languageUk": "Українська", + "repeater_pathHashModeOption0": "0 - 1 byte", + "repeater_pathHashModeOption1": "1 - 2 bytes", + "repeater_pathHashModeOption2": "2 - 3 bytes", + "repeater_pathHashModeOption3": "3 - 4 bytes", "appSettings_enableMessageTracing": "Enable Message Tracing", "appSettings_enableMessageTracingSubtitle": "Show detailed routing and timing metadata for messages", "appSettings_notifications": "Notifications", @@ -342,6 +367,19 @@ "appSettings_last6Hours": "Last 6 hours", "appSettings_last24Hours": "Last 24 hours", "appSettings_lastWeek": "Last week", + "appSettings_rasterTileSource": "Raster Tile Source", + "appSettings_stadiaEndpoint": "Stadia Endpoint", + "appSettings_stadiaApiKey": "Stadia API Key", + "appSettings_stadiaApiKeyRequired": "Required for Stadia Maps usage", + "appSettings_stadiaApiKeyConfigured": "Configured: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Enter your Stadia Maps API key. This app uses it for raster tile requests.", "appSettings_offlineMapCache": "Offline Map Cache", "appSettings_unitsTitle": "Units", "appSettings_unitsMetric": "Metric (m / km)", @@ -635,6 +673,18 @@ "channels_scanQrCodeComingSoon": "Coming soon", "channels_enterHashtag": "Enter hashtag", "channels_hashtagHint": "e.g. #team", + "channels_regionSetTo": "Region: {region}", + "@channels_regionSetTo": { + "placeholders": { + "region": { + "type": "String", + "example": "de-mitte" + } + } + }, + "channels_regionNotSet": "Region: none", + "channels_regionSelect_Title": "Select a region", + "channels_clearRegion": "Clear region", "chat_noMessages": "No messages yet", "chat_sendMessage": "Send message", "chat_sendMessageTo": "Send a message to {contactName}", @@ -688,6 +738,7 @@ } }, "chat_sendGif": "Send GIF", + "chat_receivedGif": "Received a GIF", "chat_reply": "Reply", "chat_addReaction": "Add Reaction", "chat_me": "Me", @@ -1060,6 +1111,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1377,7 +1478,24 @@ "repeater_advancedSettings": "Advanced", "repeater_advancedSettingsSubtitle": "Tuning knobs for experienced operators", "repeater_pathHashMode": "Path hash mode", - "repeater_pathHashModeHelper": "Bytes used to encode this repeater's ID in flood path/loop-detect tags. 0=1 byte (256 IDs, up to 64 hops), 1=2 bytes (65K IDs, up to 32 hops), 2=3 bytes (16M IDs, up to 21 hops). v1.13 and older firmware drops multi-byte paths — only raise once your network is on v1.14+.", + "repeater_pathHashModeHelper": "Bytes used to encode this repeater's ID in flood path/loop-detect tags. 0=1 byte (256 IDs, up to 64 hops), 1=2 bytes (65K IDs, up to 32 hops), 2=3 bytes (16M IDs, up to 21 hops). Firmware before v1.14 always used 1-byte paths; v1.14 and newer can be configured for 2- or 3-byte paths.", + "repeater_keySettings": "Change Identity Keys", + "repeater_keySettingsSubtitle": "Change the public/private keypair", + "repeater_prvKey": "Private key", + "repeater_prvKeyHelper": "A new private key for the repeater, a 128-character hex string.", + "repeater_generatePrvKey": "Generate a random keypair", + "repeater_stopGeneratingPrvKey": "Interrupt search for keypair", + "repeater_pubKey": "Public key", + "repeater_pubKeyHelper": "This is the public key that goes with the generated private key. You can't set this directly.", + "repeater_pubKeyPrefix": "Desired prefix", + "repeater_pubKeyPrefixHelper": "Find a public key that starts with these hex digits. Expected tries needed: {tries}.", + "@repeater_pubKeyPrefixHelper": { + "placeholders": { + "tries": { + "type": "int" + } + } + }, "repeater_txDelay": "Flood TX delay", "repeater_txDelayHelper": "Retransmit spacing for flood traffic, as a multiplier of the packet's airtime (0-2, default 0.5). Higher = fewer collisions but slower delivery.", "repeater_directTxDelay": "Direct TX delay", @@ -1558,7 +1676,7 @@ "repeater_cliHelpPowersavingOnOff": "Enables or disables powersaving mode (where supported).", "repeater_cliHelpErase": "(Serial only) Formats the device file system. Wipes all settings and contacts.", "repeater_cliHelpSetDutyCycle": "Sets the maximum allowed transmit duty cycle as a percentage (1-100). Internally adjusts the airtime factor.", - "repeater_cliHelpSetPrvKey": "(Serial only) Replaces the device identity private key. Reboot required to apply. Generates a new public key.", + "repeater_cliHelpSetPrvKey": "Replaces the device identity private key. Reboot required to apply. Generates a new public key.", "repeater_cliHelpSetRadioRxGain": "(SX126x only) Toggles boosted RX gain for improved sensitivity at higher current draw.", "repeater_cliHelpSetOwnerInfo": "Sets the owner contact info string included in adverts. Use '|' for newlines.", "repeater_cliHelpSetPathHashMode": "Sets the path-hash mode. 0 = legacy, 1 = standard, 2 = strict. Affects how routing paths are matched.", diff --git a/lib/l10n/app_es.arb b/lib/l10n/app_es.arb index aa696834..3ace6ffb 100644 --- a/lib/l10n/app_es.arb +++ b/lib/l10n/app_es.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Latitud o longitud inválidos.", "settings_latitude": "Latitud", "settings_longitude": "Longitud", + "settings_autoZeroHopAdvertOnGpsUpdate": "Anuncio de cero saltos automático al actualizar GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Cuando cambie la ubicación GPS, enviar un anuncio de cero saltos (requiere ubicación en anuncio).", "settings_privacyMode": "Modo de privacidad", "settings_privacyModeSubtitle": "Ocultar nombre/ubicación en anuncios", "settings_privacyModeToggle": "Activar el modo de privacidad para ocultar tu nombre y ubicación en los anuncios.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Últimas 6 horas", "appSettings_last24Hours": "Últimas 24 horas", "appSettings_lastWeek": "La semana pasada", + "appSettings_rasterTileSource": "Fuente de teselas ráster", + "appSettings_stadiaEndpoint": "Punto de acceso de Stadia", + "appSettings_stadiaApiKey": "Clave API de Stadia", + "appSettings_stadiaApiKeyRequired": "Obligatorio para usar Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Configurado: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Introduce tu clave API de Stadia Maps. La aplicación la usa para solicitar teselas ráster.", "appSettings_offlineMapCache": "Caché de mapa sin conexión", "appSettings_noAreaSelected": "No se ha seleccionado ningún área", "appSettings_areaSelectedZoom": "Área seleccionada (zoom {minZoom}-{maxZoom})", @@ -791,6 +806,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb index ae346765..7b4e1e5d 100644 --- a/lib/l10n/app_fr.arb +++ b/lib/l10n/app_fr.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Latitude ou longitude invalide.", "settings_latitude": "Latitude", "settings_longitude": "Longitude", + "settings_autoZeroHopAdvertOnGpsUpdate": "Annonce zéro saut automatique lors de la mise à jour GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Lorsque la position GPS change, envoyer une annonce zéro saut (nécessite la position dans l'annonce).", "settings_privacyMode": "Mode de confidentialité", "settings_privacyModeSubtitle": "Masquer le nom et la localisation dans les annonces", "settings_privacyModeToggle": "Activez le mode confidentialité pour masquer votre nom et votre localisation dans les annonces.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Dernières 6 heures", "appSettings_last24Hours": "Dernières 24 heures", "appSettings_lastWeek": "La semaine dernière", + "appSettings_rasterTileSource": "Source de tuiles raster", + "appSettings_stadiaEndpoint": "Point de terminaison Stadia", + "appSettings_stadiaApiKey": "Clé API Stadia", + "appSettings_stadiaApiKeyRequired": "Requis pour l’utilisation de Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Configuré : {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Entrez votre clé API Stadia Maps. Cette application l’utilise pour les requêtes de tuiles raster.", "appSettings_offlineMapCache": "Cache de carte hors ligne", "appSettings_noAreaSelected": "Aucune zone sélectionnée", "appSettings_areaSelectedZoom": "Zone sélectionnée (zoom {minZoom}-{maxZoom})", @@ -791,6 +806,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, O {west}", "@mapCache_boundsLabel": { "placeholders": { diff --git a/lib/l10n/app_hu.arb b/lib/l10n/app_hu.arb index f59b4bf0..aee8a28d 100644 --- a/lib/l10n/app_hu.arb +++ b/lib/l10n/app_hu.arb @@ -161,6 +161,8 @@ "settings_locationIntervalInvalid": "Az intervallumnak legalább 60 másodpercnek kell lennie, és kevesebbnek kell lennie 86 400 másodpercnél.", "settings_latitude": "Szélesség", "settings_longitude": "Hosszúság", + "settings_autoZeroHopAdvertOnGpsUpdate": "Automatikus zero-hop hirdetés GPS-frissítéskor", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Ha a GPS-helyzet megváltozik, küldjön zero-hop hirdetést (a hirdetésben helymegadás szükséges).", "settings_contactSettings": "Kapcsolati beállítások", "settings_contactSettingsSubtitle": "A névjegyek hozzáadásának beállításai.", "settings_privacyMode": "Adatvédelmi mód", @@ -332,6 +334,19 @@ "appSettings_last6Hours": "Utolsó 6 óra", "appSettings_last24Hours": "Az elmúlt 24 óra", "appSettings_lastWeek": "Múlt héten", + "appSettings_rasterTileSource": "Raszteres csempeforrás", + "appSettings_stadiaEndpoint": "Stadia végpont", + "appSettings_stadiaApiKey": "Stadia API-kulcs", + "appSettings_stadiaApiKeyRequired": "A Stadia Maps használatához kötelező", + "appSettings_stadiaApiKeyConfigured": "Konfigurálva: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Adja meg a Stadia Maps API-kulcsát. Az alkalmazás ezt használja raszteres csempekérésekhez.", "appSettings_offlineMapCache": "Offline térképgyorsítótár", "appSettings_unitsTitle": "Egységek", "appSettings_unitsMetric": "Metrikus (m/km)", @@ -952,6 +967,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "É {north}, D {south}, K {east}, Ny {west}", "@mapCache_boundsLabel": { "placeholders": { diff --git a/lib/l10n/app_it.arb b/lib/l10n/app_it.arb index bd2eba3f..6abac6d8 100644 --- a/lib/l10n/app_it.arb +++ b/lib/l10n/app_it.arb @@ -240,6 +240,19 @@ "appSettings_last6Hours": "Ultimi 6 ore", "appSettings_last24Hours": "Ultime 24 ore", "appSettings_lastWeek": "La settimana scorsa", + "appSettings_rasterTileSource": "Sorgente tile raster", + "appSettings_stadiaEndpoint": "Endpoint Stadia", + "appSettings_stadiaApiKey": "Chiave API Stadia", + "appSettings_stadiaApiKeyRequired": "Obbligatoria per usare Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Configurata: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Inserisci la chiave API di Stadia Maps. Questa app la usa per le richieste di tile raster.", "appSettings_offlineMapCache": "Cache Mappa Offline", "appSettings_noAreaSelected": "Nessun'area selezionata", "appSettings_areaSelectedZoom": "Area selezionata (zoom {minZoom}-{maxZoom})", @@ -837,6 +850,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1175,7 +1238,7 @@ "repeater_advancedSettings": "Avanzato", "repeater_advancedSettingsSubtitle": "Manopole di regolazione per operatori esperti", "repeater_pathHashMode": "Modalità di hashing del percorso", - "repeater_pathHashModeHelper": "Byte utilizzati per codificare l'ID di questo ripetitore nei tag per il rilevamento del percorso/loop. 0=1 byte (256 ID, fino a 64 salti), 1=2 byte (65.000 ID, fino a 32 salti), 2=3 byte (16 milioni di ID, fino a 21 salti). Le versioni 1.13 e precedenti utilizzano percorsi multi-byte: è necessario attivare la rete prima di utilizzare questa funzionalità (a partire dalla versione 1.14).", + "repeater_pathHashModeHelper": "Byte utilizzati per codificare l'ID di questo ripetitore nei tag di percorso flood/rilevamento loop. 0=1 byte (256 ID, fino a 64 salti), 1=2 byte (65.000 ID, fino a 32 salti), 2=3 byte (16 milioni di ID, fino a 21 salti). Il firmware precedente alla v1.14 usava sempre percorsi a 1 byte; v1.14 e versioni successive possono essere configurate per percorsi a 2 o 3 byte.", "repeater_txDelay": "Ritardo a Flood, TX", "repeater_txDelayHelper": "Riassegnare lo spazio tra i pacchetti per gestire il traffico intenso, come un moltiplicatore del tempo di trasmissione (da 0 a 2, valore predefinito 0,5). Un valore più alto significa meno collisioni, ma una trasmissione più lenta.", "repeater_directTxDelay": "Ritardo diretto TX", @@ -2242,6 +2305,8 @@ "settings_telemetryEnvironmentMode": "Modalità di ambiente di telemetria", "settings_advertLocation": "Posizione dell'annuncio", "settings_advertLocationSubtitle": "Includi la posizione nell'annuncio", + "settings_autoZeroHopAdvertOnGpsUpdate": "Annuncio zero-hop automatico all'aggiornamento GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Quando la posizione GPS cambia, invia un annuncio zero-hop (richiede la posizione nell'annuncio).", "settings_privacy": "Impostazioni sulla privacy", "settings_denyAll": "Negare tutto", "settings_privacySubtitle": "Controlla le informazioni che vengono condivise.", diff --git a/lib/l10n/app_ja.arb b/lib/l10n/app_ja.arb index 11d2f280..70c9d0af 100644 --- a/lib/l10n/app_ja.arb +++ b/lib/l10n/app_ja.arb @@ -167,6 +167,8 @@ "settings_locationIntervalInvalid": "間隔は少なくとも60秒で、86400秒未満でなければなりません。", "settings_latitude": "緯度", "settings_longitude": "経度", + "settings_autoZeroHopAdvertOnGpsUpdate": "GPS更新時にゼロホップ広告を自動送信", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "GPS位置が変化したときにゼロホップ広告を送信します(広告への位置情報の含有が必要)。", "settings_contactSettings": "連絡先設定", "settings_contactSettingsSubtitle": "連絡先の追加方法に関する設定", "settings_privacyMode": "プライバシーモード", @@ -338,6 +340,19 @@ "appSettings_last6Hours": "過去6時間", "appSettings_last24Hours": "過去24時間", "appSettings_lastWeek": "過去1週間", + "appSettings_rasterTileSource": "ラスタタイルのソース", + "appSettings_stadiaEndpoint": "Stadia エンドポイント", + "appSettings_stadiaApiKey": "Stadia API キー", + "appSettings_stadiaApiKeyRequired": "Stadia Maps の利用に必要です", + "appSettings_stadiaApiKeyConfigured": "設定済み: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Stadia Maps の API キーを入力してください。このアプリはラスタタイルの取得に使用します。", "appSettings_offlineMapCache": "オフライン地図キャッシュ", "appSettings_unitsTitle": "単位", "appSettings_unitsMetric": "メートル法 (m / km)", @@ -970,6 +985,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { diff --git a/lib/l10n/app_ko.arb b/lib/l10n/app_ko.arb index 2ffff877..6147fab8 100644 --- a/lib/l10n/app_ko.arb +++ b/lib/l10n/app_ko.arb @@ -161,6 +161,8 @@ "settings_locationIntervalInvalid": "간격은 최소 60초 이상, 86400초 미만이어야 합니다.", "settings_latitude": "위도", "settings_longitude": "경도", + "settings_autoZeroHopAdvertOnGpsUpdate": "GPS 업데이트 시 제로 홉 광고 자동 전송", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "GPS 위치가 변경되면 제로 홉 광고를 전송합니다(광고에 위치 포함 필요).", "settings_contactSettings": "연락처 설정", "settings_contactSettingsSubtitle": "연락처 추가 방식 설정", "settings_privacyMode": "개인 정보 보호 모드", @@ -332,6 +334,19 @@ "appSettings_last6Hours": "지난 6시간", "appSettings_last24Hours": "지난 24시간", "appSettings_lastWeek": "지난 주", + "appSettings_rasterTileSource": "래스터 타일 소스", + "appSettings_stadiaEndpoint": "Stadia 엔드포인트", + "appSettings_stadiaApiKey": "Stadia API 키", + "appSettings_stadiaApiKeyRequired": "Stadia Maps를 사용하려면 필요합니다", + "appSettings_stadiaApiKeyConfigured": "설정됨: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Stadia Maps API 키를 입력하세요. 이 앱은 래스터 타일 요청에 이 키를 사용합니다.", "appSettings_offlineMapCache": "오프라인 지도 캐시", "appSettings_unitsTitle": "단위", "appSettings_unitsMetric": "미터법 (m / km)", @@ -952,6 +967,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1293,7 +1358,7 @@ "repeater_advancedSettings": "고급", "repeater_advancedSettingsSubtitle": "숙련된 운영자를 위한 조절 노브", "repeater_pathHashMode": "패스 해시 모드", - "repeater_pathHashModeHelper": "이 리피터의 ID를 플러드 경로/루프 감지 태그에 인코딩하는 데 사용되는 바이트 수: 0=1 바이트 (256개의 ID, 최대 64개의 홉), 1=2 바이트 (65,000개의 ID, 최대 32개의 홉), 2=3 바이트 (16백만 개의 ID, 최대 21개의 홉). v1.13 및 이전 버전의 펌웨어는 다중 바이트 경로를 지원하지 않으며, 네트워크가 v1.14 이상으로 업그레이드되면 한 번만 감지합니다.", + "repeater_pathHashModeHelper": "이 리피터의 ID를 플러드 경로/루프 감지 태그에 인코딩하는 데 사용되는 바이트 수입니다. 0=1바이트(256개 ID, 최대 64홉), 1=2바이트(65,000개 ID, 최대 32홉), 2=3바이트(1,600만 개 ID, 최대 21홉). v1.14 이전 펌웨어는 항상 1바이트 경로를 사용했으며, v1.14 이상은 2바이트 또는 3바이트 경로로 설정할 수 있습니다.", "repeater_txDelay": "플러드 TX 지연", "repeater_txDelayHelper": "홍수 시 교통량에 맞춰 재전송 간격을 설정합니다. 이는 패킷의 전송 시간을 곱한 값 (0-2, 기본값 0.5)으로 설정합니다. 값이 클수록 충돌이 줄어들지만 전송 속도가 느려집니다.", "repeater_directTxDelay": "직접적인 TX 지연", diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 800df783..83e5af85 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -784,6 +784,78 @@ abstract class AppLocalizations { /// **'Radio settings updated'** String get settings_radioSettingsUpdated; + /// No description provided for @settings_regionSettings. + /// + /// In en, this message translates to: + /// **'Regions'** + String get settings_regionSettings; + + /// No description provided for @settings_regionSettingsSubtitle. + /// + /// In en, this message translates to: + /// **'Manage stored regions'** + String get settings_regionSettingsSubtitle; + + /// No description provided for @settings_regionManagement_screenTitle. + /// + /// In en, this message translates to: + /// **'Region Management'** + String get settings_regionManagement_screenTitle; + + /// No description provided for @settings_regionNameHint. + /// + /// In en, this message translates to: + /// **'Enter region name'** + String get settings_regionNameHint; + + /// No description provided for @settings_regionAddRegion. + /// + /// In en, this message translates to: + /// **'Add region'** + String get settings_regionAddRegion; + + /// No description provided for @settings_regionFetchRegions. + /// + /// In en, this message translates to: + /// **'Fetch regions from repeaters'** + String get settings_regionFetchRegions; + + /// No description provided for @settings_regionFetchRegionsFail. + /// + /// In en, this message translates to: + /// **'No regions were found'** + String get settings_regionFetchRegionsFail; + + /// No description provided for @settings_regionFetchRegionsAlreadyExists. + /// + /// In en, this message translates to: + /// **'This region has already been added'** + String get settings_regionFetchRegionsAlreadyExists; + + /// No description provided for @settings_regionName. + /// + /// In en, this message translates to: + /// **'Region Name'** + String get settings_regionName; + + /// No description provided for @settings_regionDeleted. + /// + /// In en, this message translates to: + /// **'Region deleted'** + String get settings_regionDeleted; + + /// No description provided for @settings_deleteRegion. + /// + /// In en, this message translates to: + /// **'Delete Region'** + String get settings_deleteRegion; + + /// No description provided for @settings_deleteRegionConfirm. + /// + /// In en, this message translates to: + /// **'Remove \"{region}\" from region list?'** + String settings_deleteRegionConfirm(String region); + /// No description provided for @settings_location. /// /// In en, this message translates to: @@ -958,6 +1030,18 @@ abstract class AppLocalizations { /// **'Include location in advert.'** String get settings_advertLocationSubtitle; + /// No description provided for @settings_autoZeroHopAdvertOnGpsUpdate. + /// + /// In en, this message translates to: + /// **'Auto Zero-Hop Advert On GPS Update'** + String get settings_autoZeroHopAdvertOnGpsUpdate; + + /// No description provided for @settings_autoZeroHopAdvertOnGpsUpdateSubtitle. + /// + /// In en, this message translates to: + /// **'When GPS location changes, send a zero-hop advert (requires Advert Location).'** + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle; + /// No description provided for @settings_multiAck. /// /// In en, this message translates to: @@ -1378,6 +1462,30 @@ abstract class AppLocalizations { /// **'Українська'** String get appSettings_languageUk; + /// No description provided for @repeater_pathHashModeOption0. + /// + /// In en, this message translates to: + /// **'0 - 1 byte'** + String get repeater_pathHashModeOption0; + + /// No description provided for @repeater_pathHashModeOption1. + /// + /// In en, this message translates to: + /// **'1 - 2 bytes'** + String get repeater_pathHashModeOption1; + + /// No description provided for @repeater_pathHashModeOption2. + /// + /// In en, this message translates to: + /// **'2 - 3 bytes'** + String get repeater_pathHashModeOption2; + + /// No description provided for @repeater_pathHashModeOption3. + /// + /// In en, this message translates to: + /// **'3 - 4 bytes'** + String get repeater_pathHashModeOption3; + /// No description provided for @appSettings_enableMessageTracing. /// /// In en, this message translates to: @@ -1720,6 +1828,42 @@ abstract class AppLocalizations { /// **'Last week'** String get appSettings_lastWeek; + /// No description provided for @appSettings_rasterTileSource. + /// + /// In en, this message translates to: + /// **'Raster Tile Source'** + String get appSettings_rasterTileSource; + + /// No description provided for @appSettings_stadiaEndpoint. + /// + /// In en, this message translates to: + /// **'Stadia Endpoint'** + String get appSettings_stadiaEndpoint; + + /// No description provided for @appSettings_stadiaApiKey. + /// + /// In en, this message translates to: + /// **'Stadia API Key'** + String get appSettings_stadiaApiKey; + + /// No description provided for @appSettings_stadiaApiKeyRequired. + /// + /// In en, this message translates to: + /// **'Required for Stadia Maps usage'** + String get appSettings_stadiaApiKeyRequired; + + /// No description provided for @appSettings_stadiaApiKeyConfigured. + /// + /// In en, this message translates to: + /// **'Configured: {maskedKey}'** + String appSettings_stadiaApiKeyConfigured(String maskedKey); + + /// No description provided for @appSettings_stadiaApiKeyDialogDescription. + /// + /// In en, this message translates to: + /// **'Enter your Stadia Maps API key. This app uses it for raster tile requests.'** + String get appSettings_stadiaApiKeyDialogDescription; + /// No description provided for @appSettings_offlineMapCache. /// /// In en, this message translates to: @@ -2458,6 +2602,30 @@ abstract class AppLocalizations { /// **'e.g. #team'** String get channels_hashtagHint; + /// No description provided for @channels_regionSetTo. + /// + /// In en, this message translates to: + /// **'Region: {region}'** + String channels_regionSetTo(String region); + + /// No description provided for @channels_regionNotSet. + /// + /// In en, this message translates to: + /// **'Region: none'** + String get channels_regionNotSet; + + /// No description provided for @channels_regionSelect_Title. + /// + /// In en, this message translates to: + /// **'Select a region'** + String get channels_regionSelect_Title; + + /// No description provided for @channels_clearRegion. + /// + /// In en, this message translates to: + /// **'Clear region'** + String get channels_clearRegion; + /// No description provided for @chat_noMessages. /// /// In en, this message translates to: @@ -2548,6 +2716,12 @@ abstract class AppLocalizations { /// **'Send GIF'** String get chat_sendGif; + /// No description provided for @chat_receivedGif. + /// + /// In en, this message translates to: + /// **'Received a GIF'** + String get chat_receivedGif; + /// No description provided for @chat_reply. /// /// In en, this message translates to: @@ -3700,6 +3874,54 @@ abstract class AppLocalizations { /// **'Failed downloads: {count}'** String mapCache_failedDownloads(int count); + /// No description provided for @mapCache_cachedTilesLabel. + /// + /// In en, this message translates to: + /// **'Cached tiles'** + String get mapCache_cachedTilesLabel; + + /// No description provided for @mapCache_cachedTileSummaryLabel. + /// + /// In en, this message translates to: + /// **'Cached tile summary'** + String get mapCache_cachedTileSummaryLabel; + + /// No description provided for @mapCache_bulkDownloadDisabledForSource. + /// + /// In en, this message translates to: + /// **'Offline bulk downloads are disabled for {source}.'** + String mapCache_bulkDownloadDisabledForSource(String source); + + /// No description provided for @mapCache_bulkDownloadDisabledInConfig. + /// + /// In en, this message translates to: + /// **'Offline bulk downloads are disabled for {source} in this app configuration.'** + String mapCache_bulkDownloadDisabledInConfig(String source); + + /// No description provided for @mapCache_summarySource. + /// + /// In en, this message translates to: + /// **'Source: {source}'** + String mapCache_summarySource(String source); + + /// No description provided for @mapCache_summaryCachedTilesForSource. + /// + /// In en, this message translates to: + /// **'Cached tiles for source: {count}'** + String mapCache_summaryCachedTilesForSource(int count); + + /// No description provided for @mapCache_summaryCachedInSelection. + /// + /// In en, this message translates to: + /// **'Cached in selected area/zoom: {count}'** + String mapCache_summaryCachedInSelection(int count); + + /// No description provided for @mapCache_summaryApproxCacheSize. + /// + /// In en, this message translates to: + /// **'Approx cache size: {size}'** + String mapCache_summaryApproxCacheSize(String size); + /// No description provided for @mapCache_boundsLabel. /// /// In en, this message translates to: @@ -4649,9 +4871,69 @@ abstract class AppLocalizations { /// No description provided for @repeater_pathHashModeHelper. /// /// In en, this message translates to: - /// **'Bytes used to encode this repeater\'s ID in flood path/loop-detect tags. 0=1 byte (256 IDs, up to 64 hops), 1=2 bytes (65K IDs, up to 32 hops), 2=3 bytes (16M IDs, up to 21 hops). v1.13 and older firmware drops multi-byte paths — only raise once your network is on v1.14+.'** + /// **'Bytes used to encode this repeater\'s ID in flood path/loop-detect tags. 0=1 byte (256 IDs, up to 64 hops), 1=2 bytes (65K IDs, up to 32 hops), 2=3 bytes (16M IDs, up to 21 hops). Firmware before v1.14 always used 1-byte paths; v1.14 and newer can be configured for 2- or 3-byte paths.'** String get repeater_pathHashModeHelper; + /// No description provided for @repeater_keySettings. + /// + /// In en, this message translates to: + /// **'Change Identity Keys'** + String get repeater_keySettings; + + /// No description provided for @repeater_keySettingsSubtitle. + /// + /// In en, this message translates to: + /// **'Change the public/private keypair'** + String get repeater_keySettingsSubtitle; + + /// No description provided for @repeater_prvKey. + /// + /// In en, this message translates to: + /// **'Private key'** + String get repeater_prvKey; + + /// No description provided for @repeater_prvKeyHelper. + /// + /// In en, this message translates to: + /// **'A new private key for the repeater, a 128-character hex string.'** + String get repeater_prvKeyHelper; + + /// No description provided for @repeater_generatePrvKey. + /// + /// In en, this message translates to: + /// **'Generate a random keypair'** + String get repeater_generatePrvKey; + + /// No description provided for @repeater_stopGeneratingPrvKey. + /// + /// In en, this message translates to: + /// **'Interrupt search for keypair'** + String get repeater_stopGeneratingPrvKey; + + /// No description provided for @repeater_pubKey. + /// + /// In en, this message translates to: + /// **'Public key'** + String get repeater_pubKey; + + /// No description provided for @repeater_pubKeyHelper. + /// + /// In en, this message translates to: + /// **'This is the public key that goes with the generated private key. You can\'t set this directly.'** + String get repeater_pubKeyHelper; + + /// No description provided for @repeater_pubKeyPrefix. + /// + /// In en, this message translates to: + /// **'Desired prefix'** + String get repeater_pubKeyPrefix; + + /// No description provided for @repeater_pubKeyPrefixHelper. + /// + /// In en, this message translates to: + /// **'Find a public key that starts with these hex digits. Expected tries needed: {tries}.'** + String repeater_pubKeyPrefixHelper(int tries); + /// No description provided for @repeater_txDelay. /// /// In en, this message translates to: @@ -5423,7 +5705,7 @@ abstract class AppLocalizations { /// No description provided for @repeater_cliHelpSetPrvKey. /// /// In en, this message translates to: - /// **'(Serial only) Replaces the device identity private key. Reboot required to apply. Generates a new public key.'** + /// **'Replaces the device identity private key. Reboot required to apply. Generates a new public key.'** String get repeater_cliHelpSetPrvKey; /// No description provided for @repeater_cliHelpSetRadioRxGain. diff --git a/lib/l10n/app_localizations_bg.dart b/lib/l10n/app_localizations_bg.dart index 513c10d3..897f9473 100644 --- a/lib/l10n/app_localizations_bg.dart +++ b/lib/l10n/app_localizations_bg.dart @@ -367,6 +367,45 @@ class AppLocalizationsBg extends AppLocalizations { String get settings_radioSettingsUpdated => 'Радио настройките са актуализирани'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Местоположение'; @@ -467,6 +506,14 @@ class AppLocalizationsBg extends AppLocalizations { String get settings_advertLocationSubtitle => 'Включи местоположение в обявата'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Автоматична zero-hop обява при GPS обновяване'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Когато GPS местоположението се промени, изпрати zero-hop обява (изисква местоположение в обявата).'; + @override String get settings_multiAck => 'Множество ACK'; @@ -694,6 +741,18 @@ class AppLocalizationsBg extends AppLocalizations { @override String get appSettings_languageUk => 'Украински'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Разрешаване на проследяване на съобщения'; @@ -900,6 +959,28 @@ class AppLocalizationsBg extends AppLocalizations { @override String get appSettings_lastWeek => 'Миналата седмица'; + @override + String get appSettings_rasterTileSource => 'Източник на растерни плочки'; + + @override + String get appSettings_stadiaEndpoint => 'Крайна точка на Stadia'; + + @override + String get appSettings_stadiaApiKey => 'API ключ за Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Задължително за използване на Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Конфигурирано: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Въведете своя API ключ за Stadia Maps. Приложението го използва за заявки за растерни плочки.'; + @override String get appSettings_offlineMapCache => 'Кеш на офлайн карти'; @@ -1330,6 +1411,20 @@ class AppLocalizationsBg extends AppLocalizations { @override String get channels_hashtagHint => 'напр. #отбор'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Няма съобщения.'; @@ -1385,6 +1480,9 @@ class AppLocalizationsBg extends AppLocalizations { @override String get chat_sendGif => 'Изпрати GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Отговори'; @@ -2037,6 +2135,42 @@ class AppLocalizationsBg extends AppLocalizations { return 'Неуспешни изтегляния: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2586,6 +2720,41 @@ class AppLocalizationsBg extends AppLocalizations { String get repeater_pathHashModeHelper => 'Байтовете, използвани за кодиране на идентификатора на този повторител в таговете за откриване на потоци/цикли, са: 0=1 байт (256 идентификатора, до 64 скока), 1=2 байта (65 000 идентификатора, до 32 скока), 2=3 байта (16 милиона идентификатора, до 21 скока). Версиите 1.13 и по-старите фърмуери използват многобайтови пътища - само след като мрежата е актуализирана до версия 1.14 или по-нова.'; + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } + @override String get repeater_txDelay => 'Забавяне на Flood TX'; diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart index fdbd1087..95c1c3da 100644 --- a/lib/l10n/app_localizations_de.dart +++ b/lib/l10n/app_localizations_de.dart @@ -369,6 +369,46 @@ class AppLocalizationsDe extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Funkparameter aktualisiert'; + @override + String get settings_regionSettings => 'Regionen'; + + @override + String get settings_regionSettingsSubtitle => + 'Gespeicherte Regionen verwalten'; + + @override + String get settings_regionManagement_screenTitle => 'Regions-Verwaltung'; + + @override + String get settings_regionNameHint => 'Regions-Namen eingeben'; + + @override + String get settings_regionAddRegion => 'Region hinzufügen'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Regions-Name'; + + @override + String get settings_regionDeleted => 'Region entfernt'; + + @override + String get settings_deleteRegion => 'Region entfernen'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Region \"$region\" aus der Liste entfernen?'; + } + @override String get settings_location => 'Ort'; @@ -466,6 +506,14 @@ class AppLocalizationsDe extends AppLocalizations { String get settings_advertLocationSubtitle => 'Standort in die Ankündigung einschließen.'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Automatische Zero-Hop-Ankündigung bei GPS-Update'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Wenn sich der GPS-Standort ändert, eine Zero-Hop-Ankündigung senden (erfordert Standort in der Ankündigung).'; + @override String get settings_multiAck => 'Mehrfach-ACKs'; @@ -690,6 +738,18 @@ class AppLocalizationsDe extends AppLocalizations { @override String get appSettings_languageUk => 'Ukrainisch'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Nachrichtenverfolgung aktivieren'; @@ -896,6 +956,28 @@ class AppLocalizationsDe extends AppLocalizations { @override String get appSettings_lastWeek => 'Letzte Woche'; + @override + String get appSettings_rasterTileSource => 'Quelle für Rasterkacheln'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia-Endpunkt'; + + @override + String get appSettings_stadiaApiKey => 'Stadia-API-Schlüssel'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Für die Nutzung von Stadia Maps erforderlich'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Konfiguriert: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Geben Sie Ihren Stadia-Maps-API-Schlüssel ein. Die App verwendet ihn für Rasterkachel-Anfragen.'; + @override String get appSettings_offlineMapCache => 'Offline-Karten-Cache'; @@ -1329,6 +1411,20 @@ class AppLocalizationsDe extends AppLocalizations { @override String get channels_hashtagHint => 'z.B. #team'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: keine'; + + @override + String get channels_regionSelect_Title => 'Region auswählen'; + + @override + String get channels_clearRegion => 'Region zurücksetzen'; + @override String get chat_noMessages => 'Noch keine Nachrichten.'; @@ -1385,6 +1481,9 @@ class AppLocalizationsDe extends AppLocalizations { @override String get chat_sendGif => 'GIF senden'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Antworten'; @@ -2036,6 +2135,42 @@ class AppLocalizationsDe extends AppLocalizations { return 'Fehlgeschlagene Downloads: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2581,6 +2716,41 @@ class AppLocalizationsDe extends AppLocalizations { String get repeater_pathHashModeHelper => 'Bytes, die zur Kodierung der ID dieses Repeaters in Flood-Pfad-/Schleifen-Erkennung-Tags verwendet werden. 0 = 1 Byte (256 IDs, bis zu 64 Hops), 1 = 2 Bytes (65.000 IDs, bis zu 32 Hops), 2 = 3 Bytes (16 Millionen IDs, bis zu 21 Hops). Firmware-Versionen 1.13 und älter verwenden mehrstellige Pfade – ab Version 1.14+ wird nur ein Pfad erstellt, sobald das Netzwerk aktiv ist.'; + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } + @override String get repeater_txDelay => 'Flood-TX-Verzögerung'; diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 713d0e6e..99b10a2c 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -363,6 +363,45 @@ class AppLocalizationsEn extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Radio settings updated'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Location'; @@ -457,6 +496,14 @@ class AppLocalizationsEn extends AppLocalizations { @override String get settings_advertLocationSubtitle => 'Include location in advert.'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Auto Zero-Hop Advert On GPS Update'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'When GPS location changes, send a zero-hop advert (requires Advert Location).'; + @override String get settings_multiAck => 'Multi-ACKs'; @@ -679,6 +726,18 @@ class AppLocalizationsEn extends AppLocalizations { @override String get appSettings_languageUk => 'Українська'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Enable Message Tracing'; @@ -880,6 +939,28 @@ class AppLocalizationsEn extends AppLocalizations { @override String get appSettings_lastWeek => 'Last week'; + @override + String get appSettings_rasterTileSource => 'Raster Tile Source'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia Endpoint'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API Key'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Required for Stadia Maps usage'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Configured: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Enter your Stadia Maps API key. This app uses it for raster tile requests.'; + @override String get appSettings_offlineMapCache => 'Offline Map Cache'; @@ -1300,6 +1381,20 @@ class AppLocalizationsEn extends AppLocalizations { @override String get channels_hashtagHint => 'e.g. #team'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'No messages yet'; @@ -1355,6 +1450,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get chat_sendGif => 'Send GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Reply'; @@ -1998,6 +2096,42 @@ class AppLocalizationsEn extends AppLocalizations { return 'Failed downloads: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2534,7 +2668,42 @@ class AppLocalizationsEn extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Bytes used to encode this repeater\'s ID in flood path/loop-detect tags. 0=1 byte (256 IDs, up to 64 hops), 1=2 bytes (65K IDs, up to 32 hops), 2=3 bytes (16M IDs, up to 21 hops). v1.13 and older firmware drops multi-byte paths — only raise once your network is on v1.14+.'; + 'Bytes used to encode this repeater\'s ID in flood path/loop-detect tags. 0=1 byte (256 IDs, up to 64 hops), 1=2 bytes (65K IDs, up to 32 hops), 2=3 bytes (16M IDs, up to 21 hops). Firmware before v1.14 always used 1-byte paths; v1.14 and newer can be configured for 2- or 3-byte paths.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Flood TX delay'; @@ -3006,7 +3175,7 @@ class AppLocalizationsEn extends AppLocalizations { @override String get repeater_cliHelpSetPrvKey => - '(Serial only) Replaces the device identity private key. Reboot required to apply. Generates a new public key.'; + 'Replaces the device identity private key. Reboot required to apply. Generates a new public key.'; @override String get repeater_cliHelpSetRadioRxGain => diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart index 991a9faf..e5fa4b67 100644 --- a/lib/l10n/app_localizations_es.dart +++ b/lib/l10n/app_localizations_es.dart @@ -367,6 +367,45 @@ class AppLocalizationsEs extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Ajustes de radio actualizados'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Ubicación'; @@ -464,6 +503,14 @@ class AppLocalizationsEs extends AppLocalizations { @override String get settings_advertLocationSubtitle => 'Incluir ubicación en anuncio'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Anuncio de cero saltos automático al actualizar GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Cuando cambie la ubicación GPS, enviar un anuncio de cero saltos (requiere ubicación en anuncio).'; + @override String get settings_multiAck => 'Múltiples respuestas de confirmación'; @@ -690,6 +737,18 @@ class AppLocalizationsEs extends AppLocalizations { @override String get appSettings_languageUk => 'Ucraniano'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Habilitar seguimiento de mensajes'; @@ -894,6 +953,28 @@ class AppLocalizationsEs extends AppLocalizations { @override String get appSettings_lastWeek => 'La semana pasada'; + @override + String get appSettings_rasterTileSource => 'Fuente de teselas ráster'; + + @override + String get appSettings_stadiaEndpoint => 'Punto de acceso de Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Clave API de Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Obligatorio para usar Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Configurado: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Introduce tu clave API de Stadia Maps. La aplicación la usa para solicitar teselas ráster.'; + @override String get appSettings_offlineMapCache => 'Caché de mapa sin conexión'; @@ -1327,6 +1408,20 @@ class AppLocalizationsEs extends AppLocalizations { @override String get channels_hashtagHint => 'ej. #equipo'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Aún no hay mensajes'; @@ -1382,6 +1477,9 @@ class AppLocalizationsEs extends AppLocalizations { @override String get chat_sendGif => 'Enviar GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Responder'; @@ -2031,6 +2129,42 @@ class AppLocalizationsEs extends AppLocalizations { return 'Descargas fallidas: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2581,6 +2715,41 @@ class AppLocalizationsEs extends AppLocalizations { String get repeater_pathHashModeHelper => 'Bytes utilizados para codificar el ID de este repetidor en las etiquetas de ruta/detección de bucles. 0=1 byte (256 IDs, hasta 64 saltos), 1=2 bytes (65.000 IDs, hasta 32 saltos), 2=3 bytes (16 millones de IDs, hasta 21 saltos). Las versiones 1.13 y anteriores de firmware eliminan rutas de múltiples bytes; solo se detectan una vez que la red está activa en la versión 1.14 o posterior.'; + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } + @override String get repeater_txDelay => 'Retraso TX por inundación'; diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart index 9214098d..b956a0ce 100644 --- a/lib/l10n/app_localizations_fr.dart +++ b/lib/l10n/app_localizations_fr.dart @@ -369,6 +369,45 @@ class AppLocalizationsFr extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Paramètres radio mis à jour'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Emplacement'; @@ -468,6 +507,14 @@ class AppLocalizationsFr extends AppLocalizations { String get settings_advertLocationSubtitle => 'Inclure la localisation dans l\'annonce'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Annonce zéro saut automatique lors de la mise à jour GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Lorsque la position GPS change, envoyer une annonce zéro saut (nécessite la position dans l\'annonce).'; + @override String get settings_multiAck => 'Plusieurs accusés de réception'; @@ -694,6 +741,18 @@ class AppLocalizationsFr extends AppLocalizations { @override String get appSettings_languageUk => 'Ukrainien'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Activer le traçage des messages'; @@ -898,6 +957,28 @@ class AppLocalizationsFr extends AppLocalizations { @override String get appSettings_lastWeek => 'La semaine dernière'; + @override + String get appSettings_rasterTileSource => 'Source de tuiles raster'; + + @override + String get appSettings_stadiaEndpoint => 'Point de terminaison Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Clé API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Requis pour l’utilisation de Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Configuré : $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Entrez votre clé API Stadia Maps. Cette application l’utilise pour les requêtes de tuiles raster.'; + @override String get appSettings_offlineMapCache => 'Cache de carte hors ligne'; @@ -1329,6 +1410,20 @@ class AppLocalizationsFr extends AppLocalizations { @override String get channels_hashtagHint => 'ex. #equipe'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Aucun message pour le moment'; @@ -1384,6 +1479,9 @@ class AppLocalizationsFr extends AppLocalizations { @override String get chat_sendGif => 'Envoyer un GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Répondre'; @@ -2038,6 +2136,42 @@ class AppLocalizationsFr extends AppLocalizations { return 'Téléchargements échoués : $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2592,6 +2726,41 @@ class AppLocalizationsFr extends AppLocalizations { String get repeater_pathHashModeHelper => 'Octets utilisés pour encoder l\'ID de ce routeur dans les balises de détection de flux/boucles. 0 = 1 octet (256 ID, jusqu\'à 64 sauts), 1 = 2 octets (65 000 ID, jusqu\'à 32 sauts), 2 = 3 octets (16 millions d\'ID, jusqu\'à 21 sauts). Les versions 1.13 et antérieures utilisent des chemins multi-octets ; à partir de la version 1.14, cela n\'est plus nécessaire.'; + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } + @override String get repeater_txDelay => 'Délai de transmission en flood'; diff --git a/lib/l10n/app_localizations_hu.dart b/lib/l10n/app_localizations_hu.dart index 47a00327..b8bf35fa 100644 --- a/lib/l10n/app_localizations_hu.dart +++ b/lib/l10n/app_localizations_hu.dart @@ -365,6 +365,45 @@ class AppLocalizationsHu extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'A rádió beállításai frissítve'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'hely'; @@ -463,6 +502,14 @@ class AppLocalizationsHu extends AppLocalizations { String get settings_advertLocationSubtitle => 'A hirdetésben szerepeljen a helyszín.'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Automatikus zero-hop hirdetés GPS-frissítéskor'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Ha a GPS-helyzet megváltozik, küldjön zero-hop hirdetést (a hirdetésben helymegadás szükséges).'; + @override String get settings_multiAck => 'Multi-ACK'; @@ -689,6 +736,18 @@ class AppLocalizationsHu extends AppLocalizations { @override String get appSettings_languageUk => 'Українська'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Üzenetkövetés engedélyezése'; @@ -890,6 +949,28 @@ class AppLocalizationsHu extends AppLocalizations { @override String get appSettings_lastWeek => 'Múlt héten'; + @override + String get appSettings_rasterTileSource => 'Raszteres csempeforrás'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia végpont'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API-kulcs'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'A Stadia Maps használatához kötelező'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Konfigurálva: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Adja meg a Stadia Maps API-kulcsát. Az alkalmazás ezt használja raszteres csempekérésekhez.'; + @override String get appSettings_offlineMapCache => 'Offline térképgyorsítótár'; @@ -1322,6 +1403,20 @@ class AppLocalizationsHu extends AppLocalizations { @override String get channels_hashtagHint => 'például #csapat'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Még nincsenek üzenetek'; @@ -1377,6 +1472,9 @@ class AppLocalizationsHu extends AppLocalizations { @override String get chat_sendGif => 'GIF küldése'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Válasz'; @@ -2029,6 +2127,42 @@ class AppLocalizationsHu extends AppLocalizations { return 'Sikertelen letöltések: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2575,6 +2709,41 @@ class AppLocalizationsHu extends AppLocalizations { String get repeater_pathHashModeHelper => 'Az átjátszó azonosítójának elárasztási útvonal/hurokészlelési címkékbe való kódolására használt bájtok. 0 = 1 bájt (256 azonosító, legfeljebb 64 ugrás), 1 = 2 bájt (65 000 azonosító, legfeljebb 32 ugrás), 2 = 3 bájt (16 millió azonosító, legfeljebb 21 ugrás). A v1.13 és régebbi firmware eldobja a többbájtos elérési utat – csak akkor emelje meg, ha a hálózat a v1.14+ verziót használja.'; + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } + @override String get repeater_txDelay => 'Áradási TX késleltetés'; diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart index f27a16c0..57148909 100644 --- a/lib/l10n/app_localizations_it.dart +++ b/lib/l10n/app_localizations_it.dart @@ -369,6 +369,45 @@ class AppLocalizationsIt extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Impostazioni radio aggiornate'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Posizione'; @@ -468,6 +507,14 @@ class AppLocalizationsIt extends AppLocalizations { String get settings_advertLocationSubtitle => 'Includi la posizione nell\'annuncio'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Annuncio zero-hop automatico all\'aggiornamento GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Quando la posizione GPS cambia, invia un annuncio zero-hop (richiede la posizione nell\'annuncio).'; + @override String get settings_multiAck => 'ACK multipli'; @@ -692,6 +739,18 @@ class AppLocalizationsIt extends AppLocalizations { @override String get appSettings_languageUk => 'Ucraino'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Abilita tracciamento messaggi'; @@ -897,6 +956,28 @@ class AppLocalizationsIt extends AppLocalizations { @override String get appSettings_lastWeek => 'La settimana scorsa'; + @override + String get appSettings_rasterTileSource => 'Sorgente tile raster'; + + @override + String get appSettings_stadiaEndpoint => 'Endpoint Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Chiave API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Obbligatoria per usare Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Configurata: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Inserisci la chiave API di Stadia Maps. Questa app la usa per le richieste di tile raster.'; + @override String get appSettings_offlineMapCache => 'Cache Mappa Offline'; @@ -1328,6 +1409,20 @@ class AppLocalizationsIt extends AppLocalizations { @override String get channels_hashtagHint => 'es. #team'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Nessun messaggio ancora'; @@ -1383,6 +1478,9 @@ class AppLocalizationsIt extends AppLocalizations { @override String get chat_sendGif => 'Invia GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Rispondi'; @@ -2033,6 +2131,42 @@ class AppLocalizationsIt extends AppLocalizations { return 'Download falliti: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2581,7 +2715,42 @@ class AppLocalizationsIt extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Byte utilizzati per codificare l\'ID di questo ripetitore nei tag per il rilevamento del percorso/loop. 0=1 byte (256 ID, fino a 64 salti), 1=2 byte (65.000 ID, fino a 32 salti), 2=3 byte (16 milioni di ID, fino a 21 salti). Le versioni 1.13 e precedenti utilizzano percorsi multi-byte: è necessario attivare la rete prima di utilizzare questa funzionalità (a partire dalla versione 1.14).'; + 'Byte utilizzati per codificare l\'ID di questo ripetitore nei tag di percorso flood/rilevamento loop. 0=1 byte (256 ID, fino a 64 salti), 1=2 byte (65.000 ID, fino a 32 salti), 2=3 byte (16 milioni di ID, fino a 21 salti). Il firmware precedente alla v1.14 usava sempre percorsi a 1 byte; v1.14 e versioni successive possono essere configurate per percorsi a 2 o 3 byte.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Ritardo a Flood, TX'; diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart index 8fc53844..4d306722 100644 --- a/lib/l10n/app_localizations_ja.dart +++ b/lib/l10n/app_localizations_ja.dart @@ -353,6 +353,45 @@ class AppLocalizationsJa extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'ラジオの設定が更新されました'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => '場所'; @@ -443,6 +482,13 @@ class AppLocalizationsJa extends AppLocalizations { @override String get settings_advertLocationSubtitle => '広告に場所を記載してください。'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => 'GPS更新時にゼロホップ広告を自動送信'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'GPS位置が変化したときにゼロホップ広告を送信します(広告への位置情報の含有が必要)。'; + @override String get settings_multiAck => 'マルチ ACK'; @@ -663,6 +709,18 @@ class AppLocalizationsJa extends AppLocalizations { @override String get appSettings_languageUk => 'ウクライナ語'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'メッセージ追跡を有効にする'; @@ -845,6 +903,27 @@ class AppLocalizationsJa extends AppLocalizations { @override String get appSettings_lastWeek => '過去1週間'; + @override + String get appSettings_rasterTileSource => 'ラスタタイルのソース'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia エンドポイント'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API キー'; + + @override + String get appSettings_stadiaApiKeyRequired => 'Stadia Maps の利用に必要です'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return '設定済み: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Stadia Maps の API キーを入力してください。このアプリはラスタタイルの取得に使用します。'; + @override String get appSettings_offlineMapCache => 'オフライン地図キャッシュ'; @@ -1259,6 +1338,20 @@ class AppLocalizationsJa extends AppLocalizations { @override String get channels_hashtagHint => '例:#チーム'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'まだメッセージは届いていません'; @@ -1314,6 +1407,9 @@ class AppLocalizationsJa extends AppLocalizations { @override String get chat_sendGif => 'GIF を送信'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => '返信'; @@ -1946,6 +2042,42 @@ class AppLocalizationsJa extends AppLocalizations { return '失敗したダウンロード: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2466,6 +2598,41 @@ class AppLocalizationsJa extends AppLocalizations { 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以降のバージョンでは、一度ネットワークが起動されると、パスが一度だけ検出されます。'; + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } + @override String get repeater_txDelay => 'フロイド・TXでの遅延'; diff --git a/lib/l10n/app_localizations_ko.dart b/lib/l10n/app_localizations_ko.dart index 112309e7..0c90ebfc 100644 --- a/lib/l10n/app_localizations_ko.dart +++ b/lib/l10n/app_localizations_ko.dart @@ -353,6 +353,45 @@ class AppLocalizationsKo extends AppLocalizations { @override String get settings_radioSettingsUpdated => '라디오 설정이 업데이트되었습니다.'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => '위치'; @@ -444,6 +483,14 @@ class AppLocalizationsKo extends AppLocalizations { @override String get settings_advertLocationSubtitle => '광고에 위치 정보를 포함하세요.'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'GPS 업데이트 시 제로 홉 광고 자동 전송'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'GPS 위치가 변경되면 제로 홉 광고를 전송합니다(광고에 위치 포함 필요).'; + @override String get settings_multiAck => '다중 ACK'; @@ -663,6 +710,18 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_languageUk => '우크라이나어'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => '메시지 추적 기능 활성화'; @@ -847,6 +906,27 @@ class AppLocalizationsKo extends AppLocalizations { @override String get appSettings_lastWeek => '지난 주'; + @override + String get appSettings_rasterTileSource => '래스터 타일 소스'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia 엔드포인트'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API 키'; + + @override + String get appSettings_stadiaApiKeyRequired => 'Stadia Maps를 사용하려면 필요합니다'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return '설정됨: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Stadia Maps API 키를 입력하세요. 이 앱은 래스터 타일 요청에 이 키를 사용합니다.'; + @override String get appSettings_offlineMapCache => '오프라인 지도 캐시'; @@ -1261,6 +1341,20 @@ class AppLocalizationsKo extends AppLocalizations { @override String get channels_hashtagHint => '예: #팀'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => '아직 메시지가 없습니다.'; @@ -1316,6 +1410,9 @@ class AppLocalizationsKo extends AppLocalizations { @override String get chat_sendGif => 'GIF 보내기'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => '답변'; @@ -1949,6 +2046,42 @@ class AppLocalizationsKo extends AppLocalizations { return '실패한 다운로드: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2469,7 +2602,42 @@ class AppLocalizationsKo extends AppLocalizations { @override String get repeater_pathHashModeHelper => - '이 리피터의 ID를 플러드 경로/루프 감지 태그에 인코딩하는 데 사용되는 바이트 수: 0=1 바이트 (256개의 ID, 최대 64개의 홉), 1=2 바이트 (65,000개의 ID, 최대 32개의 홉), 2=3 바이트 (16백만 개의 ID, 최대 21개의 홉). v1.13 및 이전 버전의 펌웨어는 다중 바이트 경로를 지원하지 않으며, 네트워크가 v1.14 이상으로 업그레이드되면 한 번만 감지합니다.'; + '이 리피터의 ID를 플러드 경로/루프 감지 태그에 인코딩하는 데 사용되는 바이트 수입니다. 0=1바이트(256개 ID, 최대 64홉), 1=2바이트(65,000개 ID, 최대 32홉), 2=3바이트(1,600만 개 ID, 최대 21홉). v1.14 이전 펌웨어는 항상 1바이트 경로를 사용했으며, v1.14 이상은 2바이트 또는 3바이트 경로로 설정할 수 있습니다.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => '플러드 TX 지연'; diff --git a/lib/l10n/app_localizations_nl.dart b/lib/l10n/app_localizations_nl.dart index 47a21c92..6dc38432 100644 --- a/lib/l10n/app_localizations_nl.dart +++ b/lib/l10n/app_localizations_nl.dart @@ -365,6 +365,45 @@ class AppLocalizationsNl extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Radio instellingen bijgewerkt'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Locatie'; @@ -462,6 +501,14 @@ class AppLocalizationsNl extends AppLocalizations { String get settings_advertLocationSubtitle => 'Locatie opnemen in advertentie'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Automatische zero-hop-advertentie bij GPS-update'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Wanneer de GPS-locatie verandert, een zero-hop-advertentie verzenden (vereist locatie in advertentie).'; + @override String get settings_multiAck => 'Meerdere bevestigingen'; @@ -686,6 +733,18 @@ class AppLocalizationsNl extends AppLocalizations { @override String get appSettings_languageUk => 'Oekraïens'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Berichttracking inschakelen'; @@ -889,6 +948,28 @@ class AppLocalizationsNl extends AppLocalizations { @override String get appSettings_lastWeek => 'Afgelopen week'; + @override + String get appSettings_rasterTileSource => 'Rastertegelbron'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia-eindpunt'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API-sleutel'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Vereist voor gebruik van Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Geconfigureerd: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Voer je Stadia Maps API-sleutel in. De app gebruikt die voor rastertegelverzoeken.'; + @override String get appSettings_offlineMapCache => 'Offline Kaartcache'; @@ -1316,6 +1397,20 @@ class AppLocalizationsNl extends AppLocalizations { @override String get channels_hashtagHint => 'bijv. #team'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Nog geen berichten.'; @@ -1371,6 +1466,9 @@ class AppLocalizationsNl extends AppLocalizations { @override String get chat_sendGif => 'GIF verzenden'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Reageren'; @@ -2021,6 +2119,42 @@ class AppLocalizationsNl extends AppLocalizations { return 'Mislukte downloads: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2562,7 +2696,42 @@ class AppLocalizationsNl extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Bytes die gebruikt worden om de ID van deze repeater te coderen in flood-pad/lusdetectietags. 0=1 byte (256 ID\'s, tot 64 hops), 1=2 bytes (65.000 ID\'s, tot 32 hops), 2=3 bytes (16 miljoen ID\'s, tot 21 hops). Versies 1.13 en ouder gebruiken multi-byte paden – alleen na het activeren van het netwerk.'; + 'Bytes die gebruikt worden om de ID van deze repeater te coderen in flood-pad/lusdetectietags. 0=1 byte (256 ID\'s, tot 64 hops), 1=2 bytes (65.000 ID\'s, tot 32 hops), 2=3 bytes (16 miljoen ID\'s, tot 21 hops). Firmware vóór v1.14 gebruikte altijd 1-byte paden; v1.14 en nieuwer kunnen worden ingesteld op 2- of 3-byte paden.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Vertraging bij Flood TX'; diff --git a/lib/l10n/app_localizations_pl.dart b/lib/l10n/app_localizations_pl.dart index 2f6161d2..c9af811a 100644 --- a/lib/l10n/app_localizations_pl.dart +++ b/lib/l10n/app_localizations_pl.dart @@ -371,6 +371,45 @@ class AppLocalizationsPl extends AppLocalizations { String get settings_radioSettingsUpdated => 'Ustawienia radia zostały zaktualizowane'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Lokalizacja'; @@ -469,6 +508,14 @@ class AppLocalizationsPl extends AppLocalizations { String get settings_advertLocationSubtitle => 'Uwzględnij lokalizację w ogłoszeniu'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Automatyczne ogłoszenie zero-hop przy aktualizacji GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Gdy lokalizacja GPS się zmieni, wyślij ogłoszenie zero-hop (wymaga lokalizacji w ogłoszeniu).'; + @override String get settings_multiAck => 'Wielokrotne potwierdzenia odbioru'; @@ -695,6 +742,18 @@ class AppLocalizationsPl extends AppLocalizations { @override String get appSettings_languageUk => 'Ukraińska'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Włącz śledzenie wiadomości'; @@ -898,6 +957,28 @@ class AppLocalizationsPl extends AppLocalizations { @override String get appSettings_lastWeek => 'Ostatni tydzień'; + @override + String get appSettings_rasterTileSource => 'Źródło kafelków rastrowych'; + + @override + String get appSettings_stadiaEndpoint => 'Punkt końcowy Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Klucz API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Wymagane do korzystania ze Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Skonfigurowano: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Wprowadź swój klucz API Stadia Maps. Aplikacja używa go do żądań kafelków rastrowych.'; + @override String get appSettings_offlineMapCache => 'Pamięć podręczna map offline'; @@ -1338,6 +1419,20 @@ class AppLocalizationsPl extends AppLocalizations { @override String get channels_hashtagHint => 'np. #zespół'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Brak jeszcze wiadomości'; @@ -1394,6 +1489,9 @@ class AppLocalizationsPl extends AppLocalizations { @override String get chat_sendGif => 'Wyślij GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Odpowiedz'; @@ -2051,6 +2149,42 @@ class AppLocalizationsPl extends AppLocalizations { return 'Nieudane pobrania: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2595,7 +2729,42 @@ class AppLocalizationsPl extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Bity wykorzystywane do kodowania identyfikatora tego urządzenia w tagach ścieżek/detekcji pętli. 0=1 bity (256 identyfikatorów, do 64 skoków), 1=2 bity (65 000 identyfikatorów, do 32 skoków), 2=3 bity (1 600 000 identyfikatorów, do 21 skoków). Wersje 1.13 i wcześniejsze nie obsługują ścieżek wielobitowych – wykrywają tylko jedną, gdy sieć jest w wersji 1.14 lub nowszej.'; + 'Bajty używane do kodowania identyfikatora tego repeatera w tagach ścieżki flood/wykrywania pętli. 0=1 bajt (256 identyfikatorów, do 64 skoków), 1=2 bajty (65 000 identyfikatorów, do 32 skoków), 2=3 bajty (16 milionów identyfikatorów, do 21 skoków). Firmware sprzed v1.14 zawsze używał ścieżek 1-bajtowych; v1.14 i nowsze można skonfigurować na ścieżki 2- lub 3-bajtowe.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Opóźnienie w Flood, TX'; diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart index f1d30504..33edd4e2 100644 --- a/lib/l10n/app_localizations_pt.dart +++ b/lib/l10n/app_localizations_pt.dart @@ -369,6 +369,45 @@ class AppLocalizationsPt extends AppLocalizations { String get settings_radioSettingsUpdated => 'Configurações de rádio atualizadas'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Localização'; @@ -466,6 +505,14 @@ class AppLocalizationsPt extends AppLocalizations { String get settings_advertLocationSubtitle => 'Incluir localização no anúncio'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Anúncio zero-hop automático na atualização do GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Quando a localização GPS mudar, enviar um anúncio zero-hop (requer localização no anúncio).'; + @override String get settings_multiAck => 'Multi-ACKs'; @@ -692,6 +739,18 @@ class AppLocalizationsPt extends AppLocalizations { @override String get appSettings_languageUk => 'Ucraniano'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Ativar rastreamento de mensagens'; @@ -895,6 +954,28 @@ class AppLocalizationsPt extends AppLocalizations { @override String get appSettings_lastWeek => 'Da última semana'; + @override + String get appSettings_rasterTileSource => 'Fonte de blocos raster'; + + @override + String get appSettings_stadiaEndpoint => 'Endpoint da Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Chave da API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Obrigatório para usar o Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Configurado: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Insira sua chave da API Stadia Maps. O aplicativo a usa para solicitações de blocos raster.'; + @override String get appSettings_offlineMapCache => 'Cache de Mapa Offline'; @@ -1326,6 +1407,20 @@ class AppLocalizationsPt extends AppLocalizations { @override String get channels_hashtagHint => 'ex. #equipe'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Ainda não existem mensagens.'; @@ -1381,6 +1476,9 @@ class AppLocalizationsPt extends AppLocalizations { @override String get chat_sendGif => 'Enviar GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Responder'; @@ -2034,6 +2132,42 @@ class AppLocalizationsPt extends AppLocalizations { return 'Downloads falhas: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2580,7 +2714,42 @@ class AppLocalizationsPt extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Bytes utilizados para codificar o ID deste repetidor nas tags de caminho/detecção de loop. 0=1 byte (256 IDs, até 64 saltos), 1=2 bytes (65.000 IDs, até 32 saltos), 2=3 bytes (16 milhões de IDs, até 21 saltos). As versões 1.13 e anteriores do firmware não suportam caminhos multi-byte — apenas funcionam uma vez após a ativação da rede (a partir da versão 1.14+).'; + 'Bytes usados para codificar o ID deste repetidor nas tags de caminho flood/detecção de loop. 0=1 byte (256 IDs, até 64 saltos), 1=2 bytes (65.000 IDs, até 32 saltos), 2=3 bytes (16 milhões de IDs, até 21 saltos). O firmware anterior à v1.14 sempre usava caminhos de 1 byte; v1.14 e versões mais recentes podem ser configuradas para caminhos de 2 ou 3 bytes.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Atraso na entrega em Flood, TX'; diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart index 4d3d03bf..b45a3f64 100644 --- a/lib/l10n/app_localizations_ru.dart +++ b/lib/l10n/app_localizations_ru.dart @@ -368,6 +368,45 @@ class AppLocalizationsRu extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Настройки радио обновлены'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Позиция'; @@ -466,6 +505,14 @@ class AppLocalizationsRu extends AppLocalizations { String get settings_advertLocationSubtitle => 'Включить местоположение в объявление'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Авто-объявление без хопов при обновлении GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Когда GPS-местоположение меняется, отправлять объявление без хопов (требуется геопозиция в объявлении).'; + @override String get settings_multiAck => 'Несколько подтверждений'; @@ -692,6 +739,18 @@ class AppLocalizationsRu extends AppLocalizations { @override String get appSettings_languageUk => 'Українська'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Включить трассировку сообщений'; @@ -898,6 +957,28 @@ class AppLocalizationsRu extends AppLocalizations { @override String get appSettings_lastWeek => 'Последнюю неделю'; + @override + String get appSettings_rasterTileSource => 'Источник растровых тайлов'; + + @override + String get appSettings_stadiaEndpoint => 'Конечная точка Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Ключ API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Требуется для использования Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Настроено: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Введите свой ключ API Stadia Maps. Приложение использует его для запросов растровых тайлов.'; + @override String get appSettings_offlineMapCache => 'Кэш офлайн-карты'; @@ -1327,6 +1408,20 @@ class AppLocalizationsRu extends AppLocalizations { @override String get channels_hashtagHint => 'например, #команда'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Сообщений пока нет'; @@ -1382,6 +1477,9 @@ class AppLocalizationsRu extends AppLocalizations { @override String get chat_sendGif => 'Отправить GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Ответить'; @@ -2038,6 +2136,42 @@ class AppLocalizationsRu extends AppLocalizations { return 'Неудачных загрузок: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2585,7 +2719,42 @@ class AppLocalizationsRu extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Байты, используемые для кодирования идентификатора этого ретранслятора в тегах для обнаружения потоков/циклов. 0 = 1 байт (256 идентификаторов, до 64 переходов), 1 = 2 байта (65 000 идентификаторов, до 32 переходов), 2 = 3 байта (1 600 000 идентификаторов, до 21 перехода). Версии прошивки v1.13 и более ранние версии не поддерживают многобайтовые пути — они поднимаются только после того, как ваша сеть будет обновлена до версии v1.14 и выше.'; + 'Байты, используемые для кодирования идентификатора этого ретранслятора в тегах flood-маршрута/обнаружения циклов. 0 = 1 байт (256 идентификаторов, до 64 переходов), 1 = 2 байта (65 000 идентификаторов, до 32 переходов), 2 = 3 байта (16 миллионов идентификаторов, до 21 перехода). Прошивки до v1.14 всегда использовали 1-байтовые маршруты; v1.14 и новее можно настроить на 2- или 3-байтовые маршруты.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Задержка в работе системы Flood TX'; diff --git a/lib/l10n/app_localizations_sk.dart b/lib/l10n/app_localizations_sk.dart index 77342ab1..844bb003 100644 --- a/lib/l10n/app_localizations_sk.dart +++ b/lib/l10n/app_localizations_sk.dart @@ -367,6 +367,45 @@ class AppLocalizationsSk extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Nastavenia rádia aktualizované'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Lokalita'; @@ -460,6 +499,14 @@ class AppLocalizationsSk extends AppLocalizations { @override String get settings_advertLocationSubtitle => 'Zahrnúť polohu do inzerátu'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Automatický zero-hop inzerát pri aktualizácii GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Keď sa GPS poloha zmení, odoslať zero-hop inzerát (vyžaduje polohu v inzeráte).'; + @override String get settings_multiAck => 'Viaceré ACK'; @@ -686,6 +733,18 @@ class AppLocalizationsSk extends AppLocalizations { @override String get appSettings_languageUk => 'Ukrajinská'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Povoliť sledovanie správ'; @@ -885,6 +944,28 @@ class AppLocalizationsSk extends AppLocalizations { @override String get appSettings_lastWeek => 'Minul týždeň'; + @override + String get appSettings_rasterTileSource => 'Zdroj rastrových dlaždíc'; + + @override + String get appSettings_stadiaEndpoint => 'Koncový bod Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Kľúč API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Vyžaduje sa na používanie Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Nakonfigurované: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Zadajte svoj kľúč API pre Stadia Maps. Aplikácia ho používa na požiadavky na rastrové dlaždice.'; + @override String get appSettings_offlineMapCache => 'Offline Mapa Pamäť'; @@ -1316,6 +1397,20 @@ class AppLocalizationsSk extends AppLocalizations { @override String get channels_hashtagHint => 'napr. #tím'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Zatiaľ žiadne správy.'; @@ -1371,6 +1466,9 @@ class AppLocalizationsSk extends AppLocalizations { @override String get chat_sendGif => 'Odoslať GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Odpovedať'; @@ -2024,6 +2122,42 @@ class AppLocalizationsSk extends AppLocalizations { return 'Neúspešné stiahnutia: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2566,7 +2700,42 @@ class AppLocalizationsSk extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Byty použité na zakódovanie ID tohto opakovača v tagoch pre trasu/detekciu slučky. 0 = 1 bytu (256 ID, až 64 skokov), 1 = 2 byty (65 000 ID, až 32 skokov), 2 = 3 byty (16 miliónov ID, až 21 skokov). Verzie 1.13 a staršie nepodporujú viacbytové trasy – fungujú len, keď je sieť aktivovaná.'; + 'Bajty použité na zakódovanie ID tohto opakovača v tagoch flood trasy/detekcie slučky. 0=1 bajt (256 ID, až 64 skokov), 1=2 bajty (65 000 ID, až 32 skokov), 2=3 bajty (16 miliónov ID, až 21 skokov). Firmvér pred v1.14 vždy používal 1-bajtové trasy; v1.14 a novšie možno nakonfigurovať na 2- alebo 3-bajtové trasy.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Zpoždanie v Flood, TX'; diff --git a/lib/l10n/app_localizations_sl.dart b/lib/l10n/app_localizations_sl.dart index a6544c43..02221cca 100644 --- a/lib/l10n/app_localizations_sl.dart +++ b/lib/l10n/app_localizations_sl.dart @@ -366,6 +366,45 @@ class AppLocalizationsSl extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Radio nastavitve posodobljene'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Lokacija'; @@ -461,6 +500,14 @@ class AppLocalizationsSl extends AppLocalizations { @override String get settings_advertLocationSubtitle => 'Vključi lokacijo v oglas.'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Samodejni zero-hop oglas ob posodobitvi GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Ko se GPS lokacija spremeni, pošlji zero-hop oglas (zahteva lokacijo v oglasu).'; + @override String get settings_multiAck => 'Več potrdil'; @@ -684,6 +731,18 @@ class AppLocalizationsSl extends AppLocalizations { @override String get appSettings_languageUk => 'Ukrajinsko'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Omogoči sledenje sporočilom'; @@ -886,6 +945,28 @@ class AppLocalizationsSl extends AppLocalizations { @override String get appSettings_lastWeek => 'Prejšnji teden'; + @override + String get appSettings_rasterTileSource => 'Vir rastrskih ploščic'; + + @override + String get appSettings_stadiaEndpoint => 'Končna točka Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Ključ API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Obvezno za uporabo Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Nastavljeno: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Vnesite svoj ključ API za Stadia Maps. Aplikacija ga uporablja za zahteve rastrskih ploščic.'; + @override String get appSettings_offlineMapCache => 'Shramba zemljevidov brez povezave'; @@ -1314,6 +1395,20 @@ class AppLocalizationsSl extends AppLocalizations { @override String get channels_hashtagHint => 'npr. #ekipa'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Še ni sporočil.'; @@ -1370,6 +1465,9 @@ class AppLocalizationsSl extends AppLocalizations { @override String get chat_sendGif => 'Pošlji GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Odgovori'; @@ -2021,6 +2119,42 @@ class AppLocalizationsSl extends AppLocalizations { return 'Poslovniški izniki: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2562,7 +2696,42 @@ class AppLocalizationsSl extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Biti, ki so bila uporabljena za kodiranje ID-ja tega releja v oznakah za zaznavanje pot/kroga, imajo naslednje velikosti: 0=1 bit (256 ID-jev, do 64 skokov), 1=2 biti (65.000 ID-jev, do 32 skokov), 2=3 biti (16 milijonov ID-jev, do 21 skokov). V različicah 1.13 in starejših se ustvarjajo večbitne poti – vendar se to zgodi šele, ko je omrežje vklopljeno v različicah 1.14 in kasnejših.'; + 'Bajti, uporabljeni za kodiranje ID-ja tega repetitorja v oznakah flood poti/zaznavanja zank. 0=1 bajt (256 ID-jev, do 64 skokov), 1=2 bajta (65.000 ID-jev, do 32 skokov), 2=3 bajti (16 milijonov ID-jev, do 21 skokov). Vdelana programska oprema pred v1.14 je vedno uporabljala 1-bajtne poti; v1.14 in novejše je mogoče nastaviti na 2- ali 3-bajtne poti.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Zatemnitevanje zaradi poplav v Texasu'; diff --git a/lib/l10n/app_localizations_sv.dart b/lib/l10n/app_localizations_sv.dart index c00bb3d0..f54b20a3 100644 --- a/lib/l10n/app_localizations_sv.dart +++ b/lib/l10n/app_localizations_sv.dart @@ -365,6 +365,45 @@ class AppLocalizationsSv extends AppLocalizations { String get settings_radioSettingsUpdated => 'Radioinställningarna har uppdaterats'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Plats'; @@ -458,6 +497,14 @@ class AppLocalizationsSv extends AppLocalizations { @override String get settings_advertLocationSubtitle => 'Inkludera plats i annonsen'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Automatisk zero-hop-annons vid GPS-uppdatering'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'När GPS-positionen ändras, skicka en zero-hop-annons (kräver plats i annonsen).'; + @override String get settings_multiAck => 'Flera bekräftelser'; @@ -681,6 +728,18 @@ class AppLocalizationsSv extends AppLocalizations { @override String get appSettings_languageUk => 'Ukrainska'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Aktivera meddelandespårning'; @@ -879,6 +938,28 @@ class AppLocalizationsSv extends AppLocalizations { @override String get appSettings_lastWeek => 'Förra veckan'; + @override + String get appSettings_rasterTileSource => 'Källa för rasterplattor'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia-slutpunkt'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API-nyckel'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Krävs för att använda Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Konfigurerad: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Ange din Stadia Maps API-nyckel. Appen använder den för förfrågningar om rasterplattor.'; + @override String get appSettings_offlineMapCache => 'Offline Kartcache'; @@ -1306,6 +1387,20 @@ class AppLocalizationsSv extends AppLocalizations { @override String get channels_hashtagHint => 't.ex. #team'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Inga meddelanden ännu'; @@ -1363,6 +1458,9 @@ class AppLocalizationsSv extends AppLocalizations { @override String get chat_sendGif => 'Skicka GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Svara'; @@ -2009,6 +2107,42 @@ class AppLocalizationsSv extends AppLocalizations { return 'Misslyckade nedladdningar: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2550,7 +2684,42 @@ class AppLocalizationsSv extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Byte används för att koda denna repeaters ID i taggar för att upptäcka loopar/flödesvägar. 0=1 byte (256 ID:n, upp till 64 hopp), 1=2 byte (65 000 ID:n, upp till 32 hopp), 2=3 byte (16 miljoner ID:n, upp till 21 hopp). Versioner 1.13 och äldre har stöd för multi-byte-vägar – endast en gång när nätverket är aktiverat (från och med version 1.14).'; + 'Byte som används för att koda denna repeaters ID i taggar för flood-väg/loopdetektering. 0=1 byte (256 ID:n, upp till 64 hopp), 1=2 byte (65 000 ID:n, upp till 32 hopp), 2=3 byte (16 miljoner ID:n, upp till 21 hopp). Firmware före v1.14 använde alltid 1-byte-vägar; v1.14 och nyare kan konfigureras för 2- eller 3-byte-vägar.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Försening i Flood TX'; diff --git a/lib/l10n/app_localizations_uk.dart b/lib/l10n/app_localizations_uk.dart index 71447eaf..14c3a831 100644 --- a/lib/l10n/app_localizations_uk.dart +++ b/lib/l10n/app_localizations_uk.dart @@ -367,6 +367,45 @@ class AppLocalizationsUk extends AppLocalizations { @override String get settings_radioSettingsUpdated => 'Налаштування радіо оновлено'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => 'Геопозиція'; @@ -462,6 +501,14 @@ class AppLocalizationsUk extends AppLocalizations { String get settings_advertLocationSubtitle => 'Включити геопозицію в оголошення'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => + 'Автооголошення без хопів при оновленні GPS'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + 'Коли GPS-локація змінюється, надсилати оголошення без хопів (потрібна геопозиція в оголошенні).'; + @override String get settings_multiAck => 'Багато підтверджень'; @@ -689,6 +736,18 @@ class AppLocalizationsUk extends AppLocalizations { @override String get appSettings_languageUk => 'Українська'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => 'Увімкнути відстеження повідомлень'; @@ -892,6 +951,28 @@ class AppLocalizationsUk extends AppLocalizations { @override String get appSettings_lastWeek => 'Минулий тиждень'; + @override + String get appSettings_rasterTileSource => 'Джерело растрових тайлів'; + + @override + String get appSettings_stadiaEndpoint => 'Кінцева точка Stadia'; + + @override + String get appSettings_stadiaApiKey => 'Ключ API Stadia'; + + @override + String get appSettings_stadiaApiKeyRequired => + 'Потрібно для використання Stadia Maps'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return 'Налаштовано: $maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + 'Введіть свій ключ API Stadia Maps. Програма використовує його для запитів растрових тайлів.'; + @override String get appSettings_offlineMapCache => 'Офлайн-кеш карти'; @@ -1320,6 +1401,20 @@ class AppLocalizationsUk extends AppLocalizations { @override String get channels_hashtagHint => 'напр. #команда'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => 'Поки немає повідомлень.'; @@ -1376,6 +1471,9 @@ class AppLocalizationsUk extends AppLocalizations { @override String get chat_sendGif => 'Надіслати GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => 'Відповісти'; @@ -2031,6 +2129,42 @@ class AppLocalizationsUk extends AppLocalizations { return 'Невдалі завантаження: $count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2582,7 +2716,42 @@ class AppLocalizationsUk extends AppLocalizations { @override String get repeater_pathHashModeHelper => - 'Байти, що використовуються для кодування ідентифікатора цього ретранслятора в тегах для виявлення потоків/петлі. 0=1 байт (256 ідентифікаторів, до 64 перехідів), 1=2 байти (65 000 ідентифікаторів, до 32 перехідів), 2=3 байти (16 мільйонів ідентифікаторів, до 21 переходу). Версії 1.13 та старіші не підтримують багатобайтні шляхи — вони активуються лише після того, як мережа буде оновлена до версії 1.14+.'; + 'Байти, що використовуються для кодування ідентифікатора цього ретранслятора в тегах flood-шляху/виявлення петель. 0=1 байт (256 ідентифікаторів, до 64 переходів), 1=2 байти (65 000 ідентифікаторів, до 32 переходів), 2=3 байти (16 мільйонів ідентифікаторів, до 21 переходу). Прошивки до v1.14 завжди використовували 1-байтові шляхи; v1.14 і новіші можна налаштувати на 2- або 3-байтові шляхи.'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => 'Затримка у Flood, штат Техас'; diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart index 4491de40..1344ced9 100644 --- a/lib/l10n/app_localizations_zh.dart +++ b/lib/l10n/app_localizations_zh.dart @@ -350,6 +350,45 @@ class AppLocalizationsZh extends AppLocalizations { @override String get settings_radioSettingsUpdated => '无线电设置已更新'; + @override + String get settings_regionSettings => 'Regions'; + + @override + String get settings_regionSettingsSubtitle => 'Manage stored regions'; + + @override + String get settings_regionManagement_screenTitle => 'Region Management'; + + @override + String get settings_regionNameHint => 'Enter region name'; + + @override + String get settings_regionAddRegion => 'Add region'; + + @override + String get settings_regionFetchRegions => 'Fetch regions from repeaters'; + + @override + String get settings_regionFetchRegionsFail => 'No regions were found'; + + @override + String get settings_regionFetchRegionsAlreadyExists => + 'This region has already been added'; + + @override + String get settings_regionName => 'Region Name'; + + @override + String get settings_regionDeleted => 'Region deleted'; + + @override + String get settings_deleteRegion => 'Delete Region'; + + @override + String settings_deleteRegionConfirm(String region) { + return 'Remove \"$region\" from region list?'; + } + @override String get settings_location => '位置'; @@ -437,6 +476,13 @@ class AppLocalizationsZh extends AppLocalizations { @override String get settings_advertLocationSubtitle => '在广告中包含位置'; + @override + String get settings_autoZeroHopAdvertOnGpsUpdate => 'GPS 更新时自动发送零跳广告'; + + @override + String get settings_autoZeroHopAdvertOnGpsUpdateSubtitle => + '当 GPS 位置变化时,发送零跳广告(需要在广告中包含位置)。'; + @override String get settings_multiAck => '多重ACK'; @@ -655,6 +701,18 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_languageUk => '乌克兰语'; + @override + String get repeater_pathHashModeOption0 => '0 - 1 byte'; + + @override + String get repeater_pathHashModeOption1 => '1 - 2 bytes'; + + @override + String get repeater_pathHashModeOption2 => '2 - 3 bytes'; + + @override + String get repeater_pathHashModeOption3 => '3 - 4 bytes'; + @override String get appSettings_enableMessageTracing => '启用消息追踪'; @@ -832,6 +890,27 @@ class AppLocalizationsZh extends AppLocalizations { @override String get appSettings_lastWeek => '上周'; + @override + String get appSettings_rasterTileSource => '栅格瓦片源'; + + @override + String get appSettings_stadiaEndpoint => 'Stadia 端点'; + + @override + String get appSettings_stadiaApiKey => 'Stadia API 密钥'; + + @override + String get appSettings_stadiaApiKeyRequired => '使用 Stadia Maps 时必需'; + + @override + String appSettings_stadiaApiKeyConfigured(String maskedKey) { + return '已配置:$maskedKey'; + } + + @override + String get appSettings_stadiaApiKeyDialogDescription => + '请输入你的 Stadia Maps API 密钥。该应用会使用它来请求栅格瓦片。'; + @override String get appSettings_offlineMapCache => '离线地图缓存'; @@ -1245,6 +1324,20 @@ class AppLocalizationsZh extends AppLocalizations { @override String get channels_hashtagHint => '例如:#团队'; + @override + String channels_regionSetTo(String region) { + return 'Region: $region'; + } + + @override + String get channels_regionNotSet => 'Region: none'; + + @override + String get channels_regionSelect_Title => 'Select a region'; + + @override + String get channels_clearRegion => 'Clear region'; + @override String get chat_noMessages => '暂无消息'; @@ -1300,6 +1393,9 @@ class AppLocalizationsZh extends AppLocalizations { @override String get chat_sendGif => '发送 GIF'; + @override + String get chat_receivedGif => 'Received a GIF'; + @override String get chat_reply => '回复'; @@ -1925,6 +2021,42 @@ class AppLocalizationsZh extends AppLocalizations { return '下载失败:$count'; } + @override + String get mapCache_cachedTilesLabel => 'Cached tiles'; + + @override + String get mapCache_cachedTileSummaryLabel => 'Cached tile summary'; + + @override + String mapCache_bulkDownloadDisabledForSource(String source) { + return 'Offline bulk downloads are disabled for $source.'; + } + + @override + String mapCache_bulkDownloadDisabledInConfig(String source) { + return 'Offline bulk downloads are disabled for $source in this app configuration.'; + } + + @override + String mapCache_summarySource(String source) { + return 'Source: $source'; + } + + @override + String mapCache_summaryCachedTilesForSource(int count) { + return 'Cached tiles for source: $count'; + } + + @override + String mapCache_summaryCachedInSelection(int count) { + return 'Cached in selected area/zoom: $count'; + } + + @override + String mapCache_summaryApproxCacheSize(String size) { + return 'Approx cache size: $size'; + } + @override String mapCache_boundsLabel( String north, @@ -2439,7 +2571,42 @@ class AppLocalizationsZh extends AppLocalizations { @override String get repeater_pathHashModeHelper => - '用于编码此复用器的 ID 的字节数,在“洪流路径/环检测”标签中使用。 0=1 字节(256 个 ID,最多 64 个跳跃),1=2 字节(65K 个 ID,最多 32 个跳跃),2=3 字节(16M 个 ID,最多 21 个跳跃)。 v1.13 及更早版本的固件会使用多字节路径——只有在您的网络升级到 v1.14 或更高版本后才会生效。'; + '用于在洪泛路径/环路检测标签中编码此中继器 ID 的字节数。0=1 字节(256 个 ID,最多 64 跳),1=2 字节(65K 个 ID,最多 32 跳),2=3 字节(16M 个 ID,最多 21 跳)。v1.14 之前的固件始终使用 1 字节路径;v1.14 及更新版本可配置为 2 或 3 字节路径。'; + + @override + String get repeater_keySettings => 'Change Identity Keys'; + + @override + String get repeater_keySettingsSubtitle => + 'Change the public/private keypair'; + + @override + String get repeater_prvKey => 'Private key'; + + @override + String get repeater_prvKeyHelper => + 'A new private key for the repeater, a 128-character hex string.'; + + @override + String get repeater_generatePrvKey => 'Generate a random keypair'; + + @override + String get repeater_stopGeneratingPrvKey => 'Interrupt search for keypair'; + + @override + String get repeater_pubKey => 'Public key'; + + @override + String get repeater_pubKeyHelper => + 'This is the public key that goes with the generated private key. You can\'t set this directly.'; + + @override + String get repeater_pubKeyPrefix => 'Desired prefix'; + + @override + String repeater_pubKeyPrefixHelper(int tries) { + return 'Find a public key that starts with these hex digits. Expected tries needed: $tries.'; + } @override String get repeater_txDelay => '洪水(德克萨斯州)延误'; diff --git a/lib/l10n/app_nl.arb b/lib/l10n/app_nl.arb index 5392b935..298613c0 100644 --- a/lib/l10n/app_nl.arb +++ b/lib/l10n/app_nl.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Ongeldige breedtegraad of lengtegraad.", "settings_latitude": "Breedtegraad", "settings_longitude": "Lengtegraad", + "settings_autoZeroHopAdvertOnGpsUpdate": "Automatische zero-hop-advertentie bij GPS-update", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Wanneer de GPS-locatie verandert, een zero-hop-advertentie verzenden (vereist locatie in advertentie).", "settings_privacyMode": "Privacy-modus", "settings_privacyModeSubtitle": "Naam/locatie verbergen in advertenties", "settings_privacyModeToggle": "Schakel privacy modus in om je naam en locatie in advertenties te verbergen.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Afgelopen 6 uur", "appSettings_last24Hours": "Afgelopen 24 uur", "appSettings_lastWeek": "Afgelopen week", + "appSettings_rasterTileSource": "Rastertegelbron", + "appSettings_stadiaEndpoint": "Stadia-eindpunt", + "appSettings_stadiaApiKey": "Stadia API-sleutel", + "appSettings_stadiaApiKeyRequired": "Vereist voor gebruik van Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Geconfigureerd: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Voer je Stadia Maps API-sleutel in. De app gebruikt die voor rastertegelverzoeken.", "appSettings_offlineMapCache": "Offline Kaartcache", "appSettings_noAreaSelected": "Geen gebied geselecteerd", "appSettings_areaSelectedZoom": "Geselecteerd gebied (zoom {minZoom}-{maxZoom})", @@ -769,6 +784,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1107,7 +1172,7 @@ "repeater_advancedSettings": "Geavanceerd", "repeater_advancedSettingsSubtitle": "Regelhendels voor ervaren gebruikers", "repeater_pathHashMode": "Hash-modus voor paden", - "repeater_pathHashModeHelper": "Bytes die gebruikt worden om de ID van deze repeater te coderen in flood-pad/lusdetectietags. 0=1 byte (256 ID's, tot 64 hops), 1=2 bytes (65.000 ID's, tot 32 hops), 2=3 bytes (16 miljoen ID's, tot 21 hops). Versies 1.13 en ouder gebruiken multi-byte paden – alleen na het activeren van het netwerk.", + "repeater_pathHashModeHelper": "Bytes die gebruikt worden om de ID van deze repeater te coderen in flood-pad/lusdetectietags. 0=1 byte (256 ID's, tot 64 hops), 1=2 bytes (65.000 ID's, tot 32 hops), 2=3 bytes (16 miljoen ID's, tot 21 hops). Firmware vóór v1.14 gebruikte altijd 1-byte paden; v1.14 en nieuwer kunnen worden ingesteld op 2- of 3-byte paden.", "repeater_txDelay": "Vertraging bij Flood TX", "repeater_txDelayHelper": "Herzendinterval voor verkeer tijdens overstromingen, als een veelvoud van de tijd die het pakket nodig heeft (0-2, standaard 0.5). Een hoger getal betekent minder botsingen, maar ook een langere leveringstijd.", "repeater_directTxDelay": "Directe vertraging", diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 3b4ccb88..d31fc729 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Nieprawidłowa szerokość geograficzna lub długość geograficzna.", "settings_latitude": "Szerokość", "settings_longitude": "Długość", + "settings_autoZeroHopAdvertOnGpsUpdate": "Automatyczne ogłoszenie zero-hop przy aktualizacji GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Gdy lokalizacja GPS się zmieni, wyślij ogłoszenie zero-hop (wymaga lokalizacji w ogłoszeniu).", "settings_privacyMode": "Tryb prywatności", "settings_privacyModeSubtitle": "Ukryj imię/lokalizację w rozgłoszeniach", "settings_privacyModeToggle": "Włącz tryb prywatności, aby ukryć swoje imię i lokalizację w rozgłoszeniach.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Ostatnie 6 godzin", "appSettings_last24Hours": "Ostatnie 24 godziny", "appSettings_lastWeek": "Ostatni tydzień", + "appSettings_rasterTileSource": "Źródło kafelków rastrowych", + "appSettings_stadiaEndpoint": "Punkt końcowy Stadia", + "appSettings_stadiaApiKey": "Klucz API Stadia", + "appSettings_stadiaApiKeyRequired": "Wymagane do korzystania ze Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Skonfigurowano: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Wprowadź swój klucz API Stadia Maps. Aplikacja używa go do żądań kafelków rastrowych.", "appSettings_offlineMapCache": "Pamięć podręczna map offline", "appSettings_noAreaSelected": "Nie wybrano żadnego obszaru.", "appSettings_areaSelectedZoom": "Wybrany obszar (skala {minZoom}-{maxZoom})", @@ -779,6 +794,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1117,7 +1182,7 @@ "repeater_advancedSettings": "Zaawansowany", "repeater_advancedSettingsSubtitle": "Regulowane pokrętła dla doświadczonych operatorów", "repeater_pathHashMode": "Tryb haszujący ścieżkę", - "repeater_pathHashModeHelper": "Bity wykorzystywane do kodowania identyfikatora tego urządzenia w tagach ścieżek/detekcji pętli. 0=1 bity (256 identyfikatorów, do 64 skoków), 1=2 bity (65 000 identyfikatorów, do 32 skoków), 2=3 bity (1 600 000 identyfikatorów, do 21 skoków). Wersje 1.13 i wcześniejsze nie obsługują ścieżek wielobitowych – wykrywają tylko jedną, gdy sieć jest w wersji 1.14 lub nowszej.", + "repeater_pathHashModeHelper": "Bajty używane do kodowania identyfikatora tego repeatera w tagach ścieżki flood/wykrywania pętli. 0=1 bajt (256 identyfikatorów, do 64 skoków), 1=2 bajty (65 000 identyfikatorów, do 32 skoków), 2=3 bajty (16 milionów identyfikatorów, do 21 skoków). Firmware sprzed v1.14 zawsze używał ścieżek 1-bajtowych; v1.14 i nowsze można skonfigurować na ścieżki 2- lub 3-bajtowe.", "repeater_txDelay": "Opóźnienie w Flood, TX", "repeater_txDelayHelper": "Ustawienie odstępu dla ruchu związanego z powodzią, jako mnożnik czasu przesyłania pakietu (0-2, domyślnie 0,5). Wyższe wartości oznaczają mniejszą liczbę kolizji, ale wolniejszą prędkość przesyłania.", "repeater_directTxDelay": "Bezpośrednie opóźnienie sygnału TX", diff --git a/lib/l10n/app_pt.arb b/lib/l10n/app_pt.arb index 162405b4..64d9a28e 100644 --- a/lib/l10n/app_pt.arb +++ b/lib/l10n/app_pt.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Latitude ou longitude inválidos.", "settings_latitude": "Latitude", "settings_longitude": "Longitude", + "settings_autoZeroHopAdvertOnGpsUpdate": "Anúncio zero-hop automático na atualização do GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Quando a localização GPS mudar, enviar um anúncio zero-hop (requer localização no anúncio).", "settings_privacyMode": "Modo de Privacidade", "settings_privacyModeSubtitle": "Esconder nome/localização em anúncios", "settings_privacyModeToggle": "Ative o modo de privacidade para ocultar seu nome e localização em anúncios.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Últimos 6 horas", "appSettings_last24Hours": "Últimas 24 horas", "appSettings_lastWeek": "Da última semana", + "appSettings_rasterTileSource": "Fonte de blocos raster", + "appSettings_stadiaEndpoint": "Endpoint da Stadia", + "appSettings_stadiaApiKey": "Chave da API Stadia", + "appSettings_stadiaApiKeyRequired": "Obrigatório para usar o Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Configurado: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Insira sua chave da API Stadia Maps. O aplicativo a usa para solicitações de blocos raster.", "appSettings_offlineMapCache": "Cache de Mapa Offline", "appSettings_noAreaSelected": "Nenhuma área selecionada", "appSettings_areaSelectedZoom": "Área selecionada (zoom {minZoom}-{maxZoom})", @@ -769,6 +784,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1107,7 +1172,7 @@ "repeater_advancedSettings": "Avançado", "repeater_advancedSettingsSubtitle": "Controles de ajuste para operadores experientes", "repeater_pathHashMode": "Modo de hash de caminho", - "repeater_pathHashModeHelper": "Bytes utilizados para codificar o ID deste repetidor nas tags de caminho/detecção de loop. 0=1 byte (256 IDs, até 64 saltos), 1=2 bytes (65.000 IDs, até 32 saltos), 2=3 bytes (16 milhões de IDs, até 21 saltos). As versões 1.13 e anteriores do firmware não suportam caminhos multi-byte — apenas funcionam uma vez após a ativação da rede (a partir da versão 1.14+).", + "repeater_pathHashModeHelper": "Bytes usados para codificar o ID deste repetidor nas tags de caminho flood/detecção de loop. 0=1 byte (256 IDs, até 64 saltos), 1=2 bytes (65.000 IDs, até 32 saltos), 2=3 bytes (16 milhões de IDs, até 21 saltos). O firmware anterior à v1.14 sempre usava caminhos de 1 byte; v1.14 e versões mais recentes podem ser configuradas para caminhos de 2 ou 3 bytes.", "repeater_txDelay": "Atraso na entrega em Flood, TX", "repeater_txDelayHelper": "Ajuste de espaçamento para tráfego de inundações, como um multiplicador do tempo de transmissão (0-2, padrão 0,5). Quanto maior, menos colisões, mas uma entrega mais lenta.", "repeater_directTxDelay": "Atraso direto no sinal TX", diff --git a/lib/l10n/app_ru.arb b/lib/l10n/app_ru.arb index b9595dd5..8582673b 100644 --- a/lib/l10n/app_ru.arb +++ b/lib/l10n/app_ru.arb @@ -77,6 +77,8 @@ "settings_locationIntervalInvalid": "Интервал должен составлять не менее 60 секунд и не более 86400 секунд.", "settings_latitude": "Широта", "settings_longitude": "Долгота", + "settings_autoZeroHopAdvertOnGpsUpdate": "Авто-объявление без хопов при обновлении GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Когда GPS-местоположение меняется, отправлять объявление без хопов (требуется геопозиция в объявлении).", "settings_privacyMode": "Режим конфиденциальности", "settings_privacyModeSubtitle": "Скрыть имя/позицию в анонсировании", "settings_privacyModeToggle": "Включите режим конфиденциальности, чтобы скрыть свое имя и местоположение в анонсировании.", @@ -190,6 +192,19 @@ "appSettings_last6Hours": "Последние 6 часов", "appSettings_last24Hours": "Последние 24 часа", "appSettings_lastWeek": "Последнюю неделю", + "appSettings_rasterTileSource": "Источник растровых тайлов", + "appSettings_stadiaEndpoint": "Конечная точка Stadia", + "appSettings_stadiaApiKey": "Ключ API Stadia", + "appSettings_stadiaApiKeyRequired": "Требуется для использования Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Настроено: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Введите свой ключ API Stadia Maps. Приложение использует его для запросов растровых тайлов.", "appSettings_offlineMapCache": "Кэш офлайн-карты", "appSettings_noAreaSelected": "Область не выбрана", "appSettings_areaSelectedZoom": "Область выбрана (масштаб {minZoom}–{maxZoom})", @@ -438,6 +453,56 @@ "mapCache_downloadTilesButton": "Загрузить плитки", "mapCache_clearCacheButton": "Очистить кэш", "mapCache_failedDownloads": "Неудачных загрузок: {count}", + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "С {north}, Ю {south}, В {east}, З {west}", "time_justNow": "Только что", "time_minutesAgo": "{minutes} мин назад", @@ -1507,7 +1572,7 @@ "repeater_advancedSettings": "Продвинутый", "repeater_advancedSettingsSubtitle": "Регуляторы для опытных операторов", "repeater_pathHashMode": "Режим хеширования пути", - "repeater_pathHashModeHelper": "Байты, используемые для кодирования идентификатора этого ретранслятора в тегах для обнаружения потоков/циклов. 0 = 1 байт (256 идентификаторов, до 64 переходов), 1 = 2 байта (65 000 идентификаторов, до 32 переходов), 2 = 3 байта (1 600 000 идентификаторов, до 21 перехода). Версии прошивки v1.13 и более ранние версии не поддерживают многобайтовые пути — они поднимаются только после того, как ваша сеть будет обновлена до версии v1.14 и выше.", + "repeater_pathHashModeHelper": "Байты, используемые для кодирования идентификатора этого ретранслятора в тегах flood-маршрута/обнаружения циклов. 0 = 1 байт (256 идентификаторов, до 64 переходов), 1 = 2 байта (65 000 идентификаторов, до 32 переходов), 2 = 3 байта (16 миллионов идентификаторов, до 21 перехода). Прошивки до v1.14 всегда использовали 1-байтовые маршруты; v1.14 и новее можно настроить на 2- или 3-байтовые маршруты.", "repeater_txDelay": "Задержка в работе системы Flood TX", "repeater_txDelayHelper": "Передача с увеличенным интервалом для трафика во время наводнения, в качестве коэффициента, умножающего время передачи пакета (от 0 до 2, по умолчанию 0,5). Более высокое значение означает меньшее количество столкновений, но более медленную передачу.", "repeater_directTxDelay": "Прямая задержка сигнала TX", diff --git a/lib/l10n/app_sk.arb b/lib/l10n/app_sk.arb index c3224d62..c967dd72 100644 --- a/lib/l10n/app_sk.arb +++ b/lib/l10n/app_sk.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Neplatná šírka alebo dĺžka.", "settings_latitude": "Súradnica", "settings_longitude": "Dĺžka", + "settings_autoZeroHopAdvertOnGpsUpdate": "Automatický zero-hop inzerát pri aktualizácii GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Keď sa GPS poloha zmení, odoslať zero-hop inzerát (vyžaduje polohu v inzeráte).", "settings_privacyMode": "Režim ochrany súkromia", "settings_privacyModeSubtitle": "Skryť meno/poloha v reklamách", "settings_privacyModeToggle": "Prepínač súkromného režimu skryje vaše meno a polohu v reklamách.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Posledné 6 hodín", "appSettings_last24Hours": "Posledných 24 hodín", "appSettings_lastWeek": "Minul týždeň", + "appSettings_rasterTileSource": "Zdroj rastrových dlaždíc", + "appSettings_stadiaEndpoint": "Koncový bod Stadia", + "appSettings_stadiaApiKey": "Kľúč API Stadia", + "appSettings_stadiaApiKeyRequired": "Vyžaduje sa na používanie Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Nakonfigurované: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Zadajte svoj kľúč API pre Stadia Maps. Aplikácia ho používa na požiadavky na rastrové dlaždice.", "appSettings_offlineMapCache": "Offline Mapa Pamäť", "appSettings_noAreaSelected": "Neoznačila sa žiadna oblasť", "appSettings_areaSelectedZoom": "Vyberená oblasť (zoom {minZoom}-{maxZoom})", @@ -769,6 +784,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1107,7 +1172,7 @@ "repeater_advancedSettings": "Pokročilé", "repeater_advancedSettingsSubtitle": "Ovládacie knopy pre skúsených operátorov", "repeater_pathHashMode": "Režim hashovania cesty", - "repeater_pathHashModeHelper": "Byty použité na zakódovanie ID tohto opakovača v tagoch pre trasu/detekciu slučky. 0 = 1 bytu (256 ID, až 64 skokov), 1 = 2 byty (65 000 ID, až 32 skokov), 2 = 3 byty (16 miliónov ID, až 21 skokov). Verzie 1.13 a staršie nepodporujú viacbytové trasy – fungujú len, keď je sieť aktivovaná.", + "repeater_pathHashModeHelper": "Bajty použité na zakódovanie ID tohto opakovača v tagoch flood trasy/detekcie slučky. 0=1 bajt (256 ID, až 64 skokov), 1=2 bajty (65 000 ID, až 32 skokov), 2=3 bajty (16 miliónov ID, až 21 skokov). Firmvér pred v1.14 vždy používal 1-bajtové trasy; v1.14 a novšie možno nakonfigurovať na 2- alebo 3-bajtové trasy.", "repeater_txDelay": "Zpoždanie v Flood, TX", "repeater_txDelayHelper": "Nastavenie pre opakované vysielanie pre dopravu počas povodní, ako násobok času, ktorý paket využije (0-2, výchoce hodnota 0,5). Vyššia hodnota znamená menej kolízii, ale pomalšie doručovanie.", "repeater_directTxDelay": "Priame oneskorenie TX", diff --git a/lib/l10n/app_sl.arb b/lib/l10n/app_sl.arb index 884f7a83..cd6c2c50 100644 --- a/lib/l10n/app_sl.arb +++ b/lib/l10n/app_sl.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Neveljavna zemeljska širina ali dolžina.", "settings_latitude": "Širina", "settings_longitude": "Dolžina", + "settings_autoZeroHopAdvertOnGpsUpdate": "Samodejni zero-hop oglas ob posodobitvi GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Ko se GPS lokacija spremeni, pošlji zero-hop oglas (zahteva lokacijo v oglasu).", "settings_privacyMode": "Zasebnost", "settings_privacyModeSubtitle": "Skrita imena/lokacije v oglasih", "settings_privacyModeToggle": "Omogoči način zasebnosti, da skrijemo tvoje ime in lokacijo v oglasih.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "Zadnjih 6 ur", "appSettings_last24Hours": "Zadnjih 24 ur", "appSettings_lastWeek": "Prejšnji teden", + "appSettings_rasterTileSource": "Vir rastrskih ploščic", + "appSettings_stadiaEndpoint": "Končna točka Stadia", + "appSettings_stadiaApiKey": "Ključ API Stadia", + "appSettings_stadiaApiKeyRequired": "Obvezno za uporabo Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Nastavljeno: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Vnesite svoj ključ API za Stadia Maps. Aplikacija ga uporablja za zahteve rastrskih ploščic.", "appSettings_offlineMapCache": "Shramba zemljevidov brez povezave", "appSettings_noAreaSelected": "Območje ni izbrano", "appSettings_areaSelectedZoom": "Izbrano območje (povečava {minZoom}-{maxZoom})", @@ -769,6 +784,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1107,7 +1172,7 @@ "repeater_advancedSettings": "Napredno", "repeater_advancedSettingsSubtitle": "Gumbi za nastavljanje za izkušene uporabnike", "repeater_pathHashMode": "Način ustvarjanja hash-a poti", - "repeater_pathHashModeHelper": "Biti, ki so bila uporabljena za kodiranje ID-ja tega releja v oznakah za zaznavanje pot/kroga, imajo naslednje velikosti: 0=1 bit (256 ID-jev, do 64 skokov), 1=2 biti (65.000 ID-jev, do 32 skokov), 2=3 biti (16 milijonov ID-jev, do 21 skokov). V različicah 1.13 in starejših se ustvarjajo večbitne poti – vendar se to zgodi šele, ko je omrežje vklopljeno v različicah 1.14 in kasnejših.", + "repeater_pathHashModeHelper": "Bajti, uporabljeni za kodiranje ID-ja tega repetitorja v oznakah flood poti/zaznavanja zank. 0=1 bajt (256 ID-jev, do 64 skokov), 1=2 bajta (65.000 ID-jev, do 32 skokov), 2=3 bajti (16 milijonov ID-jev, do 21 skokov). Vdelana programska oprema pred v1.14 je vedno uporabljala 1-bajtne poti; v1.14 in novejše je mogoče nastaviti na 2- ali 3-bajtne poti.", "repeater_txDelay": "Zatemnitevanje zaradi poplav v Texasu", "repeater_txDelayHelper": "Uporaba intervalov za ponovno pošiljanje v primeru prometa zaradi poplav, kot pomnožnik časovne trajanje paketa (0-2, privzeto 0,5). Veje vrednost = manjše kolizije, vendar počasnejše dostavo.", "repeater_directTxDelay": "Neposredni časovno odlašanje", diff --git a/lib/l10n/app_sv.arb b/lib/l10n/app_sv.arb index 6f51a565..1af7c461 100644 --- a/lib/l10n/app_sv.arb +++ b/lib/l10n/app_sv.arb @@ -100,6 +100,8 @@ "settings_locationInvalid": "Ogiltig latitud eller longitud.", "settings_latitude": "Latitud", "settings_longitude": "Längdgrad", + "settings_autoZeroHopAdvertOnGpsUpdate": "Automatisk zero-hop-annons vid GPS-uppdatering", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "När GPS-positionen ändras, skicka en zero-hop-annons (kräver plats i annonsen).", "settings_privacyMode": "Privatläge", "settings_privacyModeSubtitle": "Dölj namn/plats i annonser", "settings_privacyModeToggle": "Aktivera privatläge för att dölja ditt namn och din plats i annonser.", @@ -240,6 +242,19 @@ "appSettings_last6Hours": "De senaste 6 timmarna", "appSettings_last24Hours": "De senaste 24 timmarna", "appSettings_lastWeek": "Förra veckan", + "appSettings_rasterTileSource": "Källa för rasterplattor", + "appSettings_stadiaEndpoint": "Stadia-slutpunkt", + "appSettings_stadiaApiKey": "Stadia API-nyckel", + "appSettings_stadiaApiKeyRequired": "Krävs för att använda Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Konfigurerad: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Ange din Stadia Maps API-nyckel. Appen använder den för förfrågningar om rasterplattor.", "appSettings_offlineMapCache": "Offline Kartcache", "appSettings_noAreaSelected": "Ingen area markerad", "appSettings_areaSelectedZoom": "Område markerat (zoom {minZoom}-{maxZoom})", @@ -769,6 +784,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "N {north}, S {south}, E {east}, W {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1107,7 +1172,7 @@ "repeater_advancedSettings": "Avancerad", "repeater_advancedSettingsSubtitle": "Ställjusteringsknappar för erfarna användare", "repeater_pathHashMode": "Hash-läge för sökväg", - "repeater_pathHashModeHelper": "Byte används för att koda denna repeaters ID i taggar för att upptäcka loopar/flödesvägar. 0=1 byte (256 ID:n, upp till 64 hopp), 1=2 byte (65 000 ID:n, upp till 32 hopp), 2=3 byte (16 miljoner ID:n, upp till 21 hopp). Versioner 1.13 och äldre har stöd för multi-byte-vägar – endast en gång när nätverket är aktiverat (från och med version 1.14).", + "repeater_pathHashModeHelper": "Byte som används för att koda denna repeaters ID i taggar för flood-väg/loopdetektering. 0=1 byte (256 ID:n, upp till 64 hopp), 1=2 byte (65 000 ID:n, upp till 32 hopp), 2=3 byte (16 miljoner ID:n, upp till 21 hopp). Firmware före v1.14 använde alltid 1-byte-vägar; v1.14 och nyare kan konfigureras för 2- eller 3-byte-vägar.", "repeater_txDelay": "Försening i Flood TX", "repeater_txDelayHelper": "Återöverföringsintervall för trafik under perioder med hög belastning, som en multiplikator av paketets överföringstid (0-2, standard 0,5). Högre värde = färre kollisioner, men långsammare leverans.", "repeater_directTxDelay": "Direkt TX-fördröjning", diff --git a/lib/l10n/app_uk.arb b/lib/l10n/app_uk.arb index d7f44035..396577f0 100644 --- a/lib/l10n/app_uk.arb +++ b/lib/l10n/app_uk.arb @@ -101,6 +101,8 @@ "settings_locationInvalid": "Некоректна широта або довгота.", "settings_latitude": "Широта", "settings_longitude": "Довгота", + "settings_autoZeroHopAdvertOnGpsUpdate": "Автооголошення без хопів при оновленні GPS", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "Коли GPS-локація змінюється, надсилати оголошення без хопів (потрібна геопозиція в оголошенні).", "settings_privacyMode": "Режим приватності", "settings_privacyModeSubtitle": "Приховати ім'я/геопозицію в оголошеннях", "settings_privacyModeToggle": "Увімкніть режим приватності, щоб приховати своє ім'я та геопозицію в оголошеннях.", @@ -242,6 +244,19 @@ "appSettings_last6Hours": "Останні 6 годин", "appSettings_last24Hours": "Останні 24 години", "appSettings_lastWeek": "Минулий тиждень", + "appSettings_rasterTileSource": "Джерело растрових тайлів", + "appSettings_stadiaEndpoint": "Кінцева точка Stadia", + "appSettings_stadiaApiKey": "Ключ API Stadia", + "appSettings_stadiaApiKeyRequired": "Потрібно для використання Stadia Maps", + "appSettings_stadiaApiKeyConfigured": "Налаштовано: {maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "Введіть свій ключ API Stadia Maps. Програма використовує його для запитів растрових тайлів.", "appSettings_offlineMapCache": "Офлайн-кеш карти", "appSettings_noAreaSelected": "Область не вибрано", "appSettings_areaSelectedZoom": "Вибрана область (зум {minZoom}-{maxZoom})", @@ -779,6 +794,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "Пн {north}, Пд {south}, Сх {east}, Зх {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1117,7 +1182,7 @@ "repeater_advancedSettings": "Просунутий", "repeater_advancedSettingsSubtitle": "Регулювальні ручки для досвідчених операторів", "repeater_pathHashMode": "Режим хешування шляху", - "repeater_pathHashModeHelper": "Байти, що використовуються для кодування ідентифікатора цього ретранслятора в тегах для виявлення потоків/петлі. 0=1 байт (256 ідентифікаторів, до 64 перехідів), 1=2 байти (65 000 ідентифікаторів, до 32 перехідів), 2=3 байти (16 мільйонів ідентифікаторів, до 21 переходу). Версії 1.13 та старіші не підтримують багатобайтні шляхи — вони активуються лише після того, як мережа буде оновлена до версії 1.14+.", + "repeater_pathHashModeHelper": "Байти, що використовуються для кодування ідентифікатора цього ретранслятора в тегах flood-шляху/виявлення петель. 0=1 байт (256 ідентифікаторів, до 64 переходів), 1=2 байти (65 000 ідентифікаторів, до 32 переходів), 2=3 байти (16 мільйонів ідентифікаторів, до 21 переходу). Прошивки до v1.14 завжди використовували 1-байтові шляхи; v1.14 і новіші можна налаштувати на 2- або 3-байтові шляхи.", "repeater_txDelay": "Затримка у Flood, штат Техас", "repeater_txDelayHelper": "Повторне надсилання з урахуванням навантаження від потоків транспорту, як множник від часу передачі пакета (0-2, за замовчуванням 0,5). Чим вище значення, тим менше конфліктів, але повільніше передавання.", "repeater_directTxDelay": "Пряме затримка TX", diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arb index 55c2dac6..1f3e2725 100644 --- a/lib/l10n/app_zh.arb +++ b/lib/l10n/app_zh.arb @@ -105,6 +105,8 @@ "settings_locationIntervalInvalid": "间隔时间必须至少为 60 秒,但不超过 86400 秒。", "settings_latitude": "纬度", "settings_longitude": "经度", + "settings_autoZeroHopAdvertOnGpsUpdate": "GPS 更新时自动发送零跳广告", + "settings_autoZeroHopAdvertOnGpsUpdateSubtitle": "当 GPS 位置变化时,发送零跳广告(需要在广告中包含位置)。", "settings_privacyMode": "隐私模式", "settings_privacyModeSubtitle": "在广告中隐藏姓名/位置", "settings_privacyModeToggle": "切换隐私模式以在广告中隐藏姓名和位置,保护个人信息。", @@ -254,6 +256,19 @@ "appSettings_last6Hours": "过去6小时", "appSettings_last24Hours": "过去24小时", "appSettings_lastWeek": "上周", + "appSettings_rasterTileSource": "栅格瓦片源", + "appSettings_stadiaEndpoint": "Stadia 端点", + "appSettings_stadiaApiKey": "Stadia API 密钥", + "appSettings_stadiaApiKeyRequired": "使用 Stadia Maps 时必需", + "appSettings_stadiaApiKeyConfigured": "已配置:{maskedKey}", + "@appSettings_stadiaApiKeyConfigured": { + "placeholders": { + "maskedKey": { + "type": "String" + } + } + }, + "appSettings_stadiaApiKeyDialogDescription": "请输入你的 Stadia Maps API 密钥。该应用会使用它来请求栅格瓦片。", "appSettings_offlineMapCache": "离线地图缓存", "appSettings_noAreaSelected": "未选择任何区域", "appSettings_areaSelectedZoom": "已选择区域(缩放 {minZoom} - {maxZoom})", @@ -796,6 +811,56 @@ } } }, + "mapCache_cachedTilesLabel": "Cached tiles", + "mapCache_cachedTileSummaryLabel": "Cached tile summary", + "mapCache_bulkDownloadDisabledForSource": "Offline bulk downloads are disabled for {source}.", + "@mapCache_bulkDownloadDisabledForSource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_bulkDownloadDisabledInConfig": "Offline bulk downloads are disabled for {source} in this app configuration.", + "@mapCache_bulkDownloadDisabledInConfig": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summarySource": "Source: {source}", + "@mapCache_summarySource": { + "placeholders": { + "source": { + "type": "String" + } + } + }, + "mapCache_summaryCachedTilesForSource": "Cached tiles for source: {count}", + "@mapCache_summaryCachedTilesForSource": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryCachedInSelection": "Cached in selected area/zoom: {count}", + "@mapCache_summaryCachedInSelection": { + "placeholders": { + "count": { + "type": "int" + } + } + }, + "mapCache_summaryApproxCacheSize": "Approx cache size: {size}", + "@mapCache_summaryApproxCacheSize": { + "placeholders": { + "size": { + "type": "String" + } + } + }, "mapCache_boundsLabel": "北 {north}, 南 {south}, 东 {east}, 西 {west}", "@mapCache_boundsLabel": { "placeholders": { @@ -1137,7 +1202,7 @@ "repeater_advancedSettings": "高级", "repeater_advancedSettingsSubtitle": "高级操作员使用的调节旋钮", "repeater_pathHashMode": "路径哈希模式", - "repeater_pathHashModeHelper": "用于编码此复用器的 ID 的字节数,在“洪流路径/环检测”标签中使用。 0=1 字节(256 个 ID,最多 64 个跳跃),1=2 字节(65K 个 ID,最多 32 个跳跃),2=3 字节(16M 个 ID,最多 21 个跳跃)。 v1.13 及更早版本的固件会使用多字节路径——只有在您的网络升级到 v1.14 或更高版本后才会生效。", + "repeater_pathHashModeHelper": "用于在洪泛路径/环路检测标签中编码此中继器 ID 的字节数。0=1 字节(256 个 ID,最多 64 跳),1=2 字节(65K 个 ID,最多 32 跳),2=3 字节(16M 个 ID,最多 21 跳)。v1.14 之前的固件始终使用 1 字节路径;v1.14 及更新版本可配置为 2 或 3 字节路径。", "repeater_txDelay": "洪水(德克萨斯州)延误", "repeater_txDelayHelper": "对于洪水流量,重新传输间隔应设置为包的传输时间(0-2,默认值为0.5)的倍数。 较高的值意味着更少的冲突,但传输速度会变慢。", "repeater_directTxDelay": "直接的 TX 延迟", diff --git a/lib/l10n/contact_localization.dart b/lib/l10n/contact_localization.dart index d8344a32..4f21c585 100644 --- a/lib/l10n/contact_localization.dart +++ b/lib/l10n/contact_localization.dart @@ -1,4 +1,5 @@ import '../connector/meshcore_protocol.dart'; +import '../helpers/path_helper.dart'; import '../models/contact.dart'; import 'app_localizations.dart'; @@ -23,14 +24,30 @@ extension ContactLocalization on Contact { } } - String pathLabel(AppLocalizations l10n) { + String pathLabel( + AppLocalizations l10n, { + int pathHashByteWidth = pathHashSize, + }) { if (pathOverride != null) { if (pathOverride! < 0) return l10n.chat_floodForced; if (pathOverride == 0) return l10n.chat_directForced; - return l10n.chat_hopsForced(pathOverride!); + return l10n.chat_hopsForced( + _displayHopCount(pathOverrideBytes, pathOverride!, pathHashByteWidth), + ); } if (pathLength < 0) return l10n.channelPath_floodPath; if (pathLength == 0) return l10n.chat_direct; - return l10n.chat_hopsCount(pathLength); + return l10n.chat_hopsCount( + _displayHopCount(path, pathLength, pathHashByteWidth), + ); + } + + int _displayHopCount( + List? pathBytes, + int storedHopCount, + int hashWidth, + ) { + if (pathBytes == null || pathBytes.isEmpty) return storedHopCount; + return PathHelper.splitPathBytes(pathBytes, hashWidth).length; } } diff --git a/lib/main.dart b/lib/main.dart index 1445bdde..7cabda17 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -51,7 +51,9 @@ void main() async { final bleDebugLogService = BleDebugLogService(); final appDebugLogService = AppDebugLogService(); final backgroundService = BackgroundService(); - final mapTileCacheService = MapTileCacheService(); + final mapTileCacheService = MapTileCacheService( + appSettingsService: appSettingsService, + ); final chatTextScaleService = ChatTextScaleService(); final translationService = TranslationService(appSettingsService); final uiViewStateService = UiViewStateService(); @@ -183,7 +185,7 @@ class MeshCoreApp extends StatelessWidget { ChangeNotifierProvider.value(value: translationService), ChangeNotifierProvider.value(value: uiViewStateService), Provider.value(value: storage), - Provider.value(value: mapTileCacheService), + ChangeNotifierProvider.value(value: mapTileCacheService), ChangeNotifierProvider.value(value: timeoutPredictionService), ], child: Consumer( diff --git a/lib/models/app_settings.dart b/lib/models/app_settings.dart index 3fd0d05f..82d570c7 100644 --- a/lib/models/app_settings.dart +++ b/lib/models/app_settings.dart @@ -76,6 +76,7 @@ class Cyr2LatProfile { class AppSettings { static const Object _unset = Object(); + static const String stadiaDemo = '51bd0381-4685-4666-bae8-48940f6d77c0'; final bool clearPathOnMaxRetry; final bool mapShowRepeaters; @@ -91,10 +92,15 @@ class AppSettings { final Map? mapCacheBounds; final int mapCacheMinZoom; final int mapCacheMaxZoom; + final String mapRasterSourceId; + final String mapTileEndpointId; + final String? mapTileApiKey; final bool notificationsEnabled; final bool notifyOnNewMessage; final bool notifyOnNewChannelMessage; final bool notifyOnNewAdvert; + final bool autoSendZeroHopAdvertOnGpsUpdate; + final int gpsIntervalSeconds; final bool autoRouteRotationEnabled; final double maxRouteWeight; final double initialRouteWeight; @@ -122,6 +128,16 @@ class AppSettings { final List cyr2latProfiles; final String selectedCyr2latProfileId; + String get effectiveMapTileApiKey { + final apiKey = mapTileApiKey?.trim(); + if (apiKey == null || apiKey.isEmpty) { + return stadiaDemo; + } + return apiKey; + } + + bool get usesstadiaDemo => effectiveMapTileApiKey == stadiaDemo; + Map get cyr2latCharMap { final profile = cyr2latProfiles.firstWhere( (p) => p.id == selectedCyr2latProfileId, @@ -145,10 +161,15 @@ class AppSettings { this.mapCacheBounds, this.mapCacheMinZoom = 10, this.mapCacheMaxZoom = 15, + this.mapRasterSourceId = 'osm_auto', + this.mapTileEndpointId = 'standard_2x', + this.mapTileApiKey, this.notificationsEnabled = true, this.notifyOnNewMessage = true, this.notifyOnNewChannelMessage = true, this.notifyOnNewAdvert = true, + this.autoSendZeroHopAdvertOnGpsUpdate = false, + this.gpsIntervalSeconds = 900, this.autoRouteRotationEnabled = true, this.maxRouteWeight = 5.0, this.initialRouteWeight = 3.0, @@ -206,10 +227,16 @@ class AppSettings { 'map_cache_bounds': mapCacheBounds, 'map_cache_min_zoom': mapCacheMinZoom, 'map_cache_max_zoom': mapCacheMaxZoom, + 'map_raster_source_id': mapRasterSourceId, + 'map_tile_endpoint_id': mapTileEndpointId, + 'map_tile_api_key': mapTileApiKey, 'notifications_enabled': notificationsEnabled, 'notify_on_new_message': notifyOnNewMessage, 'notify_on_new_channel_message': notifyOnNewChannelMessage, 'notify_on_new_advert': notifyOnNewAdvert, + 'auto_send_zero_hop_advert_on_gps_update': + autoSendZeroHopAdvertOnGpsUpdate, + 'gps_interval_seconds': gpsIntervalSeconds, 'auto_route_rotation_enabled': autoRouteRotationEnabled, 'max_route_weight': maxRouteWeight, 'initial_route_weight': initialRouteWeight, @@ -270,11 +297,18 @@ class AppSettings { ), mapCacheMinZoom: json['map_cache_min_zoom'] as int? ?? 10, mapCacheMaxZoom: json['map_cache_max_zoom'] as int? ?? 15, + mapRasterSourceId: json['map_raster_source_id'] as String? ?? 'osm_auto', + mapTileEndpointId: json['map_tile_endpoint_id'] as String? ?? 'standard', + mapTileApiKey: json['map_tile_api_key'] as String?, notificationsEnabled: json['notifications_enabled'] as bool? ?? true, notifyOnNewMessage: json['notify_on_new_message'] as bool? ?? true, notifyOnNewChannelMessage: json['notify_on_new_channel_message'] as bool? ?? true, notifyOnNewAdvert: json['notify_on_new_advert'] as bool? ?? true, + autoSendZeroHopAdvertOnGpsUpdate: + json['auto_send_zero_hop_advert_on_gps_update'] as bool? ?? false, + gpsIntervalSeconds: + (json['gps_interval_seconds'] as num?)?.toInt() ?? 900, autoRouteRotationEnabled: json['auto_route_rotation_enabled'] as bool? ?? true, maxRouteWeight: (json['max_route_weight'] as num?)?.toDouble() ?? 5.0, @@ -379,10 +413,15 @@ class AppSettings { Object? mapCacheBounds = _unset, int? mapCacheMinZoom, int? mapCacheMaxZoom, + String? mapRasterSourceId, + String? mapTileEndpointId, + Object? mapTileApiKey = _unset, bool? notificationsEnabled, bool? notifyOnNewMessage, bool? notifyOnNewChannelMessage, bool? notifyOnNewAdvert, + bool? autoSendZeroHopAdvertOnGpsUpdate, + int? gpsIntervalSeconds, bool? autoRouteRotationEnabled, double? maxRouteWeight, double? initialRouteWeight, @@ -428,11 +467,20 @@ class AppSettings { : mapCacheBounds as Map?, mapCacheMinZoom: mapCacheMinZoom ?? this.mapCacheMinZoom, mapCacheMaxZoom: mapCacheMaxZoom ?? this.mapCacheMaxZoom, + mapRasterSourceId: mapRasterSourceId ?? this.mapRasterSourceId, + mapTileEndpointId: mapTileEndpointId ?? this.mapTileEndpointId, + mapTileApiKey: mapTileApiKey == _unset + ? this.mapTileApiKey + : mapTileApiKey as String?, notificationsEnabled: notificationsEnabled ?? this.notificationsEnabled, notifyOnNewMessage: notifyOnNewMessage ?? this.notifyOnNewMessage, notifyOnNewChannelMessage: notifyOnNewChannelMessage ?? this.notifyOnNewChannelMessage, notifyOnNewAdvert: notifyOnNewAdvert ?? this.notifyOnNewAdvert, + autoSendZeroHopAdvertOnGpsUpdate: + autoSendZeroHopAdvertOnGpsUpdate ?? + this.autoSendZeroHopAdvertOnGpsUpdate, + gpsIntervalSeconds: gpsIntervalSeconds ?? this.gpsIntervalSeconds, autoRouteRotationEnabled: autoRouteRotationEnabled ?? this.autoRouteRotationEnabled, maxRouteWeight: maxRouteWeight ?? this.maxRouteWeight, diff --git a/lib/models/channel.dart b/lib/models/channel.dart index 9baf6302..324157ef 100644 --- a/lib/models/channel.dart +++ b/lib/models/channel.dart @@ -27,6 +27,10 @@ class Channel { bool get isPublicChannel => pskHex == publicChannelPsk; + bool get isHashtagChannel => name.startsWith('#'); + + bool get isPrivateChannel => !isPublicChannel && !isHashtagChannel; + static Channel? fromFrame(Uint8List frame) { // CHANNEL_INFO format: // [0] = RESP_CODE_CHANNEL_INFO (18) diff --git a/lib/models/channel_message.dart b/lib/models/channel_message.dart index 80c9705b..0113c807 100644 --- a/lib/models/channel_message.dart +++ b/lib/models/channel_message.dart @@ -41,6 +41,7 @@ class ChannelMessage { final List repeats; final int repeatCount; final int? pathLength; + final int? pathHashWidth; final Uint8List pathBytes; final List pathVariants; final int? channelIndex; @@ -66,6 +67,7 @@ class ChannelMessage { this.repeats = const [], this.repeatCount = 0, this.pathLength, + this.pathHashWidth, Uint8List? pathBytes, List? pathVariants, this.channelIndex, @@ -93,6 +95,7 @@ class ChannelMessage { List? repeats, int? repeatCount, int? pathLength, + int? pathHashWidth, Uint8List? pathBytes, List? pathVariants, String? packetHash, @@ -129,6 +132,7 @@ class ChannelMessage { repeats: repeats ?? this.repeats, repeatCount: repeatCount ?? this.repeatCount, pathLength: pathLength ?? this.pathLength, + pathHashWidth: pathHashWidth ?? this.pathHashWidth, pathBytes: pathBytes ?? this.pathBytes, pathVariants: pathVariants ?? this.pathVariants, channelIndex: channelIndex, @@ -155,6 +159,7 @@ class ChannelMessage { int pathLen; int txtType; + int? packetPathHashWidth; Uint8List pathBytes = Uint8List(0); int channelIdx; if (code == respCodeChannelMsgRecvV3) { @@ -163,12 +168,18 @@ class ChannelMessage { final hasPath = (flags & 0x01) != 0; reader.skipBytes(1); // Skip reserved byte channelIdx = reader.readByte(); - pathLen = reader.readInt8(); - txtType = reader.readByte(); - if (hasPath && pathLen > 0) { - reader.rewind(); // Rewind to read path length again for pathBytes - pathBytes = reader.readBytes(pathLen); + final pathByte = reader.readUInt8(); + // pathByte packs: top 2 bits = hash width mode, low 6 bits = hop count + packetPathHashWidth = ((pathByte & 0xC0) >> 6) + 1; + final hopCount = pathByte & 0x3F; + pathLen = hopCount; + // If a path is present, read hopCount * width bytes + if (hasPath && hopCount > 0) { + final totalPathBytes = hopCount * packetPathHashWidth; + pathBytes = reader.readBytes(totalPathBytes); } + // After consuming optional path bytes, read the text type byte. + txtType = reader.readByte(); } else { channelIdx = reader.readByte(); pathLen = reader.readInt8(); @@ -209,6 +220,7 @@ class ChannelMessage { isOutgoing: false, status: ChannelMessageStatus.sent, pathLength: pathLen, + pathHashWidth: packetPathHashWidth, pathBytes: pathBytes, channelIndex: channelIdx, ); diff --git a/lib/models/community.dart b/lib/models/community.dart index 7261ddf9..c0abf7f0 100644 --- a/lib/models/community.dart +++ b/lib/models/community.dart @@ -1,8 +1,8 @@ import 'dart:convert'; -import 'dart:math'; import 'dart:typed_data'; import 'package:crypto/crypto.dart' as crypto; +import 'package:meshcore_open/utils/keys.dart'; import 'channel.dart'; @@ -37,11 +37,7 @@ class Community { /// Generate a new community with a random 32-byte secret factory Community.create({required String id, required String name}) { - final random = Random.secure(); - final secret = Uint8List(32); - for (int i = 0; i < 32; i++) { - secret[i] = random.nextInt(256); - } + final secret = randomBytes(32); return Community( id: id, name: name, @@ -210,12 +206,7 @@ class Community { /// Create a copy of this community with a regenerated random secret Community withRegeneratedSecret() { - final random = Random.secure(); - final newSecret = Uint8List(32); - for (int i = 0; i < 32; i++) { - newSecret[i] = random.nextInt(256); - } - return withNewSecret(newSecret); + return withNewSecret(randomBytes(32)); } /// Extract secret from QR data (for updating existing community) diff --git a/lib/models/contact.dart b/lib/models/contact.dart index 74f0cd31..924174fd 100644 --- a/lib/models/contact.dart +++ b/lib/models/contact.dart @@ -117,7 +117,7 @@ class Contact { String pathFormattedIdList(int hashByteWidth) { final pathBytes = pathBytesForDisplay; if (pathBytes.isEmpty) return ''; - final w = hashByteWidth.clamp(1, 8); + final w = hashByteWidth.clamp(1, 4); final parts = []; for (int i = 0; i < pathBytes.length; i += w) { final end = (i + w) <= pathBytes.length ? (i + w) : pathBytes.length; @@ -164,8 +164,18 @@ class Contact { final type = reader.readByte(); final flags = reader.readByte(); final pathLen = reader.readByte(); - final safePathLen = pathLen > 0 - ? (pathLen > maxPathSize ? maxPathSize : pathLen) + int hopCount = 0; + int byteLen = 0; + if (pathLen == 0xFF) { + hopCount = -1; + } else { + final mode = (pathLen & 0xC0) >> 6; + hopCount = pathLen & 0x3F; + final width = mode + 1; + byteLen = hopCount * width; + } + final safePathLen = byteLen > 0 + ? (byteLen > maxPathSize ? maxPathSize : byteLen) : 0; final pathBytes = reader.readBytes(maxPathSize).sublist(0, safePathLen); final name = reader.readCStringGreedy(maxNameSize); @@ -211,7 +221,7 @@ class Contact { name: name.isEmpty ? 'Unknown' : name, type: type, flags: flags, - pathLength: (pathLen == 0xFF || pathLen > maxPathSize) ? -1 : pathLen, + pathLength: hopCount, path: pathBytes, latitude: lat, longitude: lon, diff --git a/lib/models/display_path.dart b/lib/models/display_path.dart index 71f8ed53..b82574cc 100644 --- a/lib/models/display_path.dart +++ b/lib/models/display_path.dart @@ -1,3 +1,4 @@ +import 'dart:typed_data'; import 'dart:ui'; import 'package:latlong2/latlong.dart'; @@ -13,8 +14,8 @@ class DisplayPath { final Color color; final bool isPrimary; - /// Outbound hop bytes, including hops that could not be placed on the map. - final List hopBytes; + /// Outbound hop prefixes, 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 diff --git a/lib/models/radio_settings.dart b/lib/models/radio_settings.dart index e74cf209..6f5911e0 100644 --- a/lib/models/radio_settings.dart +++ b/lib/models/radio_settings.dart @@ -81,6 +81,16 @@ class RadioSettings { txPowerDbm: 20, ), ), + ( + 'Australia (Mid)', + RadioSettings( + frequencyMHz: 915.075, + bandwidth: LoRaBandwidth.bw125, + spreadingFactor: LoRaSpreadingFactor.sf9, + codingRate: LoRaCodingRate.cr4_5, + txPowerDbm: 20, + ), + ), ( 'Australia SA, WA, QLD', RadioSettings( diff --git a/lib/screens/app_settings_screen.dart b/lib/screens/app_settings_screen.dart index e54687c9..8405beca 100644 --- a/lib/screens/app_settings_screen.dart +++ b/lib/screens/app_settings_screen.dart @@ -8,6 +8,7 @@ import '../l10n/l10n.dart'; import '../models/app_settings.dart'; import '../models/translation_support.dart'; import '../services/app_settings_service.dart'; +import '../services/map_tile_cache_service.dart'; import '../services/notification_service.dart'; import '../services/translation_service.dart'; import '../theme/mesh_theme.dart'; @@ -699,52 +700,229 @@ class AppSettingsScreen extends StatelessWidget { ) { final scheme = Theme.of(context).colorScheme; final textTheme = Theme.of(context).textTheme; - return Column( - children: [ - SwitchListTile( - contentPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 4, + final children = [ + SwitchListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), + 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, + ), + 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, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], ), - 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, + ), + 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, + ), + ], ), - 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, + ), + 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, + ), + ], ), - 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: () => _showMapRasterSourceDialog(context, settingsService), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Icon( + Icons.layers_outlined, + size: 20, + color: scheme.onSurfaceVariant, + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + context.l10n.appSettings_rasterTileSource, + style: textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 2), + Text( + _mapRasterSourceSummary(settingsService.settings), + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + ), + ], + ), + ), + Icon( + Icons.chevron_right, + color: scheme.onSurfaceVariant, + size: 16, + ), + ], + ), + ), + ), + ]; + + if (_isStadiaSource(settingsService.settings)) { + children.addAll([ const Divider(height: 1, indent: 16), InkWell( - onTap: () => _showTimeFilterSheet(context, settingsService), + onTap: () => _showMapRasterEndpointDialog(context, settingsService), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), child: Row( children: [ Icon( - Icons.timer_outlined, + Icons.public_outlined, size: 20, color: scheme.onSurfaceVariant, ), @@ -754,19 +932,14 @@ class AppSettingsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - context.l10n.appSettings_timeFilter, + context.l10n.appSettings_stadiaEndpoint, 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(), - ), + _mapRasterEndpointSummary(settingsService.settings), style: textTheme.bodySmall?.copyWith( color: scheme.onSurfaceVariant, ), @@ -785,13 +958,13 @@ class AppSettingsScreen extends StatelessWidget { ), const Divider(height: 1, indent: 16), InkWell( - onTap: () => _showUnitsSheet(context, settingsService), + onTap: () => _showMapApiKeyDialog(context, settingsService), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), child: Row( children: [ Icon( - Icons.straighten, + Icons.key_outlined, size: 20, color: scheme.onSurfaceVariant, ), @@ -801,17 +974,14 @@ class AppSettingsScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - context.l10n.appSettings_unitsTitle, + context.l10n.appSettings_stadiaApiKey, 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, + _mapApiKeySummary(context, settingsService.settings), style: textTheme.bodySmall?.copyWith( color: scheme.onSurfaceVariant, ), @@ -828,59 +998,208 @@ class AppSettingsScreen extends StatelessWidget { ), ), ), - 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( + ]); + } + + return Column(children: children); + } + + String _mapRasterSourceSummary(AppSettings settings) { + final source = MapRasterSourceCatalog.fromSettings(settings); + return '${source.label} - ${source.description}'; + } + + bool _isStadiaSource(AppSettings settings) { + return MapRasterSourceCatalog.fromSettings(settings).isStadia; + } + + String _mapRasterEndpointSummary(AppSettings settings) { + final endpoint = MapRasterEndpointCatalog.fromSettings(settings); + return '${endpoint.label} - ${endpoint.description}'; + } + + String _mapApiKeySummary(BuildContext context, AppSettings settings) { + return context.l10n.appSettings_stadiaApiKeyConfigured( + _maskApiKey(settings.effectiveMapTileApiKey), + ); + } + + String _maskApiKey(String value) { + if (value.length <= 8) return '********'; + return '${value.substring(0, 4)}...${value.substring(value.length - 4)}'; + } + + void _showMapRasterSourceDialog( + BuildContext context, + AppSettingsService settingsService, + ) { + String selectedId = settingsService.settings.mapRasterSourceId; + showDialog( + context: context, + builder: (dialogContext) => StatefulBuilder( + builder: (dialogContext, setState) => AlertDialog( + title: Text(context.l10n.appSettings_rasterTileSource), + content: SizedBox( + width: 360, + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(dialogContext).size.height * 0.6, + ), + child: SingleChildScrollView( + child: RadioGroup( + groupValue: selectedId, + onChanged: (value) { + if (value == null) return; + setState(() { + selectedId = value; + }); + }, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, children: [ - Text( - context.l10n.appSettings_offlineMapCache, - style: textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w600, + for (final preset in MapRasterSourcePreset.values) + Builder( + builder: (context) { + final option = MapRasterSourceCatalog.fromPreset( + preset, + ); + return RadioListTile( + value: preset.id, + title: Text(option.label), + subtitle: Text(option.description), + ); + }, ), - ), - 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, - ), - ], + ), ), ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(context.l10n.common_cancel), + ), + TextButton( + onPressed: () async { + await settingsService.setMapRasterSourceId(selectedId); + if (!dialogContext.mounted) return; + Navigator.pop(dialogContext); + }, + child: Text(context.l10n.common_save), + ), + ], ), - ], + ), + ); + } + + void _showMapRasterEndpointDialog( + BuildContext context, + AppSettingsService settingsService, + ) { + String selectedId = settingsService.settings.mapTileEndpointId; + showDialog( + context: context, + builder: (dialogContext) => StatefulBuilder( + builder: (dialogContext, setState) => AlertDialog( + title: Text(context.l10n.appSettings_stadiaEndpoint), + content: SizedBox( + width: 360, + child: RadioGroup( + groupValue: selectedId, + onChanged: (value) { + if (value == null) return; + setState(() { + selectedId = value; + }); + }, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + for (final option in MapRasterEndpointCatalog.presets) + RadioListTile( + value: option.id, + title: Text(option.label), + subtitle: Text(option.description), + ), + ], + ), + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(context.l10n.common_cancel), + ), + TextButton( + onPressed: () async { + await settingsService.setMapTileEndpointId(selectedId); + if (!dialogContext.mounted) return; + Navigator.pop(dialogContext); + }, + child: Text(context.l10n.common_save), + ), + ], + ), + ), + ); + } + + void _showMapApiKeyDialog( + BuildContext context, + AppSettingsService settingsService, + ) { + final currentApiKey = settingsService.settings.mapTileApiKey?.trim() ?? ''; + final maskedApiKey = _maskApiKey( + currentApiKey.isEmpty ? AppSettings.stadiaDemo : currentApiKey, + ); + final controller = TextEditingController(text: maskedApiKey); + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.appSettings_stadiaApiKey), + content: SizedBox( + width: 420, + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(context.l10n.appSettings_stadiaApiKeyDialogDescription), + const SizedBox(height: 12), + TextField( + controller: controller, + autofocus: true, + autocorrect: false, + enableSuggestions: false, + autofillHints: const [AutofillHints.password], + decoration: const InputDecoration( + border: OutlineInputBorder(), + hintText: '4e1bf343-3d91-4d9c-a8e1-1234567890ab', + ), + ), + ], + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(context.l10n.common_cancel), + ), + TextButton( + onPressed: () async { + final apiKey = controller.text.trim(); + await settingsService.setMapTileApiKey( + apiKey == maskedApiKey ? currentApiKey : apiKey, + ); + if (!dialogContext.mounted) return; + Navigator.pop(dialogContext); + }, + child: Text(context.l10n.common_save), + ), + ], + ), ); } diff --git a/lib/screens/ble_debug_log_screen.dart b/lib/screens/ble_debug_log_screen.dart index c229c2e5..7eb4aa5f 100644 --- a/lib/screens/ble_debug_log_screen.dart +++ b/lib/screens/ble_debug_log_screen.dart @@ -10,6 +10,13 @@ import '../helpers/snack_bar_builder.dart'; enum _BleLogView { frames, rawLogRx } +int _decodeRawPathByteLen(int pathLenRaw) { + if (pathLenRaw == 0xFF || pathLenRaw == 0) return 0; + final hashCount = pathLenRaw & 0x3F; + final hashWidth = ((pathLenRaw >> 6) & 0x03) + 1; + return hashCount * hashWidth; +} + class BleDebugLogScreen extends StatefulWidget { const BleDebugLogScreen({super.key}); @@ -110,20 +117,32 @@ class _BleDebugLogScreenState extends State { 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 GestureDetector( - onLongPress: () async { - await Clipboard.setData( - ClipboardData( - text: entry.payload - .map( - (b) => b - .toRadixString(16) - .padLeft(2, '0'), - ) - .join(''), + Future copyHex() async { + await Clipboard.setData( + ClipboardData( + text: entry.payload + .map( + (b) => b + .toRadixString(16) + .padLeft(2, '0'), + ) + .join(''), + ), + ); + if (context.mounted) { + showDismissibleSnackBar( + context, + content: Text( + context.l10n.debugLog_bleCopied, ), ); - }, + } + } + + return GestureDetector( + onTap: copyHex, + onLongPress: copyHex, + onSecondaryTap: copyHex, child: Container( color: MeshPalette.bg, padding: const EdgeInsets.symmetric( @@ -302,16 +321,17 @@ class _BleDebugLogScreenState extends State { rawHex: _bytesToHex(raw), ); } - final pathLen = raw[index++]; - if (raw.length < index + pathLen) { + final pathLenRaw = raw[index++]; + final pathByteLen = _decodeRawPathByteLen(pathLenRaw); + if (raw.length < index + pathByteLen) { return _RawPacketInfo( title: 'RX RAW_LOG_RX_DATA • ${_payloadTypeLabel(payloadType)}', summary: 'Truncated path', rawHex: _bytesToHex(raw), ); } - final pathBytes = raw.sublist(index, index + pathLen); - index += pathLen; + final pathBytes = raw.sublist(index, index + pathByteLen); + index += pathByteLen; if (raw.length <= index) { return _RawPacketInfo( title: 'RX RAW_LOG_RX_DATA • ${_payloadTypeLabel(payloadType)}', @@ -324,7 +344,7 @@ class _BleDebugLogScreenState extends State { final title = 'RX ${_payloadTypeLabel(payloadType)} • ${_routeLabel(routeType)} • v$payloadVer'; final summary = _decodePayloadSummary(payloadType, payload); - final pathSummary = pathLen > 0 + final pathSummary = pathByteLen > 0 ? 'Path=${_bytesToHex(pathBytes)}' : 'Path=none'; final detail = '$summary • $pathSummary • len=${raw.length}'; diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index 94101ef3..2e7c3b68 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -16,6 +16,7 @@ import '../helpers/chat_scroll_controller.dart'; import '../connector/meshcore_protocol.dart'; import '../helpers/cyr2lat.dart'; import '../helpers/gif_helper.dart'; +import '../helpers/path_helper.dart'; import '../helpers/reaction_helper.dart'; import '../helpers/snack_bar_builder.dart'; import '../l10n/l10n.dart'; @@ -42,6 +43,8 @@ import '../theme/mesh_theme.dart'; import '../widgets/mesh_ui.dart'; import 'channel_message_path_screen.dart'; import 'map_screen.dart'; +import 'region_management_screen.dart'; +import '../storage/region_store.dart'; class ChannelChatScreen extends StatefulWidget { final Channel channel; @@ -273,46 +276,63 @@ class _ChannelChatScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Row( - children: [ - _channelIcon(widget.channel), - const SizedBox(width: 8), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - widget.channel.name.isEmpty - ? context.l10n.channels_channelIndex( - widget.channel.index, - ) - : widget.channel.name, - style: const TextStyle(fontSize: 16), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Consumer( - builder: (context, connector, _) { - final unreadCount = connector - .getUnreadCountForChannelIndex(widget.channel.index); - final privacy = widget.channel.isPublicChannel - ? context.l10n.channels_public - : context.l10n.channels_private; - return Text( - '$privacy • ${context.l10n.chat_unread(unreadCount)}', - overflow: TextOverflow.ellipsis, - style: const TextStyle(fontSize: 12), - ); - }, - ), - ], + title: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () => openRegionSelectDialog(widget.channel), + child: Row( + children: [ + _channelIcon(widget.channel), + const SizedBox(width: 8), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.channel.name.isEmpty + ? context.l10n.channels_channelIndex( + widget.channel.index, + ) + : widget.channel.name, + style: const TextStyle(fontSize: 16), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + Consumer( + builder: (context, connector, _) { + final unreadCount = connector + .getUnreadCountForChannelIndex( + widget.channel.index, + ); + final privacy = widget.channel.isPublicChannel + ? context.l10n.channels_public + : context.l10n.channels_private; + final region = connector.getChannelRegion( + widget.channel.index, + ); + final regionText = region.isNotEmpty + ? ' • ${context.l10n.channels_regionSetTo(region)}' + : ''; + return Text( + '$privacy • ${context.l10n.chat_unread(unreadCount)}$regionText', + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontSize: 12), + ); + }, + ), + ], + ), ), - ), - ], + ], + ), ), centerTitle: false, bottom: const SyncProgressAppBarBottom(), actions: [ + IconButton( + tooltip: context.l10n.channels_regionSelect_Title, + icon: const Icon(Icons.landscape), + onPressed: () => openRegionSelectDialog(widget.channel), + ), const RadioStatsIconButton(), PopupMenuButton( icon: const Icon(Icons.more_vert), @@ -511,6 +531,14 @@ class _ChannelChatScreenState extends State { : (message.pathVariants.isNotEmpty ? message.pathVariants.first : Uint8List(0)); + final displayPathHashWidth = + message.pathHashWidth ?? + context.read().pathHashByteWidth; + final displayHopCount = _displayHopCount( + displayPath, + displayPathHashWidth, + message.pathLength, + ); // Bubble colors — outgoing uses MeshPalette.me / meBorder / meInk. final bubbleColor = isOutgoing @@ -550,10 +578,10 @@ class _ChannelChatScreenState extends State { mainAxisAlignment: isOutgoing ? MainAxisAlignment.end : MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, children: [ if (!isOutgoing) ...[ - _buildAvatar(message.senderName), + _buildAvatar(message.senderName, textScale), const SizedBox(width: 6), ], Flexible( @@ -591,10 +619,10 @@ class _ChannelChatScreenState extends State { : EdgeInsets.zero, child: Text( message.senderName, - style: MeshTheme.mono( - fontSize: 11, + style: TextStyle( + fontSize: 13 * textScale, fontWeight: FontWeight.w700, - color: _colorForName(message.senderName), + color: textColor, ), ), ), @@ -646,6 +674,9 @@ class _ChannelChatScreenState extends State { fontStyle: FontStyle.italic, color: textColor.withValues(alpha: 0.72), ), + onSecondaryTap: PlatformInfo.isDesktop + ? () => _showMessageActions(message) + : null, ), ), ], @@ -658,21 +689,25 @@ class _ChannelChatScreenState extends State { : EdgeInsets.zero, child: Row( mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ RouteChip( isDirect: (message.pathLength ?? -1) >= 0, - hops: (message.pathLength ?? -1) >= 0 - ? message.pathLength - : null, + hops: displayHopCount, ), const SizedBox(width: 4), - Text( - context.l10n.channels_via( - _formatPathPrefixes(displayPath), - ), - style: MeshTheme.mono( - fontSize: 9.5 * textScale, - color: metaColor, + Flexible( + child: Text( + context.l10n.channels_via( + _formatPathPrefixes( + displayPath, + displayPathHashWidth, + ), + ), + style: MeshTheme.mono( + fontSize: 9.5 * textScale, + color: metaColor, + ), ), ), ], @@ -1012,8 +1047,11 @@ class _ChannelChatScreenState extends State { ); } - Widget _buildAvatar(String senderName) { - return AvatarCircle(name: senderName, size: 32); + Widget _buildAvatar(String senderName, double textScale) { + return AvatarCircle( + name: senderName, + size: (32 * textScale).clamp(28.0, 56.0), + ); } Widget _buildReplyBanner(double textScale) { @@ -1176,25 +1214,19 @@ class _ChannelChatScreenState extends State { decoration: InputDecoration( hintText: context.l10n.chat_typeMessage, border: OutlineInputBorder( - borderRadius: BorderRadius.circular( - MeshRadii.pill, - ), + borderRadius: BorderRadius.circular(MeshRadii.md), borderSide: BorderSide( color: scheme.outlineVariant, ), ), enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - MeshRadii.pill, - ), + borderRadius: BorderRadius.circular(MeshRadii.md), borderSide: BorderSide( color: scheme.outlineVariant, ), ), focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular( - MeshRadii.pill, - ), + borderRadius: BorderRadius.circular(MeshRadii.md), borderSide: BorderSide( color: scheme.primary, width: 1.5, @@ -1550,27 +1582,133 @@ class _ChannelChatScreenState extends State { ); } - String _formatPathPrefixes(Uint8List pathBytes) { - return pathBytes - .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) - .join(','); + String _formatPathPrefixes(Uint8List pathBytes, int pathHashByteWidth) { + return PathHelper.splitPathBytes( + pathBytes, + pathHashByteWidth, + ).map(PathHelper.formatHopHex).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]; + int? _displayHopCount( + Uint8List pathBytes, + int pathHashByteWidth, + int? fallbackPathLength, + ) { + if ((fallbackPathLength ?? -1) < 0) return null; + if (pathBytes.isEmpty) return fallbackPathLength; + return PathHelper.splitPathBytes(pathBytes, pathHashByteWidth).length; + } + + Future openRegionSelectDialog(Channel channel) async { + // The AppBar subtitle reads the region from the connector inside a + // Consumer, so setChannelRegion's notifyListeners refreshes it directly — + // no post-dialog setState needed. + await showDialog( + context: context, + builder: (BuildContext context) => _RegionSelectDialog(channel: channel), + ); + } +} + +class _RegionSelectDialog extends StatefulWidget { + final Channel channel; + + const _RegionSelectDialog({required this.channel}); + + @override + State<_RegionSelectDialog> createState() => _RegionSelectDialogState(); +} + +class _RegionSelectDialogState extends State<_RegionSelectDialog> { + final RegionStore regionStore = RegionStore(); + + List regions = []; + int selectedIndex = -1; + + @override + void initState() { + super.initState(); + loadRegions(); + } + + void loadRegions() { + setState(() { + regions = regionStore.loadRegions(); + final channelRegion = context.read().getChannelRegion( + widget.channel.index, + ); + selectedIndex = regions.indexOf(channelRegion); + }); + } + + @override + Widget build(BuildContext context) { + return Dialog( + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppBar( + backgroundColor: Colors.transparent, + title: Text(context.l10n.channels_regionSelect_Title), + centerTitle: true, + actions: [ + IconButton( + tooltip: context.l10n.channels_clearRegion, + icon: const Icon(Icons.backspace_outlined), + onPressed: () { + context.read().setChannelRegion( + widget.channel.index, + '', + ); + Navigator.pop(context); + }, + ), + IconButton( + tooltip: context.l10n.settings_regionSettingsSubtitle, + icon: const Icon(Icons.settings), + onPressed: () async { + await pushRegionManagementScreen(context); + if (!mounted) return; + loadRegions(); + }, + ), + ], + ), + const SizedBox(height: 15), + Expanded( + child: ListView.builder( + itemCount: regions.length, + itemBuilder: (context, index) { + final selected = selectedIndex == index; + return ListTile( + leading: Icon( + Icons.landscape, + color: selected ? MeshPalette.blue : null, + ), + title: Text(regions[index]), + trailing: selected + ? const Icon(Icons.check, color: MeshPalette.blue) + : null, + tileColor: selected ? MeshPalette.blueBg : null, + onTap: () { + // Tapping the already-selected region clears it. + context.read().setChannelRegion( + widget.channel.index, + selected ? '' : regions[index], + ); + Navigator.pop(context); + }, + ); + }, + ), + ), + ], + ), + ), + ); } } diff --git a/lib/screens/channel_message_path_screen.dart b/lib/screens/channel_message_path_screen.dart index bc2ca1bd..3132bb46 100644 --- a/lib/screens/channel_message_path_screen.dart +++ b/lib/screens/channel_message_path_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:latlong2/latlong.dart'; +import 'package:meshcore_open/helpers/path_helper.dart'; import 'package:meshcore_open/screens/path_trace_map.dart'; import 'package:provider/provider.dart'; @@ -22,7 +23,6 @@ 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; @@ -43,19 +43,40 @@ class ChannelMessagePathScreen extends StatelessWidget { message.pathVariants, ); - final primaryPath = !channelMessage && !message.isOutgoing - ? Uint8List.fromList(primaryPathTmp.reversed.toList()) - : primaryPathTmp; + final hashByteWidth = + (message.pathHashWidth ?? connector.pathHashByteWidth) + .clamp(1, 4) + .toInt(); + final primaryPath = _orientPathBytes( + primaryPathTmp, + hashByteWidth, + reverse: !channelMessage && !message.isOutgoing, + ); final hops = _buildPathHops( primaryPath, connector, l10n, + hashByteWidth, resolveFromEnd: !message.isOutgoing, ); final hasHopDetails = primaryPath.isNotEmpty; - final observedLabel = _formatObservedHops( + + // Convert observed path byte length to hop count using the packet width. + // Legacy messages fall back to the current connector width. + // Reported path length (V3+) is already stored as a hop count; preserve + // the negative flood sentinel when present. + final observedHopCount = _hopCountFromBytes( primaryPath.length, - message.pathLength, + hashByteWidth, + ); + final reportedHopCount = message.pathLength; + final effectiveHopCount = observedHopCount > 0 + ? observedHopCount + : reportedHopCount; + + final observedLabel = _formatObservedHops( + observedHopCount, + effectiveHopCount, l10n, ); final extraPaths = _otherPaths(primaryPath, message.pathVariants); @@ -73,11 +94,8 @@ class ChannelMessagePathScreen extends StatelessWidget { title: context.l10n.contacts_repeaterPathTrace, path: primaryPath, flipPathAround: true, - reversePathAround: - !(!channelMessage && !message.isOutgoing), - pathHashByteWidth: context - .read() - .pathHashByteWidth, + reversePathAround: false, + pathHashByteWidth: hashByteWidth, ), ), ), @@ -98,13 +116,20 @@ class ChannelMessagePathScreen extends StatelessWidget { child: ListView( padding: const EdgeInsets.symmetric(vertical: 8), children: [ - _buildSummaryCard(context, observedLabel: observedLabel), + _buildSummaryCard( + context, + observedLabel: observedLabel, + effectiveHopCount: effectiveHopCount, + ), + const SizedBox(height: 16), if (extraPaths.isNotEmpty) ...[ SectionHeader( l10n.channelPath_otherObservedPaths, padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), ), - _buildPathVariants(context, extraPaths), + const SizedBox(height: 8), + _buildPathVariants(context, extraPaths, hashByteWidth), + const SizedBox(height: 16), ], SectionHeader( l10n.channelPath_repeaterHops, @@ -123,14 +148,18 @@ class ChannelMessagePathScreen extends StatelessWidget { ); } - Widget _buildSummaryCard(BuildContext context, {String? observedLabel}) { + Widget _buildSummaryCard( + BuildContext context, { + String? observedLabel, + required int? effectiveHopCount, + }) { final l10n = context.l10n; final scheme = Theme.of(context).colorScheme; - final routeChip = message.pathLength == null + final routeChip = effectiveHopCount == null ? null - : message.pathLength! < 0 + : effectiveHopCount < 0 ? const RouteChip(isDirect: false) - : RouteChip(isDirect: true, hops: message.pathLength); + : RouteChip(isDirect: true, hops: effectiveHopCount); return MeshCard( margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), @@ -172,7 +201,7 @@ class ChannelMessagePathScreen extends StatelessWidget { _buildDetailRow( context, l10n.channelPath_pathLabelTitle, - _formatPathLabel(message.pathLength, l10n), + _formatPathLabel(effectiveHopCount, l10n), scheme: scheme, ), if (observedLabel != null) @@ -187,7 +216,11 @@ class ChannelMessagePathScreen extends StatelessWidget { ); } - Widget _buildPathVariants(BuildContext context, List variants) { + Widget _buildPathVariants( + BuildContext context, + List variants, + int hashByteWidth, + ) { final l10n = context.l10n; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -210,7 +243,11 @@ class ChannelMessagePathScreen extends StatelessWidget { Text( l10n.channelPath_observedPathTitle( i + 1, - _formatHopCount(variants[i].length, l10n), + _formatHopCount( + variants[i].length, + hashByteWidth, + l10n, + ), ), style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, @@ -218,7 +255,7 @@ class ChannelMessagePathScreen extends StatelessWidget { ), const SizedBox(height: 2), Text( - _formatPathPrefixes(variants[i]), + _formatPathPrefixes(variants[i], hashByteWidth), style: MeshTheme.mono( fontSize: 11, color: Theme.of(context).colorScheme.onSurfaceVariant, @@ -402,31 +439,31 @@ class ChannelMessagePathScreen extends StatelessWidget { ); } - String _formatPathLabel(int? pathLength, AppLocalizations l10n) { - if (pathLength == null) return l10n.channelPath_unknownPath; - if (pathLength < 0) return l10n.channelPath_floodPath; - if (pathLength == 0) return l10n.channelPath_directPath; - return l10n.chat_hopsCount(pathLength); + String _formatPathLabel(int? hopCount, AppLocalizations l10n) { + if (hopCount == null) return l10n.channelPath_unknownPath; + if (hopCount < 0) return l10n.channelPath_floodPath; + if (hopCount == 0) return l10n.channelPath_directPath; + return l10n.chat_hopsCount(hopCount); } String? _formatObservedHops( int observedCount, - int? pathLength, + int? targetHopCount, AppLocalizations l10n, ) { - if (observedCount <= 0 && (pathLength == null || pathLength <= 0)) { + if (observedCount <= 0 && (targetHopCount == null || targetHopCount <= 0)) { return null; } - if (pathLength == null || pathLength < 0) { + if (targetHopCount == null || targetHopCount < 0) { return observedCount > 0 ? l10n.chat_hopsCount(observedCount) : null; } if (observedCount == 0) { - return l10n.channelPath_observedZeroOf(pathLength); + return l10n.channelPath_observedZeroOf(targetHopCount); } - if (observedCount == pathLength) { + if (observedCount == targetHopCount) { return l10n.chat_hopsCount(observedCount); } - return l10n.channelPath_observedSomeOf(observedCount, pathLength); + return l10n.channelPath_observedSomeOf(observedCount, targetHopCount); } Widget _buildDetailRow( @@ -623,7 +660,10 @@ class _ChannelMessagePathMapScreenState ? kPrimaryPathColor : kAlternatePathColors[(index - 1) % kAlternatePathColors.length], isPrimary: isPrimary, - hopBytes: List.from(orientedBytes), + hopBytes: [ + for (final hop in hops) + if (hop.hopBytes != null) Uint8List.fromList(hop.hopBytes!), + ], points: points, pointLabels: labels, pointConfirmed: confirmed, @@ -808,7 +848,11 @@ class _ChannelMessagePathMapScreenState primaryPath, ); - final selectedPath = _orientPath(selectedPathTmp); + final width = + (widget.message.pathHashWidth ?? connector.pathHashByteWidth) + .clamp(1, 4) + .toInt(); + final selectedPath = _orientPath(selectedPathTmp, width); // Match on the unoriented bytes — observedPaths stores them as // recorded, while selectedPath may be reversed for display. @@ -817,19 +861,21 @@ class _ChannelMessagePathMapScreenState selectedPath, connector, context.l10n, + width, resolveFromEnd: !widget.message.isOutgoing, ); // 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 oriented = _orientPath(observedPaths[i].pathBytes, width); final pathHops = i == selectedIndex ? hops : _buildPathHops( oriented, connector, context.l10n, + width, resolveFromEnd: !widget.message.isOutgoing, ); final display = _buildDisplayPath( @@ -908,7 +954,7 @@ class _ChannelMessagePathMapScreenState ? LatLngBounds.fromPoints(points) : null; final mapKey = ValueKey( - '${_formatPathPrefixes(selectedPath)},${context.l10n.pathTrace_you}', + '${_formatPathPrefixes(selectedPath, width)},${context.l10n.pathTrace_you}', ); _pathDistance = _getPathDistance(points); @@ -967,7 +1013,7 @@ class _ChannelMessagePathMapScreenState }, ), children: [ - ThemedMapTileLayer(tileCache: tileCache), + tileCache.buildTileLayer(context), AnimatedBuilder( animation: _playback, builder: (context, _) { @@ -1045,6 +1091,7 @@ class _ChannelMessagePathMapScreenState context, observedPaths, selectedIndex, + width, (index) { setState(() { _selectedPath = observedPaths[index].pathBytes; @@ -1086,10 +1133,12 @@ class _ChannelMessagePathMapScreenState BuildContext context, List<_ObservedPath> paths, int selectedIndex, + int hashByteWidth, ValueChanged onSelected, { double topOffset = 16, }) { final l10n = context.l10n; + final width = hashByteWidth.clamp(1, 4).toInt(); final selectedPath = paths[selectedIndex]; final label = selectedPath.isPrimary ? l10n.channelPath_primaryPath(selectedIndex + 1) @@ -1120,7 +1169,7 @@ class _ChannelMessagePathMapScreenState value: i, child: Text( '${paths[i].isPrimary ? l10n.channelPath_primaryPath(i + 1) : l10n.channelPath_pathLabel(i + 1)}' - ' • ${_formatHopCount(paths[i].pathBytes.length, l10n)}', + ' • ${_formatHopCount(paths[i].pathBytes.length, width, l10n)}', ), ), ], @@ -1134,7 +1183,7 @@ class _ChannelMessagePathMapScreenState Text( l10n.channelPath_selectedPathLabel( label, - _formatPathPrefixes(selectedPath.pathBytes), + _formatPathPrefixes(selectedPath.pathBytes, width), ), style: TextStyle( color: Theme.of(context).colorScheme.onSurfaceVariant, @@ -1378,11 +1427,11 @@ class _ChannelMessagePathMapScreenState } /// Orients recorded path bytes in the direction the packet traveled. - Uint8List _orientPath(Uint8List bytes) { + Uint8List _orientPath(Uint8List bytes, int hashByteWidth) { final reverse = (!widget.message.isOutgoing && !widget.channelMessage) || (widget.message.isOutgoing && widget.channelMessage); - return reverse ? Uint8List.fromList(bytes.reversed.toList()) : bytes; + return _orientPathBytes(bytes, hashByteWidth, reverse: reverse); } Marker _buildNodeLabelMarker({required LatLng point, required String label}) { @@ -1738,6 +1787,7 @@ class _PathHop { final Contact? contact; final LatLng? position; final AppLocalizations l10n; + final Uint8List? hopBytes; const _PathHop({ required this.index, @@ -1745,12 +1795,18 @@ class _PathHop { required this.contact, required this.position, required this.l10n, + this.hopBytes, }); bool get hasLocation => position != null; String get displayLabel { - final prefixLabel = _formatPrefix(prefix); + final prefixLabel = hopBytes != null && hopBytes!.isNotEmpty + ? hopBytes! + .map((b) => b.toRadixString(16).padLeft(2, '0')) + .join('') + .toUpperCase() + : _formatPrefix(prefix); return '($prefixLabel) ${_resolveName(contact, l10n)}'; } } @@ -1765,10 +1821,12 @@ class _ObservedPath { List<_PathHop> _buildPathHops( Uint8List pathBytes, MeshCoreConnector connector, - AppLocalizations l10n, { + AppLocalizations l10n, + int hashByteWidth, { bool resolveFromEnd = false, }) { if (pathBytes.isEmpty) return const []; + final width = hashByteWidth.clamp(1, 4).toInt(); final endpoint = (connector.selfLatitude != null && connector.selfLongitude != null) ? LatLng(connector.selfLatitude!, connector.selfLongitude!) @@ -1778,19 +1836,23 @@ List<_PathHop> _buildPathHops( contacts: connector.allContacts, endpoint: endpoint, resolveFromEnd: resolveFromEnd, + pathHashByteWidth: width, ); + final hopChunks = PathHelper.splitPathBytes(pathBytes, width); final hops = <_PathHop>[]; - for (var i = 0; i < pathBytes.length; i++) { - final contact = resolvedContacts[i]; + for (var i = 0; i < hopChunks.length; i++) { + final hopBytes = hopChunks[i]; + final contact = i < resolvedContacts.length ? resolvedContacts[i] : null; final resolvedPosition = _resolvePosition(contact); hops.add( _PathHop( index: i + 1, - prefix: pathBytes[i], + prefix: hopBytes.isNotEmpty ? hopBytes[0] : 0, contact: contact, position: resolvedPosition, l10n: l10n, + hopBytes: hopBytes, ), ); } @@ -1810,14 +1872,35 @@ String _formatPrefix(int prefix) { return prefix.toRadixString(16).padLeft(2, '0').toUpperCase(); } -String _formatPathPrefixes(Uint8List pathBytes) { - return pathBytes - .map((b) => b.toRadixString(16).padLeft(2, '0').toUpperCase()) - .join(','); +String _formatPathPrefixes(Uint8List pathBytes, int hashByteWidth) { + return PathHelper.splitPathBytes( + pathBytes, + hashByteWidth, + ).map(PathHelper.formatHopHex).join(','); } -String _formatHopCount(int count, AppLocalizations l10n) { - return l10n.chat_hopsCount(count); +Uint8List _orientPathBytes( + Uint8List pathBytes, + int hashByteWidth, { + required bool reverse, +}) { + if (!reverse || pathBytes.isEmpty) return pathBytes; + final hops = PathHelper.splitPathBytes(pathBytes, hashByteWidth); + return Uint8List.fromList([for (final hop in hops.reversed) ...hop]); +} + +int _hopCountFromBytes(int byteCount, int hashByteWidth) { + if (byteCount <= 0) return 0; + final width = hashByteWidth.clamp(1, 4).toInt(); + return (byteCount + width - 1) ~/ width; +} + +String _formatHopCount( + int byteCount, + int hashByteWidth, + AppLocalizations l10n, +) { + return l10n.chat_hopsCount(_hopCountFromBytes(byteCount, hashByteWidth)); } String _resolveName(Contact? contact, AppLocalizations l10n) { diff --git a/lib/screens/channels_screen.dart b/lib/screens/channels_screen.dart index dce3dfc3..1867f5de 100644 --- a/lib/screens/channels_screen.dart +++ b/lib/screens/channels_screen.dart @@ -1,9 +1,9 @@ import 'dart:async'; -import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:meshcore_open/storage/channel_message_store.dart'; +import 'package:meshcore_open/utils/keys.dart'; import 'package:meshcore_open/utils/platform_info.dart'; import 'package:meshcore_open/widgets/app_bar.dart'; import 'package:provider/provider.dart'; @@ -27,6 +27,7 @@ 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/gif_helper.dart'; import '../helpers/snack_bar_builder.dart'; import 'channel_chat_screen.dart'; import 'community_qr_scanner_screen.dart'; @@ -372,13 +373,30 @@ class _ChannelsScreenState extends State _communityIndex, ); final bool isCommunityChannel = Channel.isCommunityChannel(channelType); + final community = isCommunityChannel + ? _communityIndex.getCommunityForChannel(channel) + : null; + // Only flood-routed channels carry a region; show it when one is set. + String subtitle = connector.hasChannelRegion(channel.index) + ? context.l10n.channels_regionSetTo( + connector.getChannelRegion(channel.index), + ) + : ''; switch (channelType) { case ChannelType.communityPublic: icon = Icons.groups; iconColor = MeshPalette.magenta; + if (community != null) { + subtitle = + '${context.l10n.community_publicChannel} • ${community.name}'; + } case ChannelType.communityHashtag: icon = Icons.groups; iconColor = MeshPalette.magenta; + if (community != null) { + subtitle = + '${context.l10n.community_hashtagChannel} • ${community.name}'; + } case ChannelType.public: icon = Icons.public; iconColor = MeshPalette.signal; @@ -393,7 +411,12 @@ class _ChannelsScreenState extends State // Last message preview final messages = connector.getChannelMessages(channel); final lastMessage = messages.isNotEmpty ? messages.last : null; - final lastPreview = lastMessage?.text ?? ''; + final lastMessageText = lastMessage?.text ?? ''; + final lastPreview = + lastMessageText.isNotEmpty && + GifHelper.parseGif(lastMessageText) != null + ? context.l10n.chat_receivedGif + : lastMessageText; final lastTime = lastMessage?.timestamp; final channelLabel = channel.name.isEmpty @@ -427,142 +450,156 @@ class _ChannelsScreenState extends State 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, - ), - ), - ), - ], - ), - 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, - ), - ], - ], + onSecondaryTap: PlatformInfo.isDesktop + ? () => _showChannelActions( + this.context, + connector, + channelMessageStore, + channel, + ) + : null, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Leading avatar with optional community badge + Stack( + clipBehavior: Clip.none, + children: [ + AvatarCircle( + name: channelLabel, + size: 42, + color: iconColor, + icon: icon, ), - ), - const SizedBox(width: 8), - // Right side: time + unread badge + muted + drag handle - Column( - crossAxisAlignment: CrossAxisAlignment.end, + 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, + ), + ), + ), + ], + ), + const SizedBox(width: 12), + // Title + subtitle + ch chip + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, 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, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - if (isMuted) ...[ - Icon( - Icons.notifications_off, - size: 14, - color: scheme.onSurfaceVariant, + Expanded( + child: Text( + channelLabel, + style: Theme.of(context).textTheme.bodyMedium + ?.copyWith(fontWeight: FontWeight.w500), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), - const SizedBox(width: 4), - ], - if (unreadCount > 0) UnreadBadge(count: unreadCount), + ), + const SizedBox(width: 6), + Text( + 'CH ${channel.index}', + style: MeshTheme.mono( + fontSize: 11, + color: scheme.onSurfaceVariant.withValues(alpha: 0.7), + ), + ), ], ), + if (subtitle.isNotEmpty) ...[ + const SizedBox(height: 2), + Text( + subtitle, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + color: scheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], + if (lastPreview.isNotEmpty) ...[ + const SizedBox(height: 2), + Text( + lastPreview, + style: MeshTheme.mono( + fontSize: 11.5, + color: scheme.onSurfaceVariant, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ], ], ), - if (showDragHandle && dragIndex != null) ...[ - const SizedBox(width: 4), - ReorderableDragStartListener( - index: dragIndex, - child: Padding( - padding: const EdgeInsets.all(8), - child: Icon( - Icons.drag_handle, + ), + 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), + ], ), ], + ), + if (showDragHandle && dragIndex != null) ...[ + const SizedBox(width: 4), + ReorderableDragStartListener( + index: dragIndex, + // Top-aligned with the "CH n" / time line. Bottom padding keeps + // a comfortable drag target without pushing the icon down. + child: Padding( + padding: const EdgeInsets.only(left: 8, right: 8, bottom: 16), + child: Icon( + Icons.drag_handle, + size: 18, + color: scheme.onSurfaceVariant, + ), + ), + ), ], - ), + ], ), ), ); @@ -910,11 +947,7 @@ class _ChannelsScreenState extends State ); return; } - final random = Random.secure(); - final psk = Uint8List(16); - for (int i = 0; i < 16; i++) { - psk[i] = random.nextInt(256); - } + final psk = randomBytes(16); Navigator.pop(sheetContext); await connector.setChannel( nextIndex, @@ -1543,11 +1576,7 @@ class _ChannelsScreenState extends State 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); - } + final bytes = randomBytes(16); pskController.text = Channel.formatPskHex(bytes); }, ), diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index 5bdd0fdc..bfe5a381 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -12,6 +12,7 @@ import '../utils/platform_info.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../helpers/cyr2lat.dart'; +import '../helpers/path_helper.dart'; import '../helpers/reaction_helper.dart'; import '../widgets/message_status_icon.dart'; import '../widgets/empty_state.dart'; @@ -546,15 +547,15 @@ class _ChatScreenState extends State { decoration: InputDecoration( hintText: context.l10n.chat_typeMessage, border: OutlineInputBorder( - borderRadius: BorderRadius.circular(MeshRadii.pill), + borderRadius: BorderRadius.circular(MeshRadii.md), borderSide: BorderSide(color: scheme.outlineVariant), ), enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(MeshRadii.pill), + borderRadius: BorderRadius.circular(MeshRadii.md), borderSide: BorderSide(color: scheme.outlineVariant), ), focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(MeshRadii.pill), + borderRadius: BorderRadius.circular(MeshRadii.md), borderSide: BorderSide( color: scheme.primary, width: 1.5, @@ -776,17 +777,35 @@ class _ChatScreenState extends State { } String _currentPathLabel(Contact contact) { + final connector = context.read(); + // Check if user has set a path override if (contact.pathOverride != null) { if (contact.pathOverride! < 0) return context.l10n.chat_floodForced; if (contact.pathOverride == 0) return context.l10n.chat_directForced; - return context.l10n.chat_hopsForced(contact.pathOverride!); + final bytes = contact.pathOverrideBytes ?? Uint8List(0); + final hopCount = _displayHopCount( + bytes, + contact.pathOverride!, + connector.pathHashByteWidth, + ); + return context.l10n.chat_hopsForced(hopCount); } // Use device's path if (contact.pathLength < 0) return context.l10n.chat_floodAuto; if (contact.pathLength == 0) return context.l10n.chat_direct; - return context.l10n.chat_hopsCount(contact.pathLength); + final hopCount = _displayHopCount( + contact.path, + contact.pathLength, + connector.pathHashByteWidth, + ); + return context.l10n.chat_hopsCount(hopCount); + } + + int _displayHopCount(List pathBytes, int storedHopCount, int hashWidth) { + if (pathBytes.isEmpty) return storedHopCount; + return PathHelper.splitPathBytes(pathBytes, hashWidth).length; } void _showContactInfo(BuildContext context) { @@ -807,7 +826,10 @@ class _ChatScreenState extends State { ), _buildInfoRow( context.l10n.chat_path, - contact.pathLabel(context.l10n), + contact.pathLabel( + context.l10n, + pathHashByteWidth: connector.pathHashByteWidth, + ), ), _buildInfoRow( context.l10n.contact_lastSeen, @@ -1435,6 +1457,9 @@ class _MessageBubble extends StatelessWidget { color: textColor.withValues(alpha: 0.72), fontSize: bodyFontSize * textScale, ), + onSecondaryTap: PlatformInfo.isDesktop + ? onLongPress + : null, ), ), ], diff --git a/lib/screens/contacts_screen.dart b/lib/screens/contacts_screen.dart index 44ec78d2..1cfb20a8 100644 --- a/lib/screens/contacts_screen.dart +++ b/lib/screens/contacts_screen.dart @@ -915,6 +915,7 @@ class _ContactsScreenState extends State return _ContactTileEntrance( index: index, contact: contact, + pathHashByteWidth: connector.pathHashByteWidth, lastSeen: _resolveLastSeen(contact), unreadCount: unreadCount, isFavorite: contact.isFavorite, @@ -1371,7 +1372,10 @@ class _ContactsScreenState extends State MaterialPageRoute( builder: (context) => PathTraceMapScreen( title: context.l10n.contacts_repeaterPing, - path: Uint8List.fromList([contact.publicKey.first]), + path: contact.pathBytesForDisplay.isNotEmpty + ? contact.pathBytesForDisplay + : _contactPathPrefix(contact, hw), + flipPathAround: true, targetContact: contact, pathHashByteWidth: hw, ), @@ -1405,8 +1409,8 @@ class _ContactsScreenState extends State : context.l10n.contacts_roomPing, path: contact.pathBytesForDisplay.isNotEmpty ? contact.pathBytesForDisplay - : Uint8List.fromList([contact.publicKey.first]), - flipPathAround: contact.pathBytesForDisplay.isNotEmpty, + : _contactPathPrefix(contact, hw), + flipPathAround: true, targetContact: contact, pathHashByteWidth: hw, ), @@ -1516,6 +1520,16 @@ class _ContactsScreenState extends State ); } + Uint8List _contactPathPrefix(Contact contact, int hashByteWidth) { + if (contact.publicKey.isEmpty) return Uint8List(0); + final width = hashByteWidth + .clamp(1, pubKeySize) + .toInt() + .clamp(1, contact.publicKey.length) + .toInt(); + return Uint8List.fromList(contact.publicKey.sublist(0, width)); + } + void _confirmDelete( BuildContext context, MeshCoreConnector connector, @@ -1549,6 +1563,7 @@ class _ContactsScreenState extends State class _ContactTile extends StatelessWidget { final Contact contact; + final int pathHashByteWidth; final DateTime lastSeen; final int unreadCount; final bool isFavorite; @@ -1557,6 +1572,7 @@ class _ContactTile extends StatelessWidget { const _ContactTile({ required this.contact, + required this.pathHashByteWidth, required this.lastSeen, required this.unreadCount, required this.isFavorite, @@ -1676,7 +1692,10 @@ class _ContactTile extends StatelessWidget { children: [ Expanded( child: Text( - contact.pathLabel(context.l10n), + contact.pathLabel( + context.l10n, + pathHashByteWidth: pathHashByteWidth, + ), maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( @@ -1763,6 +1782,7 @@ class _ContactTile extends StatelessWidget { class _ContactTileEntrance extends StatelessWidget { final int index; final Contact contact; + final int pathHashByteWidth; final DateTime lastSeen; final int unreadCount; final bool isFavorite; @@ -1772,6 +1792,7 @@ class _ContactTileEntrance extends StatelessWidget { const _ContactTileEntrance({ required this.index, required this.contact, + required this.pathHashByteWidth, required this.lastSeen, required this.unreadCount, required this.isFavorite, @@ -1785,6 +1806,7 @@ class _ContactTileEntrance extends StatelessWidget { index: index, child: _ContactTile( contact: contact, + pathHashByteWidth: pathHashByteWidth, lastSeen: lastSeen, unreadCount: unreadCount, isFavorite: isFavorite, diff --git a/lib/screens/discovery_screen.dart b/lib/screens/discovery_screen.dart index d5089a6b..15dc1e2b 100644 --- a/lib/screens/discovery_screen.dart +++ b/lib/screens/discovery_screen.dart @@ -184,13 +184,6 @@ class _DiscoveryScreenState extends State { connector, index, ); - if (PlatformInfo.isDesktop) { - return GestureDetector( - onSecondaryTapUp: (_) => - _showContactContextMenu(contact, connector), - child: tile, - ); - } return tile; }, ), @@ -241,6 +234,9 @@ class _DiscoveryScreenState extends State { } }, onLongPress: () => _showContactContextMenu(contact, connector), + onSecondaryTap: PlatformInfo.isDesktop + ? () => _showContactContextMenu(contact, connector) + : null, padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), child: Row( children: [ diff --git a/lib/screens/line_of_sight_map_screen.dart b/lib/screens/line_of_sight_map_screen.dart index 57d7603f..7117affa 100644 --- a/lib/screens/line_of_sight_map_screen.dart +++ b/lib/screens/line_of_sight_map_screen.dart @@ -20,7 +20,6 @@ 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; @@ -357,7 +356,7 @@ class _LineOfSightMapScreenState extends State { Widget build(BuildContext context) { final settings = context.watch().settings; final isImperial = settings.unitSystem == UnitSystem.imperial; - final tileCache = context.read(); + final tileCache = context.watch(); final endpoints = _visibleEndpoints(); final mapPoints = [ if (_start != null) _start!.point, @@ -430,6 +429,7 @@ class _LineOfSightMapScreenState extends State { minZoom: _mapMinZoom, maxZoom: _mapMaxZoom, onLongPress: (_, point) => _addCustomPoint(point), + onSecondaryTap: (_, point) => _addCustomPoint(point), onPositionChanged: (camera, hasGesture) { final shouldShow = camera.zoom >= _labelZoomThreshold; if (!_didReceivePositionUpdate || @@ -442,8 +442,8 @@ class _LineOfSightMapScreenState extends State { }, ), children: [ - ThemedMapTileLayer( - tileCache: tileCache, + tileCache.buildTileLayer( + context, opacity: _showTerrainLayer ? 1 : 0.72, ), if (_result != null && _result!.segments.isNotEmpty) diff --git a/lib/screens/map_cache_screen.dart b/lib/screens/map_cache_screen.dart index 6455c15c..9cb45d36 100644 --- a/lib/screens/map_cache_screen.dart +++ b/lib/screens/map_cache_screen.dart @@ -12,7 +12,6 @@ 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}); @@ -34,6 +33,11 @@ class _MapCacheScreenState extends State { bool _isDownloading = false; int _completedTiles = 0; int _failedTiles = 0; + List _cachedTiles = const []; + int _cachedTileBytes = 0; + bool _isLoadingCachedTiles = false; + double _overlayZoom = 2.0; + LatLngBounds? _visibleBounds; @override void initState() { @@ -123,8 +127,10 @@ class _MapCacheScreenState extends State { _minZoom = safeMin; _maxZoom = safeMax; _selectedBounds = bounds; + _visibleBounds = bounds; }); _updateEstimate(); + _refreshCachedTiles(); if (bounds != null) { _mapController.fitCamera( CameraFit.bounds(bounds: bounds, padding: const EdgeInsets.all(48)), @@ -181,6 +187,7 @@ class _MapCacheScreenState extends State { Future _startDownload() async { final bounds = _selectedBounds; + final cacheService = context.read(); if (bounds == null) { showDismissibleSnackBar( context, @@ -197,6 +204,18 @@ class _MapCacheScreenState extends State { return; } + if (!cacheService.source.allowsBulkDownload) { + showDismissibleSnackBar( + context, + content: Text( + context.l10n.mapCache_bulkDownloadDisabledInConfig( + cacheService.source.label, + ), + ), + ); + return; + } + final confirmed = await showDialog( context: context, builder: (dialogContext) => AlertDialog( @@ -219,8 +238,6 @@ class _MapCacheScreenState extends State { if (confirmed != true || !mounted) return; - final cacheService = context.read(); - setState(() { _isDownloading = true; _completedTiles = 0; @@ -254,6 +271,8 @@ class _MapCacheScreenState extends State { result.failed, ) : context.l10n.mapCache_cachedTiles(result.downloaded); + await _refreshCachedTiles(); + if (!mounted) return; showDismissibleSnackBar(context, content: Text(message)); } @@ -280,16 +299,61 @@ class _MapCacheScreenState extends State { final cacheService = context.read(); await cacheService.clearCache(); if (!mounted) return; + await _refreshCachedTiles(); + if (!mounted) return; showDismissibleSnackBar( context, content: Text(context.l10n.mapCache_offlineCacheCleared), ); } + Future _refreshCachedTiles() async { + if (!mounted) return; + setState(() { + _isLoadingCachedTiles = true; + }); + final cacheService = context.read(); + final inventory = await cacheService.getCachedTileInventory(); + if (!mounted) return; + setState(() { + _cachedTiles = inventory.tiles; + _cachedTileBytes = inventory.totalBytes; + _isLoadingCachedTiles = false; + }); + } + + String _formatBytes(int bytes) { + if (bytes < 1024) return '$bytes B'; + if (bytes < 1024 * 1024) { + return '${(bytes / 1024).toStringAsFixed(1)} KB'; + } + return '${(bytes / (1024 * 1024)).toStringAsFixed(1)} MB'; + } + @override Widget build(BuildContext context) { - final tileCache = context.read(); + final tileCache = context.watch(); + final source = tileCache.source; final selectedBounds = _selectedBounds; + final activeCachedTiles = tileCache.filterTilesForActiveSource( + _cachedTiles, + ); + final cachedInSelection = tileCache.countTilesForBounds( + activeCachedTiles, + bounds: selectedBounds, + minZoom: _minZoom, + maxZoom: _maxZoom, + ); + final overlayPolygons = tileCache.buildCachedTilePolygons( + activeCachedTiles, + zoom: _overlayZoom.round().clamp(0, 19).toInt(), + visibleBounds: _visibleBounds, + ); + final cacheSummary = + '${context.l10n.mapCache_summarySource(source.label)}\n' + '${context.l10n.mapCache_summaryCachedTilesForSource(activeCachedTiles.length)}\n' + '${context.l10n.mapCache_summaryCachedInSelection(cachedInSelection)}\n' + '${context.l10n.mapCache_summaryApproxCacheSize(_formatBytes(_cachedTileBytes))}'; final l10n = context.l10n; final scheme = Theme.of(context).colorScheme; final isDesktop = _isDesktopPlatform(defaultTargetPlatform); @@ -327,9 +391,23 @@ class _MapCacheScreenState extends State { ) : const KeyboardOptions.disabled(), ), + onPositionChanged: (camera, hasGesture) { + final nextZoom = camera.zoom; + final nextBounds = camera.visibleBounds; + if (_overlayZoom != nextZoom || + _visibleBounds?.north != nextBounds.north || + _visibleBounds?.south != nextBounds.south || + _visibleBounds?.east != nextBounds.east || + _visibleBounds?.west != nextBounds.west) { + setState(() { + _overlayZoom = nextZoom; + _visibleBounds = nextBounds; + }); + } + }, ), children: [ - ThemedMapTileLayer(tileCache: tileCache), + tileCache.buildTileLayer(context), if (selectedBounds != null) PolygonLayer( polygons: [ @@ -341,9 +419,24 @@ class _MapCacheScreenState extends State { ), ], ), + if (overlayPolygons.isNotEmpty) + PolygonLayer(polygons: overlayPolygons), ], ), if (isDesktop) _buildDesktopMapControls(), + Positioned( + top: 12, + left: isDesktop ? 84 : 12, + child: Card( + child: Padding( + padding: const EdgeInsets.all(8), + child: Text( + 'Z: ${_overlayZoom.round()}:', + style: const TextStyle(fontSize: 12), + ), + ), + ), + ), Positioned( top: 12, right: 12, @@ -445,6 +538,34 @@ class _MapCacheScreenState extends State { color: scheme.onSurfaceVariant, ), ), + const SizedBox(height: 12), + TextFormField( + key: ValueKey( + '$cacheSummary|${activeCachedTiles.length}|$cachedInSelection|$_cachedTileBytes', + ), + initialValue: cacheSummary, + readOnly: true, + minLines: 4, + maxLines: 4, + decoration: InputDecoration( + labelText: _isLoadingCachedTiles + ? l10n.mapCache_cachedTilesLabel + : l10n.mapCache_cachedTileSummaryLabel, + border: const OutlineInputBorder(), + ), + ), + if (!source.allowsBulkDownload) ...[ + const SizedBox(height: 8), + Text( + l10n.mapCache_bulkDownloadDisabledForSource( + source.label, + ), + style: MeshTheme.mono( + fontSize: 12, + color: MeshPalette.alert, + ), + ), + ], if (_isDownloading) ...[ const SizedBox(height: 8), LinearProgressIndicator( @@ -471,7 +592,10 @@ class _MapCacheScreenState extends State { child: ElevatedButton.icon( icon: const Icon(Icons.download), label: Text(l10n.mapCache_downloadTilesButton), - onPressed: _isDownloading || selectedBounds == null + onPressed: + _isDownloading || + selectedBounds == null || + !source.allowsBulkDownload ? null : _startDownload, ), diff --git a/lib/screens/map_screen.dart b/lib/screens/map_screen.dart index f2314806..c49d599b 100644 --- a/lib/screens/map_screen.dart +++ b/lib/screens/map_screen.dart @@ -5,13 +5,14 @@ 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/helpers/path_helper.dart'; import 'package:meshcore_open/screens/path_trace_map.dart'; import 'package:meshcore_open/widgets/app_bar.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; -import '../l10n/l10n.dart'; import '../connector/meshcore_protocol.dart'; +import '../l10n/l10n.dart'; import '../models/app_settings.dart'; import '../models/channel.dart'; import '../models/contact.dart'; @@ -25,7 +26,6 @@ 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'; @@ -79,6 +79,7 @@ class _MapScreenState extends State { bool _hasInitializedMap = false; bool _removedMarkersLoaded = false; final List _pathTrace = []; + final List _pathTraceHopWidths = []; final List _pathTraceContacts = []; final List _points = []; final List _polylines = []; @@ -107,6 +108,31 @@ class _MapScreenState extends State { super.dispose(); } + ColorScheme get _overlayScheme => Theme.of(context).colorScheme; + + bool get _useDarkOverlay => Theme.of(context).brightness == Brightness.dark; + + Color get _overlayPanelColor => _useDarkOverlay + ? MapPalette.panelDark + : _overlayScheme.surfaceContainerLow.withValues(alpha: 0.96); + + Color get _overlayPrimaryTextColor => + _useDarkOverlay ? MapPalette.textPrimary : _overlayScheme.onSurface; + + Color get _overlaySecondaryTextColor => _useDarkOverlay + ? MapPalette.textSecondary + : _overlayScheme.onSurfaceVariant; + + Color get _overlayMutedTextColor => + _useDarkOverlay ? MapPalette.textMuted : _overlayScheme.onSurfaceVariant; + + Color get _overlayBorderColor => + _useDarkOverlay ? MapPalette.border : _overlayScheme.outlineVariant; + + Color get _overlayShadowColor => _useDarkOverlay + ? MapPalette.markerShadow + : Colors.black.withValues(alpha: 0.18); + _NodeAge _ageOf(Contact contact) { final d = DateTime.now().difference(contact.lastSeen); if (d.inMinutes <= 60) return _NodeAge.online; @@ -233,12 +259,12 @@ class _MapScreenState extends State { bottom: 96, child: DecoratedBox( decoration: BoxDecoration( - color: MapPalette.panelDark, + color: _overlayPanelColor, borderRadius: BorderRadius.circular(MeshRadii.md), - border: Border.all(color: MapPalette.border), - boxShadow: const [ + border: Border.all(color: _overlayBorderColor), + boxShadow: [ BoxShadow( - color: MapPalette.markerShadow, + color: _overlayShadowColor, blurRadius: 8, offset: Offset(0, 3), ), @@ -250,20 +276,20 @@ class _MapScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ IconButton( - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, icon: const Icon(Icons.add), visualDensity: VisualDensity.standard, tooltip: context.l10n.map_zoomIn, onPressed: () => _zoomMapBy(1), ), IconButton( - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, icon: const Icon(Icons.remove), tooltip: context.l10n.map_zoomOut, onPressed: () => _zoomMapBy(-1), ), IconButton( - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, icon: const Icon(Icons.crop_free), tooltip: context.l10n.map_centerMap, onPressed: () => _mapController.move(center, zoom), @@ -285,6 +311,31 @@ class _MapScreenState extends State { ); } + void _handleMapContextPress( + BuildContext context, + MeshCoreConnector connector, + LatLng latLng, + ) { + if (_isSelectingPoi) { + setState(() { + _isSelectingPoi = false; + }); + _shareMarker( + context: context, + connector: connector, + position: latLng, + defaultLabel: context.l10n.map_pointOfInterest, + flags: 'poi', + ); + return; + } + _showShareMarkerAtPositionSheet( + context: context, + connector: connector, + position: latLng, + ); + } + @override Widget build(BuildContext context) { return Builder( @@ -303,6 +354,7 @@ class _MapScreenState extends State { final settingsService = context.read(); final pathHistory = context.read(); final tileCache = context.read(); + final scheme = Theme.of(context).colorScheme; final isDesktop = _isDesktopPlatform(defaultTargetPlatform); final allContacts = connector.allContacts; @@ -376,17 +428,20 @@ class _MapScreenState extends State { // Compute guessed locations with caching final maxRangeKm = _estimateLoRaRangeKm(connector); + final pathHashByteWidth = connector.pathHashByteWidth + .clamp(1, 4) + .toInt(); final filteredKeys = guessCandidates .map((c) => '${c.publicKeyHex}:${c.path.join("-")}') .join(','); final anchorKeys = allContactsWithLocation .map( (c) => - '${c.publicKeyHex}:${c.latitude}:${c.longitude}:${c.path.isNotEmpty ? c.path.last : ""}', + '${c.publicKeyHex}:${c.latitude}:${c.longitude}:${PathHelper.formatHopHex(c.path.isNotEmpty ? c.path.sublist(max(0, c.path.length - pathHashByteWidth)) : const [])}', ) .join(','); final cacheKey = - '$filteredKeys|$anchorKeys|$pathHistoryVersion:${connector.currentFreqHz}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; + '$filteredKeys|$anchorKeys|$pathHistoryVersion:$pathHashByteWidth:${connector.currentFreqHz}:${connector.currentSf}:${connector.currentBwHz}:${connector.currentTxPower}:${settings.mapShowGuessedLocations}'; if (cacheKey != _guessedLocationsCacheKey) { _guessedLocationsCacheKey = cacheKey; _cachedGuessedLocations = settings.mapShowGuessedLocations @@ -395,6 +450,7 @@ class _MapScreenState extends State { allContactsWithLocation, pathHistory, maxRangeKm, + pathHashByteWidth, ) : []; } @@ -554,8 +610,8 @@ class _MapScreenState extends State { canPop: allowBack, child: Scaffold( appBar: AppBar( - backgroundColor: MapPalette.panelDark, - foregroundColor: MapPalette.textPrimary, + backgroundColor: scheme.surface, + foregroundColor: scheme.onSurface, title: AppBarTitle(context.l10n.map_title), centerTitle: true, automaticallyImplyLeading: false, @@ -708,24 +764,10 @@ class _MapScreenState extends State { } }, onLongPress: (_, latLng) { - if (_isSelectingPoi) { - setState(() { - _isSelectingPoi = false; - }); - _shareMarker( - context: context, - connector: connector, - position: latLng, - defaultLabel: context.l10n.map_pointOfInterest, - flags: 'poi', - ); - return; - } - _showShareMarkerAtPositionSheet( - context: context, - connector: connector, - position: latLng, - ); + _handleMapContextPress(context, connector, latLng); + }, + onSecondaryTap: (_, latLng) { + _handleMapContextPress(context, connector, latLng); }, onPositionChanged: (camera, hasGesture) { // Track zoom in half-step buckets so cluster/marker @@ -742,7 +784,7 @@ class _MapScreenState extends State { }, ), children: [ - ThemedMapTileLayer(tileCache: tileCache), + tileCache.buildTileLayer(context), if (_polylines.isNotEmpty && _isBuildingPathTrace) PolylineLayer(polylines: _polylines), if (sharedMarkerPolylines.isNotEmpty) @@ -895,7 +937,7 @@ class _MapScreenState extends State { _handleQuickSwitch(index, context), contactsUnreadCount: connector.getTotalContactsUnreadCount(), channelsUnreadCount: connector.getTotalChannelsUnreadCount(), - highContrast: true, + highContrast: _useDarkOverlay, ), ), floatingActionButton: @@ -970,23 +1012,19 @@ class _MapScreenState extends State { List withLocation, PathHistoryService pathHistory, double? maxRangeKm, + int pathHashByteWidth, ) { - // Index known-location repeaters by their 1-byte hash. - // null value = two repeaters share the same hash byte (ambiguous collision). - final repeaterByHash = {}; - - for (final c in withLocation) { - if (c.type == advTypeRepeater) { - if (repeaterByHash.containsKey(c.publicKey[0])) { - repeaterByHash[c.publicKey[0]] = - null; // collision: can't disambiguate - } else { - repeaterByHash[c.publicKey[0]] = c; - } - } - } - final result = <_GuessedLocation>[]; + final hopWidth = pathHashByteWidth.clamp(1, 4).toInt(); + final anchorsByPrefix = >{}; + for (final repeater in withLocation) { + if (repeater.type != advTypeRepeater) continue; + if (repeater.publicKey.length < hopWidth) continue; + final prefix = PathHelper.formatHopHex( + repeater.publicKey.sublist(0, hopWidth), + ); + anchorsByPrefix.putIfAbsent(prefix, () => []).add(repeater); + } for (final contact in allContacts) { if (contact.hasLocation) continue; @@ -1000,21 +1038,23 @@ class _MapScreenState extends State { // Collect the contact-side (last-hop) repeater from every known path. // path = [device-side hop, ..., contact-side hop] - // Only path.last is actually within radio range of the contact — using - // earlier bytes would anchor against our own side of the network. + // Only the last hop chunk is actually within radio range of the contact. final pathSets = >[ contact.path.toList(), ...pathHistory .getRecentPaths(contact.publicKeyHex) .map((r) => r.pathBytes), ]; - final lastHopBytes = {}; for (final pathBytes in pathSets) { if (pathBytes.isEmpty) continue; - final lastHop = pathBytes.last; - lastHopBytes.add(lastHop); - final r = repeaterByHash[lastHop]; - if (r != null) anchorSet.add(LatLng(r.latitude!, r.longitude!)); + final lastHop = pathBytes.sublist(max(0, pathBytes.length - hopWidth)); + if (lastHop.isEmpty) continue; + + final repeaters = anchorsByPrefix[PathHelper.formatHopHex(lastHop)]; + if (repeaters != null && repeaters.isNotEmpty) { + final repeater = repeaters.first; + anchorSet.add(LatLng(repeater.latitude!, repeater.longitude!)); + } } // Filter anchors that are geometrically inconsistent with radio range. @@ -1181,9 +1221,12 @@ class _MapScreenState extends State { width: 48, height: 48, child: GestureDetector( - onLongPress: () => _isBuildingPathTrace - ? _showNodeInfo(context, guess.contact) - : null, + onLongPress: () { + if (_isBuildingPathTrace) _showNodeInfo(context, guess.contact); + }, + onSecondaryTap: () { + if (_isBuildingPathTrace) _showNodeInfo(context, guess.contact); + }, onTap: () => _isBuildingPathTrace ? _addToPath(context, guess.contact, position: guess.position) : _selectNode(guess.contact, guessedPosition: guess.position), @@ -1193,14 +1236,14 @@ class _MapScreenState extends State { height: 36, decoration: BoxDecoration( shape: BoxShape.circle, - color: MapPalette.panelDark, + color: _overlayPanelColor, border: Border.all( - color: guess.highConfidence ? color : MapPalette.textMuted, + color: guess.highConfidence ? color : _overlayMutedTextColor, width: guess.highConfidence ? 2.5 : 2, ), - boxShadow: const [ + boxShadow: [ BoxShadow( - color: MapPalette.markerShadow, + color: _overlayShadowColor, blurRadius: 7, offset: Offset(0, 2), ), @@ -1209,7 +1252,7 @@ class _MapScreenState extends State { alignment: Alignment.center, child: Icon( Icons.not_listed_location, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, size: 19, ), ), @@ -1286,12 +1329,20 @@ class _MapScreenState extends State { // 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 = {}; + final overlapPrefixes = {}; if (overlapsMode) { - final counts = {}; + final hopWidth = context + .read() + .pathHashByteWidth + .clamp(1, pubKeySize) + .toInt(); + final counts = {}; for (final contact in contacts) { - if (contact.type == advTypeRepeater || contact.type == advTypeRoom) { - final prefix = contact.publicKey.first; + if ((contact.type == advTypeRepeater || contact.type == advTypeRoom) && + contact.publicKey.length >= hopWidth) { + final prefix = PathHelper.formatHopHex( + contact.publicKey.sublist(0, hopWidth), + ); counts[prefix] = (counts[prefix] ?? 0) + 1; } } @@ -1299,10 +1350,20 @@ class _MapScreenState extends State { if (count > 1) overlapPrefixes.add(prefix); }); } + final overlapHopWidth = context + .read() + .pathHashByteWidth + .clamp(1, pubKeySize) + .toInt(); bool isOverlap(Contact contact) => overlapsMode && (contact.type == advTypeRepeater || contact.type == advTypeRoom) && - overlapPrefixes.contains(contact.publicKey.first); + contact.publicKey.length >= overlapHopWidth && + overlapPrefixes.contains( + PathHelper.formatHopHex( + contact.publicKey.sublist(0, overlapHopWidth), + ), + ); void addNode(Contact contact, {bool dot = false}) { final overlap = isOverlap(contact); @@ -1383,8 +1444,12 @@ class _MapScreenState extends State { height: size, child: GestureDetector( behavior: HitTestBehavior.opaque, - onLongPress: () => - _isBuildingPathTrace ? _showNodeInfo(context, contact) : null, + onLongPress: () { + if (_isBuildingPathTrace) _showNodeInfo(context, contact); + }, + onSecondaryTap: () { + if (_isBuildingPathTrace) _showNodeInfo(context, contact); + }, onTap: () => _isBuildingPathTrace ? _addToPath(context, contact) : _selectNode(contact), @@ -1523,12 +1588,12 @@ class _MapScreenState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), decoration: BoxDecoration( - color: MapPalette.panelDark, + color: _overlayPanelColor, borderRadius: BorderRadius.circular(MeshRadii.xs), - border: Border.all(color: MapPalette.border), - boxShadow: const [ + border: Border.all(color: _overlayBorderColor), + boxShadow: [ BoxShadow( - color: MapPalette.markerShadow, + color: _overlayShadowColor, blurRadius: 4, offset: Offset(0, 1), ), @@ -1542,7 +1607,7 @@ class _MapScreenState extends State { style: MeshTheme.mono( fontSize: 10, fontWeight: FontWeight.w700, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), ), ), @@ -1663,7 +1728,7 @@ class _MapScreenState extends State { decoration: BoxDecoration( shape: BoxShape.circle, color: statusColor, - border: Border.all(color: MapPalette.panelDark, width: 2), + border: Border.all(color: _overlayPanelColor, width: 2), ), alignment: Alignment.center, child: batteryLow @@ -1686,10 +1751,10 @@ class _MapScreenState extends State { Expanded( child: Text( label, - style: const TextStyle( + style: TextStyle( fontSize: 12, fontWeight: FontWeight.w600, - color: MapPalette.textSecondary, + color: _overlaySecondaryTextColor, ), overflow: TextOverflow.ellipsis, ), @@ -1747,9 +1812,9 @@ class _MapScreenState extends State { children: [ Expanded( child: Material( - color: MapPalette.panelDark, + color: _overlayPanelColor, shape: StadiumBorder( - side: const BorderSide(color: MapPalette.border), + side: BorderSide(color: _overlayBorderColor), ), clipBehavior: Clip.antiAlias, child: TextField( @@ -1757,17 +1822,15 @@ class _MapScreenState extends State { focusNode: _searchFocus, decoration: InputDecoration( hintText: context.l10n.map_searchHint, - hintStyle: const TextStyle( - color: MapPalette.textSecondary, - ), - prefixIcon: const Icon( + hintStyle: TextStyle(color: _overlaySecondaryTextColor), + prefixIcon: Icon( Icons.search, size: 20, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), suffixIcon: hasQuery ? IconButton( - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, icon: const Icon(Icons.close, size: 18), onPressed: () { setState(() { @@ -1787,9 +1850,9 @@ class _MapScreenState extends State { vertical: 12, ), ), - style: const TextStyle( + style: TextStyle( fontSize: 14, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, fontWeight: FontWeight.w600, ), cursorColor: MapPalette.selected, @@ -1801,9 +1864,9 @@ class _MapScreenState extends State { ), const SizedBox(width: 8), Material( - color: MapPalette.panelDark, + color: _overlayPanelColor, shape: StadiumBorder( - side: const BorderSide(color: MapPalette.border), + side: BorderSide(color: _overlayBorderColor), ), clipBehavior: Clip.antiAlias, child: InkWell( @@ -1827,17 +1890,17 @@ class _MapScreenState extends State { style: MeshTheme.mono( fontSize: 13, fontWeight: FontWeight.w700, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), ), const SizedBox(width: 2), AnimatedRotation( turns: _statsExpanded ? 0.5 : 0, duration: const Duration(milliseconds: 200), - child: const Icon( + child: Icon( Icons.expand_more, size: 16, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), ), ], @@ -1936,12 +1999,12 @@ class _MapScreenState extends State { color: selected ? Color.alphaBlend( accent.withValues(alpha: 0.34), - MapPalette.panelDark, + _overlayPanelColor, ) - : MapPalette.panelDark, + : _overlayPanelColor, shape: StadiumBorder( side: BorderSide( - color: selected ? accent : MapPalette.border, + color: selected ? accent : _overlayBorderColor, width: selected ? 1.5 : 1, ), ), @@ -1957,11 +2020,7 @@ class _MapScreenState extends State { mainAxisSize: MainAxisSize.min, children: [ if (selected) ...[ - const Icon( - Icons.check, - size: 13, - color: MapPalette.textPrimary, - ), + Icon(Icons.check, size: 13, color: _overlayPrimaryTextColor), const SizedBox(width: 4), ], Text( @@ -1970,8 +2029,8 @@ class _MapScreenState extends State { fontSize: 12.5, fontWeight: FontWeight.w600, color: selected - ? MapPalette.textPrimary - : MapPalette.textSecondary, + ? _overlayPrimaryTextColor + : _overlaySecondaryTextColor, ), ), ], @@ -2001,14 +2060,14 @@ class _MapScreenState extends State { margin: const EdgeInsets.only(top: 6), constraints: const BoxConstraints(maxHeight: 300), decoration: BoxDecoration( - color: MapPalette.panelDark, + color: _overlayPanelColor, borderRadius: BorderRadius.circular(MeshRadii.md), - border: Border.all(color: MapPalette.border), - boxShadow: const [ + border: Border.all(color: _overlayBorderColor), + boxShadow: [ BoxShadow( - color: MapPalette.markerShadow, + color: _overlayShadowColor, blurRadius: 10, - offset: Offset(0, 4), + offset: const Offset(0, 4), ), ], ), @@ -2017,8 +2076,8 @@ class _MapScreenState extends State { padding: const EdgeInsets.all(16), child: Text( context.l10n.map_noResults, - style: const TextStyle( - color: MapPalette.textSecondary, + style: TextStyle( + color: _overlaySecondaryTextColor, fontSize: 13, ), ), @@ -2028,7 +2087,7 @@ class _MapScreenState extends State { padding: const EdgeInsets.symmetric(vertical: 4), itemCount: results.length, separatorBuilder: (_, _) => - const Divider(height: 1, color: MapPalette.border), + Divider(height: 1, color: _overlayBorderColor), itemBuilder: (context, index) { final c = results[index]; final color = _getNodeColor(c.type); @@ -2049,10 +2108,10 @@ class _MapScreenState extends State { children: [ Text( c.name, - style: const TextStyle( + style: TextStyle( fontSize: 13.5, fontWeight: FontWeight.w600, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), overflow: TextOverflow.ellipsis, ), @@ -2060,7 +2119,7 @@ class _MapScreenState extends State { c.publicKeyHex.substring(0, 12), style: MeshTheme.mono( fontSize: 10.5, - color: MapPalette.textSecondary, + color: _overlaySecondaryTextColor, ), ), ], @@ -2070,13 +2129,13 @@ class _MapScreenState extends State { Icon( Icons.chevron_right, size: 18, - color: MapPalette.textSecondary, + color: _overlaySecondaryTextColor, ) else Text( context.l10n.map_noGps.toUpperCase(), style: MeshTheme.accentLabel( - color: MapPalette.textMuted, + color: _overlayMutedTextColor, fontSize: 8.5, ), ), @@ -2136,14 +2195,14 @@ class _MapScreenState extends State { width: 230, padding: const EdgeInsets.fromLTRB(14, 12, 14, 12), decoration: BoxDecoration( - color: MapPalette.panelDark, + color: _overlayPanelColor, borderRadius: BorderRadius.circular(MeshRadii.md), - border: Border.all(color: MapPalette.border), - boxShadow: const [ + border: Border.all(color: _overlayBorderColor), + boxShadow: [ BoxShadow( - color: MapPalette.markerShadow, + color: _overlayShadowColor, blurRadius: 10, - offset: Offset(0, 4), + offset: const Offset(0, 4), ), ], ), @@ -2160,7 +2219,7 @@ class _MapScreenState extends State { ), _statRow(context.l10n.map_hidden, hiddenCount, MapPalette.offline), _statRow(context.l10n.map_markers, pinCount, MapPalette.shared), - const Divider(height: 16, color: MapPalette.border), + Divider(height: 16, color: _overlayBorderColor), _buildLegendItem( Icons.person, context.l10n.map_chat, @@ -2190,7 +2249,7 @@ class _MapScreenState extends State { _buildLegendItem( Icons.not_listed_location, context.l10n.map_guessedLocation, - MapPalette.textMuted, + _overlayMutedTextColor, ), ], ), @@ -2211,7 +2270,10 @@ class _MapScreenState extends State { Expanded( child: Text( label, - style: TextStyle(fontSize: 12.5, color: MapPalette.textSecondary), + style: TextStyle( + fontSize: 12.5, + color: _overlaySecondaryTextColor, + ), overflow: TextOverflow.ellipsis, ), ), @@ -2220,7 +2282,7 @@ class _MapScreenState extends State { style: MeshTheme.mono( fontSize: 13, fontWeight: FontWeight.w700, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), ), ], @@ -2253,8 +2315,8 @@ class _MapScreenState extends State { child: MeshCard( margin: EdgeInsets.zero, padding: const EdgeInsets.fromLTRB(14, 12, 8, 12), - color: MapPalette.panelDark, - borderColor: MapPalette.border, + color: _overlayPanelColor, + borderColor: _overlayBorderColor, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -2277,10 +2339,10 @@ class _MapScreenState extends State { Flexible( child: Text( contact.name, - style: const TextStyle( + style: TextStyle( fontSize: 15, fontWeight: FontWeight.w700, - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, ), overflow: TextOverflow.ellipsis, ), @@ -2308,9 +2370,9 @@ class _MapScreenState extends State { Flexible( child: Text( contact.typeLabel(context.l10n), - style: const TextStyle( + style: TextStyle( fontSize: 11.5, - color: MapPalette.textSecondary, + color: _overlaySecondaryTextColor, ), overflow: TextOverflow.ellipsis, ), @@ -2322,13 +2384,13 @@ class _MapScreenState extends State { ), if (pos != null) IconButton( - color: MapPalette.textPrimary, + color: _overlayPrimaryTextColor, 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, + color: _overlayPrimaryTextColor, icon: const Icon(Icons.close, size: 20), onPressed: _clearSelection, ), @@ -2345,7 +2407,10 @@ class _MapScreenState extends State { ), _miniMeta( context.l10n.map_path, - contact.pathLabel(context.l10n), + contact.pathLabel( + context.l10n, + pathHashByteWidth: connector.pathHashByteWidth, + ), ), _miniMeta('ID', contact.publicKeyHex.substring(0, 12)), if (pos != null) @@ -2389,14 +2454,17 @@ class _MapScreenState extends State { Text( label.toUpperCase(), style: MeshTheme.accentLabel( - color: MapPalette.textMuted, + color: _overlayMutedTextColor, fontSize: 8, ), ), const SizedBox(height: 1), Text( value, - style: MeshTheme.mono(fontSize: 11.5, color: MapPalette.textPrimary), + style: MeshTheme.mono( + fontSize: 11.5, + color: _overlayPrimaryTextColor, + ), ), ], ); @@ -2746,7 +2814,10 @@ class _MapScreenState extends State { children: [ _buildInfoRow( context.l10n.map_path, - contact.pathLabel(context.l10n), + contact.pathLabel( + context.l10n, + pathHashByteWidth: connector.pathHashByteWidth, + ), ), if (contact.hasLocation) _buildInfoRow( @@ -3492,10 +3563,23 @@ class _MapScreenState extends State { } void _addToPath(BuildContext context, Contact contact, {LatLng? position}) { + final connector = context.read(); + final hopWidth = min( + connector.pathHashByteWidth.clamp(1, pubKeySize), + contact.publicKey.length, + ).toInt(); + final hopPrefix = contact.publicKey.sublist(0, hopWidth); + for (final existingHop in PathHelper.splitPathBytes( + _pathTrace, + connector.pathHashByteWidth, + )) { + if (listEquals(existingHop, hopPrefix)) { + return; + } + } setState(() { - _pathTrace.add( - contact.publicKey[0], - ); // Add first 16 bytes of public key to path trace + _pathTrace.addAll(hopPrefix); // Add the hop-width pubkey prefix. + _pathTraceHopWidths.add(hopWidth); _pathTraceContacts.add( contact.copyWith( latitude: position?.latitude ?? contact.latitude, @@ -3510,6 +3594,7 @@ class _MapScreenState extends State { setState(() { _isBuildingPathTrace = true; _pathTrace.clear(); + _pathTraceHopWidths.clear(); _pathTraceContacts.clear(); _points.clear(); _polylines.clear(); @@ -3519,8 +3604,19 @@ class _MapScreenState extends State { void _removePath() { setState(() { + final recordedHopWidth = _pathTraceHopWidths.isNotEmpty + ? _pathTraceHopWidths.removeLast() + : context.read().pathHashByteWidth.clamp( + 1, + pubKeySize, + ); + final hopByteCount = min(recordedHopWidth, _pathTrace.length).toInt(); _pathTraceContacts.removeLast(); - _pathTrace.removeLast(); // Remove last node from path trace + // A path trace hop can be wider than one byte; remove the full hash prefix. + _pathTrace.removeRange( + _pathTrace.length - hopByteCount, + _pathTrace.length, + ); _points.removeLast(); // Remove last point from points list _polylines.clear(); // Clear polylines }); @@ -3537,14 +3633,14 @@ class _MapScreenState extends State { right: 16, child: DecoratedBox( decoration: BoxDecoration( - color: MapPalette.panelDark, + color: _overlayPanelColor, borderRadius: BorderRadius.circular(MeshRadii.md), - border: Border.all(color: MapPalette.border), - boxShadow: const [ + border: Border.all(color: _overlayBorderColor), + boxShadow: [ BoxShadow( - color: MapPalette.markerShadow, + color: _overlayShadowColor, blurRadius: 10, - offset: Offset(0, 4), + offset: const Offset(0, 4), ), ], ), @@ -3557,24 +3653,34 @@ class _MapScreenState extends State { children: [ Text( l10n.contacts_pathTrace, - style: TextStyle(fontWeight: FontWeight.bold), + style: TextStyle( + fontWeight: FontWeight.bold, + color: _overlayPrimaryTextColor, + ), ), if (_pathTrace.isEmpty) const SizedBox(height: 8), if (_pathTrace.isEmpty) - Text(l10n.map_tapToAdd, style: TextStyle(fontSize: 12)), + Text( + l10n.map_tapToAdd, + style: TextStyle( + fontSize: 12, + color: _overlaySecondaryTextColor, + ), + ), const SizedBox(height: 6), if (_pathTrace.isNotEmpty) Text( "${l10n.path_currentPathLabel} ${formatDistance(getPathDistanceMeters(_points), isImperial: isImperial)}", style: MeshTheme.mono( fontSize: 12, - color: MapPalette.textSecondary, + color: _overlaySecondaryTextColor, ), ), SelectableText( - _pathTrace - .map((b) => b.toRadixString(16).padLeft(2, '0')) - .join(','), + PathHelper.splitPathBytes( + _pathTrace, + context.read().pathHashByteWidth, + ).map(PathHelper.formatHopHex).join(','), style: MeshTheme.mono( fontSize: 18, fontWeight: FontWeight.w700, @@ -3599,6 +3705,7 @@ class _MapScreenState extends State { builder: (context) => PathTraceMapScreen( title: l10n.contacts_pathTrace, path: Uint8List.fromList(_pathTrace), + flipPathAround: false, pathHashByteWidth: hashW, pathContacts: _pathTraceContacts, ), @@ -3621,6 +3728,10 @@ class _MapScreenState extends State { title: l10n.contacts_pathTrace, path: Uint8List.fromList(_pathTrace), flipPathAround: true, + pathHashByteWidth: context + .read() + .pathHashByteWidth, + pathContacts: _pathTraceContacts, ), ), ); @@ -3643,6 +3754,7 @@ class _MapScreenState extends State { setState(() { _isBuildingPathTrace = false; _pathTrace.clear(); + _pathTraceHopWidths.clear(); _points.clear(); _polylines.clear(); }); diff --git a/lib/screens/neighbors_screen.dart b/lib/screens/neighbors_screen.dart index 529a00dd..219afa6e 100644 --- a/lib/screens/neighbors_screen.dart +++ b/lib/screens/neighbors_screen.dart @@ -276,7 +276,7 @@ class _NeighborsScreenState extends State { return Scaffold( appBar: AppBar( title: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ Text( @@ -296,7 +296,7 @@ class _NeighborsScreenState extends State { ), ], ), - centerTitle: false, + centerTitle: true, actions: [ IconButton( icon: Icon(isFloodMode ? Icons.waves : Icons.route), diff --git a/lib/screens/path_trace_map.dart b/lib/screens/path_trace_map.dart index 2eebdc71..3d4032c8 100644 --- a/lib/screens/path_trace_map.dart +++ b/lib/screens/path_trace_map.dart @@ -7,6 +7,7 @@ import 'package:flutter_map/flutter_map.dart'; import 'package:latlong2/latlong.dart'; import 'package:meshcore_open/connector/meshcore_connector.dart'; import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/helpers/path_helper.dart'; import 'package:meshcore_open/l10n/l10n.dart'; import 'package:meshcore_open/models/app_settings.dart'; import 'package:meshcore_open/models/contact.dart'; @@ -19,7 +20,6 @@ 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'; @@ -27,9 +27,9 @@ export 'package:meshcore_open/widgets/path_map_ui.dart' show formatDistance, getPathDistanceMeters; class PathTraceData { - final Uint8List pathData; + final List pathData; final List snrData; - final Map pathContacts; + final Map pathContacts; PathTraceData({ required this.pathData, @@ -38,6 +38,20 @@ class PathTraceData { }); } +String _hopKey(Uint8List hopBytes) => PathHelper.formatHopHex(hopBytes); + +Uint8List _lastHopChunk(Uint8List path, int hopWidth) { + if (path.isEmpty) return Uint8List(0); + final width = hopWidth.clamp(1, path.length).toInt(); + return Uint8List.fromList(path.sublist(path.length - width)); +} + +bool _matchesHopPrefix(Uint8List a, Uint8List b) { + if (a.isEmpty || b.isEmpty) return false; + final width = min(a.length, b.length); + return listEquals(a.sublist(0, width), b.sublist(0, width)); +} + class PathTraceMapScreen extends StatefulWidget { final String title; final Uint8List path; @@ -80,8 +94,8 @@ class _PathTraceMapScreenState extends State bool _failed2Loaded = false; bool _hasData = false; PathTraceData? _traceData; - // Inferred positions for hops that have no GPS location, keyed by hop byte. - Map _inferredHopPositions = {}; + // Inferred positions for hops that have no GPS location, keyed by hop prefix. + Map _inferredHopPositions = {}; // Endpoint position for the target contact (GPS or guessed). LatLng? _targetContactPosition; bool _targetContactIsGuessed = false; @@ -94,6 +108,7 @@ class _PathTraceMapScreenState extends State double _pathDistanceMeters = 0.0; bool _showNodeLabels = true; Contact? _targetContact; + Uint8List? _sentTagBytes; // 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); @@ -103,17 +118,82 @@ class _PathTraceMapScreenState extends State PathHistoryService? _pathHistory; PathViewMode _viewMode = PathViewMode.single; List _displayPaths = []; - List _primaryOutboundHops = []; + 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()) - .join(','); + String _formatPathPrefixes(Uint8List pathBytes, [int? hashByteWidth]) { + return PathHelper.splitPathBytes( + pathBytes, + hashByteWidth ?? widget.pathHashByteWidth, + ).map(PathHelper.formatHopHex).join(','); + } + + int _traceHashByteWidth(int pathHashByteWidth) { + final width = pathHashByteWidth.clamp(1, pubKeySize).toInt(); + if (width <= 1) return 1; + if (width == 2) return 2; + // Trace packets encode hash width as 1 << flags, so 3-byte path hashes + // must be traced with a 4-byte public-key prefix. + return 4; + } + + int _traceFlagsForHashWidth(int traceHashByteWidth) { + if (traceHashByteWidth <= 1) return 0; + if (traceHashByteWidth == 2) return 1; + return 2; + } + + Uint8List _reversePathByHop(Uint8List pathBytes, int hopWidth) { + final reversedHops = PathHelper.splitPathBytes( + pathBytes, + hopWidth, + ).reversed; + final bytes = []; + for (final hop in reversedHops) { + bytes.addAll(hop); + } + return Uint8List.fromList(bytes); + } + + Uint8List? _expandHopForTrace( + Uint8List hop, + int traceHashByteWidth, + MeshCoreConnector connector, + ) { + if (hop.length == traceHashByteWidth) return hop; + + final candidates = [ + ...?widget.pathContacts, + if (widget.targetContact != null) widget.targetContact!, + ...connector.allContactsUnfiltered, + ]; + for (final contact in candidates) { + if (contact.publicKey.length < traceHashByteWidth) continue; + if (!listEquals(contact.publicKey.sublist(0, hop.length), hop)) continue; + return Uint8List.fromList( + contact.publicKey.sublist(0, traceHashByteWidth), + ); + } + return null; + } + + Uint8List? _tracePathFromBytes( + Uint8List pathBytes, + int traceHashByteWidth, + MeshCoreConnector connector, + ) { + final hops = PathHelper.splitPathBytes(pathBytes, widget.pathHashByteWidth); + final traceBytes = []; + for (final hop in hops) { + final traceHop = _expandHopForTrace(hop, traceHashByteWidth, connector); + if (traceHop == null) return null; + traceBytes.addAll(traceHop); + } + return Uint8List.fromList(traceBytes); } @override @@ -233,45 +313,62 @@ class _PathTraceMapScreenState extends State ); } - Uint8List buildPath(Uint8List pathBytes) { - Uint8List traceBytes; + Uint8List? buildPath( + Uint8List pathBytes, + int traceHashByteWidth, + MeshCoreConnector connector, + ) { + final pathHops = PathHelper.splitPathBytes( + pathBytes, + widget.pathHashByteWidth, + ); + final hopWidth = traceHashByteWidth.clamp(1, pubKeySize).toInt(); - if (pathBytes.isEmpty) { - final pk = widget.targetContact?.publicKey; - final n = widget.pathHashByteWidth.clamp(1, pubKeySize); - if (pk != null && pk.length >= n) { - return Uint8List.fromList(pk.sublist(0, n)); + // Compute targetPrefix if targetContact is provided + Uint8List? targetPrefix; + if (widget.targetContact != null) { + final pk = widget.targetContact!.publicKey; + if (pk.isNotEmpty) { + final len = pk.length >= hopWidth ? hopWidth : pk.length; + targetPrefix = Uint8List.fromList(pk.sublist(0, len)); } - traceBytes = Uint8List(1); - traceBytes[0] = pk?[0] ?? 0; - return traceBytes; } - if (widget.targetContact?.type == advTypeRepeater || - widget.targetContact?.type == advTypeRoom) { - final len = (pathBytes.length + pathBytes.length + 1); - traceBytes = Uint8List(len); - traceBytes[pathBytes.length] = widget.targetContact?.publicKey[0] ?? 0; - for (int i = 0; i < pathBytes.length; i++) { - traceBytes[i] = pathBytes[i]; - if (i < pathBytes.length) { - traceBytes[len - 1 - i] = pathBytes[i]; + final outboundHops = []; + for (final hop in pathHops) { + final traceHop = _expandHopForTrace(hop, traceHashByteWidth, connector); + if (traceHop == null) return null; + outboundHops.add(traceHop); + } + if (targetPrefix != null) { + // Check if targetPrefix is already the last hop in pathHops to avoid duplication + bool alreadyEndedWithTarget = false; + if (outboundHops.isNotEmpty) { + if (listEquals(outboundHops.last, targetPrefix)) { + alreadyEndedWithTarget = true; } } - } else { - if (pathBytes.length < 2) { - return pathBytes[0] == 0 ? Uint8List(0) : pathBytes; - } - final len = (pathBytes.length + pathBytes.length - 1); - traceBytes = Uint8List(len); - for (int i = 0; i < pathBytes.length; i++) { - traceBytes[i] = pathBytes[i]; - if (i < pathBytes.length - 1) { - traceBytes[len - 1 - i] = pathBytes[i]; - } + if (!alreadyEndedWithTarget) { + outboundHops.add(targetPrefix); } } - return traceBytes; + + if (outboundHops.isEmpty) { + return Uint8List(0); + } + + final mirroredHops = [...outboundHops]; + if (outboundHops.length > 1) { + mirroredHops.addAll( + outboundHops.sublist(0, outboundHops.length - 1).reversed, + ); + } + + final traceBytes = []; + for (final hop in mirroredHops) { + traceBytes.addAll(hop); + } + return Uint8List.fromList(traceBytes); } /// Resolves the path bytes to trace. When tracing a specific contact's @@ -301,26 +398,49 @@ class _PathTraceMapScreenState extends State } final connector = Provider.of(context, listen: false); + final traceHashByteWidth = _traceHashByteWidth(widget.pathHashByteWidth); final livePath = _resolveLivePath(connector); _tracedPath = livePath; final pathTmp = widget.reversePathAround - ? Uint8List.fromList(livePath.reversed.toList()) + ? _reversePathByHop(livePath, widget.pathHashByteWidth) : livePath; - final path = widget.flipPathAround ? buildPath(pathTmp) : pathTmp; + final path = widget.flipPathAround + ? buildPath(pathTmp, traceHashByteWidth, connector) + : _tracePathFromBytes(pathTmp, traceHashByteWidth, connector); + + if (path == null) { + if (!mounted) return; + setState(() { + _isLoading = false; + _failed2Loaded = true; + }); + return; + } appLogger.info( - 'Initiating path trace with path: ${_formatPathPrefixes(path)}', + 'Initiating path trace with path: ' + '${_formatPathPrefixes(path, traceHashByteWidth)}', tag: 'PathTraceMapScreen', noNotify: !mounted, ); + final sentTag = DateTime.now().millisecondsSinceEpoch ~/ 1000; + _sentTagBytes = Uint8List(4) + ..[0] = sentTag & 0xFF + ..[1] = (sentTag >> 8) & 0xFF + ..[2] = (sentTag >> 16) & 0xFF + ..[3] = (sentTag >> 24) & 0xFF; + + final flags = _traceFlagsForHashWidth(traceHashByteWidth); + final tracePayload = path.isEmpty ? Uint8List.fromList([0x00]) : path; + final frame = buildTraceReq( - DateTime.now().millisecondsSinceEpoch ~/ 1000, - 0, //auth - 0, //flag - payload: path, + sentTag, + 0, // auth + flags, // flag + payload: tracePayload, ); connector.sendFrame(frame); } @@ -364,15 +484,13 @@ class _PathTraceMapScreenState extends State } // Check if it's a binary response - if (frame.length > 8 && + if (frame.length >= 12 && code == pushCodeTraceData && - listEquals(frame.sublist(4, 8), tagData)) { + (listEquals(frame.sublist(4, 8), _sentTagBytes) || + listEquals(frame.sublist(4, 8), tagData))) { _timeoutTimer?.cancel(); if (!mounted) return; - frameBuffer.skipBytes(3); //reserved + path length + flag - if (listEquals(frameBuffer.readBytes(4), tagData)) { - _handleTraceResponse(frame); - } + _handleTraceResponse(frame); } } catch (e) { _timeoutTimer?.cancel(); @@ -393,21 +511,30 @@ class _PathTraceMapScreenState extends State final buffer = BufferReader(frame); try { buffer.skipBytes(2); // Skip push code and reserved byte - int pathLength = buffer.readUInt8(); - final int flags = buffer - .readUInt8(); // path_sz = flags & 0x03 (path-hash mode, fw v1.11+) + final pathLenByte = buffer.readUInt8(); + final flags = buffer.readUInt8(); buffer.skipBytes(4); // Skip tag data buffer.skipBytes(4); // Skip auth code - final int pathSz = flags & 0x03; - Uint8List pathData = buffer.readBytes(pathLength); + var width = _traceHashByteWidth(1 << (flags & 0x03)); + var pathLength = pathLenByte == 0xFF ? 0 : pathLenByte; + if (pathLength > buffer.remaining && (pathLenByte & 0xC0) != 0) { + final packedWidth = ((pathLenByte & 0xC0) >> 6) + 1; + final packedLength = (pathLenByte & 0x3F) * packedWidth; + if (packedLength <= buffer.remaining) { + width = packedWidth; + pathLength = packedLength; + } + } + final pathBytes = buffer.readBytes(pathLength); + final pathData = PathHelper.splitPathBytes(pathBytes, width); // Firmware emits (path_len >> path_sz) hop SNRs plus 1 final SNR (to this node). - final int snrCount = (pathLength >> pathSz) + 1; + final snrCount = (pathLength ~/ width) + 1; List snrData = buffer .readBytes(snrCount) .map((snr) => snr.toSigned(8).toDouble() / 4) .toList(); - Map pathContacts = {}; + Map pathContacts = {}; Contact lastContact = Contact( path: Uint8List(0), pathLength: 0, @@ -419,7 +546,12 @@ class _PathTraceMapScreenState extends State lastSeen: DateTime.now(), ); if (widget.pathContacts != null) { - pathContacts = {for (var c in widget.pathContacts!) c.publicKey[0]: c}; + final hopWidth = width.clamp(1, pubKeySize).toInt(); + pathContacts = { + for (var c in widget.pathContacts!) + if (c.publicKey.length >= hopWidth) + _hopKey(Uint8List.fromList(c.publicKey.sublist(0, hopWidth))): c, + }; } else { final contacts = connector.allContactsUnfiltered; contacts.where((c) => c.type != advTypeChat).forEach((repeater) { @@ -434,12 +566,14 @@ class _PathTraceMapScreenState extends State _maxRepeaterMatchDistanceMeters) { return; //skip reapeaters that are far away from the last one with known GPS, to avoid false matches } - for (var repeaterData in pathData) { + for (final repeaterData in pathData) { + final hopWidth = repeaterData.length; + if (repeater.publicKey.length < hopWidth) continue; if (listEquals( - repeater.publicKey.sublist(0, 1), - Uint8List.fromList([repeaterData]), + repeater.publicKey.sublist(0, hopWidth), + repeaterData, )) { - pathContacts[repeaterData] = repeater; + pathContacts[_hopKey(repeaterData)] = repeater; lastContact = repeater; } } @@ -448,13 +582,20 @@ class _PathTraceMapScreenState extends State // For hops with no GPS contact, infer position from other contacts // with known GPS that share the same last-hop byte. - final Map inferredPositions = {}; + final Map inferredPositions = {}; for (final hop in pathData) { - final contact = pathContacts[hop]; + final hopKey = _hopKey(hop); + final contact = pathContacts[hopKey]; if (contact != null && contact.hasLocation) continue; final peers = connector.contacts .where( - (c) => c.hasLocation && c.path.isNotEmpty && c.path.last == hop, + (c) => + c.hasLocation && + c.path.isNotEmpty && + _matchesHopPrefix( + _lastHopChunk(c.path, widget.pathHashByteWidth), + hop, + ), ) .toList(); if (peers.isNotEmpty) { @@ -464,7 +605,7 @@ class _PathTraceMapScreenState extends State final lon = peers.map((c) => c.longitude!).reduce((a, b) => a + b) / peers.length; - inferredPositions[hop] = LatLng(lat, lon); + inferredPositions[hopKey] = LatLng(lat, lon); } } @@ -486,20 +627,31 @@ class _PathTraceMapScreenState extends State final tc = _targetContact!; if (tc.hasLocation) { targetPos = LatLng(tc.latitude!, tc.longitude!); - } else if (_tracedPath.length > 1) { + } else if (pathData.length > 1 || _tracedPath.isNotEmpty) { // 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 tracedHops = PathHelper.splitPathBytes( + _tracedPath, + widget.pathHashByteWidth, + ); + final hopsForEndpoint = tracedHops.isNotEmpty + ? tracedHops + : pathData; final lastHop = widget.reversePathAround - ? _tracedPath.first - : _tracedPath.last; + ? hopsForEndpoint.first + : hopsForEndpoint.last; + final lastHopKey = _hopKey(lastHop); final peers = connector.allContacts .where( (c) => c.hasLocation && c.path.isNotEmpty && - c.path.last == lastHop, + _matchesHopPrefix( + _lastHopChunk(c.path, widget.pathHashByteWidth), + lastHop, + ), ) .toList(); if (peers.isNotEmpty) { @@ -516,9 +668,9 @@ class _PathTraceMapScreenState extends State lon + offsetDeg * sin(angle), ); targetGuessed = true; - } else if (inferredPositions.containsKey(lastHop)) { - final lat = inferredPositions[lastHop]!.latitude; - final lon = inferredPositions[lastHop]!.longitude; + } else if (inferredPositions.containsKey(lastHopKey)) { + final lat = inferredPositions[lastHopKey]!.latitude; + final lon = inferredPositions[lastHopKey]!.longitude; const offsetDeg = 0.003; final angle = (tc.publicKey[1] / 255.0) * 2 * pi; targetPos = LatLng( @@ -528,7 +680,7 @@ class _PathTraceMapScreenState extends State targetGuessed = true; } else { // As a last resort, just place it at the same position as the last hop. - final contact = pathContacts[lastHop]; + final contact = pathContacts[lastHopKey]; if (contact != null && contact.hasLocation) { const offsetDeg = 0.003; final angle = (tc.publicKey[1] / 255.0) * 2 * pi; @@ -546,21 +698,22 @@ class _PathTraceMapScreenState extends State _points = []; _points.add(LatLng(connector.selfLatitude!, connector.selfLongitude!)); - int hopLast = 0; - int hopLastLast = 0; + String hopLast = ''; + String hopLastLast = ''; for (final hop in _traceData!.pathData) { - if (hop == hopLastLast && widget.flipPathAround) { + final hopKey = _hopKey(hop); + if (hopKey == hopLastLast && widget.flipPathAround) { break; //skip duplicate hops in round-trip paths } - final contact = _traceData!.pathContacts[hop]; + final contact = _traceData!.pathContacts[hopKey]; if (contact != null && contact.hasLocation) { _points.add(LatLng(contact.latitude!, contact.longitude!)); } else { - final inferred = inferredPositions[hop]; + final inferred = inferredPositions[hopKey]; if (inferred != null) _points.add(inferred); } hopLastLast = hopLast; - hopLast = hop; + hopLast = hopKey; } if (targetPos != null) { if (_targetContact != null && _targetContact!.type == advTypeChat) { @@ -583,7 +736,7 @@ class _PathTraceMapScreenState extends State _initialZoom = _points.isNotEmpty ? 13.0 : 2.0; _bounds = _points.length > 1 ? LatLngBounds.fromPoints(_points) : null; _mapKey = ValueKey( - '${context.l10n.pathTrace_you},${_formatPathPrefixes(_traceData!.pathData)}', + '${context.l10n.pathTrace_you},${_traceData!.pathData.map(PathHelper.formatHopHex).join(',')}', ); _pathDistanceMeters = getPathDistanceMeters(_points); _primaryOutboundHops = _outboundHops(pathData); @@ -605,37 +758,47 @@ 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; + List _outboundHops(List pathData) { + final hops = []; + var hopLast = ''; + var hopLastLast = ''; for (final hop in pathData) { - if (hop == hopLastLast && widget.flipPathAround) break; + final hopKey = _hopKey(hop); + if (hopKey == hopLastLast && widget.flipPathAround) break; hops.add(hop); hopLastLast = hopLast; - hopLast = hop; + hopLast = hopKey; } return hops; } - Contact? _contactForHop(int hop, MeshCoreConnector connector) { - final traced = _traceData?.pathContacts[hop]; + Contact? _contactForHop(Uint8List hop, MeshCoreConnector connector) { + final traced = _traceData?.pathContacts[_hopKey(hop)]; if (traced != null) return traced; for (final c in connector.allContactsUnfiltered) { if (c.type != advTypeChat && - c.publicKey.isNotEmpty && - c.publicKey[0] == hop) { + c.publicKey.length >= hop.length && + listEquals(c.publicKey.sublist(0, hop.length), hop)) { return c; } } return null; } - LatLng? _inferredPositionForHop(int hop, MeshCoreConnector connector) { - final cached = _inferredHopPositions[hop]; + LatLng? _inferredPositionForHop(Uint8List hop, MeshCoreConnector connector) { + final hopKey = _hopKey(hop); + final cached = _inferredHopPositions[hopKey]; if (cached != null) return cached; final peers = connector.contacts - .where((c) => c.hasLocation && c.path.isNotEmpty && c.path.last == hop) + .where( + (c) => + c.hasLocation && + c.path.isNotEmpty && + _matchesHopPrefix( + _lastHopChunk(c.path, widget.pathHashByteWidth), + hop, + ), + ) .toList(); if (peers.isEmpty) return null; final lat = @@ -643,10 +806,14 @@ class _PathTraceMapScreenState extends State final lon = peers.map((c) => c.longitude!).reduce((a, b) => a + b) / peers.length; final pos = LatLng(lat, lon); - _inferredHopPositions[hop] = pos; + _inferredHopPositions[hopKey] = pos; return pos; } + String _pathKeyForHops(List hops) { + return hops.map(PathHelper.formatHopHex).join(','); + } + /// 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) { @@ -664,18 +831,22 @@ class _PathTraceMapScreenState extends State final target = widget.targetContact; final history = _pathHistory; if (target != null && history != null) { - final seen = {_primaryOutboundHops.join(',')}; + final seen = {_pathKeyForHops(_primaryOutboundHops)}; var altIndex = 0; for (final record in history.getRecentPaths(target.publicKeyHex)) { if (record.pathBytes.isEmpty) continue; - if (!seen.add(record.pathBytes.join(','))) continue; + final recordHops = PathHelper.splitPathBytes( + record.pathBytes, + widget.pathHashByteWidth, + ); + if (!seen.add(_pathKeyForHops(recordHops))) continue; if (altIndex >= kAlternatePathColors.length) break; final alt = _buildDisplayPath( - id: 'alt-${record.pathBytes.join('-')}', + id: 'alt-${_pathKeyForHops(recordHops)}', label: context.l10n.pathMap_alternate(altIndex + 1), color: kAlternatePathColors[altIndex], isPrimary: false, - hops: record.pathBytes, + hops: recordHops, record: record, connector: connector, ); @@ -700,7 +871,7 @@ class _PathTraceMapScreenState extends State required String label, required Color color, required bool isPrimary, - required List hops, + required List hops, required MeshCoreConnector connector, PathRecord? record, }) { @@ -719,7 +890,7 @@ class _PathTraceMapScreenState extends State for (var i = 0; i < hops.length; i++) { final hop = hops[i]; - final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final hex = PathHelper.formatHopHex(hop); final contact = _contactForHop(hop, connector); LatLng? pos; var isGps = false; @@ -773,7 +944,7 @@ class _PathTraceMapScreenState extends State label: label, color: color, isPrimary: isPrimary, - hopBytes: List.from(hops), + hopBytes: List.from(hops), points: points, pointLabels: labels, pointConfirmed: confirmed, @@ -934,29 +1105,34 @@ class _PathTraceMapScreenState extends State } List _buildHopMarkers( - List pathData, { + List pathData, { required bool showLabels, required Contact? target, }) { final markers = []; - int hopLast = 0; - int hopLastLast = 0; + String hopLast = ''; + String hopLastLast = ''; for (final hop in pathData) { - final contact = _traceData!.pathContacts[hop]; - final inferred = _inferredHopPositions[hop]; + final hopKey = _hopKey(hop); + final contact = _traceData!.pathContacts[hopKey]; + final inferred = _inferredHopPositions[hopKey]; final hasGps = contact != null && contact.hasLocation; - if (hop == hopLastLast && widget.flipPathAround) { + if (hopKey == hopLastLast && widget.flipPathAround) { continue; //skip duplicate hops in round-trip paths } if (!hasGps && inferred == null) { hopLastLast = hopLast; - hopLast = hop; + hopLast = hopKey; continue; //skip hops with no GPS and no inferred position } final point = hasGps ? LatLng(contact.latitude!, contact.longitude!) : inferred!; - final label = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final label = PathHelper.formatHopHex(hop); + final shortLabel = label.length > 2 ? label.substring(0, 2) : label; + final fullLabel = label.length > 2 + ? (contact?.name != null ? '$label: ${contact!.name}' : label) + : (contact?.name ?? label); markers.add( Marker( @@ -989,9 +1165,9 @@ class _PathTraceMapScreenState extends State ), alignment: Alignment.center, child: Text( - hasGps ? label : '~$label', + shortLabel, style: MeshTheme.mono( - fontSize: 10, + fontSize: 12, fontWeight: FontWeight.w700, color: hasGps ? MeshPalette.signal : MeshPalette.warn, ), @@ -1001,15 +1177,10 @@ class _PathTraceMapScreenState extends State ), ); if (showLabels) { - markers.add( - _buildNodeLabelMarker( - point: point, - label: contact?.name ?? '~$label', - ), - ); + markers.add(_buildNodeLabelMarker(point: point, label: fullLabel)); } hopLastLast = hopLast; - hopLast = hop; + hopLast = hopKey; } _addEndpointMarkers(markers, showLabels: showLabels, target: target); @@ -1137,17 +1308,22 @@ class _PathTraceMapScreenState extends State final connector = context.read(); final markers = []; - // Hop byte -> paths that use it, in display order. - final hopPaths = >{}; + // Hop prefix -> paths that use it, in display order. + final hopPaths = >{}; + final hopsByKey = {}; for (final path in _visiblePaths) { for (final hop in path.hopBytes) { - final list = hopPaths.putIfAbsent(hop, () => []); + final hopKey = _hopKey(hop); + hopsByKey[hopKey] = hop; + final list = hopPaths.putIfAbsent(hopKey, () => []); if (!list.contains(path)) list.add(path); } } for (final entry in hopPaths.entries) { - final hop = entry.key; + final hopKey = entry.key; + final hop = hopsByKey[hopKey]; + if (hop == null) continue; final paths = entry.value; final contact = _contactForHop(hop, connector); final hasGps = contact != null && contact.hasLocation; @@ -1155,7 +1331,7 @@ class _PathTraceMapScreenState extends State ? LatLng(contact.latitude!, contact.longitude!) : _inferredPositionForHop(hop, connector); if (point == null) continue; - final label = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final label = PathHelper.formatHopHex(hop); final baseColor = hasGps ? MeshPalette.signal : MeshPalette.warn; final shared = paths.length > 1; @@ -1240,11 +1416,11 @@ class _PathTraceMapScreenState extends State } void _showSharedNodeSheet( - int hop, + Uint8List hop, Contact? contact, List paths, ) { - final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final hex = PathHelper.formatHopHex(hop); showSharedNodeSheet( context, title: @@ -1291,29 +1467,28 @@ class _PathTraceMapScreenState extends State } String formatDirectionText(PathTraceData pathTraceData, int index) { - if (index == 0 || index == pathTraceData.snrData.length - 1) { + if (pathTraceData.pathData.isEmpty) { + return context.l10n.pathTrace_you; + } + if (index < 0 || index > pathTraceData.pathData.length) { + return context.l10n.pathTrace_you; + } + + if (index == 0 || index == pathTraceData.pathData.length) { if (index == 0) { return context.l10n.pathTrace_you; } else { - final contactName = pathTraceData - .pathContacts[pathTraceData.pathData[pathTraceData.pathData.length - - 1]] - ?.name; - final hex = pathTraceData.pathData[pathTraceData.pathData.length - 1] - .toRadixString(16) - .padLeft(2, '0') - .toUpperCase(); + final hop = pathTraceData.pathData.last; + final contactName = pathTraceData.pathContacts[_hopKey(hop)]?.name; + final hex = PathHelper.formatHopHex(hop); return contactName != null ? "$hex: $contactName" : "$hex: ${context.l10n.channelPath_unknownRepeater}"; } } else { - final contactName = - pathTraceData.pathContacts[pathTraceData.pathData[index - 1]]?.name; - final hex = pathTraceData.pathData[index - 1] - .toRadixString(16) - .padLeft(2, '0') - .toUpperCase(); + final hop = pathTraceData.pathData[index - 1]; + final contactName = pathTraceData.pathContacts[_hopKey(hop)]?.name; + final hex = PathHelper.formatHopHex(hop); return contactName != null ? "$hex: $contactName" : "$hex: ${context.l10n.channelPath_unknownRepeater}"; @@ -1321,14 +1496,18 @@ class _PathTraceMapScreenState extends State } String formatDirectionSubText(PathTraceData pathTraceData, int index) { - if (index == 0 || index == pathTraceData.snrData.length - 1) { + if (pathTraceData.pathData.isEmpty) { + return context.l10n.pathTrace_you; + } + if (index < 0 || index > pathTraceData.pathData.length) { + return context.l10n.pathTrace_you; + } + + if (index == 0 || index == pathTraceData.pathData.length) { if (index == 0) { - final contactName = - pathTraceData.pathContacts[pathTraceData.pathData[0]]?.name; - final hex = pathTraceData.pathData[0] - .toRadixString(16) - .padLeft(2, '0') - .toUpperCase(); + final hop = pathTraceData.pathData.first; + final contactName = pathTraceData.pathContacts[_hopKey(hop)]?.name; + final hex = PathHelper.formatHopHex(hop); return contactName != null ? "$hex: $contactName" : "$hex: ${context.l10n.channelPath_unknownRepeater}"; @@ -1336,12 +1515,9 @@ class _PathTraceMapScreenState extends State return context.l10n.pathTrace_you; } } else { - final contactName = - pathTraceData.pathContacts[pathTraceData.pathData[index]]?.name; - final hex = pathTraceData.pathData[index] - .toRadixString(16) - .padLeft(2, '0') - .toUpperCase(); + final hop = pathTraceData.pathData[index]; + final contactName = pathTraceData.pathContacts[_hopKey(hop)]?.name; + final hex = PathHelper.formatHopHex(hop); return contactName != null ? "$hex: $contactName" : "$hex: ${context.l10n.channelPath_unknownRepeater}"; @@ -1399,7 +1575,7 @@ class _PathTraceMapScreenState extends State }, ), children: [ - ThemedMapTileLayer(tileCache: tileCache), + tileCache.buildTileLayer(context), AnimatedBuilder( animation: _playback, builder: (context, _) { @@ -1670,11 +1846,11 @@ class _PathTraceMapScreenState extends State final connector = context.read(); final l10n = context.l10n; - final hopUseCount = {}; + 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); + for (final hopKey in p.hopBytes.map(PathHelper.formatHopHex).toSet()) { + hopUseCount.update(hopKey, (v) => v + 1, ifAbsent: () => 1); } } } @@ -1690,7 +1866,7 @@ class _PathTraceMapScreenState extends State Widget? trailing; if (index < path.hopBytes.length) { final hop = path.hopBytes[index]; - final hex = hop.toRadixString(16).padLeft(2, '0').toUpperCase(); + final hex = PathHelper.formatHopHex(hop); final contact = _contactForHop(hop, connector); title = contact != null ? '$hex: ${contact.name}' @@ -1703,7 +1879,7 @@ class _PathTraceMapScreenState extends State : inferred ? l10n.pathTrace_legendInferred : l10n.pathMap_noLocation; - final sharedCount = hopUseCount[hop] ?? 0; + final sharedCount = hopUseCount[_hopKey(hop)] ?? 0; subtitle = sharedCount > 1 ? '$status · ${l10n.pathMap_sharedNodeCount(sharedCount)}' : status; diff --git a/lib/screens/region_management_screen.dart b/lib/screens/region_management_screen.dart new file mode 100644 index 00000000..df6c477c --- /dev/null +++ b/lib/screens/region_management_screen.dart @@ -0,0 +1,527 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:meshcore_open/connector/meshcore_connector.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/l10n/l10n.dart'; +import 'package:meshcore_open/models/contact.dart'; +import 'package:meshcore_open/storage/region_store.dart'; +import 'package:meshcore_open/theme/mesh_theme.dart'; +import 'package:meshcore_open/widgets/mesh_ui.dart'; +import 'package:provider/provider.dart'; + +Future pushRegionManagementScreen(BuildContext context) { + return Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const RegionManagementScreen(), + ), + ); +} + +class RegionManagementScreen extends StatefulWidget { + const RegionManagementScreen({super.key}); + + @override + State createState() => _RegionManagementScreenState(); +} + +class _RegionManagementScreenState extends State { + static final RegExp _validFetchedRegion = RegExp(r'^[a-z0-9-]{1,30}$'); + + final RegionStore _regionStore = RegionStore(); + List _regions = []; + bool _isFetchingRegions = false; + + @override + void initState() { + super.initState(); + final connector = context.read(); + _regionStore.setPublicKeyHex = connector.selfPublicKeyHex; + _loadRegions(); + } + + void _loadRegions() { + final regions = _regionStore.loadRegions(); + if (mounted) { + setState(() { + _regions = regions; + }); + } + } + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + return Scaffold( + appBar: AppBar( + title: Text(l10n.settings_regionManagement_screenTitle), + centerTitle: true, + actions: [ + IconButton( + tooltip: l10n.settings_regionAddRegion, + icon: const Icon(Icons.add), + onPressed: () => _showAddRegionDialog(context), + ), + IconButton( + tooltip: l10n.settings_regionFetchRegions, + icon: _isFetchingRegions + ? const SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Icon(Icons.travel_explore), + onPressed: _isFetchingRegions ? null : _showFetchRegionsDialog, + ), + ], + ), + body: ListView.builder( + padding: const EdgeInsets.only(left: 16, right: 16, top: 8, bottom: 88), + itemCount: _regions.length, + itemBuilder: (context, index) { + final region = _regions[index]; + return _buildRegionTile(context, region); + }, + ), + ); + } + + void _showAddRegionDialog(BuildContext context) { + final l10n = context.l10n; + final controller = TextEditingController(); + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Text(l10n.settings_regionName), + content: TextField( + controller: controller, + autofocus: true, + textInputAction: TextInputAction.send, + onSubmitted: (_) => _handleAddRegion(controller.text, context), + decoration: InputDecoration( + hintText: l10n.settings_regionNameHint, + border: const OutlineInputBorder(), + ), + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp("[a-z0-9-]")), + ], + maxLength: 30, + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text(l10n.common_cancel), + ), + TextButton( + onPressed: () => _handleAddRegion(controller.text, context), + child: Text(l10n.common_add), + ), + ], + ), + ); + } + + Future _showFetchRegionsDialog() async { + if (_isFetchingRegions) return; + + setState(() { + _isFetchingRegions = true; + }); + + Set fetchedRegions = {}; + try { + fetchedRegions = await _fetchRegionsFromRepeaters(); + } finally { + if (mounted) { + setState(() { + _isFetchingRegions = false; + }); + } + } + + if (!mounted) return; + final l10n = context.l10n; + final sortedRegions = fetchedRegions.toList()..sort(); + await showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(l10n.settings_regionFetchRegions), + content: sortedRegions.isEmpty + ? Text(l10n.settings_regionFetchRegionsFail) + : StatefulBuilder( + builder: (context, setDialogState) { + return SizedBox( + width: double.maxFinite, + child: ListView.builder( + shrinkWrap: true, + itemCount: sortedRegions.length, + itemBuilder: (context, index) { + final fetchedRegion = sortedRegions[index]; + final alreadyExists = _regions.contains(fetchedRegion); + return MeshCard( + margin: const EdgeInsets.symmetric(vertical: 4), + padding: const EdgeInsets.only(left: 14, right: 4), + child: Row( + children: [ + const Icon( + Icons.landscape, + color: MeshPalette.blue, + ), + const SizedBox(width: 12), + Expanded( + child: Text( + fetchedRegion, + style: Theme.of(context).textTheme.bodyMedium, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + TextButton( + style: alreadyExists + ? TextButton.styleFrom( + foregroundColor: Theme.of( + context, + ).disabledColor, + ) + : null, + onPressed: () { + if (alreadyExists) { + _showDialogSnackBar( + context, + l10n.settings_regionFetchRegionsAlreadyExists, + ); + return; + } + + _regionStore.addRegion(fetchedRegion); + _loadRegions(); + setDialogState(() {}); + }, + child: Text(l10n.common_add), + ), + ], + ), + ); + }, + ), + ); + }, + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(l10n.common_close), + ), + ], + ), + ); + } + + void _showDialogSnackBar(BuildContext context, String message) { + final overlay = Overlay.maybeOf(context); + if (overlay == null) return; + + final theme = Theme.of(context); + final entry = OverlayEntry( + builder: (context) => Positioned( + left: 16, + right: 16, + bottom: 32, + child: SafeArea( + child: Material( + color: theme.colorScheme.inverseSurface, + elevation: 6, + borderRadius: BorderRadius.circular(4), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14), + child: Text( + message, + style: theme.textTheme.bodyMedium?.copyWith( + color: theme.colorScheme.onInverseSurface, + ), + ), + ), + ), + ), + ), + ); + + overlay.insert(entry); + Timer(const Duration(seconds: 3), entry.remove); + } + + Future> _fetchRegionsFromRepeaters() async { + final connector = context.read(); + final repeaters = await _discoverNearbyRepeaters(connector); + final regions = {}; + + for (final repeater in repeaters) { + if (!mounted || !connector.isConnected) break; + regions.addAll(await _requestRegionsFromRepeater(connector, repeater)); + } + + return regions; + } + + Future> _discoverNearbyRepeaters( + MeshCoreConnector connector, + ) async { + final repeaters = connector.contacts + .where((contact) => contact.type == advTypeRepeater) + .toList(); + if (repeaters.isEmpty || !connector.isConnected) return []; + + StreamSubscription? subscription; + Timer? timeout; + final completer = Completer>(); + final respondingPrefixes = {}; + final tag = DateTime.now().microsecondsSinceEpoch & 0xFFFFFFFF; + + void complete() { + if (completer.isCompleted) return; + timeout?.cancel(); + subscription?.cancel(); + completer.complete(respondingPrefixes); + } + + subscription = connector.receivedFrames.listen((frame) { + if (frame.isEmpty || completer.isCompleted) return; + + final reader = BufferReader(frame); + try { + if (reader.readByte() != pushCodeControlData) return; + if (reader.remaining < 9) return; + reader.skipBytes(3); // SNR, RSSI, path_len from companion firmware. + + final payloadType = reader.readByte(); + if (((payloadType >> 4) & 0x0F) != controlSubtypeDiscoverResp || + (payloadType & 0x0F) != advTypeRepeater) { + return; + } + + reader.skipBytes(1); // Inbound SNR reported by the responding repeater. + if (reader.readUInt32LE() != tag) return; + + final publicKeyPrefix = reader.readRemainingBytes(); + if (publicKeyPrefix.isEmpty) return; + respondingPrefixes.add(pubKeyToHex(publicKeyPrefix)); + } catch (_) { + // Ignore malformed discovery frames; another response may still arrive. + } + }); + + try { + final payload = buildDiscoveryRequestPayload(tag, prefixOnly: true); + await connector.sendFrame(buildSendControlDataFrame(payload)); + timeout = Timer(const Duration(seconds: 10), complete); + final prefixes = await completer.future; + return repeaters.where((contact) { + final contactKey = contact.publicKeyHex.toLowerCase(); + return prefixes.any((prefix) => contactKey.startsWith(prefix)); + }).toList(); + } catch (_) { + timeout?.cancel(); + await subscription.cancel(); + return []; + } + } + + Future> _requestRegionsFromRepeater( + MeshCoreConnector connector, + Contact repeater, + ) async { + StreamSubscription? subscription; + Timer? timeout; + final completer = Completer>(); + int? expectedTag; + final originalPath = Uint8List.fromList(repeater.path); + final originalPathLength = repeater.pathLength; + var pathChangedForRequest = false; + + void complete(Set regions) { + if (completer.isCompleted) return; + timeout?.cancel(); + subscription?.cancel(); + completer.complete(regions); + } + + void restartTimeout(Duration duration) { + timeout?.cancel(); + timeout = Timer(duration, () => complete({})); + } + + try { + final replyPath = Uint8List(0); + const replyHopCount = 0; + await connector.setContactPath(repeater, replyPath, replyHopCount); + pathChangedForRequest = true; + + subscription = connector.receivedFrames.listen((frame) { + if (frame.isEmpty || completer.isCompleted) return; + + final reader = BufferReader(frame); + try { + final cmd = reader.readByte(); + if (cmd == respCodeSent) { + reader.skipBytes(1); + expectedTag = reader.readUInt32LE(); + final estimatedTimeoutMs = reader.readUInt32LE(); + restartTimeout( + Duration( + milliseconds: estimatedTimeoutMs > 0 + ? estimatedTimeoutMs + 2000 + : 10000, + ), + ); + return; + } + + if (cmd == respCodeErr) { + complete({}); + return; + } + + if (cmd != pushCodeBinaryResponse || expectedTag == null) return; + + reader.skipBytes(1); + final tag = reader.readUInt32LE(); + if (tag != expectedTag) return; + + complete(_parseRegionsResponse(reader.readRemainingBytes())); + } catch (_) { + complete({}); + } + }); + + restartTimeout(const Duration(seconds: 10)); + final frame = buildSendAnonReqFrame( + repeater.publicKey, + requestType: anonReqTypeRegions, + replyPath: replyPath, + replyHopCount: replyHopCount, + pathHashWidth: connector.pathHashByteWidth, + ); + await connector.sendFrame(frame); + final regions = await completer.future; + if (pathChangedForRequest && connector.isConnected) { + await _restoreRepeaterPath( + connector, + repeater, + originalPathLength, + originalPath, + ); + } + return regions; + } catch (_) { + timeout?.cancel(); + subscription?.cancel(); + if (pathChangedForRequest && connector.isConnected) { + await _restoreRepeaterPath( + connector, + repeater, + originalPathLength, + originalPath, + ); + } + return {}; + } + } + + Future _restoreRepeaterPath( + MeshCoreConnector connector, + Contact repeater, + int originalPathLength, + Uint8List originalPath, + ) async { + if (originalPathLength < 0) { + await connector.clearContactPath(repeater); + return; + } + await connector.setContactPath(repeater, originalPath, originalPathLength); + } + + Set _parseRegionsResponse(Uint8List frame) { + if (frame.length <= 4) return {}; + final names = utf8 + .decode(frame.sublist(4), allowMalformed: true) + .replaceAll('\x00', '') + .split(','); + return names + .map((name) => name.trim()) + .where((name) => _validFetchedRegion.hasMatch(name)) + .toSet(); + } + + void _handleAddRegion(Region region, BuildContext context) { + Navigator.pop(context); + _regionStore.addRegion(region); + _loadRegions(); + } + + Widget _buildRegionTile(BuildContext context, Region region) { + final scheme = Theme.of(context).colorScheme; + return MeshCard( + key: ValueKey(region), + padding: const EdgeInsets.only(left: 14, right: 4), + child: Row( + children: [ + const Icon(Icons.landscape, color: MeshPalette.blue), + const SizedBox(width: 12), + Expanded( + child: Text( + region, + style: Theme.of(context).textTheme.bodyMedium, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + IconButton( + tooltip: context.l10n.settings_deleteRegion, + icon: Icon(Icons.delete_outline, color: scheme.error), + onPressed: () => _confirmDelete(context, region), + ), + ], + ), + ); + } + + void _confirmDelete(BuildContext context, Region region) { + showDialog( + context: context, + builder: (dialogContext) => AlertDialog( + title: Text(context.l10n.settings_deleteRegion), + content: Text(context.l10n.settings_deleteRegionConfirm(region)), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(context.l10n.common_cancel), + ), + TextButton( + onPressed: () async { + final connector = context.read(); + Navigator.pop(dialogContext); + await _regionStore.removeRegion(region); + // Deleting a region clears it from any channels that used it; + // refresh the connector's in-memory channel regions to match. + await connector.loadChannelSettings(); + _loadRegions(); + if (!context.mounted) return; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(context.l10n.settings_regionDeleted)), + ); + }, + child: Text( + context.l10n.common_delete, + style: TextStyle( + color: Theme.of(dialogContext).colorScheme.error, + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/repeater_hub_screen.dart b/lib/screens/repeater_hub_screen.dart index ab15e01e..b23be5dc 100644 --- a/lib/screens/repeater_hub_screen.dart +++ b/lib/screens/repeater_hub_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/connector/meshcore_connector.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; @@ -31,6 +32,7 @@ class RepeaterHubScreen extends StatelessWidget { final l10n = context.l10n; final scheme = Theme.of(context).colorScheme; final settingsService = context.watch(); + final connector = context.watch(); final chemistry = settingsService.batteryChemistryForRepeater( repeater.publicKeyHex, ); @@ -85,7 +87,10 @@ class RepeaterHubScreen extends StatelessWidget { ), const SizedBox(height: 4), Text( - repeater.pathLabel(l10n), + repeater.pathLabel( + l10n, + pathHashByteWidth: connector.pathHashByteWidth, + ), style: Theme.of(context).textTheme.bodySmall ?.copyWith(color: scheme.onSurfaceVariant), ), diff --git a/lib/screens/repeater_settings_screen.dart b/lib/screens/repeater_settings_screen.dart index dca0d7f4..6c6d633a 100644 --- a/lib/screens/repeater_settings_screen.dart +++ b/lib/screens/repeater_settings_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; -import 'dart:typed_data'; +import 'dart:math'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; @@ -11,6 +12,7 @@ import '../services/storage_service.dart'; import '../theme/mesh_theme.dart'; import '../widgets/mesh_ui.dart'; import '../widgets/routing_sheet.dart'; +import '../utils/keys.dart'; import '../helpers/snack_bar_builder.dart'; class RepeaterSettingsScreen extends StatefulWidget { @@ -44,6 +46,7 @@ enum _SettingField { advertInterval, floodAdvertInterval, pathHashMode, + prvKey, txDelay, directTxDelay, intThresh, @@ -109,6 +112,8 @@ class _RepeaterSettingsScreenState extends State { bool _refreshingIntThresh = false; bool _refreshingAgcResetInterval = false; bool _runningAction = false; + bool _searchingForKeyPair = false; + bool _stopSearchingForKeyPair = false; StreamSubscription? _frameSubscription; RepeaterCommandService? _commandService; @@ -154,6 +159,11 @@ class _RepeaterSettingsScreenState extends State { // Advanced int _pathHashMode = 0; // 0-2 + final TextEditingController _prvKeyController = TextEditingController(); + final TextEditingController _pubKeyController = TextEditingController(); + final TextEditingController _prvKeyPrefixController = TextEditingController(); + final KeyPairSearcher _keyPairSearcher = KeyPairSearcher(); + final int _searchChunkTime = 30; // time in ms to search before yielding final TextEditingController _txDelayController = TextEditingController(); final TextEditingController _directTxDelayController = TextEditingController(); @@ -206,6 +216,10 @@ class _RepeaterSettingsScreenState extends State { _txDelayController.dispose(); _directTxDelayController.dispose(); _intThreshController.dispose(); + _prvKeyController.dispose(); + _pubKeyController.dispose(); + _prvKeyPrefixController.dispose(); + _stopSearchingForKeyPair = true; super.dispose(); } @@ -860,6 +874,12 @@ class _RepeaterSettingsScreenState extends State { command: 'set path.hash.mode $_pathHashMode', )); } + if (_dirtyFields.contains(_SettingField.prvKey)) { + final v = _prvKeyController.text.trim(); + if (v != "") { + pending.add((field: _SettingField.prvKey, command: 'set prv.key $v')); + } + } if (_dirtyFields.contains(_SettingField.txDelay) && _txDelayController.text.isNotEmpty) { final v = double.tryParse(_txDelayController.text.trim()); @@ -1005,6 +1025,36 @@ class _RepeaterSettingsScreenState extends State { } } + void _startSearchingForKeyPair() async { + if (_searchingForKeyPair) return; + setState(() { + _searchingForKeyPair = true; + _stopSearchingForKeyPair = false; + }); + _searchForKeyPair(); + } + + void _searchForKeyPair() async { + if (_stopSearchingForKeyPair) { + if (mounted) setState(() => _searchingForKeyPair = false); + return; + } + final String prefix = _prvKeyPrefixController.text.trim(); + MCKeyPair? keys = await _keyPairSearcher.findMatchingKeyPair( + prefix, + _searchChunkTime, + ); + if (keys == null) { + // Ran out of time; schedule another attempt. + Timer.run(_searchForKeyPair); + } else { + setState(() => _searchingForKeyPair = false); + _prvKeyController.text = pubKeyToHex(keys.private); + _pubKeyController.text = pubKeyToHex(keys.public); + _markChanged(_SettingField.prvKey); + } + } + Widget _buildInlineRefreshButton({ required bool isRefreshing, required VoidCallback onRefresh, @@ -1069,6 +1119,7 @@ class _RepeaterSettingsScreenState extends State { _buildOwnerInfoCard(), _buildActionsCard(), _buildAdvancedCard(), + _buildKeysCard(), const SizedBox(height: 16), _buildDangerZoneCard(), ], @@ -1984,6 +2035,127 @@ class _RepeaterSettingsScreenState extends State { ); } + Widget _buildKeysCard() { + final l10n = context.l10n; + return MeshCard( + child: ExpansionTile( + leading: const Icon(Icons.vpn_key), + title: Text( + l10n.repeater_keySettings, + style: const TextStyle(fontSize: 15, fontWeight: FontWeight.w600), + ), + subtitle: Text(l10n.repeater_keySettingsSubtitle), + childrenPadding: const EdgeInsets.fromLTRB(0, 8, 0, 4), + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _prvKeyController, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp("[0-9a-fA-F]")), + ], + decoration: InputDecoration( + labelText: l10n.repeater_prvKey, + helperText: l10n.repeater_prvKeyHelper, + helperMaxLines: 3, + border: const OutlineInputBorder(), + ), + onChanged: (_) { + _pubKeyController.text = ""; + if (_prvKeyController.text.isNotEmpty) { + _markChanged(_SettingField.prvKey); + } + }, + ), + ), + const SizedBox(width: 8), + Padding( + padding: const EdgeInsets.only(top: 8), + child: _searchingForKeyPair + ? IconButton( + icon: const Icon(Icons.cancel, size: 24), + onPressed: (() => _stopSearchingForKeyPair = true), + tooltip: l10n.repeater_stopGeneratingPrvKey, + visualDensity: VisualDensity.compact, + ) + : IconButton( + icon: const Icon(Icons.casino_rounded, size: 24), + onPressed: () { + _startSearchingForKeyPair(); + }, + tooltip: l10n.repeater_generatePrvKey, + visualDensity: VisualDensity.compact, + ), + ), + ], + ), + const SizedBox(height: 16), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + readOnly: true, + controller: _pubKeyController, + style: TextStyle( + color: Theme.of( + context, + ).textTheme.headlineSmall?.color?.withValues(alpha: 0.6), + ), + decoration: InputDecoration( + labelText: l10n.repeater_pubKey, + helperText: l10n.repeater_pubKeyHelper, + helperMaxLines: 3, + border: const OutlineInputBorder(), + ), + ), + ), + const SizedBox(width: 16), + Padding( + padding: const EdgeInsets.only(top: 12), + child: SizedBox( + width: 24, + height: 24, + child: _searchingForKeyPair + ? CircularProgressIndicator(strokeWidth: 2) + : null, + ), + ), + const SizedBox(width: 8), + ], + ), + const SizedBox(height: 16), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: TextField( + controller: _prvKeyPrefixController, + maxLength: 4, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp("[0-9a-fA-F]")), + ], + onChanged: (_) => setState(() => {}), // updates helper text + decoration: InputDecoration( + labelText: l10n.repeater_pubKeyPrefix, + helperText: l10n.repeater_pubKeyPrefixHelper( + pow(16, _prvKeyPrefixController.text.length).toInt(), + ), + helperMaxLines: 3, + border: const OutlineInputBorder(), + ), + ), + ), + const SizedBox(width: 48), + ], + ), + ], + ), + ); + } + Widget _buildDangerZoneCard() { final l10n = context.l10n; return MeshCard( diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart index ef7ae08e..17cca639 100644 --- a/lib/screens/settings_screen.dart +++ b/lib/screens/settings_screen.dart @@ -9,6 +9,7 @@ import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; import '../l10n/l10n.dart'; import '../models/radio_settings.dart'; +import '../services/app_settings_service.dart'; import '../services/app_debug_log_service.dart'; import '../theme/mesh_theme.dart'; import '../widgets/app_bar.dart'; @@ -19,6 +20,7 @@ import 'app_debug_log_screen.dart'; import 'ble_debug_log_screen.dart'; import '../widgets/radio_stats_entry.dart'; import '../widgets/sync_progress_overlay.dart'; +import 'region_management_screen.dart'; /// Convert device coding-rate value (1-4 on some firmware, 5-8 on others) /// to the UI enum range (always 5-8). @@ -449,6 +451,14 @@ class _SettingsScreenState extends State { onTap: () => _showRadioSettings(context, connector), ), const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.landscape, + title: l10n.settings_regionSettings, + subtitle: l10n.settings_regionSettingsSubtitle, + onTap: () => pushRegionManagementScreen(context), + ), + const Divider(height: 1, indent: 16), _tappableTile( context, icon: Icons.sensors_outlined, @@ -458,10 +468,30 @@ class _SettingsScreenState extends State { ? () => pushCompanionRadioStatsScreen(context) : null, ), + const Divider(height: 1, indent: 16), + _tappableTile( + context, + icon: Icons.route_outlined, + title: l10n.repeater_pathHashMode, + subtitle: _pathHashModeSubtitle(context, connector.pathHashByteWidth), + onTap: connector.isConnected + ? () => _editPathHashMode(context, connector) + : null, + ), ], ); } + String _pathHashModeSubtitle(BuildContext context, int pathHashByteWidth) { + final l10n = context.l10n; + return switch (pathHashByteWidth.clamp(1, 4).toInt()) { + 1 => l10n.repeater_pathHashModeOption0, + 2 => l10n.repeater_pathHashModeOption1, + 3 => l10n.repeater_pathHashModeOption2, + _ => l10n.repeater_pathHashModeOption3, + }; + } + Widget _buildLocationCardContent( BuildContext context, MeshCoreConnector connector, @@ -750,8 +780,90 @@ class _SettingsScreenState extends State { ); } + void _editPathHashMode(BuildContext context, MeshCoreConnector connector) { + final l10n = context.l10n; + var selectedMode = (connector.pathHashByteWidth - 1).clamp(0, 3).toInt(); + + showDialog( + context: context, + builder: (dialogContext) => StatefulBuilder( + builder: (context, setDialogState) => AlertDialog( + title: Text(l10n.repeater_pathHashMode), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + DropdownButtonFormField( + initialValue: selectedMode, + decoration: InputDecoration( + labelText: l10n.repeater_pathHashMode, + border: const OutlineInputBorder(), + ), + items: [ + DropdownMenuItem( + value: 0, + child: Text(l10n.repeater_pathHashModeOption0), + ), + DropdownMenuItem( + value: 1, + child: Text(l10n.repeater_pathHashModeOption1), + ), + DropdownMenuItem( + value: 2, + child: Text(l10n.repeater_pathHashModeOption2), + ), + DropdownMenuItem( + value: 3, + child: Text(l10n.repeater_pathHashModeOption3), + ), + ], + onChanged: (value) { + if (value == null) return; + setDialogState(() => selectedMode = value); + }, + ), + const SizedBox(height: 12), + Text( + l10n.repeater_pathHashModeHelper, + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(dialogContext), + child: Text(l10n.common_cancel), + ), + FilledButton( + onPressed: () async { + Navigator.pop(dialogContext); + try { + await connector.setPathHashMode(selectedMode); + await connector.refreshDeviceInfo(); + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(l10n.repeater_settingsSaved), + ); + } catch (e) { + if (!context.mounted) return; + showDismissibleSnackBar( + context, + content: Text(l10n.settings_error(e.toString())), + ); + } + }, + child: Text(l10n.common_save), + ), + ], + ), + ), + ); + } + void _editLocation(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; + final settingsService = context.read(); final latController = TextEditingController(); final lonController = TextEditingController(); final intervalController = TextEditingController(); @@ -763,9 +875,9 @@ class _SettingsScreenState extends State { final bool hasGPS = customVars.containsKey("gps"); bool isGPSEnabled = customVars["gps"] == "1"; - // Read current interval or default to 900 (15 minutes) - final currentInterval = - int.tryParse(customVars["gps_interval"] ?? "") ?? 900; + final currentInterval = settingsService.resolvedGpsIntervalSeconds( + customVars, + ); intervalController.text = currentInterval.toString(); String? intervalError; @@ -863,7 +975,11 @@ class _SettingsScreenState extends State { Navigator.pop(context); if (interval != null) { - await connector.setCustomVar("gps_interval:$interval"); + await settingsService.setGpsIntervalSeconds( + interval, + writeToDevice: (value) => + connector.setCustomVar("gps_interval:$value"), + ); await connector.refreshDeviceInfo(); if (!context.mounted) return; showDismissibleSnackBar( @@ -1163,12 +1279,15 @@ class _SettingsScreenState extends State { void _privacySettings(BuildContext context, MeshCoreConnector connector) { final l10n = context.l10n; + final settingsService = context.read(); int telemetryMode = connector.telemetryModeBase; int telemetryLocMode = connector.telemetryModeLoc; int telemetryEnvMode = connector.telemetryModeEnv; bool advertLocPolicy = connector.advertLocationPolicy == 0 ? false : true; int multiAcks = connector.multiAcks; + bool autoZeroHopAdvertOnGpsUpdate = + settingsService.settings.autoSendZeroHopAdvertOnGpsUpdate; final telemModeBase = [ DropdownMenuItem(value: teleModeDeny, child: Text(l10n.settings_denyAll)), @@ -1203,6 +1322,20 @@ void _privacySettings(BuildContext context, MeshCoreConnector connector) { }, ), const SizedBox(height: 8), + FeatureToggleRow( + title: l10n.settings_autoZeroHopAdvertOnGpsUpdate, + subtitle: l10n.settings_autoZeroHopAdvertOnGpsUpdateSubtitle, + value: autoZeroHopAdvertOnGpsUpdate, + enabled: advertLocPolicy, + onChanged: advertLocPolicy + ? (value) { + setDialogState( + () => autoZeroHopAdvertOnGpsUpdate = value, + ); + } + : null, + ), + const SizedBox(height: 8), SwitchListTile( title: Text(l10n.settings_multiAck), value: multiAcks == 1, @@ -1271,6 +1404,9 @@ void _privacySettings(BuildContext context, MeshCoreConnector connector) { advertLocPolicy ? 1 : 0, multiAcks, ); + await settingsService.setAutoSendZeroHopAdvertOnGpsUpdate( + autoZeroHopAdvertOnGpsUpdate, + ); await connector.refreshDeviceInfo(); if (!context.mounted) return; showDismissibleSnackBar( diff --git a/lib/screens/telemetry_screen.dart b/lib/screens/telemetry_screen.dart index fafa68f2..96a59c75 100644 --- a/lib/screens/telemetry_screen.dart +++ b/lib/screens/telemetry_screen.dart @@ -334,7 +334,7 @@ class _TelemetryScreenState extends State { return Scaffold( appBar: AppBar( title: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ Text( @@ -350,7 +350,7 @@ class _TelemetryScreenState extends State { ), ], ), - centerTitle: false, + centerTitle: true, bottom: const SyncProgressAppBarBottom(), actions: [ IconButton( diff --git a/lib/services/app_settings_service.dart b/lib/services/app_settings_service.dart index 88ff0f47..e695ba99 100644 --- a/lib/services/app_settings_service.dart +++ b/lib/services/app_settings_service.dart @@ -13,6 +13,14 @@ class AppSettingsService extends ChangeNotifier { AppSettings get settings => _settings; + int resolvedGpsIntervalSeconds(Map? deviceCustomVars) { + final deviceValue = int.tryParse(deviceCustomVars?['gps_interval'] ?? ''); + if (deviceValue != null && deviceValue >= 0) { + return deviceValue; + } + return _settings.gpsIntervalSeconds; + } + String batteryChemistryForDevice(String deviceId) { final stored = _settings.batteryChemistryByDeviceId[deviceId]; if (stored == 'liion') return 'nmc'; @@ -112,6 +120,25 @@ class AppSettingsService extends ChangeNotifier { ); } + Future setMapRasterSourceId(String value) async { + await updateSettings(_settings.copyWith(mapRasterSourceId: value)); + } + + Future setMapTileEndpointId(String value) async { + await updateSettings(_settings.copyWith(mapTileEndpointId: value)); + } + + Future setMapTileApiKey(String? value) async { + final normalized = value?.trim(); + await updateSettings( + _settings.copyWith( + mapTileApiKey: (normalized == null || normalized.isEmpty) + ? null + : normalized, + ), + ); + } + Future setNotificationsEnabled(bool value) async { await updateSettings(_settings.copyWith(notificationsEnabled: value)); } @@ -128,6 +155,28 @@ class AppSettingsService extends ChangeNotifier { await updateSettings(_settings.copyWith(notifyOnNewAdvert: value)); } + Future setAutoSendZeroHopAdvertOnGpsUpdate(bool value) async { + await updateSettings( + _settings.copyWith(autoSendZeroHopAdvertOnGpsUpdate: value), + ); + } + + Future setGpsIntervalSeconds( + int value, { + Future Function(int value)? writeToDevice, + }) async { + await updateSettings(_settings.copyWith(gpsIntervalSeconds: value)); + if (writeToDevice == null) return; + try { + await writeToDevice(value); + } catch (e) { + appLogger.warn( + 'Failed to write GPS interval to device: $e', + tag: 'AppSettings', + ); + } + } + Future setAutoRouteRotationEnabled(bool value) async { await updateSettings(_settings.copyWith(autoRouteRotationEnabled: value)); } diff --git a/lib/services/ble_debug_log_service.dart b/lib/services/ble_debug_log_service.dart index df2822bd..d415b5c2 100644 --- a/lib/services/ble_debug_log_service.dart +++ b/lib/services/ble_debug_log_service.dart @@ -176,6 +176,8 @@ class BleDebugLogService extends ChangeNotifier { return 'CMD_SET_CUSTOM_VAR'; case cmdSendTracePath: return 'CMD_SEND_TRACE_PATH'; + case cmdSetFloodScope: + return 'CMD_SET_FLOOD_SCOPE'; default: return null; } diff --git a/lib/services/map_tile_cache_service.dart b/lib/services/map_tile_cache_service.dart index e0d4e573..07584132 100644 --- a/lib/services/map_tile_cache_service.dart +++ b/lib/services/map_tile_cache_service.dart @@ -1,12 +1,232 @@ import 'dart:math' as math; import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter_map/flutter_map.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:flutter_map/flutter_map.dart'; -const String kMapTileUrlTemplate = - 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'; +import '../models/app_settings.dart'; +import 'app_settings_service.dart'; + +enum MapRasterSourcePreset { + osmAuto('osm_auto'), + osmStandard('osm_standard'), + osmDark('osm_dark'), + stamenTerrain('stamen_terrain'), + alidadeSmoothDark('alidade_smooth_dark'), + outdoors('outdoors'), + osmBright('osm_bright'), + outdoorsDark('outdoors_dark'), + osmBrightDark('osm_bright_dark'); + + const MapRasterSourcePreset(this.id); + + final String id; + + static MapRasterSourcePreset fromId(String id) { + for (final value in values) { + if (value.id == id) return value; + } + return MapRasterSourcePreset.osmAuto; + } +} + +enum MapRasterEndpointPreset { + standard('standard'), + standard2x('standard_2x'), + eu('eu'), + eu2x('eu_2x'); + + const MapRasterEndpointPreset(this.id); + + final String id; + + static MapRasterEndpointPreset fromId(String id) { + for (final value in values) { + if (value.id == id) return value; + } + return MapRasterEndpointPreset.standard; + } +} + +@immutable +class MapRasterSourceDefinition { + const MapRasterSourceDefinition({ + required this.id, + required this.label, + required this.description, + this.isStadia = false, + this.allowsBulkDownload = false, + }); + + final String id; + final String label; + final String description; + final bool isStadia; + final bool allowsBulkDownload; +} + +@immutable +class MapRasterEndpointDefinition { + const MapRasterEndpointDefinition({ + required this.id, + required this.label, + required this.description, + required this.host, + this.scaleSuffix = '', + }); + + final String id; + final String label; + final String description; + final String host; + final String scaleSuffix; +} + +class MapRasterSourceCatalog { + static const MapRasterSourceDefinition osmAuto = MapRasterSourceDefinition( + id: 'osm_auto', + label: 'OpenStreetMap Auto', + description: + 'Automatically uses OpenStreetMap Standard or Dark from the app theme', + ); + static const MapRasterSourceDefinition osmStandard = + MapRasterSourceDefinition( + id: 'osm_standard', + label: 'OpenStreetMap Standard', + description: 'Direct tiles from tile.openstreetmap.org', + ); + static const MapRasterSourceDefinition osmDark = MapRasterSourceDefinition( + id: 'osm_dark', + label: 'OpenStreetMap Dark', + description: 'Standard OpenStreetMap tiles with an inverted dark filter', + ); + static const MapRasterSourceDefinition stamenTerrain = + MapRasterSourceDefinition( + id: 'stamen_terrain', + label: 'Stamen Terrain', + description: 'Terrain-focused style with hill shading', + isStadia: true, + allowsBulkDownload: true, + ); + static const MapRasterSourceDefinition alidadeSmoothDark = + MapRasterSourceDefinition( + id: 'alidade_smooth_dark', + label: 'Alidade Smooth Dark', + description: 'Dark basemap with smooth contrast', + isStadia: true, + allowsBulkDownload: true, + ); + static const MapRasterSourceDefinition outdoors = MapRasterSourceDefinition( + id: 'outdoors', + label: 'Outdoors', + description: 'Outdoor-focused map with trails and terrain context', + isStadia: true, + allowsBulkDownload: true, + ); + static const MapRasterSourceDefinition osmBright = MapRasterSourceDefinition( + id: 'osm_bright', + label: 'OSM Bright', + description: 'Bright general-purpose OpenStreetMap style', + isStadia: true, + allowsBulkDownload: true, + ); + static const MapRasterSourceDefinition outdoorsDark = + MapRasterSourceDefinition( + id: 'outdoors', + label: 'Outdoors Dark', + description: 'Dark version of the Outdoors map style', + isStadia: true, + allowsBulkDownload: true, + ); + static const MapRasterSourceDefinition osmBrightDark = + MapRasterSourceDefinition( + id: 'osm_bright', + label: 'OSM Bright Dark', + description: 'Dark version of the OSM Bright map style', + isStadia: true, + allowsBulkDownload: true, + ); + + static MapRasterSourceDefinition fromPreset(MapRasterSourcePreset preset) { + switch (preset) { + case MapRasterSourcePreset.osmAuto: + return osmAuto; + case MapRasterSourcePreset.osmStandard: + return osmStandard; + case MapRasterSourcePreset.osmDark: + return osmDark; + case MapRasterSourcePreset.alidadeSmoothDark: + return alidadeSmoothDark; + case MapRasterSourcePreset.outdoors: + return outdoors; + case MapRasterSourcePreset.outdoorsDark: + return outdoorsDark; + case MapRasterSourcePreset.osmBright: + return osmBright; + case MapRasterSourcePreset.osmBrightDark: + return osmBrightDark; + case MapRasterSourcePreset.stamenTerrain: + return stamenTerrain; + } + } + + static MapRasterSourceDefinition fromSettings(AppSettings settings) { + return fromPreset(MapRasterSourcePreset.fromId(settings.mapRasterSourceId)); + } +} + +class MapRasterEndpointCatalog { + static const MapRasterEndpointDefinition standard = + MapRasterEndpointDefinition( + id: 'standard', + label: 'Standard Endpoint', + description: 'Global CDN routing to the fastest Stadia server', + host: 'tiles.stadiamaps.com', + ); + static const MapRasterEndpointDefinition standard2x = + MapRasterEndpointDefinition( + id: 'standard_2x', + label: 'Standard Endpoint (@2x)', + description: 'Global Stadia endpoint with HiDPI raster tiles', + host: 'tiles.stadiamaps.com', + scaleSuffix: '@2x', + ); + static const MapRasterEndpointDefinition eu = MapRasterEndpointDefinition( + id: 'eu', + label: 'EU Endpoint', + description: 'Route tile requests to Stadia EU servers', + host: 'tiles-eu.stadiamaps.com', + ); + static const MapRasterEndpointDefinition eu2x = MapRasterEndpointDefinition( + id: 'eu_2x', + label: 'EU Endpoint (@2x)', + description: 'EU Stadia endpoint with HiDPI raster tiles', + host: 'tiles-eu.stadiamaps.com', + scaleSuffix: '@2x', + ); + + static const List presets = [ + standard, + standard2x, + eu, + eu2x, + ]; + + static MapRasterEndpointDefinition fromSettings(AppSettings settings) { + final preset = MapRasterEndpointPreset.fromId(settings.mapTileEndpointId); + switch (preset) { + case MapRasterEndpointPreset.standard2x: + return standard2x; + case MapRasterEndpointPreset.eu: + return eu; + case MapRasterEndpointPreset.eu2x: + return eu2x; + case MapRasterEndpointPreset.standard: + return standard; + } + } +} class MapTileCacheProgress { final int completed; @@ -32,36 +252,253 @@ class MapTileCacheResult { }); } -class MapTileCacheService { +class CachedTileInfo { + final String key; + final String host; + final String sourceId; + final int zoom; + final int x; + final int y; + final int length; + + const CachedTileInfo({ + required this.key, + required this.host, + required this.sourceId, + required this.zoom, + required this.x, + required this.y, + required this.length, + }); +} + +class CachedTileInventory { + final List tiles; + final int totalBytes; + + const CachedTileInventory({required this.tiles, required this.totalBytes}); +} + +class MapTileCacheService extends ChangeNotifier { static const String cacheKey = 'map_tile_cache'; static const String userAgentPackageName = 'com.meshcore.open'; static const int defaultMinZoom = 10; static const int defaultMaxZoom = 15; + final AppSettingsService appSettingsService; final BaseCacheManager cacheManager; late final TileProvider tileProvider; - MapTileCacheService({BaseCacheManager? cacheManager}) - : cacheManager = - cacheManager ?? - CacheManager( - Config( - cacheKey, - stalePeriod: const Duration(days: 365), - maxNrOfCacheObjects: 200000, - ), - ) { + MapTileCacheService({ + required this.appSettingsService, + BaseCacheManager? cacheManager, + }) : cacheManager = + cacheManager ?? + CacheManager( + Config( + cacheKey, + stalePeriod: const Duration(days: 365), + maxNrOfCacheObjects: 200000, + ), + ) { tileProvider = CachedNetworkTileProvider(cacheManager: this.cacheManager); + appSettingsService.addListener(_handleSettingsChanged); } + MapRasterSourceDefinition get source { + final selectedSource = MapRasterSourceCatalog.fromSettings( + appSettingsService.settings, + ); + if (!selectedSource.allowsBulkDownload || + !appSettingsService.settings.usesstadiaDemo) { + return selectedSource; + } + return MapRasterSourceDefinition( + id: selectedSource.id, + label: selectedSource.label, + description: selectedSource.description, + isStadia: selectedSource.isStadia, + allowsBulkDownload: false, // Explicitly disable bulk download for demo. + ); + } + + MapRasterEndpointDefinition get endpoint => + MapRasterEndpointCatalog.fromSettings(appSettingsService.settings); + + String get urlTemplate => _buildUrlTemplate(appSettingsService.settings); + + TileBuilder? get tileBuilder => null; + + static bool shouldApplyDarkFilterForSettings( + AppSettings settings, + Brightness brightness, + ) { + switch (MapRasterSourcePreset.fromId(settings.mapRasterSourceId)) { + case MapRasterSourcePreset.osmDark: + case MapRasterSourcePreset.outdoorsDark: + case MapRasterSourcePreset.osmBrightDark: + return true; + case MapRasterSourcePreset.osmAuto: + return brightness == Brightness.dark; + case MapRasterSourcePreset.osmStandard: + case MapRasterSourcePreset.stamenTerrain: + case MapRasterSourcePreset.alidadeSmoothDark: + case MapRasterSourcePreset.outdoors: + case MapRasterSourcePreset.osmBright: + return false; + } + } + + 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, + ]); + + CacheManager get _concreteCacheManager => cacheManager as CacheManager; + Map get defaultHeaders => { 'User-Agent': 'flutter_map ($userAgentPackageName)', }; + Widget buildTileLayer(BuildContext context, {double opacity = 1}) { + Widget layer = TileLayer( + urlTemplate: urlTemplate, + tileProvider: tileProvider, + tileBuilder: tileBuilder, + userAgentPackageName: userAgentPackageName, + maxZoom: 19, + ); + + final shouldApplyDarkFilter = shouldApplyDarkFilterForSettings( + appSettingsService.settings, + Theme.of(context).brightness, + ); + + if (shouldApplyDarkFilter) { + layer = ColorFiltered(colorFilter: _darkMapFilter, child: layer); + } + + if (opacity < 1) { + layer = Opacity(opacity: opacity, child: layer); + } + + return layer; + } + Future clearCache() async { await cacheManager.emptyCache(); } + Future getCachedTileInventory() async { + final repo = _concreteCacheManager.config.repo; + await repo.open(); + final objects = await repo.getAllObjects(); + final tiles = []; + int totalBytes = 0; + + for (final object in objects) { + totalBytes += object.length ?? 0; + final tile = _parseCachedTile(object); + if (tile != null) { + tiles.add(tile); + } + } + + return CachedTileInventory(tiles: tiles, totalBytes: totalBytes); + } + + List filterTilesForActiveSource( + Iterable tiles, + ) { + final activeSource = source; + if (!activeSource.isStadia) { + return tiles + .where( + (tile) => + tile.sourceId == MapRasterSourceCatalog.osmStandard.id && + tile.host == 'tile.openstreetmap.org', + ) + .toList(); + } + + final activeEndpoint = endpoint; + return tiles + .where( + (tile) => + tile.sourceId == activeSource.id && + tile.host == activeEndpoint.host, + ) + .toList(); + } + + int countTilesForBounds( + Iterable tiles, { + LatLngBounds? bounds, + required int minZoom, + required int maxZoom, + }) { + if (bounds == null) return 0; + final safeMin = math.min(minZoom, maxZoom); + final safeMax = math.max(minZoom, maxZoom); + return tiles.where((tile) { + if (tile.zoom < safeMin || tile.zoom > safeMax) { + return false; + } + final tileBounds = _tileBoundsForTile(tile.x, tile.y, tile.zoom); + return _boundsIntersect(bounds, tileBounds); + }).length; + } + + List buildCachedTilePolygons( + Iterable tiles, { + required int zoom, + LatLngBounds? visibleBounds, + int limit = 250, + }) { + final polygons = []; + for (final tile in tiles) { + if (tile.zoom != zoom) continue; + final tileBounds = _tileBoundsForTile(tile.x, tile.y, tile.zoom); + if (visibleBounds != null && + !_boundsIntersect(visibleBounds, tileBounds)) { + continue; + } + polygons.add( + Polygon( + points: [ + tileBounds.northWest, + tileBounds.northEast, + tileBounds.southEast, + tileBounds.southWest, + ], + borderStrokeWidth: 0.6, + color: const Color(0x5532A852), + borderColor: const Color(0xCC2F8F46), + ), + ); + if (polygons.length >= limit) break; + } + return polygons; + } + int estimateTileCount(LatLngBounds bounds, int minZoom, int maxZoom) { final safeMin = math.min(minZoom, maxZoom); final safeMax = math.max(minZoom, maxZoom); @@ -89,6 +526,7 @@ class MapTileCacheService { final total = estimateTileCount(bounds, safeMin, safeMax); final authHeaders = headers ?? defaultHeaders; final safeConcurrency = math.max(1, concurrentDownloads); + final currentTemplate = urlTemplate; int completed = 0; int failed = 0; @@ -124,7 +562,7 @@ class MapTileCacheService { final tileBounds = _tileBoundsForBounds(bounds, zoom); for (int x = tileBounds.minX; x <= tileBounds.maxX; x++) { for (int y = tileBounds.minY; y <= tileBounds.maxY; y++) { - final url = _buildTileUrl(x, y, zoom); + final url = _buildTileUrl(x, y, zoom, urlTemplate: currentTemplate); await queueDownload(url); } } @@ -167,6 +605,16 @@ class MapTileCacheService { ); } + void _handleSettingsChanged() { + notifyListeners(); + } + + @override + void dispose() { + appSettingsService.removeListener(_handleSettingsChanged); + super.dispose(); + } + _TileBounds _tileBoundsForBounds(LatLngBounds bounds, int zoom) { final north = _clampLatitude(bounds.north); final south = _clampLatitude(bounds.south); @@ -185,6 +633,56 @@ class MapTileCacheService { ); } + String _buildUrlTemplate(AppSettings settings) { + final source = MapRasterSourceCatalog.fromSettings(settings); + if (!source.isStadia) { + return 'https://tile.openstreetmap.org/{z}/{x}/{y}.png'; + } + final endpoint = MapRasterEndpointCatalog.fromSettings(settings); + final apiKey = settings.effectiveMapTileApiKey; + final base = + 'https://${endpoint.host}/tiles/${source.id}/{z}/{x}/{y}${endpoint.scaleSuffix}.png'; + final query = Uri(queryParameters: {'api_key': apiKey}).query; + return '$base?$query'; + } + + CachedTileInfo? _parseCachedTile(CacheObject object) { + final uri = Uri.tryParse(object.key); + if (uri == null) return null; + final segments = uri.pathSegments; + + if (segments.length >= 3 && + segments[segments.length - 3].isNotEmpty && + segments[segments.length - 2].isNotEmpty) { + final zoom = int.tryParse(segments[segments.length - 3]); + final x = int.tryParse(segments[segments.length - 2]); + final ySegment = segments.last; + final yString = ySegment.split('.').first.replaceAll('@2x', ''); + final y = int.tryParse(yString); + + if (zoom == null || x == null || y == null) { + return null; + } + + var sourceId = MapRasterSourceCatalog.osmStandard.id; + if (segments.length >= 5 && segments[0] == 'tiles') { + sourceId = segments[1]; + } + + return CachedTileInfo( + key: object.key, + host: uri.host, + sourceId: sourceId, + zoom: zoom, + x: x, + y: y, + length: object.length ?? 0, + ); + } + + return null; + } + int _lonToTileX(double lon, int zoom, int maxIndex) { final n = 1 << zoom; final value = ((lon + 180.0) / 360.0 * n).floor(); @@ -205,8 +703,34 @@ class MapTileCacheService { return lat.clamp(-maxLat, maxLat); } - String _buildTileUrl(int x, int y, int zoom) { - return kMapTileUrlTemplate + LatLngBounds _tileBoundsForTile(int x, int y, int zoom) { + return LatLngBounds.unsafe( + north: _tileYToLat(y, zoom), + south: _tileYToLat(y + 1, zoom), + east: _tileXToLon(x + 1, zoom), + west: _tileXToLon(x, zoom), + ); + } + + double _tileXToLon(int x, int zoom) { + final n = 1 << zoom; + return x / n * 360.0 - 180.0; + } + + double _tileYToLat(int y, int zoom) { + final n = math.pi - (2.0 * math.pi * y) / (1 << zoom); + return 180.0 / math.pi * math.atan(0.5 * (math.exp(n) - math.exp(-n))); + } + + bool _boundsIntersect(LatLngBounds a, LatLngBounds b) { + return a.west <= b.east && + a.east >= b.west && + a.south <= b.north && + a.north >= b.south; + } + + String _buildTileUrl(int x, int y, int zoom, {required String urlTemplate}) { + return urlTemplate .replaceAll('{z}', zoom.toString()) .replaceAll('{x}', x.toString()) .replaceAll('{y}', y.toString()); diff --git a/lib/services/notification_service.dart b/lib/services/notification_service.dart index b148c95d..05ebf6b0 100644 --- a/lib/services/notification_service.dart +++ b/lib/services/notification_service.dart @@ -27,6 +27,11 @@ class NotificationService { AppLocalizations get _l10n => lookupAppLocalizations(_locale); + String _logSafe(String value) { + final sanitized = value.replaceAll(RegExp(r'[\x00-\x1F\x7F]'), ' '); + return Uri.encodeComponent(sanitized); + } + // Rate limiting to prevent notification storms // (Added after getting notification-flooded while evaluating RF flood management. The irony.) static const _minNotificationInterval = Duration(seconds: 3); @@ -356,11 +361,11 @@ class NotificationService { String _getNotificationIdentifier(_PendingNotification n) { switch (n.type) { case _NotificationType.advert: - return n.body; + return _logSafe(n.body); case _NotificationType.message: - return 'from: ${n.title}'; + return 'from: ${_logSafe(n.title)}'; case _NotificationType.channelMessage: - return 'in: ${n.title}'; + return 'in: ${_logSafe(n.title)}'; } } @@ -606,7 +611,7 @@ class NotificationService { // Show first few device names in batch summary for debugging (only if adverts exist) final deviceInfo = adverts.isNotEmpty - ? ' (${adverts.take(5).map((n) => n.body).join(', ')}${adverts.length > 5 ? ', ...' : ''})' + ? ' (${adverts.take(5).map((n) => _logSafe(n.body)).join(', ')}${adverts.length > 5 ? ', ...' : ''})' : ''; debugPrint('[Notification] batch summary: ${parts.join(", ")}$deviceInfo'); diff --git a/lib/storage/channel_message_store.dart b/lib/storage/channel_message_store.dart index 5a0fbd8f..f16081a6 100644 --- a/lib/storage/channel_message_store.dart +++ b/lib/storage/channel_message_store.dart @@ -110,6 +110,7 @@ class ChannelMessageStore { 'channelIndex': msg.channelIndex, 'repeatCount': msg.repeatCount, 'pathLength': msg.pathLength, + 'pathHashWidth': msg.pathHashWidth, 'pathBytes': base64Encode(msg.pathBytes), 'pathVariants': msg.pathVariants.map(base64Encode).toList(), 'repeats': msg.repeats.map(_repeatToJson).toList(), @@ -126,6 +127,38 @@ class ChannelMessageStore { ChannelMessage _messageFromJson(Map json) { final rawText = json['text'] as String; final decodedText = Smaz.tryDecodePrefixed(rawText) ?? rawText; + + final rawPathLength = json['pathLength'] as int?; + final rawPathBytes = json['pathBytes'] != null + ? Uint8List.fromList(base64Decode(json['pathBytes'] as String)) + : Uint8List(0); + final rawPathHashWidth = json['pathHashWidth'] as int?; + + int? decodedPathLength = rawPathLength; + Uint8List decodedPathBytes = rawPathBytes; + int? decodedPathHashWidth = rawPathHashWidth; + + if (rawPathLength != null) { + if (rawPathLength == 0xFF || rawPathLength < 0) { + decodedPathLength = -1; + decodedPathBytes = Uint8List(0); + } else if (rawPathLength >= 64) { + final mode = (rawPathLength & 0xC0) >> 6; + final hopCount = rawPathLength & 0x3F; + final width = mode + 1; + final byteLen = hopCount * width; + decodedPathLength = hopCount; + decodedPathHashWidth = width; + if (byteLen <= rawPathBytes.length) { + decodedPathBytes = rawPathBytes.sublist(0, byteLen); + } else { + decodedPathBytes = Uint8List(0); + } + } else if (rawPathLength == 0) { + decodedPathBytes = Uint8List(0); + } + } + return ChannelMessage( senderKey: json['senderKey'] != null ? Uint8List.fromList(base64Decode(json['senderKey'])) @@ -143,10 +176,9 @@ class ChannelMessageStore { isOutgoing: json['isOutgoing'] as bool, status: ChannelMessageStatus.values[json['status'] as int], repeatCount: (json['repeatCount'] as int?) ?? 0, - pathLength: json['pathLength'] as int?, - pathBytes: json['pathBytes'] != null - ? Uint8List.fromList(base64Decode(json['pathBytes'] as String)) - : Uint8List(0), + pathLength: decodedPathLength, + pathHashWidth: decodedPathHashWidth, + pathBytes: decodedPathBytes, pathVariants: (json['pathVariants'] as List?) ?.map((entry) => Uint8List.fromList(base64Decode(entry as String))) .toList(), diff --git a/lib/storage/channel_region_store.dart b/lib/storage/channel_region_store.dart new file mode 100644 index 00000000..e28551a7 --- /dev/null +++ b/lib/storage/channel_region_store.dart @@ -0,0 +1,39 @@ +import '../utils/app_logger.dart'; +import 'prefs_manager.dart'; + +class ChannelRegionStore { + static const String _keyPrefix = 'channel_region_'; + + String publicKeyHex = ''; + set setPublicKeyHex(String value) => + publicKeyHex = value.length >= 10 ? value.substring(0, 10) : ''; + + String get keyFor => '$_keyPrefix$publicKeyHex'; + + Future loadRegion(int channelIndex) async { + if (publicKeyHex.isEmpty) { + appLogger.warn( + 'Public key hex is not set. Cannot load channel settings.', + ); + return ''; + } + final prefs = PrefsManager.instance; + final key = '$keyFor$channelIndex'; + String? region = prefs.getString(key); + return region ?? ''; + } + + Future saveRegion(int channelIndex, String region) async { + if (publicKeyHex.isEmpty) { + appLogger.warn( + 'Public key hex is not set. Cannot save channel settings.', + ); + return ''; + } + + final prefs = PrefsManager.instance; + final key = '$keyFor$channelIndex'; + await prefs.setString(key, region); + return region; + } +} diff --git a/lib/storage/contact_discovery_store.dart b/lib/storage/contact_discovery_store.dart index 40b7ba90..0f57c690 100644 --- a/lib/storage/contact_discovery_store.dart +++ b/lib/storage/contact_discovery_store.dart @@ -105,15 +105,40 @@ class ContactDiscoveryStore { final lastSeenMs = json['lastSeen'] as int? ?? 0; final lastMessageMs = json['lastMessageAt'] as int?; final lastModifiedMs = json['lastModified'] as int?; + + final rawPathLength = json['pathLength'] as int? ?? -1; + final rawPath = json['path'] != null + ? Uint8List.fromList(base64Decode(json['path'] as String)) + : Uint8List(0); + + int decodedPathLength = rawPathLength; + Uint8List decodedPath = rawPath; + + if (rawPathLength == 0xFF || rawPathLength < 0) { + decodedPathLength = -1; + decodedPath = Uint8List(0); + } else if (rawPathLength >= 64) { + final mode = (rawPathLength & 0xC0) >> 6; + final hopCount = rawPathLength & 0x3F; + final width = mode + 1; + final byteLen = hopCount * width; + decodedPathLength = hopCount; + if (byteLen <= rawPath.length) { + decodedPath = rawPath.sublist(0, byteLen); + } else { + decodedPath = Uint8List(0); + } + } else if (rawPathLength == 0) { + decodedPath = Uint8List(0); + } + return Contact( publicKey: Uint8List.fromList(base64Decode(json['publicKey'] as String)), name: json['name'] as String? ?? 'Unknown', type: json['type'] as int? ?? 0, flags: json['flags'] as int? ?? 0, - pathLength: json['pathLength'] as int? ?? -1, - path: json['path'] != null - ? Uint8List.fromList(base64Decode(json['path'] as String)) - : Uint8List(0), + pathLength: decodedPathLength, + path: decodedPath, pathOverride: json['pathOverride'] as int?, pathOverrideBytes: json['pathOverrideBytes'] != null ? Uint8List.fromList( diff --git a/lib/storage/contact_store.dart b/lib/storage/contact_store.dart index 7883d885..fa4152d2 100644 --- a/lib/storage/contact_store.dart +++ b/lib/storage/contact_store.dart @@ -88,15 +88,40 @@ class ContactStore { final lastSeenMs = json['lastSeen'] as int? ?? 0; final lastMessageMs = json['lastMessageAt'] as int?; final lastModifiedMs = json['lastModified'] as int?; + + final rawPathLength = json['pathLength'] as int? ?? -1; + final rawPath = json['path'] != null + ? Uint8List.fromList(base64Decode(json['path'] as String)) + : Uint8List(0); + + int decodedPathLength = rawPathLength; + Uint8List decodedPath = rawPath; + + if (rawPathLength == 0xFF || rawPathLength < 0) { + decodedPathLength = -1; + decodedPath = Uint8List(0); + } else if (rawPathLength >= 64) { + final mode = (rawPathLength & 0xC0) >> 6; + final hopCount = rawPathLength & 0x3F; + final width = mode + 1; + final byteLen = hopCount * width; + decodedPathLength = hopCount; + if (byteLen <= rawPath.length) { + decodedPath = rawPath.sublist(0, byteLen); + } else { + decodedPath = Uint8List(0); + } + } else if (rawPathLength == 0) { + decodedPath = Uint8List(0); + } + return Contact( publicKey: Uint8List.fromList(base64Decode(json['publicKey'] as String)), name: json['name'] as String? ?? 'Unknown', type: json['type'] as int? ?? 0, flags: json['flags'] as int? ?? 0, - pathLength: json['pathLength'] as int? ?? -1, - path: json['path'] != null - ? Uint8List.fromList(base64Decode(json['path'] as String)) - : Uint8List(0), + pathLength: decodedPathLength, + path: decodedPath, pathOverride: json['pathOverride'] as int?, pathOverrideBytes: json['pathOverrideBytes'] != null ? Uint8List.fromList( diff --git a/lib/storage/message_store.dart b/lib/storage/message_store.dart index 3d237681..96aaba9c 100644 --- a/lib/storage/message_store.dart +++ b/lib/storage/message_store.dart @@ -113,6 +113,35 @@ class MessageStore { final decodedText = isCli ? rawText : (Smaz.tryDecodePrefixed(rawText) ?? rawText); + + final rawPathLength = json['pathLength'] as int?; + final rawPathBytes = json['pathBytes'] != null + ? Uint8List.fromList(base64Decode(json['pathBytes'] as String)) + : Uint8List(0); + + int? decodedPathLength = rawPathLength; + Uint8List decodedPathBytes = rawPathBytes; + + if (rawPathLength != null) { + if (rawPathLength == 0xFF || rawPathLength < 0) { + decodedPathLength = -1; + decodedPathBytes = Uint8List(0); + } else if (rawPathLength >= 64) { + final mode = (rawPathLength & 0xC0) >> 6; + final hopCount = rawPathLength & 0x3F; + final width = mode + 1; + final byteLen = hopCount * width; + decodedPathLength = hopCount; + if (byteLen <= rawPathBytes.length) { + decodedPathBytes = rawPathBytes.sublist(0, byteLen); + } else { + decodedPathBytes = Uint8List(0); + } + } else if (rawPathLength == 0) { + decodedPathBytes = Uint8List(0); + } + } + return Message( senderKey: Uint8List.fromList(base64Decode(json['senderKey'] as String)), text: decodedText, @@ -138,10 +167,8 @@ class MessageStore { ? DateTime.fromMillisecondsSinceEpoch(json['deliveredAt'] as int) : null, tripTimeMs: json['tripTimeMs'] as int?, - pathLength: json['pathLength'] as int?, - pathBytes: json['pathBytes'] != null - ? Uint8List.fromList(base64Decode(json['pathBytes'] as String)) - : Uint8List(0), + pathLength: decodedPathLength, + pathBytes: decodedPathBytes, reactions: (json['reactions'] as Map?)?.map( (key, value) => MapEntry(key, value as int), diff --git a/lib/storage/region_store.dart b/lib/storage/region_store.dart new file mode 100644 index 00000000..af532da9 --- /dev/null +++ b/lib/storage/region_store.dart @@ -0,0 +1,53 @@ +import 'package:meshcore_open/storage/channel_region_store.dart'; +import 'package:meshcore_open/storage/channel_store.dart'; + +import 'prefs_manager.dart'; + +typedef Region = String; + +class RegionStore { + static const String key = 'regions'; + String publicKeyHex = ''; + set setPublicKeyHex(String value) => + publicKeyHex = value.length >= 10 ? value.substring(0, 10) : ''; + + List loadRegions() { + final prefs = PrefsManager.instance; + List? region = prefs.getStringList(key); + return region ?? []; + } + + void saveRegions(List regions) { + final prefs = PrefsManager.instance; + + var distinctRegions = [ + ...{...regions}, + ]; + + distinctRegions.sort(); + prefs.setStringList(key, distinctRegions); + } + + void addRegion(Region region) { + final regions = loadRegions(); + regions.add(region); + saveRegions(regions); + } + + Future removeRegion(Region region) async { + final regions = loadRegions(); + final channelStore = ChannelStore(); + final channelRegionStore = ChannelRegionStore(); + channelStore.setPublicKeyHex = publicKeyHex; + channelRegionStore.setPublicKeyHex = publicKeyHex; + + for (var channel in await channelStore.loadChannels()) { + var channelRegion = await channelRegionStore.loadRegion(channel.index); + if (channelRegion == region) { + await channelRegionStore.saveRegion(channel.index, ''); + } + } + regions.remove(region); + saveRegions(regions); + } +} diff --git a/lib/theme/mesh_theme.dart b/lib/theme/mesh_theme.dart index 883ea2a2..281b1145 100644 --- a/lib/theme/mesh_theme.dart +++ b/lib/theme/mesh_theme.dart @@ -11,16 +11,16 @@ class MeshPalette { static const bg3 = Color(0xFF1E293B); static const bg4 = Color(0xFF334155); - // Lines - static const line = Color(0xFF1E293B); - static const line2 = Color(0xFF334155); - static const line3 = Color(0xFF475569); + // Lines — lifted for clearer element separation on the near-black surface + static const line = Color(0xFF2A3850); + static const line2 = Color(0xFF3B4A61); + static const line3 = Color(0xFF546376); - // Ink + // Ink — muted tones brightened for readable secondary/tertiary text in dark static const ink = Color(0xFFF8FAFC); - static const ink2 = Color(0xFFCBD5E1); - static const ink3 = Color(0xFF94A3B8); - static const ink4 = Color(0xFF64748B); + static const ink2 = Color(0xFFD5DEE9); + static const ink3 = Color(0xFFAAB6C6); + static const ink4 = Color(0xFF828FA3); // Signal-quality green (used only for SNR coloring, not UI chrome) static const signal = Color(0xFF22C55E); @@ -394,9 +394,9 @@ class MeshTheme { labelTextStyle: WidgetStateProperty.resolveWith((states) { final selected = states.contains(WidgetState.selected); return TextStyle( - fontFamily: MeshFonts.mono, - fontFamilyFallback: MeshFonts.monoFallback, - fontSize: 10, + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: 11.5, fontWeight: selected ? FontWeight.w700 : FontWeight.w500, letterSpacing: 0.1, color: selected ? scheme.onPrimary : scheme.onSurfaceVariant, @@ -582,14 +582,15 @@ class MeshTheme { ); } - /// Small-caps mono label — used for section accents and chip labels. + /// Section-accent / chip label — sans for legibility, with light tracking + /// to keep the "label" feel that section headers rely on. static TextStyle accentLabel({Color? color, double? fontSize}) { return TextStyle( - fontFamily: MeshFonts.mono, - fontFamilyFallback: MeshFonts.monoFallback, - fontSize: fontSize ?? 9.5, - fontWeight: FontWeight.w600, - letterSpacing: 1.8, + fontFamily: MeshFonts.sans, + fontFamilyFallback: MeshFonts.sansFallback, + fontSize: fontSize ?? 11, + fontWeight: FontWeight.w700, + letterSpacing: 0.6, color: color, ); } diff --git a/lib/utils/keys.dart b/lib/utils/keys.dart new file mode 100644 index 00000000..488223f7 --- /dev/null +++ b/lib/utils/keys.dart @@ -0,0 +1,87 @@ +import 'dart:async'; +import 'dart:math'; +import 'dart:typed_data'; +import 'package:convert/convert.dart'; +import 'package:cryptography/cryptography.dart'; + +Uint8List randomBytes(int length) { + final random = Random.secure(); + final bytes = Uint8List(length); + for (int i = 0; i < length; i++) { + bytes[i] = random.nextInt(256); + } + return bytes; +} + +class MCKeyPair { + final Uint8List public; + final Uint8List private; + MCKeyPair(this.public, this.private); +} + +Future generateKeyPair() async { + final algo = Ed25519(); + final seed = randomBytes(32); + final SimpleKeyPair keys = await algo.newKeyPairFromSeed(seed); + final Uint8List pubKeyBytes = Uint8List.fromList( + (await keys.extractPublicKey()).bytes, + ); + // Ed25519 gives 32-byte public and private keys, but MeshCore + // uses an expanded 64-byte private key, so we have to make it + // ourselves. Luckily, we can do it such that it has the same public + // key, which we'd otherwise be unable to compute, since although the + // crypto library implements the elliptic curve computations we need, + // it doesn't make them available. + final Uint8List hash = Uint8List.fromList((await Sha512().hash(seed)).bytes); + hash[0] &= 248; // Clamp the scalar. This keeps the chosen point in the + hash[31] &= 63; // large elliptic curve subgroup, and is demanded both by + hash[31] |= 64; // Ed25519 and by the MeshCore repeater key validation code. + return MCKeyPair(pubKeyBytes, hash); +} + +class _KeyHashPrefix { + Uint8List _bytes = Uint8List(0); + Uint8List _mask = Uint8List(0); + _KeyHashPrefix(String prefix) { + final bool lengthIsOdd = (prefix.length % 2 == 1) ? true : false; + final String decodableString = lengthIsOdd ? "${prefix}0" : prefix; + _bytes = hex.decoder.convert(decodableString); + _mask = Uint8List(_bytes.length); + for (var i = 0; i < _mask.length; i++) { + _mask[i] = 0xff; + } + if (lengthIsOdd) { + _mask[_mask.length - 1] = 0xf0; + } + } + + bool matches(List keyBytes) { + if (keyBytes.length < _bytes.length) { + return false; + } + for (var i = 0; i < _bytes.length; i++) { + if (keyBytes[i] & _mask[i] != _bytes[i]) { + return false; + } + } + return true; + } +} + +class KeyPairSearcher { + Future findMatchingKeyPair( + String prefixStr, + int maxMilliseconds, + ) async { + final int now = DateTime.now().millisecondsSinceEpoch; + final int endTime = now + maxMilliseconds; + final _KeyHashPrefix keyHashPrefix = _KeyHashPrefix(prefixStr); + while (DateTime.now().millisecondsSinceEpoch < endTime) { + final MCKeyPair keys = await generateKeyPair(); + if (keyHashPrefix.matches(keys.public)) { + return keys; + } + } + return null; + } +} diff --git a/lib/utils/route_transitions.dart b/lib/utils/route_transitions.dart index 7de5a9c5..2d68bbdf 100644 --- a/lib/utils/route_transitions.dart +++ b/lib/utils/route_transitions.dart @@ -6,20 +6,15 @@ Route buildQuickSwitchRoute(Widget page) { transitionDuration: const Duration(milliseconds: 220), reverseTransitionDuration: const Duration(milliseconds: 200), transitionsBuilder: (context, animation, secondaryAnimation, child) { - final curved = CurvedAnimation( - parent: animation, - curve: Curves.easeOutCubic, - reverseCurve: Curves.easeInCubic, - ); + // Pure crossfade — no positional slide, so the shared top chrome + // (app bar + Contacts/Channels toggle) stays rock-steady while switching. return FadeTransition( - opacity: curved, - child: SlideTransition( - position: Tween( - begin: const Offset(0.02, 0), - end: Offset.zero, - ).animate(curved), - child: child, + opacity: CurvedAnimation( + parent: animation, + curve: Curves.easeOut, + reverseCurve: Curves.easeIn, ), + child: child, ); }, ); diff --git a/lib/widgets/elements_ui.dart b/lib/widgets/elements_ui.dart index a4995c73..f77b90a6 100644 --- a/lib/widgets/elements_ui.dart +++ b/lib/widgets/elements_ui.dart @@ -4,6 +4,7 @@ class FeatureToggleRow extends StatefulWidget { final String title; final String subtitle; final bool value; + final bool enabled; final bool hasRefreshing; final bool isRefreshing; final ValueChanged? onChanged; @@ -15,6 +16,7 @@ class FeatureToggleRow extends StatefulWidget { required this.title, required this.subtitle, required this.value, + this.enabled = true, this.hasRefreshing = false, this.isRefreshing = false, this.onChanged, @@ -31,6 +33,13 @@ class _FeatureToggleRow extends State { Widget build(BuildContext context) { final scheme = Theme.of(context).colorScheme; final textTheme = Theme.of(context).textTheme; + final isEnabled = widget.enabled; + final titleColor = isEnabled + ? scheme.onSurface + : scheme.onSurfaceVariant.withValues(alpha: 0.7); + final subtitleColor = isEnabled + ? scheme.onSurfaceVariant + : scheme.onSurfaceVariant.withValues(alpha: 0.55); return Padding( padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), @@ -44,14 +53,13 @@ class _FeatureToggleRow extends State { widget.title, style: textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, + color: titleColor, ), ), const SizedBox(height: 2), Text( widget.subtitle, - style: textTheme.bodySmall?.copyWith( - color: scheme.onSurfaceVariant, - ), + style: textTheme.bodySmall?.copyWith(color: subtitleColor), ), ], ), @@ -60,7 +68,18 @@ class _FeatureToggleRow extends State { Row( mainAxisSize: MainAxisSize.min, children: [ - Switch(value: widget.value, onChanged: widget.onChanged), + Switch( + value: widget.value, + onChanged: isEnabled ? widget.onChanged : null, + thumbColor: !isEnabled + ? WidgetStatePropertyAll(scheme.onSurfaceVariant) + : null, + trackColor: !isEnabled + ? WidgetStatePropertyAll( + scheme.onSurfaceVariant.withValues(alpha: 0.35), + ) + : null, + ), if (widget.hasRefreshing) ...[ const SizedBox(width: 4), widget.isRefreshing @@ -74,7 +93,7 @@ class _FeatureToggleRow extends State { ) : IconButton( icon: const Icon(Icons.refresh, size: 18), - onPressed: widget.onRefresh, + onPressed: isEnabled ? widget.onRefresh : null, tooltip: widget.refreshTooltip, visualDensity: VisualDensity.compact, padding: EdgeInsets.zero, diff --git a/lib/widgets/mesh_ui.dart b/lib/widgets/mesh_ui.dart index 797af7a7..cb4698bb 100644 --- a/lib/widgets/mesh_ui.dart +++ b/lib/widgets/mesh_ui.dart @@ -50,6 +50,7 @@ class MeshCard extends StatelessWidget { final Widget child; final VoidCallback? onTap; final VoidCallback? onLongPress; + final VoidCallback? onSecondaryTap; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry margin; final Color? color; @@ -61,6 +62,7 @@ class MeshCard extends StatelessWidget { required this.child, this.onTap, this.onLongPress, + this.onSecondaryTap, this.padding = const EdgeInsets.all(14), this.margin = const EdgeInsets.symmetric(horizontal: 16, vertical: 4), this.color, @@ -89,6 +91,7 @@ class MeshCard extends StatelessWidget { HapticFeedback.selectionClick(); onLongPress!(); }, + onSecondaryTap: onSecondaryTap, child: Padding(padding: padding, child: child), ), ), diff --git a/lib/widgets/path_editor_sheet.dart b/lib/widgets/path_editor_sheet.dart index ee6ba006..f20aad1c 100644 --- a/lib/widgets/path_editor_sheet.dart +++ b/lib/widgets/path_editor_sheet.dart @@ -11,17 +11,20 @@ import '../models/contact.dart'; class PathEditorSheet extends StatefulWidget { final List availableContacts; final List initialPath; + final int pathHashByteWidth; const PathEditorSheet({ super.key, required this.availableContacts, this.initialPath = const [], + this.pathHashByteWidth = pathHashSize, }); static Future show( BuildContext context, { required List availableContacts, List initialPath = const [], + int pathHashByteWidth = pathHashSize, }) { return showModalBottomSheet( context: context, @@ -36,6 +39,7 @@ class PathEditorSheet extends StatefulWidget { child: PathEditorSheet( availableContacts: availableContacts, initialPath: initialPath, + pathHashByteWidth: pathHashByteWidth, ), ), ), @@ -48,9 +52,9 @@ class PathEditorSheet extends StatefulWidget { class _Hop { final int id; - final int byte; + final Uint8List bytes; - const _Hop(this.id, this.byte); + const _Hop(this.id, this.bytes); } class _PathEditorSheetState extends State { @@ -66,8 +70,11 @@ class _PathEditorSheetState extends State { @override void initState() { super.initState(); - for (final byte in widget.initialPath) { - _hops.add(_Hop(_nextHopId++, byte)); + for (final hop in PathHelper.splitPathBytes( + widget.initialPath, + widget.pathHashByteWidth, + )) { + _hops.add(_Hop(_nextHopId++, hop)); } _syncHexFromHops(); } @@ -90,9 +97,9 @@ class _PathEditorSheetState extends State { void _syncHexFromHops() { _syncingHex = true; - _hexController.text = PathHelper.formatPathHex( - _hops.map((h) => h.byte).toList(), - ); + _hexController.text = _hops + .map((h) => PathHelper.formatHopHex(h.bytes)) + .join(','); _syncingHex = false; _hexError = null; } @@ -104,8 +111,13 @@ class _PathEditorSheetState extends State { .split(RegExp(r'[,\s]+')) .where((t) => t.isNotEmpty) .toList(); + final width = widget.pathHashByteWidth.clamp(1, pubKeySize).toInt(); + final expectedChars = width * 2; final invalid = tokens - .where((t) => t.length != 2 || int.tryParse(t, radix: 16) == null) + .where( + (t) => + t.length != expectedChars || int.tryParse(t, radix: 16) == null, + ) .toList(); setState(() { if (invalid.isNotEmpty) { @@ -120,15 +132,29 @@ class _PathEditorSheetState extends State { _hops ..clear() ..addAll( - tokens.map((t) => _Hop(_nextHopId++, int.parse(t, radix: 16))), + tokens.map((t) { + final bytes = []; + for (var i = 0; i < t.length; i += 2) { + bytes.add(int.parse(t.substring(i, i + 2), radix: 16)); + } + return _Hop(_nextHopId++, Uint8List.fromList(bytes)); + }), ); }); } void _addHop(Contact contact) { if (_hops.length >= _maxHops) return; + final width = widget.pathHashByteWidth + .clamp(1, contact.publicKey.length) + .toInt(); setState(() { - _hops.add(_Hop(_nextHopId++, contact.publicKey.first)); + _hops.add( + _Hop( + _nextHopId++, + Uint8List.fromList(contact.publicKey.sublist(0, width)), + ), + ); _syncHexFromHops(); }); } @@ -149,18 +175,31 @@ class _PathEditorSheetState extends State { } void _save() { - Navigator.pop( - context, - Uint8List.fromList(_hops.map((h) => h.byte).toList()), - ); + final bytes = []; + for (final hop in _hops) { + bytes.addAll(hop.bytes); + } + Navigator.pop(context, Uint8List.fromList(bytes)); } 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); + final hex = PathHelper.formatHopHex(hop.bytes); + final matches = widget.availableContacts.where((contact) { + if (contact.publicKey.length < hop.bytes.length) return false; + return contact.publicKey + .sublist(0, hop.bytes.length) + .asMap() + .entries + .every((entry) => entry.value == hop.bytes[entry.key]); + }).toList(); + final name = matches.isEmpty + ? null + : matches.length == 1 + ? matches.first.name + : matches.map((c) => c.name).join(' | '); return ListTile( key: ValueKey(hop.id), @@ -224,7 +263,7 @@ class _PathEditorSheetState extends State { ), title: Text(contact.name, maxLines: 1, overflow: TextOverflow.ellipsis), subtitle: Text( - '${contact.typeLabel(l10n)} • ${PathHelper.hopHex(contact.publicKey.first)}', + '${contact.typeLabel(l10n)} • ${PathHelper.formatHopHex(contact.publicKey.sublist(0, widget.pathHashByteWidth.clamp(1, contact.publicKey.length).toInt()))}', ), trailing: const Icon(Icons.add_circle_outline), onTap: full ? null : () => _addHop(contact), diff --git a/lib/widgets/quick_switch_bar.dart b/lib/widgets/quick_switch_bar.dart index 90b90b40..917ceced 100644 --- a/lib/widgets/quick_switch_bar.dart +++ b/lib/widgets/quick_switch_bar.dart @@ -26,9 +26,16 @@ class QuickSwitchBar extends StatelessWidget { final colorScheme = theme.colorScheme; final labelStyle = theme.textTheme.labelMedium ?? const TextStyle(); final background = highContrast ? MapPalette.panelDark : Colors.transparent; - final selectedColor = highContrast + // The selected icon sits on the primary indicator pill, so it uses + // onPrimary. The label sits below on the bar background, so it must use a + // foreground color that contrasts with the surface (not onPrimary, which + // is white-on-white in the light theme). + final selectedIconColor = highContrast ? MapPalette.textPrimary : colorScheme.onPrimary; + final selectedLabelColor = highContrast + ? MapPalette.textPrimary + : colorScheme.onSurface; final unselectedColor = highContrast ? MapPalette.textSecondary : colorScheme.onSurfaceVariant; @@ -59,13 +66,13 @@ class QuickSwitchBar extends StatelessWidget { final isSelected = states.contains(WidgetState.selected); return labelStyle.copyWith( fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500, - color: isSelected ? selectedColor : unselectedColor, + color: isSelected ? selectedLabelColor : unselectedColor, ); }), iconTheme: WidgetStateProperty.resolveWith((states) { final isSelected = states.contains(WidgetState.selected); return IconThemeData( - color: isSelected ? selectedColor : unselectedColor, + color: isSelected ? selectedIconColor : unselectedColor, ); }), ), diff --git a/lib/widgets/repeater_login_dialog.dart b/lib/widgets/repeater_login_dialog.dart index 56834455..03f6e345 100644 --- a/lib/widgets/repeater_login_dialog.dart +++ b/lib/widgets/repeater_login_dialog.dart @@ -469,7 +469,10 @@ class _RepeaterLoginDialogState extends State { ), const SizedBox(height: 4), Text( - repeater.pathLabel(context.l10n), + repeater.pathLabel( + context.l10n, + pathHashByteWidth: connector.pathHashByteWidth, + ), style: TextStyle( fontSize: 11, color: scheme.onSurfaceVariant, diff --git a/lib/widgets/room_login_dialog.dart b/lib/widgets/room_login_dialog.dart index a5e2555b..b88716f8 100644 --- a/lib/widgets/room_login_dialog.dart +++ b/lib/widgets/room_login_dialog.dart @@ -405,7 +405,10 @@ class _RoomLoginDialogState extends State { ), const SizedBox(height: 4), Text( - repeater.pathLabel(context.l10n), + repeater.pathLabel( + context.l10n, + pathHashByteWidth: connector.pathHashByteWidth, + ), style: TextStyle( fontSize: 11, color: scheme.onSurfaceVariant, diff --git a/lib/widgets/routing_sheet.dart b/lib/widgets/routing_sheet.dart index 4c1a26f6..ee11937b 100644 --- a/lib/widgets/routing_sheet.dart +++ b/lib/widgets/routing_sheet.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../connector/meshcore_connector.dart'; +import '../utils/platform_info.dart'; import '../helpers/path_helper.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; @@ -106,11 +107,13 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { context, availableContacts: available, initialPath: initial, + pathHashByteWidth: connector.pathHashByteWidth, ); if (result == null || !mounted) return; + final hopCount = result.length ~/ connector.pathHashByteWidth; await connector.setPathOverride( contact, - pathLen: result.length, + pathLen: hopCount, pathBytes: result, ); await _verifyPath(connector, contact, result); @@ -122,9 +125,10 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { PathRecord record, ) async { final bytes = Uint8List.fromList(record.pathBytes); + final hopCount = bytes.length ~/ connector.pathHashByteWidth; await connector.setPathOverride( contact, - pathLen: bytes.length, + pathLen: hopCount, pathBytes: bytes, ); await _verifyPath(connector, contact, bytes); @@ -156,11 +160,17 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { setState(() => _syncStatus = context.l10n.chat_pathCleared); } - _PathQuality _qualityOf(PathRecord record, List ranked) { + _PathQuality _qualityOf( + MeshCoreConnector connector, + 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) { + if (ranked[i].matchesPathStart( + record.pathBytes, + connector.pathHashByteWidth, + )) { return switch (i) { 0 => _PathQuality.strong, 1 => _PathQuality.good, @@ -228,14 +238,22 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { case _RoutingMode.manual: final bytes = contact.pathOverrideBytes ?? Uint8List(0); if (bytes.isEmpty) return l10n.routing_directNoHops; - return PathHelper.resolvePathNames(bytes, connector.allContacts); + return PathHelper.resolvePathNames( + bytes, + connector.allContacts, + connector.pathHashByteWidth, + ); 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); + return PathHelper.resolvePathNames( + contact.path, + connector.allContacts, + connector.pathHashByteWidth, + ); } } @@ -274,10 +292,14 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { List pathBytes, ) { final l10n = context.l10n; - final formattedPath = PathHelper.formatPathHex(pathBytes); + final formattedPath = PathHelper.splitPathBytes( + pathBytes, + connector.pathHashByteWidth, + ).map(PathHelper.formatHopHex).join(','); final resolvedNames = PathHelper.resolvePathNames( pathBytes, connector.allContacts, + connector.pathHashByteWidth, ); showDialog( @@ -520,11 +542,21 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { listEquals(record.pathBytes, contact.path))); final title = hasBytes - ? PathHelper.resolvePathNames(record.pathBytes, connector.allContacts) + ? PathHelper.resolvePathNames( + record.pathBytes, + connector.allContacts, + connector.pathHashByteWidth, + ) : l10n.chat_hopsCount(record.hopCount); + final displayHopCount = hasBytes + ? PathHelper.splitPathBytes( + record.pathBytes, + connector.pathHashByteWidth, + ).length + : record.hopCount; final line1 = - '${l10n.chat_hopsCount(record.hopCount)} • ${_qualityLabel(context, quality)}'; + '${l10n.chat_hopsCount(displayHopCount)} • ${_qualityLabel(context, quality)}'; final line2Parts = [ record.timestamp != null ? l10n.routing_lastWorked(_relativeTime(context, record.timestamp!)) @@ -534,56 +566,67 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { 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), + return GestureDetector( + behavior: HitTestBehavior.opaque, + onSecondaryTapUp: PlatformInfo.isDesktop && hasBytes + ? (_) => + _showPathDetail(context, connector, contact, record.pathBytes) + : null, + child: 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, + 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, ), ), - 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, ), - onTap: hasBytes && !inUse - ? () => _applyHistoryPath(connector, contact, record) - : null, - onLongPress: hasBytes - ? () => - _showPathDetail(context, connector, contact, record.pathBytes) - : null, ), ); } @@ -609,7 +652,10 @@ class _RoutingSheetBodyState extends State<_RoutingSheetBody> { pathService .getRecentPaths(contact.publicKeyHex) .map( - (r) => (quality: _qualityOf(r, rankedRepeaters), record: r), + (r) => ( + quality: _qualityOf(connector, r, rankedRepeaters), + record: r, + ), ) .toList() ..sort((a, b) { diff --git a/lib/widgets/snr_indicator.dart b/lib/widgets/snr_indicator.dart index f57776de..29512023 100644 --- a/lib/widgets/snr_indicator.dart +++ b/lib/widgets/snr_indicator.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:flutter/foundation.dart'; import 'package:latlong2/latlong.dart'; import '../connector/meshcore_connector.dart'; import '../connector/meshcore_protocol.dart'; +import '../helpers/path_helper.dart'; import '../l10n/l10n.dart'; import '../models/contact.dart'; import '../theme/mesh_theme.dart'; @@ -11,15 +13,27 @@ import 'signal_ui.dart'; Contact? _getRepeaterPrefixMatchNearLocation( List contacts, - int pubkeyFirstByte, { + List pubkeyPrefix, { + String? contactKeyHex, LatLng? searchPoint, bool preferFavorites = false, }) { + if (contactKeyHex != null) { + for (final c in contacts) { + if (c.publicKeyHex == contactKeyHex) { + return c; + } + } + } + final candidates = contacts .where( (c) => - c.publicKey.isNotEmpty && - c.publicKey.first == pubkeyFirstByte && + c.publicKey.length >= pubkeyPrefix.length && + listEquals( + c.publicKey.sublist(0, pubkeyPrefix.length), + pubkeyPrefix, + ) && (c.type == advTypeRepeater || c.type == advTypeRoom), ) .toList(); @@ -164,7 +178,7 @@ class _SNRIndicatorState extends State { ), if (directRepeater != null) Text( - '${directRepeaters.length}: ${directRepeater.pubkeyFirstByte.toRadixString(16).padLeft(2, '0')}: ${_formatLastUpdated(directRepeater.lastUpdated)}', + '${directRepeaters.length}: ${directRepeater.pubkeyPrefixHex}: ${_formatLastUpdated(directRepeater.lastUpdated)}', style: TextStyle( fontSize: 12, fontWeight: FontWeight.w500, @@ -234,15 +248,16 @@ class _SNRIndicatorState extends State { final contact = _getRepeaterPrefixMatchNearLocation( allContacts, - repeater.pubkeyFirstByte, + repeater.pubkeyPrefix, + contactKeyHex: repeater.contactKeyHex, searchPoint: selfPoint, preferFavorites: true, ); final name = contact?.name; - final hex = repeater.pubkeyFirstByte - .toRadixString(16) - .padLeft(2, '0'); + final prefixLabel = PathHelper.formatHopHex( + repeater.pubkeyPrefix, + ); final snrColor = MeshTheme.snrColor( repeater.snr, blocked: false, @@ -256,7 +271,7 @@ class _SNRIndicatorState extends State { child: Row( children: [ AvatarCircle( - name: name ?? hex, + name: name ?? prefixLabel, size: 36, color: snrColor, ), @@ -266,7 +281,7 @@ class _SNRIndicatorState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - name ?? hex, + name ?? prefixLabel, style: Theme.of(context).textTheme.bodyMedium, ), Text( diff --git a/lib/widgets/telemetry_location_map.dart b/lib/widgets/telemetry_location_map.dart index f8983c04..537867c5 100644 --- a/lib/widgets/telemetry_location_map.dart +++ b/lib/widgets/telemetry_location_map.dart @@ -11,7 +11,6 @@ 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; @@ -115,7 +114,7 @@ class _TelemetryLocationMapState extends State { ), ), children: [ - ThemedMapTileLayer(tileCache: tileCache), + tileCache.buildTileLayer(context), MarkerLayer( markers: [ ...contacts.map(_buildContactMarker), diff --git a/lib/widgets/themed_map_tile_layer.dart b/lib/widgets/themed_map_tile_layer.dart deleted file mode 100644 index c6d2eaad..00000000 --- a/lib/widgets/themed_map_tile_layer.dart +++ /dev/null @@ -1,60 +0,0 @@ -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/translated_message_content.dart b/lib/widgets/translated_message_content.dart index 3495897d..a40bacf8 100644 --- a/lib/widgets/translated_message_content.dart +++ b/lib/widgets/translated_message_content.dart @@ -8,6 +8,7 @@ class TranslatedMessageContent extends StatelessWidget { final TextStyle style; final TextStyle? originalStyle; final bool showOriginalFirst; + final VoidCallback? onSecondaryTap; const TranslatedMessageContent({ super.key, @@ -16,6 +17,7 @@ class TranslatedMessageContent extends StatelessWidget { this.originalText, this.originalStyle, this.showOriginalFirst = true, + this.onSecondaryTap, }); @override @@ -36,12 +38,14 @@ class TranslatedMessageContent extends StatelessWidget { fontStyle: FontStyle.italic, fontSize: style.fontSize, ), + onSecondaryTap: onSecondaryTap, ) : null; final translatedWidget = LinkHandler.buildLinkifyText( context: context, text: trimmedDisplay, style: style, + onSecondaryTap: onSecondaryTap, ); if (!shouldShowOriginal) { diff --git a/lib/widgets/unread_badge.dart b/lib/widgets/unread_badge.dart index 1cf5c1d6..dd2e2ab3 100644 --- a/lib/widgets/unread_badge.dart +++ b/lib/widgets/unread_badge.dart @@ -11,18 +11,19 @@ class UnreadBadge extends StatelessWidget { Widget build(BuildContext context) { final display = count > 9999 ? '9999+' : count.toString(); return Container( - padding: const EdgeInsets.symmetric(horizontal: 7, vertical: 2), + constraints: const BoxConstraints(minWidth: 20), + padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2), + alignment: Alignment.center, decoration: BoxDecoration( - color: MeshPalette.blue.withValues(alpha: 0.18), + color: MeshPalette.alert, borderRadius: BorderRadius.circular(MeshRadii.pill), - border: Border.all(color: MeshPalette.blue.withValues(alpha: 0.45)), ), child: Text( display, style: MeshTheme.mono( fontSize: 11, fontWeight: FontWeight.w700, - color: MeshPalette.blue, + color: Colors.white, ), ), ); diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 380c924f..d7e75bd8 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,7 @@ import FlutterMacOS import Foundation +import cryptography_flutter import file_selector_macos import flutter_blue_plus_darwin import flutter_local_notifications @@ -16,6 +17,7 @@ import sqflite_darwin import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + CryptographyFlutterPlugin.register(with: registry.registrar(forPlugin: "CryptographyFlutterPlugin")) FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FlutterBluePlusPlugin.register(with: registry.registrar(forPlugin: "FlutterBluePlusPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) diff --git a/pubspec.yaml b/pubspec.yaml index 09abc235..930a32dc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -74,6 +74,9 @@ dependencies: ml_dataframe: ^1.0.0 llamadart: ^0.8.0 flutter_langdetect: ^0.0.1 + cryptography: ^2.9.0 + cryptography_flutter: ^2.3.4 + convert: ^3.1.2 hooks: user_defines: @@ -112,12 +115,25 @@ flutter: assets: - assets/images/ - assets/icons/ + - assets/fonts/ + + fonts: + - family: Inter + fonts: + - asset: assets/fonts/Inter.ttf + - asset: assets/fonts/InterItalic.ttf + style: italic + - family: JetBrains Mono + fonts: + - asset: assets/fonts/JetBrainsMono.ttf flutter_launcher_icons: android: true ios: true image_path: "mesh-icon.png" remove_alpha_ios: true + adaptive_icon_background: "#9F9D95" + adaptive_icon_foreground: "assets/icons/ic_foreground.png" # To add assets to your application, add an assets section, like this: # assets: diff --git a/test/helpers/path_helper_test.dart b/test/helpers/path_helper_test.dart index 38abf2cd..67391c94 100644 --- a/test/helpers/path_helper_test.dart +++ b/test/helpers/path_helper_test.dart @@ -22,15 +22,64 @@ Contact _contact({ } void main() { - test('resolvePathNames ignores chat nodes and keeps repeater/room nodes', () { + test('splitPathBytes groups bytes by hash width', () { + final hops = PathHelper.splitPathBytes([0xA1, 0xA2, 0xC1, 0xC2], 2); + + expect(hops, hasLength(2)); + expect(hops.first, equals(Uint8List.fromList([0xA1, 0xA2]))); + expect(hops.last, equals(Uint8List.fromList([0xC1, 0xC2]))); + expect(PathHelper.formatHopHex(hops.first), equals('A1A2')); + }); + + test( + 'resolvePathNames ignores chat nodes and keeps repeater/room nodes with 1-byte paths', + () { + final contacts = [ + _contact(firstByte: 0xF2, name: 'MunTui', type: advTypeChat), + _contact(firstByte: 0x7E, name: 'zrepeater', type: advTypeRepeater), + _contact(firstByte: 0xBA, name: 'USS Ronald Reagan', type: advTypeRoom), + ]; + + final resolved = PathHelper.resolvePathNames( + [0xF2, 0x7E, 0xBA], + contacts, + 1, // 1-byte hash width + ); + + expect(resolved, equals('F2 → zrepeater → USS Ronald Reagan')); + }, + ); + + test('resolvePathNames supports multi-byte paths', () { final contacts = [ - _contact(firstByte: 0xF2, name: 'MunTui', type: advTypeChat), - _contact(firstByte: 0x7E, name: 'zrepeater', type: advTypeRepeater), - _contact(firstByte: 0xBA, name: 'USS Ronald Reagan', type: advTypeRoom), + _contact(firstByte: 0xA1, name: 'Repeater1', type: advTypeRepeater), + _contact(firstByte: 0xC1, name: 'Room42', type: advTypeRoom), ]; - final resolved = PathHelper.resolvePathNames([0xF2, 0x7E, 0xBA], contacts); + // Contacts with 2-byte public keys + contacts[0] = Contact( + publicKey: Uint8List.fromList([0xA1, 0xA2, ...List.filled(30, 0)]), + name: 'Repeater1', + type: advTypeRepeater, + pathLength: 0, + path: Uint8List(0), + lastSeen: DateTime.now(), + ); + contacts[1] = Contact( + publicKey: Uint8List.fromList([0xC1, 0xC2, ...List.filled(30, 0)]), + name: 'Room42', + type: advTypeRoom, + pathLength: 0, + path: Uint8List(0), + lastSeen: DateTime.now(), + ); - expect(resolved, equals('F2 → zrepeater → USS Ronald Reagan')); + final resolved = PathHelper.resolvePathNames( + [0xA1, 0xA2, 0xC1, 0xC2], + contacts, + 2, // 2-byte hash width + ); + + expect(resolved, equals('Repeater1 → Room42')); }); } diff --git a/test/models/model_changes_test.dart b/test/models/model_changes_test.dart index a80c7944..c91a9c73 100644 --- a/test/models/model_changes_test.dart +++ b/test/models/model_changes_test.dart @@ -1,10 +1,19 @@ +import 'dart:convert'; import 'dart:typed_data'; import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/models/channel_message.dart'; import 'package:meshcore_open/models/contact.dart'; import 'package:meshcore_open/models/path_history.dart'; import 'package:meshcore_open/models/app_settings.dart'; -import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/storage/contact_store.dart'; +import 'package:meshcore_open/storage/channel_message_store.dart'; +import 'package:meshcore_open/storage/contact_discovery_store.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/storage/prefs_manager.dart'; +import 'package:meshcore_open/storage/message_store.dart'; +import 'package:shared_preferences/shared_preferences.dart'; // Builds a valid contact frame with the given pathLen and optional overrides. // Frame layout: [respCode(1)][pubKey(32)][type(1)][flags(1)][pathLen(1)][path(64)][name(32)][timestamp(4)][lat(4)][lon(4)] @@ -37,7 +46,108 @@ Uint8List _buildContactFrame({ return Uint8List.fromList(writer.toBytes()); } +Uint8List _buildChannelMessageFrameV3({ + required int pathHashWidth, + required int hopCount, + required bool hasPath, + int channelIndex = 7, + String senderName = 'Alice', + + String text = 'Hello world', + int txtType = txtTypePlain, +}) { + final writer = BytesBuilder(); + writer.addByte(respCodeChannelMsgRecvV3); + writer.addByte(0x10); + writer.addByte(hasPath ? 0x01 : 0x00); + writer.addByte(0x00); + writer.addByte(channelIndex); + writer.addByte(((pathHashWidth - 1) << 6) | hopCount); + + if (hasPath && hopCount > 0) { + writer.add( + Uint8List.fromList(List.generate(hopCount * pathHashWidth, (i) => i + 1)), + ); + } + + writer.addByte(txtType); + writer.add(Uint8List.fromList([0x01, 0x00, 0x00, 0x00])); + writer.add(utf8.encode('$senderName: $text')); + writer.addByte(0x00); + + return Uint8List.fromList(writer.toBytes()); +} + void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + setUp(() async { + SharedPreferences.setMockInitialValues({}); + PrefsManager.reset(); + await PrefsManager.initialize(); + }); + + group('ChannelMessage.fromFrame — V3 packed path decoding', () { + test( + 'hasPath reads width, hop count, path bytes, and txtType correctly', + () { + final frame = _buildChannelMessageFrameV3( + pathHashWidth: 2, + hopCount: 3, + hasPath: true, + ); + + final message = ChannelMessage.fromFrame(frame); + + expect(message, isNotNull); + expect(message!.pathHashWidth, equals(2)); + expect(message.pathLength, equals(3)); + expect(message.pathBytes.length, equals(6)); + expect(message.senderName, equals('Alice')); + expect(message.text, equals('Hello world')); + }, + ); + + test('no path still reads width, hop count, and txtType correctly', () { + final frame = _buildChannelMessageFrameV3( + pathHashWidth: 4, + hopCount: 5, + hasPath: false, + ); + + final message = ChannelMessage.fromFrame(frame); + + expect(message, isNotNull); + expect(message!.pathHashWidth, equals(4)); + expect(message.pathLength, equals(5)); + expect(message.pathBytes, isEmpty); + expect(message.senderName, equals('Alice')); + expect(message.text, equals('Hello world')); + }); + + test('non-plain txtType with path -> returns null', () { + final frame = _buildChannelMessageFrameV3( + pathHashWidth: 2, + hopCount: 2, + hasPath: true, + txtType: txtTypeCliData, + ); + final message = ChannelMessage.fromFrame(frame); + expect(message, isNull); + }); + + test('non-plain txtType without path -> returns null', () { + final frame = _buildChannelMessageFrameV3( + pathHashWidth: 2, + hopCount: 2, + hasPath: false, + txtType: txtTypeCliData, + ); + final message = ChannelMessage.fromFrame(frame); + expect(message, isNull); + }); + }); + group('Contact.fromFrame — pathLen mapping', () { test('pathLen == 0 → pathLength == 0 (direct, NOT flood)', () { final frame = _buildContactFrame(pathLen: 0); @@ -53,11 +163,11 @@ void main() { expect(contact!.pathLength, equals(1)); }); - test('pathLen == 64 (maxPathSize) → pathLength == 64', () { - final frame = _buildContactFrame(pathLen: maxPathSize); + test('pathLen == 64 (mode 1, 0 hops) → pathLength == 0', () { + final frame = _buildContactFrame(pathLen: 64); final contact = Contact.fromFrame(frame); expect(contact, isNotNull); - expect(contact!.pathLength, equals(maxPathSize)); + expect(contact!.pathLength, equals(0)); }); test('pathLen == 0xFF → pathLength == -1 (flood)', () { @@ -67,11 +177,18 @@ void main() { expect(contact!.pathLength, equals(-1)); }); - test('pathLen == 65 (over maxPathSize) → pathLength == -1 (flood)', () { + test('pathLen == 65 (mode 1, 1 hop) → pathLength == 1', () { final frame = _buildContactFrame(pathLen: 65); final contact = Contact.fromFrame(frame); expect(contact, isNotNull); - expect(contact!.pathLength, equals(-1)); + expect(contact!.pathLength, equals(1)); + }); + + test('pathLen == 129 (mode 2, 1 hop) → pathLength == 1', () { + final frame = _buildContactFrame(pathLen: 129); + final contact = Contact.fromFrame(frame); + expect(contact, isNotNull); + expect(contact!.pathLength, equals(1)); }); }); @@ -358,4 +475,213 @@ void main() { expect(updated.maxRouteWeight, equals(settings.maxRouteWeight)); }); }); + + group('Storage migration — multi-byte paths compatibility', () { + test( + 'ContactStore decodes and migrates legacy mode-encoded paths', + () async { + final store = ContactStore()..publicKeyHex = '1234567890'; + + // Let's create a contact with legacy 64 path length (mode 1, 0 hops) + final rawPath = Uint8List(64); // 64 bytes of zeroes + final contactJson = [ + { + 'publicKey': base64Encode(Uint8List(32)..[0] = 0xAA), + 'name': 'LegacyNode', + 'type': 2, + 'flags': 0, + 'pathLength': 64, // encoded pathLength (mode 1, 0 hops) + 'path': base64Encode(rawPath), + 'lastSeen': DateTime.now().millisecondsSinceEpoch, + 'lastMessageAt': DateTime.now().millisecondsSinceEpoch, + 'isActive': true, + }, + ]; + + final prefs = PrefsManager.instance; + await prefs.setString(store.keyFor, jsonEncode(contactJson)); + + final contacts = await store.loadContacts(); + expect(contacts, hasLength(1)); + expect(contacts.first.pathLength, equals(0)); + expect(contacts.first.path, isEmpty); + }, + ); + + test( + 'ContactStore decodes and migrates legacy mode-1 paths with hops', + () async { + final store = ContactStore()..publicKeyHex = '1234567890'; + + // Contact with legacy 65 path length (mode 1, 1 hop) + final rawPath = Uint8List(64) + ..[0] = 0xBB + ..[1] = 0xCC; + final contactJson = [ + { + 'publicKey': base64Encode(Uint8List(32)..[0] = 0xAA), + 'name': 'LegacyNode2', + 'type': 2, + 'flags': 0, + 'pathLength': 65, // encoded pathLength (mode 1, 1 hop) + 'path': base64Encode(rawPath), + 'lastSeen': DateTime.now().millisecondsSinceEpoch, + 'lastMessageAt': DateTime.now().millisecondsSinceEpoch, + 'isActive': true, + }, + ]; + + final prefs = PrefsManager.instance; + await prefs.setString(store.keyFor, jsonEncode(contactJson)); + + final contacts = await store.loadContacts(); + expect(contacts, hasLength(1)); + expect(contacts.first.pathLength, equals(1)); + expect(contacts.first.path, equals(Uint8List.fromList([0xBB, 0xCC]))); + }, + ); + + test( + 'MessageStore decodes and migrates legacy mode-encoded message paths', + () async { + final store = MessageStore()..publicKeyHex = '1234567890'; + final contactKeyHex = pubKeyToHex(Uint8List(32)..[0] = 0xAA); + + final rawPath = Uint8List(64); + final messageJson = [ + { + 'senderKey': base64Encode(Uint8List(32)..[0] = 0xAA), + 'text': 'Hello', + 'timestamp': DateTime.now().millisecondsSinceEpoch, + 'isOutgoing': false, + 'status': 2, // delivered + 'messageId': 'msg_1', + 'pathLength': 64, // encoded pathLength (mode 1, 0 hops) + 'pathBytes': base64Encode(rawPath), + }, + ]; + + final prefs = PrefsManager.instance; + await prefs.setString( + '${store.keyFor}$contactKeyHex', + jsonEncode(messageJson), + ); + + final messages = await store.loadMessages(contactKeyHex); + expect(messages, hasLength(1)); + expect(messages.first.pathLength, equals(0)); + expect(messages.first.pathBytes, isEmpty); + }, + ); + + test( + 'ChannelMessageStore decodes and migrates legacy mode-encoded paths', + () async { + final store = ChannelMessageStore()..publicKeyHex = '1234567890'; + final channelIndex = 1; + + final rawPath = Uint8List(64) + ..[0] = 0xBB + ..[1] = 0xCC; + final messageJson = [ + { + 'senderName': 'Alice', + 'text': 'Hello', + 'timestamp': DateTime.now().millisecondsSinceEpoch, + 'isOutgoing': false, + 'status': 2, + 'channelIndex': channelIndex, + 'pathLength': 65, // encoded pathLength (mode 1, 1 hop) + 'pathBytes': base64Encode(rawPath), + }, + ]; + + final prefs = PrefsManager.instance; + await prefs.setString( + '${store.keyFor}$channelIndex', + jsonEncode(messageJson), + ); + + final messages = await store.loadChannelMessages(channelIndex); + expect(messages, hasLength(1)); + expect(messages.first.pathLength, equals(1)); + expect( + messages.first.pathBytes, + equals(Uint8List.fromList([0xBB, 0xCC])), + ); + expect(messages.first.pathHashWidth, equals(2)); + }, + ); + + test( + 'ContactDiscoveryStore decodes and migrates legacy mode-encoded paths', + () async { + final store = ContactDiscoveryStore(); + + final rawPath = Uint8List(64) + ..[0] = 0x11 + ..[1] = 0x22; + final contactJson = [ + { + 'publicKey': base64Encode(Uint8List(32)..[0] = 0xBB), + 'name': 'DiscoveredNode', + 'type': 1, + 'flags': 0, + 'pathLength': 65, // encoded pathLength (mode 1, 1 hop) + 'path': base64Encode(rawPath), + 'lastSeen': DateTime.now().millisecondsSinceEpoch, + 'lastMessageAt': DateTime.now().millisecondsSinceEpoch, + }, + ]; + + final prefs = PrefsManager.instance; + await prefs.setString('discovered_contacts', jsonEncode(contactJson)); + + final contacts = await store.loadContacts(); + expect(contacts, hasLength(1)); + expect(contacts.first.pathLength, equals(1)); + expect(contacts.first.path, equals(Uint8List.fromList([0x11, 0x22]))); + }, + ); + }); + + group('AppSettingsService — gps interval fallback', () { + test('resolvedGpsIntervalSeconds prefers device custom var', () { + final service = AppSettingsService(); + + expect( + service.resolvedGpsIntervalSeconds(const {'gps_interval': '120'}), + equals(120), + ); + }); + + test('resolvedGpsIntervalSeconds falls back to stored value', () async { + final service = AppSettingsService(); + await service.updateSettings(AppSettings(gpsIntervalSeconds: 900)); + + expect(service.resolvedGpsIntervalSeconds(null), equals(900)); + expect( + service.resolvedGpsIntervalSeconds(const {'gps_interval': 'bad'}), + equals(900), + ); + }); + + test('resolvedGpsIntervalSeconds keeps an explicit device zero', () async { + final service = AppSettingsService(); + await service.updateSettings(AppSettings(gpsIntervalSeconds: 900)); + + expect( + service.resolvedGpsIntervalSeconds(const {'gps_interval': '0'}), + equals(0), + ); + }); + + test('toJson/fromJson preserves gpsIntervalSeconds', () { + final settings = AppSettings(gpsIntervalSeconds: 321); + + final restored = AppSettings.fromJson(settings.toJson()); + + expect(restored.gpsIntervalSeconds, equals(321)); + }); + }); } diff --git a/test/screens/path_trace_test.dart b/test/screens/path_trace_test.dart new file mode 100644 index 00000000..74b2b37a --- /dev/null +++ b/test/screens/path_trace_test.dart @@ -0,0 +1,403 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:provider/provider.dart'; +import 'dart:typed_data'; + +import 'package:meshcore_open/connector/meshcore_connector.dart'; +import 'package:meshcore_open/connector/meshcore_protocol.dart'; +import 'package:meshcore_open/screens/path_trace_map.dart'; +import 'package:meshcore_open/services/app_settings_service.dart'; +import 'package:meshcore_open/services/map_tile_cache_service.dart'; +import 'package:meshcore_open/models/contact.dart'; +import 'package:meshcore_open/l10n/app_localizations.dart'; +import 'package:meshcore_open/services/path_history_service.dart'; +import 'package:meshcore_open/services/storage_service.dart'; +import 'package:meshcore_open/models/path_history.dart'; + +class _FakeStorageService extends StorageService { + @override + Future savePathHistory( + String contactPubKeyHex, + ContactPathHistory history, + ) async {} + @override + Future loadPathHistory(String contactPubKeyHex) async => + null; + @override + Future clearPathHistory(String contactPubKeyHex) async {} +} + +class _FakeMeshCoreConnector extends MeshCoreConnector { + final StreamController _receivedFramesController = + StreamController.broadcast(); + + @override + Stream get receivedFrames => _receivedFramesController.stream; + + @override + Uint8List? get selfPublicKey => + Uint8List.fromList(List.generate(32, (i) => i)); + + @override + double? get selfLatitude => 48.8566; + + @override + double? get selfLongitude => 2.3522; + + @override + List get allContactsUnfiltered => []; + + @override + List get contacts => []; + + void emitFrame(Uint8List frame) { + _receivedFramesController.add(frame); + } + + final List sentFrames = []; + + @override + Future sendFrame( + Uint8List frame, { + String? channelSendQueueId, + bool expectsGenericAck = false, + bool waitForGenericAck = false, + }) async { + sentFrames.add(frame); + } +} + +Widget _buildTestApp({ + required MeshCoreConnector connector, + required Widget child, +}) { + final appSettingsService = AppSettingsService(); + + return MultiProvider( + providers: [ + ChangeNotifierProvider.value(value: connector), + ChangeNotifierProvider.value( + value: appSettingsService, + ), + ChangeNotifierProvider( + create: (_) => + MapTileCacheService(appSettingsService: appSettingsService), + ), + ChangeNotifierProvider( + create: (_) => PathHistoryService(_FakeStorageService()), + ), + ], + child: MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + home: child, + ), + ); +} + +void main() { + testWidgets('PathTraceMapScreen parses response frames correctly', ( + tester, + ) async { + final connector = _FakeMeshCoreConnector(); + + final screen = PathTraceMapScreen( + title: 'Test Trace', + path: Uint8List.fromList([0x12, 0x34]), + pathHashByteWidth: 1, + ); + + await tester.pumpWidget(_buildTestApp(connector: connector, child: screen)); + await tester.pump(); + + // Verify a send request was made + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + expect(sentFrame[0], cmdSendTracePath); + + // Extract the tag sent in the request (bytes 2-5) + final tag = sentFrame.sublist(2, 6); + + // Emit respCodeSent (6) + final respCodeSentFrame = Uint8List(10); + respCodeSentFrame[0] = respCodeSent; + respCodeSentFrame[1] = 0; // reserved / is_flood + respCodeSentFrame.setRange(2, 6, tag); + // timeout milliseconds = 5000 (0x1388) + respCodeSentFrame[6] = 0x88; + respCodeSentFrame[7] = 0x13; + respCodeSentFrame[8] = 0x00; + respCodeSentFrame[9] = 0x00; + + connector.emitFrame(respCodeSentFrame); + await tester.pump(); + + // Now emit PUSH_CODE_TRACE_DATA (0x89) + // Structure: + // Offset 0: pushCodeTraceData (0x89) + // Offset 1: reserved (0) + // Offset 2: pathLength (2) + // Offset 3: flag (0) + // Offset 4..7: tag + // Offset 8..11: auth (0) + // Offset 12..13: pathBytes [0x12, 0x34] + // Offset 14..16: SNR bytes [12, 16, 20] -> to be mapped to signed 8 bit Snr/4 + final pushTraceFrame = Uint8List(17); + pushTraceFrame[0] = pushCodeTraceData; + pushTraceFrame[1] = 0; // reserved + pushTraceFrame[2] = 2; // pathLength + pushTraceFrame[3] = 0; // flag + pushTraceFrame.setRange(4, 8, tag); + // auth bytes (8..11) = 0 + pushTraceFrame.setRange(12, 14, [0x12, 0x34]); // pathBytes + pushTraceFrame.setRange(14, 17, [12, 16, 20]); // SNR bytes + + connector.emitFrame(pushTraceFrame); + for (int i = 0; i < 5; i++) { + await tester.pump(const Duration(milliseconds: 100)); + } + + // Verify it doesn't show "Path trace not available" or similar + expect(find.text('Path trace not available.'), findsNothing); + }); + + testWidgets( + 'PathTraceMapScreen parses multi-byte encoded path trace response correctly', + (tester) async { + final connector = _FakeMeshCoreConnector(); + + final screen = PathTraceMapScreen( + title: 'Test Trace Multi-byte', + path: Uint8List.fromList([0x12, 0x34]), + pathHashByteWidth: 2, + ); + + await tester.pumpWidget( + _buildTestApp(connector: connector, child: screen), + ); + await tester.pump(); + + // Verify a send request was made + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + expect(sentFrame[0], cmdSendTracePath); + + // Extract the tag sent in the request (bytes 2-5) + final tag = sentFrame.sublist(2, 6); + + // Emit respCodeSent (6) + final respCodeSentFrame = Uint8List(10); + respCodeSentFrame[0] = respCodeSent; + respCodeSentFrame[1] = 0; + respCodeSentFrame.setRange(2, 6, tag); + respCodeSentFrame[6] = 0x88; + respCodeSentFrame[7] = 0x13; + respCodeSentFrame[8] = 0x00; + respCodeSentFrame[9] = 0x00; + + connector.emitFrame(respCodeSentFrame); + await tester.pump(); + + // Now emit PUSH_CODE_TRACE_DATA (0x89) + // Structure: + // Offset 0: pushCodeTraceData (0x89) + // Offset 1: reserved (0) + // Offset 2: pathLength (65) -> mode 1 (width 2), 1 hop + // Offset 3: flag (0) + // Offset 4..7: tag + // Offset 8..11: auth (0) + // Offset 12..13: pathBytes [0x12, 0x34] + // Offset 14..15: SNR bytes [12, 16] + final pushTraceFrame = Uint8List(16); + pushTraceFrame[0] = pushCodeTraceData; + pushTraceFrame[1] = 0; // reserved + pushTraceFrame[2] = 65; // pathLength encoded (mode 1, 1 hop -> 2 bytes) + pushTraceFrame[3] = 0; // flag + pushTraceFrame.setRange(4, 8, tag); + pushTraceFrame.setRange(12, 14, [0x12, 0x34]); // pathBytes + pushTraceFrame.setRange(14, 16, [12, 16]); // SNR bytes + + connector.emitFrame(pushTraceFrame); + for (int i = 0; i < 5; i++) { + await tester.pump(const Duration(milliseconds: 100)); + } + + // Verify it parsed correctly (should not show the unavailable message) + expect(find.text('Path trace not available.'), findsNothing); + }, + ); + + testWidgets('PathTraceMapScreen buildPath: Direct repeater ping (0-hop)', ( + tester, + ) async { + final connector = _FakeMeshCoreConnector(); + final target = Contact( + publicKey: Uint8List.fromList([0xAA, 0xBB, 0xCC]), + name: 'Repeater Node', + type: advTypeRepeater, + path: Uint8List(0), + pathLength: 0, + lastSeen: DateTime.now(), + ); + + final screen = PathTraceMapScreen( + title: 'Direct Repeater Ping', + path: Uint8List.fromList([0xAA]), + targetContact: target, + flipPathAround: true, + pathHashByteWidth: 1, + ); + + await tester.pumpWidget(_buildTestApp(connector: connector, child: screen)); + await tester.pump(); + + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + expect(sentFrame[0], cmdSendTracePath); + final payload = sentFrame.sublist(10); + expect(payload, Uint8List.fromList([0xAA])); + }); + + testWidgets('PathTraceMapScreen buildPath: 1-hop chat contact trace', ( + tester, + ) async { + final connector = _FakeMeshCoreConnector(); + final target = Contact( + publicKey: Uint8List.fromList([0xCC, 0xDD, 0xEE]), + name: 'Chat User', + type: advTypeChat, + path: Uint8List.fromList([0xBB]), + pathLength: 1, + lastSeen: DateTime.now(), + ); + + final screen = PathTraceMapScreen( + title: '1-Hop Chat Trace', + path: Uint8List.fromList([0xBB]), + targetContact: target, + flipPathAround: true, + pathHashByteWidth: 1, + ); + + await tester.pumpWidget(_buildTestApp(connector: connector, child: screen)); + await tester.pump(); + + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + expect(sentFrame[0], cmdSendTracePath); + final payload = sentFrame.sublist(10); + expect(payload, Uint8List.fromList([0xBB, 0xCC, 0xBB])); + }); + + testWidgets('PathTraceMapScreen buildPath: Multi-hop chat contact trace', ( + tester, + ) async { + final connector = _FakeMeshCoreConnector(); + final target = Contact( + publicKey: Uint8List.fromList([0x33, 0x44, 0x55]), + name: 'Chat User Multi-hop', + type: advTypeChat, + path: Uint8List.fromList([0x11, 0x22]), + pathLength: 2, + lastSeen: DateTime.now(), + ); + + final screen = PathTraceMapScreen( + title: 'Multi-Hop Chat Trace', + path: Uint8List.fromList([0x11, 0x22]), + targetContact: target, + flipPathAround: true, + pathHashByteWidth: 1, + ); + + await tester.pumpWidget(_buildTestApp(connector: connector, child: screen)); + await tester.pump(); + + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + expect(sentFrame[0], cmdSendTracePath); + final payload = sentFrame.sublist(10); + expect(payload, Uint8List.fromList([0x11, 0x22, 0x33, 0x22, 0x11])); + }); + + testWidgets( + 'PathTraceMapScreen buildPath: Map trace with null target contact', + (tester) async { + final connector = _FakeMeshCoreConnector(); + + final screen = PathTraceMapScreen( + title: 'Map Trace No Target', + path: Uint8List.fromList([0x11, 0x22]), + targetContact: null, + flipPathAround: true, + pathHashByteWidth: 1, + ); + + await tester.pumpWidget( + _buildTestApp(connector: connector, child: screen), + ); + await tester.pump(); + + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + expect(sentFrame[0], cmdSendTracePath); + final payload = sentFrame.sublist(10); + expect(payload, Uint8List.fromList([0x11, 0x22, 0x11])); + }, + ); + + testWidgets('PathTraceMapScreen parses raw byte length fallback correctly', ( + tester, + ) async { + final connector = _FakeMeshCoreConnector(); + + final screen = PathTraceMapScreen( + title: 'Test Raw Fallback', + path: Uint8List.fromList([0x12, 0x34]), + pathHashByteWidth: 2, + ); + + await tester.pumpWidget(_buildTestApp(connector: connector, child: screen)); + await tester.pump(); + + expect(connector.sentFrames.length, 1); + final sentFrame = connector.sentFrames.first; + // Extract the tag sent in the request (bytes 2-5) + final tag = sentFrame.sublist(2, 6); + + // Emit respCodeSent (6) + final respCodeSentFrame = Uint8List(10); + respCodeSentFrame[0] = respCodeSent; + respCodeSentFrame[1] = 0; + respCodeSentFrame.setRange(2, 6, tag); + respCodeSentFrame[6] = 0x88; + respCodeSentFrame[7] = 0x13; + respCodeSentFrame[8] = 0x00; + respCodeSentFrame[9] = 0x00; + + connector.emitFrame(respCodeSentFrame); + await tester.pump(); + + // Now emit PUSH_CODE_TRACE_DATA (0x89) + // Structure: + // Offset 2: pathLength (1) -> mode 0, hop count 1. + // Offset 12..13: pathBytes [0x12, 0x34] (1 hop * 2 bytes/hop) + final pushTraceFrame = Uint8List(16); + pushTraceFrame[0] = pushCodeTraceData; + pushTraceFrame[1] = 0; // reserved + pushTraceFrame[2] = 1; // pathLength encoded (mode 0, 1 hop) + pushTraceFrame[3] = 0; // flag + pushTraceFrame.setRange(4, 8, tag); + pushTraceFrame.setRange(12, 14, [0x12, 0x34]); // pathBytes + pushTraceFrame.setRange(14, 16, [12, 16]); // SNR bytes + + connector.emitFrame(pushTraceFrame); + for (int i = 0; i < 5; i++) { + await tester.pump(const Duration(milliseconds: 100)); + } + + // Verify it parsed correctly (should not show the unavailable message) + expect(find.text('Path trace not available.'), findsNothing); + }); +} diff --git a/test/services/path_history_service_test.dart b/test/services/path_history_service_test.dart index 87ae729d..3ea6acf1 100644 --- a/test/services/path_history_service_test.dart +++ b/test/services/path_history_service_test.dart @@ -549,12 +549,15 @@ void main() { final pubKey = _hex('w004'); await _seed(svc, pubKey, pathBytes: [0x01], hopCount: 1, weight: 0.3); - svc.recordPathResult( - pubKey, - const PathSelection(pathBytes: [0x01], hopCount: 1, useFlood: false), - success: false, - failureDecrement: 0.5, // 0.3 - 0.5 = -0.2 → remove - ); + // The service requires failureCount >= 3 to remove a path + for (int i = 0; i < 3; i++) { + svc.recordPathResult( + pubKey, + const PathSelection(pathBytes: [0x01], hopCount: 1, useFlood: false), + success: false, + failureDecrement: 0.5, // 0.3 - 0.5 = -0.2 → remove + ); + } await _flush(); final paths = svc.getRecentPaths(pubKey); diff --git a/untranslated.json b/untranslated.json index 9e26dfee..14f7f7cc 100644 --- a/untranslated.json +++ b/untranslated.json @@ -1 +1,566 @@ -{} \ No newline at end of file +{ + "bg": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "de": [ + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "es": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "fr": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "hu": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "it": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "ja": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "ko": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "nl": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "pl": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "pt": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "ru": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "sk": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "sl": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "sv": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "uk": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ], + + "zh": [ + "settings_regionSettings", + "settings_regionSettingsSubtitle", + "settings_regionManagement_screenTitle", + "settings_regionNameHint", + "settings_regionAddRegion", + "settings_regionFetchRegions", + "settings_regionFetchRegionsFail", + "settings_regionFetchRegionsAlreadyExists", + "settings_regionName", + "settings_regionDeleted", + "settings_deleteRegion", + "settings_deleteRegionConfirm", + "repeater_pathHashModeOption0", + "repeater_pathHashModeOption1", + "repeater_pathHashModeOption2", + "repeater_pathHashModeOption3", + "channels_regionSetTo", + "channels_regionNotSet", + "channels_regionSelect_Title", + "channels_clearRegion", + "chat_receivedGif", + "repeater_keySettings", + "repeater_keySettingsSubtitle", + "repeater_prvKey", + "repeater_prvKeyHelper", + "repeater_generatePrvKey", + "repeater_stopGeneratingPrvKey", + "repeater_pubKey", + "repeater_pubKeyHelper", + "repeater_pubKeyPrefix", + "repeater_pubKeyPrefixHelper" + ] +}