From 772d6be528e438b371e043289c63faf6f64e3e57 Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Sun, 5 Jul 2026 22:16:12 -0700 Subject: [PATCH] Settings Feature Enhancement Nucleic-Session: 89BFAB13-D559-43FC-BE28-0B2639BECF0F Co-authored-by: Nucleic --- .../NucleicRemote/Models/RemoteStore.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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"