修复房主离开模式的bug
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
// 抱用户上麦控制器
|
||||
|
||||
#import "BaseViewController.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomInfoModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@@ -18,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,copy) NSString *roomId;
|
||||
///坑位信息
|
||||
@property (nonatomic,copy) NSString *position;
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -39,9 +39,18 @@
|
||||
@property (nonatomic,strong) NIMChatroomMember *lastMember;
|
||||
///临时成员最后一个
|
||||
@property (nonatomic,strong) NIMChatroomMember *tmpLastMember;
|
||||
@property (nonatomic, weak) id<RoomHostDelegate> hostDelegate;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomInviteUserViewController
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_hostDelegate = delegate;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
@@ -270,6 +279,7 @@
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
|
||||
XPRoomOnlineTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomOnlineTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPRoomOnlineTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomOnlineTableViewCell class])];
|
||||
@@ -299,7 +309,12 @@
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
NIMChatroomMember * member = [self.datasource safeObjectAtIndex1:indexPath.row];
|
||||
if (roomInfo.leaveMode && roomInfo.uid == member.userId.integerValue) {
|
||||
[XCHUDTool showErrorWithMessage:@"请先关闭离开模式"];
|
||||
return;
|
||||
}
|
||||
if ([AccountInfoStorage instance].getUid.integerValue == member.userId.integerValue) {
|
||||
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
|
@@ -370,6 +370,11 @@
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (roomInfo.leaveMode && roomInfo.uid == targetUid.integerValue) {
|
||||
[XCHUDTool showErrorWithMessage:@"请先关闭离开模式"];
|
||||
return;
|
||||
}
|
||||
|
||||
model.nick = self.hostDelegate.getUserInfo.nick;
|
||||
model.uid = targetUid;
|
||||
model.delegate = self.hostDelegate;
|
||||
|
@@ -182,7 +182,7 @@
|
||||
if (member.type == NIMTeamMemberTypeOwner) {
|
||||
// 抱Ta上麦
|
||||
TTActionSheetConfig *inviteMic = [TTActionSheetConfig normalTitle:@"抱Ta上麦" clickAction:^{
|
||||
XPRoomInviteUserViewController * inviteUserMicVC = [[XPRoomInviteUserViewController alloc] init];
|
||||
XPRoomInviteUserViewController * inviteUserMicVC = [[XPRoomInviteUserViewController alloc] initWithDelegate:self.hostDelegate];
|
||||
inviteUserMicVC.roomId = roomId;
|
||||
inviteUserMicVC.position = position;
|
||||
inviteUserMicVC.blindDateVipUid = roomInfo.blindDateVipUid;
|
||||
|
@@ -426,6 +426,12 @@
|
||||
self.sexImageView.hidden = NO;
|
||||
self.postionLabel.hidden = YES;
|
||||
self.sexImageView.image = [UIImage imageNamed:userInfo.gender == GenderType_Male ? @"common_male" : @"common_female"];
|
||||
[self.stackView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(10);
|
||||
make.width.mas_lessThanOrEqualTo(kGetScaleWidth(200));
|
||||
}];
|
||||
|
||||
}
|
||||
self.forbidKickView.hidden = !userInfo.preventKick;
|
||||
} else {
|
||||
|
@@ -783,45 +783,48 @@
|
||||
NSString* uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
NSString* roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
|
||||
// 1. 麦位上有人,弹窗用户资料卡
|
||||
NSString * targetUid;
|
||||
if (roomInfo.leaveMode && [position isEqualToString:@"-1"]) {
|
||||
targetUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
}
|
||||
if (micModel.userInfo && micModel.userInfo.uid > 0) {
|
||||
targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid];
|
||||
}
|
||||
|
||||
if (targetUid && targetUid.length > 0) {
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
model.uid = targetUid;
|
||||
model.position = position;
|
||||
model.posState = micModel.microState.posState;
|
||||
model.micState = micModel.microState.micState;
|
||||
model.nick = userInfo.nick;
|
||||
model.roomInfo = roomInfo;
|
||||
model.micQueue = self.micQueue;
|
||||
model.delegate = self.hostDelegate;
|
||||
model.superMangerList = self.hostDelegate.getRoomSuperAdminList;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_mike_click eventAttributes:@{@"actionType" : @"userCard"}];
|
||||
if (roomInfo.leaveMode && roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
[XCHUDTool showErrorWithMessage:@"请先关闭离开模式"];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 2. 空麦位,上麦逻辑
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
if (!member) return;
|
||||
if (roomInfo.leaveMode && (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager)) {
|
||||
if (!member)return;
|
||||
if (roomInfo.leaveMode && member.type == NIMTeamMemberTypeManager && [position isEqualToString:@"-1"]) {
|
||||
[XCHUDTool showErrorWithMessage:@"请先关闭离开模式"];
|
||||
return;
|
||||
}
|
||||
// 1. 麦位上有人,弹窗用户资料卡
|
||||
NSString * targetUid;
|
||||
if (roomInfo.leaveMode && [position isEqualToString:@"-1"]) {
|
||||
targetUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
}
|
||||
if (micModel.userInfo && micModel.userInfo.uid > 0) {
|
||||
targetUid = [NSString stringWithFormat:@"%ld", micModel.userInfo.uid];
|
||||
}
|
||||
if (targetUid && targetUid.length > 0) {
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
model.uid = targetUid;
|
||||
model.position = position;
|
||||
model.posState = micModel.microState.posState;
|
||||
model.micState = micModel.microState.micState;
|
||||
model.nick = userInfo.nick;
|
||||
model.roomInfo = roomInfo;
|
||||
model.micQueue = self.micQueue;
|
||||
model.delegate = self.hostDelegate;
|
||||
model.superMangerList = self.hostDelegate.getRoomSuperAdminList;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_mike_click eventAttributes:@{@"actionType" : @"userCard"}];
|
||||
return;
|
||||
}
|
||||
|
||||
void(^nimUpQueue)(NSString*, BOOL) = ^ (NSString* up, BOOL isFromDownMic){
|
||||
if (!self.hadGetQueueInfoSuccess) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user