上麦时闭麦、房间收藏公屏优化、被踢出房间后短时间不可进房、拉黑/踢人公屏仅有权限者可见

This commit is contained in:
chenguilong
2022-10-12 17:25:07 +08:00
parent 3385e4826f
commit a28f6ef57a
4 changed files with 64 additions and 1 deletions

View File

@@ -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;

View File

@@ -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"];

View File

@@ -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;

View File

@@ -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:@"您已被管理员拉黑"];
}