Skip to content

Commit

Permalink
Ignore 0 timestamp since it is called too earlier under iOS 17
Browse files Browse the repository at this point in the history
If there is an APNGImageView object during app startup
  • Loading branch information
onevcat committed Dec 8, 2023
1 parent bfd119f commit 5271088
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 5271088

Please sign in to comment.