Skip to content

Commit

Permalink
support harmonyos, update version to 5.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
wicked-tc130 committed May 21, 2024
1 parent d62a178 commit c362186
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 16 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
这是 Jiguang REST API 的 Java 版本封装开发包,是由极光推送官方提供的,一般支持最新的 API 功能。

对应的 REST API 文档:
* [REST API - Push](https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/)
* [REST API - Device](https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/)
* [REST API - Report](https://docs.jiguang.cn/jpush/server/push/rest_api_v3_report/)
* [REST API - Admin](https://docs.jiguang.cn/jpush/server/push/rest_api_admin_api_v1/)
* [REST API - Push](https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push)
* [REST API - Device](https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device)
* [REST API - Report](https://docs.jiguang.cn/jpush/server/push/rest_api_v3_report)
* [REST API - Admin](https://docs.jiguang.cn/jpush/server/push/rest_api_admin_api_v1)

支持 Java JDK 1.8 及其以上版本。
> 支持 Java JDK 1.6 版本:[jpush-api-java-client](https://github.com/jpush/jpush-api-java-client),但不再更新。
## 1. 集成
引入sdk包
```xml
<!--以5.0.9版本为例-->
<!--以5.1.0版本为例-->
<dependencies>
<!-- jiguang-sdk -->
<dependency>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>
</dependency>
</dependencies>
```
Expand Down
4 changes: 2 additions & 2 deletions example-for-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>io.github.jpush</groupId>
<artifactId>example-for-spring</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand All @@ -26,7 +26,7 @@
<dependency>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>
</dependency>
<!-- lombok -->
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions jiguang-sdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<parent>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk-java</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class PushSendParam {
/**
* 两种格式
* 字符串:"all"
* {@link Platform}数组:["android","ios","quickapp"]
* {@link Platform}数组:["android","ios","hmos","quickapp"]
*/
@JsonProperty("platform")
private Object platform;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public class NotificationMessage {
@JsonInclude(JsonInclude.Include.NON_NULL)
private IOS ios;

@JsonProperty("hmos")
@JsonInclude(JsonInclude.Include.NON_NULL)
private HMOS hmos;

@JsonProperty("quickapp")
@JsonInclude(JsonInclude.Include.NON_NULL)
private QuickApp quickApp;
Expand Down Expand Up @@ -187,6 +191,52 @@ public static class IOS {
private String interruptionLevel;
}

@Data
public static class HMOS {
@JsonProperty("alert")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String alert;

@JsonProperty("title")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String title;

@JsonProperty("category")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String category;

@JsonProperty("large_icon")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String largeIcon;

@JsonProperty("intent")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Android.Intent intent;

@JsonProperty("badge_add_num")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer badgeAddNumber;

@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;

@JsonProperty("test_message")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Boolean isTest;

@JsonProperty("receipt_id")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String receiptId;

@Data
public static class Intent {
@JsonProperty("url")
@JsonInclude(JsonInclude.Include.NON_NULL)
private String url;
}
}

@Data
public static class QuickApp {
@JsonProperty("title")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import feign.RequestLine;

/**
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_admin_api_v1/">REST API - Admin</a>)
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_admin_api_v1">REST API - Admin</a>)
*/
public interface AdminClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import feign.RequestLine;

/**
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device/">REST API - Device</a>)
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_device">REST API - Device</a>)
*/
public interface DeviceClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import feign.RequestLine;

/**
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_report/">REST API - Push</a>)
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push">REST API - Push</a>)
*/
public interface PushClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Map;

/**
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_admin_api_v1/">REST API - Report</a>)
* (<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_report">REST API - Report</a>)
*/
public interface ReportClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface Platform {
String ALL = "all";
String ANDROID = "android";
String IOS = "ios";
String HMOS = "hmos";
String QUICK_APP = "quickapp";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum Platform {

android(ApiConstants.Platform.ANDROID, "Android平台"),
ios(ApiConstants.Platform.IOS, "iOS平台"),
hmos(ApiConstants.Platform.HMOS, "鸿蒙平台"),
quickapp(ApiConstants.Platform.QUICK_APP, "快应用平台");

private String value;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk-java</artifactId>
<version>5.0.9</version>
<version>5.1.0</version>
<packaging>pom</packaging>

<name>Jiguang SDK For Rest Api</name>
Expand Down

0 comments on commit c362186

Please sign in to comment.