修改欢迎Ta
This commit is contained in:
@@ -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];
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user