-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat: Web Push Options #3889
feat: Web Push Options #3889
Conversation
[source,java] | ||
---- | ||
WebPushAction webPushAction = new WebPushAction("dashboard", "Open Dashboard"); | ||
WebPushOptions webPushOptions = new WebPushOptions( | ||
body, | ||
List.of(webPushAction), | ||
"This is my data", | ||
"https://example.com/my-icon.png" | ||
); | ||
webPush.sendNotification(subscription, new WebPushMessage(title, webPushOptions)); | ||
---- | ||
|
||
`WebPushAction` and `WebPushOptions` records are not part of the Vaadin Web Push API and must be defined within the project. | ||
|
||
[source,java] | ||
---- | ||
public record WebPushAction(String action, String title) implements Serializable { | ||
} | ||
public record WebPushOptions(String body, | ||
List<WebPushAction> actions, | ||
Serializable data, | ||
String icon) implements Serializable { | ||
} | ||
---- |
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.
I would perhaps have these in the reverse order so that the record definitions are shown first to not create confusion on where these are available.
So say for the following records [sample records] they can be used as [sample creation]....
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.
I agree, done.
Could we still rename the file from |
|
Thanks. I’ll update it. I assume there shouldn't be too many links to this pages out in the wild, so we won't need any redirect rules for it. |
Documents vaadin/flow#20285.