Skip to content

Commit 78c6198

Browse files
authored
Added WebpushNotification.Builder API with additional Webpush parameters (#193)
* Added webpush notification fields * Added documentation * Support for adding arbitrary key-value pairs to WebpushNotification * Updated changelog * Added a couple of helper methods for clarity * Updated comment * Renamed setTimestamp to setTimestampMillis as per API review feedback
1 parent 0a1c652 commit 78c6198

File tree

4 files changed

+442
-16
lines changed

4 files changed

+442
-16
lines changed

CHANGELOG.md

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

3-
-
3+
- [added] `WebpushNotification` type now supports arbitrary key-value
4+
pairs in its payload.
45

56
# v6.3.0
67

src/main/java/com/google/firebase/messaging/WebpushConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ public class WebpushConfig {
3535
private final Map<String, String> data;
3636

3737
@Key("notification")
38-
private final WebpushNotification notification;
38+
private final Map<String, Object> notification;
3939

4040
private WebpushConfig(Builder builder) {
4141
this.headers = builder.headers.isEmpty() ? null : ImmutableMap.copyOf(builder.headers);
4242
this.data = builder.data.isEmpty() ? null : ImmutableMap.copyOf(builder.data);
43-
this.notification = builder.notification;
43+
this.notification = builder.notification != null ? builder.notification.getFields() : null;
4444
}
4545

4646
/**

0 commit comments

Comments
 (0)