Files
attendi/Widgets/Attendi/Sources/Intents/ProcessRecordingIntent.swift
T

30 lines
1.1 KiB
Swift
Raw Normal View History

import Commanding
import AppIntents
/// The intent behind the send button of the recording Live Activity, which sends the paused recording for processing.
///
/// The intent is compiled into both the app and the widget extension: the widget references it from the activity's buttons, and the
/// system executes it in the app's process — where it sends ``RecordingCommand/process`` through the process-wide
/// ``RecordingCommander``, mirroring a press of the feature's send button.
struct ProcessRecordingIntent: LiveActivityIntent {
// MARK: Constants
static let title: LocalizedStringResource = "Process Recording"
static let description = IntentDescription("Sends the paused recording for processing.")
static let openAppWhenRun = false
// MARK: Methods
/// Sends the process command to the recording flow.
///
/// - Returns: An empty result, since the outcome surfaces through the Live Activity's own content update.
@MainActor
func perform() async throws -> some IntentResult {
RecordingCommander.shared.send(.process)
return .result()
}
}