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