Warn when the node reports contact storage is full

This commit is contained in:
Hacuchino-hash committed 2026-08-07 08:02:01 -05:00
1 parent 98f6cf3745
commit 966c5d74cc
23 files changed
+119

No files matched your search

+14
View File
@@ -271,6 +271,7 @@ class MeshCoreConnector extends ChangeNotifier {
bool _batteryRequested = false;
bool _awaitingSelfInfo = false;
bool _hasReceivedDeviceInfo = false;
bool _contactsFull = false;
// Initial sync is serialized for predictable progress. Firmware exposes one
// FIFO queued-message stream, so direct/room frames are buffered until after
// contacts are known.
@@ -459,6 +460,7 @@ class MeshCoreConnector extends ChangeNotifier {
Uint8List? get selfPublicKey => _selfPublicKey;
String get selfPublicKeyHex => pubKeyToHex(_selfPublicKey ?? Uint8List(0));
String? get selfName => _selfName;
bool get contactsFull => _contactsFull;
double? get selfLatitude => _selfLatitude;
double? get selfLongitude => _selfLongitude;
List<DirectRepeater> get directRepeaters => _directRepeaters;
@@ -2290,6 +2292,7 @@ class MeshCoreConnector extends ChangeNotifier {
_setState(MeshCoreConnectionState.connected);
if (_shouldGateInitialChannelSync) {
_hasReceivedDeviceInfo = false;
_contactsFull = false;
_pendingInitialChannelSync = true;
}
await _startBleInitialSync();
@@ -2581,6 +2584,7 @@ class MeshCoreConnector extends ChangeNotifier {
_selfInfoRetryTimer?.cancel();
_selfInfoRetryTimer = null;
_hasReceivedDeviceInfo = false;
_contactsFull = false;
_resetSyncProgressState();
_bleInitialSyncStarted = false;
_pathHashByteWidth = 1;
@@ -2752,6 +2756,7 @@ class MeshCoreConnector extends ChangeNotifier {
_batteryRequested = false;
_awaitingSelfInfo = false;
_hasReceivedDeviceInfo = false;
_contactsFull = false;
_maxContacts = _defaultMaxContacts;
_maxChannels = _defaultMaxChannels;
_resetSyncProgressState();
@@ -4183,6 +4188,11 @@ class MeshCoreConnector extends ChangeNotifier {
case pushCodeAdvert:
// Known contact was seen again - just a pub key, no action needed
break;
case pushCodeContactsFull:
debugPrint('Got CONTACTS_FULL');
_contactsFull = true;
notifyListeners();
break;
case pushCodeNewAdvert:
debugPrint('Got New CONTACT');
// It's the same format as respCodeContact, so we can reuse the handler
@@ -4195,6 +4205,9 @@ class MeshCoreConnector extends ChangeNotifier {
case respCodeEndOfContacts:
debugPrint('Got END_OF_CONTACTS');
_isLoadingContacts = false;
if (_contactsFull && _contacts.length < _maxContacts) {
_contactsFull = false; // capacity freed up since the warning
}
_hasLoadedContacts = true;
_preserveContactsOnRefresh = false;
_contactSyncUsesSinceFilter = false;
@@ -6559,6 +6572,7 @@ class MeshCoreConnector extends ChangeNotifier {
// Preserve deviceId and displayName for UI display during reconnection
// They're only cleared on manual disconnect via disconnect() method
_hasReceivedDeviceInfo = false;
_contactsFull = false;
_maxContacts = _defaultMaxContacts;
_maxChannels = _defaultMaxChannels;
_resetSyncProgressState();
+1
View File
@@ -282,6 +282,7 @@ const int pushCodeNewAdvert = 0x8A;
const int pushCodeTelemetryResponse = 0x8B;
const int pushCodeBinaryResponse = 0x8C;
const int pushCodeControlData = 0x8E;
const int pushCodeContactsFull = 0x90;
// Contact/advertisement types
const int advTypeChat = 1;
+1
View File
@@ -463,6 +463,7 @@
},
"contacts_noUnreadContacts": "No unread contacts",
"contacts_noContactsFound": "No contacts or groups found",
"contacts_storageFull": "Contact storage on the node is full. New nodes cannot be added until contacts are removed.",
"contacts_deleteContact": "Delete Contact",
"contacts_removeConfirm": "Remove {contactName} from contacts?",
"@contacts_removeConfirm": {
+6
View File
@@ -2002,6 +2002,12 @@ abstract class AppLocalizations {
/// **'No contacts or groups found'**
String get contacts_noContactsFound;
/// No description provided for @contacts_storageFull.
///
/// In en, this message translates to:
/// **'Contact storage on the node is full. New nodes cannot be added until contacts are removed.'**
String get contacts_storageFull;
/// No description provided for @contacts_deleteContact.
///
/// In en, this message translates to:
+4
View File
@@ -1067,6 +1067,10 @@ class AppLocalizationsBg extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Няма намерени контакти или групи.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Изтрий Контакт';
+4
View File
@@ -1064,6 +1064,10 @@ class AppLocalizationsDe extends AppLocalizations {
String get contacts_noContactsFound =>
'Keine Kontakte oder Gruppen gefunden.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Kontakt löschen';
+4
View File
@@ -1045,6 +1045,10 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get contacts_noContactsFound => 'No contacts or groups found';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Delete Contact';
+4
View File
@@ -1061,6 +1061,10 @@ class AppLocalizationsEs extends AppLocalizations {
String get contacts_noContactsFound =>
'No se encontraron contactos ni grupos.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Eliminar contacto';
+4
View File
@@ -1065,6 +1065,10 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Aucun contact ou groupe trouvé.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Supprimer le contact';
+4
View File
@@ -1057,6 +1057,10 @@ class AppLocalizationsHu extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Nem található névjegy vagy csoport';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Névjegy törlése';
+4
View File
@@ -1063,6 +1063,10 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Nessun contatto o gruppo trovato.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Elimina Contatto';
+4
View File
@@ -1006,6 +1006,10 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get contacts_noContactsFound => '連絡先またはグループは見つかりませんでした。';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => '連絡先を削除';
+4
View File
@@ -1009,6 +1009,10 @@ class AppLocalizationsKo extends AppLocalizations {
@override
String get contacts_noContactsFound => '연락처 또는 그룹이 검색되지 않았습니다.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => '연락처 삭제';
+4
View File
@@ -1055,6 +1055,10 @@ class AppLocalizationsNl extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Geen contacten of groepen gevonden.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Verwijder Contact';
+4
View File
@@ -1073,6 +1073,10 @@ class AppLocalizationsPl extends AppLocalizations {
String get contacts_noContactsFound =>
'Brak znalezionych kontaktów ani grup.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Usuń Kontakt';
+4
View File
@@ -1063,6 +1063,10 @@ class AppLocalizationsPt extends AppLocalizations {
String get contacts_noContactsFound =>
'Não foram encontrados contatos ou grupos.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Excluir Contato';
+4
View File
@@ -1064,6 +1064,10 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Контакты или группы не найдены';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Удалить контакт';
+4
View File
@@ -1052,6 +1052,10 @@ class AppLocalizationsSk extends AppLocalizations {
String get contacts_noContactsFound =>
'Neboli nájdených žiadnych kontaktov ani skupiny.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Odstrániť kontakt';
+4
View File
@@ -1052,6 +1052,10 @@ class AppLocalizationsSl extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Stiki niso najdeni.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Izbriši stik';
+4
View File
@@ -1046,6 +1046,10 @@ class AppLocalizationsSv extends AppLocalizations {
String get contacts_noContactsFound =>
'Inga kontakter eller grupper hittades.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Ta bort Kontakt';
+4
View File
@@ -1059,6 +1059,10 @@ class AppLocalizationsUk extends AppLocalizations {
@override
String get contacts_noContactsFound => 'Контактів або груп не знайдено.';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => 'Видалити контакт';
+4
View File
@@ -992,6 +992,10 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get contacts_noContactsFound => '未找到任何联系人或群聊';
@override
String get contacts_storageFull =>
'Contact storage on the node is full. New nodes cannot be added until contacts are removed.';
@override
String get contacts_deleteContact => '删除联系人';
+25
View File
@@ -882,6 +882,31 @@ class _ContactsScreenState extends State<ContactsScreen>
],
),
),
if (connector.contactsFull)
Container(
width: double.infinity,
color: Theme.of(context).colorScheme.errorContainer,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
child: Row(
children: [
Icon(
Icons.warning_amber_rounded,
size: 18,
color: Theme.of(context).colorScheme.onErrorContainer,
),
const SizedBox(width: 10),
Expanded(
child: Text(
context.l10n.contacts_storageFull,
style: TextStyle(
fontSize: 13,
color: Theme.of(context).colorScheme.onErrorContainer,
),
),
),
],
),
),
Expanded(
child: RefreshIndicator(
onRefresh: () => connector.getContacts(),