Merge pull request #702 from celsoazevedo/contact-settings-hop-limit

Contact Settings: add Hop limit
This commit is contained in:
zjs81 authored and GitHub committed 2026-11-23 20:31:44 -07:00
commit 009dfed2ec
46 files changed
+628 -1

No files matched your search

+1
View File
@@ -124,6 +124,7 @@ Icon sizes in use: 24 for tile and banner icons, 20 for menu icons and small act
| Switch that reveals more controls | `SettingsReveal` | 200ms height ease, `surfaceContainerHighest`, 16px start indent. See [Reveal on enable](#reveal-on-enable) |
| Settings slider | `SettingsValueSlider` | Requires a 24px `icon` (`ListTile.leading`). The title includes the selected number, so it stays visible. The drag bubble repeats it |
| Read-only value in a settings row | 24px `onSurfaceVariant` icon, title (`meshTileTitleStyle`), the value on its own line in `MeshTheme.mono` 15 w500 `onSurface`, subtitle `bodyMedium` `onSurfaceVariant` | Same value style as the Settings device info card; not `StatTile`, which is for status screens (Node Name message length) |
| Settings choice from a long list | `ListTile` with a 24px `leading` icon, title and subtitle, and a `DropdownButtonFormField` under the subtitle | Same row shape as `SettingsValueSlider`; no label or helper inside the field (Hop limit in Contact Settings) |
| Settings saved to a radio | `SaveToRadioPage(title:, hasChanges:, onSave:, children:)` | See [Settings pages](#settings-pages). A custom scaffold uses `UnsavedChangesGuard` + `SaveChangesAction` |
| Section explanation | `SectionHeader(label, description:)` | One or two short sentences in `bodyMedium` `onSurfaceVariant` under the label, for a note that belongs to one section (Node Name, Location) |
| Option that needs a longer explanation | `MeshCard(padding: EdgeInsets.zero)`: explanation text, `Divider(height: 1, indent: 16, endIndent: 16)`, the switch row, divider, optional note | Text in `bodyMedium` `onSurfaceVariant`, padding 16 / 14, so it reads like tile subtitles. The dividers are inset on both sides to match the text (Off-Grid Repeat Mode) |
+1
View File
@@ -92,6 +92,7 @@ The location is shown on the map, used when you share your location, and sent in
- **Auto-add contacts**: users, repeaters, room servers and sensors. Newly heard nodes of the enabled types are added to the radio's contacts; others can be added later from Discovered Contacts
- **Contact List Limits**:
- **Overwrite oldest** (radio): when the radio's contact list is full, the oldest non-favorited contact is replaced
- **Hop limit** (radio): dropdown with No limit (default), 1 (direct only) and 2-64. The radio only auto-adds contacts heard in fewer hops than this; contacts beyond it still appear in Discovered Contacts. Only shown when the firmware reports the setting
- **Limit discovered contacts** (app, not the radio; saved with the rest): keeps up to 500 discovered contacts, removing the ones heard longest ago. When off, there's no limit
### Privacy
+3
View File
@@ -2142,6 +2142,9 @@
"discoveredContacts_importSummary": "Импортирани: {imported}, пропуснати вече известни: {skipped}, нечетими записи: {invalid}.",
"discoveredContacts_importTooLarge": "Файлът за импортиране е твърде голям (максимум {maxMb} MB).",
"contactsSettings_overwriteOldestSubtitle": "Когато списъкът с контакти на радиото е пълен, най-старият контакт извън любимите се заменя.",
"contactsSettings_hopLimit": "Ограничение на скоковете",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Без ограничение} =1{1 (само директно)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Радиото добавя автоматично само контакти с по-малко скокове от тази стойност. В „Открити контакти“ пак се запазват всички.",
"contactsSettings_evictDiscoveredContactsTitle": "Ограничаване на откритите контакти",
"contactsSettings_evictDiscoveredContactsSubtitle": "Приложението ограничава списъка „Открити контакти“ до {limit} записа. При достигане на лимита по-старите контакти се премахват. Изключете, за да премахнете ограничението.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2975,6 +2975,9 @@
"contactsSettings_autoAddSensorsTitle": "Senzory",
"contactsSettings_overwriteOldestTitle": "Přepisovat nejstarší",
"contactsSettings_overwriteOldestSubtitle": "Když je seznam kontaktů v rádiu plný, nahradí se nejstarší kontakt, který není oblíbený.",
"contactsSettings_hopLimit": "Limit skoků",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Bez omezení} =1{1 (pouze přímo)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Rádio automaticky přidá jen kontakty s menším počtem skoků, než je tato hodnota. Seznam „Objevené kontakty“ přesto uloží všechny.",
"contactsSettings_evictDiscoveredContactsTitle": "Omezit objevené kontakty",
"contactsSettings_evictDiscoveredContactsSubtitle": "Aplikace omezuje seznam „Objevené kontakty“ na {limit} položek. Po dosažení limitu jsou starší kontakty odstraněny. Vypněte pro zrušení limitu.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2231,6 +2231,9 @@
"discoveredContacts_copyContact": "Kontakt in die Zwischenablage kopieren",
"contactsSettings_overwriteOldestTitle": "Ältesten überschreiben",
"contactsSettings_overwriteOldestSubtitle": "Wenn die Kontaktliste des Funkgeräts voll ist, den ältesten Kontakt ersetzen, der kein Favorit ist.",
"contactsSettings_hopLimit": "Sprunglimit",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Kein Limit} =1{1 (nur direkt)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Das Funkgerät fügt nur Kontakte mit weniger Sprüngen als diesem Wert automatisch hinzu. Unter „Entdeckte Kontakte“ werden trotzdem alle gespeichert.",
"contactsSettings_evictDiscoveredContactsTitle": "Entdeckte Kontakte begrenzen",
"contactsSettings_evictDiscoveredContactsSubtitle": "Die App begrenzt die Liste „Entdeckte Kontakte“ auf {limit} Einträge. Ist das Limit erreicht, werden ältere Kontakte entfernt. Deaktivieren, um das Limit aufzuheben.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+10
View File
@@ -3287,6 +3287,16 @@
"contactsSettings_autoAddSensorsTitle": "Sensors",
"contactsSettings_overwriteOldestTitle": "Overwrite oldest",
"contactsSettings_overwriteOldestSubtitle": "Replace the oldest non-favorited contact when the radio's contact list is full.",
"contactsSettings_hopLimit": "Hop limit",
"contactsSettings_hopLimitOption": "{hops, plural, =0{No limit} =1{1 (direct only)} other{{hops}}}",
"@contactsSettings_hopLimitOption": {
"placeholders": {
"hops": {
"type": "int"
}
}
},
"contactsSettings_hopLimitSubtitle": "The radio only auto-adds contacts under this many hops. Discovered Contacts still saves them all.",
"contactsSettings_evictDiscoveredContactsTitle": "Limit discovered contacts",
"contactsSettings_evictDiscoveredContactsSubtitle": "The app sets a {limit} entry limit to the discovered contacts list, older contacts are evicted when the limit is reached. Disable to have no limits.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2162,6 +2162,9 @@
"discoveredContacts_searchHint": "Buscar contactos descubiertos",
"discoveredContacts_addContact": "Agregar contacto",
"contactsSettings_overwriteOldestSubtitle": "Cuando la lista de contactos de la radio esté llena, reemplaza el contacto no favorito más antiguo.",
"contactsSettings_hopLimit": "Límite de saltos",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Sin límite} =1{1 (solo directo)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "La radio solo añade automáticamente contactos con menos saltos que este valor. En Contactos descubiertos se siguen guardando todos.",
"contactsSettings_evictDiscoveredContactsTitle": "Limitar contactos descubiertos",
"contactsSettings_evictDiscoveredContactsSubtitle": "La app limita la lista \"Contactos descubiertos\" a {limit} entradas. Al alcanzar el límite, se eliminan los contactos más antiguos. Desactivar para quitar el límite.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2155,6 +2155,9 @@
"discoveredContacts_Title": "Contacts découverts",
"discoveredContacts_searchHint": "Rechercher des contacts découverts",
"contactsSettings_overwriteOldestSubtitle": "Lorsque la liste de contacts de la radio est pleine, remplace le plus ancien contact non favori.",
"contactsSettings_hopLimit": "Limite de sauts",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Aucune limite} =1{1 (direct uniquement)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "La radio n'ajoute automatiquement que les contacts situés à moins de sauts que cette valeur. Ils sont quand même tous enregistrés dans Contacts découverts.",
"contactsSettings_evictDiscoveredContactsTitle": "Limiter les contacts découverts",
"contactsSettings_evictDiscoveredContactsSubtitle": "L'application limite la liste « Contacts découverts » à {limit} entrées. Une fois la limite atteinte, les contacts les plus anciens sont supprimés. Désactivez pour supprimer la limite.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2227,6 +2227,9 @@
"contactsSettings_autoAddSensorsTitle": "Érzékelők",
"contactsSettings_overwriteOldestTitle": "A legrégebbi felülírása",
"contactsSettings_overwriteOldestSubtitle": "Ha a rádió kapcsolatlistája megtelt, a legrégebbi, nem kedvenc kapcsolat lecserélődik.",
"contactsSettings_hopLimit": "Ugráskorlát",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Nincs korlát} =1{1 (csak közvetlen)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "A rádió csak az ennél kevesebb ugrásra lévő kapcsolatokat adja hozzá automatikusan. A „Felfedezett kapcsolatok” lista továbbra is mindet elmenti.",
"contactsSettings_evictDiscoveredContactsTitle": "Felfedezett kapcsolatok korlátozása",
"contactsSettings_evictDiscoveredContactsSubtitle": "Az alkalmazás a „Felfedezett kapcsolatok” listát {limit} bejegyzésre korlátozza. A korlát elérésekor a régebbi kapcsolatok törlődnek. Kikapcsolva nincs korlát.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2204,6 +2204,9 @@
}
},
"contactsSettings_overwriteOldestSubtitle": "Quando l'elenco dei contatti della radio è pieno, sostituisce il contatto più vecchio non tra i preferiti.",
"contactsSettings_hopLimit": "Limite di salti",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Nessun limite} =1{1 (solo diretto)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "La radio aggiunge automaticamente solo i contatti con meno salti di questo valore. In Contatti scoperti vengono comunque salvati tutti.",
"contactsSettings_evictDiscoveredContactsTitle": "Limita i contatti scoperti",
"contactsSettings_evictDiscoveredContactsSubtitle": "L'app limita l'elenco \"Contatti scoperti\" a {limit} voci. Al raggiungimento del limite, i contatti più vecchi vengono rimossi. Disattiva per rimuovere il limite.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2237,6 +2237,9 @@
"contactsSettings_autoAddSensorsTitle": "センサー",
"contactsSettings_overwriteOldestTitle": "最も古い連絡先を上書き",
"contactsSettings_overwriteOldestSubtitle": "ラジオの連絡先リストが満杯になったら、お気に入り以外で最も古い連絡先を置き換えます。",
"contactsSettings_hopLimit": "ホップ数の上限",
"contactsSettings_hopLimitOption": "{hops, plural, =0{制限なし} =1{1(直接のみ)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "ラジオはこの値より少ないホップ数の連絡先のみ自動追加します。「連絡先が見つかった」にはすべて保存されます。",
"contactsSettings_evictDiscoveredContactsTitle": "発見された連絡先を制限",
"contactsSettings_evictDiscoveredContactsSubtitle": "アプリは「連絡先が見つかった」リストを {limit} 件に制限します。上限に達すると古い連絡先から削除されます。オフにすると上限はなくなります。",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2142,6 +2142,9 @@
"contactsSettings_autoAddSensorsTitle": "센서",
"contactsSettings_overwriteOldestTitle": "가장 오래된 연락처 덮어쓰기",
"contactsSettings_overwriteOldestSubtitle": "라디오의 연락처 목록이 가득 차면 즐겨찾기가 아닌 가장 오래된 연락처를 교체합니다.",
"contactsSettings_hopLimit": "홉 수 제한",
"contactsSettings_hopLimitOption": "{hops, plural, =0{제한 없음} =1{1 (직접 연결만)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "라디오는 이 값보다 적은 홉의 연락처만 자동 추가합니다. '연락처 찾기'에는 모두 저장됩니다.",
"contactsSettings_evictDiscoveredContactsTitle": "발견된 연락처 제한",
"contactsSettings_evictDiscoveredContactsSubtitle": "앱은 \"연락처 찾기\" 목록을 {limit}개 항목으로 제한합니다. 한도에 도달하면 오래된 연락처부터 삭제됩니다. 끄면 제한이 없습니다.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+18
View File
@@ -10025,6 +10025,24 @@ abstract class AppLocalizations {
/// **'Replace the oldest non-favorited contact when the radio\'s contact list is full.'**
String get contactsSettings_overwriteOldestSubtitle;
/// No description provided for @contactsSettings_hopLimit.
///
/// In en, this message translates to:
/// **'Hop limit'**
String get contactsSettings_hopLimit;
/// No description provided for @contactsSettings_hopLimitOption.
///
/// In en, this message translates to:
/// **'{hops, plural, =0{No limit} =1{1 (direct only)} other{{hops}}}'**
String contactsSettings_hopLimitOption(int hops);
/// No description provided for @contactsSettings_hopLimitSubtitle.
///
/// In en, this message translates to:
/// **'The radio only auto-adds contacts under this many hops. Discovered Contacts still saves them all.'**
String get contactsSettings_hopLimitSubtitle;
/// No description provided for @contactsSettings_evictDiscoveredContactsTitle.
///
/// In en, this message translates to:
+19
View File
@@ -5909,6 +5909,25 @@ class AppLocalizationsBg extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Когато списъкът с контакти на радиото е пълен, най-старият контакт извън любимите се заменя.';
@override
String get contactsSettings_hopLimit => 'Ограничение на скоковете';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (само директно)',
zero: 'Без ограничение',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Радиото добавя автоматично само контакти с по-малко скокове от тази стойност. В „Открити контакти“ пак се запазват всички.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Ограничаване на откритите контакти';
+19
View File
@@ -5888,6 +5888,25 @@ class AppLocalizationsCs extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Když je seznam kontaktů v rádiu plný, nahradí se nejstarší kontakt, který není oblíbený.';
@override
String get contactsSettings_hopLimit => 'Limit skoků';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (pouze přímo)',
zero: 'Bez omezení',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Rádio automaticky přidá jen kontakty s menším počtem skoků, než je tato hodnota. Seznam „Objevené kontakty“ přesto uloží všechny.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Omezit objevené kontakty';
+19
View File
@@ -5920,6 +5920,25 @@ class AppLocalizationsDe extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Wenn die Kontaktliste des Funkgeräts voll ist, den ältesten Kontakt ersetzen, der kein Favorit ist.';
@override
String get contactsSettings_hopLimit => 'Sprunglimit';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (nur direkt)',
zero: 'Kein Limit',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Das Funkgerät fügt nur Kontakte mit weniger Sprüngen als diesem Wert automatisch hinzu. Unter „Entdeckte Kontakte“ werden trotzdem alle gespeichert.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Entdeckte Kontakte begrenzen';
+19
View File
@@ -5828,6 +5828,25 @@ class AppLocalizationsEn extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Replace the oldest non-favorited contact when the radio\'s contact list is full.';
@override
String get contactsSettings_hopLimit => 'Hop limit';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (direct only)',
zero: 'No limit',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'The radio only auto-adds contacts under this many hops. Discovered Contacts still saves them all.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Limit discovered contacts';
+19
View File
@@ -5909,6 +5909,25 @@ class AppLocalizationsEs extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Cuando la lista de contactos de la radio esté llena, reemplaza el contacto no favorito más antiguo.';
@override
String get contactsSettings_hopLimit => 'Límite de saltos';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (solo directo)',
zero: 'Sin límite',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'La radio solo añade automáticamente contactos con menos saltos que este valor. En Contactos descubiertos se siguen guardando todos.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Limitar contactos descubiertos';
+19
View File
@@ -5923,6 +5923,25 @@ class AppLocalizationsFr extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Lorsque la liste de contacts de la radio est pleine, remplace le plus ancien contact non favori.';
@override
String get contactsSettings_hopLimit => 'Limite de sauts';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (direct uniquement)',
zero: 'Aucune limite',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'La radio n\'ajoute automatiquement que les contacts situés à moins de sauts que cette valeur. Ils sont quand même tous enregistrés dans Contacts découverts.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Limiter les contacts découverts';
+19
View File
@@ -5907,6 +5907,25 @@ class AppLocalizationsHu extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Ha a rádió kapcsolatlistája megtelt, a legrégebbi, nem kedvenc kapcsolat lecserélődik.';
@override
String get contactsSettings_hopLimit => 'Ugráskorlát';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (csak közvetlen)',
zero: 'Nincs korlát',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'A rádió csak az ennél kevesebb ugrásra lévő kapcsolatokat adja hozzá automatikusan. A „Felfedezett kapcsolatok” lista továbbra is mindet elmenti.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Felfedezett kapcsolatok korlátozása';
+19
View File
@@ -5914,6 +5914,25 @@ class AppLocalizationsIt extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Quando l\'elenco dei contatti della radio è pieno, sostituisce il contatto più vecchio non tra i preferiti.';
@override
String get contactsSettings_hopLimit => 'Limite di salti';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (solo diretto)',
zero: 'Nessun limite',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'La radio aggiunge automaticamente solo i contatti con meno salti di questo valore. In Contatti scoperti vengono comunque salvati tutti.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Limita i contatti scoperti';
+19
View File
@@ -5632,6 +5632,25 @@ class AppLocalizationsJa extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'ラジオの連絡先リストが満杯になったら、お気に入り以外で最も古い連絡先を置き換えます。';
@override
String get contactsSettings_hopLimit => 'ホップ数の上限';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1(直接のみ)',
zero: '制限なし',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'ラジオはこの値より少ないホップ数の連絡先のみ自動追加します。「連絡先が見つかった」にはすべて保存されます。';
@override
String get contactsSettings_evictDiscoveredContactsTitle => '発見された連絡先を制限';
+19
View File
@@ -5642,6 +5642,25 @@ class AppLocalizationsKo extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'라디오의 연락처 목록이 가득 차면 즐겨찾기가 아닌 가장 오래된 연락처를 교체합니다.';
@override
String get contactsSettings_hopLimit => '홉 수 제한';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (직접 연결만)',
zero: '제한 없음',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'라디오는 이 값보다 적은 홉의 연락처만 자동 추가합니다. \'연락처 찾기\'에는 모두 저장됩니다.';
@override
String get contactsSettings_evictDiscoveredContactsTitle => '발견된 연락처 제한';
+19
View File
@@ -5880,6 +5880,25 @@ class AppLocalizationsNl extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Als de contactenlijst van de radio vol is, het oudste contact vervangen dat geen favoriet is.';
@override
String get contactsSettings_hopLimit => 'Hoplimiet';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (alleen direct)',
zero: 'Geen limiet',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'De radio voegt alleen contacten met minder hops dan deze waarde automatisch toe. In Ontdekte contacten worden ze nog steeds allemaal opgeslagen.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Ontdekte contacten beperken';
+19
View File
@@ -5950,6 +5950,25 @@ class AppLocalizationsPl extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Gdy lista kontaktów w radiu jest pełna, najstarszy kontakt spoza ulubionych zostanie zastąpiony.';
@override
String get contactsSettings_hopLimit => 'Limit skoków';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (tylko bezpośrednio)',
zero: 'Bez limitu',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Radio automatycznie dodaje tylko kontakty z mniejszą liczbą skoków niż ta wartość. Lista „Odkryte Kontakty” nadal zapisuje wszystkie.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Ogranicz odkryte kontakty';
+38
View File
@@ -5905,6 +5905,25 @@ class AppLocalizationsPt extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Quando a lista de contatos do rádio estiver cheia, substitui o contato mais antigo que não seja favorito.';
@override
String get contactsSettings_hopLimit => 'Limite de saltos';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (somente direto)',
zero: 'Sem limite',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'O rádio só adiciona automaticamente contatos com menos saltos que este valor. Todos continuam sendo salvos em Contatos Descobertos.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Limitar contatos descobertos';
@@ -14151,6 +14170,25 @@ class AppLocalizationsPtPt extends AppLocalizationsPt {
String get contactsSettings_overwriteOldestSubtitle =>
'Quando a lista de contactos do rádio estiver cheia, substitui o contacto mais antigo que não seja favorito.';
@override
String get contactsSettings_hopLimit => 'Limite de hops';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (apenas direto)',
zero: 'Sem limite',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'O rádio só adiciona automaticamente contactos com menos hops do que este valor. Todos continuam a ser guardados em Contactos descobertos.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Limitar contactos descobertos';
+19
View File
@@ -5926,6 +5926,25 @@ class AppLocalizationsRu extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Когда список контактов радио заполнен, заменяется самый старый контакт не из избранного.';
@override
String get contactsSettings_hopLimit => 'Лимит хопов';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (только напрямую)',
zero: 'Без лимита',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Радио автоматически добавляет только контакты, до которых меньше хопов, чем это значение. В списке «Обнаруженные контакты» по-прежнему сохраняются все.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Ограничивать обнаруженные контакты';
+19
View File
@@ -5903,6 +5903,25 @@ class AppLocalizationsSk extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Keď je zoznam kontaktov v rádiu plný, nahradí sa najstarší kontakt, ktorý nie je obľúbený.';
@override
String get contactsSettings_hopLimit => 'Limit skokov';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (iba priamo)',
zero: 'Bez obmedzenia',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Rádio automaticky pridá iba kontakty s menším počtom skokov, než je táto hodnota. Zoznam „Objavené kontakty“ aj tak uloží všetky.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Obmedziť objavené kontakty';
+19
View File
@@ -5893,6 +5893,25 @@ class AppLocalizationsSl extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Ko je seznam stikov v radiu poln, se zamenja najstarejši stik, ki ni med priljubljenimi.';
@override
String get contactsSettings_hopLimit => 'Omejitev skokov';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (samo neposredno)',
zero: 'Brez omejitve',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Radio avtomatsko doda le stike z manj skoki od te vrednosti. Seznam »Odkriti stiki« še vedno shrani vse.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Omeji odkrite stike';
+19
View File
@@ -5861,6 +5861,25 @@ class AppLocalizationsSv extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'När radions kontaktlista är full ersätts den äldsta kontakten som inte är en favorit.';
@override
String get contactsSettings_hopLimit => 'Hoppgräns';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (endast direkt)',
zero: 'Ingen gräns',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Radion lägger bara till kontakter automatiskt om de har färre hopp än detta värde. Alla sparas ändå i Upptäckta kontakter.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Begränsa upptäckta kontakter';
+19
View File
@@ -5931,6 +5931,25 @@ class AppLocalizationsUk extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'Коли список контактів радіо заповнений, замінюється найстаріший контакт, якого немає в улюблених.';
@override
String get contactsSettings_hopLimit => 'Ліміт переходів';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1 (лише напряму)',
zero: 'Без ліміту',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'Радіо автоматично додає лише контакти, до яких менше переходів, ніж це значення. У списку «Виявлені контакти» й надалі зберігаються всі.';
@override
String get contactsSettings_evictDiscoveredContactsTitle =>
'Обмежувати виявлені контакти';
+19
View File
@@ -5504,6 +5504,25 @@ class AppLocalizationsZh extends AppLocalizations {
String get contactsSettings_overwriteOldestSubtitle =>
'无线电的联系人列表已满时,替换最旧的非收藏联系人。';
@override
String get contactsSettings_hopLimit => '跳数限制';
@override
String contactsSettings_hopLimitOption(int hops) {
String _temp0 = intl.Intl.pluralLogic(
hops,
locale: localeName,
other: '$hops',
one: '1(仅直连)',
zero: '不限',
);
return '$_temp0';
}
@override
String get contactsSettings_hopLimitSubtitle =>
'无线电只会自动添加跳数少于此值的联系人。“已发现的联系人”中仍会保存全部。';
@override
String get contactsSettings_evictDiscoveredContactsTitle => '限制已发现的联系人';
+3
View File
@@ -2180,6 +2180,9 @@
}
},
"contactsSettings_overwriteOldestSubtitle": "Als de contactenlijst van de radio vol is, het oudste contact vervangen dat geen favoriet is.",
"contactsSettings_hopLimit": "Hoplimiet",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Geen limiet} =1{1 (alleen direct)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "De radio voegt alleen contacten met minder hops dan deze waarde automatisch toe. In Ontdekte contacten worden ze nog steeds allemaal opgeslagen.",
"contactsSettings_evictDiscoveredContactsTitle": "Ontdekte contacten beperken",
"contactsSettings_evictDiscoveredContactsSubtitle": "De app beperkt de lijst \"Ontdekte contacten\" tot {limit} items. Bij het bereiken van de limiet worden oudere contacten verwijderd. Schakel uit om de limiet op te heffen.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2180,6 +2180,9 @@
"discoveredContacts_importSummary": "Zaimportowano: {imported}, pominięto już znane: {skipped}, nieczytelne wpisy: {invalid}.",
"discoveredContacts_importTooLarge": "Plik importu jest zbyt duży (maksymalnie {maxMb} MB).",
"contactsSettings_overwriteOldestSubtitle": "Gdy lista kontaktów w radiu jest pełna, najstarszy kontakt spoza ulubionych zostanie zastąpiony.",
"contactsSettings_hopLimit": "Limit skoków",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Bez limitu} =1{1 (tylko bezpośrednio)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Radio automatycznie dodaje tylko kontakty z mniejszą liczbą skoków niż ta wartość. Lista „Odkryte Kontakty” nadal zapisuje wszystkie.",
"contactsSettings_evictDiscoveredContactsTitle": "Ogranicz odkryte kontakty",
"contactsSettings_evictDiscoveredContactsSubtitle": "Aplikacja ogranicza listę „Odkryte Kontakty” do {limit} pozycji. Po osiągnięciu limitu starsze kontakty są usuwane. Wyłącz, aby znieść limit.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2073,6 +2073,9 @@
}
},
"contactsSettings_overwriteOldestSubtitle": "Quando a lista de contatos do rádio estiver cheia, substitui o contato mais antigo que não seja favorito.",
"contactsSettings_hopLimit": "Limite de saltos",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Sem limite} =1{1 (somente direto)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "O rádio só adiciona automaticamente contatos com menos saltos que este valor. Todos continuam sendo salvos em Contatos Descobertos.",
"contactsSettings_evictDiscoveredContactsTitle": "Limitar contatos descobertos",
"contactsSettings_evictDiscoveredContactsSubtitle": "O app limita a lista \"Contatos Descobertos\" a {limit} entradas. Ao atingir o limite, os contatos mais antigos são removidos. Desative para remover o limite.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -1610,6 +1610,9 @@
"contactsSettings_autoAddSensorsTitle": "Sensores",
"contactsSettings_overwriteOldestTitle": "Substituir o mais antigo",
"contactsSettings_overwriteOldestSubtitle": "Quando a lista de contactos do rádio estiver cheia, substitui o contacto mais antigo que não seja favorito.",
"contactsSettings_hopLimit": "Limite de hops",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Sem limite} =1{1 (apenas direto)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "O rádio só adiciona automaticamente contactos com menos hops do que este valor. Todos continuam a ser guardados em Contactos descobertos.",
"contactsSettings_evictDiscoveredContactsTitle": "Limitar contactos descobertos",
"contactsSettings_evictDiscoveredContactsSubtitle": "A app limita a lista \"Contactos descobertos\" a {limit} entradas. Ao atingir o limite, os contactos mais antigos são removidos. Desative para remover o limite.",
"discoveredContacts_Title": "Contactos descobertos",
+3
View File
@@ -1321,6 +1321,9 @@
"discoveredContacts_importSummary": "Импортировано: {imported}, пропущено уже известных: {skipped}, нечитаемых записей: {invalid}.",
"discoveredContacts_importTooLarge": "Файл импорта слишком большой (максимум {maxMb} МБ).",
"contactsSettings_overwriteOldestSubtitle": "Когда список контактов радио заполнен, заменяется самый старый контакт не из избранного.",
"contactsSettings_hopLimit": "Лимит хопов",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Без лимита} =1{1 (только напрямую)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Радио автоматически добавляет только контакты, до которых меньше хопов, чем это значение. В списке «Обнаруженные контакты» по-прежнему сохраняются все.",
"contactsSettings_evictDiscoveredContactsTitle": "Ограничивать обнаруженные контакты",
"contactsSettings_evictDiscoveredContactsSubtitle": "Приложение ограничивает список «Обнаруженные контакты» до {limit} записей. При достижении лимита старые контакты удаляются. Отключите, чтобы снять ограничение.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2147,6 +2147,9 @@
}
},
"contactsSettings_overwriteOldestSubtitle": "Keď je zoznam kontaktov v rádiu plný, nahradí sa najstarší kontakt, ktorý nie je obľúbený.",
"contactsSettings_hopLimit": "Limit skokov",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Bez obmedzenia} =1{1 (iba priamo)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Rádio automaticky pridá iba kontakty s menším počtom skokov, než je táto hodnota. Zoznam „Objavené kontakty“ aj tak uloží všetky.",
"contactsSettings_evictDiscoveredContactsTitle": "Obmedziť objavené kontakty",
"contactsSettings_evictDiscoveredContactsSubtitle": "Aplikácia obmedzuje zoznam „Objavené kontakty“ na {limit} položiek. Po dosiahnutí limitu sa staršie kontakty odstránia. Vypnite pre zrušenie limitu.",
"@contactsSettings_evictDiscoveredContactsSubtitle": {
+3
View File
@@ -2073,6 +2073,9 @@
}
},
"contactsSettings_overwriteOldestSubtitle": "Ko je seznam stikov v radiu poln, se zamenja najstarejši stik, ki ni med priljubljenimi.",
"contactsSettings_hopLimit": "Omejitev skokov",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Brez omejitve} =1{1 (samo neposredno)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Radio avtomatsko doda le stike z manj skoki od te vrednosti. Seznam »Odkriti stiki« še vedno shrani vse.",
"contactsSettings_evictDiscoveredContactsTitle": "Omeji odkrite stike",
"contactsSettings_evictDiscoveredContactsSubtitle": "Aplikacija omeji seznam »Odkriti stiki« na {limit} vnosov. Ko je omejitev dosežena, se starejši stiki odstranijo. Izklopite za odpravo omejitve.",
"common_deleteAll": "Izbriši vse",
+3
View File
@@ -2074,6 +2074,9 @@
"discoveredContacts_importSummary": "Importerade: {imported}, hoppade över redan kända: {skipped}, oläsliga poster: {invalid}.",
"discoveredContacts_importTooLarge": "Importfilen är för stor (högst {maxMb} MB).",
"contactsSettings_overwriteOldestSubtitle": "När radions kontaktlista är full ersätts den äldsta kontakten som inte är en favorit.",
"contactsSettings_hopLimit": "Hoppgräns",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Ingen gräns} =1{1 (endast direkt)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Radion lägger bara till kontakter automatiskt om de har färre hopp än detta värde. Alla sparas ändå i Upptäckta kontakter.",
"contactsSettings_evictDiscoveredContactsTitle": "Begränsa upptäckta kontakter",
"contactsSettings_evictDiscoveredContactsSubtitle": "Appen begränsar listan ”Upptäckta kontakter” till {limit} poster. När gränsen nås tas äldre kontakter bort. Stäng av för att ta bort gränsen.",
"common_deleteAll": "Ta bort alla",
+3
View File
@@ -2152,6 +2152,9 @@
"discoveredContacts_importSummary": "Імпортовано: {imported}, пропущено вже відомих: {skipped}, нечитабельних записів: {invalid}.",
"discoveredContacts_importTooLarge": "Файл імпорту завеликий (максимум {maxMb} МБ).",
"contactsSettings_overwriteOldestSubtitle": "Коли список контактів радіо заповнений, замінюється найстаріший контакт, якого немає в улюблених.",
"contactsSettings_hopLimit": "Ліміт переходів",
"contactsSettings_hopLimitOption": "{hops, plural, =0{Без ліміту} =1{1 (лише напряму)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "Радіо автоматично додає лише контакти, до яких менше переходів, ніж це значення. У списку «Виявлені контакти» й надалі зберігаються всі.",
"contactsSettings_evictDiscoveredContactsTitle": "Обмежувати виявлені контакти",
"contactsSettings_evictDiscoveredContactsSubtitle": "Застосунок обмежує список «Виявлені контакти» до {limit} записів. Коли ліміт досягнуто, старіші контакти видаляються. Вимкніть, щоб зняти обмеження.",
"common_deleteAll": "Видалити все",
+3
View File
@@ -2078,6 +2078,9 @@
}
},
"contactsSettings_overwriteOldestSubtitle": "无线电的联系人列表已满时,替换最旧的非收藏联系人。",
"contactsSettings_hopLimit": "跳数限制",
"contactsSettings_hopLimitOption": "{hops, plural, =0{不限} =1{1(仅直连)} other{{hops}}}",
"contactsSettings_hopLimitSubtitle": "无线电只会自动添加跳数少于此值的联系人。“已发现的联系人”中仍会保存全部。",
"contactsSettings_evictDiscoveredContactsTitle": "限制已发现的联系人",
"contactsSettings_evictDiscoveredContactsSubtitle": "应用将“已发现的联系人”列表限制为 {limit} 条。达到上限时会移除较旧的联系人。关闭后不限数量。",
"common_deleteAll": "删除全部",
+10 -1
View File
@@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/foundation.dart';
@@ -66,6 +67,7 @@ class ReviewRadio {
int _txPowerDbm = ReviewScript.txPowerDbm;
int _autoAddFlags =
autoAddChatFlag | autoAddRepeaterFlag | autoAddRoomServerFlag;
int _autoAddMaxHops = 0;
int _timeOffsetSecs = 0;
/// Frames radio to app. Each event is one complete companion frame.
@@ -240,10 +242,17 @@ class ReviewRadio {
_emit([ReviewFrames.customVars('gps:0')]);
break;
case cmdGetAutoAddConfig:
_emit([ReviewFrames.autoAddConfig(flags: _autoAddFlags)]);
_emit([
ReviewFrames.autoAddConfig(
flags: _autoAddFlags,
maxHops: _autoAddMaxHops,
),
]);
break;
case cmdSetAutoAddConfig:
if (frame.length >= 2) _autoAddFlags = frame[1];
// Like firmware: the optional hop limit, capped at 64.
if (frame.length >= 3) _autoAddMaxHops = math.min(frame[2], 64);
_emit([ReviewFrames.ok()]);
break;
case cmdGetAllowedRepeatFreq:
+45
View File
@@ -16,6 +16,7 @@ typedef _ContactForm = ({
bool autoAddRoomServers,
bool autoAddSensors,
bool overwriteOldest,
int? maxHops,
bool evictDiscovered,
});
@@ -33,6 +34,8 @@ class _ContactSettingsScreenState extends State<ContactSettingsScreen> {
late bool _autoAddRoomServers;
late bool _autoAddSensors;
late bool _overwriteOldest;
// Null when the firmware doesn't report a hop limit.
int? _maxHops;
late bool _evictDiscovered;
late _ContactForm _savedForm;
@@ -45,6 +48,7 @@ class _ContactSettingsScreenState extends State<ContactSettingsScreen> {
_autoAddRoomServers = connector.autoAddRoomServers ?? false;
_autoAddSensors = connector.autoAddSensors ?? false;
_overwriteOldest = connector.autoAddOverwriteOldest ?? false;
_maxHops = connector.autoAddMaxHops;
_evictDiscovered = context
.read<AppSettingsService>()
.settings
@@ -58,6 +62,7 @@ class _ContactSettingsScreenState extends State<ContactSettingsScreen> {
autoAddRoomServers: _autoAddRoomServers,
autoAddSensors: _autoAddSensors,
overwriteOldest: _overwriteOldest,
maxHops: _maxHops,
evictDiscovered: _evictDiscovered,
);
@@ -73,6 +78,8 @@ class _ContactSettingsScreenState extends State<ContactSettingsScreen> {
autoAddRoomServer: form.autoAddRoomServers,
autoAddSensor: form.autoAddSensors,
overwriteOldest: form.overwriteOldest,
// Sent only when changed, so the frame is otherwise unchanged.
maxHops: form.maxHops != _savedForm.maxHops ? form.maxHops : null,
),
);
await connector.sendFrame(buildGetAutoAddFlagsFrame());
@@ -168,6 +175,44 @@ class _ContactSettingsScreenState extends State<ContactSettingsScreen> {
value: _overwriteOldest,
onChanged: (v) => _overwriteOldest = v,
),
if (_maxHops != null) ...[
divider,
// Same row shape as SettingsValueSlider: icon, title and
// description, with the dropdown under the description.
ListTile(
contentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 4,
),
leading: const Icon(Icons.linear_scale, size: 24),
title: Text(l10n.contactsSettings_hopLimit),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(l10n.contactsSettings_hopLimitSubtitle),
const SizedBox(height: 8),
DropdownButtonFormField<int>(
initialValue: _maxHops,
isExpanded: true,
// Firmware: 0 = no limit, N = under N hops (max 64).
items: [
for (var hops = 0; hops <= 64; hops++)
DropdownMenuItem(
value: hops,
child: Text(
l10n.contactsSettings_hopLimitOption(hops),
overflow: TextOverflow.ellipsis,
),
),
],
onChanged: (v) {
if (v != null) setState(() => _maxHops = v);
},
),
],
),
),
],
divider,
_switch(
// The Discovered Contacts icon.
@@ -0,0 +1,33 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:meshcore_open/connector/meshcore_protocol.dart';
void main() {
// CMD_SET_AUTOADD_CONFIG: [cmd][flags][autoadd_max_hops?]. Firmware stores
// the third byte (capped at 64) only when it is present.
group('buildSetAutoAddConfigFrame', () {
Iterable<int> frame({int? maxHops}) => buildSetAutoAddConfigFrame(
autoAddChat: true,
autoAddRepeater: false,
autoAddRoomServer: true,
autoAddSensor: false,
overwriteOldest: true,
maxHops: maxHops,
);
const flags =
autoAddChatFlag | autoAddRoomServerFlag | autoAddOverwriteOldestFlag;
test('omits the hop limit when not given', () {
expect(frame(), [cmdSetAutoAddConfig, flags]);
});
test('appends the hop limit, including 0 (no limit)', () {
expect(frame(maxHops: 8), [cmdSetAutoAddConfig, flags, 8]);
expect(frame(maxHops: 0), [cmdSetAutoAddConfig, flags, 0]);
});
test('caps the hop limit at 64', () {
expect(frame(maxHops: 200), [cmdSetAutoAddConfig, flags, 64]);
});
});
}
+73
View File
@@ -37,6 +37,7 @@ final _l10n = AppLocalizationsEn();
MeshCoreConnector? _sharedConnector;
AppSettingsService? _sharedSettings;
final _frameLog = BleDebugLogService();
Future<MeshCoreConnector> _connectedConnector(WidgetTester tester) async {
if (_sharedConnector != null) return _sharedConnector!;
@@ -51,6 +52,7 @@ Future<MeshCoreConnector> _connectedConnector(WidgetTester tester) async {
pathHistoryService: PathHistoryService(storage),
appSettingsService: settings,
translationService: translation,
bleDebugLogService: _frameLog,
);
connector.reviewRadioFactoryForTest = () => ReviewRadio(
scheduledMessageInterval: const Duration(hours: 1),
@@ -338,6 +340,77 @@ void main() {
await tester.pumpWidget(const SizedBox());
});
testWidgets('Contact Settings sends the hop limit and reads it back', (
tester,
) async {
final connector = await _connectedConnector(tester);
final original = connector.autoAddMaxHops;
expect(original, isNotNull, reason: 'review radio reports the hop limit');
await tester.pumpWidget(
_app(connector, _launcher(const ContactSettingsScreen())),
);
await _open(tester);
String option(int hops) => _l10n.contactsSettings_hopLimitOption(hops);
expect(find.text(option(original!)), findsOneWidget);
Future<void> setHops(int hops) async {
final field = find.byType(DropdownButtonFormField<int>);
await tester.ensureVisible(field);
await tester.pumpAndSettle();
await tester.tap(field);
await tester.pumpAndSettle();
// The open menu builds only the rows around the current value.
final item = find.text(option(hops));
await tester.scrollUntilVisible(
item,
hops < connector.autoAddMaxHops! ? -48 : 48,
scrollable: find.byType(Scrollable).last,
);
await tester.pumpAndSettle();
await tester.tap(item.last);
await tester.pumpAndSettle();
await tester.tap(_saveAction);
await _waitFor(tester, () => connector.autoAddMaxHops == hops);
}
// The last frame of [code] the app sent to the radio.
List<int> lastSent(int code) => _frameLog.entries
.lastWhere((e) => e.outgoing && e.payload.first == code)
.payload;
int sentCount(int code) => _frameLog.entries
.where((e) => e.outgoing && e.payload.first == code)
.length;
final fetchesBefore = sentCount(cmdGetAutoAddConfig);
await setHops(8);
expect(connector.autoAddMaxHops, 8);
expect(find.text(option(8)), findsOneWidget);
expect(_saveAction, findsNothing);
// [CMD_SET_AUTOADD_CONFIG][flags][max hops], then a fetch to read it back.
expect(lastSent(cmdSetAutoAddConfig), hasLength(3));
expect(lastSent(cmdSetAutoAddConfig).last, 8);
expect(sentCount(cmdGetAutoAddConfig), fetchesBefore + 1);
// Changing only another setting sends the old two-byte frame.
final overwrite = find.text(_l10n.contactsSettings_overwriteOldestTitle);
for (var i = 0; i < 2; i++) {
await tester.ensureVisible(overwrite);
await tester.pumpAndSettle();
await tester.tap(overwrite);
await tester.pump();
await tester.tap(_saveAction);
await _waitFor(tester, () => _saveAction.evaluate().isEmpty);
expect(lastSent(cmdSetAutoAddConfig), hasLength(2));
}
expect(connector.autoAddMaxHops, 8);
await setHops(original);
expect(connector.autoAddMaxHops, original);
expect(lastSent(cmdSetAutoAddConfig), hasLength(3));
expect(lastSent(cmdSetAutoAddConfig).last, original);
await tester.pumpWidget(const SizedBox());
});
testWidgets('Node Name counts bytes and saves to the radio', (tester) async {
final connector = await _connectedConnector(tester);
final originalName = connector.selfName!;