Adds SendTransport/TransportSettings (UserDefaults-backed, mirrors FolderSettings) and OneDriveLocator, which finds a OneDrive-* sync root under ~/Library/CloudStorage and resolves the Redline send/watch folder inside it (MMD-named roots preferred). TransportSettings.effectiveFolders() is the one function that combines the transport choice with FolderSettings/OneDriveLocator. ReturnWatcher gains recordUncommented (default true, today's AirDrop behaviour): when false, a document with zero human marks is neither recorded into the ledger nor returned by scanNow. This is needed because in OneDrive mode the outbox and watch folder are the same folder, so a freshly written, unmarked PDF must not be treated as a return — only a later, actually marked-up save of the same file should be. Adds ShotdeckError.oneDriveFolderUnavailable(path:) for when the OneDrive folder is missing or unwritable at send time. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ZiTXPbPCSjzPVsfoweAbp
40 lines
1.7 KiB
Swift
40 lines
1.7 KiB
Swift
import Foundation
|
|
|
|
public enum ShotdeckError: Error, LocalizedError, Sendable {
|
|
case screenRecordingNotGranted
|
|
case noRegionRemembered
|
|
case displayNoLongerConnected(displayID: UInt32)
|
|
case captureFailed(underlying: String)
|
|
case spoolWriteFailed(path: String, underlying: String)
|
|
case manifestCorrupt(path: String)
|
|
case pdfCompositionFailed(reason: String)
|
|
case airDropUnavailable
|
|
case noCommentedReturns
|
|
case oneDriveFolderUnavailable(path: String)
|
|
|
|
public var errorDescription: String? {
|
|
switch self {
|
|
case .screenRecordingNotGranted:
|
|
return "Screen Recording is turned off. Grant it in System Settings to capture."
|
|
case .noRegionRemembered:
|
|
return "No capture region is set. Choose 'Re-select area' from the Redline menu."
|
|
case .displayNoLongerConnected:
|
|
return "The display used for capture is no longer connected."
|
|
case .captureFailed(let underlying):
|
|
return "The screenshot could not be taken. \(underlying)"
|
|
case .spoolWriteFailed(_, let underlying):
|
|
return "The screenshot could not be saved. \(underlying)"
|
|
case .manifestCorrupt:
|
|
return "This session's file is damaged and cannot be opened."
|
|
case .pdfCompositionFailed(let reason):
|
|
return "The PDF could not be built. \(reason)"
|
|
case .airDropUnavailable:
|
|
return "AirDrop is not available right now."
|
|
case .noCommentedReturns:
|
|
return "None of the returned PDFs have comments on them."
|
|
case .oneDriveFolderUnavailable(let path):
|
|
return "Your OneDrive folder is not available: \(path). Check that OneDrive is signed in, or choose another folder in Settings."
|
|
}
|
|
}
|
|
}
|