-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[iOS] Fixes animated gifs incorrectly looping #25612
Conversation
Let's try |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@osdnk has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@@ -87,6 +87,10 @@ - (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source | |||
NSNumber *gifLoopCount = gifProperties[(__bridge NSString *)kCGImagePropertyGIFLoopCount]; | |||
if (gifLoopCount != nil) { | |||
loopCount = gifLoopCount.unsignedIntegerValue; | |||
// A loop count of 1 means it should repeat twice, 2 means, thrice, etc. | |||
if (loopCount != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @zhongwuzw ,
I think we could simplify this, we could assign loopCount = 0 and then when returning from the function we could return loopCount + 1. This way we get rid of this condition. What do you think?
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sammy-SC Emm, if we return loopCount + 1
, the min value is 1? but we need to return 0 if gifLoopCount
exist and its value is 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see :)
Thanks for fixing this.
This pull request was successfully merged by @zhongwuzw in 6f2e6f1. When will my fix make it into a release? | Upcoming Releases |
Summary
After migrate to new GIF implementation, we need to do some cleanup, before, we already unify the gif loop count between iOS and Android, more details please see #21999, so let's unify it again.
Changelog
[iOS] [Fixed] - Fixes animated gifs incorrectly looping
Test Plan
example gif should repeat playback twice.