From 6bf5f9416990e863ffcd56bdecd88f5e6041ef9d Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 23 Dec 2022 17:05:42 -0500 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20play=20GIFs=20in=20timelines=20?= =?UTF-8?q?if=20=E2=80=9CReduce=20Motion=E2=80=9D=20is=20enabled?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MastodonUI/View/Content/MediaView.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/MediaView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/MediaView.swift index a140d9737..5d8a3fb35 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/MediaView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/MediaView.swift @@ -191,7 +191,19 @@ extension MediaView { playerViewController.showsPlaybackControls = false // auto play for GIF - player.play() + if !UIAccessibility.isReduceMotionEnabled { + player.play() + } + NotificationCenter.default + .publisher(for: UIAccessibility.reduceMotionStatusDidChangeNotification) + .sink { _ in + if UIAccessibility.isReduceMotionEnabled { + player.pause() + } else { + player.play() + } + } + .store(in: &_disposeBag) bindAlt(configuration: configuration, altDescription: info.altDescription) }