头条优化

This commit is contained in:
liyuhua
2024-06-04 11:30:58 +08:00
committed by eggmanQQQ
parent d4023a1d4c
commit 5cb44c5e72
5 changed files with 45 additions and 49 deletions

View File

@@ -13,7 +13,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface MsRoomMessagChatHallView : UIView<RoomGuestDelegate,JXCategoryListContentViewDelegate>
@property(nonatomic,strong) MSSessionPublicChatHallTopModel *topModel;
@property(nonatomic,strong) MSSessionPublicChatHallTopModel * __nullable topModel;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
- (void)handleNIMImageMessage:(NIMMessage *)message;
@end

View File

@@ -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);
}];
}

View File

@@ -15,6 +15,7 @@
#import <NIMSDK/NIMSDK.h>
#import "Api+Message.h"
#import "MSSessionPublicChatHallTopModel.h"
#import "AttachmentModel.h"
@interface MsRoomMessageMainView()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate>
///
@property (nonatomic, strong) NSArray<NSString *> *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]){

View File

@@ -13,7 +13,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomMessageContainerView : UIView<RoomGuestDelegate,JXCategoryListContentViewDelegate>
@property(nonatomic,strong) MSSessionPublicChatHallTopModel *topModel;
@property(nonatomic,strong) MSSessionPublicChatHallTopModel *__nullable topModel;
- (void)showUserCard:(NSInteger)uid;
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;

View File

@@ -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