欢迎消息
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
14C1F15A29B876EC000A960F /* XPMineMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15929B876EC000A960F /* XPMineMoreItemModel.m */; };
|
14C1F15A29B876EC000A960F /* XPMineMoreItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15929B876EC000A960F /* XPMineMoreItemModel.m */; };
|
||||||
14C1F15D29B88DEE000A960F /* XPMessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15C29B88DEE000A960F /* XPMessageViewController.m */; };
|
14C1F15D29B88DEE000A960F /* XPMessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C1F15C29B88DEE000A960F /* XPMessageViewController.m */; };
|
||||||
14E9019829CC2C4700B57C22 /* starred_kitchen_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 14E9019729CC2C4600B57C22 /* starred_kitchen_bg.svga */; };
|
14E9019829CC2C4700B57C22 /* starred_kitchen_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 14E9019729CC2C4600B57C22 /* starred_kitchen_bg.svga */; };
|
||||||
|
14E9019B29CC546000B57C22 /* XPRoomWelcomeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 14E9019A29CC546000B57C22 /* XPRoomWelcomeModel.m */; };
|
||||||
14EDBBAA29B5935F001D3E16 /* XPFindNewFriendViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EDBBA929B5935F001D3E16 /* XPFindNewFriendViewController.m */; };
|
14EDBBAA29B5935F001D3E16 /* XPFindNewFriendViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EDBBA929B5935F001D3E16 /* XPFindNewFriendViewController.m */; };
|
||||||
14EDBBB329B5F7B2001D3E16 /* XPButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EDBBB229B5F7B2001D3E16 /* XPButton.m */; };
|
14EDBBB329B5F7B2001D3E16 /* XPButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EDBBB229B5F7B2001D3E16 /* XPButton.m */; };
|
||||||
14EDBBB629B600DC001D3E16 /* XPNewMomentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EDBBB529B600DC001D3E16 /* XPNewMomentsViewController.m */; };
|
14EDBBB629B600DC001D3E16 /* XPNewMomentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 14EDBBB529B600DC001D3E16 /* XPNewMomentsViewController.m */; };
|
||||||
@@ -1349,6 +1350,8 @@
|
|||||||
14C1F15B29B88DEE000A960F /* XPMessageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMessageViewController.h; sourceTree = "<group>"; };
|
14C1F15B29B88DEE000A960F /* XPMessageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMessageViewController.h; sourceTree = "<group>"; };
|
||||||
14C1F15C29B88DEE000A960F /* XPMessageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMessageViewController.m; sourceTree = "<group>"; };
|
14C1F15C29B88DEE000A960F /* XPMessageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMessageViewController.m; sourceTree = "<group>"; };
|
||||||
14E9019729CC2C4600B57C22 /* starred_kitchen_bg.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = starred_kitchen_bg.svga; sourceTree = "<group>"; };
|
14E9019729CC2C4600B57C22 /* starred_kitchen_bg.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = starred_kitchen_bg.svga; sourceTree = "<group>"; };
|
||||||
|
14E9019929CC546000B57C22 /* XPRoomWelcomeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomWelcomeModel.h; sourceTree = "<group>"; };
|
||||||
|
14E9019A29CC546000B57C22 /* XPRoomWelcomeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomWelcomeModel.m; sourceTree = "<group>"; };
|
||||||
14EDBBA829B5935F001D3E16 /* XPFindNewFriendViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFindNewFriendViewController.h; sourceTree = "<group>"; };
|
14EDBBA829B5935F001D3E16 /* XPFindNewFriendViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPFindNewFriendViewController.h; sourceTree = "<group>"; };
|
||||||
14EDBBA929B5935F001D3E16 /* XPFindNewFriendViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFindNewFriendViewController.m; sourceTree = "<group>"; };
|
14EDBBA929B5935F001D3E16 /* XPFindNewFriendViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPFindNewFriendViewController.m; sourceTree = "<group>"; };
|
||||||
14EDBBB129B5F7B2001D3E16 /* XPButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPButton.h; sourceTree = "<group>"; };
|
14EDBBB129B5F7B2001D3E16 /* XPButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPButton.h; sourceTree = "<group>"; };
|
||||||
@@ -6795,6 +6798,8 @@
|
|||||||
E87A24F0272935920086A794 /* XPMessageRemoteExtModel.m */,
|
E87A24F0272935920086A794 /* XPMessageRemoteExtModel.m */,
|
||||||
E8398069290288660084BFC8 /* XPMessageInfoModel.h */,
|
E8398069290288660084BFC8 /* XPMessageInfoModel.h */,
|
||||||
E839806A290288660084BFC8 /* XPMessageInfoModel.m */,
|
E839806A290288660084BFC8 /* XPMessageInfoModel.m */,
|
||||||
|
14E9019929CC546000B57C22 /* XPRoomWelcomeModel.h */,
|
||||||
|
14E9019A29CC546000B57C22 /* XPRoomWelcomeModel.m */,
|
||||||
);
|
);
|
||||||
path = Model;
|
path = Model;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -10625,6 +10630,7 @@
|
|||||||
9B73CD09279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m in Sources */,
|
9B73CD09279A9AA2006AF255 /* XPSkillCardUpdatePropModel.m in Sources */,
|
||||||
E874B88827215D39003954B9 /* MicroStateModel.m in Sources */,
|
E874B88827215D39003954B9 /* MicroStateModel.m in Sources */,
|
||||||
E877A7F427842EF800EFACED /* XPRoomDatingVipUpMicView.m in Sources */,
|
E877A7F427842EF800EFACED /* XPRoomDatingVipUpMicView.m in Sources */,
|
||||||
|
14E9019B29CC546000B57C22 /* XPRoomWelcomeModel.m in Sources */,
|
||||||
E896EF9F2771AE7B00AD2CC1 /* XPMineAttentionViewController.m in Sources */,
|
E896EF9F2771AE7B00AD2CC1 /* XPMineAttentionViewController.m in Sources */,
|
||||||
9B2A12E127845DD300CED41B /* XPNobleCenterMyNobleView.m in Sources */,
|
9B2A12E127845DD300CED41B /* XPNobleCenterMyNobleView.m in Sources */,
|
||||||
E89D60C1271D64B9001F8895 /* RoomInfoModel.m in Sources */,
|
E89D60C1271D64B9001F8895 /* RoomInfoModel.m in Sources */,
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// XPRoomWelcomeModel.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by XY on 2023/3/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface XPRoomWelcomeModel : NSObject
|
||||||
|
|
||||||
|
///用户ID
|
||||||
|
@property (nonatomic,copy) NSString *targetUid;
|
||||||
|
///用户昵称
|
||||||
|
@property (nonatomic, copy) NSString *targetNick;
|
||||||
|
///内容
|
||||||
|
@property (nonatomic, copy) NSString *content;
|
||||||
|
///是不是粉丝
|
||||||
|
@property (nonatomic, assign) BOOL isFans;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// XPRoomWelcomeModel.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by XY on 2023/3/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "XPRoomWelcomeModel.h"
|
||||||
|
|
||||||
|
@implementation XPRoomWelcomeModel
|
||||||
|
|
||||||
|
@end
|
@@ -22,6 +22,7 @@
|
|||||||
#import "UIView+Corner.h"
|
#import "UIView+Corner.h"
|
||||||
#import "Api+Room.h"
|
#import "Api+Room.h"
|
||||||
#import "XCCurrentVCStackManager.h"
|
#import "XCCurrentVCStackManager.h"
|
||||||
|
#import "Api+UserCard.h"
|
||||||
///Model
|
///Model
|
||||||
#import "XPMessageRemoteExtModel.h"
|
#import "XPMessageRemoteExtModel.h"
|
||||||
#import "AttachmentModel.h"
|
#import "AttachmentModel.h"
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
#import "XPMessageInfoModel.h"
|
#import "XPMessageInfoModel.h"
|
||||||
#import "XPStarredKitchenModel.h"
|
#import "XPStarredKitchenModel.h"
|
||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
|
#import "XPRoomWelcomeModel.h"
|
||||||
|
|
||||||
#import "XPUserCardViewController.h"
|
#import "XPUserCardViewController.h"
|
||||||
#import "XPRoomTopicAlertView.h"
|
#import "XPRoomTopicAlertView.h"
|
||||||
@@ -131,7 +133,7 @@
|
|||||||
} else if (first == CustomMessageType_Starred_Kitchen) {
|
} else if (first == CustomMessageType_Starred_Kitchen) {
|
||||||
return [self createStarredKitchenAttribute:attachment messageInfo:messageInfo];
|
return [self createStarredKitchenAttribute:attachment messageInfo:messageInfo];
|
||||||
} else if (first == CustomMessageType_Room_Welcome && attachment.second == Custom_Message_Sub_Room_Welcome) {
|
} else if (first == CustomMessageType_Room_Welcome && attachment.second == Custom_Message_Sub_Room_Welcome) {
|
||||||
return [self createWelcomeAttribute:attachment messageInfo:messageInfo];
|
return [self createWelcomeAttribute:message messageInfo:messageInfo];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -296,22 +298,53 @@
|
|||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
NSDictionary *dataDcit = data.data;
|
NSDictionary *dataDcit = data.data;
|
||||||
NSString *msg = dataDcit[@"msg"];
|
NSString *msg = dataDcit[@"msg"];
|
||||||
|
|
||||||
|
UserInfoModel *userInfo = [self.hostDelegate getUserInfo];
|
||||||
|
//设置ext
|
||||||
|
XPMessageRemoteExtModel * extModel = [[XPMessageRemoteExtModel alloc] init];
|
||||||
|
extModel.defUser = userInfo.defUser;
|
||||||
|
extModel.erbanNo = userInfo.erbanNo;
|
||||||
|
extModel.carName = userInfo.carName;
|
||||||
|
extModel.inRoomNameplatePic = userInfo.nameplatePic;
|
||||||
|
extModel.inRoomNameplateWord = userInfo.nameplateWord;
|
||||||
|
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
|
||||||
|
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
|
||||||
|
extModel.experUrl = userInfo.userLevelVo.experUrl;
|
||||||
|
extModel.newUser = userInfo.newUser;
|
||||||
|
extModel.vipIcon = userInfo.userVipInfoVO.vipIcon;
|
||||||
|
extModel.fromUid = userInfo.fromUid;
|
||||||
|
extModel.fromType = userInfo.fromType;
|
||||||
|
extModel.fromNick = userInfo.fromNick;
|
||||||
|
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
|
||||||
|
extModel.androidBubbleUrl = userInfo.androidBubbleUrl;
|
||||||
|
extModel.enterHide = userInfo.userVipInfoVO.enterHide;
|
||||||
|
extModel.preventKick = userInfo.userVipInfoVO.preventKick;
|
||||||
|
extModel.enterRoomEffects = userInfo.userVipInfoVO.enterRoomEffects;
|
||||||
|
extModel.gender = userInfo.gender;
|
||||||
|
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
|
||||||
|
extModel.platformRole = userInfo.platformRole;
|
||||||
|
|
||||||
|
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
|
||||||
|
|
||||||
/// 发动欢迎消息
|
/// 发动欢迎消息
|
||||||
AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
||||||
attachment.first = CustomMessageType_Room_Welcome;
|
attachment.first = CustomMessageType_Room_Welcome;
|
||||||
attachment.second = Custom_Message_Sub_Room_Welcome;
|
attachment.second = Custom_Message_Sub_Room_Welcome;
|
||||||
NSDictionary * dic = @{@"targetUid": toUid,
|
|
||||||
@"targetNick": nick,
|
XPRoomWelcomeModel *welcomeModel = [[XPRoomWelcomeModel alloc] init];
|
||||||
@"content":msg ? msg : @"",
|
welcomeModel.targetUid = toUid;
|
||||||
@"isFans":dataDcit[@"isFans"]
|
welcomeModel.targetNick = nick;
|
||||||
};
|
welcomeModel.content = msg ? msg : @"";
|
||||||
|
welcomeModel.isFans = dataDcit[@"isFans"];
|
||||||
|
NSDictionary *dic = [welcomeModel model2dictionary];
|
||||||
attachment.data = dic;
|
attachment.data = dic;
|
||||||
|
|
||||||
NIMMessage *message = [[NIMMessage alloc]init];
|
NIMMessage *message = [[NIMMessage alloc]init];
|
||||||
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
||||||
object.attachment = attachment;
|
object.attachment = attachment;
|
||||||
message.messageObject = object;
|
message.messageObject = object;
|
||||||
message.text = msg;
|
message.remoteExt = ext;
|
||||||
|
message.text = [NSString stringWithFormat:@"欢迎%@",nick];
|
||||||
|
|
||||||
NSString *sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
NSString *sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||||
//构造会话
|
//构造会话
|
||||||
@@ -400,12 +433,78 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 欢迎Ta
|
#pragma mark - 欢迎Ta
|
||||||
- (XPMessageInfoModel *)createWelcomeAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
//- (XPMessageInfoModel *)createWelcomeAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
NSString *nickName = attachment.data[@"targetNick"];
|
// NSString *nickName = attachment.data[@"targetNick"];
|
||||||
NSString *uid = attachment.data[@"targetUid"];
|
// 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;
|
||||||
|
//}
|
||||||
|
|
||||||
|
- (XPMessageInfoModel *)createWelcomeAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{
|
||||||
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
messageInfo.isShowAvatar = YES;
|
||||||
|
messageInfo.uid = message.from;
|
||||||
|
NIMUser * user = [[NIMSDK sharedSDK].userManager userInfo:message.from];
|
||||||
|
if (user) {
|
||||||
|
|
||||||
|
messageInfo.avatarUrl = user.userInfo.avatarUrl.length > 0 ? user.userInfo.avatarUrl : user.userInfo.thumbAvatarUrl;
|
||||||
|
}
|
||||||
|
if (messageInfo.avatarUrl.length <= 0) {
|
||||||
|
NIMMessageChatroomExtension * ext = message.messageExt;
|
||||||
|
messageInfo.avatarUrl = ext.roomAvatar;
|
||||||
|
}
|
||||||
|
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 = @"我:";
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:@"欢迎" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
if (model.vipIcon) {//贵族icon
|
||||||
[attribute appendAttributedString:[self createNickAtrribute:nickName ? nickName : @"" uid:uid.integerValue]];
|
[attribute appendAttributedString:[self createUrlImageAttribute:model.vipIcon]];
|
||||||
|
[attribute appendAttributedString:[self createSapceAttribute:2]];
|
||||||
|
}
|
||||||
|
[attribute appendAttributedString:[self createTextAttribute:nick color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||||
|
[attribute appendAttributedString:[self createTextAttribute:@"\n" color:[UIColor clearColor] font:kRoomMessageDefalutFont]];
|
||||||
|
|
||||||
|
///官方新用户
|
||||||
|
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:model.defUser newUser:model.newUser fromSayHelloChannel:model.fromSayHelloChannel]];
|
||||||
|
if ([self isCurrentRoomSuperAdmin:message.from]) {
|
||||||
|
[attribute appendAttributedString:[self createLocalImageAttribute:@"common_super_admin"]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.experUrl) {
|
||||||
|
[attribute appendAttributedString:[self createUrlImageAttribute:model.experUrl]];
|
||||||
|
[attribute appendAttributedString:[self createSapceAttribute:2]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.charmUrl) {
|
||||||
|
[attribute appendAttributedString:[self createUrlImageAttribute:model.charmUrl]];
|
||||||
|
[attribute appendAttributedString:[self createSapceAttribute:2]];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.inRoomNameplatePic.length > 0 && model.inRoomNameplateWord.length > 0) { //铭牌有图片加文字
|
||||||
|
[attribute appendAttributedString:[self createNameplateAttibute:model.inRoomNameplateWord image:model.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]];
|
||||||
|
[attribute appendAttributedString:[self createSapceAttribute:2]];
|
||||||
|
} else if (model.inRoomNameplatePic.length > 0) {//铭牌只有图片
|
||||||
|
[attribute appendAttributedString:[self createUrlImageAttribute:model.inRoomNameplatePic]];
|
||||||
|
[attribute appendAttributedString:[self createSapceAttribute:2]];
|
||||||
|
}
|
||||||
|
[attribute appendAttributedString:[self createTextAttribute:@"\n" color:[UIColor clearColor] font:kRoomMessageDefalutFont]];
|
||||||
|
|
||||||
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||||
|
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||||
|
XPRoomWelcomeModel *welcomeModel = [XPRoomWelcomeModel modelWithDictionary:attachment.data];
|
||||||
|
|
||||||
|
NSMutableAttributedString *msgStr = [self createWelcomeUrlImageAttribute:model.iosBubbleUrl toNick:welcomeModel.targetNick toUid:welcomeModel.targetUid.integerValue isFans:welcomeModel.isFans];
|
||||||
|
[attribute appendAttributedString:msgStr];
|
||||||
|
|
||||||
|
[self attributeAddLongPressHihtLight:attribute uid:message.from nick:((NIMMessageChatroomExtension *)message.messageExt).roomNickname];
|
||||||
|
attribute.yy_lineSpacing = 5;
|
||||||
messageInfo.content = attribute;
|
messageInfo.content = attribute;
|
||||||
return messageInfo;
|
return messageInfo;
|
||||||
}
|
}
|
||||||
@@ -1244,6 +1343,67 @@
|
|||||||
return attrString;
|
return attrString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 生成一个背景的图片 和文字
|
||||||
|
/// @param imageUrl 网络图片的地址 如果地址为空 那就显示默认背景
|
||||||
|
- (NSMutableAttributedString *)createWelcomeUrlImageAttribute:(NSString *)imageUrl toNick:(NSString *)toNick toUid:(NSInteger)toUid isFans:(BOOL)isFans {
|
||||||
|
NetImageConfig *config = [[NetImageConfig alloc]init];
|
||||||
|
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageUrl config:config];
|
||||||
|
imageView.tag = 1000;
|
||||||
|
NSString *welcomeText = @"欢迎";
|
||||||
|
NSString * fullText = [NSString stringWithFormat:@"%@%@",welcomeText,toNick];
|
||||||
|
NSMutableAttributedString * msgStr = [[NSMutableAttributedString alloc] init];
|
||||||
|
[msgStr appendAttributedString:[self createTextAttribute:welcomeText color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
|
[msgStr appendAttributedString:[self createNickAtrribute:toNick uid:toUid]];
|
||||||
|
|
||||||
|
NSString *uid = [AccountInfoStorage instance].getUid;
|
||||||
|
if (toUid == uid.integerValue && isFans == NO) {
|
||||||
|
// NSAttributedString *attention = [self createImageAttribute:[UIImage imageNamed:@"room_enter_greeting"] height:18];
|
||||||
|
// [msgStr appendAttributedString:attention];
|
||||||
|
// /// 关注事件
|
||||||
|
// [msgStr yy_setTextHighlightRange:NSMakeRange(msgStr.length-attention.length, attention.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||||
|
// NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||||
|
// NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||||
|
// NSString * type = @"1";
|
||||||
|
// [Api attentionCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
|
// if (code == 200) {
|
||||||
|
// //TODO: 关注成功更新消息内容
|
||||||
|
// }
|
||||||
|
// } uid:uid likedUid:[NSString stringWithFormat:@"%ld",toUid] ticket:ticket type:type];
|
||||||
|
//
|
||||||
|
// }];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 铭牌文字
|
||||||
|
UILabel *label = [[UILabel alloc] init];
|
||||||
|
label.textAlignment = NSTextAlignmentLeft;
|
||||||
|
label.font = [UIFont boldSystemFontOfSize:kRoomMessageDefalutFont];
|
||||||
|
label.adjustsFontSizeToFitWidth = YES;
|
||||||
|
label.numberOfLines = 0;
|
||||||
|
label.textColor = UIColor.whiteColor;
|
||||||
|
label.attributedText = msgStr;
|
||||||
|
[imageView addSubview:label];
|
||||||
|
[label mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(10);
|
||||||
|
make.right.mas_equalTo(-19);
|
||||||
|
make.top.mas_equalTo(10);
|
||||||
|
}];
|
||||||
|
CGFloat imageWidth;
|
||||||
|
CGFloat imageHeight;
|
||||||
|
CGSize size = [fullText boundingRectWithSize:CGSizeMake(kRoomMessageMaxWidth - 10 - 19 - 15 - 34 - 7, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} context:nil].size;
|
||||||
|
imageWidth = size.width + 10 + 19 + 5;
|
||||||
|
imageHeight = size.height + 20;
|
||||||
|
imageView.layer.masksToBounds = YES;
|
||||||
|
imageView.frame = CGRectMake(0, 0, imageWidth, imageHeight);
|
||||||
|
if (imageUrl.length > 0) {
|
||||||
|
imageView.imageUrl = imageUrl;
|
||||||
|
}else {
|
||||||
|
[imageView setCornerWithLeftTopCorner:4 rightTopCorner:11 bottomLeftCorner:11 bottomRightCorner:11 size:CGSizeMake(imageWidth, imageHeight)];
|
||||||
|
imageView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.2];
|
||||||
|
}
|
||||||
|
NSMutableAttributedString * attrString = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:CGSizeMake(imageView.bounds.size.width, imageView.bounds.size.height) alignToFont:[UIFont systemFontOfSize:15.0] alignment:YYTextVerticalAlignmentCenter];
|
||||||
|
return attrString;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - tool
|
#pragma mark - tool
|
||||||
- (UIImage*)resizableImage:(UIImage *)image {
|
- (UIImage*)resizableImage:(UIImage *)image {
|
||||||
//图片拉伸区域
|
//图片拉伸区域
|
||||||
|
@@ -484,7 +484,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
}];
|
}];
|
||||||
return;
|
return;
|
||||||
} else if(attachment.first == CustomMessageType_Room_Welcome && attachment.second == Custom_Message_Sub_Room_Welcome) {
|
} else if(attachment.first == CustomMessageType_Room_Welcome && attachment.second == Custom_Message_Sub_Room_Welcome) {
|
||||||
// [self addRoomMessage:message];
|
[self addRoomMessage:message];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||||
|
Reference in New Issue
Block a user