|
@@ -35,7 +35,7 @@
|
|
|
|
|
|
if (self)
|
|
|
{
|
|
|
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadTaskDownloadingNoti:) name:kDownloadTaskDownloadingNoti object:nil];
|
|
|
+// [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadTaskDownloadingNoti:) name:kDownloadTaskDownloadingNoti object:nil];
|
|
|
[self drawView];
|
|
|
}
|
|
|
|
|
@@ -221,8 +221,9 @@
|
|
|
_progressBgView.hidden = NO;
|
|
|
_upLoadStateButton.hidden = NO;
|
|
|
|
|
|
- if (!_curShareFileDataModel
|
|
|
- || ![_curShareFileDataModel.fileUrl isEqualToString:curShareFileDataModel.fileUrl]) {
|
|
|
+ if (!_curShareFileDataModel ||
|
|
|
+ ![_curShareFileDataModel.fileUrl isEqualToString:curShareFileDataModel.fileUrl])
|
|
|
+ {
|
|
|
|
|
|
if(_curShareFileDataModel){
|
|
|
HLog(@"%@\n%@",_curShareFileDataModel.fileUrl,curShareFileDataModel.fileUrl);
|
|
@@ -385,6 +386,10 @@
|
|
|
#pragma mark setImage
|
|
|
- (void)setFixedValueByModel:(ShareFileDataModel *)curShareFileDataModel
|
|
|
{
|
|
|
+ if ([_fileNamelabel.text isEqualToString:curShareFileDataModel.fileName]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
_fileNamelabel.text = curShareFileDataModel.fileName;
|
|
|
|
|
|
NSArray *nameArr= [curShareFileDataModel.fileName componentsSeparatedByString:@"."];
|
|
@@ -417,16 +422,25 @@
|
|
|
NSString *fileUrl = curShareFileDataModel.headUrl;
|
|
|
HLog(@"11图片1:%@",fileUrl);
|
|
|
fileUrl = [fileUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
- UIImage * defaultImage = [UIImage imageNamed:@"uploadFile_image"];
|
|
|
- [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
|
|
- if(image){
|
|
|
- //HLog(@"11图片1:%@",imageURL.absoluteString);
|
|
|
- }
|
|
|
- else{
|
|
|
- //HLog(@"11图片0:%@",imageURL.absoluteString);
|
|
|
- }
|
|
|
-
|
|
|
- }];
|
|
|
+ __block UIImage * defaultImage = [UIImage imageNamed:@"uploadFile_image"];
|
|
|
+
|
|
|
+ UIImage *cacheImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:fileUrl];
|
|
|
+ if(cacheImage){
|
|
|
+ _fileImageView.image = cacheImage;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
|
|
+ if(image){
|
|
|
+ //HLog(@"11图片1:%@",imageURL.absoluteString);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ //HLog(@"11图片0:%@",imageURL.absoluteString);
|
|
|
+ self->_fileImageView.image = defaultImage;
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else if ([iTools isVideoFilewithName:lastName]) {//JPG、JPEG、PNG、GIF、BMP、SVG、TIFF、HEIC。
|
|
|
//MP4、AVI、FLV、WMV、MKV、TS、MOV、RMVB。
|
|
@@ -434,16 +448,23 @@
|
|
|
NSString *fileUrl = curShareFileDataModel.headUrl;
|
|
|
HLog(@"11图片1:%@",fileUrl);
|
|
|
fileUrl = [fileUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
|
|
- UIImage * defaultImage = [UIImage imageNamed:@"uploadFile_Video"];
|
|
|
- [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:defaultImage completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
|
|
- if(image){
|
|
|
- //HLog(@"11图片1:%@",imageURL.absoluteString);
|
|
|
- }
|
|
|
- else{
|
|
|
- //HLog(@"11图片0:%@",imageURL.absoluteString);
|
|
|
- }
|
|
|
-
|
|
|
- }];
|
|
|
+ __block UIImage * defaultImage = [UIImage imageNamed:@"uploadFile_Video"];
|
|
|
+ UIImage *cacheImage = [[SDImageCache sharedImageCache] imageFromDiskCacheForKey:fileUrl];
|
|
|
+ if(cacheImage){
|
|
|
+ _fileImageView.image = cacheImage;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [_fileImageView sd_setImageWithURL:[NSURL URLWithString:fileUrl] placeholderImage:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
|
|
+ if(image){
|
|
|
+ //HLog(@"11图片1:%@",imageURL.absoluteString);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ //HLog(@"11图片0:%@",imageURL.absoluteString);
|
|
|
+ self->_fileImageView.image = defaultImage;
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+ }
|
|
|
}
|
|
|
else{
|
|
|
_fileImageView.image = [UIImage imageNamed:@"uploadFile_other"];
|
|
@@ -639,19 +660,19 @@
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-#pragma mark 下载通知
|
|
|
-- (void)downloadTaskDownloadingNoti:(NSNotification *)notification
|
|
|
-{
|
|
|
- YCDownloadItem *item = notification.object;
|
|
|
- if(!item)return;
|
|
|
-
|
|
|
- if (item.downloadStatus != YCDownloadStatusDownloading) {
|
|
|
- return;
|
|
|
- }
|
|
|
- mainBlock(^{
|
|
|
- [self downloadItem:item downloadedSize:item.downloadedSize totalSize:item.fileSize];
|
|
|
- });
|
|
|
-}
|
|
|
+//#pragma mark 下载通知
|
|
|
+//- (void)downloadTaskDownloadingNoti:(NSNotification *)notification
|
|
|
+//{
|
|
|
+// YCDownloadItem *item = notification.object;
|
|
|
+// if(!item)return;
|
|
|
+//
|
|
|
+// if (item.downloadStatus != YCDownloadStatusDownloading) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// mainBlock(^{
|
|
|
+// [self downloadItem:item downloadedSize:item.downloadedSize totalSize:item.fileSize];
|
|
|
+// });
|
|
|
+//}
|
|
|
|
|
|
#pragma mark 下载代理
|
|
|
- (void)downloadItemStatusChanged:(YCDownloadItem *)item {
|