From 61d267db5efb6342bb64dd9ae6ecdbf9cacdca31 Mon Sep 17 00:00:00 2001 From: jack Date: Wed, 23 Jul 2025 10:54:47 +0200 Subject: [PATCH] Fix UI not updating lock icon after handshake completion The handshake was completing successfully but the UI wasn't being notified to update the encryption status icon. Added a delegate notification after handshake completion to trigger updateEncryptionStatusForPeers() in the UI. This ensures the lock icon changes from empty to filled when encryption is established. --- bitchat/Services/BluetoothMeshService.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bitchat/Services/BluetoothMeshService.swift b/bitchat/Services/BluetoothMeshService.swift index 15ca8b70..63e767a9 100644 --- a/bitchat/Services/BluetoothMeshService.swift +++ b/bitchat/Services/BluetoothMeshService.swift @@ -3421,6 +3421,14 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate { // Send any cached store-and-forward messages sendCachedMessages(to: peerID) + + // Notify delegate to update UI encryption status + DispatchQueue.main.async { [weak self] in + // Force UI to refresh by sending a peer list update + if let peers = self?.collectionsQueue.sync(execute: { Array(self?.activePeers ?? []) }) { + self?.delegate?.didUpdatePeerList(peers) + } + } } } catch NoiseSessionError.alreadyEstablished { // Session already established, ignore handshake