mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 11:45:19 +00:00
Refactor MessageRouter to use generic Transport abstraction
- Decouple MessageRouter from specific Mesh/Nostr implementations - Update NostrTransport to implement isPeerReachable using a local cache of favorited peers - Update ChatViewModel to inject transports as a list - Mark NostrTransport as @unchecked Sendable to handle internal thread safety
This commit is contained in:
@@ -436,7 +436,8 @@ final class ChatViewModel: ObservableObject, BitchatDelegate, CommandContextProv
|
||||
self.privateChatManager = PrivateChatManager(meshService: meshService)
|
||||
self.unifiedPeerService = UnifiedPeerService(meshService: meshService, idBridge: idBridge, identityManager: identityManager)
|
||||
let nostrTransport = NostrTransport(keychain: keychain, idBridge: idBridge)
|
||||
self.messageRouter = MessageRouter(mesh: meshService, nostr: nostrTransport)
|
||||
nostrTransport.senderPeerID = meshService.myPeerID
|
||||
self.messageRouter = MessageRouter(transports: [meshService, nostrTransport])
|
||||
// Route receipts from PrivateChatManager through MessageRouter
|
||||
self.privateChatManager.messageRouter = self.messageRouter
|
||||
// Allow PrivateChatManager to look up peer info for message consolidation
|
||||
|
||||
Reference in New Issue
Block a user