房间公屏用模型

This commit is contained in:
fengshuo
2022-10-21 18:03:00 +08:00
parent b93d46fb3f
commit 5df38804e2
26 changed files with 482 additions and 165 deletions

View File

@@ -17,6 +17,7 @@
#import "XPGiftStorage.h"
#import "XPRoomFaceTool.h"
#import "TTPopup.h"
#import "Api+WishGift.h"
///Model
#import "XPMessageRemoteExtModel.h"
#import "AttachmentModel.h"
@@ -37,6 +38,7 @@
#import "XPGiftCompoundModel.h"
#import "RoomSailingPrizeModel.h"
#import "XPOpenRedPacketModel.h"
#import "XPMessageInfoModel.h"
#import "NetImageView.h"
@@ -47,20 +49,21 @@
@implementation XPRoomMessageParser
- (NSAttributedString*)parseMessageAttribute:(NIMMessage *)message {
- (XPMessageInfoModel*)parseMessageAttribute:(NIMMessage *)message {
NIMMessageType messageType = message.messageType;
XPMessageInfoModel * messageInfo = [[XPMessageInfoModel alloc] init];
switch (messageType) {
case NIMMessageTypeText:
return [self makeChatAttribute:message];
return [self makeChatAttribute:message messageInfo:messageInfo];
case NIMMessageTypeTip:
return [self makeTipsAttribute:message];
return [self makeTipsAttribute:message messageInfo:messageInfo];
case NIMMessageTypeNotification:
return [self makeNotificationAttribute:message];
return [self makeNotificationAttribute:message messageInfo:messageInfo];
case NIMMessageTypeCustom:
return [self makeCustomAttribute:message];
return [self makeCustomAttribute:message messageInfo:messageInfo];
default:
return nil;
}
@@ -72,60 +75,63 @@
}
///
- (NSAttributedString *)makeCustomAttribute:(NIMMessage *)message {
- (XPMessageInfoModel *)makeCustomAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel*)messageInfo{
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
int first = attachment.first;
if (first == CustomMessageType_Gift) {///
return [self createSendGiftAttribute:attachment sendInfo:model];
return [self createSendGiftAttribute:attachment sendInfo:model messageInfo:messageInfo];
} else if(first == CustomMessageType_AllMicroSend) {///
return [self createBatchMicroSendGiftAttribute:attachment sendInfo:model];
return [self createBatchMicroSendGiftAttribute:attachment sendInfo:model messageInfo:messageInfo];
} else if(first == CustomMessageType_Room_Tip) {////
return [self createShareOrAttentionRoomAttribute:attachment sendInfo:model uid:message.from];
return [self createShareOrAttentionRoomAttribute:attachment sendInfo:model uid:message.from messageInfo:messageInfo];
} else if(first == CustomMessageType_Kick_User || first == CustomMessageType_Queue) {
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
return [self createKickUserAttribute:attachment info:kickModel];
return [self createKickUserAttribute:attachment info:kickModel messageInfo:messageInfo];
} else if(first == CustomMessageType_Candy_Tree) {//
return [self createCandyTreeHighLevelAttribute:attachment];
return [self createCandyTreeHighLevelAttribute:attachment messageInfo:messageInfo];
} else if(first == CustomMessageType_Arrange_Mic) {
return [self createArrangeMicAttribute:attachment];
return [self createArrangeMicAttribute:attachment messageInfo:messageInfo];
}else if(first == CustomMessageType_Update_RoomInfo) {
return [self createRoomInfoUpdateAttribute:attachment];
return [self createRoomInfoUpdateAttribute:attachment messageInfo:messageInfo];
} else if(first == CustomMessageType_Collection_Room) {
return [self createCollectRoomAttribute:attachment];
return [self createCollectRoomAttribute:attachment messageInfo:messageInfo];
} else if(first == CustomMessageType_RoomPlay_Dating) {
return [self createRoomDatingAttribute:attachment];
return [self createRoomDatingAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_Noble_VIP) {//
return [self createNobleLevelAttribute:attachment];
return [self createNobleLevelAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_Face) {//
return [self createRoomFaceAttribute:attachment];
return [self createRoomFaceAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_Tarot) {//
return [self createTarotAttribute:attachment];
return [self createTarotAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_Anchor_FansTeam) {//
return [self createAnchorFansTeamAttribute:attachment];
return [self createAnchorFansTeamAttribute:attachment messageInfo:messageInfo];
} else if(first == CustomMessageType_Hall_Super_Admin) {///
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
return [self createKickUserAttribute:attachment info:kickModel];
return [self createKickUserAttribute:attachment info:kickModel messageInfo:messageInfo];
} else if (first == CustomMessageType_Room_PK) {///PK
return [self createRoomPKAttribute:attachment];
return [self createRoomPKAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_LuckyBag) {///
return [self createRoomLuckyBigPrizeAttribute:attachment];
return [self createRoomLuckyBigPrizeAttribute:attachment messageInfo:messageInfo];
} else if(first == CustomMessageType_Gift_Compound) {///
return [self createRoomGiftCompoundAttribute:attachment];
return [self createRoomGiftCompoundAttribute:attachment messageInfo:messageInfo];
} else if(first == CustomMessageType_Room_Sailing) {///
return [self createRoomSailingAttribute:attachment];
return [self createRoomSailingAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_OpenRedPacketSuccess) {
return [self createRedPacketAttribute:attachment];
}
return [self createRedPacketAttribute:attachment messageInfo:messageInfo];
} else if (first == CustomMessageType_Wish_Gift) {
return [self createWishGiftAttribute:attachment messageInfo:messageInfo];
}
return nil;
}
/// @param message
- (NSAttributedString*)makeChatAttribute:(NIMMessage *)message{
- (XPMessageInfoModel*)makeChatAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
NSString * uid = [AccountInfoStorage instance].getUid;
XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]];
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
NSString * nick = [NSString stringWithFormat:@"%@:", ((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
if ([message.from isEqualToString:uid]) {
nick = @"我:";
@@ -176,15 +182,17 @@
[attribute appendAttributedString:msgStr];
}
[self attributeAddLongPressHihtLight:attribute uid:message.from nick:((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
/// tips
/// @param message
- (NSAttributedString*)makeTipsAttribute:(NIMMessage *)message {
- (XPMessageInfoModel*)makeTipsAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
if ([message.localExt.allKeys containsObject:@"isRoomTopic"]) {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString: [self createTextAttribute:message.text color:[UIColor whiteColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString: [self createTextAttribute:message.text color:[UIColor whiteColor] font:kRoomMessageDefalutFont]];
if ([[message.localExt objectForKey:@"isRoomTopic"] boolValue] == YES) {
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
@@ -196,15 +204,18 @@
[TTPopup popupWithConfig:config];
}];
}
return attribute;
messageInfo.content = attribute;
} else {
return [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
NSAttributedString * attribute = [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
messageInfo.content = attribute;
}
return messageInfo;
}
///
/// @param message
- (NSAttributedString*)makeNotificationAttribute:(NIMMessage *)message {
- (XPMessageInfoModel*)makeNotificationAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
messageInfo.bubbleImageUrl = [self parseMessageBubble:message];
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
NIMChatroomNotificationMember *member = content.targets[0];
@@ -256,14 +267,16 @@
}
}
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
break;
case NIMChatroomEventTypeInfoUpdated:{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if (self.hostDelegate.getRoomInfo.datingState == RoomDatingStateChangeType_Open) {
[attribute appendAttributedString:[self createTextAttribute:@"相亲玩法已开启,请点击主持人麦位选择主持人" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
}
break;
@@ -273,8 +286,32 @@
return nil;
}
#pragma mark -
- (XPMessageInfoModel *)createWishGiftAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
UIImageView *imaveView = [[UIImageView alloc]init];
imaveView.image = [UIImage imageNamed:@"room_wish_gift_mesage_finish"];
imaveView.bounds = CGRectMake(0, 0, 170, 34);
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imaveView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imaveView.frame.size.width, imaveView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
@kWeakify(self);
[attrString yy_setTextHighlightRange:NSMakeRange(0, attrString.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
@kStrongify(self);
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self.hostDelegate getRoomInfo].uid];
[Api wishGiftSendCelebrate:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
} roomUid:roomUid];
}];
messageInfo.contentLeftMargin = 0;
messageInfo.contentRightMargin = 0;
messageInfo.contentTopMargin = 0;
messageInfo.contentBottomMargin = 0;
messageInfo.isUpdateContentFrame = YES;
messageInfo.isHiddenBubble = YES;
messageInfo.content = attrString;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createRedPacketAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createRedPacketAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
XPOpenRedPacketModel *info = [XPOpenRedPacketModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createNickAtrribute:info.openRedEnvelopeUserNick uid:info.openRedEnvelopeId.integerValue]];
@@ -284,11 +321,12 @@
if (info.amount.floatValue>0) {
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@钻石", info.amount] color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createRoomSailingAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createRoomSailingAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
RoomSailingPrizeModel *info = [RoomSailingPrizeModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:@"厉害了! " color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -299,11 +337,12 @@
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"x%d", info.prizeNum] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createRoomGiftCompoundAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createRoomGiftCompoundAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
XPGiftCompoundModel *info = [XPGiftCompoundModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -311,11 +350,12 @@
[attribute appendAttributedString:[self createTextAttribute:info.msg color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:info.giftName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:info.uid.integerValue];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createRoomLuckyBigPrizeAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createRoomLuckyBigPrizeAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
XPGiftBigPrizeModel * info= [XPGiftBigPrizeModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -324,11 +364,12 @@
[attribute appendAttributedString:[self createTextAttribute:info.roomTitle color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"通过%@", info.luckyBagName] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@",开出%@", info.giftName] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark - PK
- (NSAttributedString *)createRoomPKAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createRoomPKAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if (attachment.second == Custom_Message_Sub_Room_PK_Manager_Up_Mic) {
[attribute appendAttributedString:[self createTextAttribute:@"房主/管理员邀请" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -453,7 +494,8 @@
[attribute appendAttributedString:[self createTextAttribute:title color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
- (void)showRoomPKResult:(NSDictionary *)dic {
@@ -466,7 +508,7 @@
}
#pragma mark -
- (NSAttributedString*)createRoomFaceAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel*)createRoomFaceAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) {
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
@@ -490,11 +532,12 @@
}
}
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString*)createCollectRoomAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel*)createCollectRoomAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSDictionary *data = attachment.data[@"data"];
NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
@@ -504,11 +547,12 @@
tipString = @"收藏了房间";
}
[attribute appendAttributedString:[self createTextAttribute:tipString color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString*)createRoomInfoUpdateAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel*)createRoomInfoUpdateAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
if (attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) {
NSDictionary * dic= attachment.data[@"roomInfo"];
if (dic.allKeys.count <=0) {
@@ -522,7 +566,7 @@
} else {
[attribute appendAttributedString:[self createTextAttribute:@"管理员已开启聊天公屏" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
return attribute;
messageInfo.content = attribute;
} else if(attachment.second == Custom_Message_Sub_Update_RoomInfo_AnimateEffect) {
NSDictionary * dic = attachment.data[@"roomInfo"];
if (dic.allKeys.count <=0) {
@@ -538,7 +582,7 @@
[attribute appendAttributedString:[self createImageAttribute:[UIImage imageNamed:@"room_menu_more"]]];
[attribute appendAttributedString:[self createTextAttribute:@"图标即可开启" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
return attribute;
messageInfo.content = attribute;
} else if (attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
NSNumber *roleType = attachment.data[@"roleType"];
NSString *nick = attachment.data[@"nick"];
@@ -559,13 +603,13 @@
}
[attribute appendAttributedString:[self createTextAttribute:@"已清空房间公屏消息" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:uid];
return attribute;
messageInfo.content = attribute;
}
return nil;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createRoomDatingAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createRoomDatingAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if(attachment.second == Custom_Message_Sub_Room_Play_Dating_Pick_Heart) {
DatingInfoModel * datingModel = [DatingInfoModel modelWithDictionary:attachment.data];
@@ -598,11 +642,12 @@
[attribute appendAttributedString:[self createTextAttribute:@"未选择心动对象" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createArrangeMicAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createArrangeMicAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:@"管理员" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
if (attachment.second == Custom_Message_Sub_Arrange_Mic_Mode_Open) {
@@ -622,11 +667,12 @@
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%d麦", ((NSNumber *)dic[@"micPos"]).intValue + 1 ] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:@"自由麦" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
//action
[attribute appendAttributedString:[self createTextAttribute:@"厉害了 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
@@ -643,11 +689,12 @@
}
[self attributeAddHihtLight:attribute uid:giftInfo.uid.integerValue];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createNobleLevelAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createNobleLevelAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSInteger uid = 0;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
@@ -669,11 +716,12 @@
[attribute appendAttributedString:[self createTextAttribute:@"" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
[self attributeAddHihtLight:attribute uid:uid];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createTarotAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createTarotAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if (attachment.second == Custom_Message_Sub_Tarot) {
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
@@ -685,11 +733,12 @@
}
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@ ", attachment.data[@"chargeProdName"]] color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createAnchorFansTeamAttribute:(AttachmentModel *)attachment {
- (XPMessageInfoModel *)createAnchorFansTeamAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSInteger uid = 0;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
@@ -715,11 +764,12 @@
[attribute appendAttributedString:[self createTextAttribute:@"已退出粉丝团" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
}
[self attributeAddHihtLight:attribute uid:uid];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark - //
- (NSAttributedString *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info {
- (XPMessageInfoModel *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createNickAtrribute:info.targetNick uid:info.targetUid]];
[attribute appendAttributedString:[self createTextAttribute:@"被" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
@@ -733,12 +783,13 @@
content = @"请下麦";
}
[attribute appendAttributedString:[self createTextAttribute:content color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createShareOrAttentionRoomAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo uid:(NSString *)uid {
- (XPMessageInfoModel *)createShareOrAttentionRoomAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo uid:(NSString *)uid messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSDictionary *data = attachment.data[@"data"];
NSString *nick = [NSString stringWithFormat:@"%@",data[@"nick"]];
@@ -751,11 +802,12 @@
}
[attribute appendAttributedString:[self createTextAttribute:tipString color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:uid.integerValue];
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark -
- (NSAttributedString *)createBatchMicroSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo {
- (XPMessageInfoModel *)createBatchMicroSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data];
GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift;
@@ -845,10 +897,11 @@
}];
}
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
- (NSAttributedString *)createSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo {
- (XPMessageInfoModel *)createSendGiftAttribute:(AttachmentModel *)attachment sendInfo:(XPMessageRemoteExtModel *)sendInfo messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data];
GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift;
@@ -904,7 +957,8 @@
//x N
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X%ld",info.giftNum] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
return attribute;
messageInfo.content = attribute;
return messageInfo;
}
#pragma mark - Commond Mehotd