Skip to content

Commit 2f6ab64

Browse files
committed
update version to 5.1.1.
1 parent c362186 commit 2f6ab64

File tree

9 files changed

+76
-11
lines changed

9 files changed

+76
-11
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
## 1. 集成
1515
引入sdk包
1616
```xml
17-
<!--以5.1.0版本为例-->
17+
<!--以5.1.1版本为例-->
1818
<dependencies>
1919
<!-- jiguang-sdk -->
2020
<dependency>
2121
<groupId>io.github.jpush</groupId>
2222
<artifactId>jiguang-sdk</artifactId>
23-
<version>5.1.0</version>
23+
<version>5.1.1</version>
2424
</dependency>
2525
</dependencies>
2626
```

example-for-spring/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
<groupId>io.github.jpush</groupId>
1515
<artifactId>example-for-spring</artifactId>
16-
<version>5.1.0</version>
16+
<version>5.1.1</version>
1717

1818
<properties>
1919
<maven.compiler.source>8</maven.compiler.source>
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>io.github.jpush</groupId>
2828
<artifactId>jiguang-sdk</artifactId>
29-
<version>5.1.0</version>
29+
<version>5.1.1</version>
3030
</dependency>
3131
<!-- lombok -->
3232
<dependency>

example-for-spring/src/test/java/cn/jiguang/app/api/PushApiTest.java

+37-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
import cn.jiguang.sdk.bean.push.PushSendResult;
1111
import cn.jiguang.sdk.bean.push.audience.Audience;
1212
import cn.jiguang.sdk.bean.push.message.notification.NotificationMessage;
13+
import cn.jiguang.sdk.bean.push.options.Options;
1314
import cn.jiguang.sdk.bean.push.other.CidGetResult;
1415
import cn.jiguang.sdk.bean.push.other.QuotaGetResult;
1516
import cn.jiguang.sdk.constants.ApiConstants;
1617
import cn.jiguang.sdk.enums.platform.Platform;
18+
import com.fasterxml.jackson.databind.ObjectMapper;
1719
import lombok.extern.slf4j.Slf4j;
1820
import org.junit.Test;
1921
import org.junit.runner.RunWith;
@@ -23,6 +25,8 @@
2325

2426
import java.io.File;
2527
import java.util.Arrays;
28+
import java.util.HashMap;
29+
import java.util.Map;
2630

