上麦时闭麦、房间收藏公屏优化、被踢出房间后短时间不可进房、拉黑/踢人公屏仅有权限者可见
This commit is contained in:
@@ -579,7 +579,24 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
if (model.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (attachment.first == CustomMessageType_Kick_User) {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = roomId;
|
||||
request.userIds = @[uid];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
||||
if (error == nil) {
|
||||
NIMChatroomMember * member = members.firstObject;
|
||||
BOOL isCreator = member.type == NIMChatroomMemberTypeCreator;
|
||||
BOOL isManager = member.type == NIMChatroomMemberTypeManager;
|
||||
if (isCreator || isManager) {
|
||||
[self addRoomMessage:message];
|
||||
}
|
||||
}
|
||||
}];
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||
return;
|
||||
|
@@ -69,6 +69,9 @@
|
||||
///右侧推荐房间
|
||||
@property (nonatomic, strong) XPRoomRecommendView *recommendRoomView;
|
||||
|
||||
///是否已发送过收藏房间公屏消息
|
||||
@property (nonatomic, assign) BOOL hadShowCollectInScreen;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RoomHeaderView
|
||||
@@ -278,6 +281,10 @@
|
||||
if ([type isEqualToString:@"1"]) {///收藏的话
|
||||
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_collect_icon_click eventAttributes:@{@"roomUid" : @(self.hostDelegate.getRoomInfo.uid)}];
|
||||
[XCHUDTool showSuccessWithMessage:@"收藏成功"];
|
||||
if (self.hadShowCollectInScreen) {
|
||||
return;
|
||||
}
|
||||
self.hadShowCollectInScreen = YES;
|
||||
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||
[dic setValue:[AccountInfoStorage instance].getUid forKey:@"uid"];
|
||||
[dic setValue:self.hostDelegate.getUserInfo.nick forKey:@"nick"];
|
||||
|
@@ -367,6 +367,10 @@
|
||||
}
|
||||
} roomUid:roomUid micUid:uid position:position uid:uid];
|
||||
}
|
||||
//如果是当前用户上麦,关闭自己的麦克风
|
||||
if (sequence && sequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||
[RtcManager instance].localMuted = YES;
|
||||
}
|
||||
}
|
||||
|
||||
microQueueChanged = YES;
|
||||
|
@@ -700,6 +700,30 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
}
|
||||
}
|
||||
|
||||
///判断是否被踢出房间
|
||||
- (BOOL)isKictOutLatest:(RoomInfoModel *)roomInfo {
|
||||
NSString *currentUid = [AccountInfoStorage instance].getUid;
|
||||
NSString *key = [NSString stringWithFormat:@"%@_%ld", currentUid, roomInfo.uid];
|
||||
NSString *kictOutTime = [[NSUserDefaults standardUserDefaults] objectForKey:key];
|
||||
if (kictOutTime) {
|
||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];
|
||||
NSTimeInterval time = [date timeIntervalSince1970];
|
||||
NSString *currentTime = [NSString stringWithFormat:@"%.0f", time];
|
||||
//是否超过5分钟
|
||||
if ([currentTime intValue] - [kictOutTime intValue] > 5 * 60) {
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
return NO;
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:@"抱歉,您暂时无法进入该房间"];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
return YES;
|
||||
}
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 本地礼物特效更新
|
||||
- (void)myGiftEffectUpdate:(NSNotification *)notification {
|
||||
NSDictionary * dic = notification.object;
|
||||
@@ -721,6 +745,10 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
[self showAnchorScrollTipView];
|
||||
return;
|
||||
}
|
||||
//判断5分钟内是否被踢出过房间
|
||||
if ([self isKictOutLatest:roomInfo]) {
|
||||
return;
|
||||
}
|
||||
if (roomInfo.valid) { // 房间有效,直接进入房间
|
||||
if (roomInfo.roomPwd.length > 0 && roomInfo.uid != [AccountInfoStorage instance].getUid.integerValue && [XPRoomMiniManager shareManager].getRoomInfo.uid != self.roomUid.integerValue) {//进房密码的情况
|
||||
if (!self.isRequestSuperAdmin) {
|
||||
@@ -1019,6 +1047,13 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
- (void)chatroomBeKicked:(NIMChatroomBeKickedResult *)result {
|
||||
if (result.reason == 2) {
|
||||
[self showErrorToast:@"您被管理员踢出直播间"];
|
||||
///保存被踢出时的时间
|
||||
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];//获取当前时间0秒后的时间
|
||||
NSTimeInterval time=[date timeIntervalSince1970];
|
||||
NSString *currentTime = [NSString stringWithFormat:@"%.0f", time];
|
||||
NSString *key = [NSString stringWithFormat:@"%@_%ld", [AccountInfoStorage instance].getUid, self.roomInfo.uid];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:currentTime forKey:key];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
} else if (result.reason == 5) {
|
||||
[self showErrorToast:@"您已被管理员拉黑"];
|
||||
}
|
||||
|
Reference in New Issue
Block a user