|
|
@@ -289,8 +289,8 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
[sizeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.left.equalTo(nameLabel);
|
|
|
make.top.equalTo(nameLabel.mas_bottom).offset(4);
|
|
|
- make.right.equalTo(nameLabel);
|
|
|
- make.bottom.lessThanOrEqualTo(_fileContentView).offset(-8);
|
|
|
+// make.right.equalTo(nameLabel);
|
|
|
+// make.bottom.lessThanOrEqualTo(_fileContentView).offset(-8);
|
|
|
}];
|
|
|
|
|
|
[self.contentView addSubview:_fileContentView];
|
|
|
@@ -838,14 +838,10 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
}
|
|
|
|
|
|
//没有有效本地图片 使用SDWebImage加载图片
|
|
|
-// NSLog(@"UIImage------------4:%@",_messageModel.url);
|
|
|
- NSString *gifPath = [[NSBundle mainBundle] pathForResource:@"load" ofType:@"gif"];
|
|
|
- NSData *gifData = [NSData dataWithContentsOfFile:gifPath];
|
|
|
- UIImage *placeholder = [UIImage sd_imageWithGIFData:gifData];
|
|
|
-
|
|
|
+
|
|
|
weakSelf(self);
|
|
|
[_imageContentView sd_setImageWithURL:[NSURL URLWithString:_messageModel.url]
|
|
|
- placeholderImage:placeholder
|
|
|
+ placeholderImage:[UIImage imageNamed:@"pictrue_placeholder"]
|
|
|
completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
|
|
|
if (!error && image) {
|
|
|
// 图片加载成功后可以更新布局(如果需要)
|
|
|
@@ -903,36 +899,6 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
-
|
|
|
- [_messageModel xiazaishipin:^(NSInteger persent) {
|
|
|
- if(persent>=100){
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- if(weakself.jinduLbl){
|
|
|
- weakself.jinduLbl.alpha = 0;
|
|
|
- weakself.loadingImg.alpha = 0;
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- NSLog(@"下载完成:%@",self->_messageModel.localurl);
|
|
|
- }
|
|
|
- else{
|
|
|
-// NSLog(@"下载中:%ld",(long)persent);
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- if(weakself.jinduLbl){
|
|
|
- if(weakself.loadingImg.alpha!=1||!weakself.loadingImg.image){
|
|
|
- NSString *gifPath = [[NSBundle mainBundle] pathForResource:@"load" ofType:@"gif"];
|
|
|
- NSData *gifData = [NSData dataWithContentsOfFile:gifPath];
|
|
|
- UIImage *placeholder = [UIImage sd_imageWithGIFData:gifData];
|
|
|
- weakself.loadingImg.image = placeholder;
|
|
|
- weakself.loadingImg.alpha = 1;
|
|
|
- }
|
|
|
- weakself.jinduLbl.alpha = 1;
|
|
|
- weakself.jinduLbl.text = [NSString stringWithFormat:@"%ld",(long)persent];
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- }
|
|
|
- }];
|
|
|
|
|
|
|
|
|
_messageModel.uploadPersentChange = ^(NSInteger index,NSInteger localtime) {
|
|
|
@@ -990,30 +956,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
// 设置文件内容
|
|
|
iconView.image = [UIImage imageNamed: @"file_icon_black"];
|
|
|
nameLabel.text = _messageModel.fileName ?: @"未知文件";
|
|
|
-
|
|
|
- sizeLabel.alpha = 0;
|
|
|
-
|
|
|
-
|
|
|
- [_messageModel xiazaiwenjian:^(NSInteger persent) {
|
|
|
-// NSLog(@"setupFileContent----------");
|
|
|
- if(persent>=100){
|
|
|
- NSLog(@"setupFileContent:下载完成:%@",self->_messageModel.localurl);
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- if(sizeLabel){
|
|
|
- sizeLabel.alpha = 0;
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- else{
|
|
|
-// NSLog(@"setupFileContent 下载中:%ld",(long)persent);
|
|
|
- dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
- if(sizeLabel){
|
|
|
- sizeLabel.alpha = 1;
|
|
|
- sizeLabel.text = [NSString stringWithFormat:@"%ld",(long)persent];
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }];
|
|
|
+ sizeLabel.text = _messageModel.customFileSize ?: @"0KB";
|
|
|
|
|
|
_currentContentView = _fileContentView;
|
|
|
}
|
|
|
@@ -1584,7 +1527,40 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
[MBProgressHUD showWithText:@"视频正在上传"];
|
|
|
return;
|
|
|
}
|
|
|
- [FilePreviewer.shared previewFileWithLocalPath:_messageModel.localurl remoteURL:getURL(_messageModel.url) fromViewController:self.parentViewController];
|
|
|
+
|
|
|
+ weakSelf(self);
|
|
|
+ [_messageModel xiazaishipin:^(NSInteger persent) {
|
|
|
+ if(persent>=100){
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ if(weakself.jinduLbl){
|
|
|
+ weakself.jinduLbl.alpha = 0;
|
|
|
+ weakself.loadingImg.alpha = 0;
|
|
|
+ }
|
|
|
+ [FilePreviewer.shared previewFileWithLocalPath:weakself.messageModel.localurl
|
|
|
+ remoteURL:getURL(weakself.messageModel.url)
|
|
|
+ fromViewController:weakself.parentViewController];
|
|
|
+ });
|
|
|
+
|
|
|
+ NSLog(@"下载完成:%@",self->_messageModel.localurl);
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ // NSLog(@"下载中:%ld",(long)persent);
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ if(weakself.jinduLbl){
|
|
|
+ if(weakself.loadingImg.alpha!=1||!weakself.loadingImg.image){
|
|
|
+ NSString *gifPath = [[NSBundle mainBundle] pathForResource:@"load" ofType:@"gif"];
|
|
|
+ NSData *gifData = [NSData dataWithContentsOfFile:gifPath];
|
|
|
+ UIImage *placeholder = [UIImage sd_imageWithGIFData:gifData];
|
|
|
+ weakself.loadingImg.image = placeholder;
|
|
|
+ weakself.loadingImg.alpha = 1;
|
|
|
+ }
|
|
|
+ weakself.jinduLbl.alpha = 1;
|
|
|
+ weakself.jinduLbl.text = [NSString stringWithFormat:@"%ld",(long)persent];
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1603,7 +1579,23 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
[MBProgressHUD showWithText:@"文件正在上传"];
|
|
|
return;
|
|
|
}
|
|
|
- [FilePreviewer.shared previewFileWithLocalPath:_messageModel.localurl remoteURL:getURL(_messageModel.url) fromViewController:self.parentViewController];
|
|
|
+
|
|
|
+
|
|
|
+ UILabel *sizeLabel = _fileContentView.subviews[2];
|
|
|
+
|
|
|
+ weakSelf(self)
|
|
|
+ [_messageModel xiazaiwenjian:^(NSInteger persent) {
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+ sizeLabel.text = [NSString stringWithFormat:@"%ld",(long)persent];
|
|
|
+ if(persent>=100){
|
|
|
+ sizeLabel.text = weakself.messageModel.customFileSize;
|
|
|
+ NSLog(@"setupFileContent:下载完成:%@",weakself.messageModel.localurl);
|
|
|
+ [FilePreviewer.shared previewFileWithLocalPath:weakself.messageModel.localurl
|
|
|
+ remoteURL:getURL(weakself.messageModel.url)
|
|
|
+ fromViewController:weakself.parentViewController];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }];
|
|
|
}
|
|
|
}
|
|
|
|