2731
@Slf4j
2832
@SpringBootTest()
@@ -32,6 +36,9 @@ public class PushApiTest {
3236
@Autowired
3337
private PushApi pushApi;
3438

39+
@Autowired
40+
private ObjectMapper objectMapper;
41+
3542
@Test
3643
public void getCidForPush() {
3744
CidGetResult result = pushApi.getCidForPush(10);
@@ -45,18 +52,35 @@ public void send() {
4552
NotificationMessage.Android android = new NotificationMessage.Android();
4653
android.setAlert("this is android alert");
4754
android.setTitle("this is android title");
55+
56+
NotificationMessage.IOS iOS = new NotificationMessage.IOS();
57+
Map<String, String> iOSAlert = new HashMap<>();
58+
iOSAlert.put("title", "this is iOS title");
59+
iOSAlert.put("subtitle", "this is iOS subtitle");
60+
iOS.setAlert(iOSAlert);
61+
62+
Map<String, Object> extrasMap = new HashMap<>();
63+
Map<String, Object> extrasParamMap = new HashMap<>();
64+
extrasParamMap.put("key1", "value1");
65+
extrasParamMap.put("key2", "value2");
66+
extrasMap.put("params", extrasParamMap);
67+
android.setExtras(extrasMap);
68+
iOS.setExtras(extrasMap);
69+
4870
NotificationMessage notificationMessage = new NotificationMessage();
4971
notificationMessage.setAlert("this is alert");
5072
notificationMessage.setAndroid(android);
73+
notificationMessage.setIos(iOS);
5174
param.setNotification(notificationMessage);
5275

5376
// 目标人群
5477
Audience audience = new Audience();
5578
audience.setRegistrationIdList(Arrays.asList("1104a89793af2cfc030", "1104a89793af2cfc030"));
5679
// 指定目标
57-
param.setAudience(audience);
80+
// param.setAudience(audience);
81+
5882
// 或者发送所有人
59-
// param.setAudience(ApiConstants.Audience.ALL);
83+
param.setAudience(ApiConstants.Audience.ALL);
6084

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

99+
// options
100+
Options options = new Options();
101+
Map<String, Object> thirdPartyMap = new HashMap<>();
102+
Map<String, Object> huaweiMap = new HashMap<>();
103+
huaweiMap.put("distribution", "first_ospush");
104+
huaweiMap.put("importance", "NORMAL");
105+
huaweiMap.put("category", "MARKETING");
106+
thirdPartyMap.put("huawei", huaweiMap);
107+
options.setThirdPartyChannel(thirdPartyMap);
108+
param.setOptions(options);
109+
75110
// 发送
76111
PushSendResult result = pushApi.send(param);
77112
log.info("result:{}", result);

jiguang-sdk/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
<parent>
88
<groupId>io.github.jpush</groupId>
99
<artifactId>jiguang-sdk-java</artifactId>
10-
<version>5.1.0</version>
10+
<version>5.1.1</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

1414
<groupId>io.github.jpush</groupId>
1515
<artifactId>jiguang-sdk</artifactId>
16-
<version>5.1.0</version>
16+
<version>5.1.1</version>
1717
<packaging>jar</packaging>
1818

1919
<properties>

jiguang-sdk/src/main/java/cn/jiguang/sdk/bean/push/message/custom/CustomMessage.java

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public class CustomMessage {
3131
@JsonInclude(JsonInclude.Include.NON_NULL)
3232
public String contentType;
3333

34+
/**
35+
* 这里的Object,可以是基础数据类型
36+
*/
3437
@JsonProperty("extras")
3538
@JsonInclude(JsonInclude.Include.NON_NULL)
3639
public Map<String, Object> extras;

jiguang-sdk/src/main/java/cn/jiguang/sdk/bean/push/message/liveactivity/LiveActivityMessage.java

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public static class LiveActivityIOS {
1818
@JsonProperty("event")
1919
private Event event;
2020

21+
/**
22+
* 这里的Object,可以是基础数据类型
23+
*/
2124
@JsonProperty("content-state")
2225
@JsonInclude(JsonInclude.Include.NON_NULL)
2326
private Map<String, Object> contentState;

jiguang-sdk/src/main/java/cn/jiguang/sdk/bean/push/message/notification/NotificationMessage.java

+23-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Map;
1111

1212
/**
13-
* 可设置字段,详情参考<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push">Android</a>
13+
* 可设置字段,详情参考<a href="https://docs.jiguang.cn/jpush/server/push/rest_api_v3_push">Notification</a>
1414
*/
1515
@Data
1616
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -82,6 +82,9 @@ public static class Android {
8282
@JsonInclude(JsonInclude.Include.NON_NULL)
8383
private String bigText;
8484

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

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

155161
@Data
156162
public static class IOS {
163+
/**
164+
* 这里的Object,可以是String类型,也可以是Map<String,Object>
165+
*/
157166
@JsonProperty("alert")
158167
@JsonInclude(JsonInclude.Include.NON_NULL)
159168
private Object alert;
160169

170+
/**
171+
* 这里的Object,可以是String类型,也可以是Map<String,Object>
172+
*/
161173
@JsonProperty("sound")
162174
@JsonInclude(JsonInclude.Include.NON_NULL)
163175
private Object sound;
164176

165177
@JsonProperty("badge")
166178
@JsonInclude(JsonInclude.Include.NON_NULL)
167-
private Object badge;
179+
private String badge;
168180

169181
@JsonProperty("content-available")
170182
@JsonInclude(JsonInclude.Include.NON_NULL)
@@ -178,6 +190,9 @@ public static class IOS {
178190
@JsonInclude(JsonInclude.Include.NON_NULL)
179191
private String category;
180192

193+
/**
194+
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
195+
*/
181196
@JsonProperty("extras")
182197
@JsonInclude(JsonInclude.Include.NON_NULL)
183198
private Map<String, Object> extras;
@@ -217,6 +232,9 @@ public static class HMOS {
217232
@JsonInclude(JsonInclude.Include.NON_NULL)
218233
private Integer badgeAddNumber;
219234

235+
/**
236+
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
237+
*/
220238
@JsonProperty("extras")
221239
@JsonInclude(JsonInclude.Include.NON_NULL)
222240
private Map<String, Object> extras;
@@ -251,6 +269,9 @@ public static class QuickApp {
251269
@JsonInclude(JsonInclude.Include.NON_NULL)
252270
private String page;
253271

272+
/**
273+
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
274+
*/
254275
@JsonProperty("extras")
255276
@JsonInclude(JsonInclude.Include.NON_NULL)
256277
private Map<String, Object> extras;

jiguang-sdk/src/main/java/cn/jiguang/sdk/bean/push/message/notification/ThirdNotificationMessage.java

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public class ThirdNotificationMessage {
5050
@JsonInclude(JsonInclude.Include.NON_NULL)
5151
private String channelId;
5252

53+
/**
54+
* 这里的Object,可以是基础数据类型,也可以是Map<String,Object>
55+
*/
5356
@JsonProperty("extras")
5457
@JsonInclude(JsonInclude.Include.NON_NULL)
5558
private Map<String, Object> extras;

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.jpush</groupId>
88
<artifactId>jiguang-sdk-java</artifactId>
9-
<version>5.1.0</version>
9+
<version>5.1.1</version>
1010
<packaging>pom</packaging>
1111

1212
<name>Jiguang SDK For Rest Api</name>

0 commit comments

Comments
 (0)