mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 07:25:18 +00:00
wip
This commit is contained in:
@@ -168,7 +168,7 @@ struct BinaryProtocol {
|
|||||||
|
|
||||||
// Payload length (2 bytes, big-endian) - includes original size if compressed
|
// Payload length (2 bytes, big-endian) - includes original size if compressed
|
||||||
let payloadDataSize = payload.count + (isCompressed ? 2 : 0)
|
let payloadDataSize = payload.count + (isCompressed ? 2 : 0)
|
||||||
let payloadLength = UInt16(payloadDataSize)
|
let payloadLength = UInt32(payloadDataSize)
|
||||||
|
|
||||||
|
|
||||||
data.append(UInt8((payloadLength >> 8) & 0xFF))
|
data.append(UInt8((payloadLength >> 8) & 0xFF))
|
||||||
|
|||||||
@@ -1582,6 +1582,11 @@ final class BLEService: NSObject {
|
|||||||
SecureLogger.error("❌ Failed to decode file TLV from \(peerID)", category: .session)
|
SecureLogger.error("❌ Failed to decode file TLV from \(peerID)", category: .session)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Determine if this is a true direct message; Android may use 0xFF..FF to denote broadcast
|
||||||
|
let isBroadcastRecipient: Bool = {
|
||||||
|
guard let rid = packet.recipientID else { return true }
|
||||||
|
return rid == Data(repeating: 0xFF, count: 8)
|
||||||
|
}()
|
||||||
// Persist to app files in type-specific folder
|
// Persist to app files in type-specific folder
|
||||||
let isAudio = file.mimeType.lowercased().hasPrefix("audio/")
|
let isAudio = file.mimeType.lowercased().hasPrefix("audio/")
|
||||||
let subfolder = isAudio ? "voicenotes/incoming" : "images/incoming"
|
let subfolder = isAudio ? "voicenotes/incoming" : "images/incoming"
|
||||||
@@ -1606,7 +1611,7 @@ final class BLEService: NSObject {
|
|||||||
timestamp: ts,
|
timestamp: ts,
|
||||||
isRelay: false,
|
isRelay: false,
|
||||||
originalSender: nil,
|
originalSender: nil,
|
||||||
isPrivate: packet.recipientID != nil,
|
isPrivate: (packet.recipientID != nil) && !isBroadcastRecipient,
|
||||||
recipientNickname: nil,
|
recipientNickname: nil,
|
||||||
senderPeerID: peerID,
|
senderPeerID: peerID,
|
||||||
mentions: nil,
|
mentions: nil,
|
||||||
|
|||||||
@@ -905,8 +905,8 @@ struct ContentView: View {
|
|||||||
.font(.system(size: 22))
|
.font(.system(size: 22))
|
||||||
.foregroundColor(isRecordingVoice ? .red : (viewModel.selectedPrivateChatPeer != nil ? Color.orange : textColor))
|
.foregroundColor(isRecordingVoice ? .red : (viewModel.selectedPrivateChatPeer != nil ? Color.orange : textColor))
|
||||||
.padding(.trailing, 12)
|
.padding(.trailing, 12)
|
||||||
.gesture(
|
.highPriorityGesture(
|
||||||
LongPressGesture(minimumDuration: 0.2)
|
DragGesture(minimumDistance: 0)
|
||||||
.onChanged { _ in
|
.onChanged { _ in
|
||||||
if !isRecordingVoice {
|
if !isRecordingVoice {
|
||||||
do {
|
do {
|
||||||
@@ -940,14 +940,14 @@ struct ContentView: View {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
#else
|
#else
|
||||||
// Non-iOS: keep send button placeholder
|
// Non-iOS: keep send button placeholder
|
||||||
Button(action: sendMessage) {
|
Button(action: sendMessage) {
|
||||||
Image(systemName: "arrow.up.circle.fill")
|
Image(systemName: "arrow.up.circle.fill")
|
||||||
.font(.system(size: 20))
|
.font(.system(size: 20))
|
||||||
.foregroundColor(Color.gray)
|
.foregroundColor(Color.gray)
|
||||||
}
|
}
|
||||||
.buttonStyle(.plain)
|
.buttonStyle(.plain)
|
||||||
.padding(.trailing, 12)
|
.padding(.trailing, 12)
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
Button(action: sendMessage) {
|
Button(action: sendMessage) {
|
||||||
|
|||||||
Reference in New Issue
Block a user