mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 19:25:20 +00:00
Fix screenshot notifications and remove 'private:' from UI
- Screenshot notifications now properly appear as system messages - Send messages directly via mesh service to avoid local echo - Remove 'private:' prefix from private chat header - Keep only lock icon and peer name in private chat header
This commit is contained in:
@@ -1073,10 +1073,11 @@ class ChatViewModel: ObservableObject {
|
|||||||
if let peerID = selectedPrivateChatPeer {
|
if let peerID = selectedPrivateChatPeer {
|
||||||
// In private chat - send to the other person
|
// In private chat - send to the other person
|
||||||
if let peerNickname = meshService.getPeerNicknames()[peerID] {
|
if let peerNickname = meshService.getPeerNicknames()[peerID] {
|
||||||
|
// Send the message directly without going through sendPrivateMessage to avoid local echo
|
||||||
meshService.sendPrivateMessage(screenshotMessage, to: peerID, recipientNickname: peerNickname)
|
meshService.sendPrivateMessage(screenshotMessage, to: peerID, recipientNickname: peerNickname)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also show locally
|
// Show local notification immediately as system message
|
||||||
let localNotification = BitchatMessage(
|
let localNotification = BitchatMessage(
|
||||||
sender: "system",
|
sender: "system",
|
||||||
content: "you took a screenshot",
|
content: "you took a screenshot",
|
||||||
@@ -1094,9 +1095,14 @@ class ChatViewModel: ObservableObject {
|
|||||||
|
|
||||||
} else if let channel = currentChannel {
|
} else if let channel = currentChannel {
|
||||||
// In a channel - send to channel
|
// In a channel - send to channel
|
||||||
meshService.sendMessage(screenshotMessage, channel: channel)
|
// Check if channel is password protected and encrypt if needed
|
||||||
|
if let channelKey = channelKeys[channel] {
|
||||||
|
meshService.sendEncryptedChannelMessage(screenshotMessage, mentions: [], channel: channel, channelKey: channelKey)
|
||||||
|
} else {
|
||||||
|
meshService.sendMessage(screenshotMessage, mentions: [], channel: channel)
|
||||||
|
}
|
||||||
|
|
||||||
// Also show locally
|
// Show local notification immediately as system message
|
||||||
let localNotification = BitchatMessage(
|
let localNotification = BitchatMessage(
|
||||||
sender: "system",
|
sender: "system",
|
||||||
content: "you took a screenshot",
|
content: "you took a screenshot",
|
||||||
@@ -1113,9 +1119,9 @@ class ChatViewModel: ObservableObject {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
// In public chat - send to everyone
|
// In public chat - send to everyone
|
||||||
meshService.sendMessage(screenshotMessage)
|
meshService.sendMessage(screenshotMessage, mentions: [], channel: nil)
|
||||||
|
|
||||||
// Also show locally
|
// Show local notification immediately as system message
|
||||||
let localNotification = BitchatMessage(
|
let localNotification = BitchatMessage(
|
||||||
sender: "system",
|
sender: "system",
|
||||||
content: "you took a screenshot",
|
content: "you took a screenshot",
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ struct ContentView: View {
|
|||||||
Image(systemName: "lock.fill")
|
Image(systemName: "lock.fill")
|
||||||
.font(.system(size: 14))
|
.font(.system(size: 14))
|
||||||
.foregroundColor(Color.orange)
|
.foregroundColor(Color.orange)
|
||||||
Text("private: \(privatePeerNick)")
|
Text("\(privatePeerNick)")
|
||||||
.font(.system(size: 16, weight: .medium, design: .monospaced))
|
.font(.system(size: 16, weight: .medium, design: .monospaced))
|
||||||
.foregroundColor(Color.orange)
|
.foregroundColor(Color.orange)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user