Skip to content

Commit 853a097

Browse files
KenChoiKenChoi
authored andcommitted
add field apnsCollapseId
1 parent 1ada40b commit 853a097

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>cn.jpush.api</groupId>
2828
<artifactId>jpush-client</artifactId>
29-
<version>3.3.1</version>
29+
<version>3.3.2</version>
3030
</dependency>
3131
```
3232
### jar 包方式

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<url>https://github.com/jpush/jpush-api-java-client</url>
3636
<connection>scm:git:git@github.com:jpush/jpush-api-java-client.git</connection>
3737
<developerConnection>scm:git:git@github.com:jpush/jpush-api-java-client.git</developerConnection>
38-
<tag>v3.3.1</tag>
38+
<tag>v3.3.2</tag>
3939
</scm>
4040

4141
<dependencies>

src/main/java/cn/jpush/api/push/model/Options.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public class Options implements PushModel {
1414
private static final String TIME_TO_LIVE = "time_to_live";
1515
private static final String APNS_PRODUCTION = "apns_production";
1616
private static final String BIG_PUSH_DURATION = "big_push_duration";
17+
private static final String APNS_COLLAPSE_ID = "apns_collapse_id";
1718

1819
private static final long NONE_TIME_TO_LIVE = -1;
1920

@@ -22,14 +23,16 @@ public class Options implements PushModel {
2223
private long timeToLive;
2324
private boolean apnsProduction;
2425
private int bigPushDuration; // minutes
26+
private String apnsCollapseId;
2527

2628
private Options(int sendno, long overrideMsgId, long timeToLive, boolean apnsProduction,
27-
int bigPushDuration) {
29+
int bigPushDuration, String apnsCollapseId) {
2830
this.sendno = sendno;
2931
this.overrideMsgId = overrideMsgId;
3032
this.timeToLive = timeToLive;
3133
this.apnsProduction = apnsProduction;
3234
this.bigPushDuration = bigPushDuration;
35+
this.apnsCollapseId = apnsCollapseId;
3336
}
3437

3538
public static Builder newBuilder() {
@@ -78,6 +81,10 @@ public JsonElement toJSON() {
7881
if (bigPushDuration > 0) {
7982
json.add(BIG_PUSH_DURATION, new JsonPrimitive(bigPushDuration));
8083
}
84+
85+
if (apnsCollapseId != null) {
86+
json.add(APNS_COLLAPSE_ID, new JsonPrimitive(apnsCollapseId));
87+
}
8188

8289
return json;
8390
}
@@ -88,6 +95,7 @@ public static class Builder {
8895
private long timeToLive = NONE_TIME_TO_LIVE;
8996
private boolean apnsProduction = false;
9097
private int bigPushDuration = 0;
98+
private String apnsCollapseId;
9199

92100
public Builder setSendno(int sendno) {
93101
this.sendno = sendno;
@@ -108,12 +116,17 @@ public Builder setApnsProduction(boolean apnsProduction) {
108116
this.apnsProduction = apnsProduction;
109117
return this;
110118
}
119+
120+
public Builder setApnsCollapseId(String id) {
121+
this.apnsCollapseId = id;
122+
return this;
123+
}
111124

112125
public Builder setBigPushDuration(int bigPushDuration) {
113126
this.bigPushDuration = bigPushDuration;
114127
return this;
115128
}
116-
129+
117130
public Options build() {
118131
Preconditions.checkArgument(sendno >= 0, "sendno should be greater than 0.");
119132
Preconditions.checkArgument(overrideMsgId >= 0, "override_msg_id should be greater than 0.");
@@ -123,7 +136,7 @@ public Options build() {
123136
sendno = ServiceHelper.generateSendno();
124137
}
125138

126-
return new Options(sendno, overrideMsgId, timeToLive, apnsProduction, bigPushDuration);
139+
return new Options(sendno, overrideMsgId, timeToLive, apnsProduction, bigPushDuration, apnsCollapseId);
127140
}
128141
}
129142

0 commit comments

Comments
 (0)