import AppIntents /// Play or pause (#427, #428): Siri, Shortcuts and the widget's button. An `AudioPlaybackIntent`, /// so iOS runs it in the app, which may start audio from the background, wherever it is asked /// from. Compiled into the widget too, which needs the type for its button but never runs it. struct PlayPauseIntent: AudioPlaybackIntent { static let title: LocalizedStringResource = "Play or Pause" static let description = IntentDescription( "Pauses what iPX is playing, or carries on with the last episode where you left off.") @MainActor func perform() async throws -> some IntentResult { #if !WIDGET if Playback.shared.isPlaying { Playback.shared.pause() } else { Playback.shared.resumeLast() } #endif return .result() } }