Add network availability notifications when bitchatters are nearby

- Show notification when network transitions from empty to having peers
- Single notification per session, resets when network becomes empty
- Background Bluetooth modes enabled for iOS
- Generic message: 'bitchatters nearby\! 1 person around' or 'X people around'
This commit is contained in:
jack
2025-07-22 16:32:07 +02:00
parent cdaa3dadc2
commit 79d9f8ee88
5 changed files with 56 additions and 18 deletions
+9 -1
View File
@@ -77,10 +77,18 @@ class NotificationService {
}
func sendFavoriteOnlineNotification(nickname: String) {
let title = "\(nickname) is online"
let title = "\(nickname) is online!"
let body = "wanna get in there?"
let identifier = "favorite-online-\(UUID().uuidString)"
sendLocalNotification(title: title, body: body, identifier: identifier)
}
func sendNetworkAvailableNotification(peerCount: Int) {
let title = "👥 bitchatters nearby!"
let body = peerCount == 1 ? "1 person around" : "\(peerCount) people around"
let identifier = "network-available"
sendLocalNotification(title: title, body: body, identifier: identifier)
}
}