进房欢迎TA

This commit is contained in:
chenshuanglin
2023-03-17 17:00:45 +08:00
parent b64d9bd851
commit 5219165ac3
6 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_enter_greeting@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_enter_greeting@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -201,6 +201,12 @@ NS_ASSUME_NONNULL_BEGIN
/// @param roomUid 房间Uid
+ (void)requestRedPacket:(HttpRequestHelperCompletion)completion uid:(NSString *)roomUid;
/// 获取欢迎Ta信息
/// @param completion 完成
/// @param uid 用户Uid
/// @param toUid 目标用户Uid
+ (void)requestMsgGetone:(HttpRequestHelperCompletion)completion uid:(NSString *)uid toUid:(NSString *)toUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -241,4 +241,12 @@
[self makeRequest:@"room/red-envelop" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
}
/// Ta
/// @param completion
/// @param uid Uid
/// @param toUid Uid
+ (void)requestMsgGetone:(HttpRequestHelperCompletion)completion uid:(NSString *)uid toUid:(NSString *)toUid {
[self makeRequest:@"welcome/room/msg/getOne" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, uid, toUid, nil];
}
@end

View File

@@ -20,6 +20,7 @@
#import "Api+WishGift.h"
#import "NSArray+Safe.h"
#import "UIView+Corner.h"
#import "Api+Room.h"
///Model
#import "XPMessageRemoteExtModel.h"
#import "AttachmentModel.h"
@@ -275,6 +276,51 @@
}
}
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString *uid = [AccountInfoStorage instance].getUid;
NSString *toUid = member.userId;
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
///TA
if (roomInfo.uid == [uid integerValue] && ![uid isEqualToString:toUid]) {
NSAttributedString *welcome = [self createLocalImageAttribute:@"room_enter_greeting"];
[attribute appendAttributedString:welcome];
[attribute yy_setTextHighlightRange:NSMakeRange(attribute.length-welcome.length, welcome.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
///
[Api requestMsgGetone:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSDictionary *dataDcit = data.data;
NSString *msg = dataDcit[@"msg"];
if (msg.length > 0) {
///
UserInfoModel * userInfo = [self.hostDelegate getUserInfo];
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.androidBubbleUrl = userInfo.androidBubbleUrl;
extModel.iosBubbleUrl = userInfo.iosBubbleUrl;
extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel;
NIMMessage * message = [[NIMMessage alloc] init];
message.text = msg;
NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[AccountInfoStorage instance].getUid];
message.remoteExt = remoteExt;
NSString *sessionId = [NSString stringWithFormat:@"%ld", [self.hostDelegate getRoomInfo].roomId];
//
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) {
}];
}
}
} uid:uid toUid:toUid];
}];
}
messageInfo.content = attribute;
return messageInfo;
}