fix(companion): clear stale Locator/Live Share/favourite refs on delete

Deleting a waypoint left the Locator pointed at coordinates that no longer
existed (it's a coordinate snapshot, so nothing noticed). Removing a contact
was worse: nothing cleared its favourite slot, its Locator/Live Share target,
or its per-contact mute/melody entry, so all four kept referencing a pubkey
that no longer resolved to anything.

- WaypointsView's Delete now calls UITask::clearTargetIfWaypoint() first.
- New AbstractUITask::onContactRemoved() hook, called from MyMesh.cpp's
  CMD_REMOVE_CONTACT handler, clears the favourite slot, the Locator target,
  and dm_notif/dm_melody entries for that pubkey. Live Share's DM target
  turns auto-share off instead of guessing a new recipient.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-26 17:48:05 +02:00
co-authored by Claude Sonnet 4.6
parent 50cd56cd0c
commit 5c4607cca9
5 changed files with 65 additions and 0 deletions
@@ -73,5 +73,9 @@ public:
virtual void onSharedLocation(const uint8_t* pub_key, const char* name,
int32_t lat_1e6, int32_t lon_1e6,
uint32_t ts, bool verified) {}
// A contact was removed (companion app / CLI command). Lets UI state that
// references contacts by pubkey (favourite slots, the Locator/Live Share
// target) drop a reference that would otherwise dangle. Default no-op.
virtual void onContactRemoved(const uint8_t* pub_key) {}
virtual void loop() = 0;
};