feature: sent-PDF history (10) + image retention (30) with pruning per Ben's 2026-09-02 ruling
This commit is contained in:
@@ -100,6 +100,8 @@ extension AppModel: SendCapable {
|
||||
/// `NSSharingServiceDelegate.sharingService(_:didShareItems:)` seam.
|
||||
func handleDidShareItems(fileName: String, pageCount: Int) async {
|
||||
guard !session.isEmpty else { return }
|
||||
let sentSessionID = session.id
|
||||
let sourceURL = lastComposedPDFURL ?? outboxURL.appendingPathComponent(fileName)
|
||||
do {
|
||||
_ = try await spool.archiveCurrent(pdfFileName: fileName)
|
||||
replaceSession(try await spool.currentSession())
|
||||
@@ -107,6 +109,20 @@ extension AppModel: SendCapable {
|
||||
setStatus("Sent — \(pageCount) \(pageWord).")
|
||||
} catch {
|
||||
setStatus((error as? ShotdeckError)?.errorDescription ?? "Could not archive the session.")
|
||||
return
|
||||
}
|
||||
do {
|
||||
_ = try await historyStore.recordSentPDF(
|
||||
sourceURL: sourceURL,
|
||||
sessionID: sentSessionID,
|
||||
pageCount: pageCount,
|
||||
sentAt: Date()
|
||||
)
|
||||
try await historyStore.pruneImages()
|
||||
} catch {
|
||||
Log.spool.error(
|
||||
"Could not record sent PDF into history at \(sourceURL.path, privacy: .public): \(error.localizedDescription, privacy: .public)"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user