This commit is contained in:
启星
2025-10-25 19:38:29 +08:00
parent 3a5cf56099
commit 90709a94c4
144 changed files with 890 additions and 821 deletions

View File

@@ -23,6 +23,8 @@ typedef NS_ENUM(NSInteger) {
QXRoomChatMessageTypeGift = 2,
/// 表情
QXRoomChatMessageTypeEmoji = 3,
/// 系统公告
QXRoomChatMessageTypeNotice = 10,
}QXRoomChatMessageType;
@class QXRoomChatListModel;
@interface QXRoomChatListView : UIView
@@ -49,14 +51,14 @@ typedef NS_ENUM(NSInteger) {
@interface QXRoomGiftListCell : UITableViewCell
@property(nonatomic,strong)UIView *bgView;
@property(nonatomic,strong)UIImageView *headerImageView;
@property(nonatomic,strong)UIView *iconBgView;
//@property(nonatomic,strong)UIImageView *headerImageView;
//@property(nonatomic,strong)UIView *iconBgView;
/// 礼物图片
@property(nonatomic,strong)UIImageView *giftImageView;
//@property(nonatomic,strong)UIImageView *giftImageView;
/// 礼物数量
@property(nonatomic,strong)UILabel *giftCountLabel;
@property(nonatomic,strong)NSMutableArray *iconViewArray;
@property(nonatomic,strong)UILabel *nameLabel;
//@property(nonatomic,strong)UILabel *giftCountLabel;
//@property(nonatomic,strong)NSMutableArray *iconViewArray;
//@property(nonatomic,strong)UILabel *nameLabel;
@property(nonatomic,strong)UILabel *titleLabel;
@property(nonatomic,strong)UIImageView *bubbleImageView;
@property (nonatomic,strong)QXRoomChatListModel *message;

View File

@@ -7,6 +7,7 @@
#import "QXRoomChatListView.h"
#import "UIImage+WebP.h"
#define messageNoticeColor RGB16(0xCCA882)
#define messageNameColor RGB16(0x00C8FF)
#define messageGiftColor RGB16(0xFFE309)
#define messageBubbleColor RGB16A(0x000000, 0.3)
@@ -66,7 +67,7 @@ NSInteger maxMessageCount = 20;
[self addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self);
make.top.equalTo(self).offset(0);
make.top.equalTo(self).offset(10);
make.bottom.equalTo(self).offset(-10);
}];
@@ -169,7 +170,7 @@ NSInteger maxMessageCount = 20;
}
-(void)insertNoitce{
QXRoomChatListModel *model = [QXRoomChatListModel new];
model.messageType = QXRoomChatMessageTypeSystem;
model.messageType = QXRoomChatMessageTypeNotice;
model.text = @"羽声语音严禁未成年人进行直播或打赏官方将24小时在线巡查。我们提倡绿色直播直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。";
[self.dataArray addObject:model];
[self.tableView reloadData];
@@ -315,13 +316,13 @@ NSInteger maxMessageCount = 20;
height = 28+19+13+8 + height;
}
}else if (model.messageType == QXRoomChatMessageTypeGift) {
if ([model.FromUserInfo.chat_bubble isExist]) {
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-60-18];
height = 28+19+13+16 + height;
}else{
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-60-18-16];
height = 28+19+13+8 + height;
}
// if ([model.FromUserInfo.chat_bubble isExist]) {
// height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16*2-8];
// height = 16*2 + height+1;
// }else{
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16*2-8];
height = 8*2+messageBubbleMargin*2 + height+1;
// }
}else if(model.messageType == QXRoomChatMessageTypeEmoji){
if ([model.FromUserInfo.chat_bubble isExist]) {
height = 28+19+13+16 + 40;
@@ -689,26 +690,26 @@ NSInteger maxMessageCount = 20;
}
}
self.titleLabel.attributedText = attr;
self.nameLabel.text = message.FromUserInfo.nickname;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.avatar]];
self.iconBgView.hidden = YES;
for (int i = 0;i < message.FromUserInfo.icon.count;i++) {
if (i < 3) {
self.iconBgView.hidden = NO;
UIImageView *iconImageView = self.iconViewArray[i];
iconImageView.hidden = NO;
[iconImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.icon[i]]];
}else{
self.iconBgView.hidden = YES;
}
}
// self.nameLabel.text = message.FromUserInfo.nickname;
// [self.headerImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.avatar]];
// self.iconBgView.hidden = YES;
// for (int i = 0;i < message.FromUserInfo.icon.count;i++) {
// if (i < 3) {
// self.iconBgView.hidden = NO;
// UIImageView *iconImageView = self.iconViewArray[i];
// iconImageView.hidden = NO;
// [iconImageView sd_setImageWithURL:[NSURL URLWithString:message.FromUserInfo.icon[i]]];
// }else{
// self.iconBgView.hidden = YES;
// }
// }
}
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
[self.contentView addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(0);
make.right.mas_lessThanOrEqualTo(-8);
make.top.mas_equalTo(messageBubbleMargin);
make.bottom.mas_equalTo(-messageBubbleMargin);
}];
@@ -723,36 +724,36 @@ NSInteger maxMessageCount = 20;
make.edges.equalTo(self.bgView);
}];
self.headerImageView = [[UIImageView alloc] init];
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
self.headerImageView.backgroundColor = [UIColor whiteColor];
[self.headerImageView addRoundedCornersWithRadius:14];
[self.bgView addSubview:self.headerImageView];
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(19);
make.size.mas_equalTo(CGSizeMake(28, 28));
}];
UIButton *headerBtn = [[UIButton alloc] init];
[headerBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:headerBtn];
[headerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self.headerImageView).offset(-2);
make.bottom.right.equalTo(self.headerImageView).offset(2);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0xDED6ED);
self.nameLabel.font = [UIFont systemFontOfSize:14];
[self.bgView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.headerImageView).offset(-3);
make.left.equalTo(self.headerImageView.mas_right).offset(8);
make.height.mas_equalTo(18);
}];
// self.headerImageView = [[UIImageView alloc] init];
// self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
// self.headerImageView.backgroundColor = [UIColor whiteColor];
// [self.headerImageView addRoundedCornersWithRadius:14];
// [self.bgView addSubview:self.headerImageView];
//
// [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(16);
// make.top.mas_equalTo(19);
// make.size.mas_equalTo(CGSizeMake(28, 28));
// }];
//
// UIButton *headerBtn = [[UIButton alloc] init];
// [headerBtn addTarget:self action:@selector(headerAction) forControlEvents:(UIControlEventTouchUpInside)];
// [self.bgView addSubview:headerBtn];
// [headerBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.top.equalTo(self.headerImageView).offset(-2);
// make.bottom.right.equalTo(self.headerImageView).offset(2);
// }];
//
// self.nameLabel = [[UILabel alloc] init];
// self.nameLabel.textColor = RGB16(0xDED6ED);
// self.nameLabel.font = [UIFont systemFontOfSize:14];
// [self.bgView addSubview:self.nameLabel];
// [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(self.headerImageView).offset(-3);
// make.left.equalTo(self.headerImageView.mas_right).offset(8);
// make.height.mas_equalTo(18);
// }];
//
self.titleLabel = [[UILabel alloc] init];
@@ -760,85 +761,95 @@ NSInteger maxMessageCount = 20;
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.numberOfLines = 0;
[self.bgView addSubview:self.titleLabel];
// [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.nameLabel).offset(0);
// make.top.equalTo(self.headerImageView.mas_bottom).offset(13);
// make.right.mas_lessThanOrEqualTo(-18);
// }];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel).offset(0);
make.top.equalTo(self.headerImageView.mas_bottom).offset(13);
make.right.mas_lessThanOrEqualTo(-18);
make.left.equalTo(self.bgView).offset(8);
make.top.mas_equalTo(8);
make.bottom.mas_equalTo(-8);
make.right.mas_equalTo(-8);
}];
self.nameLabel.text = @"张三站撒旦撒大萨达撒";
// self.nameLabel.text = @"张三站撒旦撒大萨达撒";
[self.contentView bringSubviewToFront:self.titleLabel];
self.iconBgView = [[UIView alloc] init];
[self.bgView addSubview:self.iconBgView];
[self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.nameLabel);
make.width.mas_equalTo(UserIconWidth*2+6);
make.height.mas_equalTo(16);
make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
}];
CGFloat iconWidth = UserIconWidth;
CGFloat iconHeight = UserIconHeight;
CGFloat margin = 6;
for (int i = 0; i < 3; i++) {
UIImageView *iconImageView = [[UIImageView alloc] init];
iconImageView.hidden = YES;
iconImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.iconBgView addSubview:iconImageView];
[iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(i*(iconWidth+margin));
make.width.mas_equalTo(iconWidth);
make.height.mas_equalTo(iconHeight);
make.centerY.equalTo(self.iconBgView);
}];
[self.iconViewArray addObject:iconImageView];
}
// self.iconBgView = [[UIView alloc] init];
// [self.bgView addSubview:self.iconBgView];
// [self.iconBgView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.nameLabel);
// make.width.mas_equalTo(UserIconWidth*2+6);
// make.height.mas_equalTo(16);
// make.top.equalTo(self.nameLabel.mas_bottom).offset(2);
// }];
//
// CGFloat iconWidth = UserIconWidth;
// CGFloat iconHeight = UserIconHeight;
// CGFloat margin = 6;
// for (int i = 0; i < 3; i++) {
// UIImageView *iconImageView = [[UIImageView alloc] init];
// iconImageView.hidden = YES;
// iconImageView.contentMode = UIViewContentModeScaleAspectFit;
// [self.iconBgView addSubview:iconImageView];
// [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(i*(iconWidth+margin));
// make.width.mas_equalTo(iconWidth);
// make.height.mas_equalTo(iconHeight);
// make.centerY.equalTo(self.iconBgView);
// }];
// [self.iconViewArray addObject:iconImageView];
// }
}
-(void)loadBubble{
if ([self.message.FromUserInfo.chat_bubble isExist]) {
self.bubbleImageView.backgroundColor = UIColor.clearColor;
// self.bubbleImageView.image = [[UIImage imageNamed:@"chat_bubble2"] resizableImageWithCapInsets:UIEdgeInsetsMake(30, 40, 40, 40) resizingMode:(UIImageResizingModeStretch)];;
[self.bubbleImageView sd_setImageWithURL:[NSURL URLWithString:self.message.FromUserInfo.chat_bubble] placeholderImage:nil options:SDWebImageRetryFailed completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(40, 40, 40, 40) resizingMode:(UIImageResizingModeStretch)];
self.bubbleImageView.image = image;
}];
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(8);
make.right.mas_equalTo(0);
make.top.mas_equalTo(0);
make.bottom.mas_equalTo(0);
}];
[self.headerImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.top.mas_equalTo(19);
}];
}else{
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-8);
make.top.mas_equalTo(messageBubbleMargin);
make.bottom.mas_equalTo(-messageBubbleMargin);
}];
[self.headerImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(9);
make.top.mas_equalTo(11);
}];
self.bubbleImageView.image = nil;
self.bubbleImageView.backgroundColor = messageBubbleColor;
}
}
-(NSMutableArray *)iconViewArray{
if (!_iconViewArray) {
_iconViewArray = [NSMutableArray array];
}
return _iconViewArray;
// if ([self.message.FromUserInfo.chat_bubble isExist]) {
// self.bubbleImageView.backgroundColor = UIColor.clearColor;
//// self.bubbleImageView.image = [[UIImage imageNamed:@"chat_bubble2"] resizableImageWithCapInsets:UIEdgeInsetsMake(30, 40, 40, 40) resizingMode:(UIImageResizingModeStretch)];;
// [self.bubbleImageView sd_setImageWithURL:[NSURL URLWithString:self.message.FromUserInfo.chat_bubble] placeholderImage:nil options:SDWebImageRetryFailed completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
// image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(40, 40, 40, 40) resizingMode:(UIImageResizingModeStretch)];
// self.bubbleImageView.image = image;
// }];
// [self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(8);
// make.right.mas_equalTo(0);
// make.top.mas_equalTo(0);
// make.bottom.mas_equalTo(0);
// }];
// [self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(16);
// make.top.mas_equalTo(16);
// make.bottom.mas_equalTo(-16);
// make.right.mas_equalTo(-16);
// }];
// }else{
// [self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(16);
// make.right.mas_equalTo(-8);
// make.top.mas_equalTo(messageBubbleMargin);
// make.bottom.mas_equalTo(-messageBubbleMargin);
// }];
// [self.titleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
// make.left.mas_equalTo(8);
// make.top.mas_equalTo(8);
// make.bottom.mas_equalTo(-8);
// make.right.mas_equalTo(-8);
// }];
// self.bubbleImageView.image = nil;
// self.bubbleImageView.backgroundColor = messageBubbleColor;
// }
}
//-(NSMutableArray *)iconViewArray{
// if (!_iconViewArray) {
// _iconViewArray = [NSMutableArray array];
// }
// return _iconViewArray;
//}
@end
@@ -1103,6 +1114,9 @@ NSInteger maxMessageCount = 20;
}
}
}
if (message.messageType == QXRoomChatMessageTypeNotice) {
[attr yy_setColor:messageNameColor range:NSMakeRange(0, attr.length)];
}
self.titleLabel.attributedText = attr;
}

