mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 23:05:20 +00:00
Fix thread safety issue causing peer count to show 0
- Add thread safety lock for activePeers Set access - Force UI update when peer list changes with objectWillChange - Add debug logging to track peer additions/removals - This fixes the 'alone :/' display when peers are actually connected
This commit is contained in:
@@ -588,13 +588,12 @@ extension ChatViewModel: BitchatDelegate {
|
||||
}
|
||||
|
||||
func didUpdatePeerList(_ peers: [String]) {
|
||||
print("[DEBUG] Updating peer list: \(peers.count) peers: \(peers)")
|
||||
connectedPeers = peers
|
||||
isConnected = !peers.isEmpty
|
||||
|
||||
// If we just disconnected from all peers, ensure UI updates
|
||||
if peers.isEmpty && isConnected {
|
||||
isConnected = false
|
||||
}
|
||||
// Force UI update
|
||||
objectWillChange.send()
|
||||
|
||||
// If we're in a private chat with someone who disconnected, exit the chat
|
||||
if let currentChatPeer = selectedPrivateChatPeer,
|
||||
|
||||
Reference in New Issue
Block a user