From 42cdbe44f6a96e3f2e0cafcf01bccf1cb6081e44 Mon Sep 17 00:00:00 2001 From: linyudan <1031378945@qq.com> Date: Mon, 4 Dec 2023 15:44:22 -0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E9=83=A8=E5=88=86=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Mew/Room/View/MewRoomViewController.m | 7 +-- .../Session/CHSessionInfoViewController.m | 2 +- .../YMRoomMessageContainerView.m | 48 +++++++++---------- .../YinMeng/Room/View/StageView/CHStageView.m | 10 +--- 4 files changed, 25 insertions(+), 42 deletions(-) diff --git a/yinmeng-ios/yinmeng-ios/Main/Mew/Room/View/MewRoomViewController.m b/yinmeng-ios/yinmeng-ios/Main/Mew/Room/View/MewRoomViewController.m index 75f3a1e..ba5f2a6 100644 --- a/yinmeng-ios/yinmeng-ios/Main/Mew/Room/View/MewRoomViewController.m +++ b/yinmeng-ios/yinmeng-ios/Main/Mew/Room/View/MewRoomViewController.m @@ -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]; } /// 送礼物成功 diff --git a/yinmeng-ios/yinmeng-ios/Main/YinMeng/Message/View/Session/CHSessionInfoViewController.m b/yinmeng-ios/yinmeng-ios/Main/YinMeng/Message/View/Session/CHSessionInfoViewController.m index 0ab72fe..a591018 100644 --- a/yinmeng-ios/yinmeng-ios/Main/YinMeng/Message/View/Session/CHSessionInfoViewController.m +++ b/yinmeng-ios/yinmeng-ios/Main/YinMeng/Message/View/Session/CHSessionInfoViewController.m @@ -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; } diff --git a/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/MessageContainerView/YMRoomMessageContainerView.m b/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/MessageContainerView/YMRoomMessageContainerView.m index 4795fb2..82a8767 100644 --- a/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/MessageContainerView/YMRoomMessageContainerView.m +++ b/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/MessageContainerView/YMRoomMessageContainerView.m @@ -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 * _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 * _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 *)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]; diff --git a/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/StageView/CHStageView.m b/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/StageView/CHStageView.m index 924660d..6d268ca 100644 --- a/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/StageView/CHStageView.m +++ b/yinmeng-ios/yinmeng-ios/Main/YinMeng/Room/View/StageView/CHStageView.m @@ -146,13 +146,7 @@ } - (void)onRoomInfoUpdate { -// self.isMiniEnter = NO; - RoomInfoModel * roomInfo = self.hostDelegate.getRoomInformation; -// for (int i = 0; i < self.countOfMircoView; i++) { -// UIView * 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 *view in self.microViews) { view.layer.borderColor = UIColor.clearColor.CGColor;