View File

@@ -161,10 +161,24 @@
}
}
-(void)textDidChange:(UITextField*)textField{
if ([self isMarkedText]) {
//
QXLOG(@"中文输入中,不回调");
return;
}
QXLOG(@"中文输入结束,回调");
[[SDImageCache sharedImageCache] clearMemory];
self.page = 0;
[self getSongList];
}
- (BOOL)isMarkedText {
UITextRange *markedTextRange = self.textField.markedTextRange;
return markedTextRange && ![markedTextRange isEmpty];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}

View File

@@ -18,6 +18,10 @@
- (void)setupDisplayViewInContainer:(UIView *)container;
- (void)clearAll;
- (void)inBackGround;
- (void)becomeFront;
@end

View File

@@ -18,6 +18,7 @@
@property (nonatomic, strong) NSMutableDictionary *accumulatedGifts;
@property (nonatomic, strong) NSMutableDictionary *waitingUpdateGifts; //
@property (nonatomic, assign) BOOL isProcessingQueue; //
@property (nonatomic, assign) BOOL isInBackground; //
@end
@@ -74,6 +75,9 @@
}
- (void)receiveGift:(QXRoomChatListModel *)gift {
if (self.isInBackground) {
return;
}
if (!gift) return;
dispatch_async(dispatch_get_main_queue(), ^{
@@ -220,7 +224,20 @@
self.isProcessingQueue = NO;
}
-(void)inBackGround{
self.isInBackground = YES;
for (QXGiftDisplayView *view in self.displayViews) {
[view finishAnimationImmediately];
}
[self.giftQueue removeAllObjects];
[self.accumulatedGifts removeAllObjects];
[self.waitingUpdateGifts removeAllObjects];
self.isProcessingQueue = NO;
}
-(void)becomeFront{
self.isInBackground = NO;
}
//
- (void)printDebugInfo {
NSLog(@"=== 飘屏管理器状态 ===");

View File

@@ -91,11 +91,14 @@
self.senderLabel.text = [NSString stringWithFormat:@"%@",gift.FromUserInfo.nickname?: @""];
//
self.giftLabel.text = [NSString stringWithFormat:@"%@送给%@",gift.ToUserInfo.nickname?: @"", gift.GiftInfo.gift_name ?: @"礼物"];
self.giftLabel.text = [NSString stringWithFormat:@"送给%@%@",gift.ToUserInfo.nickname?: @"", gift.GiftInfo.gift_name ?: @"礼物"];
//
self.countLabel.text = [NSString stringWithFormat:@"x%@", gift.gift_num];
if (gift.gift_num.intValue>0) {
self.countLabel.text = [NSString stringWithFormat:@"x%@", gift.gift_num];
}else{
self.countLabel.text = @"";
}
// 使SDWebImage
[self.avatarImageView sd_setImageWithURL:[NSURL URLWithString:gift.FromUserInfo.avatar]];
@@ -157,19 +160,23 @@
NSLog(@"更新礼物数量: %ld", (long)count);
//
self.countLabel.text = [NSString stringWithFormat:@"x%ld", (long)count];
//
[UIView animateWithDuration:0.2 animations:^{
self.countLabel.transform = CGAffineTransformMakeScale(1.5, 1.5);
} completion:^(BOOL finished) {
if (count>0) {
self.countLabel.text = [NSString stringWithFormat:@"x%ld", (long)count];
//
[UIView animateWithDuration:0.2 animations:^{
self.countLabel.transform = CGAffineTransformIdentity;
self.countLabel.transform = CGAffineTransformMakeScale(1.5, 1.5);
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.2 animations:^{
self.countLabel.transform = CGAffineTransformIdentity;
}];
//
[self resetHideTimer];
}];
//
[self resetHideTimer];
}];
}else{
self.countLabel.text = @"";
}
}
- (void)startHideTimer {

View File

@@ -183,7 +183,7 @@
MJWeakSelf
[QXMineNetwork getWalletInfoSuccessBlock:^(NSString * _Nonnull coin, NSString * _Nonnull earnings, NSString * _Nonnull title, NSString * _Nonnull url) {
weakSelf.coin = coin;
weakSelf.earnings = coin;
weakSelf.earnings = earnings;
weakSelf.moneyLabel.text = [NSString stringWithFormat:@"%@金币可用",self.coin];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
@@ -770,7 +770,7 @@
-(void)helpAction{
self.isFromRule = YES;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@api/Page/page_show?id=25",ServerUrl]]];
[self.webView loadRequest:request];
self.backBtn.hidden = NO;
self.helpBtn.hidden = YES;