-
Notifications
You must be signed in to change notification settings - Fork 285
Added WebpushNotification.Builder API with additional Webpush parameters #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
/** | ||
* Sets any arbitrary data that should be associated with the notification. | ||
* | ||
* @param data A json-serializable object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/json/JSON/ :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -35,12 +35,12 @@ | |||
private final Map<String, String> data; | |||
|
|||
@Key("notification") | |||
private final WebpushNotification notification; | |||
private final Map<String, Object> notification; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't quite follow where this private fields are ever read. Can you elaborate?
I am asking this because I liked using WebpushNotification
here better but I can see reason why the Map would be more appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these get serialized into JSON. We now need a Map because the notification now allows arbitrary key-value pairs (via putCustomData()
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schmidt-sebastian made the suggested change.
@@ -35,12 +35,12 @@ | |||
private final Map<String, String> data; | |||
|
|||
@Key("notification") | |||
private final WebpushNotification notification; | |||
private final Map<String, Object> notification; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these get serialized into JSON. We now need a Map because the notification now allows arbitrary key-value pairs (via putCustomData()
).
/** | ||
* Sets any arbitrary data that should be associated with the notification. | ||
* | ||
* @param data A json-serializable object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for enlightening me!
FCM Webpush API now supports additional parameters as defined in https://developer.mozilla.org/en-US/docs/Web/API/notification/Notification
Related to firebase/firebase-admin-node#305