Skip to content

Commit 364e9a3

Browse files
PubNub SDK v4.31.2 release.
1 parent f8a3d9d commit 364e9a3

File tree

10 files changed

+65
-32
lines changed

10 files changed

+65
-32
lines changed

.pubnub.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
name: java
2-
version: 4.31.1
2+
version: 4.31.2
33
schema: 1
44
scm: github.com/pubnub/java
55
files:
6-
- build/libs/pubnub-gson-4.31.1-all.jar
6+
- build/libs/pubnub-gson-4.31.2-all.jar
77
changelog:
8+
-
9+
version: v4.31.2
10+
date: 2020-06-13
11+
changes:
12+
-
13+
type: feature
14+
text: "Add \"click_action\" parameter to PushPayloadHelper in order to pass it to FCM."
815
- version: v4.31.1
916
date: 2020-04-16
1017
changes:

.travis.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1+
jdk: oraclejdk8
12
language: java
2-
sudo: false
33
dist: trusty
4-
jdk:
5-
- oraclejdk8
4+
os: linux
5+
66

77
before_install:
88
- wget https://oss.sonatype.org/service/local/repositories/releases/content/com/codacy/codacy-coverage-reporter/2.0.0/codacy-coverage-reporter-2.0.0-assembly.jar
99

10-
after_success:
11-
- java -cp ~/codacy-coverage-reporter-2.0.0-assembly.jar com.codacy.CodacyCoverageReporter -l Java -r build/reports/jacoco/test/jacocoTestReport.xml
12-
addons:
13-
10+
install: skip
11+
12+
13+
stages:
14+
- name: "test"
15+
16+
jobs:
17+
include:
18+
- stage: "test"
19+
name: "Build & test"
20+
script:
21+
- ./gradlew assemble
22+
- ./gradlew check
23+
after_success:
24+
- java -cp ~/codacy-coverage-reporter-2.0.0-assembly.jar com.codacy.CodacyCoverageReporter -l Java -r build/reports/jacoco/test/jacocoTestReport.xml

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [v4.31.2](https://github.com/pubnub/java/releases/tag/v4.31.2)
2+
June-13-2020
3+
4+
[Full Changelog](https://github.com/pubnub/java/compare/v4.31.1...v4.31.2)
5+
6+
- 🌟️ Add "click_action" parameter to PushPayloadHelper in order to pass it to FCM.
7+
18
## [v4.29.2](https://github.com/pubnub/java/tree/v4.29.2)
29
December-03-2019
310

@@ -785,5 +792,3 @@
785792

786793

787794
- ⭐initial beta1.
788-
789-

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
### PubNub Java-based SDKs for Java / Android
44

5-
65
[![Build Status](https://travis-ci.org/pubnub/java.svg?branch=master)](https://travis-ci.org/pubnub/java)
76
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/164fd518c314417e896b3de494ab75df)](https://www.codacy.com/app/PubNub/java?utm_source=github.com&utm_medium=referral&utm_content=pubnub/java&utm_campaign=Badge_Grade)
87
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/164fd518c314417e896b3de494ab75df)](https://www.codacy.com/app/PubNub/java?utm_source=github.com&utm_medium=referral&utm_content=pubnub/java&utm_campaign=Badge_Coverage)

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ nexus {
117117
modifyPom {
118118
project {
119119
name 'PubNub Java SDK'
120-
description 'PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of\n' +
121-
' broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter\n' +
120+
description 'PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of\\n' +
121+
' broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter\\n' +
122122
' second!'
123123
url 'https://github.com/pubnub/java'
124124
inceptionYear '2009'
36.4 MB
Binary file not shown.

src/main/java/com/pubnub/api/PubNub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class PubNub {
9191
private static final int TIMESTAMP_DIVIDER = 1000;
9292
private static final int MAX_SEQUENCE = 65535;
9393

94-
private static final String SDK_VERSION = "4.31.1";
94+
private static final String SDK_VERSION = "4.31.2";
9595

9696
public PubNub(@NotNull PNConfiguration initialConfig) {
9797
this.configuration = initialConfig;

src/main/java/com/pubnub/api/models/consumer/push/payload/PushPayloadHelper.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -225,23 +225,34 @@ public Map<String, Object> toMap() {
225225
@Setter
226226
@Accessors(chain = true)
227227
public static class Notification implements PushPayloadSerializer {
228-
private String title;
229-
private String body;
230-
private String image;
228+
private Map<String, Object> parametersMap = new HashMap();
229+
230+
public Notification set(String parameterName, Object parameterValue) {
231+
parametersMap.put(parameterName, parameterValue);
232+
return this;
233+
}
234+
235+
public Notification setTitle(String title) {
236+
set("title", title);
237+
return this;
238+
}
239+
240+
public Notification setBody(String body) {
241+
set("body", body);
242+
return this;
243+
}
244+
public Notification setImage(String image) {
245+
set("image", image);
246+
return this;
247+
}
248+
public Notification setClickAction(String clickAction) {
249+
set("click_action", clickAction);
250+
return this;
251+
}
231252

232253
@Override
233254
public Map<String, Object> toMap() {
234-
Map<String, Object> map = new HashMap<>();
235-
if (title != null) {
236-
map.put("title", title);
237-
}
238-
if (body != null) {
239-
map.put("body", body);
240-
}
241-
if (image != null) {
242-
map.put("image", image);
243-
}
244-
return map;
255+
return filterNonNullEntries(parametersMap);
245256
}
246257
}
247258
}

src/test/java/com/pubnub/api/PubNubTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void getVersionAndTimeStamp() {
9898
pubnub = new PubNub(pnConfiguration);
9999
String version = pubnub.getVersion();
100100
int timeStamp = pubnub.getTimestamp();
101-
Assert.assertEquals("4.31.1", version);
101+
Assert.assertEquals("4.31.2", version);
102102
Assert.assertTrue(timeStamp > 0);
103103
}
104104

src/test/java/com/pubnub/api/endpoints/push/PushPayloadHelperHelperTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ public void testGoogle_Valid_1() {
337337
.setBody("Notification body")
338338
.setImage(null)
339339
.setTitle("")
340+
.setClickAction("FOO_ACTION")
340341
);
341342

342343
HashMap<String, Object> customFcmPayload = new HashMap<>();
@@ -374,8 +375,7 @@ public void testGoogle_Valid_1() {
374375
Assert.assertEquals(pnFcmNotificationsMap.get("body"), "Notification body");
375376
Assert.assertEquals(pnFcmNotificationsMap.get("image"), null);
376377
Assert.assertEquals(pnFcmNotificationsMap.get("title"), "");
377-
378-
378+
Assert.assertEquals(pnFcmNotificationsMap.get("click_action"), "FOO_ACTION");
379379
}
380380

381381
@Test

0 commit comments

Comments
 (0)