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

Refactory AnimatedImageView with player backend, supports more rendering target like WatchKit/SwiftUI #2882

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: #2867 #2861

Pull Request Description

Feature Proposal see #2861.

This is the real implementation of that refactory, now we can use SDAnimatedImagePlayer to support more common usage, for example:

  • WatchKit support: See the updated WatchKit demo with that player, with better performance than WKInterfaceImage
  • SwiftUI: See SDWebImageSwiftUI)
  • Thread safe: Yes, this animated player is now thread-safe to use, not like that SDAnimartedImageView which force main queue

Extra Changes

During this refactory, there are also a solution change for our current Progressive Animated Loading.

Now, the animated player directly get the coder, such as SDImageGIFCoder, so that it don't need previously check of image data (That's a little suck on performance because of NSData subdata compare).

This PR also move those utils method SDDeviceTotalMemory and SDDeviceFreeMemory into a new private header SDDeviceHelper.h, make it easy for code maintain and readability.

CC @kinarobin

@dreampiggy dreampiggy force-pushed the refactory_animated_player_phase2 branch 2 times, most recently from e0bb013 to a857762 Compare November 4, 2019 09:02
@codecov
Copy link

codecov bot commented Nov 4, 2019

Codecov Report

Merging #2882 into master will increase coverage by 0.08%.
The diff coverage is 86.11%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2882      +/-   ##
==========================================
+ Coverage   84.13%   84.21%   +0.08%     
==========================================
  Files          63       65       +2     
  Lines        6346     6393      +47     
==========================================
+ Hits         5339     5384      +45     
- Misses       1007     1009       +2
Flag Coverage Δ
#ios 85.04% <86.03%> (+0.23%) ⬆️
#macos 83.01% <81.04%> (+0.29%) ⬆️
#tvos 85.04% <85.07%> (+0.11%) ⬆️
Impacted Files Coverage Δ
SDWebImage/Core/SDAnimatedImage.m 87.97% <100%> (+0.63%) ⬆️
SDWebImage/Private/SDDeviceHelper.m 100% <100%> (ø)
SDWebImage/Core/SDAnimatedImageView.m 76.14% <80.28%> (-5.61%) ⬇️
SDWebImage/Core/SDAnimatedImagePlayer.m 86.72% <86.72%> (ø)
SDWebImage/Core/SDWebImageDownloaderOperation.m 92.4% <0%> (-0.31%) ⬇️
SDWebImage/Core/SDImageIOAnimatedCoder.m 83.52% <0%> (+0.37%) ⬆️
SDWebImage/Core/SDWebImagePrefetcher.m 90.56% <0%> (+0.62%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 469d2c5...aa3d222. Read the comment docs.

@dreampiggy dreampiggy force-pushed the refactory_animated_player_phase2 branch from a857762 to 6a3f975 Compare November 4, 2019 12:15
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