麦上有人时不能再上麦
This commit is contained in:
@@ -60,6 +60,8 @@
|
||||
* 防止快速点击连续上麦。
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL isUpingMic;
|
||||
///是否已获取麦上用户信息,防止没获取到信息时点击上麦,把麦上的人挤下来
|
||||
@property (nonatomic, assign) BOOL hadGetQueueInfoSuccess;
|
||||
|
||||
@end
|
||||
|
||||
@@ -151,7 +153,7 @@
|
||||
}
|
||||
[self microQueueUpdated: NO];
|
||||
}];
|
||||
|
||||
self.hadGetQueueInfoSuccess = NO;
|
||||
// 获取麦位的用户,并初始化 self.micQueue 。
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomQueue:[NSString stringWithFormat:@"%ld", (long)roomInfo.roomId] completion:^(NSError * _Nullable error, NSArray<NSDictionary<NSString *,NSString *> *> * _Nullable info) {
|
||||
if (error) return;
|
||||
@@ -167,6 +169,7 @@
|
||||
}
|
||||
[self microQueueUpdated:ownerRTCChange];
|
||||
[self.hostDelegate onMicroQueueUpdate:self.micQueue];
|
||||
self.hadGetQueueInfoSuccess = YES;
|
||||
}];
|
||||
|
||||
// 拿到麦序后初始化礼物值
|
||||
@@ -534,6 +537,14 @@
|
||||
if (!member) return;
|
||||
|
||||
void(^nimUpQueue)(NSString*, BOOL) = ^ (NSString* up, BOOL isFromDownMic){
|
||||
if (!self.hadGetQueueInfoSuccess) {
|
||||
return;
|
||||
}
|
||||
MicroQueueModel* micModel = [self.micQueue objectForKey:up];
|
||||
if (micModel.userInfo) {///麦上已经有人,不上麦
|
||||
[XCHUDTool showErrorWithMessage:@"该麦位已经有人了哦~"];
|
||||
return;
|
||||
}
|
||||
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
|
||||
request.key = up;
|
||||
request.value = [[self userInfoToQueueExt:userInfo] toJSONString];
|
||||
|
Reference in New Issue
Block a user