CancelOverrideIntent.swift 699 B

1234567891011121314151617181920
  1. import AppIntents
  2. import Foundation
  3. struct CancelOverrideIntent: AppIntent {
  4. // Title of the action in the Shortcuts app
  5. static var title = LocalizedStringResource("Cancel override", table: "ShortcutsDetail")
  6. // Description of the action in the Shortcuts app
  7. static var description = IntentDescription(.init("Cancel an active override", table: "ShortcutsDetail"))
  8. @MainActor func perform() async throws -> some ProvidesDialog {
  9. do {
  10. await OverridePresetsIntentRequest().cancelOverride()
  11. return .result(
  12. dialog: IntentDialog(LocalizedStringResource("Override canceled", table: "ShortcutsDetail"))
  13. )
  14. }
  15. }
  16. }