提交部分修改

This commit is contained in:
linyudan
2023-12-04 15:44:22 -08:00
parent f52505a799
commit 42cdbe44f6
4 changed files with 25 additions and 42 deletions

View File

@@ -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];
}
///

View File

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

View File

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

View File

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