风险提醒优化
This commit is contained in:
@@ -75,7 +75,9 @@ typedef NS_ENUM(NSUInteger, URLType) {
|
||||
///航海玩法说明
|
||||
kSailingPlayDescdURL,
|
||||
///活动地址
|
||||
kSailingActivityURL
|
||||
kSailingActivityURL,
|
||||
///网络整治乱象
|
||||
kNetworkRenovateURL
|
||||
};
|
||||
|
||||
NSString * const URLWithType(URLType type);
|
||||
|
@@ -50,6 +50,7 @@ NSString * const URLWithType(URLType type) {
|
||||
@(kSailingActivityURL) : @"activity/radish/index.html", ///航海活动地址
|
||||
@(kSailingPlayDescdURL) : @"modules/rule/radishRule.html", ///航海玩法规则
|
||||
@(kSailingRecordURL) : @"modules/rank/index.html#/RadishRecord", ///航海中奖记录
|
||||
@(kNetworkRenovateURL) : @"activity/activemodel/index.html?code=ZBGG"///网络整治乱象
|
||||
};
|
||||
NSString * url = [dic objectForKey:@(type)];
|
||||
|
||||
|
@@ -8,13 +8,17 @@
|
||||
#import "MessageContentRiskAlertView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <YYText/YYText.h>
|
||||
#import "ContentRistAlertModel.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "XCCurrentVCStackManager.h"
|
||||
#import "XPHtmlUrl.h"
|
||||
#import "XPWebViewController.h"
|
||||
|
||||
@interface MessageContentRiskAlertView ()
|
||||
///显示内容
|
||||
@property (nonatomic,strong) UILabel *contentLabel;
|
||||
@property (nonatomic,strong) YYLabel *contentLabel;
|
||||
@end
|
||||
|
||||
@implementation MessageContentRiskAlertView
|
||||
@@ -44,9 +48,9 @@
|
||||
|
||||
- (void)initSubViews {
|
||||
[super initSubViews];
|
||||
self.backView.backgroundColor = [ThemeColor colorWithHexString:@"#e8e8e8"];
|
||||
self.backView.layer.masksToBounds = YES;
|
||||
self.backView.layer.cornerRadius = 10;
|
||||
// self.backView.backgroundColor = [ThemeColor colorWithHexString:@"#e8e8e8"];
|
||||
// self.backView.layer.masksToBounds = YES;
|
||||
// self.backView.layer.cornerRadius = 10;
|
||||
[self.backView addSubview:self.contentLabel];
|
||||
}
|
||||
|
||||
@@ -66,12 +70,25 @@
|
||||
if (text.length <= 0) {
|
||||
text = @"";
|
||||
}
|
||||
self.contentLabel.attributedText = [[NSMutableAttributedString alloc] initWithString:text attributes:[MessageContentRiskAlertView messageTextAttibutes]];
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:text attributes:[MessageContentRiskAlertView messageTextAttibutes]];
|
||||
NSRange range = [text rangeOfString:@"《整治网络直播乱象》"];
|
||||
if ((range.location + range.length) <= text.length) {
|
||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor appEmphasizeColor] range:range];
|
||||
|
||||
}
|
||||
|
||||
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) 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.contentLabel.attributedText = attribute;
|
||||
|
||||
}
|
||||
|
||||
- (UILabel *)contentLabel {
|
||||
- (YYLabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
_contentLabel = [[UILabel alloc]initWithFrame:CGRectZero];
|
||||
_contentLabel = [[YYLabel alloc]initWithFrame:CGRectZero];
|
||||
_contentLabel.preferredMaxLayoutWidth = CONTENT_WIDTH_MAX - MESSAGE_PADDING * 2;
|
||||
_contentLabel.textColor = ThemeColor.mainTextColor;
|
||||
_contentLabel.numberOfLines = 0;
|
||||
|
@@ -7,6 +7,7 @@
|
||||
|
||||
#import "MessageContentText.h"
|
||||
#import "ThemeColor.h"
|
||||
#import "NSObject+MJExtension.h"
|
||||
|
||||
#import <NIMSDK/NIMSDK.h>
|
||||
#import <Masonry/Masonry.h>
|
||||
@@ -63,7 +64,7 @@
|
||||
if (!messageText || (message.messageType != NIMMessageTypeTip && message.messageType != NIMMessageTypeText)) {
|
||||
messageText = @"未知消息类型";
|
||||
}
|
||||
|
||||
NSDictionary * dic = message.yidunAntiSpamRes.toJSONObject;
|
||||
_messageText.attributedText = [[NSAttributedString alloc] initWithString:messageText attributes:[MessageContentText messageTextAttibutes]];
|
||||
}
|
||||
|
||||
|
@@ -199,6 +199,12 @@
|
||||
BOOL isHiddenFail = YES;
|
||||
if (!message.isReceivedMsg) {
|
||||
isHiddenFail = message.deliveryState != NIMMessageDeliveryStateFailed;
|
||||
if (message.localExt) {
|
||||
NSDictionary * dic = message.localExt;
|
||||
if (((NSString *)dic[@"suggestion"]).integerValue == 2) {
|
||||
isHiddenFail = NO;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
isHiddenFail = message.attachmentDownloadState != NIMMessageAttachmentDownloadStateFailed;
|
||||
}
|
||||
|
@@ -380,6 +380,15 @@
|
||||
if (![self isExistMessages:message]) {
|
||||
[self.messages addObject:message];
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
[self.sessionTableView reloadData];
|
||||
[self.sessionTableView nim_scrollToBottom:YES];
|
||||
}
|
||||
|
@@ -1165,6 +1165,16 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
|
||||
if (![message.session.sessionId isEqualToString:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.yidunAntiSpamRes) {
|
||||
NSDictionary * spamRes = message.yidunAntiSpamRes.toJSONObject;
|
||||
NSDictionary * spamResExt = ((NSString *)spamRes[@"ext"]).toJSONObject;
|
||||
if ([spamResExt[@"antispam"][@"suggestion"] intValue] == 2) {
|
||||
[self showErrorToast:@"消息中可能含有违规信息,请停止发送类似信息!"];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (error) return;
|
||||
if (message.messageType == NIMMessageTypeCustom) {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
|
Reference in New Issue
Block a user