From 8218d6042efbe501b527aee806e5802594c34beb Mon Sep 17 00:00:00 2001 From: Andrew Blakeslee Moore Date: Mon, 6 Jul 2026 14:44:18 -0700 Subject: [PATCH] Read App Intents Documentation Nucleic-Session: 56C5F781-4444-466B-91CE-A7734A8E117F Co-authored-by: Nucleic --- .../AppIntents/IntentError.swift | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 NucleicRemote/NucleicRemote/AppIntents/IntentError.swift diff --git a/NucleicRemote/NucleicRemote/AppIntents/IntentError.swift b/NucleicRemote/NucleicRemote/AppIntents/IntentError.swift new file mode 100644 index 0000000..fb71770 --- /dev/null +++ b/NucleicRemote/NucleicRemote/AppIntents/IntentError.swift @@ -0,0 +1,24 @@ +import AppIntents + +/// Friendly, spoken-safe failures for Nucleic's App Intents. The phone is a thin client with no +/// local authority (docs/APP_INTENTS_OPPORTUNITIES §3.1): an intent that can't reach the paired +/// Mac must fail *clean* with a dialog, never silently or with a raw error. +enum IntentError: Error, CustomLocalizedStringResourceConvertible { + /// No live channel to any paired Mac (and none came up within the wait window). + case macUnreachable + /// Not paired with a Mac yet — nothing to act on. + case notPaired + /// The action needs `control` scope, which this device hasn't been granted. + case controlScopeRequired + + var localizedStringResource: LocalizedStringResource { + switch self { + case .macUnreachable: + "Your Mac isn't reachable right now. Try again when it's online." + case .notPaired: + "Pair this iPhone with your Mac in Nucleic first." + case .controlScopeRequired: + "This device can view and approve, but isn't allowed to control sessions." + } + } +}