-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove SDWebImage dependency #21285
Remove SDWebImage dependency #21285
Conversation
👋 @kean, would you be able to give me your thoughts on this as a follow-up to #20956 (comment)? The main thing I'm not sure about is what the value of the cache cost calculation that |
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
@guarani I'd suggest going with option B and reimplementing the SDWebImage version: UIImage+MemoryCacheCost.m.
If you don't pass the cost, it'll be 0 (only documented in the headers): - (void)setObject:(ObjectType)obj forKey:(KeyType)key; // 0 cost The cost must be non-zero in order for the
SDWebImage also handles it, but we are not using |
This proposes replaces usage of `SDWebImage` in the new `MemoryCache` following the comment #20956 (comment). It's only being used in one instance, to calculate the cost of objects added to the cache. What's the difference between not passing in a cost and using `sd_memoryCost`? I'm not sure, so I'll share my current understanding and ask for feedback. For images, I don't see a difference because I think the cost is the image's size in bytes. For gifs (also `UIImage`s), the cost calculation seems more complex since I think it's only the number of frames loaded into memory (not the frames that are kept on disk). This PR is meant to start a conversation about which option to take: a. Let `NSCache` calculate the cost and remove `SDWebImage` from the Podfile b. Re-implement a cost calculation and remove `SDWebImage` from the Podfile c. Leave things as-is and close this PR The assumption here is that by removing `SDWebImage`, we're not importing the library twice (once here and once in Gutenberg as a transitive dependency of a RN library).
28ad671
to
5156b31
Compare
I rebased it and updated cost calculation – ready for merge. |
f8d3254
to
9d83e7f
Compare
Generated by 🚫 Danger |
Thanks @kean! |
This proposes replaces usage of
SDWebImage
in the newMemoryCache
following the comment #20956 (comment). It's only being used in one instance, to calculate the cost of objects added to the cache.What's the difference between not passing in a cost and using
sd_memoryCost
? I'm not sure, so I'll share my current understanding and ask for feedback. For images, I don't see a difference because I think the cost is the image's size in bytes. For gifs (alsoUIImage
s), the cost calculation seems more complex since I think it's only the number of frames loaded into memory (not the frames that are kept on disk).This PR is meant to start a conversation about which option to take: a. Let
NSCache
calculate the cost and removeSDWebImage
from the Podfile b. Re-implement a cost calculation and removeSDWebImage
from the Podfile c. Leave things as-is and close this PRThe assumption here is that by removing
SDWebImage
, we're not importing the library twice (once here and once in Gutenberg as a transitive dependency of a RN library).To test: TO-DO
Regression Notes
PR submission checklist:
RELEASE-NOTES.txt
if necessary.UI Changes testing checklist: