Added the "reset()" method to the Reporting protocol in the Recording feature target to discard leftover Live Activities at launch and set a stale date on recording activities.

This commit is contained in:
2026-07-06 23:05:24 +02:00
parent f443d434f2
commit b3f0826122
5 changed files with 53 additions and 3 deletions
@@ -38,6 +38,10 @@ extension ContentView {
@ObservationIgnored
let capturer: any Capturing
/// Whether the reporting surfaces left over from an earlier run have been discarded, so the discard runs only once per launch.
@ObservationIgnored
private var didReset = false
/// The locale whose speech model assets are preinstalled or being preinstalled, or `nil` when none are.
@ObservationIgnored
private var localePreinstalling: Locale?
@@ -96,7 +100,9 @@ extension ContentView {
// MARK: Methods
/// Loads the locales the transcriber supports resolved through the preinstalling service into ``locales``, sorted by their
/// Discards, once per launch, any reporting surface left over from an earlier run a Live Activity the app was killed before it
/// could end, for example since a fresh launch has no recording it could still belong to. It then loads the locales the
/// transcriber supports resolved through the preinstalling service into ``locales``, sorted by their
/// localized names, and aligns ``locale`` with the supported equivalent of its current value restored first from the given
/// persisted identifier when one exists, and falling back to the supported equivalent of a default locale when no equivalent
/// exists so the locale picker starts with a valid selection. It then kicks off the preinstallation of the aligned locale's
@@ -107,6 +113,12 @@ extension ContentView {
func load(
identifier: String
) async {
if !didReset {
didReset = true
await reporter.reset()
}
if !identifier.isEmpty {
locale = .init(identifier: identifier)
}