From 8f3f5ae84349a583d67dbb5d42ae8ede96c4a987 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 29 Jan 2024 09:29:37 -0600 Subject: [PATCH] ensure voiceover is running Signed-off-by: Matt Bruce --- VDS/Components/Loader/Loader.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/VDS/Components/Loader/Loader.swift b/VDS/Components/Loader/Loader.swift index 691fed89..f765c4e6 100644 --- a/VDS/Components/Loader/Loader.swift +++ b/VDS/Components/Loader/Loader.swift @@ -107,10 +107,18 @@ open class Loader: View { rotation.duration = 0.5 rotation.repeatCount = .infinity icon.layer.add(rotation, forKey: rotationLayerName) - + + // check to make sure VoiceOver is running + guard UIAccessibility.isVoiceOverRunning else { + loadingTimer?.invalidate() + loadingTimer = nil + return + } + // Focus VoiceOver on this view UIAccessibility.post(notification: .layoutChanged, argument: self) - + + // setup timer for post loadingTimer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) { [weak self] _ in self?.accessibilityLabel = "Still Loading" UIAccessibility.post(notification: .announcement, argument: "Still Loading")