Implemented the reinstallation of speech assets in a cancellable task with notifications on the ContentViewModel view model in the Sample app target.

This commit is contained in:
2026-07-05 11:51:39 +02:00
parent 9949c94490
commit 480a0c80e1
3 changed files with 190 additions and 36 deletions
+49
View File
@@ -0,0 +1,49 @@
import Foundation
/// An in-app notification reporting an event of a speech model asset download.
struct AppNotification: Equatable, Identifiable {
// MARK: Properties
/// The unique identifier of the notification.
let id: UUID
/// The download event the notification reports.
let event: Event
/// The localized name of the locale whose speech model the event is about.
let localeName: String
// MARK: Initializers
/// Creates a notification for a given download event and locale name.
///
/// - Parameters:
/// - id: The unique identifier of the notification. Defaults to a newly generated identifier.
/// - event: The download event the notification reports.
/// - localeName: The localized name of the locale whose speech model the event is about.
init(
id: UUID = .init(),
event: Event,
localeName: String
) {
self.id = id
self.event = event
self.localeName = localeName
}
}
// MARK: - Enumerations
extension AppNotification {
/// The download event the notification reports.
enum Event: Sendable {
/// The download was cancelled before it finished.
case cancelled
/// The download failed.
case failed
/// The download started.
case started
}
}