Skip to content

Commit

Permalink
Merge pull request #140 from onevcat/fix/ios-17-startup
Browse files Browse the repository at this point in the history
Ignore 0 timestamp since it is called too earlier under iOS 17
  • Loading branch information
onevcat committed Dec 8, 2023
2 parents bfd119f + 5271088 commit 22558d0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/APNGKit/APNGImageView.swift
Expand Up @@ -381,7 +381,14 @@ open class APNGImageView: PlatformView {
@objc private func appMovedFromBackground() {
// Reset the current displaying frame when the app is active again.
// This prevents the animation being played faster due to the old timestamp.
displayingFrameStarted = drivingTimer?.timestamp
//
// Also check to ignore when `timestamp` is still 0. It is an app lifetime change from iOS 17 where an APNGImage
// instance already exists when app starts. See #139.
if let timer = drivingTimer, timer.timestamp == 0 {
displayingFrameStarted = timer.timestamp
} else {
displayingFrameStarted = nil
}
}

// Invalid and reset the display link.
Expand Down

0 comments on commit 22558d0

Please sign in to comment.