Skip to content

Commit

Permalink
Merge pull request #92 from jpush/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
KenChoi1992 committed Sep 22, 2017
2 parents 7fc2b03 + db012b1 commit 74d2e5d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -26,7 +26,7 @@
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.1</version>
<version>3.3.2</version>
</dependency>
```
### jar 包方式
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -3,7 +3,7 @@

<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.3.3-SNAPSHOT</version>
<packaging>jar</packaging>
<url>https://github.com/jpush/jpush-api-java-client</url>
<name>JPush API Java Client</name>
Expand Down Expand Up @@ -35,7 +35,7 @@
<url>https://github.com/jpush/jpush-api-java-client</url>
<connection>scm:git:git@github.com:jpush/jpush-api-java-client.git</connection>
<developerConnection>scm:git:git@github.com:jpush/jpush-api-java-client.git</developerConnection>
<tag>v3.3.1</tag>
<tag>v3.3.2</tag>
</scm>

<dependencies>
Expand Down
19 changes: 16 additions & 3 deletions src/main/java/cn/jpush/api/push/model/Options.java
Expand Up @@ -14,6 +14,7 @@ public class Options implements PushModel {
private static final String TIME_TO_LIVE = "time_to_live";
private static final String APNS_PRODUCTION = "apns_production";
private static final String BIG_PUSH_DURATION = "big_push_duration";
private static final String APNS_COLLAPSE_ID = "apns_collapse_id";

private static final long NONE_TIME_TO_LIVE = -1;

Expand All @@ -22,14 +23,16 @@ public class Options implements PushModel {
private long timeToLive;
private boolean apnsProduction;
private int bigPushDuration; // minutes
private String apnsCollapseId;

private Options(int sendno, long overrideMsgId, long timeToLive, boolean apnsProduction,
int bigPushDuration) {
int bigPushDuration, String apnsCollapseId) {
this.sendno = sendno;
this.overrideMsgId = overrideMsgId;
this.timeToLive = timeToLive;
this.apnsProduction = apnsProduction;
this.bigPushDuration = bigPushDuration;
this.apnsCollapseId = apnsCollapseId;
}

public static Builder newBuilder() {
Expand Down Expand Up @@ -78,6 +81,10 @@ public JsonElement toJSON() {
if (bigPushDuration > 0) {
json.add(BIG_PUSH_DURATION, new JsonPrimitive(bigPushDuration));
}

if (apnsCollapseId != null) {
json.add(APNS_COLLAPSE_ID, new JsonPrimitive(apnsCollapseId));
}

return json;
}
Expand All @@ -88,6 +95,7 @@ public static class Builder {
private long timeToLive = NONE_TIME_TO_LIVE;
private boolean apnsProduction = false;
private int bigPushDuration = 0;
private String apnsCollapseId;

public Builder setSendno(int sendno) {
this.sendno = sendno;
Expand All @@ -108,12 +116,17 @@ public Builder setApnsProduction(boolean apnsProduction) {
this.apnsProduction = apnsProduction;
return this;
}

public Builder setApnsCollapseId(String id) {
this.apnsCollapseId = id;
return this;
}

public Builder setBigPushDuration(int bigPushDuration) {
this.bigPushDuration = bigPushDuration;
return this;
}

public Options build() {
Preconditions.checkArgument(sendno >= 0, "sendno should be greater than 0.");
Preconditions.checkArgument(overrideMsgId >= 0, "override_msg_id should be greater than 0.");
Expand All @@ -123,7 +136,7 @@ public Options build() {
sendno = ServiceHelper.generateSendno();
}

return new Options(sendno, overrideMsgId, timeToLive, apnsProduction, bigPushDuration);
return new Options(sendno, overrideMsgId, timeToLive, apnsProduction, bigPushDuration, apnsCollapseId);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/cn/jpush/api/BaseTest.java
Expand Up @@ -5,7 +5,7 @@
public abstract class BaseTest {

protected static final String APP_KEY = "d4ee2375846bc30fa51334f5";
protected static final String MASTER_SECRET = "f88f9b289c3f681eef0b95ee";
protected static final String MASTER_SECRET = "1bdab6d2cb99727cf768cc9c";
protected static final String GROUP_MASTER_SECRET = "b11314807507e2bcfdeebe2e";
protected static final String GROUP_PUSH_KEY = "2c88a01e073a0fe4fc7b167c";

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/cn/jpush/api/report/ReportFunctionTests.java
Expand Up @@ -31,7 +31,7 @@ public void getReceivedsFixed() throws Exception {

@Test
public void getReceivedsFixed2() throws Exception {
ReceivedsResult result = jpushClient.getReportReceiveds("1613113584, 1229760629, ");
ReceivedsResult result = jpushClient.getReportReceiveds("1613113584, 1229760629");
assertTrue(result.isResultOK());
assertTrue(result.received_list.size() > 0);
}
Expand Down

0 comments on commit 74d2e5d

Please sign in to comment.