新用户进入房间自动打招呼

This commit is contained in:
fengshuo
2022-06-07 16:16:27 +08:00
parent f3778b4c63
commit e74ac4c211
20 changed files with 195 additions and 59 deletions

View File

@@ -118,12 +118,14 @@
if ([message.from isEqualToString:uid]) {
nick = @"我:";
}
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
///
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:model.defUser newUser:model.newUser fromSayHelloChannel:model.fromSayHelloChannel]];
if ([self isCurrentRoomSuperAdmin:message.from]) {
[attribute appendAttributedString:[self createLocalImageAttribute:@"common_super_admin"]];
}
///
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:model.defUser newUser:model.newUser]];
if (model.vipIcon) {//icon
[attribute appendAttributedString:[self createUrlImageAttribute:model.vipIcon]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
@@ -202,6 +204,9 @@
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
NSDictionary * dic = [(NSDictionary *)messageExt.roomExt.toJSONObject objectForKey:message.from];
XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithDictionary:dic];
///
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:extModel.defUser newUser:extModel.newUser fromSayHelloChannel:extModel.fromSayHelloChannel]];
if ([self isCurrentRoomSuperAdmin:message.from]) {
[attribute appendAttributedString:[self createLocalImageAttribute:@"common_super_admin"]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
@@ -229,7 +234,7 @@
if (extModel.fromType > 0) {
if (extModel.fromType == UserEnterRoomFromType_Home_Recommend) {
[attribute appendAttributedString:[self createTextAttribute:@"根据首页推荐" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
} else if(extModel.fromType == UserEnterRoomFromType_Follow_User) {
} else if(extModel.fromType == UserEnterRoomFromType_Follow_User || extModel.fromType == UserEnterRoomFromType_New_User_Greet) {
[attribute appendAttributedString:[self createTextAttribute:@"跟随" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createNickAtrribute:extModel.fromNick uid:extModel.fromUid.integerValue]];
} else if(extModel.fromType == UserEnterRoomFromType_Follow_Game_Detail) {
@@ -685,7 +690,7 @@
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:info.giftId];
}
///
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:sendInfo.defUser newUser:sendInfo.newUser]];
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:sendInfo.defUser newUser:sendInfo.newUser fromSayHelloChannel:sendInfo.fromSayHelloChannel]];
//nick
[attribute appendAttributedString:[self createNickAtrribute:info.nick uid:info.uid.integerValue]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
@@ -778,7 +783,7 @@
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:info.giftId];
}
///
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:sendInfo.defUser newUser:sendInfo.newUser]];
[attribute appendAttributedString:[self createOfficalAndNewuserAttribute:sendInfo.defUser newUser:sendInfo.newUser fromSayHelloChannel:sendInfo.fromSayHelloChannel]];
//nick
[attribute appendAttributedString:[self createNickAtrribute:info.nick uid:info.uid.integerValue]];
[attribute appendAttributedString:[self createSapceAttribute:2]];;
@@ -840,7 +845,7 @@
return NO;
}
- (NSAttributedString *)createOfficalAndNewuserAttribute:(UserLevelType)levelType newUser:(BOOL)newUser {
- (NSAttributedString *)createOfficalAndNewuserAttribute:(UserLevelType)levelType newUser:(BOOL)newUser fromSayHelloChannel:(BOOL)fromSayHelloChannel{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
//offical
if (levelType == UserLevelType_Offical) {
@@ -848,8 +853,13 @@
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
if (newUser) {
[attribute appendAttributedString: [self createLocalImageAttribute:@"common_new_user"]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
if (fromSayHelloChannel) {
[attribute appendAttributedString:[self createLocalImageAttribute:@"room_new_user_greet_new"]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
} else {
[attribute appendAttributedString: [self createLocalImageAttribute:@"common_new_user"]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
}
return attribute;
}