Match the server's rename: CollaborationSession uses labID, createLab / joinLab, ProjectCollaborationState's roomID field + its DB column become labID / lab_id, and UI strings / deep- link query param all track "lab". Since the app hasn't launched, the DB column rename is landed directly in the v1 migration rather than via a new migration — dev databases need to be wiped.
22 lines
534 B
Swift
22 lines
534 B
Swift
import Foundation
|
|
|
|
public final class CollaborationJoinQueue: @unchecked Sendable {
|
|
public static let shared = CollaborationJoinQueue()
|
|
|
|
private let lock = NSLock()
|
|
private var pending: [String] = []
|
|
|
|
public func enqueue(labID: String) {
|
|
lock.lock()
|
|
defer { lock.unlock() }
|
|
pending.append(labID)
|
|
}
|
|
|
|
public func consumeNext() -> String? {
|
|
lock.lock()
|
|
defer { lock.unlock() }
|
|
guard !pending.isEmpty else { return nil }
|
|
return pending.removeFirst()
|
|
}
|
|
}
|