Skip to content

Fix: Active peer notification in background#644

Open
callebtc wants to merge 4 commits intomainfrom
fix/peer-notification-bug
Open

Fix: Active peer notification in background#644
callebtc wants to merge 4 commits intomainfrom
fix/peer-notification-bug

Conversation

@callebtc
Copy link
Collaborator

Summary

This PR fixes an issue where the "Active Peers" notification (e.g. "bitchatters nearby!") was not triggering when the app was in the background. It also fixes a logic flaw where reconnecting to previously seen peers after a disconnect (0 peers) would not trigger the notification.

Changes

  • BluetoothMeshService.kt: Modified onPeerListUpdated to explicitly call serviceNotificationManager.showActiveUserNotification(peerIDs) when the UI delegate is null (indicating the app is in the background). This ensures the notification logic is executed even when the UI is not active.
  • NotificationManager.kt: Modified showActiveUserNotification to clear notificationIntervalManager.recentlySeenPeers when the peer list is empty. This resets the tracking state so that subsequent connections (going from 0 to n peers) are treated as "new" connections, allowing the notification to trigger again.

Testing

  • Verified that notifications now appear when the app is backgrounded and peers connect.
  • Verified that disconnecting and reconnecting triggers the notification again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant