Fix notification dot size and improve peer announcements

- Make notification dot smaller (5x5) for better appearance
- Remove all delays from announcement sending
- Send announcements immediately on connection
- Add debug logging for join/leave messages
- Ensure join/leave messages are properly displayed
This commit is contained in:
jack
2025-07-02 21:32:51 +02:00
parent d67e11cdab
commit e50f14eeed
3 changed files with 17 additions and 21 deletions
+7 -8
View File
@@ -117,10 +117,9 @@ class BluetoothMeshService: NSObject {
startAdvertising()
}
// Schedule initial announcement after services are ready
announcementTimer?.invalidate()
announcementTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: false) { [weak self] _ in
self?.sendInitialAnnouncement()
// Send initial announcement immediately if we have peers
if !connectedPeripherals.isEmpty || !subscribedCentrals.isEmpty {
sendInitialAnnouncement()
}
}
@@ -623,7 +622,7 @@ extension BluetoothMeshService: CBPeripheralDelegate {
peripheral.setNotifyValue(true, for: characteristic)
peripheralCharacteristics[peripheral] = characteristic
// Send key exchange immediately
// Send key exchange and announce immediately
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
@@ -644,7 +643,7 @@ extension BluetoothMeshService: CBPeripheralDelegate {
// Send announce packet immediately after key exchange
if let vm = self.delegate as? ChatViewModel {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
let announcePacket = BitchatPacket(
type: MessageType.announce.rawValue,
@@ -751,7 +750,7 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
// Send announce immediately after key exchange
if let vm = self.delegate as? ChatViewModel {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
print("[DEBUG] Sending announce packet to central after key exchange")
let announcePacket = BitchatPacket(
@@ -805,7 +804,7 @@ extension BluetoothMeshService: CBPeripheralManagerDelegate {
// Send announce immediately after key exchange
if let vm = delegate as? ChatViewModel {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
DispatchQueue.main.async { [weak self] in
guard let self = self else { return }
let announcePacket = BitchatPacket(
type: MessageType.announce.rawValue,