diff --git a/AltStore/Components/ToastView.swift b/AltStore/Components/ToastView.swift index 8fc81407..5f3d754d 100644 --- a/AltStore/Components/ToastView.swift +++ b/AltStore/Components/ToastView.swift @@ -31,6 +31,8 @@ class ToastView: RSTToastView super.init(text: text, detailText: detailedText) + self.isAccessibilityElement = true + self.layoutMargins = UIEdgeInsets(top: 8, left: 16, bottom: 10, right: 16) self.setNeedsLayout() @@ -106,6 +108,19 @@ class ToastView: RSTToastView self.show(in: viewController.navigationController?.view ?? viewController.view, duration: self.preferredDuration) } + override func show(in view: UIView, duration: TimeInterval) + { + super.show(in: view, duration: duration) + + let announcement = (self.textLabel.text ?? "") + ". " + (self.detailTextLabel.text ?? "") + self.accessibilityLabel = announcement + + // Minimum 0.75 delay to prevent announcement being cut off by VoiceOver. + DispatchQueue.main.asyncAfter(deadline: .now() + 0.75) { + UIAccessibility.post(notification: .announcement, argument: announcement) + } + } + override func show(in view: UIView) { self.show(in: view, duration: self.preferredDuration)