Reportage/Services/InstantReportLogger.swift (1737B)
1import AppIntents
2
3
4
5struct InstantReportLogger: InstantReportLogging {
6 let persistence: PersistenceController
7
8 private static let log = EventLog.shared.category("Intents")
9
10 func logInstantReport() async throws {
11 let store = ReportStore(persistence: persistence)
12 Self.log.info("Filing an instant report from an intent")
13 try await PassiveLog(store: store, capture: { await ContextCapture.background.capture() })
14 .log(trigger: .intent)
15 await PromptScheduler().refresh()
16 }
17}
18
19
20struct ReportageShortcuts: AppShortcutsProvider {
21 static var appShortcuts: [AppShortcut] {
22 AppShortcut(
23 intent: LogPassiveReportIntent(),
24 phrases: [
25 "File a report in \(.applicationName)",
26 "Make a report in \(.applicationName)",
27 "Log a report in \(.applicationName)",
28 "Record a report in \(.applicationName)",
29 "File an update in \(.applicationName)",
30 "Make an update in \(.applicationName)",
31 "Log an update in \(.applicationName)",
32 "Record an update in \(.applicationName)",
33 "File an instant report in \(.applicationName)",
34 "Make an instant report in \(.applicationName)",
35 "Log an instant report in \(.applicationName)",
36 "Record an instant report in \(.applicationName)",
37 ],
38 shortTitle: "Instant Report",
39 systemImageName: "bolt.fill")
40 }
41}