Skip to content

Commit

Permalink
update version to 5.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
wicked-tc130 committed Jun 24, 2024
1 parent c362186 commit 2f6ab64
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
## 1. 集成
引入sdk包
```xml
<!--以5.1.0版本为例-->
<!--以5.1.1版本为例-->
<dependencies>
<!-- jiguang-sdk -->
<dependency>
<groupId>io.github.jpush</groupId>
<artifactId>jiguang-sdk</artifactId>
<version>5.1.0</version>
<version>5.1.1</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.1.0</version>
<version>5.1.1</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.1.0</version>
<version>5.1.1</version>
</dependency>
<!-- lombok -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import cn.jiguang.sdk.bean.push.PushSendResult;
import cn.jiguang.sdk.bean.push.audience.Audience;
import cn.jiguang.sdk.bean.push.message.notification.NotificationMessage;
import cn.jiguang.sdk.bean.push.options.Options;
import cn.jiguang.sdk.bean.push.other.CidGetResult;
import cn.jiguang.sdk.bean.push.other.QuotaGetResult;
import cn.jiguang.sdk.constants.ApiConstants;
import cn.jiguang.sdk.enums.platform.Platform;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand All @@ -23,6 +25,8 @@

import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

@Slf4j
@SpringBootTest()
Expand All @@ -32,6 +36,9 @@ public class PushApiTest {
@Autowired
private PushApi pushApi;

@Autowired
private ObjectMapper objectMapper;

@Test
public void getCidForPush() {
CidGetResult result = pushApi.getCidForPush(10);
Expand All @@ -45,18 +52,35 @@ public void send() {
NotificationMessage.Android android = new NotificationMessage.Android();
android.setAlert("this is android alert");
android.setTitle("this is android title");

NotificationMessage.IOS iOS = new NotificationMessage.IOS();
Map<String, String> iOSAlert = new HashMap<>();
iOSAlert.put("title", "this is iOS title");
iOSAlert.put("subtitle", "this is iOS subtitle");
iOS.setAlert(iOSAlert);

Map<String, Object> extrasMap = new HashMap<>();
Map<String, Object> extrasParamMap = new HashMap<>();
extrasParamMap.put("key1", "value1");
extrasParamMap.put("key2", "value2");
extrasMap.put("params", extrasParamMap);
android.setExtras(extrasMap);
iOS.setExtras(extrasMap);

NotificationMessage notificationMessage = new NotificationMessage();
notificationMessage.setAlert("this is alert");
notificationMessage.setAndroid(android);
notificationMessage.setIos(iOS);
param.setNotification(notificationMessage);

// 目标人群
Audience audience = new Audience();
audience.setRegistrationIdList(Arrays.asList("1104a89793af2cfc030", "1104a89793af2cfc030"));
// 指定目标
param.setAudience(audience);
// param.setAudience(audience);

// 或者发送所有人
// param.setAudience(ApiConstants.Audience.ALL);
param.setAudience(ApiConstants.Audience.ALL);

// 指定平台
param.setPlatform(Arrays.asList(Platform.android, Platform.ios));
Expand All @@ -72,6 +96,17 @@ public void send() {
// 回调
// param.setCallback();

// options
Options options = new Options();
Map<String, Object> thirdPartyMap = new HashMap<>();
Map<String, Object> huaweiMap = new HashMap<>();
huaweiMap.put("distribution", "first_ospush");
huaweiMap.put("importance", "NORMAL");
huaweiMap.put("category", "MARKETING");
thirdPartyMap.put("huawei", huaweiMap);
options.setThirdPartyChannel(thirdPartyMap);
param.setOptions(options);

// 发送
PushSendResult result = pushApi.send(param);
log.info("result:{}", result);
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.1.0</version>
<version>5.1.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

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

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class CustomMessage {
@JsonInclude(JsonInclude.Include.NON_NULL)
public String contentType;

/**
* 这里的Object,可以是基础数据类型
*/
@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
public Map<String, Object> extras;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public static class LiveActivityIOS {
@JsonProperty("event")
private Event event;

/**
* 这里的Object,可以是基础数据类型
*/
@JsonProperty("content-state")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> contentState;
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_v3_push">Android</a>
* 可设置字段,详情参考<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push">Notification</a>
*/
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down Expand Up @@ -82,6 +82,9 @@ public static class Android {
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bigText;

/**
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
*/
@JsonProperty("inbox")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> inbox;
Expand All @@ -90,6 +93,9 @@ public static class Android {
@JsonInclude(JsonInclude.Include.NON_NULL)
private String bigPicture;

/**
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
*/
@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;
Expand Down Expand Up @@ -154,17 +160,23 @@ public static class Intent {

@Data
public static class IOS {
/**
* 这里的Object,可以是String类型,也可以是Map<String,Object>
*/
@JsonProperty("alert")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Object alert;

/**
* 这里的Object,可以是String类型,也可以是Map<String,Object>
*/
@JsonProperty("sound")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Object sound;

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

@JsonProperty("content-available")
@JsonInclude(JsonInclude.Include.NON_NULL)
Expand All @@ -178,6 +190,9 @@ public static class IOS {
@JsonInclude(JsonInclude.Include.NON_NULL)
private String category;

/**
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
*/
@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;
Expand Down Expand Up @@ -217,6 +232,9 @@ public static class HMOS {
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer badgeAddNumber;

/**
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
*/
@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;
Expand Down Expand Up @@ -251,6 +269,9 @@ public static class QuickApp {
@JsonInclude(JsonInclude.Include.NON_NULL)
private String page;

/**
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
*/
@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public class ThirdNotificationMessage {
@JsonInclude(JsonInclude.Include.NON_NULL)
private String channelId;

/**
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
*/
@JsonProperty("extras")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, Object> extras;
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.1.0</version>
<version>5.1.1</version>
<packaging>pom</packaging>

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

0 comments on commit 2f6ab64

Please sign in to comment.