Implement hashtag rooms feature

- Add room field to BitchatMessage structure
- Update BinaryProtocol to encode/decode room information
- Create room management in ChatViewModel (join/leave/switch rooms)
- Add BluetoothMeshService support for room messages
- Implement rooms UI in sidebar with unread counts
- Create clickable hashtags in messages to join rooms
- Add room persistence across app restarts
- Filter message display by current room selection
This commit is contained in:
jack
2025-07-05 19:35:37 +02:00
parent bb2edd4e23
commit 3d7232222c
5 changed files with 426 additions and 47 deletions
+3 -4
View File
@@ -507,7 +507,7 @@ class BluetoothMeshService: NSObject {
self.characteristic = characteristic
}
func sendMessage(_ content: String, mentions: [String] = [], to recipientID: String? = nil) {
func sendMessage(_ content: String, mentions: [String] = [], room: String? = nil, to recipientID: String? = nil) {
messageQueue.async { [weak self] in
guard let self = self else { return }
@@ -520,7 +520,8 @@ class BluetoothMeshService: NSObject {
timestamp: Date(),
isRelay: false,
originalSender: nil,
mentions: mentions.isEmpty ? nil : mentions
mentions: mentions.isEmpty ? nil : mentions,
room: room
)
if let messageData = message.toBinaryPayload() {
@@ -847,11 +848,9 @@ class BluetoothMeshService: NSObject {
processedKeyExchanges = processedKeyExchanges.filter { !$0.contains(peerID) }
peerNicknamesLock.lock()
let nickname = peerNicknames[peerID]
peerNicknames.removeValue(forKey: peerID)
peerNicknamesLock.unlock()
let lastSeenAgo = peerLastSeenTimestamps[peerID].map { now.timeIntervalSince($0) } ?? 999
// Removed stale peer
}
activePeersLock.unlock()