修改欢迎Ta

This commit is contained in:
chenshuanglin
2023-03-22 17:47:32 +08:00
parent df1430dd53
commit 9efb4f9504
2 changed files with 38 additions and 25 deletions

View File

@@ -130,7 +130,9 @@
return [self createWishGiftAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_Starred_Kitchen) {
return [self createStarredKitchenAttribute:attachment messageInfo:messageInfo];
}
} else if (first == CustomMessageType_Room_Welcome && attachment.second == Custom_Message_Sub_Room_Welcome) {
return [self createWelcomeAttribute:attachment messageInfo:messageInfo];
}
return nil;
}
@@ -294,30 +296,28 @@
if (code == 200) {
NSDictionary *dataDcit = data.data;
NSString *msg = dataDcit[@"msg"];
if (msg.length > 0) {
///
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_Room_Welcome;
attachment.second = Custom_Message_Sub_Room_Welcome;
NSDictionary * dic = @{@"targetUid": toUid,
@"targetNick": nick,
@"content":msg,
@"isFans":dataDcit[@"isFans"]
};
attachment.data = dic;
///
AttachmentModel * attachment = [[AttachmentModel alloc] init];
attachment.first = CustomMessageType_Room_Welcome;
attachment.second = Custom_Message_Sub_Room_Welcome;
NSDictionary * dic = @{@"targetUid": toUid,
@"targetNick": nick,
@"content":msg ? msg : @"",
@"isFans":dataDcit[@"isFans"]
};
attachment.data = dic;
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
message.text = msg;
NIMMessage *message = [[NIMMessage alloc]init];
NIMCustomObject *object = [[NIMCustomObject alloc] init];
object.attachment = attachment;
message.messageObject = object;
message.text = msg;
NSString *sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
//
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) {
}];
}
NSString *sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
//
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) {
}];
}
} uid:uid toUid:toUid];
}];
@@ -399,6 +399,17 @@
return messageInfo;
}
#pragma mark - Ta
- (XPMessageInfoModel *)createWelcomeAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSString *nickName = attachment.data[@"targetNick"];
NSString *uid = attachment.data[@"targetUid"];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:@"欢迎" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createNickAtrribute:nickName ? nickName : @"" uid:uid.integerValue]];
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (XPMessageInfoModel *)createRedPacketAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
XPOpenRedPacketModel *info = [XPOpenRedPacketModel modelWithDictionary:attachment.data];

View File

@@ -483,6 +483,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
}
}];
return;
} else if(attachment.first == CustomMessageType_Room_Welcome && attachment.second == Custom_Message_Sub_Room_Welcome) {
// [self addRoomMessage:message];
}
}
if (self.hostDelegate.getRoomInfo.isCloseScreen) {