Skip to content

Commit c0dcac5

Browse files
authored
Merge pull request #132 from jpush/dev
Dev
2 parents b01f0fb + 559ee4f commit c0dcac5

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
## 安装
1919

2020
### maven 方式
21-
将下边的依赖条件放到你项目的 maven pom.xml 文件里。
21+
将下边的依赖条件放到你项目的 maven pom.xml 文件里。v3.3.10 为例,最新版本请看[Release页面](https://github.com/jpush/jpush-api-java-client/releases)
2222

2323
```Java
2424
<dependency>
2525
<groupId>cn.jpush.api</groupId>
2626
<artifactId>jpush-client</artifactId>
27-
<version>3.3.9</version>
27+
<version>3.3.10</version>
2828
</dependency>
2929
```
3030
### jar 包方式
@@ -33,6 +33,7 @@
3333

3434

3535
### 依赖包
36+
* [jiguang-java-client-common](https://github.com/jpush/jiguang-java-client-common) / 极光 Java client 的公共封装开发包,必须依赖,v1.1.4 为例,查看[最新版本](https://github.com/jpush/jiguang-java-client-common/releases)
3637
* [slf4j](http://www.slf4j.org/) / log4j (Logger)
3738
* [gson](https://code.google.com/p/google-gson/) (Google JSON Utils)
3839

@@ -44,7 +45,7 @@
4445
<dependency>
4546
<groupId>cn.jpush.api</groupId>
4647
<artifactId>jiguang-common</artifactId>
47-
<version>1.1.3</version>
48+
<version>1.1.4</version>
4849
</dependency>
4950
<dependency>
5051
<groupId>io.netty</groupId>

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>cn.jpush.api</groupId>
55
<artifactId>jpush-client</artifactId>
6-
<version>3.3.10-SNAPSHOT</version>
6+
<version>3.3.11-SNAPSHOT</version>
77
<packaging>jar</packaging>
88
<url>https://github.com/jpush/jpush-api-java-client</url>
99
<name>JPush API Java Client</name>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public JsonElement toJSON() {
6060
}
6161

6262
JsonObject extrasObject = null;
63-
if (null != extras || null != numberExtras || null != booleanExtras) {
63+
if (null != extras || null != numberExtras || null != booleanExtras || null != jsonExtras){
6464
extrasObject = new JsonObject();
6565
}
6666

src/main/java/cn/jpush/api/push/model/notification/IosNotification.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
* <li>badge: 支持 setBadge(int) 方法来设置;支持 incrBadge(int) 方法来增加。</li>
1818
* <li>sound: 支持 setSound(string) 方法来设置声音文件。或者 setSound(JSON object) 对应官方payload结构 </li>
1919
* <li>content-available: 用来支持后台推送。如果该值赋值为 1,表示开启后台推送。</li>
20+
* <li>mutable-content: 通知扩展</li>
21+
* <li>category: IOS 8 才支持。设置 APNs payload 中的 "category" 字段值</li>
22+
* <li>mutable-content: 通知扩展</li>
2023
* <li>extras: JSON object. 支持更多的自定义字段信息。</li>
2124
* </ul>
2225
* <br>
@@ -37,6 +40,7 @@ public class IosNotification extends PlatformNotification {
3740
private static final String CONTENT_AVAILABLE = "content-available";
3841
private static final String MUTABLE_CONTENT = "mutable-content";
3942
private static final String CATEGORY = "category";
43+
private static final String THREAD_ID = "thread-id";
4044

4145
private static final String ALERT_VALID_BADGE = "Badge number should be 0~99999, "
4246
+ "and can be prefixed with + to add, - to minus";
@@ -49,11 +53,12 @@ public class IosNotification extends PlatformNotification {
4953
private final boolean contentAvailable;
5054
private final String category;
5155
private final boolean mutableContent;
56+
private final String threadId;
5257

5358

5459
private IosNotification(Object alert, Object sound, String badge,
5560
boolean contentAvailable, boolean soundDisabled, boolean badgeDisabled,
56-
String category, boolean mutableContent,
61+
String category, boolean mutableContent,String threadId,
5762
Map<String, String> extras,
5863
Map<String, Number> numberExtras,
5964
Map<String, Boolean> booleanExtras,
@@ -67,6 +72,7 @@ private IosNotification(Object alert, Object sound, String badge,
6772
this.badgeDisabled = badgeDisabled;
6873
this.category = category;
6974
this.mutableContent = mutableContent;
75+
this.threadId = threadId;
7076
}
7177

7278
public static Builder newBuilder() {
@@ -115,6 +121,9 @@ public JsonElement toJSON() {
115121
if (mutableContent) {
116122
json.add(MUTABLE_CONTENT, new JsonPrimitive(true));
117123
}
124+
if (null != threadId) {
125+
json.add(THREAD_ID, new JsonPrimitive(threadId));
126+
}
118127

119128
return json;
120129
}
@@ -128,6 +137,7 @@ public static class Builder extends PlatformNotification.Builder<IosNotification
128137
private boolean badgeDisabled = false;
129138
private String category;
130139
private boolean mutableContent;
140+
private String threadId;
131141

132142
protected Builder getThis() {
133143
return this;
@@ -202,11 +212,16 @@ public Builder setMutableContent(boolean mutableContent) {
202212
this.mutableContent = mutableContent;
203213
return this;
204214
}
215+
216+
public Builder setThreadId(String threadId) {
217+
this.threadId = threadId;
218+
return this;
219+
}
205220

206221

207222
public IosNotification build() {
208223
return new IosNotification(alert, sound, badge, contentAvailable,
209-
soundDisabled, badgeDisabled, category, mutableContent,
224+
soundDisabled, badgeDisabled, category, mutableContent, threadId,
210225
extrasBuilder, numberExtrasBuilder, booleanExtrasBuilder, jsonExtrasBuilder);
211226
}
212227
}

0 commit comments

Comments
 (0)