更多菜单栏增加清除房间公屏
This commit is contained in:
@@ -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;}
|
||||
|
Reference in New Issue
Block a user