chore: Initial clean commit

- Removed YuMi/Library/ (138 MB, not tracked)
- Removed YuMi/Resources/ (23 MB, not tracked)
- Removed old version assets (566 files, not tracked)
- Excluded Pods/, xcuserdata/ and other build artifacts
- Clean repository optimized for company server deployment
This commit is contained in:
edwinQQQ
2025-10-09 16:19:14 +08:00
commit a35a711be6
5582 changed files with 408913 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
//
// SVGAParserManager.h
// YMhat
//
// Created by 卫明何 on 2018/4/11.
// Copyright © 2018年 XC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SVGA.h"
@interface SVGAParserManager : NSObject
- (void)loadSvgaWithURL:(NSURL *_Nullable)url
completionBlock:(void ( ^ _Nonnull )(SVGAVideoEntity * _Nullable videoItem))completionBlock
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock;
@end

View File

@@ -0,0 +1,111 @@
//
// SVGAParserManager.m
// YMhat
//
// Created by on 2018/4/11.
// Copyright © 2018 XC. All rights reserved.
//
#import "SVGAParserManager.h"
#import "YYUtility.h"
#import "GCDHelper.h"
#import "YUMIMacroUitls.h"
static NSInteger retryCount = 3;
@interface SVGAParserManager ()
@property (nonatomic,strong) NSMutableDictionary *parserQueue;
@property (nonatomic,strong) NSMutableDictionary *retryCache;
@property (nonatomic,strong) SVGAParser *parser;
@end
@implementation SVGAParserManager
- (void)loadSvgaWithURL:(NSURL *)url
completionBlock:(void (^)(SVGAVideoEntity * _Nullable))completionBlock
failureBlock:(void (^)(NSError * _Nullable))failureBlock {
if (!url) return;
@kWeakify(self);
NSString *key = [self cacheURL:url];
[self.parser parseWithURL:url completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@kStrongify(self);
dispatch_main_sync_safe(^{
@kStrongify(self);
if (videoItem) {
completionBlock(videoItem);
[self removeCacheWithKey:key];
[self.retryCache removeObjectForKey:key];
}
});
} failureBlock:^(NSError * _Nullable error) {
@kStrongify(self);
if (error) {
if (![self.retryCache objectForKey:key]) {
[self.retryCache setObject:@(0) forKey:key];
}
[self.retryCache setObject:@([[self.retryCache objectForKey:key] integerValue] + 1) forKey:key];
if ([[self.retryCache objectForKey:key] integerValue] < retryCount) {
[self retryWithKey:key completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
completionBlock(videoItem);
} failureBlock:^(NSError * _Nullable error) {
failureBlock(error);
}];
}
}
}];
}
//
- (void)retryWithKey:(NSString *)key
completionBlock:(void (^)(SVGAVideoEntity * _Nullable))completionBlock
failureBlock:(void (^)(NSError * _Nullable))failureBlock {
if (key) {
NSURL *url = [self.parserQueue objectForKey:key];
[self loadSvgaWithURL:url completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
completionBlock(videoItem);
} failureBlock:^(NSError * _Nullable error) {
}];
}
}
// url
- (NSString *)cacheURL:(NSURL *)url {
NSString *key = [self getUUid];
[self.parserQueue setObject:url forKey:key];
return key;
}
- (void)removeCacheWithKey:(NSString *)key {
[self.parserQueue removeObjectForKey:key];
}
- (NSString *)getUUid {
return [UIDevice currentDevice].identifierForVendor.UUIDString;
}
#pragma mark - Getter
- (SVGAParser *)parser {
if (_parser == nil) {
_parser = [[SVGAParser alloc]init];
}
return _parser;
}
- (NSMutableDictionary *)parserQueue {
if (_parserQueue == nil) {
_parserQueue = [NSMutableDictionary dictionary];
}
return _parserQueue;
}
- (NSMutableDictionary *)retryCache {
if (_retryCache == nil) {
_retryCache = [NSMutableDictionary dictionary];
}
return _retryCache;
}
@end