diff --git a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift index 187fd94..9435338 100644 --- a/NucleicRemote/NucleicRemote/Models/RemoteStore.swift +++ b/NucleicRemote/NucleicRemote/Models/RemoteStore.swift @@ -807,13 +807,25 @@ final class RemoteStore: ObservableObject { } /// The user dismissed the "add a device" sheet — tell the minting Mac to close its pairing - /// window (retire the one-time secret) and reset to idle. + /// window (retire the one-time secret) and reset to idle. Any Mac-join awaiting approval is + /// abandoned here too; the host fails it closed when its pairing window shuts. func cancelPairingCode() { if !demoMode, let id = pairingMintHostID { connections[id]?.send(.cancelPairingCode) } pairingMintHostID = nil + pendingMacPairRequest = nil + pendingMacPairHostID = nil addDevice = .idle } + /// Approve or deny a Mac joining via a code this phone shared (the forwarded confirm). Routes + /// the answer to the Mac that forwarded it and clears the prompt optimistically. + func respondMacPair(_ approve: Bool) { + guard let req = pendingMacPairRequest else { return } + if let id = pendingMacPairHostID { connections[id]?.send(.respondMacPair(req.deviceID, approve)) } + pendingMacPairRequest = nil + pendingMacPairHostID = nil + } + /// A stand-in join code for the offline demo so the QR/copy sheet renders without a Mac. private static let demoPairingCode = "nucleic://pair?d=demo"