Files
nucleic-remote-ios/NucleicRemote/NucleicRemote/AppIntents/IntentError.swift
T
abkslmandNucleic 67693a1be9 Read App Intents Documentation
Nucleic-Session: 56C5F781-4444-466B-91CE-A7734A8E117F
Co-authored-by: Nucleic <[email protected]>
2026-07-06 14:45:29 -07:00

30 lines
1.4 KiB
Swift

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
/// A high-risk approval (destructive/network/host-exec) can't be allowed inline — it must be
/// confirmed on the app's guarded card (docs/APP_INTENTS_OPPORTUNITIES §3.3).
case needsAppConfirmation
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."
case .needsAppConfirmation:
"This one's high-risk — open Nucleic to confirm it on the approval card."
}
}
}