diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.h b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.h index c1220b3d..75fe902b 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.h +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface MsRoomMessagChatHallView : UIView -@property(nonatomic,strong) MSSessionPublicChatHallTopModel *topModel; +@property(nonatomic,strong) MSSessionPublicChatHallTopModel * __nullable topModel; - (instancetype)initWithDelegate:(id)delegate; - (void)handleNIMImageMessage:(NIMMessage *)message; @end diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m index 7e149cb0..974fb4d7 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessagChatHallView.m @@ -135,12 +135,13 @@ make.height.mas_greaterThanOrEqualTo(0); }]; - + RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo; + CGFloat top = infoModel.type == RoomType_MiniGame ? 0 : 10; [self.messageTableView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(self).offset(15); make.trailing.mas_equalTo(self); make.bottom.mas_equalTo(10); - make.top.equalTo(self.headerView.mas_bottom).mas_offset(0); + make.top.equalTo(self.headerView.mas_bottom).mas_offset(top); }]; @@ -173,25 +174,6 @@ AttachmentModel *attachment = (AttachmentModel *)obj.attachment; 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.headerView.content = 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.headerView.content = 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; } @@ -448,6 +430,14 @@ } RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo; self.headerView.isGame = infoModel.type == RoomType_MiniGame; + + CGFloat top = infoModel.type == RoomType_MiniGame ? 0 : 10; + [self.messageTableView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self).offset(15); + make.trailing.mas_equalTo(self); + make.bottom.mas_equalTo(10); + make.top.equalTo(self.headerView.mas_bottom).mas_offset(top); + }]; } diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m index f1c49a37..29562ce7 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m @@ -15,6 +15,7 @@ #import #import "Api+Message.h" #import "MSSessionPublicChatHallTopModel.h" +#import "AttachmentModel.h" @interface MsRoomMessageMainView() ///分页标题 @property (nonatomic, strong) NSArray *titles; @@ -83,6 +84,24 @@ #pragma mark - RoomGuestDelegate - (void)handleNIMCustomMessage:(NIMMessage *)message { + NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; + if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { + AttachmentModel *attachment = (AttachmentModel *)obj.attachment; + + 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.chatHallView.topModel = nil; + self.roomView.topModel = nil; + + }else{ + self.chatHallView.topModel = topModel; + self.roomView.topModel = topModel; + + } + } + } + UserInfoModel *infoModel = self.hostDelegate.getUserInfo; NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]]; if(![message.session.sessionId isEqualToString:publicChatRoomId]){ @@ -95,6 +114,8 @@ } - (void)handleNIMNotificationMessage:(NIMMessage *)message { + + UserInfoModel *infoModel = self.hostDelegate.getUserInfo; NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]]; if(![message.session.sessionId isEqualToString:publicChatRoomId]){ diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.h b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.h index 0d3973fb..ae4e8fb4 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.h +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.h @@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN @interface XPRoomMessageContainerView : UIView -@property(nonatomic,strong) MSSessionPublicChatHallTopModel *topModel; +@property(nonatomic,strong) MSSessionPublicChatHallTopModel *__nullable topModel; - (void)showUserCard:(NSInteger)uid; - (instancetype)initWithDelegate:(id)delegate; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m index b3db65ca..5a1c23f5 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m @@ -263,10 +263,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; make.height.mas_greaterThanOrEqualTo(0); }]; + RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo; + CGFloat top = infoModel.type == RoomType_MiniGame ? 0 : 10; [self.messageTableView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(self).offset(15); make.bottom.trailing.mas_equalTo(self); - make.top.equalTo(self.headlineView.mas_bottom).mas_offset(0); + make.top.equalTo(self.headlineView.mas_bottom).mas_offset(top); }]; [self.messageTipsBtn mas_makeConstraints:^(MASConstraintMaker *make) { @@ -286,7 +288,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; _topModel = topModel; if(_topModel != nil){ self.headlineView.content = _topModel.content; - [self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { + [self.headlineView mas_remakeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(self).offset(15); make.top.trailing.mas_equalTo(self); make.height.mas_greaterThanOrEqualTo(0); @@ -294,7 +296,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; }]; }else{ - [self.headerView mas_remakeConstraints:^(MASConstraintMaker *make) { + [self.headlineView mas_remakeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(self).offset(15); make.top.trailing.mas_equalTo(self); make.height.mas_equalTo(0); @@ -441,30 +443,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; if (giftInfo.giftType == GiftType_super){ return NO; } - }else 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.headlineView.content = topModel.content; - [self.headlineView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(self).offset(15); - make.top.trailing.mas_equalTo(self); - make.height.mas_equalTo(0); - - }]; - - }else{ - self.headlineView.content = topModel.content; - [self.headlineView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(self).offset(15); - make.top.trailing.mas_equalTo(self); - make.height.mas_greaterThanOrEqualTo(0); - - }]; - - } } - - return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)]; } return NO; @@ -965,6 +944,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; } RoomInfoModel *infoModel = self.hostDelegate.getRoomInfo; self.headlineView.isGame = infoModel.type == RoomType_MiniGame; + CGFloat top = infoModel.type == RoomType_MiniGame ? 0 : 10; + [self.messageTableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self).offset(15); + make.bottom.trailing.mas_equalTo(self); + make.top.equalTo(self.headlineView.mas_bottom).mas_offset(top); + }]; } #pragma mark - ScrollViewDelegate