mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Conform to UIAccessibility.isReduceMotionEnabled
This commit is contained in:
committed by
Stefan Ceriu
parent
29bcc5371a
commit
bba3fab31d
@@ -23,7 +23,7 @@ public extension Animation {
|
|||||||
|
|
||||||
/// `noAnimation` if running UI tests, otherwise `default` animation.
|
/// `noAnimation` if running UI tests, otherwise `default` animation.
|
||||||
static var elementDefault: Animation {
|
static var elementDefault: Animation {
|
||||||
Tests.isRunningUITests ? .noAnimation : .default
|
Tests.isRunningUITests ? .noAnimation : (UIAccessibility.isReduceMotionEnabled ? .noAnimation : .default)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+10
-1
@@ -181,8 +181,17 @@ class TimelineTableViewController: UIViewController {
|
|||||||
|
|
||||||
// We only animate when there's a new last message, so its safe
|
// We only animate when there's a new last message, so its safe
|
||||||
// to animate from the bottom (which is the top as we're flipped).
|
// to animate from the bottom (which is the top as we're flipped).
|
||||||
dataSource?.defaultRowAnimation = .top
|
dataSource?.defaultRowAnimation = (UIAccessibility.isReduceMotionEnabled ? .none : .top)
|
||||||
tableView.delegate = self
|
tableView.delegate = self
|
||||||
|
|
||||||
|
NotificationCenter.default.addObserver(self,
|
||||||
|
selector: #selector(accessibilityReduceMotionDidChange),
|
||||||
|
name: UIAccessibility.reduceMotionStatusDidChangeNotification,
|
||||||
|
object: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc private func accessibilityReduceMotionDidChange() {
|
||||||
|
dataSource?.defaultRowAnimation = (UIAccessibility.isReduceMotionEnabled ? .none : .top)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Updates the table view with the latest items from the ``timelineItems`` array. After
|
/// Updates the table view with the latest items from the ``timelineItems`` array. After
|
||||||
|
|||||||
Reference in New Issue
Block a user