Implemented the resumed interrupted recordings and allowed processing discards on the RecordingViewModel view model in the Recording package target.

This commit is contained in:
2026-07-05 16:16:53 +02:00
parent 8576d6bac6
commit c2ac476257
14 changed files with 563 additions and 309 deletions
@@ -74,18 +74,19 @@ public final class AssetPreinstalling: Preinstalling {
}
/// Preinstalls the speech model assets for the supported equivalent of the given locale, emitting the started, cancelled, and
/// failed downloads through ``events`` a download that finishes, or assets that are already installed, emit nothing.
/// failed downloads through ``events`` a download that finishes, or assets that are already installed, emit nothing. The
/// emitted events carry the given locale, not its supported equivalent, so a caller can match them against its requests.
///
/// - Parameter locale: The locale to preinstall the speech model assets for.
public func preinstall(
for locale: Locale
) async {
guard let locale = await supportedLocale(equivalentTo: locale) else {
guard let supported = await supportedLocale(equivalentTo: locale) else {
return
}
do {
try await install(for: locale) { [continuation] in
try await install(for: supported) { [continuation] in
continuation.yield(.started(locale))
}
} catch {
@@ -94,7 +95,7 @@ public final class AssetPreinstalling: Preinstalling {
} else {
continuation.yield(.failed(locale))
logger.error("The speech model assets for the \"\(locale.identifier, privacy: .public)\" locale failed to preinstall: \(String(describing: error), privacy: .public)")
logger.error("The speech model assets for the \"\(supported.identifier, privacy: .public)\" locale failed to preinstall: \(String(describing: error), privacy: .public)")
}
}
}