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

View File

@@ -84,9 +84,46 @@
self.hostDelegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
[self add__test__button];
}
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
- (UIView *)listView {
return self;
@@ -96,16 +133,14 @@
}
#pragma mark - Response
#pragma mark - Private Method
- (void)initSubViews {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCustomMessage:) name:@"message" object:nil];
[self addSubview:self.headerView];
[self.headerView addSubview:self.titleView];
self.headerView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
[self addSubview:self.messageTableView];
[Api getPublicChatHallTopText:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
@@ -113,21 +148,9 @@
MSSessionPublicChatHallTopModel *model = [MSSessionPublicChatHallTopModel modelWithDictionary:data.data];
if(model != nil){
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{
[self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
make.height.mas_equalTo(0);
}];
} else {
self.titleView.text = @"";
}
}
}];
}
@@ -137,7 +160,6 @@
make.leading.mas_equalTo(self).offset(15);
make.top.trailing.mas_equalTo(self);
make.height.mas_greaterThanOrEqualTo(0);
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.top.bottom.equalTo(self.headerView).inset(10);
@@ -147,14 +169,8 @@
make.bottom.trailing.mas_equalTo(self);
make.top.equalTo(self.headerView.mas_bottom).mas_offset(10);
}];
}
#pragma mark -
@@ -165,10 +181,7 @@
NSIndexPath *ip = [NSIndexPath indexPathForRow:self.datasource.count-1 inSection:0]; //
[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){
MSSessionPublicChatHallTopModel *topModel = [MSSessionPublicChatHallTopModel modelWithDictionary:attachment.data];
if(topModel.recordStatus == 1){
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_equalTo(0);
}];
}else{
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){
self.titleView.text = @"";
return NO;
} else {
self.titleView.text = topModel.content;
}
}
return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)];
@@ -234,7 +233,7 @@
- (void)handleNIMCustomMessage:(NIMMessage *)message {
self.isMiniEnter = NO;
if ([self isCanDisplayMessage:message]) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
// NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
[self addRoomMessage:message];
}
}
@@ -262,10 +261,9 @@
self.isMiniEnter = NO;
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
// RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
if (content.eventType == NIMChatroomEventTypeEnter) {
NIMChatroomNotificationMember *member = content.targets[0];
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 {
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
// self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
}
- (void)onRoomUpdate {
///
if (self.hostDelegate.getRoomInfo.hadChangeRoomType) {
self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
// self.headerView.backgroundColor = UIColorRGBAlpha(0xADF4FF, 0.2);
[self.messageTableView reloadData];
}
}

View File

@@ -183,7 +183,7 @@
}
- (MsRoomMessagChatHallView *)chatHallView{
if(!_chatHallView){
_chatHallView = [[MsRoomMessagChatHallView alloc]initWithDelegate:self.hostDelegate];
_chatHallView = [[MsRoomMessagChatHallView alloc] initWithDelegate:self.hostDelegate];
}
return _chatHallView;
}