Added accessibility support to in-app notifications on the ContentViewModel view model in the Sample app.

This commit is contained in:
2026-07-05 13:06:43 +02:00
parent 6373fad0cd
commit 6bcb88c944
4 changed files with 50 additions and 33 deletions
@@ -1,5 +1,5 @@
import Accessibility
import Foundation
import Notifying
import Observation
import OSLog
import Recording
@@ -153,8 +153,8 @@ private extension ContentView.Model {
await SpeechTranscriber.supportedLocale(equivalentTo: locale)
}
/// Posts a notification for a download event of the given locale, scheduling its automatic dismissal a few seconds later
/// the only way a notification is dismissed.
/// Posts a notification for a download event of the given locale, announcing it to assistive technologies and scheduling its
/// automatic dismissal a few seconds later the only way a notification is dismissed.
///
/// - Parameters:
/// - event: The download event to notify.
@@ -170,6 +170,10 @@ private extension ContentView.Model {
notifications.append(notification)
AccessibilityNotification.Announcement(
String(localized: notification.textMessage)
).post()
Task {
try? await Task.sleep(for: Constant.Delay.dismissal)