Skip to content

Commit

Permalink
Add checking availability for webp animation
Browse files Browse the repository at this point in the history
  • Loading branch information
gmary95 committed Jun 7, 2024
1 parent e711bb7 commit 0825988
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MMMLoadable.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Pod::Spec.new do |s|

s.name = "MMMLoadable"
s.version = "2.2.1"
s.version = "2.2.2"
s.summary = "A simple model for async calculations"
s.description = "#{s.summary}."
s.homepage = "https://github.com/mediamonks/#{s.name}"
Expand Down
7 changes: 5 additions & 2 deletions Sources/MMMLoadableObjC/MMMLoadableImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,10 @@ - (NSNumber *)imageAnimationDelayTime:(CGImageSourceRef)source {
return nil;
}
NSDictionary *gifProps = (__bridge NSDictionary *)(CFDictionaryRef)CFDictionaryGetValue(props, kCGImagePropertyGIFDictionary);
NSDictionary *webpProps = (__bridge NSDictionary *)(CFDictionaryRef)CFDictionaryGetValue(props, kCGImagePropertyWebPDictionary);
NSDictionary *webpProps = nil;
if (@available(iOS 14.0, *)) {
webpProps = (__bridge NSDictionary *)(CFDictionaryRef)CFDictionaryGetValue(props, kCGImagePropertyWebPDictionary);
}
CFRelease(props);
if (gifProps) {
return (NSNumber *)gifProps[(NSString *)kCGImagePropertyGIFDelayTime];
Expand Down Expand Up @@ -270,7 +273,7 @@ - (UIImage *)imageWithData:(NSData *)data {
[images addObject:image];
}

NSTimeInterval delayTime = MAX([delayTimeNum doubleValue], 0.1);
NSTimeInterval delayTime = MAX([delayTimeNum doubleValue], 0.04);

UIImage *result = [UIImage animatedImageWithImages:images duration:delayTime * count];

Expand Down

0 comments on commit 0825988

Please sign in to comment.