Reduce notification timing for better UX

- Network empty reset delay: 5 min → 1 min
- Notification cooldown: 10 min → 5 min
- More responsive when peers drop and rejoin
- Still prevents spam from flaky connections
This commit is contained in:
jack
2025-07-22 16:53:33 +02:00
parent f7b4fb815b
commit 79243c8fca
+2 -2
View File
@@ -84,8 +84,8 @@ class BluetoothMeshService: NSObject {
private var hasNotifiedNetworkAvailable = false // Track if we've notified about network availability
private var lastNetworkNotificationTime: Date? // Track when we last sent a network notification
private var networkBecameEmptyTime: Date? // Track when the network became empty
private let networkNotificationCooldown: TimeInterval = 600 // 10 minutes between notifications
private let networkEmptyResetDelay: TimeInterval = 300 // 5 minutes before resetting notification flag
private let networkNotificationCooldown: TimeInterval = 300 // 5 minutes between notifications
private let networkEmptyResetDelay: TimeInterval = 60 // 1 minute before resetting notification flag
private var intentionalDisconnects = Set<String>() // Track peripherals we're disconnecting intentionally
private var peerLastSeenTimestamps = LRUCache<String, Date>(maxSize: 100) // Bounded cache for peer timestamps
private var cleanupTimer: Timer? // Timer to clean up stale peers