Fix store-and-forward duplicate message delivery and timestamp ordering

- Add tracking to prevent sending cached messages multiple times to the same peer
- Only cache messages for offline favorites, not online ones
- Sort messages by timestamp when adding to ensure proper chronological order
- Clean up tracking sets when peers disconnect to allow re-sending on reconnect
- Cache our own messages when sending to offline favorites
- Update favorite online notification text to "wanna get in there?"
This commit is contained in:
jack
2025-07-04 15:02:49 +02:00
parent 3c894bcb2f
commit a569b87a18
3 changed files with 61 additions and 13 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ class NotificationService {
func sendFavoriteOnlineNotification(nickname: String) {
let title = "\(nickname) is online"
let body = "Your favorite peer just joined the chat"
let body = "wanna get in there?"
let identifier = "favorite-online-\(UUID().uuidString)"
sendLocalNotification(title: title, body: body, identifier: identifier)