Compare commits

...

1 Commits

Author SHA1 Message Date
eggmanQQQ
b638193f25 temp save 2024-05-28 16:29:30 +08:00
3 changed files with 53 additions and 55 deletions

View File

@@ -66,9 +66,9 @@
[self.presenter getPublicChatHallList]; [self.presenter getPublicChatHallList];
} }
-(void)getPublicChatHallListSuccess:(NSArray<MSSessionScrollingModel *> *)list{ -(void)getPublicChatHallListSuccess:(NSArray<MSSessionScrollingModel *> *)list{
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
for (MSSessionScrollingModel *model in list) { for (MSSessionScrollingModel *model in list) {
CGSize dstRect = CGSizeMake(model.width, MAXFLOAT); CGSize dstRect = CGSizeMake(model.width, MAXFLOAT);
QEmotionHelper *faceManager = [QEmotionHelper sharedEmotionHelper];
NSMutableAttributedString * attribute = [faceManager attributedStringByText:model.content font:kFontMedium(12)]; NSMutableAttributedString * attribute = [faceManager attributedStringByText:model.content font:kFontMedium(12)];
[attribute addAttributes:@{NSForegroundColorAttributeName: UIColorFromRGB(0xFFFCED)} range:[attribute.string rangeOfString:attribute.string]]; [attribute addAttributes:@{NSForegroundColorAttributeName: UIColorFromRGB(0xFFFCED)} range:[attribute.string rangeOfString:attribute.string]];
YYTextContainer *container = [YYTextContainer containerWithSize:dstRect]; YYTextContainer *container = [YYTextContainer containerWithSize:dstRect];

View File

@@ -84,9 +84,46 @@
self.hostDelegate = delegate; self.hostDelegate = delegate;
[self initSubViews]; [self initSubViews];
[self initSubViewConstraints]; [self initSubViewConstraints];
[self add__test__button];
} }
return self; return self;
} }
- (void)add__test__button {
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
b.titleLabel.text= @"测试按钮";
b.backgroundColor = [UIColor blackColor];
[b addTarget:self
action:@selector(__test__)
forControlEvents:UIControlEventTouchUpInside];
[self addSubview:b];
[b mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(100, 40));
make.center.mas_equalTo(CGPointMake(100, 50));
}];
}
- (void)__test__ {
NSInteger randomNum = arc4random()%1000;
[self updateTitleView:(randomNum > 500) ?
[NSString stringWithFormat:@"测试头头头头拓土偷偷头条 %ld", (long)randomNum] :
@""];
}
- (void)updateTitleView:(NSString *)content {
self.titleView.text = content;
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
if (content.length > 0) {
make.height.mas_greaterThanOrEqualTo(0);
}else {
make.height.mas_equalTo(0);
}
}];
}
#pragma mark - JXCategoryListContentViewDelegate #pragma mark - JXCategoryListContentViewDelegate
- (UIView *)listView { - (UIView *)listView {
return self; return self;
@@ -96,16 +133,14 @@
} }
#pragma mark - Response #pragma mark - Response
#pragma mark - Private Method #pragma mark - Private Method
- (void)initSubViews { - (void)initSubViews {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCustomMessage:) name:@"message" object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCustomMessage:) name:@"message" object:nil];
[self addSubview:self.headerView]; [self addSubview:self.headerView];
[self.headerView addSubview:self.titleView]; [self.headerView addSubview:self.titleView];
self.headerView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
[self addSubview:self.messageTableView]; [self addSubview:self.messageTableView];
[Api getPublicChatHallTopText:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { [Api getPublicChatHallTopText:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@@ -113,21 +148,9 @@
MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data]; MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data];
if(model != nil){ if(model != nil){
self.titleView.text = model.content; self.titleView.text = model.content;
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
make.height.mas_greaterThanOrEqualTo(0);
}];
} else { } else {
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { self.titleView.text = @"";
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
make.height.mas_equalTo(0);
}];
} }
} }
}]; }];
} }
@@ -137,7 +160,6 @@
make.leading.mas_equalTo(self).offset(15); make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self); make.top.trailing.mas_equalTo(self);
make.height.mas_greaterThanOrEqualTo(0); make.height.mas_greaterThanOrEqualTo(0);
}]; }];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) { [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.top.bottom.equalTo(self.headerView).inset(10); make.leading.trailing.top.bottom.equalTo(self.headerView).inset(10);
@@ -147,14 +169,8 @@
make.bottom.trailing.mas_equalTo(self); make.bottom.trailing.mas_equalTo(self);
make.top.equalTo(self.headerView.mas_bottom).mas_offset(10); make.top.equalTo(self.headerView.mas_bottom).mas_offset(10);
}]; }];
} }
#pragma mark - #pragma mark -
@@ -165,10 +181,7 @@
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.datasource.count-1 inSection:0]; // NSIndexPath *ip = [NSIndexPath indexPathForRow:self.datasource.count-1 inSection:0]; //
[self.messageTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:animated]; // [self.messageTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:animated]; //
}); });
} }
} }
/// ///
@@ -179,24 +192,10 @@
if(attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn){ if(attachment.first == CustomMessageType_Chat_Hall_Headlinesn && attachment.second == Custom_Message_Sub_Chat_Hall_Headlinesn){
MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data]; MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data];
if(topModel.recordStatus == 1){ if(topModel.recordStatus == 1){
self.titleView.text = topModel.content; self.titleView.text = @"";
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { return NO;
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
make.height.mas_equalTo(0);
}];
} else { } else {
self.titleView.text = topModel.content; self.titleView.text = topModel.content;
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
make.height.mas_greaterThanOrEqualTo(0);
}];
}
if(topModel.recordStatus == 1){
return NO;
} }
} }
return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)]; return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)];
@@ -234,7 +233,7 @@
- (void)handleNIMCustomMessage:(NIMMessage *)message { - (void)handleNIMCustomMessage:(NIMMessage *)message {
self.isMiniEnter = NO; self.isMiniEnter = NO;
if ([self isCanDisplayMessage:message]) { if ([self isCanDisplayMessage:message]) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; // NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
[self addRoomMessage:message]; [self addRoomMessage:message];
} }
} }
@@ -262,10 +261,9 @@
self.isMiniEnter = NO; self.isMiniEnter = NO;
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject; NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content; NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo; // RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
if (content.eventType == NIMChatroomEventTypeEnter) { if (content.eventType == NIMChatroomEventTypeEnter) {
NIMChatroomNotificationMember *member = content.targets[0]; NIMChatroomNotificationMember *member = content.targets[0];
if (member.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue) { if (member.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
/// ///
@@ -436,18 +434,18 @@
} }
}]; }];
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2); // self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
} }
- (void)onRoomEntered { - (void)onRoomEntered {
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2); // self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
} }
- (void)onRoomUpdate { - (void)onRoomUpdate {
/// ///
if (self.hostDelegate.getRoomInfo.hadChangeRoomType) { if (self.hostDelegate.getRoomInfo.hadChangeRoomType) {
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2); // self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
[self.messageTableView reloadData]; [self.messageTableView reloadData];
} }
} }