Fix: Send device discovery notifications when contact list is full #1369
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: Send device discovery notifications when contact list is full
Problem
When the contact list reached MAX_CONTACTS, new device discoveries were ignored and the app was not notified. This behavior is particularly frustrating for new users who miss out on mesh discovery because of a full contacts list.
Solution
When the table is full, create a temporary
ContactInfoand callonDiscoveredContact()to notify the app, matching manual-add mode behavior and sendPUSH_CODE_NEW_ADVERTwith the full contact info allowing the Discovery List to continue to populate.Changes
BaseChatMesh::onAdvertRecv(): Whennum_contacts >= MAX_CONTACTS, create a temporaryContactInfoand callonDiscoveredContact()instead of returning early.MyMesh::onDiscoveredContact(): Remove check for!isAutoAddEnabled()and send full contact ifis_newis true.Behavior
ContactInfousingPUSH_CODE_NEW_ADVERTPUSH_CODE_NEW_ADVERT(existing behavior, unchanged)Connection checks remain in
onDiscoveredContact().