Implemented the (first version of the) Recording Live Activity in the Attendi widget target.

This commit is contained in:
2026-07-06 03:43:25 +02:00
parent ffa80d3b58
commit 874de398d2
15 changed files with 755 additions and 4 deletions
@@ -0,0 +1,29 @@
import Commanding
import AppIntents
/// The intent behind the main button of the recording Live Activity, which pauses or resumes the recording.
///
/// 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/toggle`` through the process-wide
/// ``RecordingCommander``, mirroring a press of the feature's main button.
struct ToggleRecordingIntent: LiveActivityIntent {
// MARK: Constants
static let title: LocalizedStringResource = "Pause or Resume Recording"
static let description = IntentDescription("Pauses or resumes the ongoing recording.")
static let openAppWhenRun = false
// MARK: Methods
/// Sends the toggle 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(.toggle)
return .result()
}
}