|
|
@@ -2,7 +2,7 @@
|
|
|
// chatCellView.m
|
|
|
// ABtong
|
|
|
//
|
|
|
-// Created by gan on 2025/7/28.
|
|
|
+// Created by qin on 2025/7/28.
|
|
|
//
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
@@ -17,7 +17,7 @@
|
|
|
#import "config.h"
|
|
|
#import "FilePreviewer.h"
|
|
|
#import "ChatRecordController.h"
|
|
|
-#import "QuoteDetailController.h"
|
|
|
+#import "GotoDetailController.h"
|
|
|
|
|
|
|
|
|
// 定义一些常量
|
|
|
@@ -26,7 +26,7 @@ static const CGFloat kTextHorizontalMargin = 12.0f; //文本水平边距
|
|
|
static const CGFloat kVerticalMargin = 18.0f; // 垂直边距
|
|
|
static const CGFloat kContentMaxWidth = 220.0f; // 内容最大宽度
|
|
|
static const CGFloat kAvatarSize = 36.0f; // 头像大小
|
|
|
-static const CGFloat kAvatarMargin = 20.0f; // 头像边距
|
|
|
+static const CGFloat kAvatarMargin = 24.0f; // 头像边距
|
|
|
static const CGFloat kAvatarBatchMargin = 70.0f; // 批量操作头像边距
|
|
|
static const CGFloat kBubbleTopMargin = 20.0f; // 气泡顶部距离
|
|
|
static const CGFloat kBubbleBottomMargin = 40.0f; // 气泡底部距离
|
|
|
@@ -37,8 +37,8 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
@interface chatCellView()
|
|
|
|
|
|
// 基本视图
|
|
|
-@property (nonatomic, strong) UIImageView *avatarImageView;
|
|
|
-@property (nonatomic, strong) UILabel *nameLabel;
|
|
|
+//@property (nonatomic, strong) UIImageView *avatarImageView;
|
|
|
+//@property (nonatomic, strong) UILabel *nameLabel;
|
|
|
@property (nonatomic, strong) UIImageView *bubbleImageView;
|
|
|
@property (nonatomic, strong) UILabel * timeLabel;
|
|
|
@property (nonatomic, strong) UILabel * readStateLbl;
|
|
|
@@ -90,27 +90,24 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
_batchStateBtn.hidden = YES;
|
|
|
[self.contentView addSubview:_batchStateBtn];
|
|
|
[_batchStateBtn addTarget:self action:@selector(batchStateButtonClicked) forControlEvents:UIControlEventTouchUpInside];
|
|
|
- // 头像
|
|
|
- _avatarImageView = [UIImageView new];
|
|
|
- _avatarImageView.layer.cornerRadius = kAvatarSize / 2;
|
|
|
- _avatarImageView.layer.masksToBounds = YES;
|
|
|
- _avatarImageView.userInteractionEnabled = YES;
|
|
|
- _avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
- [self.contentView addSubview:_avatarImageView];
|
|
|
-
|
|
|
- UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleAvatarTap)];
|
|
|
- [_avatarImageView addGestureRecognizer:tap];
|
|
|
-
|
|
|
-// [_avatarImageView jk_addLongPressActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
|
|
|
-// [self handleAvatarLongPress];
|
|
|
-// }];
|
|
|
+// // 头像
|
|
|
+// _avatarImageView = [UIImageView new];
|
|
|
+// _avatarImageView.layer.cornerRadius = kAvatarSize / 2;
|
|
|
+// _avatarImageView.layer.masksToBounds = YES;
|
|
|
+// _avatarImageView.userInteractionEnabled = YES;
|
|
|
+// _avatarImageView.contentMode = UIViewContentModeScaleAspectFill;
|
|
|
+// [self.contentView addSubview:_avatarImageView];
|
|
|
+//
|
|
|
+// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleAvatarTap)];
|
|
|
+// [_avatarImageView addGestureRecognizer:tap];
|
|
|
|
|
|
- // 名字
|
|
|
- _nameLabel = [UILabel new];
|
|
|
- _nameLabel.font = SYSFONT(12);
|
|
|
- _nameLabel.textColor = [UIColor whiteColor];
|
|
|
- [self.contentView addSubview:_nameLabel];
|
|
|
|
|
|
+ // 名字
|
|
|
+// _nameLabel = [UILabel new];
|
|
|
+// _nameLabel.font = SYSFONT(12);
|
|
|
+// _nameLabel.textColor = [UIColor whiteColor];
|
|
|
+// [self.contentView addSubview:_nameLabel];
|
|
|
+//
|
|
|
// 时间
|
|
|
_timeLabel = [UILabel new];
|
|
|
_timeLabel.font = SYSFONT(12);
|
|
|
@@ -145,7 +142,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
- (void)setupTextContentView {
|
|
|
_textLbl = [UILabel new];
|
|
|
_textLbl.numberOfLines = 0;
|
|
|
- _textLbl.textColor = UIColor.blackColor;
|
|
|
+ _textLbl.textColor = UIColor.whiteColor;
|
|
|
[self.contentView addSubview:_textLbl];
|
|
|
|
|
|
_quoteLbl = [UILabel new];
|
|
|
@@ -217,12 +214,12 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
UIImageView *iconView = [[UIImageView alloc] init];
|
|
|
UILabel *nameLabel = [[UILabel alloc] init];
|
|
|
- nameLabel.textColor = UIColor.blackColor;
|
|
|
+ nameLabel.textColor = UIColor.whiteColor;
|
|
|
nameLabel.font = [UIFont systemFontOfSize:14];
|
|
|
nameLabel.numberOfLines = 1;
|
|
|
UILabel *sizeLabel = [[UILabel alloc] init];
|
|
|
sizeLabel.font = [UIFont systemFontOfSize:12];
|
|
|
- sizeLabel.textColor = [UIColor grayColor];
|
|
|
+ sizeLabel.textColor = [UIColor whiteColor];
|
|
|
|
|
|
[_fileContentView addSubview:iconView];
|
|
|
[_fileContentView addSubview:nameLabel];
|
|
|
@@ -259,7 +256,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
UIImageView *voiceIcon = [[UIImageView alloc] initWithImage:kImageMake(@"play_btn")];
|
|
|
UILabel *durationLabel = [[UILabel alloc] init];
|
|
|
- durationLabel.textColor = UIColor.blackColor;
|
|
|
+ durationLabel.textColor = UIColor.whiteColor;
|
|
|
durationLabel.font = [UIFont systemFontOfSize:14];
|
|
|
|
|
|
[_voiceContentView addSubview:voiceIcon];
|
|
|
@@ -287,11 +284,11 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
UIImageView *callIcon = [[UIImageView alloc] init];
|
|
|
UILabel *callLabel = [[UILabel alloc] init];
|
|
|
- callLabel.textColor = UIColor.blackColor;
|
|
|
+ callLabel.textColor = UIColor.whiteColor;
|
|
|
callLabel.font = [UIFont systemFontOfSize:16];
|
|
|
UILabel *durationLabel = [[UILabel alloc] init];
|
|
|
durationLabel.font = [UIFont systemFontOfSize:16];
|
|
|
- durationLabel.textColor = [UIColor grayColor];
|
|
|
+ durationLabel.textColor = [UIColor whiteColor];
|
|
|
|
|
|
[_callContentView addSubview:callIcon];
|
|
|
[_callContentView addSubview:callLabel];
|
|
|
@@ -330,7 +327,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
UILabel *titleLabel = [[UILabel alloc] init];
|
|
|
titleLabel.font = SYSBFONT(14);
|
|
|
titleLabel.text = @"聊天记录";
|
|
|
- titleLabel.textColor = UIColor.blackColor;
|
|
|
+ titleLabel.textColor = UIColor.whiteColor;
|
|
|
|
|
|
UILabel *contentLabel = [[UILabel alloc] init];
|
|
|
contentLabel.font = SYSFONT(12);
|
|
|
@@ -383,7 +380,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
- (void)setupdeleateContentView {
|
|
|
_deleateLbl = [[UILabel alloc] init];
|
|
|
_deleateLbl.font = SYSFONT(14);
|
|
|
- _deleateLbl.textColor = UIColor.blackColor;
|
|
|
+ _deleateLbl.textColor = UIColor.whiteColor;
|
|
|
_deleateLbl.layer.cornerRadius = 2.f;
|
|
|
_deleateLbl.layer.masksToBounds = YES;
|
|
|
|
|
|
@@ -470,21 +467,21 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
_batchState = batchState;
|
|
|
self.batchStateBtn.hidden = !batchState;
|
|
|
- if (!_messageModel.isSender) {
|
|
|
- if (batchState) {
|
|
|
- [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.size.mas_equalTo(CGSizeMake(kAvatarSize, kAvatarSize));
|
|
|
- make.left.mas_equalTo(kAvatarBatchMargin);
|
|
|
- make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
- }];
|
|
|
- }else{
|
|
|
- [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.size.mas_equalTo(CGSizeMake(kAvatarSize, kAvatarSize));
|
|
|
- make.left.mas_equalTo(kAvatarMargin);
|
|
|
- make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
- }];
|
|
|
- }
|
|
|
- }
|
|
|
+// if (!_messageModel.isSender) {
|
|
|
+// if (batchState) {
|
|
|
+// [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.size.mas_equalTo(CGSizeMake(kAvatarSize, kAvatarSize));
|
|
|
+// make.left.mas_equalTo(kAvatarBatchMargin);
|
|
|
+// make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
+// }];
|
|
|
+// }else{
|
|
|
+// [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.size.mas_equalTo(CGSizeMake(kAvatarSize, kAvatarSize));
|
|
|
+// make.left.mas_equalTo(kAvatarMargin);
|
|
|
+// make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
+// }];
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
self.batchStateBtn.selected = NO;
|
|
|
}
|
|
|
@@ -492,11 +489,11 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
- (void)setupAvatarAndName {
|
|
|
self.readStateLbl.text = nil;
|
|
|
// 这里应该根据实际数据设置头像和名字
|
|
|
- if (_messageModel.avatar) {
|
|
|
- [_avatarImageView sd_setImageWithURL:getURL(_messageModel.avatar) placeholderImage:kImageMake(@"Avatar")];
|
|
|
- }else{
|
|
|
- _avatarImageView.image = kImageMake(@"Avatar");
|
|
|
- }
|
|
|
+// if (_messageModel.avatar) {
|
|
|
+// [_avatarImageView sd_setImageWithURL:getURL(_messageModel.avatar) placeholderImage:kImageMake(@"Avatar")];
|
|
|
+// }else{
|
|
|
+// _avatarImageView.image = kImageMake(@"Avatar");
|
|
|
+// }
|
|
|
|
|
|
_timeLabel.text = _messageModel.formatterTime;
|
|
|
_readStateLbl.text = _messageModel.readStatus;
|
|
|
@@ -507,28 +504,28 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
_readStateLbl.textColor = [UIColor whiteColor];
|
|
|
}
|
|
|
|
|
|
- if (_messageModel.type==1) {
|
|
|
- if (_messageModel.nickName && ![_messageModel.nickName isKindOfClass:NSNull.class]) {
|
|
|
- _nameLabel.text = _messageModel.isSender ? @"": _messageModel.nickName;
|
|
|
- _nameLabel.textAlignment = _messageModel.isSender ? NSTextAlignmentRight : NSTextAlignmentLeft;
|
|
|
- }
|
|
|
- }
|
|
|
+// if (_messageModel.type==1) {
|
|
|
+// if (_messageModel.nickName && ![_messageModel.nickName isKindOfClass:NSNull.class]) {
|
|
|
+// _nameLabel.text = _messageModel.isSender ? @"": _messageModel.nickName;
|
|
|
+// _nameLabel.textAlignment = _messageModel.isSender ? NSTextAlignmentRight : NSTextAlignmentLeft;
|
|
|
+// }
|
|
|
+// }
|
|
|
|
|
|
|
|
|
if (_messageModel.messageType == ChatMessageTypeEvent || _messageModel.messageType == ChatMessageTypeCallBack || _messageModel.messageType == ChatMessageTypeCallBack2) {
|
|
|
- _avatarImageView.hidden = YES;
|
|
|
- _nameLabel.hidden = YES;
|
|
|
+// _avatarImageView.hidden = YES;
|
|
|
+ //_nameLabel.hidden = YES;
|
|
|
_readStateLbl.hidden = YES;
|
|
|
_timeLabel.hidden = YES;
|
|
|
}else{
|
|
|
- _avatarImageView.hidden = NO;
|
|
|
- _nameLabel.hidden = NO;
|
|
|
- _readStateLbl.hidden = NO;
|
|
|
+// _avatarImageView.hidden = NO;
|
|
|
+// _nameLabel.hidden = NO;
|
|
|
+ _readStateLbl.hidden = YES;
|
|
|
_timeLabel.hidden = NO;
|
|
|
}
|
|
|
|
|
|
if (_messageModel.type == 0&& _messageModel.isSender) {
|
|
|
- _readStateLbl.hidden = NO;
|
|
|
+ _readStateLbl.hidden = YES;
|
|
|
}else{
|
|
|
_readStateLbl.hidden = YES;
|
|
|
}
|
|
|
@@ -764,7 +761,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
// UILabel *sizeLabel = _fileContentView.subviews[2];
|
|
|
|
|
|
// 设置文件内容
|
|
|
- iconView.image = [UIImage imageNamed: @"file_icon_black"];
|
|
|
+ iconView.image = [UIImage imageNamed: @"file_icon"];
|
|
|
nameLabel.text = _messageModel.fileName ?: @"未知文件";
|
|
|
// sizeLabel.text = _messageModel.fileSize ?: @"0KB";
|
|
|
|
|
|
@@ -940,22 +937,22 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
// 头像布局
|
|
|
if (_messageModel.isSender) {
|
|
|
- [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
- make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
- make.width.height.mas_equalTo(kAvatarSize);
|
|
|
- }];
|
|
|
+// [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+// make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
+// make.width.height.mas_equalTo(kAvatarSize);
|
|
|
+// }];
|
|
|
|
|
|
- [_nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-4);
|
|
|
- make.top.equalTo(_avatarImageView);
|
|
|
- make.left.greaterThanOrEqualTo(self.contentView).offset(10);
|
|
|
- }];
|
|
|
+// [_nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.right.equalTo(_avatarImageView.mas_left).offset(-4);
|
|
|
+// make.top.equalTo(_avatarImageView);
|
|
|
+// make.left.greaterThanOrEqualTo(self.contentView).offset(10);
|
|
|
+// }];
|
|
|
|
|
|
[_timeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.height.mas_equalTo(14);
|
|
|
- make.right.mas_equalTo(self.nameLabel.mas_left).offset(-12);
|
|
|
- make.top.mas_equalTo(self.avatarImageView);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+ make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
}];
|
|
|
|
|
|
if (_messageModel.messageType == ChatMessageTypeImage || _messageModel.messageType == ChatMessageTypeVideo) {
|
|
|
@@ -981,22 +978,22 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
- [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
- make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
- make.width.height.mas_equalTo(kAvatarSize);
|
|
|
- }];
|
|
|
+// [_avatarImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+// make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
+// make.width.height.mas_equalTo(kAvatarSize);
|
|
|
+// }];
|
|
|
|
|
|
- [_nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(4);
|
|
|
- make.top.equalTo(_avatarImageView);
|
|
|
- make.right.lessThanOrEqualTo(self.contentView).offset(-10);
|
|
|
- }];
|
|
|
+// [_nameLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.left.equalTo(_avatarImageView.mas_right).offset(4);
|
|
|
+// make.top.equalTo(_avatarImageView);
|
|
|
+// make.right.lessThanOrEqualTo(self.contentView).offset(-10);
|
|
|
+// }];
|
|
|
|
|
|
[_timeLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.height.mas_equalTo(14);
|
|
|
- make.left.mas_equalTo(self.nameLabel.mas_right).offset(12);
|
|
|
- make.top.mas_equalTo(self.avatarImageView);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+ make.top.equalTo(self.contentView).offset(kVerticalMargin);
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
@@ -1046,8 +1043,8 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
if (_messageModel.isSender) {
|
|
|
[_textLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-26);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_equalTo(textSize.width);
|
|
|
make.height.mas_equalTo(textSize.height);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
@@ -1063,8 +1060,8 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
}
|
|
|
} else {
|
|
|
[_textLbl mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(26);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_equalTo(textSize.width);
|
|
|
make.height.mas_equalTo(textSize.height);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
@@ -1087,16 +1084,16 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
if (_messageModel.isSender) {
|
|
|
[_imageContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-16);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_equalTo(imageSize.width);
|
|
|
make.height.mas_equalTo(imageSize.height);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
} else {
|
|
|
[_imageContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(16);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_equalTo(imageSize.width);
|
|
|
make.height.mas_equalTo(imageSize.height);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
@@ -1109,16 +1106,16 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
if (_messageModel.isSender) {
|
|
|
[_videoContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-16);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_equalTo(videoSize.width);
|
|
|
make.height.mas_equalTo(videoSize.height);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
} else {
|
|
|
[_videoContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(16);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_equalTo(videoSize.width);
|
|
|
make.height.mas_equalTo(videoSize.height);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
@@ -1130,11 +1127,11 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
// 设置内容视图约束
|
|
|
[_voiceContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
if (_messageModel.isSender) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-26);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
} else {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(26);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
}
|
|
|
- make.top.equalTo(_avatarImageView).offset(28);
|
|
|
+ make.top.equalTo(_timeLabel).offset(28);
|
|
|
make.width.mas_equalTo(_messageModel.voiceWidth);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
@@ -1148,15 +1145,15 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
|
|
|
if (_messageModel.isSender) {
|
|
|
[_callContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-26);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_lessThanOrEqualTo(kContentMaxWidth);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
} else {
|
|
|
[_callContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(26);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_lessThanOrEqualTo(kContentMaxWidth);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
@@ -1189,11 +1186,11 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
- (void)layoutHistoryContent {
|
|
|
[_historyContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
if (_messageModel.isSender) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-26);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
} else {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(26);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
}
|
|
|
- make.top.equalTo(_avatarImageView).offset(28);
|
|
|
+ make.top.equalTo(_timeLabel).offset(28);
|
|
|
make.width.mas_equalTo(160);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
@@ -1202,15 +1199,15 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
- (void)layoutOtherContent {
|
|
|
if (_messageModel.isSender) {
|
|
|
[_currentContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_avatarImageView.mas_left).offset(-26);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.right.equalTo(self.contentView).offset(-kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_lessThanOrEqualTo(kContentMaxWidth);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
} else {
|
|
|
[_currentContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.equalTo(_avatarImageView.mas_right).offset(26);
|
|
|
- make.top.mas_equalTo(_avatarImageView.mas_top).offset(28);
|
|
|
+ make.left.equalTo(self.contentView).offset(kAvatarMargin);
|
|
|
+ make.top.mas_equalTo(_timeLabel.mas_top).offset(28);
|
|
|
make.width.mas_lessThanOrEqualTo(kContentMaxWidth);
|
|
|
make.bottom.equalTo(self.contentView).offset(-kVerticalMargin).priorityHigh();
|
|
|
}];
|
|
|
@@ -1275,15 +1272,16 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
}
|
|
|
|
|
|
- (NSString *)formatTimeWithMilliseconds:(NSInteger)milliseconds{
|
|
|
- CGFloat seconds = milliseconds / 1000.0;
|
|
|
+ NSInteger seconds = milliseconds / 1000.0;
|
|
|
|
|
|
if (seconds >= 60) {
|
|
|
// 大于等于60秒时显示为分钟,保留一位小数
|
|
|
- CGFloat minutes = seconds / 60.0;
|
|
|
- return [NSString stringWithFormat:@"%.1f分钟", minutes];
|
|
|
+ NSInteger minutes = seconds / 60.0;
|
|
|
+ NSInteger sc = seconds%60;
|
|
|
+ return [NSString stringWithFormat:@"%ld分%ld秒", (long)minutes,(long)sc];
|
|
|
} else {
|
|
|
// 小于60秒时显示为秒,保留整数
|
|
|
- return [NSString stringWithFormat:@"%.0f秒", seconds];
|
|
|
+ return [NSString stringWithFormat:@"%ld秒", seconds];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1301,8 +1299,14 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
[MBProgressHUD showWithText:@"图片正在上传"];
|
|
|
return;
|
|
|
}
|
|
|
+ NSMutableArray *array = [NSMutableArray new];
|
|
|
+ NSDictionary *item = @{
|
|
|
+ @"localPath":_messageModel.localurl,
|
|
|
+ @"remoteURL":_messageModel.url
|
|
|
+ };
|
|
|
+ [array addObject:item];
|
|
|
|
|
|
- [FilePreviewer.shared previewFileWithLocalPath:_messageModel.localurl remoteURL:getURL(_messageModel.url) fromViewController:self.parentViewController];
|
|
|
+ [FilePreviewer.shared shouImages:array actindex:0 fromViewController:self.parentViewController];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1415,7 +1419,7 @@ static const CGFloat kMediaCornerRadius = 4.0f;
|
|
|
return;
|
|
|
}
|
|
|
if (_messageModel.quoteMessage.messageType == ChatMessageTypeText) {
|
|
|
- QuoteDetailController * quoteDetailVc = [[QuoteDetailController alloc] init];
|
|
|
+ GotoDetailController * quoteDetailVc = [[GotoDetailController alloc] init];
|
|
|
quoteDetailVc.quotedContent = _messageModel.quoteMessage.content;
|
|
|
quoteDetailVc.quotedSenderName = _messageModel.quoteMessage.nickName;
|
|
|
|