mirror of
https://github.com/svga/SVGAPlayer-iOS.git
synced 2025-10-20 23:19:13 +08:00
add SVGAImageView and SVGAVideoEntity to SVGA.h;
add URLRequest params to SVGAParser; update to 2.1.3;
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SVGAPlayer"
|
||||
s.version = "2.1.1"
|
||||
s.version = "2.1.3"
|
||||
s.summary = "SVGAPlayer 是一个高性能的动画播放器"
|
||||
s.description = <<-DESC
|
||||
SVGA 是一个私有的动画格式,由 YY UED 主导开发。
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "SVGAPlayer"
|
||||
s.version = "2.1.2"
|
||||
s.version = "2.1.3"
|
||||
s.summary = "SVGAPlayer 是一个高性能的动画播放器"
|
||||
s.description = <<-DESC
|
||||
SVGA 是一个私有的动画格式,由 YY UED 主导开发。
|
||||
|
@@ -9,6 +9,8 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SVGAParser.h"
|
||||
#import "SVGAPlayer.h"
|
||||
#import "SVGAImageView.h"
|
||||
#import "SVGAVideoEntity.h"
|
||||
#import "SVGAExporter.h"
|
||||
|
||||
@interface SVGA : NSObject
|
||||
|
@@ -16,6 +16,10 @@
|
||||
completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock
|
||||
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock;
|
||||
|
||||
- (void)parseWithURLRequest:(nonnull NSURLRequest *)URLRequest
|
||||
completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock
|
||||
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock;
|
||||
|
||||
- (void)parseWithData:(nonnull NSData *)data
|
||||
cacheKey:(nonnull NSString *)cacheKey
|
||||
completionBlock:(void ( ^ _Nullable)(SVGAVideoEntity * _Nonnull videoItem))completionBlock
|
||||
|
@@ -32,15 +32,21 @@ static NSOperationQueue *unzipQueue;
|
||||
- (void)parseWithURL:(nonnull NSURL *)URL
|
||||
completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock
|
||||
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock {
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[self cacheDirectory:[self cacheKey:URL]]]) {
|
||||
[self parseWithCacheKey:[self cacheKey:URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
[self parseWithURLRequest:[NSURLRequest requestWithURL:URL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:20.0]
|
||||
completionBlock:completionBlock
|
||||
failureBlock:failureBlock];
|
||||
}
|
||||
|
||||
- (void)parseWithURLRequest:(NSURLRequest *)URLRequest completionBlock:(void (^)(SVGAVideoEntity * _Nullable))completionBlock failureBlock:(void (^)(NSError * _Nullable))failureBlock {
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:[self cacheDirectory:[self cacheKey:URLRequest.URL]]]) {
|
||||
[self parseWithCacheKey:[self cacheKey:URLRequest.URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
if (completionBlock) {
|
||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
||||
completionBlock(videoItem);
|
||||
}];
|
||||
}
|
||||
} failureBlock:^(NSError * _Nonnull error) {
|
||||
[self clearCache:[self cacheKey:URL]];
|
||||
[self clearCache:[self cacheKey:URLRequest.URL]];
|
||||
if (failureBlock) {
|
||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
||||
failureBlock(error);
|
||||
@@ -49,16 +55,16 @@ static NSOperationQueue *unzipQueue;
|
||||
}];
|
||||
return;
|
||||
}
|
||||
[[[NSURLSession sharedSession] dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
[[[NSURLSession sharedSession] dataTaskWithRequest:URLRequest completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error == nil && data != nil) {
|
||||
[self parseWithData:data cacheKey:[self cacheKey:URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
[self parseWithData:data cacheKey:[self cacheKey:URLRequest.URL] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
if (completionBlock) {
|
||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
||||
completionBlock(videoItem);
|
||||
}];
|
||||
}
|
||||
} failureBlock:^(NSError * _Nonnull error) {
|
||||
[self clearCache:[self cacheKey:URL]];
|
||||
[self clearCache:[self cacheKey:URLRequest.URL]];
|
||||
if (failureBlock) {
|
||||
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
|
||||
failureBlock(error);
|
||||
|
Reference in New Issue
Block a user