feat(ios): optimize method loadImage:completed:
In the protocol of HippyImageViewCustomLoader, there is a method called loadImage:completed:. As an iOS developer, we usually use SDWebImage to implement this interface. The loadImage(_:completed:) method is implemented using the loadImage(with:options:progress:completed:) method provided by SDWebImageManager.
[SDWebImageManager.sharedManager loadImageWithURL:url options:0 progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { completedBlock(data, url, error, !!cacheType); }];
However, this implementation encountered some exceptions in practical scenarios. When the loaded image is found in the memory cache, the image parameter in the callback of the SDWebImageManager method has a value, but the data parameter is empty. This causes the image to fail to load in the application.
Therefore, aligning the interface with SDWebImage and internally handling this scenario will make it more convenient for integrators to implement and avoid encountering the same issue as I did.
Hi, @Geor9eLau. Thanks for your PR! :clap:
:label: You can leave a comment in this PR with #help tag when you need help (e.g. some status checks run failed due to internal issue), admin team members will help asap.
After a quick scan, I have approved workflow to run.
- SHA: 108a3de4b7424c9cdb7820ffde6cace215e4d8ae
:label: New commits in this PR would not be tested automatically until this pull request is reviewed by our collaborators.
:label: No need to worry about the status of merge_guard and [gh] pull request merge guard / merge_guard (pull_request_target) checks, once this pull request is met merge requirements, it will be automatically converted to successful status.
Pay attention 🛎️ !! There has been no activity on this PR for 2 months, so I will label it stalled. It will be automatically closed in 30 days if no more activity. Feel free to leave a comment if you have any questions.
Pay attention 🛎️ !! There has been no activity on this PR for 2 months, so I will label it stalled. It will be automatically closed in 30 days if no more activity. Feel free to leave a comment if you have any questions.
Sorry, closing this PR because it has stalled for over 4 months. Feel free to reopen if this PR is still relevant, or to ping the collaborator if you have any questions.
Pay attention 🛎️ !! There has been no activity on this PR for 2 months, so I will label it stalled. It will be automatically closed in 30 days if no more activity. Feel free to leave a comment if you have any questions.
Sorry, closing this PR because it has stalled for over 4 months. Feel free to reopen if this PR is still relevant, or to ping the collaborator if you have any questions.