From 9e3b40eff73659da7d267edd7ff3b4f2b5e84f69 Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Mon, 10 Aug 2026 17:29:06 +0700 Subject: [PATCH] Update LumaRoomStore.swift --- Sources/Shared/XMPP/LumaRoomStore.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Sources/Shared/XMPP/LumaRoomStore.swift b/Sources/Shared/XMPP/LumaRoomStore.swift index 73dc6d6..79a9882 100644 --- a/Sources/Shared/XMPP/LumaRoomStore.swift +++ b/Sources/Shared/XMPP/LumaRoomStore.swift @@ -1,20 +1,22 @@ import Foundation import Martin +/// Martin 3.2.4 does not expose `DefaultRoomStore.init()` outside its module. +/// This mirrors its in-memory behavior so the app can register XEP-0045 MUC. final class LumaRoomStore: RoomStore { typealias Room = RoomBase - private let dispatcher = QueueDispatcher(label: "LumaRoomStore") + private let queue = DispatchQueue(label: "LumaRoomStore") private var roomsByJID: [BareJID: RoomBase] = [:] func rooms(for context: Context) -> [RoomBase] { - dispatcher.sync { + queue.sync { Array(roomsByJID.values) } } func room(for context: Context, with jid: BareJID) -> RoomBase? { - dispatcher.sync { + queue.sync { roomsByJID[jid] } } @@ -25,7 +27,7 @@ final class LumaRoomStore: RoomStore { nickname: String, password: String? ) -> ConversationCreateResult { - dispatcher.sync { + queue.sync { if let room = roomsByJID[jid] { return .found(room) } @@ -34,7 +36,7 @@ final class LumaRoomStore: RoomStore { jid: jid, nickname: nickname, password: password, - dispatcher: dispatcher + dispatcher: QueueDispatcher(queue: queue) ) roomsByJID[jid] = room return .created(room) @@ -42,7 +44,7 @@ final class LumaRoomStore: RoomStore { } func close(room: RoomBase) -> Bool { - dispatcher.sync { + queue.sync { guard roomsByJID[room.jid] === room else { return false } roomsByJID.removeValue(forKey: room.jid) return true