mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-06 11:09:03 +08:00
update win impl to match
This commit is contained in:
parent
f8647ff73c
commit
c1230d4b86
@ -5,16 +5,16 @@ type Service struct {
|
||||
|
||||
// NotificationAction represents an action button for a notification
|
||||
type NotificationAction = struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Destructive bool `json:"destructive,omitempty"`
|
||||
AuthenticationRequired bool `json:"authenticationRequired,omitempty"`
|
||||
}
|
||||
|
||||
// NotificationCategory groups actions for notifications
|
||||
type NotificationCategory = struct {
|
||||
ID string `json:"id"`
|
||||
Actions []NotificationAction `json:"actions"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Actions []NotificationAction `json:"actions,omitempty"`
|
||||
HasReplyField bool `json:"hasReplyField,omitempty"`
|
||||
ReplyPlaceholder string `json:"replyPlaceholder,omitempty"`
|
||||
ReplyButtonTitle string `json:"replyButtonTitle,omitempty"`
|
||||
@ -22,10 +22,10 @@ type NotificationCategory = struct {
|
||||
|
||||
// NotificationOptions contains configuration for a notification
|
||||
type NotificationOptions = struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
ID string `json:"id,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Subtitle string `json:"subtitle,omitempty"`
|
||||
Body string `json:"body"`
|
||||
Body string `json:"body,omitempty"`
|
||||
CategoryID string `json:"categoryId,omitempty"`
|
||||
Data map[string]interface{} `json:"data,omitempty"`
|
||||
}
|
||||
|
@ -71,11 +71,11 @@ func (ns *Service) CheckNotificationAuthorization() bool {
|
||||
|
||||
// SendNotification sends a basic notification with a name, title, and body.
|
||||
// (subtitle is only available on macOS)
|
||||
func (ns *Service) SendNotification(identifier, title, _, body string) error {
|
||||
func (ns *Service) SendNotification(options NotificationOptions) error {
|
||||
n := toast.Notification{
|
||||
AppID: identifier,
|
||||
Title: title,
|
||||
Body: body,
|
||||
AppID: options.ID,
|
||||
Title: options.Title,
|
||||
Body: options.Body,
|
||||
}
|
||||
|
||||
err := n.Push()
|
||||
|
Loading…
Reference in New Issue
Block a user