更多菜单栏增加清除房间公屏

This commit is contained in:
chenguilong
2022-04-25 17:45:57 +08:00
parent 514081b699
commit eb373ad8aa
12 changed files with 154 additions and 14 deletions

View File

@@ -494,9 +494,23 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self.locationArray removeAllObjects];
self.atCount = 0;
self.atTipBtn.hidden = YES;
[[XPRoomMiniManager shareManager] resetLocalMessage];
self.messageTipsBtn.hidden = YES;
self.isPending = NO;
[[XPRoomMiniManager shareManager] resetLocalMessage];
[self addRoomMessage:message];
return;
} else if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) {
[self.datasource removeAllObjects];
[self.incomingMessages removeAllObjects];
[self.messageBubbles removeAllObjects];
[self.locationArray removeAllObjects];
self.atCount = 0;
self.atTipBtn.hidden = YES;
self.messageTipsBtn.hidden = YES;
self.isPending = NO;
[[XPRoomMiniManager shareManager] resetLocalMessage];
[self addRoomMessage:message];
return;
}
}
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
@@ -525,14 +539,56 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
[self addRoomMessage:message];
return;
} else {
[self addRoomMessage:message];
NIMChatroomNotificationMember *member = content.targets[0];
if (member.userId.integerValue == [AccountInfoStorage instance].getUid.integerValue) {
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomtopicMessage];
}
///
NSString *roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
option.startTime = self.hostDelegate.getRoomInfo.clearScreenTime / 1000.0;
option.order = NIMMessageSearchOrderAsc;
option.messageTypes = @[@(NIMMessageTypeText)];
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
if (messages.count) {
if (self.datasource.count > kRoomMessageMaxLength) {
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
[self.datasource removeObjectsInArray:needRemoveMsgArray];
[self.messageBubbles removeObjectsAtIndexes:set];
}
//
for (NIMMessage *item in messages) {
[self.datasource addObject:[self.messageParser parseMessageAttribute:item]];
[self.messageBubbles addObject:[self.messageParser parseMessageBubble:item]];
if (!self.isMiniEnter) {///
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
NIMCustomObject *obj = (NIMCustomObject *)item.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_Update_RoomInfo && attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState){
[[XPRoomMiniManager shareManager] saveRoomMessage:item];
}
}
} else {
[[XPRoomMiniManager shareManager] saveRoomMessage:item];
}
}
}
[self.messageTableView reloadData];
//
[self scrollToBottom:YES];
}
///
[self addRoomMessage:message];
if (!roomInfo.hasAnimationEffect) {
[self roomInfoNoGiftAnimationMessage:message];
}
[self createUserEnterRoomAddRoomtopicMessage];
}];
} else {
[self addRoomMessage:message];
}
}
} else if(content.eventType == NIMChatroomEventTypeInfoUpdated) {
if (roomInfo.isCloseScreen) {return;}