修复适配bug

This commit is contained in:
liyuhua
2024-04-19 17:26:43 +08:00
parent c638ebbc02
commit d5f595777b
8 changed files with 83 additions and 63 deletions

View File

@@ -590,13 +590,12 @@
#pragma mark -
- (XPMessageInfoModel *)createRoomLuckyBigPrizeAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
XPGiftBigPrizeModel * info= [XPGiftBigPrizeModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser15") color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:info.nick color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser16") color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:info.roomTitle color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser17"), info.luckyBagName] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser18" ), info.giftName] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString *text = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser15"),info.nick,info.luckyBagName,info.roomTitle,info.giftName];
if (isMSZH()){
text = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser15"),info.nick,info.roomTitle,info.luckyBagName,info.giftName];
}
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor],NSParagraphStyleAttributeName:[self paragraphStyle]}];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor]} range:[text rangeOfString:info.nick]];
messageInfo.content = attribute;
return messageInfo;
}
@@ -906,15 +905,18 @@
#pragma mark -
- (XPMessageInfoModel *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
CandyTreeGiftInfoModel * giftInfo = [CandyTreeGiftInfoModel modelWithDictionary:attachment.data];
//action
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser77") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
CandyTreeGiftInfoModel * giftInfo = [CandyTreeGiftInfoModel modelWithDictionary:attachment.data];
[attribute appendAttributedString:[self createTextAttribute:giftInfo.nick color:[DJDKMIMOMColor messageNickColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser78") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:giftInfo.prizeName color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString *text = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser77"),giftInfo.nick,giftInfo.prizeName,[NSString stringWithFormat:@" X %d", giftInfo.prizeNum]];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithAttributedString:[self createTextAttribute:text color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSParagraphStyleAttributeName:[self paragraphStyle]} range:[text rangeOfString:giftInfo.nick]];
[attribute addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor],NSParagraphStyleAttributeName:[self paragraphStyle]} range:[text rangeOfString:giftInfo.prizeName]];
if (giftInfo.prizeNum > 1) {
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X %d", giftInfo.prizeNum] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute addAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor],NSParagraphStyleAttributeName:[self paragraphStyle]} range:[text rangeOfString:[NSString stringWithFormat:@" X %d", giftInfo.prizeNum]]];
}
if (attachment.second == Custom_Message_Sub_Candy_Tree_Me && giftInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) {