Skip to content

Commit b65ae97

Browse files
committed
Add urgent to notifications
1 parent 87ac947 commit b65ae97

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ notification.imageUrl = "http://example.com/assets/image.png";
5555
notification.ttl = 604800;
5656
// optional, prevent Chrome on desktop from automatically closing the notification after a few seconds
5757
notification.requireInteraction = true;
58+
// optional, enable this option only for time-sensitive alerts (e.g. incoming phone call)
59+
notification.urgent = false;
5860
// optional, a string that is passed as an argument to action button callbacks
5961
notification.customData = "123";
6062
// optional, add some action buttons to the notification

src/xyz/pushpad/Notification.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class Notification {
1818
public String imageUrl;
1919
public Integer ttl;
2020
public Boolean requireInteraction;
21+
public Boolean urgent;
2122
public String customData;
2223
public String[] customMetrics;
2324
public ActionButton[] actionButtons;
@@ -74,6 +75,9 @@ private String reqBody(String[] uids, String[] tags) {
7475
if (this.requireInteraction != null) {
7576
notificationData.put("require_interaction", this.requireInteraction);
7677
}
78+
if (this.urgent != null) {
79+
notificationData.put("urgent", this.urgent);
80+
}
7781
if (this.customData != null) {
7882
notificationData.put("custom_data", this.customData);
7983
}

0 commit comments

Comments
 (0)