mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 13:45:22 +00:00
Fix warnings and improve autocomplete positioning, add unit tests
- Remove unused variables (beforeCount, beforeFavCount) - Remove Tx Power Level from advertising (not allowed) - Fix autocomplete popup to appear near cursor position - Calculate position based on nickname width and @ location - Add comprehensive unit tests for: - Binary protocol encoding/decoding - Message padding for privacy - Bloom filter duplicate detection - BitchatMessage serialization - Add test target to project.yml
This commit is contained in:
@@ -407,9 +407,7 @@ class BluetoothMeshService: NSObject {
|
||||
advertisementData = [
|
||||
CBAdvertisementDataServiceUUIDsKey: [BluetoothMeshService.serviceUUID],
|
||||
// Use only peer ID without any identifying prefix
|
||||
CBAdvertisementDataLocalNameKey: myPeerID,
|
||||
// Request max TX power for better range (system may adjust)
|
||||
CBAdvertisementDataTxPowerLevelKey: NSNumber(value: 1)
|
||||
CBAdvertisementDataLocalNameKey: myPeerID
|
||||
]
|
||||
|
||||
isAdvertising = true
|
||||
@@ -960,22 +958,17 @@ class BluetoothMeshService: NSObject {
|
||||
if !messageIDsToRemove.isEmpty {
|
||||
self.messageQueue.async(flags: .barrier) {
|
||||
// Remove only the messages we sent to this specific peer
|
||||
let beforeCount = self.messageCache.count
|
||||
self.messageCache.removeAll { message in
|
||||
messageIDsToRemove.contains(message.messageID)
|
||||
}
|
||||
let afterCount = self.messageCache.count
|
||||
|
||||
// Also remove from favorite queue if any
|
||||
if var favoriteQueue = self.favoriteMessageQueue[peerID] {
|
||||
let beforeFavCount = favoriteQueue.count
|
||||
favoriteQueue.removeAll { message in
|
||||
messageIDsToRemove.contains(message.messageID)
|
||||
}
|
||||
self.favoriteMessageQueue[peerID] = favoriteQueue.isEmpty ? nil : favoriteQueue
|
||||
// Removed from favorite queue
|
||||
}
|
||||
// Removed from cache
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user