Default discovered-contact eviction on and harden the auto-add dialog

- Default evictDiscoveredContactsEnabled to true so the 500-entry cap stays
  in effect unless the user opts out
- Evict until under the cap when adding, so an oversized list recovers
- Pass the cap into the localized subtitle instead of hard-coding 500
- Fix German title and subtitle wording
- Save: block double taps, send radio config first, show an error if
  persisting the setting fails
- Restore untranslated.json to match dev
This commit is contained in:
zjs81 committed 2026-10-07 21:12:59 -07:00
1 parent 956c779e2c
commit ef53b8f390
26 files changed
+130 -223

No files matched your search

+37 -20
View File
@@ -1234,6 +1234,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
final appSettingsService = context.read<AppSettingsService>();
bool evictDiscoveredContactsEnabled =
appSettingsService.settings.evictDiscoveredContactsEnabled;
bool saving = false;
final connector = context.read<MeshCoreConnector>();
autoAddChat = connector.autoAddUsers ?? false;
@@ -1298,8 +1299,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
const Divider(height: 4),
FeatureToggleRow(
title: l10n.contactsSettings_evictDiscoveredContactsTitle,
subtitle:
l10n.contactsSettings_evictDiscoveredContactsSubtitle,
subtitle: l10n
.contactsSettings_evictDiscoveredContactsSubtitle(
MeshCoreConnector.maxDiscoveredContacts,
),
value: evictDiscoveredContactsEnabled,
onChanged: (value) {
setDialogState(
@@ -1316,24 +1319,38 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Text(l10n.common_cancel),
),
TextButton(
onPressed: () async {
await appSettingsService.setEvictDiscoveredContactsEnabled(
evictDiscoveredContactsEnabled,
);
if (evictDiscoveredContactsEnabled) {
await connector.trimDiscoveredContactsToLimit();
}
_sendSettings(
connector,
autoAddChat,
autoAddRepeater,
autoAddRoomServer,
autoAddSensor,
overwriteOldest,
);
if (!context.mounted) return;
Navigator.pop(context);
},
onPressed: saving
? null
: () async {
setDialogState(() => saving = true);
_sendSettings(
connector,
autoAddChat,
autoAddRepeater,
autoAddRoomServer,
autoAddSensor,
overwriteOldest,
);
try {
await appSettingsService
.setEvictDiscoveredContactsEnabled(
evictDiscoveredContactsEnabled,
);
if (evictDiscoveredContactsEnabled) {
await connector.trimDiscoveredContactsToLimit();
}
} catch (e) {
if (!context.mounted) return;
showDismissibleSnackBar(
context,
content: Text(l10n.settings_error(e.toString())),
);
setDialogState(() => saving = false);
return;
}
if (!context.mounted) return;
Navigator.pop(context);
},
child: Text(l10n.common_save),
),
],