NIMSDK-AOS  10.10.13
V2NIMNotificationAntispamConfig.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.notification.config;
2 
4 
5  // 指定是否需要过安全通(对于已开通安全通的用户有效,默认通知都会走安全通,如果对单条通知设置 enable 为false,则此通知不会走安全通)。
6  // 该字段为true,其他字段才生效
7  private final boolean antispamEnabled;
8 
9 
10  // 开发者自定义的反垃圾字段, content 必须是 json 格式,长度不超过 5000 字节,格式如下 { "type": 1, //1:文本,2:图片,3视频 "data": "" //文本内容or图片地址or视频地址 }
11  private final String antispamCustomNotification;
12 
14  this(DEFAULT_ANTISPAM_ENABLED, null);
15  }
16 
17  public V2NIMNotificationAntispamConfig(boolean antispamEnabled, String antispamCustomNotification) {
18  this.antispamEnabled = antispamEnabled;
19  this.antispamCustomNotification = antispamCustomNotification;
20  }
21 
22  public boolean isAntispamEnabled() {
23  return antispamEnabled;
24  }
25 
27  return antispamCustomNotification;
28  }
29 
30  public static final boolean DEFAULT_ANTISPAM_ENABLED = true;
31 
32  public static final class V2NIMNotificationAntispamConfigBuilder {
33  private boolean antispamEnabled = DEFAULT_ANTISPAM_ENABLED;
34  private String antispamCustomNotification;
35 
36  private V2NIMNotificationAntispamConfigBuilder() {
37  }
38 
39  public static V2NIMNotificationAntispamConfigBuilder builder() {
40  return new V2NIMNotificationAntispamConfigBuilder();
41  }
42 
43  public V2NIMNotificationAntispamConfigBuilder withAntispamEnabled(boolean antispamEnabled) {
44  this.antispamEnabled = antispamEnabled;
45  return this;
46  }
47 
48  public V2NIMNotificationAntispamConfigBuilder withAntispamCustomNotification(String antispamCustomNotification) {
49  this.antispamCustomNotification = antispamCustomNotification;
50  return this;
51  }
52 
53  public V2NIMNotificationAntispamConfig build() {
54  return new V2NIMNotificationAntispamConfig(antispamEnabled, antispamCustomNotification);
55  }
56  }
57 }
V2NIMNotificationAntispamConfig(boolean antispamEnabled, String antispamCustomNotification)