Commit a1f39fb5 by pierce

fixed bugs

parent 3cea9d2e
Showing with 105 additions and 97 deletions
......@@ -31,7 +31,7 @@
if ([urlString containsString:@"http"]) {
url = [NSURL URLWithString:urlString];
}else{
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]];
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]];
}
[self setImageWithURL:url forState:UIControlStateNormal placeholder:placeholder];
......@@ -54,7 +54,7 @@
if ([urlString containsString:@"http"]) {
url = [NSURL URLWithString:urlString];
}else{
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]];
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]];
}
[self setImageWithURL:url forState:UIControlStateNormal placeholder:placeholder options:kNilOptions completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
......@@ -81,7 +81,7 @@
if ([urlString containsString:@"http"]) {
url = [NSURL URLWithString:urlString];
}else{
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]];
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]];
}
[self setImageWithURL:url forState:state placeholder:placeholder];
......@@ -115,7 +115,7 @@
if ([urlString containsString:@"http"]) {
url = [NSURL URLWithString:urlString];
}else{
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]];
url = [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]];
}
[self setBackgroundImageWithURL:url forState:state placeholder:placeholder];
......
......@@ -44,7 +44,7 @@ static dispatch_queue_t get_image_clip_queue(){
}
if (![urlString containsString:@"http"]) {
urlString = [FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString];
urlString = [FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString];
}
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:urlString] placeholder:placeholder options:nil completion:nil];
......@@ -79,7 +79,7 @@ static dispatch_queue_t get_image_clip_queue(){
}
if (![urlString containsString:@"http"]) {
urlString = [FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString];
urlString = [FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString];
}
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:urlString] placeholder:placeholder options:nil completion:completion];
......@@ -104,7 +104,7 @@ static dispatch_queue_t get_image_clip_queue(){
}
if (![urlString containsString:@"http"]) {
urlString = [FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString];
urlString = [FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString];
}
[self cancelCurrentImageRequest];
......@@ -138,7 +138,7 @@ static dispatch_queue_t get_image_clip_queue(){
}
[self cancelCurrentImageRequest];
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]] placeholder:placeholder options:nil completion:completion];
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]] placeholder:placeholder options:nil completion:completion];
}
......@@ -167,7 +167,7 @@ static dispatch_queue_t get_image_clip_queue(){
if (![urlString containsString:@"http"]) {
urlString = [FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString];
urlString = [FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString];
}
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:urlString] placeholder:placeholder options:nil completion:nil];
......@@ -196,7 +196,7 @@ static dispatch_queue_t get_image_clip_queue(){
return;
}
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]] placeholder:placeholder options:options completion:nil];
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]] placeholder:placeholder options:options completion:nil];
}
- (void)setWebImageWithSubURLString:(NSString *)urlString placeholder:(UIImage *)placeholder completion:(YYWebImageCompletionBlock)completion
......@@ -228,7 +228,7 @@ static dispatch_queue_t get_image_clip_queue(){
}
if (![urlString containsString:@"http"]) {
urlString = [FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString];
urlString = [FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString];
}
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:urlString] placeholder:placeholder options:nil completion:completion];
......@@ -238,7 +238,7 @@ static dispatch_queue_t get_image_clip_queue(){
- (void)setBluredWebImageSubURLString:(NSString *)urlString placeholder:(UIImage *)placeholder
{
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]] placeholder:placeholder options:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]] placeholder:placeholder options:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
if ([urlString containsString:@"boy"] || [urlString containsString:@"girl"]) {
image = UIImage.fus_defaultIcon;
......@@ -274,7 +274,7 @@ static dispatch_queue_t get_image_clip_queue(){
return;
}
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]] placeholder:nil options:nil completion:completion];
[self setImageWithURL:[NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]] placeholder:nil options:nil completion:completion];
}
// 有占位图的聊天图片下载
......@@ -296,7 +296,7 @@ static dispatch_queue_t get_image_clip_queue(){
//下载有圆角的图片
- (void)setRadiusImageWithURL:(NSString *)urlString sizeToFit:(CGSize)size cornerRadius:(CGFloat)radius placeholderImage:(UIImage *)placeholder{
NSURL *url = [NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]];
NSURL *url = [NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]];
//这里默认是把图片剪成一个圆
if (radius == CGFLOAT_MIN) {
......@@ -361,7 +361,7 @@ static dispatch_queue_t get_image_clip_queue(){
//设置带边色的圆角图片
- (void)setRadiusImageWithURL:(NSString *)urlstring sizeToFit:(CGSize)size cornerRadius:(CGFloat)radius color:(NSString *)color borderWidth:(CGFloat)width withLevel:(NSString *)level placeholderImage:(UIImage *)placeholder{
NSURL *url = [NSString isNull:urlstring] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlstring]];
NSURL *url = [NSString isNull:urlstring] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlstring]];
if ([NSString isNull:color]) {
color = @"ffffff"; //默认黑色
......@@ -417,7 +417,7 @@ static dispatch_queue_t get_image_clip_queue(){
completion:(YYWebImageCompletionBlock)completion
{
// 空值判断
NSURL *url = [NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:urlString]];
NSURL *url = [NSString isNull:urlString] ? nil : [NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:urlString]];
// 如果 url 为空
if (!url) {
......
......@@ -227,7 +227,7 @@
}];
} else {
[[YYWebImageManager sharedManager] requestImageWithURL:[FUSConfig.sharedInstanced.pathConfigs downloadPath:task.downloadUrl] options:nil progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[FUSConfig.sharedInstanced.pathConfigs webImagePath:task.downloadUrl] options:nil progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
if (image) {
[task fus_executeDownloadSucceedHandlerWithFilePath:@""];
......
......@@ -118,8 +118,8 @@ static dispatch_queue_t get_downloadOperationQueue(){
/// 所以这里记录md5 -> 本地地址的映射,
/// 如果文件md5对应的本地地址存在,那么就直接返回这个资源下载成功
NSString *taskKey = [self fus_taskKeyWithDownloadUrl:resource.resourceUrl md5:resource.md5];
NSString *filePath = self.md5ToLocalPathDict[taskKey];
if (![NSString isNull:filePath]) {
if (![NSString isNull:self.md5ToLocalPathDict[taskKey]]) {
NSString *filePath = [NSString stringWithFormat:@"%@%@", FUSConfig.sharedInstanced.pathConfigs.downloadPathDocument, self.md5ToLocalPathDict[taskKey]];
/// 如果当前的资源已经有了本地文件了,那么直接返回下载成功
if (resource.succeedHandler) {
resource.succeedHandler(filePath);
......@@ -166,7 +166,14 @@ static dispatch_queue_t get_downloadOperationQueue(){
[self fus_addDataLock];
NSString *taskKey = [self fus_taskKeyWithDownloadUrl:task.downloadUrl md5:task.downloadMd5];
[self.taskDict removeObjectForKey:taskKey];
self.md5ToLocalPathDict[taskKey] = filePath;
NSString *documentPath = FUSConfig.sharedInstanced.pathConfigs.downloadPathDocument;
NSString *relativePath = filePath;
if (filePath.length > documentPath.length) {
relativePath = [filePath substringWithRange:NSMakeRange(documentPath.length, filePath.length - documentPath.length)];
}
self.md5ToLocalPathDict[taskKey] = relativePath;
[[NSUserDefaults standardUserDefaults] setObject:self.md5ToLocalPathDict forKey:FUSDownloadMd5ToLocalPathDictUDKey];
[[NSUserDefaults standardUserDefaults] synchronize];
[self fus_removeDataLock];
......
......@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
/// 在线视频缓存地址
@property (nonatomic, copy, readonly) NSString *onlineStreamVideoCachePath;
- (NSString *)downloadPath:(NSString *)url;
- (NSString *)webImagePath:(NSString *)url;
- (NSString *)bigDownloadPath:(NSString *)url;
/// 图片的下载地址
......
......@@ -25,7 +25,7 @@
return @"";
}
- (NSString *)downloadPath:(NSString *)url {
- (NSString *)webImagePath:(NSString *)url {
return @"";
}
......
......@@ -69,7 +69,7 @@
if (from == FUSFromTopic ||[(NSString *)imageOrUrl containsString:@"https://"] || [(NSString *)imageOrUrl containsString:@"http://"]) {
downloadUrl = imageOrUrl;
}else {
downloadUrl = [FUSConfig.sharedInstanced.pathConfigs downloadPath:imageOrUrl];
downloadUrl = [FUSConfig.sharedInstanced.pathConfigs webImagePath:imageOrUrl];
}
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:downloadUrl] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
......@@ -175,7 +175,7 @@
NSString *title;
NSString *content;
NSString *url;
NSString *imgKey = [NSString isNull:faceImgStr] ? @"" : [[YYWebImageManager sharedManager] cacheKeyForURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:faceImgStr]]];
NSString *imgKey = [NSString isNull:faceImgStr] ? @"" : [[YYWebImageManager sharedManager] cacheKeyForURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:faceImgStr]]];
__block UIImage *faceImg;
if (isPusher) {
......@@ -194,7 +194,7 @@
// 图片为空
faceImg = [UIImage imageNamed:@"FUSShareImage"];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:faceImgStr]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:faceImgStr]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
faceImg = image ? image : [UIImage imageNamed:@"FUSShareImage"];
......@@ -218,7 +218,7 @@
if (!faceImg) {
// 图片为空
faceImg = [UIImage imageNamed:@"FUSShareImage"];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:imgKey]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:imgKey]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
faceImg = image ? image : [UIImage imageNamed:@"FUSShareImage"];
......@@ -245,7 +245,7 @@
if (!faceImg) {
// 图片为空
faceImg = [UIImage imageNamed:@"FUSShareImage"];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:imgKey]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:imgKey]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
faceImg = image ? image : [UIImage imageNamed:@"FUSShareImage"];
......@@ -265,7 +265,7 @@
if (!faceImg) {
// 图片为空
faceImg = [UIImage imageNamed:@"FUSShareImage"];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:imgKey]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:imgKey]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageUrl, YYWebImageFromType cacheFrom, YYWebImageStage stage, NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
faceImg = image ? image : [UIImage imageNamed:@"FUSShareImage"];
......
......@@ -61,7 +61,7 @@
NSString *path = model.effectsImage;
if (![path hasPrefix:@"http"]) {
path = [FUSConfig.sharedInstanced.pathConfigs downloadPath:path];
path = [FUSConfig.sharedInstanced.pathConfigs webImagePath:path];
}
// 下载到了图片才加入队列中
......
......@@ -390,7 +390,7 @@
[self fus_saveImageToPhotosAlbum:cacheImage];
} else {
[FUSLoadingView fus_showProgressViewWithMessage:@""];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:path]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable resultImg, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:path]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable resultImg, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[FUSLoadingView fus_dismissProgressView];
if (resultImg) {
......
......@@ -1342,7 +1342,7 @@ NSString * const kMD5GiftResourceKey = @"kMD5GiftResourceKey";
- (void)checkImageCacheWithImageUrl:(NSString *)imageUrl
{
// 检测本地是否有缓存
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:imageUrl]] options:0 progress:nil transform:nil completion:nil];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:imageUrl]] options:0 progress:nil transform:nil completion:nil];
}
......
......@@ -70,7 +70,7 @@
__weak typeof(self) weakSelf = self;
self.giftImageView.image = [UIImage imageNamed:@"icon_gift_placehold"];
[self.giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_currentModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[self.giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_currentModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
self.giftImageView.image = nil;
......@@ -79,7 +79,7 @@
return ;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:weakSelf.currentModel.resource]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:weakSelf.currentModel.resource]]) {
// weakSelf.giftImageView.image = [UIImage imageNamed:@"icon_gift_placehold"];
return;
}
......@@ -169,7 +169,7 @@
__weak typeof(self) weakSelf = self;
self.giftImageView.image = [UIImage imageNamed:@"icon_gift_placehold"];
[self.giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_currentVideoChatModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[self.giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_currentVideoChatModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
weakSelf.giftImageView.image = nil;
......@@ -178,7 +178,7 @@
return ;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:weakSelf.currentVideoChatModel.resource]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:weakSelf.currentVideoChatModel.resource]]) {
return;
}
......
......@@ -429,7 +429,7 @@
break;
}
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:giftModel.resource]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable result, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:giftModel.resource]] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable result, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
if (result) {
[self.cellImageDict setObject:result forKey:giftModel.gid];
......
......@@ -77,7 +77,7 @@
__weak typeof(self) weakSelf = self;
self.giftImageView.image = [UIImage imageNamed:@"icon_gift_placehold"];
[self.giftImageView setWebImageWithSubURLString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_currentModel.resource] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[self.giftImageView setWebImageWithSubURLString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_currentModel.resource] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
weakSelf.giftImageView.image = nil;
......@@ -86,7 +86,7 @@
return ;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:weakSelf.currentModel.resource]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:weakSelf.currentModel.resource]]) {
return;
}
......
......@@ -340,7 +340,7 @@
- (void)fus_setUserImageViewWithUrlStr:(NSString *)facePath{
if (![facePath containsString:@"http"] && ![facePath containsString:@"https"]) {
facePath = [FUSConfig.sharedInstanced.pathConfigs downloadPath:facePath];
facePath = [FUSConfig.sharedInstanced.pathConfigs webImagePath:facePath];
}
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:facePath] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
......
......@@ -379,7 +379,7 @@
_waitTime = 0;
} else {
UIImage *splashImage = [[YYWebImageManager sharedManager].cache getImageForKey:[FUSConfig.sharedInstanced.pathConfigs downloadPath:splashUrl]];
UIImage *splashImage = [[YYWebImageManager sharedManager].cache getImageForKey:[FUSConfig.sharedInstanced.pathConfigs webImagePath:splashUrl]];
if (splashImage) {
_waitTime = BG_VIEW_STAYDURATION;
[self.startSplashView fus_setImage:splashImage];
......
......@@ -195,7 +195,7 @@
self.giftModel = giftModel;
self.giftNum = giftNum;
[_giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:giftModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:nil];
[_giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:giftModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:nil];
_giftNumLabel.text = [NSString stringWithFormat:@"x%ld", giftNum];
......
......@@ -514,38 +514,38 @@
NSString *nameStr = model.fromuser.nickname;
NSMutableAttributedString *senderAttr = [NSMutableAttributedString fus_createAttributedLabelStringForString:[NSString stringWithFormat:@"%@", nameStr] withTextColor:[UIColor colorWithHex:colorStr] font:[UIFont fus_themeFont:13] needShadow:NO maxWidth:120];
if ([model.fromuser.privilege[@"richPower"] integerValue] == 1 || model.fromuser.isHide.boolValue) {
// 3.0.5 添加昵称颜色
// [senderAttr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHex:levelModel.color] range:NSMakeRange(0, senderAttr.length)];
// if ([model.fromuser.privilege[@"richPower"] integerValue] == 1 || model.fromuser.isHide.boolValue) {
//
// _faceImageView.layer.borderColor = [[UIColor colorWithHex:levelModel.color] CGColor];
UIImage *levelImage = [UIImage fus_imageWithLevel:model.level.integerValue];
if (levelImage) {
CGFloat imageH = 14;
CGFloat imageW = imageH / levelImage.size.height * levelImage.size.width;
NSAttributedString *levelAttr = [NSAttributedString attachmentStringWithContent:levelImage contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageW, imageH) alignToFont:[UIFont fus_themeFont:13] alignment:YYTextVerticalAlignmentCenter];
[senderAttr appendAttributedString:levelAttr];
}
// CGFloat imageH = 15;
// CGFloat imageW = 35;
// if (model.fromuser.isHide.boolValue) {
// imageH = 27*0.8;
// imageW = 45*0.8;
// }
// // 3.0.5 添加昵称颜色
//// [senderAttr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHex:levelModel.color] range:NSMakeRange(0, senderAttr.length)];
////
//// _faceImageView.layer.borderColor = [[UIColor colorWithHex:levelModel.color] CGColor];
//
// // 有等级
// UIImageView *downloadView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, imageW, imageH)];
// downloadView.contentMode = UIViewContentModeScaleAspectFit;
// // 创建 attachment
// NSAttributedString *levelAttr = [NSAttributedString attachmentStringWithContent:downloadView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageW, imageH) alignToFont:[UIFont fus_themeFont:13] alignment:YYTextVerticalAlignmentCenter];
// UIImage *levelImage = [UIImage fus_imageWithLevel:model.level.integerValue];
// if (levelImage) {
// CGFloat imageH = 14;
// CGFloat imageW = imageH / levelImage.size.height * levelImage.size.width;
// NSAttributedString *levelAttr = [NSAttributedString attachmentStringWithContent:levelImage contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageW, imageH) alignToFont:[UIFont fus_themeFont:13] alignment:YYTextVerticalAlignmentCenter];
//
// [senderAttr insertAttributedString:levelAttr atIndex:0];
// [downloadView setWebImageWithSubURLString:levelModel.icon placeholder:[UIImage imageNamed:[NSString stringWithFormat:@"rich_icon_level_%@", model.level]] completion:nil];
}
// [senderAttr appendAttributedString:levelAttr];
// }
//
//// CGFloat imageH = 15;
//// CGFloat imageW = 35;
//// if (model.fromuser.isHide.boolValue) {
//// imageH = 27*0.8;
//// imageW = 45*0.8;
//// }
////
//// // 有等级
//// UIImageView *downloadView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, imageW, imageH)];
//// downloadView.contentMode = UIViewContentModeScaleAspectFit;
//// // 创建 attachment
//// NSAttributedString *levelAttr = [NSAttributedString attachmentStringWithContent:downloadView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageW, imageH) alignToFont:[UIFont fus_themeFont:13] alignment:YYTextVerticalAlignmentCenter];
////
//// [senderAttr insertAttributedString:levelAttr atIndex:0];
//// [downloadView setWebImageWithSubURLString:levelModel.icon placeholder:[UIImage imageNamed:[NSString stringWithFormat:@"rich_icon_level_%@", model.level]] completion:nil];
// }
if (FUSRTL.isRTL) {
senderAttr.alignment = NSTextAlignmentRight;
......
......@@ -249,7 +249,7 @@
_giftModel = model;
__weak typeof(self) weakSelf = self;
[_giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:model.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[_giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:model.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
weakSelf.giftImageView.image = nil;
......@@ -258,7 +258,7 @@
return;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:weakSelf.giftModel.resource]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:weakSelf.giftModel.resource]]) {
return;
}
......@@ -341,7 +341,7 @@
return;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:weakSelf.giftModel.subimg]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:weakSelf.giftModel.subimg]]) {
return;
}
......
......@@ -137,7 +137,7 @@
if ([_backgroundImgName isEqualToString:@"live_chat_gift_send_bg_normal"]) {
_bgImageView.image = [UIImage imageNamed:_backgroundImgName];
}else{
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
}
[self addSubview:_bgImageView];
}
......@@ -279,7 +279,7 @@
*/
- (void)fus_setBackgroundImage:(NSString *)backfroudImgName{
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:backfroudImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:backfroudImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
}
#pragma mark - View Delegate
......@@ -296,7 +296,7 @@
_bgImageView.image = [UIImage imageNamed:_backgroundImgName];
}else{
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
}
......@@ -330,7 +330,7 @@
_bgImageView.image = [UIImage imageNamed:_backgroundImgName];
}else{
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
}
}
......@@ -339,7 +339,7 @@
if ([_backgroundImgName isEqualToString:@"live_chat_gift_send_bg_normal"]) {
_bgImageView.image = [UIImage imageNamed:_backgroundImgName];
}else{
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
[self.bgImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:_backgroundImgName]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"]];
}
}
- (void)setBackgroundImgName:(NSString *)backgroundImgName{
......
......@@ -2342,7 +2342,7 @@ static FUSLiveGiftView *giftView = nil;
NSString *imageUrl = dataDict[@"imageUrl"];
// 校验图片是否已经下载
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:imageUrl]] options:0 progress:nil transform:nil completion:nil];
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:imageUrl]] options:0 progress:nil transform:nil completion:nil];
[weakSelf initFirstChargeBtn];
......
......@@ -87,7 +87,7 @@
/// @param selected 是否选中
- (void)fus_setupCellWithParcelGiftModel:(FUSLiveParcelGiftModel *)model selected:(BOOL)selected {
__weak typeof(self) weakSelf = self;
[_itemImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:model.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[_itemImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:model.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
weakSelf.itemImageView.image = nil;
......@@ -100,7 +100,7 @@
return;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:model.resource]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:model.resource]]) {
return;
}
......
......@@ -182,7 +182,7 @@
return;
}
__weak typeof(self) weakSelf = self;
[_giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:parcelGiftModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
[_giftImageView setImageWithURL:[NSURL URLWithString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:parcelGiftModel.resource]] placeholder:[UIImage imageNamed:@"icon_gift_placehold"] options:0 completion:^(UIImage * _Nullable image, NSURL * _Nonnull imageURL, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
// FUSLogVerbose(@"Gift Name:%@ URL:%@", model.name, imageURL.absoluteString);
......@@ -197,7 +197,7 @@
return;
}
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs downloadPath:weakSelf.parcelGiftModel.resource]]) {
if (![imageURL.absoluteString isEqualToString:[FUSConfig.sharedInstanced.pathConfigs webImagePath:weakSelf.parcelGiftModel.resource]]) {
return;
}
......
......@@ -807,9 +807,9 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
if (speaker.volume > 50) {
[speakArr addObject:[NSString stringWithFormat:@"%ld",speaker.uid]];
}
// if (ENABLE_TEST_VIEW) {
// FUSLogInfo(@"=======>Agora speaker:%ld volume:%ld", speaker.uid, speaker.volume);
// }
if (ENABLE_TEST_VIEW) {
FUSLogInfo(@"=======>Agora speaker:%ld volume:%ld", speaker.uid, speaker.volume);
}
}
// FUSLogInfo(@"\n");
......@@ -943,7 +943,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
- (void)rtcEngine:(AgoraRtcEngineKit * _Nonnull)engine didJoinChannel:(NSString * _Nonnull)channel withUid:(NSUInteger)uid elapsed:(NSInteger) elapsed
{
FUSLogVerbose(@"%s",__func__);
[self switchLocalMic:YES];
[engine enableAudio];
}
......
......@@ -71,6 +71,7 @@ class FUSPkWinningStreakView: UIView {
super.layoutSubviews()
// self.bgImageView.frame = self.bounds
self.bgImageView.size = CGSizeMake(64, 56)
self.bgImageView.center = CGPointMake(self.width/2.0, self.height/2.0 - 2)
self.xImageView.x = 12.5
self.xImageView.bottom = self.height - 15
......
......@@ -602,7 +602,7 @@ WKScriptMessageHandler
//上传成功
fileM.state = WGUploadFileStateSuccess;
// NSString *testUrl = @"https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=210671490,1554278141&fm=173&app=25&f=JPEG?w=638&h=445&s=9C366790E4892B4F26293C810300A088";
[weakSelf successWithKey:fileM.key url:[FUSConfig.sharedInstanced.pathConfigs downloadPath:obj]];
[weakSelf successWithKey:fileM.key url:[FUSConfig.sharedInstanced.pathConfigs webImagePath:obj]];
}else{
//上传失败
fileM.state = WGUploadFileStateError;
......@@ -1029,7 +1029,7 @@ WKScriptMessageHandler
// 上传成功
fileM.state = WGUploadFileStateSuccess;
fileM.uploadUrl = [FUSConfig.sharedInstanced.pathConfigs downloadPath:obj];
fileM.uploadUrl = [FUSConfig.sharedInstanced.pathConfigs webImagePath:obj];
[weakSelf.imageDict setValue:fileM forKey:fileM.localUrl];
// [weakSelf successWithKey:fileM.key url:testUrl];
}else{
......
......@@ -344,7 +344,7 @@
if ([iconString hasPrefix:@"http"] || [iconString hasPrefix:@"https"]) {
dealUrlStr = iconString;
}else{
dealUrlStr = [FUSConfig.sharedInstanced.pathConfigs downloadPath:iconString];
dealUrlStr = [FUSConfig.sharedInstanced.pathConfigs webImagePath:iconString];
}
// 图标此时已经下载好了 直接用SDWebImage去取
NSString *imageKey = [[YYWebImageManager sharedManager] cacheKeyForURL:[NSURL URLWithString:dealUrlStr]];
......
......@@ -63,7 +63,7 @@
if ([iconString hasPrefix:@"http"] || [iconString hasPrefix:@"https"]) {
dealUrlStr = iconString;
}else{
dealUrlStr = [FUSConfig.sharedInstanced.pathConfigs downloadPath:iconString];
dealUrlStr = [FUSConfig.sharedInstanced.pathConfigs webImagePath:iconString];
}
// 提前下好小图标
[[YYWebImageManager sharedManager] requestImageWithURL:[NSURL URLWithString:dealUrlStr] options:0 progress:nil transform:nil completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
......
......@@ -497,7 +497,7 @@ static NSString *const reuseIdentifyCell = @"cell";
[FUSZoneHttpRequest fus_taskGetDataTid:tid Success:^(NSDictionary *dataDic) {
__weak typeof(self) weakSelf = self;
[self.view addSubview:self.shareView];
NSString *imgStr = [FUSConfig.sharedInstanced.pathConfigs downloadPath:dataDic[@"shareConfig"][@"img"]];
NSString *imgStr = [FUSConfig.sharedInstanced.pathConfigs webImagePath:dataDic[@"shareConfig"][@"img"]];
[self.shareView fus_showShareViewWithViewController:self title:dataDic[@"shareConfig"][@"title"] content:dataDic[@"shareConfig"][@"content"] imageOrUrl:[imgStr stringByReplacingOccurrencesOfString:@"/com" withString:@""] shareUrl:DNS_WEB(dataDic[@"shareConfig"][@"href"]) from:FUSFromMission shareType:FUSShareTypeWebUrl success:^{
} failure:nil];
......
......@@ -226,7 +226,7 @@
if (_audioPlayer.fus_isPlaying) {
[_audioPlayer fus_seekToTime:kCMTimeZero];
} else {
NSString *playUrl = [FUSConfig.sharedInstanced.pathConfigs downloadPath:self.zoneModel.voiceChat[@"url"]];
NSString *playUrl = [FUSConfig.sharedInstanced.pathConfigs webImagePath:self.zoneModel.voiceChat[@"url"]];
AVPlayerItem *playItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:playUrl]];
[_audioPlayer fus_playVideoWithPlayItem:playItem];
}
......
......@@ -138,7 +138,7 @@
if (_audioPlayer.fus_isPlaying) {
[_audioPlayer fus_seekToTime:kCMTimeZero];
} else {
NSString *playUrl = [FUSConfig.sharedInstanced.pathConfigs downloadPath:self.zoneModel.voiceChat[@"url"]];
NSString *playUrl = [FUSConfig.sharedInstanced.pathConfigs webImagePath:self.zoneModel.voiceChat[@"url"]];
AVPlayerItem *playItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:playUrl]];
[_audioPlayer fus_playVideoWithPlayItem:playItem];
}
......
......@@ -138,7 +138,7 @@
if ([_dataSource.firstObject isKindOfClass:[UIImage class]]) {
cell.imageView.image = _dataSource[indexPath.row];
} else {
NSString *path = [NSString isNull:_dataSource[indexPath.row]] ? nil : [FUSConfig.sharedInstanced.pathConfigs downloadPath:_dataSource[indexPath.row]];
NSString *path = [NSString isNull:_dataSource[indexPath.row]] ? nil : [FUSConfig.sharedInstanced.pathConfigs webImagePath:_dataSource[indexPath.row]];
[cell.imageView setWebImageWithSubURLString:path placeholder:[UIImage imageNamed:@"fireFly_zone_empty_photos"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) {
......
......@@ -207,7 +207,7 @@
}
- (NSString *)downloadPath:(NSString *)url {
- (NSString *)webImagePath:(NSString *)url {
return [NSString stringWithFormat:@"%@%@",self.imageDownUrl,url];
}
......
......@@ -502,7 +502,7 @@ static NSString *FUSWebRightBtnExtraInfoKey = @"FUSWebRightBtnExtraInfoKey";
NSString *url = nil;
FUSMotorDataModel *motorModel = (FUSMotorDataModel *)([FUSGiftDataCenter sharedCenter].motorGiftDict[mid]);
if (![NSString isNull:motorModel.darkRes]) {
url = [FUSConfig.sharedInstanced.pathConfigs downloadPath:motorModel.darkRes];
url = [FUSConfig.sharedInstanced.pathConfigs webImagePath:motorModel.darkRes];
} else if (![NSString isNull:dataDict[@"url"]]) {
url = dataDict[@"url"];
} else {
......
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