Skip to content
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

Fix imageFromCacheForKey with options and context behavior, matching the async version one. #3238

Merged

Conversation

dreampiggy
Copy link
Contributor

New Pull Request Checklist

  • I have read and understood the CONTRIBUTING guide

  • I have read the Documentation

  • I have searched for a similar pull request in the project and found none

  • I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)

  • I have added the required tests to prove the fix/feature I am adding

  • I have updated the documentation (if necessary)

  • I have run the tests and they pass

  • I have run the lint and it passes (pod lib lint)

This merge request fixes / refers to the following issues: ...

Pull Request Description

Support SDImageCacheDecodeFirstFrameOnly and SDImageCacheMatchAnimatedImageClass

This may be a little related to #3230 . But not solve them all.

From the design of this framework, the SDAnimatedImage custom class, should provide the top level priority.

Which means:

  • If there are SDAnimatedImage custom class instance in memory cache: Always query and return it, whatever caller is UIImageView or SDAnimatedImageView
  • If there are UIImage not custom class instance in memory cache: If matchesImageClass, ignore it and override with new created one SDAnimatedImage.

This can ensure we always prefer the SDAnimatedImage over UIImage, so that we do not replace same instance once by another. (If we put UIImage and SDAnimatedImage with the same level priority, this will cause huge issue)

…the async version one.

Support `SDImageCacheDecodeFirstFrameOnly` and `SDImageCacheMatchAnimatedImageClass`
@dreampiggy dreampiggy added this to the 5.12.0 milestone May 21, 2021
@dreampiggy dreampiggy requested a review from kinarobin May 21, 2021 06:34
@kinarobin
Copy link
Member

How about add some test case ?

@dreampiggy
Copy link
Contributor Author

How about add some test case ?

Done in the test41MatchAnimatedImageClassWorks sync version as well.

@dreampiggy dreampiggy merged commit fd326e3 into SDWebImage:master May 21, 2021
@dreampiggy dreampiggy deleted the fix_image_from_cache_api_behavior branch May 21, 2021 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants