|
|
|
@@ -410,32 +410,19 @@
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
- (XPMessageInfoModel *)createStarredKitchenAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
|
|
|
|
XPRoomStarKitchenModel * giftInfo = [XPRoomStarKitchenModel modelWithDictionary:attachment.data];
|
|
|
|
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
|
|
|
|
CGFloat fontSize = 13;
|
|
|
|
|
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser14") color:[UIColor whiteColor] font:fontSize]];
|
|
|
|
|
NSString * nick = giftInfo.nick;
|
|
|
|
|
if (nick.length > 6) {
|
|
|
|
|
nick = [nick substringToIndex:6];
|
|
|
|
|
}
|
|
|
|
|
[attribute appendAttributedString:[self createTextAttribute:nick color:[DJDKMIMOMColor colorWithHexString:@"#FEF23E"] font:fontSize]];
|
|
|
|
|
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser112") color:[UIColor whiteColor] font:fontSize]];
|
|
|
|
|
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@", giftInfo.diamonds] color:[DJDKMIMOMColor colorWithHexString:@"#00EAFF"] font:fontSize]];
|
|
|
|
|
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser113") color:[UIColor whiteColor] font:fontSize]];
|
|
|
|
|
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
|
|
|
|
|
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
|
|
|
|
|
paragraphStyle.lineSpacing = 4.0f;//行间距
|
|
|
|
|
paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
|
|
|
|
|
[attribute addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attribute.length)];
|
|
|
|
|
@kWeakify(self);
|
|
|
|
|
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
|
|
|
|
XPRoomStarKitchenModel *starModel = [XPRoomStarKitchenModel modelWithDictionary:attachment.data];
|
|
|
|
|
NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser1033333"),starModel.nick,starModel.itemMultiple,starModel.diamonds];
|
|
|
|
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageDefaultTextColor]}];
|
|
|
|
|
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor]} range:[title rangeOfString:starModel.nick]];
|
|
|
|
|
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor]} range:[title rangeOfString:[NSString stringWithFormat:@" %@",starModel.itemMultiple]]];
|
|
|
|
|
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor]} range:[title rangeOfString:[NSString stringWithFormat:@" %@",starModel.diamonds]]];
|
|
|
|
|
@kWeakify(self)
|
|
|
|
|
[attribute yy_setTextHighlightRange:[title rangeOfString:starModel.nick] color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
|
|
|
|
@kStrongify(self);
|
|
|
|
|
if (giftInfo &&giftInfo.needLevel < self.hostDelegate.getUserInfo.userLevelVo.experLevelSeq && giftInfo.skipUrl.length > 0) {
|
|
|
|
|
XPWebViewController * webVC = [[XPWebViewController alloc] init];
|
|
|
|
|
webVC.url = giftInfo.skipUrl;
|
|
|
|
|
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
|
|
|
|
|
}
|
|
|
|
|
if (starModel.uid.integerValue <= 0) {return;}
|
|
|
|
|
[self showUserCard:starModel.uid.integerValue];
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
messageInfo.content = attribute;
|
|
|
|
|
return messageInfo;
|
|
|
|
|
}
|
|
|
|
|