mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 01:45:22 +00:00
Fix active peer notification in background logic
This commit is contained in:
@@ -178,6 +178,14 @@ class BluetoothMeshService(private val context: Context) {
|
||||
try { com.bitchat.android.services.AppStateStore.setPeers(peerIDs) } catch (_: Exception) { }
|
||||
// Then notify UI delegate if attached
|
||||
delegate?.didUpdatePeerList(peerIDs)
|
||||
|
||||
// If UI is detached (background), update notification manager directly
|
||||
if (delegate == null) {
|
||||
try {
|
||||
serviceNotificationManager.setAppBackgroundState(true)
|
||||
serviceNotificationManager.showActiveUserNotification(peerIDs)
|
||||
} catch (_: Exception) { }
|
||||
}
|
||||
}
|
||||
override fun onPeerRemoved(peerID: String) {
|
||||
try { gossipSyncManager.removeAnnouncementForPeer(peerID) } catch (_: Exception) { }
|
||||
|
||||
@@ -174,6 +174,11 @@ class NotificationManager(
|
||||
}
|
||||
|
||||
fun showActiveUserNotification(peers: List<String>) {
|
||||
if (peers.isEmpty()) {
|
||||
notificationIntervalManager.recentlySeenPeers.clear()
|
||||
return
|
||||
}
|
||||
|
||||
val currentTime = System.currentTimeMillis()
|
||||
val activePeerNotificationIntervalExceeded =
|
||||
(currentTime - notificationIntervalManager.lastNetworkNotificationTime) > ACTIVE_PEERS_NOTIFICATION_TIME_INTERVAL
|
||||
|
||||
Reference in New Issue
Block a user