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

Override the UIImage+Metadata category method to provide the correct value for YYImage #5

Merged
merged 2 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "SDWebImage/SDWebImage" ~> 5.4
github "SDWebImage/SDWebImage" ~> 5.6
github "ibireme/YYCache" ~> 1.0
github "ibireme/YYImage" ~> 1.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
github "SDWebImage/SDWebImage" "5.4.0"
github "SDWebImage/SDWebImage" "5.6.0"
github "ibireme/YYCache" "1.0.4"
github "ibireme/YYImage" "1.0.4"
4 changes: 2 additions & 2 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- Expecta (1.0.6)
- SDWebImage/Core (5.4.0)
- SDWebImage/Core (5.6.0)
- SDWebImageYYPlugin (0.3.0):
- SDWebImage/Core (~> 5.4)
- SDWebImageYYPlugin/YYCache (= 0.3.0)
Expand Down Expand Up @@ -34,7 +34,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
SDWebImage: 5bf6aec6481ae2a062bdc59f9d6c1d1e552090e0
SDWebImage: 21b19f56b4226cdfe3aefe4e6848dc43ed129a86
SDWebImageYYPlugin: f6c1af162fb075efe5918d8caedee1f3d17c197e
YYCache: 8105b6638f5e849296c71f331ff83891a4942952
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
Expand Down
2 changes: 1 addition & 1 deletion SDWebImageYYPlugin.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TODO: Add long description of the pod here.
s.source_files = 'SDWebImageYYPlugin/Module/SDWebImageYYPlugin.h'
s.module_map = 'SDWebImageYYPlugin/Module/SDWebImageYYPlugin.modulemap'

s.dependency 'SDWebImage/Core', '~> 5.4'
s.dependency 'SDWebImage/Core', '~> 5.6'

s.subspec 'YYCache' do |ss|
ss.dependency 'YYCache'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,44 @@ - (NSUInteger)sd_memoryCost {

@end

@implementation YYImage (Metadata)

- (BOOL)sd_isAnimated {
return YES;
}

- (NSUInteger)sd_imageLoopCount {
return self.animatedImageLoopCount;
}

- (void)setSd_imageLoopCount:(NSUInteger)sd_imageLoopCount {
return;
}

- (SDImageFormat)sd_imageFormat {
switch (self.animatedImageType) {
case YYImageTypeJPEG:
case YYImageTypeJPEG2000:
return SDImageFormatJPEG;
case YYImageTypePNG:
return SDImageFormatPNG;
case YYImageTypeGIF:
return SDImageFormatGIF;
case YYImageTypeTIFF:
return SDImageFormatTIFF;
case YYImageTypeWebP:
return SDImageFormatWebP;
default:
return SDImageFormatUndefined;
}
}

- (void)setSd_imageFormat:(SDImageFormat)sd_imageFormat {
return;
}

- (BOOL)sd_isVector {
return NO;
}

@end