提交部分修改
This commit is contained in:
@@ -142,7 +142,6 @@
|
||||
case NIMChatroomEventTypeEnter:
|
||||
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue && self.userInfo.platformRole != 1) {
|
||||
// onLineNumber += 1;
|
||||
}else {///如果是自己的话 如果有坐骑的话
|
||||
}
|
||||
break;
|
||||
case NIMChatroomEventTypeAddBlack:
|
||||
@@ -320,11 +319,7 @@
|
||||
[self showErrorToast:@"您已被管理员拉黑"];
|
||||
}
|
||||
|
||||
if (code == -1) {
|
||||
// 房主已下线
|
||||
} else {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
/// 送礼物成功
|
||||
|
@@ -323,7 +323,7 @@
|
||||
_blackButton.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
[_blackButton setBackgroundColor:[MEWThemeColor mewAppCellBackgroundColor]];
|
||||
[_blackButton addTarget:self action:@selector(blackButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_blackButton.hidden = YES;
|
||||
// _blackButton.hidden = YES;
|
||||
}
|
||||
return _blackButton;
|
||||
}
|
||||
|
@@ -88,30 +88,17 @@
|
||||
|
||||
- (void)handleFetchHistoryMessage:(NIMMessage *)message {
|
||||
NSString *roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInformation.roomId];
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
|
||||
NIMHistoryMessageSearchOption *option = [self configWithHistoryMessageOption];
|
||||
option.startTime = self.hostDelegate.getRoomInformation.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) {
|
||||
//如果拉取的数量等于请求的数量,说明这个时间点以后的消息数量大于等于需要拉取的数量,直接拉取最新的50条
|
||||
if (messages.count == [ClientConfig shareConfig].configInfo.roomMessageCount) {
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
|
||||
NIMHistoryMessageSearchOption *option = [self configWithHistoryMessageOption];
|
||||
option.order = NIMMessageSearchOrderDesc;
|
||||
option.messageTypes = @[@(NIMMessageTypeText)];
|
||||
[[NIMSDK sharedSDK].chatroomManager fetchMessageHistory:roomId option:option result:^(NSError * _Nullable error, NSArray<NIMMessage *> * _Nullable messages) {
|
||||
if (self.datasource.count > kRoomMessageMaxLength) {
|
||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||
}
|
||||
// 执行插入
|
||||
for (NIMMessage *item in messages.reverseObjectEnumerator) {
|
||||
[self.datasource addObject:[self.roomMessageParser parseMessageAttribute:item]];
|
||||
}
|
||||
[self.messageTableView reloadData];
|
||||
[self reloadMessageDataWithMessages:messages];
|
||||
//执行插入动画并滚动
|
||||
[self scrollToBottomAnimated:YES];
|
||||
///插入进房消息及房间公告提示
|
||||
@@ -119,16 +106,7 @@
|
||||
}];
|
||||
return;
|
||||
}
|
||||
if (self.datasource.count > kRoomMessageMaxLength) {
|
||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||
}
|
||||
// 执行插入
|
||||
for (NIMMessage *item in messages) {
|
||||
[self.datasource addObject:[self.roomMessageParser parseMessageAttribute:item]];
|
||||
}
|
||||
[self.messageTableView reloadData];
|
||||
[self reloadMessageDataWithMessages:messages];
|
||||
//执行插入动画并滚动
|
||||
[self scrollToBottomAnimated:YES];
|
||||
}
|
||||
@@ -136,6 +114,24 @@
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (NIMHistoryMessageSearchOption *)configWithHistoryMessageOption{
|
||||
NIMHistoryMessageSearchOption *option = [[NIMHistoryMessageSearchOption alloc] init];
|
||||
option.limit = [ClientConfig shareConfig].configInfo.roomMessageCount;
|
||||
option.messageTypes = @[@(NIMMessageTypeText)];
|
||||
return option;
|
||||
}
|
||||
- (void)reloadMessageDataWithMessages:(NSArray<NIMMessage *> *)messages {
|
||||
if (self.datasource.count > kRoomMessageMaxLength) {
|
||||
NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, kRoomMessageMaxLength/2)];
|
||||
NSArray *needRemoveMsgArray = [self.datasource objectsAtIndexes:set];
|
||||
[self.datasource removeObjectsInArray:needRemoveMsgArray];
|
||||
}
|
||||
// 执行插入
|
||||
for (NIMMessage *item in messages) {
|
||||
[self.datasource addObject:[self.roomMessageParser parseMessageAttribute:item]];
|
||||
}
|
||||
[self.messageTableView reloadData];
|
||||
}
|
||||
///添加信息
|
||||
- (void)addCurrentRoomMessage:(NIMMessage *)message {
|
||||
[self.incomingMessages addObject:message];
|
||||
|
@@ -146,13 +146,7 @@
|
||||
}
|
||||
|
||||
- (void)onRoomInfoUpdate {
|
||||
// self.isMiniEnter = NO;
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInformation;
|
||||
// for (int i = 0; i < self.countOfMircoView; i++) {
|
||||
// UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||
// [view showGiftValueMode:roomInfo.showGiftValue];
|
||||
// }
|
||||
// [self microQueueUpdated];
|
||||
|
||||
}
|
||||
|
||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
|
||||
@@ -267,8 +261,6 @@
|
||||
- (void)microQueueUpdated:(BOOL)isHandleRTC {
|
||||
BOOL selfNeedBroadcast = NO;
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInformation;
|
||||
BOOL leaveMode = roomInfo.leaveMode;
|
||||
NSMutableArray *statisMicArray = [NSMutableArray array];
|
||||
|
||||
for (UIView<MicroViewProtocol> *view in self.microViews) {
|
||||
view.layer.borderColor = UIColor.clearColor.CGColor;
|
||||
|
Reference in New Issue
Block a user