表情公屏显示
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XPGiftStorage.h"
|
||||
#import "XPRoomFaceTool.h"
|
||||
///Model
|
||||
#import "XPMessageRemoteExtModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
@@ -25,6 +26,8 @@
|
||||
#import "MicroStateModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "DatingInfoModel.h"
|
||||
#import "RoomFaceInfoModel.h"
|
||||
#import "RoomFaceSendInfoModel.h"
|
||||
|
||||
#import "NetImageView.h"
|
||||
|
||||
@@ -79,7 +82,9 @@
|
||||
return [self createRoomDatingAttribute:attachment];
|
||||
} else if (first == CustomMessageType_Noble_VIP) {//贵族
|
||||
return [self createNobleLevelAttribute:attachment];
|
||||
}
|
||||
} else if (first == CustomMessageType_Face) {//贵族
|
||||
return [self createRoomFaceAttribute:attachment];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@@ -176,6 +181,34 @@
|
||||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark - 表情显示
|
||||
- (NSAttributedString*)createRoomFaceAttribute:(AttachmentModel *)attachment {
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) {
|
||||
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
|
||||
for (int i = 0; i< array.count; i++) {
|
||||
RoomFaceSendInfoModel * sendFaceInfo = [array objectAtIndex:i];
|
||||
[attribute appendAttributedString:[self createTextAttribute:sendFaceInfo.nick color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:@":" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:@"\n" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
for (int j = 0; j < sendFaceInfo.resultIndexes.count; j++) {
|
||||
NSNumber *index = sendFaceInfo.resultIndexes[j];
|
||||
UIImage *face = [[XPRoomFaceTool shareFaceTool] findFaceImageById:sendFaceInfo.faceId index:[index integerValue]];
|
||||
if (face) {
|
||||
UIImageView *imageView = [[UIImageView alloc]init];
|
||||
imageView.image = face;
|
||||
imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
imageView.bounds = CGRectMake(0, 0, 30, 30);
|
||||
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.frame.size.width, imageView.frame.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||
[attribute appendAttributedString:[self createSapceAttribute:1]];
|
||||
[attribute appendAttributedString:attrString];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return attribute;
|
||||
}
|
||||
|
||||
#pragma mark - 收藏房间
|
||||
- (NSAttributedString*)createCollectRoomAttribute:(AttachmentModel *)attachment {
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
|
@@ -34,23 +34,26 @@
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.bubbleView];
|
||||
[self.bubbleView addSubview:self.titleLabel];
|
||||
[self addSubview:self.titleLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
/// 设置绿色消息
|
||||
NSString *title = @"封面、背景及内容含低俗、引导、暴露等都会被屏蔽处理,泄露用户隐私、导流第三方平台、欺诈用户等将被封号处理。请珍惜自己的直播间哦!";
|
||||
self.titleLabel.text = title;
|
||||
CGFloat height = [self getHeaderViewHeight:title] + kRoomMessageTextSpaceHeight *2;
|
||||
self.frame = CGRectMake(0, 0, kRoomMessageMaxWidth, height);
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(kRoomMessageMaxWidth);
|
||||
make.height.mas_equalTo(height);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.bubbleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.mas_equalTo(self);
|
||||
make.bottom.mas_equalTo(self).offset(-10);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.bubbleView).inset(10);
|
||||
make.left.right.mas_equalTo(self).inset(10);
|
||||
make.centerY.mas_equalTo(self.bubbleView);
|
||||
}];
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "AttachmentModel.h"
|
||||
#import "RoomFaceSendInfoModel.h"
|
||||
///View
|
||||
#import "XPRoomMessageTableViewCell.h"
|
||||
#import "XPRoomMessageHeaderView.h"
|
||||
@@ -166,6 +167,17 @@
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_Face && attachment.second == Custom_Message_Sub_Face_Send) {
|
||||
if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) {
|
||||
NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]];
|
||||
for (int i = 0; i< array.count; i++) {
|
||||
RoomFaceSendInfoModel * sendInfo = [array objectAtIndex:i];
|
||||
if (sendInfo.resultIndexes.count <=0) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return [[[self supportMessageDic] objectForKey:@(attachment.first)] containsObject:@(attachment.second)];
|
||||
}
|
||||
return NO;
|
||||
@@ -235,6 +247,10 @@
|
||||
@(Custom_Message_Sub_Room_Noble_LevelUp),
|
||||
@(Custom_Message_Sub_AllRoom_Noble_LevelUp_Suspend),
|
||||
nil],
|
||||
@(CustomMessageType_Face):
|
||||
[NSSet setWithObjects:
|
||||
@(Custom_Message_Sub_Face_Send),
|
||||
nil],
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user