diff --git a/SVGAPlayer.podspec b/SVGAPlayer.podspec index 3753c367..38e50349 100644 --- a/SVGAPlayer.podspec +++ b/SVGAPlayer.podspec @@ -25,7 +25,7 @@ Pod::Spec.new do |s| s.subspec 'ProtoFiles' do |ss| ss.source_files = "Source/pbobjc/*.{h,m}" ss.requires_arc = false - ss.dependency 'Protobuf', '~> 3.4' + ss.dependency 'Protobuf', '~> 3.22.1' ss.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1', } diff --git a/Source/SVGAPlayer.m b/Source/SVGAPlayer.m index 289e09f0..60f38024 100644 --- a/Source/SVGAPlayer.m +++ b/Source/SVGAPlayer.m @@ -400,6 +400,7 @@ - (void)next { if (self.videoItem.frames > 0) { if ([delegate respondsToSelector:@selector(svgaPlayer:didAnimatedToPercentage:)]) { [delegate svgaPlayer:self didAnimatedToPercentage:(CGFloat)(self.currentFrame + 1) / (CGFloat)self.videoItem.frames]; + } else if ([delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToPercentage:)]) { [delegate svgaPlayerDidAnimatedToPercentage:(CGFloat)(self.currentFrame + 1) / (CGFloat)self.videoItem.frames]; } diff --git a/Source/SVGAVideoEntity.h b/Source/SVGAVideoEntity.h index 77498206..81329645 100644 --- a/Source/SVGAVideoEntity.h +++ b/Source/SVGAVideoEntity.h @@ -36,6 +36,10 @@ - (void)saveCache:(NSString *)cacheKey; // NSMapTable弱缓存 - (void)saveWeakCache:(NSString *)cacheKey; +/// 清除缓存 ++ (void)clearCache:(NSString *)cacheKey; +/// 清除所有缓存 ++ (void)clearAllCache; @end diff --git a/Source/SVGAVideoEntity.m b/Source/SVGAVideoEntity.m index cd63400a..1cb68586 100644 --- a/Source/SVGAVideoEntity.m +++ b/Source/SVGAVideoEntity.m @@ -233,6 +233,16 @@ - (void)saveWeakCache:(NSString *)cacheKey { dispatch_semaphore_signal(videoSemaphore); } ++ (void)clearCache:(NSString *)cacheKey{ + dispatch_semaphore_wait(videoSemaphore, DISPATCH_TIME_FOREVER); + [videoCache removeObjectForKey:cacheKey]; + dispatch_semaphore_signal(videoSemaphore); +} + ++ (void)clearAllCache{ + [videoCache removeAllObjects]; +} + @end @interface SVGAVideoSpriteEntity()