Fix peer nickname display once and for all

- Only show peers in UI who have announced (have nicknames)
- Filter out peers without nicknames from getAllConnectedPeerIDs()
- Send announces proactively when app starts, not just on connection
- Send announces immediately when nickname changes via saveNickname()
- Send announces when Bluetooth services become available
- Send announces multiple times (0.5s, 1s, 2s) for reliability
- Add sendBroadcastAnnounce() method for proactive announcing

This ensures peers always see proper nicknames, never 'person-xxx'
This commit is contained in:
jack
2025-07-03 23:38:17 +02:00
parent 7e8c5d0153
commit 34e51b3d9a
2 changed files with 75 additions and 32 deletions
+3
View File
@@ -61,6 +61,9 @@ class ChatViewModel: ObservableObject {
func saveNickname() {
userDefaults.set(nickname, forKey: nicknameKey)
userDefaults.synchronize() // Force immediate save
// Send announce with new nickname to all peers
meshService.sendBroadcastAnnounce()
}
private func loadFavorites() {