feat: Simplify search results condition in ChatsListScreen
This commit is contained in:
@@ -77,13 +77,14 @@ class PacketSearch : Packet() {
|
||||
override fun receive(stream: Stream) {
|
||||
privateKey = stream.readString()
|
||||
search = stream.readString()
|
||||
val userCount = stream.readInt32()
|
||||
val userCount = stream.readInt16() // Int16, not Int32!
|
||||
val usersList = mutableListOf<SearchUser>()
|
||||
for (i in 0 until userCount) {
|
||||
// Order: username, title, publicKey, verified, online (matching React Native)
|
||||
val user = SearchUser(
|
||||
publicKey = stream.readString(),
|
||||
title = stream.readString(),
|
||||
username = stream.readString(),
|
||||
title = stream.readString(),
|
||||
publicKey = stream.readString(),
|
||||
verified = stream.readInt8(),
|
||||
online = stream.readInt8()
|
||||
)
|
||||
|
||||
@@ -135,11 +135,11 @@ class Protocol(
|
||||
}
|
||||
|
||||
override fun onClosing(webSocket: WebSocket, code: Int, reason: String) {
|
||||
log("WebSocket closing: $code - $reason")
|
||||
log("⚠️ WebSocket closing: $code - $reason")
|
||||
}
|
||||
|
||||
override fun onClosed(webSocket: WebSocket, code: Int, reason: String) {
|
||||
log("WebSocket closed: $code - $reason")
|
||||
log("❌ WebSocket closed: $code - $reason")
|
||||
handleDisconnect()
|
||||
}
|
||||
|
||||
@@ -210,6 +210,10 @@ class Protocol(
|
||||
|
||||
log("📤 Sending packet: ${packet.getPacketId()} (${data.size} bytes)")
|
||||
|
||||
// Debug: log first 50 bytes as hex
|
||||
val hexDump = data.take(50).joinToString(" ") { String.format("%02X", it) }
|
||||
log(" Hex: $hexDump${if (data.size > 50) "..." else ""}")
|
||||
|
||||
webSocket?.send(ByteString.of(*data))
|
||||
}
|
||||
|
||||
@@ -222,10 +226,14 @@ class Protocol(
|
||||
|
||||
private fun handleMessage(data: ByteArray) {
|
||||
try {
|
||||
// Debug: log first 50 bytes as hex
|
||||
val hexDump = data.take(50).joinToString(" ") { String.format("%02X", it.toInt() and 0xFF) }
|
||||
log("📥 Received ${data.size} bytes: $hexDump${if (data.size > 50) "..." else ""}")
|
||||
|
||||
val stream = Stream(data)
|
||||
val packetId = stream.readInt16()
|
||||
|
||||
log("📥 Received packet: $packetId")
|
||||
log("📥 Packet ID: $packetId")
|
||||
|
||||
val packetFactory = supportedPackets[packetId]
|
||||
if (packetFactory == null) {
|
||||
@@ -246,6 +254,7 @@ class Protocol(
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
log("❌ Error parsing packet: ${e.message}")
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user