From 93b043c6609453fe92535bd40186239faed5deb5 Mon Sep 17 00:00:00 2001 From: eggmanQQQ <3671373519@qq.com> Date: Fri, 5 Jul 2024 17:15:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E5=B0=8F=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi.xcodeproj/project.pbxproj | 4 +- YuMi/Global/YUMIConstant.h | 1 + YuMi/Global/YUMIConstant.m | 6 +- YuMi/Global/YUMIMacroUitls.h | 2 +- YuMi/Modules/YMMessage/View/NIMMessageMaker.m | 16 +- .../SesssionModel/MessageRiskAlertModel.m | 9 - .../View/Session/MSSessionPublicChatHallVC.m | 201 +++++++++--------- .../View/Session/SessionViewController.m | 46 +++- .../MenuContainerView/XPRoomSendTextView.m | 8 +- .../XPRoomQuickMessageContainView.m | 8 +- .../View/SubView/MSRoomGameSendTextView.m | 9 +- .../View/RoomHeaderView/RoomHeaderView.m | 3 - .../YMTabbar/View/TabbarViewController.m | 3 +- YuMi/ar.lproj/Localizable.strings | 2 +- YuMi/en.lproj/Localizable.strings | 2 +- 15 files changed, 178 insertions(+), 142 deletions(-) diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 3f348468..76cc456e 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -12856,7 +12856,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 20.20.26; + MARKETING_VERSION = 20.20.27; PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -12898,7 +12898,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 20.20.26; + MARKETING_VERSION = 20.20.27; PRODUCT_BUNDLE_IDENTIFIER = com.peko.enterprise.ios; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/YuMi/Global/YUMIConstant.h b/YuMi/Global/YUMIConstant.h index a54893a9..575a2542 100644 --- a/YuMi/Global/YUMIConstant.h +++ b/YuMi/Global/YUMIConstant.h @@ -24,6 +24,7 @@ typedef NS_ENUM(NSUInteger, Pi_KeyType) { KeyType_TRTC,///TRTC key KeyType_NetEase,///云信的key keyType_YiDunBussinessId,///易盾的id + keyType_YiDunPhotoBussinessId,///易盾图片的id KeyType_FacePwdEncode, ///表情包解密key KeyType_SudGameAppID,///小游戏APPID KeyType_SudGameAppKey,///小游戏APPKey diff --git a/YuMi/Global/YUMIConstant.m b/YuMi/Global/YUMIConstant.m index 6f5a13a5..3272b5c7 100644 --- a/YuMi/Global/YUMIConstant.m +++ b/YuMi/Global/YUMIConstant.m @@ -67,7 +67,8 @@ NSString * const KeyWithType(Pi_KeyType type) { @(KeyType_Agora) : @"f8713b6ec98c4c01adaf34cb4fa091b1", @(KeyType_TRTC) : @"1400741885", @(KeyType_NetEase) : @"79bc37000f4018a2a24ea9dc6ca08d32", - @(keyType_YiDunBussinessId) : @"yinyouApnsDebug", +// @(keyType_YiDunBussinessId) : @"3611b99d0457202a7f69151288183236", +// @(keyType_YiDunPhotoBussinessId) : @"", @(KeyType_FacePwdEncode) : @"1ea53d260ecf11e7b56e00163e046a26", @(KeyType_SudGameAppID) : @"1578948593831571457", @(KeyType_SudGameAppKey) : @"J9lHOXvFWkAZiTfl4SK7IGt0wDnW3fWd", @@ -85,7 +86,8 @@ NSString * const KeyWithType(Pi_KeyType type) { @(KeyType_Agora) : @"3da88e33bc4f45019cc867ec51d7b465",///声网 @(KeyType_SudGameAppID) : @"1578948593831571457",///小游戏 @(KeyType_SudGameAppKey) : @"J9lHOXvFWkAZiTfl4SK7IGt0wDnW3fWd",///小游戏 - @(keyType_YiDunBussinessId) : @"f459972b432106844b89fd58c92b8061", +// @(keyType_YiDunBussinessId) : @"f459972b432106844b89fd58c92b8061", +// @(keyType_YiDunPhotoBussinessId) : @"", @(KeyType_TRTC) : @"1400823228",/// @(KeyType_NetEase) : @"7371d729710cd6ce3a50163b956b5eb6",/// @(KeyType_FacePwdEncode) : @"1ea53d260ecf11e7b56e00163e046a26",/// diff --git a/YuMi/Global/YUMIMacroUitls.h b/YuMi/Global/YUMIMacroUitls.h index 1cd2e84f..6571307a 100644 --- a/YuMi/Global/YUMIMacroUitls.h +++ b/YuMi/Global/YUMIMacroUitls.h @@ -49,7 +49,7 @@ isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaIns ///内置版本号 -#define PI_App_Version @"1.0.12" +#define PI_App_Version @"1.0.13" ///渠道 #define PI_App_Source @"appstore" #define PI_Test_Flight @"TestFlight" diff --git a/YuMi/Modules/YMMessage/View/NIMMessageMaker.m b/YuMi/Modules/YMMessage/View/NIMMessageMaker.m index b2497069..524aec37 100644 --- a/YuMi/Modules/YMMessage/View/NIMMessageMaker.m +++ b/YuMi/Modules/YMMessage/View/NIMMessageMaker.m @@ -48,6 +48,7 @@ NIMImageOption *option = [[NIMImageOption alloc] init]; option.compressQuality = 0.7; imageObject.option = option; + return [NIMMessageMaker generateImageMessage:imageObject]; } @@ -69,9 +70,16 @@ [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; imageObject.displayName = [NSString stringWithFormat:@"%@%@",YMLocalizedString(@"NIMMessageMaker3"), dateString]; + NIMMessage *message = [[NIMMessage alloc] init]; message.messageObject = imageObject; message.apnsContent = YMLocalizedString(@"NIMMessageMaker4"); + +// NIMAntiSpamOption *spamOption = [[NIMAntiSpamOption alloc] init]; +// spamOption.yidunEnabled = YES; +// spamOption.businessId = KeyWithType(keyType_YiDunBussinessId); +// message.antiSpamOption = spamOption; + [self setupMessage:message]; return message; } @@ -87,10 +95,10 @@ setting.apnsEnabled = YES; message.setting = setting; - NIMAntiSpamOption *option = [NIMAntiSpamOption new]; - option.yidunEnabled = YES; - option.businessId = KeyWithType(keyType_YiDunBussinessId); - message.antiSpamOption = option; +// NIMAntiSpamOption *option = [NIMAntiSpamOption new]; +// option.yidunEnabled = YES; +// option.businessId = KeyWithType(keyType_YiDunBussinessId); +// message.antiSpamOption = option; } diff --git a/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/MessageRiskAlertModel.m b/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/MessageRiskAlertModel.m index a50ad903..16395971 100644 --- a/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/MessageRiskAlertModel.m +++ b/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/MessageRiskAlertModel.m @@ -27,15 +27,6 @@ } NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:[self messageTextAttibutes]]; - NSRange range = [text rangeOfString:YMLocalizedString(@"MessageRiskAlertModel0")]; - if ((range.location + range.length) <= text.length) { - [attribute addAttribute:NSForegroundColorAttributeName value:[DJDKMIMOMColor appEmphasizeColor] range:range]; - [attribute yy_setTextHighlightRange:range color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) { - XPWebViewController * webVC = [[XPWebViewController alloc] init]; - webVC.url = URLWithType(kNetworkRenovateURL); - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - }]; - } self.isHiddenAvatar = YES; self.attributedText = attribute; CGSize dstRect = CGSizeMake(CONTENT_WIDTH_MAX - MESSAGE_PADDING * 2, MAXFLOAT); diff --git a/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m b/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m index a4041c7f..2150dd59 100644 --- a/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m +++ b/YuMi/Modules/YMMessage/View/Session/MSSessionPublicChatHallVC.m @@ -111,25 +111,17 @@ [self initHeaderAndFooterRrfresh]; [IQKeyboardManager sharedManager].enable = NO; [IQKeyboardManager sharedManager].enableAutoToolbar = NO; - + [[NIMSDK sharedSDK].chatManager addDelegate:self]; - } - - - (void)initHeaderAndFooterRrfresh { [self initData]; } - - #pragma mark - 提前加载相册中的图片 - (void)loadAlbumPhotos { - [YYUtility checkAssetsLibrayAvailable:^{ - } denied:^{ - } restriction:^{ - }]; + [YYUtility checkAssetsLibrayAvailable:^{} denied:^{} restriction:^{}]; } #pragma mark - cell的样式 @@ -519,16 +511,16 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return self.messages.count; + return self.messages.count; } - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { - + MessageBaseModel * message = [self.messages xpSafeObjectAtIndex:indexPath.row]; MessageHeadlinesTextModel * textModel = (MessageHeadlinesTextModel *)message; if(message.messageType == SessionMessageType_Text){ - + if(textModel.isSelf){ MSSessionPublicChatHalRightTextCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([MSSessionPublicChatHalRightTextCell class]) forIndexPath:indexPath]; [cell render:message]; @@ -550,18 +542,18 @@ return cell; } - NSString * identifier = [message cellContent:message]; - ///从复用池中获取所需要的cell - MessageCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier]; - if (!cell) { - ///如果没有的话 根据identifier 注册一下 重新获取一下即可 - [tableView registerClass:[MessageCell class] forCellReuseIdentifier:identifier]; - ///如果注册过了 就不需要判断cell是否为空 - cell = [tableView dequeueReusableCellWithIdentifier:identifier]; - } - cell.delegate = self; - [cell renderWithMessage:[self.messages xpSafeObjectAtIndex:indexPath.row]]; - return cell; + NSString * identifier = [message cellContent:message]; + ///从复用池中获取所需要的cell + MessageCell * cell = [tableView dequeueReusableCellWithIdentifier:identifier]; + if (!cell) { + ///如果没有的话 根据identifier 注册一下 重新获取一下即可 + [tableView registerClass:[MessageCell class] forCellReuseIdentifier:identifier]; + ///如果注册过了 就不需要判断cell是否为空 + cell = [tableView dequeueReusableCellWithIdentifier:identifier]; + } + cell.delegate = self; + [cell renderWithMessage:[self.messages xpSafeObjectAtIndex:indexPath.row]]; + return cell; } @@ -605,7 +597,7 @@ if(self.messages.count > 0){ NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据 [self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:YES]; //滚动到最后一行 - + } } @@ -626,15 +618,34 @@ [self.messages addObject:model]; } } + if (message.yidunAntiSpamRes) { NSDictionary * spamRes = message.yidunAntiSpamRes.toJSONObject; - NSDictionary * spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject; - if ([spamResExt[@"antispam"][@"suggestion"] intValue] == 2) { - NSDictionary * dic = @{@"suggestion": @"2"}; - message.localExt = dic; - [[NIMSDK sharedSDK].conversationManager updateMessage:message forSession:self.session completion:nil]; + id spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject; + NSDictionary *antispamDic = nil; + if ([spamResExt isKindOfClass:[NSArray class]]) { + antispamDic = [spamResExt xpSafeObjectAtIndex:0]; + } else if ([spamResExt isKindOfClass:[NSDictionary class]]) { + antispamDic = spamResExt[@"antispam"]; + } + NSDictionary *realAntiDic = nil; + if ([[antispamDic allKeys] containsObject:@"antispam"]) { + realAntiDic = antispamDic[@"antispam"];; + } else { + realAntiDic = antispamDic; + } + if (realAntiDic) { + NSInteger suggestion = [realAntiDic[@"suggestion"] integerValue]; + if (suggestion == 2) { + NSDictionary * dic = @{@"suggestion": @"2"}; + message.localExt = dic; + [[NIMSDK sharedSDK].conversationManager updateMessage:message forSession:self.session completion:nil]; + + [self showErrorToast:YMLocalizedString(@"XPRoomViewController10")]; + } } } + [self.sessionTableView reloadData]; if(self.messages.count > 0){ NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据 @@ -642,19 +653,16 @@ } } - - - - - - (void)sendTextMessage:(NSString *)text { - - NIMMessage *message = [NIMMessageMaker msgWithText:text]; - message.remoteExt = [self getRemoteExt]; - [[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil]; - + NIMMessage *message = [NIMMessageMaker msgWithText:text]; + message.remoteExt = [self getRemoteExt]; +// NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; +// option.yidunEnabled = YES; +// option.businessId = KeyWithType(keyType_YiDunBussinessId); +// message.antiSpamOption = option; + [[[NIMSDK sharedSDK] chatManager] sendMessage:message toSession:self.session error:nil]; } -(NSDictionary *)getRemoteExt{ UserInfoModel *userInfo = self.userInfo; @@ -680,20 +688,20 @@ NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[AccountInfoStorage instance].getUid]; return remoteExt; - + } #pragma mark - TZImagePickerControllerDelegate - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray *)infos { + @kWeakify(self); [photos enumerateObjectsUsingBlock:^(UIImage * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + @kStrongify(self); if (obj) { - NIMMessage * message = [NIMMessageMaker msgWithImage:obj]; - message.remoteExt = [self getRemoteExt]; - // 发送消息 - [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil]; - - + NIMMessage * message = [NIMMessageMaker msgWithImage:obj]; + message.remoteExt = [self getRemoteExt]; + // 发送消息 + [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil]; } }]; } @@ -793,7 +801,7 @@ @kStrongify(self); [self showNotPhoto:YMLocalizedString(@"SessionViewController19") content:YMLocalizedString(@"SessionViewController12")]; }]; - + } - (void)inputBarView:(QInputBarView *)inputBarView onPhototButtonClick:(UIButton *)emotionSwitchButton { @@ -804,42 +812,42 @@ [TZImagePickerConfig sharedInstance].allowPickingImage = YES; dispatch_async(dispatch_get_global_queue(0, 0), ^{ [[TZImageManager manager] getCameraRollAlbumWithFetchAssets:NO completion:^(TZAlbumModel *model) { - [[TZImageManager manager] getAssetsFromFetchResult:model.result completion:^(NSArray *models) { - dispatch_async(dispatch_get_main_queue(), ^{ - NSMutableArray * array = [NSMutableArray array]; - if (models.count > 40) { - for (int i = 0; i < 40; i++) { - TZAssetModel * assets = [models objectAtIndex:i]; - QPhotoImageModel * infor = [[QPhotoImageModel alloc] init]; - infor.isOrigin = NO; - infor.assetInfo = assets; - [array addObject:infor]; - } - } else { - for (int i = 0; i < models.count; i++) { - TZAssetModel * assets = [models objectAtIndex:i]; - QPhotoImageModel * infor = [[QPhotoImageModel alloc] init]; - infor.isOrigin = NO; - infor.assetInfo = assets; - [array addObject:infor]; - } + [[TZImageManager manager] getAssetsFromFetchResult:model.result completion:^(NSArray *models) { + dispatch_async(dispatch_get_main_queue(), ^{ + NSMutableArray * array = [NSMutableArray array]; + if (models.count > 40) { + for (int i = 0; i < 40; i++) { + TZAssetModel * assets = [models objectAtIndex:i]; + QPhotoImageModel * infor = [[QPhotoImageModel alloc] init]; + infor.isOrigin = NO; + infor.assetInfo = assets; + [array addObject:infor]; } - self.phototArray = array; - if (self.phototArray.count > 0) { - self.photoView.photoList = self.phototArray; - [self.keyboardManager switchToPhotoBoardKeyboard]; - } else { - TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; - imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen; - imagePickerVc.allowPickingVideo = NO; - imagePickerVc.allowTakeVideo = NO; - imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor]; - imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor]; - imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor]; - [self presentViewController:imagePickerVc animated:YES completion:nil]; + } else { + for (int i = 0; i < models.count; i++) { + TZAssetModel * assets = [models objectAtIndex:i]; + QPhotoImageModel * infor = [[QPhotoImageModel alloc] init]; + infor.isOrigin = NO; + infor.assetInfo = assets; + [array addObject:infor]; } - }); - }]; + } + self.phototArray = array; + if (self.phototArray.count > 0) { + self.photoView.photoList = self.phototArray; + [self.keyboardManager switchToPhotoBoardKeyboard]; + } else { + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; + imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen; + imagePickerVc.allowPickingVideo = NO; + imagePickerVc.allowTakeVideo = NO; + imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor]; + imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor]; + imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor]; + [self presentViewController:imagePickerVc animated:YES completion:nil]; + } + }); + }]; }]; }); } denied:^{ @@ -854,14 +862,14 @@ _inputBarView.inputTextView.text = @""; [_inputBarView textViewResignFirstResponder]; } - + } - (void)showNotPhoto:(NSString *)title content:(NSString *)content { TTAlertConfig *config = [[TTAlertConfig alloc] init]; config.title = title; config.message = content; - + [TTPopup alertWithConfig:config confirmHandler:^{ NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; if ([[UIApplication sharedApplication] canOpenURL:url]) { @@ -879,7 +887,7 @@ if(self.messages.count > 0){ NSIndexPath *ip = [NSIndexPath indexPathForRow:self.messages.count-1 inSection:0]; //取最后一行数据 [self.sessionTableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:NO]; //滚动到最后一行 - + } [self.sessionTableView mas_remakeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.mas_equalTo(self.view); @@ -904,7 +912,7 @@ emotionAtt.image = iconImage; emotionAtt.imageName = emotion.displayName; NSAttributedString *emotionAttribute = [NSMutableAttributedString attributedStringWithAttachment:(NSTextAttachment *)emotionAtt]; - + [_inputBarView insertEmotionAttributedString:emotionAttribute]; } @@ -921,7 +929,7 @@ [self sendTextMessage:[_inputBarView textViewInputNormalText]]; _inputBarView.inputTextView.text = @""; [_keyboardManager hideAllBoardView]; - + } /** @@ -953,9 +961,6 @@ [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil]; [view resetChoosePhotos]; - - - } } @@ -979,12 +984,16 @@ if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { UIImageWriteToSavedPhotosAlbum(selectedPhoto, nil, nil, nil); } - NIMMessage * message = [NIMMessageMaker msgWithImage:selectedPhoto]; - message.remoteExt = [self getRemoteExt]; - // 发送消息 - [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil]; - +// NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; +// option.yidunEnabled = YES; +// option.businessId = @"e9da8bd5c76da23d5e37f87e5ab1f5e9"; + + NIMMessage * message = [NIMMessageMaker msgWithImage:selectedPhoto]; + message.remoteExt = [self getRemoteExt]; +// message.antiSpamOption = option; + // 发送消息 + [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:self.session error:nil]; } [picker dismissViewControllerAnimated:YES completion:^{}]; } diff --git a/YuMi/Modules/YMMessage/View/Session/SessionViewController.m b/YuMi/Modules/YMMessage/View/Session/SessionViewController.m index 21b4f9cf..269ec12a 100644 --- a/YuMi/Modules/YMMessage/View/Session/SessionViewController.m +++ b/YuMi/Modules/YMMessage/View/Session/SessionViewController.m @@ -705,15 +705,43 @@ [self.messages addObject:model]; } - if (message.yidunAntiSpamRes) { - NSDictionary * spamRes = message.yidunAntiSpamRes.toJSONObject; - NSDictionary * spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject; - if ([spamResExt[@"antispam"][@"suggestion"] intValue] == 2) { - NSDictionary * dic = @{@"suggestion": @"2"}; - message.localExt = dic; - [[NIMSDK sharedSDK].conversationManager updateMessage:message forSession:self.session completion:nil]; - } - } +// if (message.yidunAntiSpamRes) { +// NSDictionary * spamRes = message.yidunAntiSpamRes.toJSONObject; +// NSDictionary * spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject; +// if ([spamResExt[@"antispam"][@"suggestion"] intValue] == 2) { +// NSDictionary * dic = @{@"suggestion": @"2"}; +// message.localExt = dic; +// [[NIMSDK sharedSDK].conversationManager updateMessage:message forSession:self.session completion:nil]; +// } +// } + + if (message.yidunAntiSpamRes) { + NSDictionary * spamRes = message.yidunAntiSpamRes.toJSONObject; + id spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject; + NSDictionary *antispamDic = nil; + if ([spamResExt isKindOfClass:[NSArray class]]) { + antispamDic = [spamResExt xpSafeObjectAtIndex:0]; + } else if ([spamResExt isKindOfClass:[NSDictionary class]]) { + antispamDic = spamResExt[@"antispam"]; + } + NSDictionary *realAntiDic = nil; + if ([[antispamDic allKeys] containsObject:@"antispam"]) { + realAntiDic = antispamDic[@"antispam"];; + } else { + realAntiDic = antispamDic; + } + if (realAntiDic) { + NSInteger suggestion = [realAntiDic[@"suggestion"] integerValue]; + if (suggestion == 2) { + NSDictionary * dic = @{@"suggestion": @"2"}; + message.localExt = dic; + [[NIMSDK sharedSDK].conversationManager updateMessage:message forSession:self.session completion:nil]; + + [self showErrorToast:YMLocalizedString(@"XPRoomViewController10")]; + } + } + } + [self.sessionTableView reloadData]; [self.sessionTableView nim_scrollToBottom:YES]; } diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m index 4752f6b2..d56209a0 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m @@ -114,10 +114,10 @@ message.remoteExt = remoteExt; ///网易易盾 拦截高风险 - NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; - option.yidunEnabled = YES; - option.businessId = KeyWithType(keyType_YiDunBussinessId); - message.antiSpamOption = option; +// NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; +// option.yidunEnabled = YES; +// option.businessId = KeyWithType(keyType_YiDunBussinessId); +// message.antiSpamOption = option; NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[userInfo.partitionId]]; NSString * sessionId = [self.delegate getPublicScreenType] == 0 ? [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]:publicChatRoomId; //构造会话 diff --git a/YuMi/Modules/YMRoom/View/QuickMessageView/XPRoomQuickMessageContainView.m b/YuMi/Modules/YMRoom/View/QuickMessageView/XPRoomQuickMessageContainView.m index 38dc8ff3..374fcf18 100644 --- a/YuMi/Modules/YMRoom/View/QuickMessageView/XPRoomQuickMessageContainView.m +++ b/YuMi/Modules/YMRoom/View/QuickMessageView/XPRoomQuickMessageContainView.m @@ -131,10 +131,10 @@ message.remoteExt = remoteExt; ///网易易盾 拦截高风险 - NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; - option.yidunEnabled = YES; - option.businessId = KeyWithType(keyType_YiDunBussinessId); - message.antiSpamOption = option; +// NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; +// option.yidunEnabled = YES; +// option.businessId = KeyWithType(keyType_YiDunBussinessId); +// message.antiSpamOption = option; NSString * sessionId = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]; //构造会话 NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; diff --git a/YuMi/Modules/YMRoom/View/RoomGame/View/SubView/MSRoomGameSendTextView.m b/YuMi/Modules/YMRoom/View/RoomGame/View/SubView/MSRoomGameSendTextView.m index 9b90dc61..fed87244 100644 --- a/YuMi/Modules/YMRoom/View/RoomGame/View/SubView/MSRoomGameSendTextView.m +++ b/YuMi/Modules/YMRoom/View/RoomGame/View/SubView/MSRoomGameSendTextView.m @@ -73,17 +73,16 @@ extModel.fromSayHelloChannel = userInfo.fromSayHelloChannel; - NIMMessage * message = [[NIMMessage alloc] init]; message.text = self.inputMessage; NSMutableDictionary *remoteExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[AccountInfoStorage instance].getUid]; message.remoteExt = remoteExt; ///网易易盾 拦截高风险 - NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; - option.yidunEnabled = YES; - option.businessId = KeyWithType(keyType_YiDunBussinessId); - message.antiSpamOption = option; +// NIMAntiSpamOption *option = [[NIMAntiSpamOption alloc]init]; +// option.yidunEnabled = YES; +// option.businessId = KeyWithType(keyType_YiDunBussinessId); +// message.antiSpamOption = option; NSString * sessionId = self.roomId; //构造会话 self.sendButton.enabled = NO; diff --git a/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m b/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m index e38cdcd8..feb37f30 100644 --- a/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m +++ b/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m @@ -252,7 +252,6 @@ } self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0; } - self.topicButton.hidden = roomInfo.type == RoomType_Anchor; } - (void)onRoomUpdate { @@ -267,8 +266,6 @@ self.collectButton.hidden = NO; // self.collectButton.selected = roomInfo.isRoomFans; 收藏后,房间数据没有及时更新 } - self.lockRoomImageView.hidden = roomInfo.roomPwd.length <= 0; - self.topicButton.hidden = roomInfo.type == RoomType_Anchor; } #pragma mark - Event Response - (void)showSharePanel { diff --git a/YuMi/Modules/YMTabbar/View/TabbarViewController.m b/YuMi/Modules/YMTabbar/View/TabbarViewController.m index 835d4831..3212b423 100644 --- a/YuMi/Modules/YMTabbar/View/TabbarViewController.m +++ b/YuMi/Modules/YMTabbar/View/TabbarViewController.m @@ -175,10 +175,12 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showAnchorCardKey:) name:kTabShowAnchorCardKey object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(switchLanguage:) name:@"kSwitchLanguage" object:nil]; } + -(void)switchLanguage:(NSNotification *)not{ [self initTabs:YES]; self.selectedIndex = 4; } + - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:YES]; @@ -186,7 +188,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; if ([XPRoomMiniManager shareManager].getRoomInfo == nil) { [self.roomMineView hiddenRoomMiniView]; } - } - (void)viewWillDisappear:(BOOL)animated { diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index 7f67a5f1..f99d9efa 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -2332,7 +2332,7 @@ ineHeadView12" = "الحمل"; "XPRoomViewController7" = "انتهى وقت البث لصاحب الغرفة"; "XPRoomViewController8" = "تم طردك من البث المباشر"; "XPRoomViewController9" = "تم حظرك من قبل المشرف"; -"XPRoomViewController10" = "قد تحتوي الرسالة على معلومات غير ملائمة، يرجى التوقف عن إرسال مثل هذه الرسائل!"; +"XPRoomViewController10" = "قد تحتوي الرسالة على معلومات غير قانونية، يرجى التوقف عن إرسال معلومات مماثلة مثل ذلك!"; "XPRoomViewController11" = "سوف تخرج من الغرفة وتفقد مكانك في قائمة الانتظار، هل أنت متأكد من الخروج؟"; "XPRoomViewController12" = "سوف تخرج من الغرفة وتفقد مكانك في قائمة الانتظار، هل أنت متأكد من الخروج؟"; "XPRoomViewController13" = "لقد وصلت إلى الأعلى~ سوف يتم إعادتك تلقائيًا إلى الغرفة الحالية"; diff --git a/YuMi/en.lproj/Localizable.strings b/YuMi/en.lproj/Localizable.strings index bfd64d90..53ec04d4 100644 --- a/YuMi/en.lproj/Localizable.strings +++ b/YuMi/en.lproj/Localizable.strings @@ -2061,7 +2061,7 @@ "XPRoomViewController7" = "The host has gone offline"; "XPRoomViewController8" = "You have been kicked out of the live room by the administrator"; "XPRoomViewController9" = "You have been blacklisted by the administrator"; -"XPRoomViewController10" = "The message may contain inappropriate content. Please refrain from sending such messages!"; +"XPRoomViewController10" = "The message may contain illegal information, please stop sending similar information like that!"; "XPRoomViewController11" = "Exiting the room will also exit the current queue. You need to queue again when re-entering. Are you sure you want to exit the room?"; "XPRoomViewController12" = "Exiting the room will also exit the current queue. You need to queue again when re-entering. Are you sure you want to exit the room?"; "XPRoomViewController13" = "Reached the top~ Automatically return to the current room";