PeerID 31/n: Remove String interop to be explicit (#840)

* PeerID 28/n: `ChatViewModel.getShortIDForNoiseKey`

* PeerID 29/n: `BLEService` + remove dupe funcs from #823

* `handleFileTransfer` to use PeerID

* `sendMessage` and `sendPrivateMessage`

* PeerID 30/n: Update some leftovers

* `lowercased()` inside PeerID for normalization

* PeerID 31/n: Remove String interop to be explicit

* MockBLEService: Remove direct target delivery

This causes a delivery even if the sender and receiver are not connected

---------

Co-authored-by: jack <jackjackbits@users.noreply.github.com>
This commit is contained in:
Islam
2025-10-19 20:50:44 +02:00
committed by GitHub
co-authored by jack
parent 0776c9813c
commit b839ce5f6c
8 changed files with 34 additions and 80 deletions
@@ -186,11 +186,11 @@ struct PrivateChatE2ETests {
// Bob relays private messages for Charlie
bob.packetDeliveryHandler = { packet in
if let recipientID = packet.recipientID,
String(data: recipientID, encoding: .utf8) == charlie.peerID {
PeerID(data: recipientID) == charlie.peerID {
// Relay to Charlie
var relayPacket = packet
relayPacket.ttl = packet.ttl - 1
self.charlie.simulateIncomingPacket(relayPacket)
charlie.simulateIncomingPacket(relayPacket)
}
}
@@ -388,7 +388,7 @@ struct PublicChatE2ETests {
if let message = BitchatMessage(packet.payload) {
// Don't relay own messages
guard message.senderPeerID?.id != node.peerID else { return }
guard message.senderPeerID != node.peerID else { return }
// Create relay message
let relayMessage = BitchatMessage(