Skip to content

Commit

Permalink
Merge pull request #132 from jpush/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
JoshLipan authored Dec 24, 2018
2 parents b01f0fb + 559ee4f commit c0dcac5
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
## 安装

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

```Java
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.9</version>
<version>3.3.10</version>
</dependency>
```
### jar 包方式
Expand All @@ -33,6 +33,7 @@


### 依赖包
* [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)
* [slf4j](http://www.slf4j.org/) / log4j (Logger)
* [gson](https://code.google.com/p/google-gson/) (Google JSON Utils)

Expand All @@ -44,7 +45,7 @@
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jiguang-common</artifactId>
<version>1.1.3</version>
<version>1.1.4</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.3.10-SNAPSHOT</version>
<version>3.3.11-SNAPSHOT</version>
<packaging>jar</packaging>
<url>https://github.com/jpush/jpush-api-java-client</url>
<name>JPush API Java Client</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cn/jpush/api/push/model/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public JsonElement toJSON() {
}

JsonObject extrasObject = null;
if (null != extras || null != numberExtras || null != booleanExtras) {
if (null != extras || null != numberExtras || null != booleanExtras || null != jsonExtras){
extrasObject = new JsonObject();
}

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

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


private IosNotification(Object alert, Object sound, String badge,
boolean contentAvailable, boolean soundDisabled, boolean badgeDisabled,
String category, boolean mutableContent,
String category, boolean mutableContent,String threadId,
Map<String, String> extras,
Map<String, Number> numberExtras,
Map<String, Boolean> booleanExtras,
Expand All @@ -67,6 +72,7 @@ private IosNotification(Object alert, Object sound, String badge,
this.badgeDisabled = badgeDisabled;
this.category = category;
this.mutableContent = mutableContent;
this.threadId = threadId;
}

public static Builder newBuilder() {
Expand Down Expand Up @@ -115,6 +121,9 @@ public JsonElement toJSON() {
if (mutableContent) {
json.add(MUTABLE_CONTENT, new JsonPrimitive(true));
}
if (null != threadId) {
json.add(THREAD_ID, new JsonPrimitive(threadId));
}

return json;
}
Expand All @@ -128,6 +137,7 @@ public static class Builder extends PlatformNotification.Builder<IosNotification
private boolean badgeDisabled = false;
private String category;
private boolean mutableContent;
private String threadId;

protected Builder getThis() {
return this;
Expand Down Expand Up @@ -202,11 +212,16 @@ public Builder setMutableContent(boolean mutableContent) {
this.mutableContent = mutableContent;
return this;
}

public Builder setThreadId(String threadId) {
this.threadId = threadId;
return this;
}


public IosNotification build() {
return new IosNotification(alert, sound, badge, contentAvailable,
soundDisabled, badgeDisabled, category, mutableContent,
soundDisabled, badgeDisabled, category, mutableContent, threadId,
extrasBuilder, numberExtrasBuilder, booleanExtrasBuilder, jsonExtrasBuilder);
}
}
Expand Down

0 comments on commit c0dcac5

Please sign in to comment.