NIMSDK-AOS  10.10.13
V2NIMNotificationPushConfig.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.v2.notification.config;
2 
4 
5 import java.util.List;
6 
8 
9  // 是否需要推送通知
10  private final boolean pushEnabled;
11  // 是否需要推送通知发送者昵称
12  private final boolean pushNickEnabled;
13  // 推送文案
14  private final String pushContent;
15  // 推送数据
16  private final String pushPayload;
17  // 强制推送,忽略用户通知提醒相关设置,只通知类型有效
18  private final boolean forcePush;
19  // 强制推送文案,只通知类型有效
20  private final String forcePushContent;
21  // 强制推送目标账号列表,只通知类型有效
22  private final List<String> forcePushAccountIds;
23 
24  private V2NIMNotificationPushConfig() {
25  this(DEFAULT_PUSH_ENABLE, DEFAULT_PUSH_NICK_ENABLE, null, null, false, null, null);
26  }
27 
28  private V2NIMNotificationPushConfig(boolean pushEnabled, boolean pushNickEnabled, String pushContent, String pushPayload, boolean forcePush, String forcePushContent, List<String> forcePushAccountIds) {
29  this.pushEnabled = pushEnabled;
30  this.pushNickEnabled = pushNickEnabled;
31  this.pushContent = pushContent;
32  this.pushPayload = pushPayload;
33  this.forcePush = forcePush;
34  this.forcePushContent = forcePushContent;
35  this.forcePushAccountIds = forcePushAccountIds;
36  }
37 
38  public boolean isPushEnabled() {
39  return pushEnabled;
40  }
41 
42  public boolean isPushNickEnabled() {
43  return pushNickEnabled;
44  }
45 
46  public String getPushContent() {
47  return pushContent;
48  }
49 
50  public String getPushPayload() {
51  return pushPayload;
52  }
53 
54  public boolean isForcePush() {
55  return forcePush;
56  }
57 
58  public String getForcePushContent() {
59  return forcePushContent;
60  }
61 
62  public List<String> getForcePushAccountIds() {
63  return forcePushAccountIds;
64  }
65 
68 
69  public static final class V2NIMNotificationPushConfigBuilder {
70  private boolean pushEnabled = DEFAULT_PUSH_ENABLE;
71  private boolean pushNickEnabled = DEFAULT_PUSH_NICK_ENABLE;
72  private String pushContent;
73  private String pushPayload;
74  private boolean forcePush;
75  private String forcePushContent;
76  private List<String> forcePushAccountIds;
77 
78  private V2NIMNotificationPushConfigBuilder() {
79  }
80 
81  public static V2NIMNotificationPushConfigBuilder builder() {
82  return new V2NIMNotificationPushConfigBuilder();
83  }
84 
85  public V2NIMNotificationPushConfigBuilder withPushEnabled(boolean pushEnabled) {
86  this.pushEnabled = pushEnabled;
87  return this;
88  }
89 
90  public V2NIMNotificationPushConfigBuilder withPushNickEnabled(boolean pushNickEnabled) {
91  this.pushNickEnabled = pushNickEnabled;
92  return this;
93  }
94 
95  public V2NIMNotificationPushConfigBuilder withPushContent(String pushContent) {
96  this.pushContent = pushContent;
97  return this;
98  }
99 
100  public V2NIMNotificationPushConfigBuilder withPushPayload(String pushPayload) {
101  this.pushPayload = pushPayload;
102  return this;
103  }
104 
105  public V2NIMNotificationPushConfigBuilder withForcePush(boolean forcePush) {
106  this.forcePush = forcePush;
107  return this;
108  }
109 
110  public V2NIMNotificationPushConfigBuilder withForcePushContent(String forcePushContent) {
111  this.forcePushContent = forcePushContent;
112  return this;
113  }
114 
115  public V2NIMNotificationPushConfigBuilder withForcePushAccountIds(List<String> forcePushAccountIds) {
116  this.forcePushAccountIds = forcePushAccountIds;
117  return this;
118  }
119 
120  public V2NIMNotificationPushConfig build() {
121  return new V2NIMNotificationPushConfig(pushEnabled, pushNickEnabled, pushContent, pushPayload, forcePush, forcePushContent, forcePushAccountIds);
122  }
123  }
124 }