diff --git a/TalerCommon/HelperViews/LaunchAnimationView.swift b/TalerCommon/HelperViews/LaunchAnimationView.swift index cd79b87d..f35a7fc0 100644 --- a/TalerCommon/HelperViews/LaunchAnimationView.swift +++ b/TalerCommon/HelperViews/LaunchAnimationView.swift @@ -30,6 +30,16 @@ struct RotatingTaler: View { @Binding var rotationEnabled: Bool @State private var rotationDirection = false + /// Someone who has asked the system for less motion gets a still logo. + /// + /// This also has a consequence beyond accessibility: the `once: false` + /// form restarts a 1.5s animation every 1.5s for as long as it is on + /// screen, so Core Animation always has an animation in flight. XCUITest + /// will not synthesize a tap or a swipe until the app reports itself idle, + /// and an app that always has a running animation never does -- every + /// event then fails after about two minutes, which makes the app + /// undrivable by UI automation while any progress indicator is visible. + @Environment(\.accessibilityReduceMotion) private var reduceMotion private let animationTimer = Timer .publish(every: 1.5, on: .current, in: .common) @@ -46,7 +56,7 @@ struct RotatingTaler: View { .rotationEffect(rotationDirection ? Angle(degrees: 0) : Angle(degrees: once ? 900 : 720)) .onReceive(animationTimer) { timerValue in // print("Timer: \(timerValue), rotationDirection: \(rotationDirection)") - if rotationEnabled { + if rotationEnabled && !reduceMotion { if !once { withAnimation(.easeInOut(duration: 1.5)) { rotationDirection.toggle() @@ -55,7 +65,7 @@ struct RotatingTaler: View { } } .task { - if once { + if once && !reduceMotion { withAnimation(.easeInOut(duration: 2.0)) { rotationDirection.toggle() }