Commit 0bef85c4 by ludi

Merge branch 'feature/UI修改版本' of http://git.yabolive.net:88/pidan/FuSiLive into feature/UI修改版本

parents eae9c769 e68066f6
Showing with 101 additions and 376 deletions
......@@ -115,7 +115,7 @@
if (task.resourceType == FUSDownloadResourceTypeResource) {
NSString *downloadPath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl];
NSString *downloadPath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl pathMd5:task.downloadMd5];
// 如果文件存在则不下载,直接返回成功
if ([FUSFileHelper fus_isExistFileAtPath:downloadPath]) {
// 如果md5为空或者md5校验通过,则直接返回成功
......@@ -131,7 +131,7 @@
// 如果解压后的资源是存在的,则使用解压后的资源
if ([FUSFileHelper fus_isExistFileAtPath:task.unzipPath]) {
[task fus_executeDownloadSucceedHandlerWithFilePath:[FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl]];
[task fus_executeDownloadSucceedHandlerWithFilePath:[FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl pathMd5:task.downloadMd5]];
[self updateStateWithIsExcuting:NO];
FUSLogInfo(@"pierce:%s 资源已存在 %@",__func__,task.unzipPath);
return;
......@@ -142,7 +142,7 @@
// 解压成功
if (succeed) {
FUSLogInfo(@"pierce:%s 解压成功 %@",__func__,task.downloadUrl);
[task fus_executeDownloadSucceedHandlerWithFilePath:[FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl]];
[task fus_executeDownloadSucceedHandlerWithFilePath:[FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl pathMd5:task.downloadMd5]];
[self updateStateWithIsExcuting:NO];
} else {
......@@ -159,7 +159,7 @@
else {
// 如果文件存在,且MD5正确,则返回正确
[task fus_executeDownloadSucceedHandlerWithFilePath:[FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl]];
[task fus_executeDownloadSucceedHandlerWithFilePath:[FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:task.downloadUrl pathMd5:task.downloadMd5]];
[self updateStateWithIsExcuting:NO];
return;
}
......
......@@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *unzipPath;
// 优先级
@property (nonatomic, assign) NSOperationQueuePriority downloadPriority;
@property (nonatomic, assign) NSInteger downloadPriority;
// 资源类型
@property (nonatomic, assign) FUSDownloadResourceType resourceType;
......
......@@ -255,12 +255,12 @@ static dispatch_queue_t get_downloadOperationQueue(){
switch (bitrateLimit) {
case FUSResourceDownloaderBitrateLimitedLow:
self.needLimitBitRate = YES;
self.maxDownloadBitRate = 1 * 500 * 1024;
self.maxDownloadBitRate = 2 * 1024 * 1024;
break;
case FUSResourceDownloaderBitrateLimitedNormal:
self.needLimitBitRate = YES;
self.maxDownloadBitRate = 2 * 1024 * 1024;
self.maxDownloadBitRate = 3 * 1024 * 1024;
break;
case FUSResourceDownloaderBitrateLimitedNoLimit:
......@@ -275,13 +275,15 @@ static dispatch_queue_t get_downloadOperationQueue(){
}
[task suspend];
__weak typeof(self) weakSelf = self;
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:waitTime repeats:NO block:^(NSTimer * _Nonnull timer) {
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:waitTime repeats:YES block:^(NSTimer * _Nonnull timer) {
[task resume];
weakSelf.lastSecondSize = 0;
weakSelf.lastUpdateTime = [NSDate date].timeIntervalSince1970;
[timer invalidate];
}];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
[[NSRunLoop currentRunLoop] run];
}
......
......@@ -1206,7 +1206,7 @@
}
// 拼接下载地址及下载存储路径
NSString *downPath = [FUSConfig.sharedInstanced.pathConfigs.downloadPathDocument stringByAppendingPathComponent:relativePath];
NSString *downPath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:relativePath pathMd5:md5Check];
NSString *cachePath = [DOWNLOAD_PATH_CACHES stringByAppendingPathComponent:relativePath];
NSString *downUrl = [NSString stringWithString:dnsUrl];
if ([downUrl rangeOfString:relativePath].location == NSNotFound) {
......
......@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 图片的下载地址
@property (nonatomic, copy, readonly) NSString *downloadPathDocument;
- (NSString *)downloadResourcePath:(NSString *)resourcePath;
- (NSString *)downloadResourcePath:(NSString *)resourcePath pathMd5:(NSString *)md5;
/// 图片的下载解压地址
@property (nonatomic, copy, readonly) NSString *resourceUnzipDocument;
......
......@@ -37,7 +37,7 @@
return @"";
}
- (NSString *)downloadResourcePath:(NSString *)resourcePath {
- (NSString *)downloadResourcePath:(NSString *)resourcePath pathMd5:(NSString *)md5 {
return @"";
}
......
......@@ -117,6 +117,38 @@ static dispatch_queue_t get_status_queue() {
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// NSString *document = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingString:@"/ATest"];
// [FUSFileHelper createDirectoryAtPath:document];
//
// for (NSInteger i = 1; i <= 99;i++) {
// NSString *filePath = [document stringByAppendingPathComponent:[NSString stringWithFormat:@"fus_time_level_%zd.png",i]];
//
// if (![FUSFileHelper fus_isExistFileAtPath:filePath]) {
// CGFloat width = 20;
//
// /// 生成等级图片。保存在本地,然后再将路径加入HTML里面
// UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 14)];
// timeLabel.text = @(i).stringValue;
// timeLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.32];
// timeLabel.textColor = [UIColor whiteColor];
// timeLabel.font = [UIFont fus_themeFont:9];
// timeLabel.layer.cornerRadius = 7;
// timeLabel.textAlignment = NSTextAlignmentCenter;
// timeLabel.layer.masksToBounds = YES;
//
// UIGraphicsBeginImageContextWithOptions(timeLabel.bounds.size, NO, [UIScreen mainScreen].scale);
// [timeLabel drawViewHierarchyInRect:timeLabel.bounds afterScreenUpdates:YES];
// UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
// UIGraphicsEndImageContext();
//
// if (screenImage) {
// NSData *imageData = UIImagePNGRepresentation(screenImage);
// [FUSFileHelper fus_writeDataToFile:imageData filePath:filePath];
// }
// }
// }
[FUSConfig fus_setUpFusiLiveConfigs];
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "大礼包-背景光-灰色@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "大礼包-背景光-灰色@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "消息聊天-更多-拍照@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "消息聊天-更多-拍照@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "周榜@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "消息聊天-好友-小箭头向下@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "消息聊天-好友-小箭头向下@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "消息聊天-好友-小箭头@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "消息聊天-好友-小箭头@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "indicator_right_rtl@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "indicator_right_rtl@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "1@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "2@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "3@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "111.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "222.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "icon_语音介绍.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "萤火卡片@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "萤火卡片@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -76,7 +76,7 @@
dispatch_async(dispatch_get_global_queue(0, 0), ^{
self.attr = [NSMutableAttributedString fus_attributeStringWithHTMLString:self.languageContent baseColor:@"222222" font:[UIFont fus_themeFont:13] needRTLTransfer:FUSRTL.isRTL imgHeight:33 imgWidth:0];
self.attr = [NSMutableAttributedString fus_attributeStringWithHTMLString:self.languageContent baseColor:@"222222" font:[UIFont fus_themeFont:13] needRTLTransfer:FUSRTL.isRTL imgHeight:33 imgWidth:33];
dispatch_async(dispatch_get_main_queue(), ^{
if (completed) {
......
......@@ -29,10 +29,10 @@
@property (nonatomic, strong) UIView *labelContentView;
// 正在显示的label
@property (nonatomic, strong) UILabel *showwingLabel;
@property (nonatomic, strong) YYLabel *showwingLabel;
// 下次显示的label
@property (nonatomic, strong) UILabel *nextLabel;
@property (nonatomic, strong) YYLabel *nextLabel;
// 是否动画中
@property (nonatomic, assign) BOOL isAnimating;
......@@ -80,11 +80,11 @@
[self addSubview:self.labelContentView];
self.labelContentView.clipsToBounds = YES;
self.showwingLabel = [[UILabel alloc] initWithFrame:self.labelContentView.bounds];
self.showwingLabel = [[YYLabel alloc] initWithFrame:self.labelContentView.bounds];
self.showwingLabel.font = [UIFont fus_themeFont:13];
[self.labelContentView addSubview:self.showwingLabel];
self.nextLabel = [[UILabel alloc] initWithFrame:self.labelContentView.bounds];
self.nextLabel = [[YYLabel alloc] initWithFrame:self.labelContentView.bounds];
self.nextLabel.font = [UIFont fus_themeFont:13];
[self.labelContentView addSubview:self.nextLabel];
......@@ -204,7 +204,7 @@
self.nextLabel.y = 0;
} completion:^(BOOL finished) {
UILabel *tmpLabel = self.showwingLabel;
YYLabel *tmpLabel = self.showwingLabel;
self.showwingLabel = self.nextLabel;
self.nextLabel = tmpLabel;
self.nextLabel.x = 0;
......
......@@ -1146,26 +1146,33 @@ NSString * const kMD5GiftResourceKey = @"kMD5GiftResourceKey";
// 循环遍历礼物资源
dispatch_async(get_gift_resource_parse_queue(), ^{
for (FUSGiftResourceModel *model in liveGiftArr) {
// [weakSelf checkImageCacheWithImageUrl:model.darkRes];
FUSLogInfo(@"====--- 锁1");
__strong typeof(model) strongModel = model;
NSString *resPath = strongModel.darkRes;
NSString *md5 = strongModel.darkMd5;
if (![NSString isNull:strongModel.zipRes]) {
resPath = strongModel.zipRes;
md5 = strongModel.zipMd5;
}
[weakSelf checkResourceDownloadWithResourceUrl:resPath
resourceMd5:md5
gid:strongModel.gid success:^{
} failure:^(NSString *msg, int code) {
}];
NSArray *sortedArr = [liveGiftArr sortedArrayUsingComparator:^NSComparisonResult(FUSGiftResourceModel * _Nonnull obj1, FUSGiftResourceModel * _Nonnull obj2) {
if (obj1.weight > obj2.weight) {
return NSOrderedAscending;
}else {
return NSOrderedDescending;
}
}];
for (FUSGiftResourceModel *model in sortedArr) {
// [weakSelf checkImageCacheWithImageUrl:model.darkRes];
FUSLogInfo(@"====--- 锁1");
__strong typeof(model) strongModel = model;
NSString *resPath = strongModel.darkRes;
NSString *md5 = strongModel.darkMd5;
if (![NSString isNull:strongModel.zipRes]) {
resPath = strongModel.zipRes;
md5 = strongModel.zipMd5;
}
[weakSelf checkResourceDownloadWithResourceUrl:resPath
resourceMd5:md5
gid:strongModel.gid success:^{
} failure:^(NSString *msg, int code) {
}];
}
});
} failure:^(NSString *msg, int code) {
......@@ -1423,7 +1430,7 @@ NSString * const kMD5GiftResourceKey = @"kMD5GiftResourceKey";
resourceMd5:(NSString *)resourceMd5
completion:(void(^)(YYImage *yyImage))completion
{
NSString *filePath = [NSString stringWithFormat:@"%@%@", FUSConfig.sharedInstanced.pathConfigs.downloadPathDocument, resourceUrl];
NSString *filePath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:resourceUrl pathMd5:resourceMd5];
if (![FUSFileHelper fus_isExistFileAtPath:filePath]) {
......
......@@ -30,4 +30,7 @@
// zip资源MD5
@property (nonatomic, copy) NSString *zipMd5;
/// 下载权重
@property (nonatomic, assign) NSInteger weight;
@end
......@@ -45,6 +45,9 @@
@property (nonatomic, copy) NSString *micGiftDesc; // 礼物显示描述
@property (nonatomic, assign) BOOL isMystic; // 是否为神秘礼物
/// 下载权重
@property (nonatomic, assign) NSInteger weight;
@property (nonatomic, copy) NSString *position; // 在礼物面板中的位置
// 礼物大类(1:normal,2:webp,3:zip)
......
......@@ -32,4 +32,7 @@
// html 内容
@property (nonatomic, copy) NSString *content;
/// 下载权重
@property (nonatomic, assign) NSInteger weight;
@end
......@@ -416,42 +416,6 @@
} else {
NSString *path = [NSString stringWithFormat:@"<img src=https://big.bgp.ourpow.com/comm/userlevel/fusi/TimeLevels/fus_time_level_%zd.png />",level];
content = [content stringByReplacingCharactersInRange:result.range withString:path];
// NSString *document = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingString:@"/ATest"];
// [FUSFileHelper createDirectoryAtPath:document];
//
// for (NSInteger i = 1; i <= 99;i++) {
// NSString *filePath = [document stringByAppendingPathComponent:[NSString stringWithFormat:@"fus_time_level_%zd.png",i]];
//
// if (![FUSFileHelper fus_isExistFileAtPath:filePath]) {
// CGFloat width = 14;
// if (i >= 10) {
// width = 20;
// }
// /// 生成等级图片。保存在本地,然后再将路径加入HTML里面
// UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 14)];
// timeLabel.text = @(i).stringValue;
// timeLabel.backgroundColor = [UIColor colorWithWhite:1 alpha:0.32];
// timeLabel.textColor = [UIColor whiteColor];
// timeLabel.font = [UIFont fus_themeFont:9];
// timeLabel.layer.cornerRadius = 7;
// timeLabel.textAlignment = NSTextAlignmentCenter;
// timeLabel.layer.masksToBounds = YES;
//
// UIGraphicsBeginImageContextWithOptions(timeLabel.bounds.size, NO, [UIScreen mainScreen].scale);
// [timeLabel drawViewHierarchyInRect:timeLabel.bounds afterScreenUpdates:YES];
// UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
// UIGraphicsEndImageContext();
//
// if (screenImage) {
// NSData *imageData = UIImagePNGRepresentation(screenImage);
// [FUSFileHelper fus_writeDataToFile:imageData filePath:filePath];
// }
// }
// }
// UIImage *testImg = [UIImage imageWithContentsOfFile:filePath];
// content = [content stringByReplacingCharactersInRange:result.range withString:[NSString stringWithFormat:@"<img src=%@ />",filePath]];
}
}
}
......
......@@ -12,7 +12,7 @@
// 192.168.1.122
#define BYTE_DANCE_FILTER_RESOURCE_PATH [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:@"/BytedanceResource"]
#define BYTE_DANCE_FILTER_RESOURCE_PATH [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:@"/BytedanceResource" pathMd5:@""]
NS_ASSUME_NONNULL_BEGIN
......
......@@ -220,11 +220,21 @@
}
- (NSString *)resourceUnzipDocument {
return [self downloadResourcePath:@"/GiftResourceUnzipPath"];
return [self downloadResourcePath:@"/GiftResourceUnzipPath" pathMd5:@""];
}
- (NSString *)downloadResourcePath:(NSString *)resourcePath {
return [NSString stringWithFormat:@"%@%@", self.downloadPathDocument, resourcePath];
- (NSString *)downloadResourcePath:(NSString *)resourcePath pathMd5:(NSString *)md5 {
NSString *pathExtension = resourcePath.pathExtension;
if ([NSString isNull:md5] || [pathExtension isEqualToString:@"zip"]) {
return [NSString stringWithFormat:@"%@%@", self.downloadPathDocument, resourcePath];
}
NSString *resource = resourcePath.lastPathComponent;
NSString *md5Path = [NSString stringWithFormat:@"%@.%@",md5,pathExtension];
NSString *md5ResourcePath = [resourcePath stringByReplacingOccurrencesOfString:resource withString:md5Path];
return [NSString stringWithFormat:@"%@%@", self.downloadPathDocument, md5ResourcePath];
}
- (NSString *)thumbImageSizeUrl:(NSString *)url size:(CGFloat)size {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment