5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-06 19:11:14 +08:00

update win impl to match

This commit is contained in:
Zach Botterman 2025-02-23 14:37:03 -08:00
parent f8647ff73c
commit c1230d4b86
2 changed files with 11 additions and 11 deletions

View File

@ -5,16 +5,16 @@ type Service struct {
// NotificationAction represents an action button for a notification // NotificationAction represents an action button for a notification
type NotificationAction = struct { type NotificationAction = struct {
ID string `json:"id"` ID string `json:"id,omitempty"`
Title string `json:"title"` Title string `json:"title,omitempty"`
Destructive bool `json:"destructive,omitempty"` Destructive bool `json:"destructive,omitempty"`
AuthenticationRequired bool `json:"authenticationRequired,omitempty"` AuthenticationRequired bool `json:"authenticationRequired,omitempty"`
} }
// NotificationCategory groups actions for notifications // NotificationCategory groups actions for notifications
type NotificationCategory = struct { type NotificationCategory = struct {
ID string `json:"id"` ID string `json:"id,omitempty"`
Actions []NotificationAction `json:"actions"` Actions []NotificationAction `json:"actions,omitempty"`
HasReplyField bool `json:"hasReplyField,omitempty"` HasReplyField bool `json:"hasReplyField,omitempty"`
ReplyPlaceholder string `json:"replyPlaceholder,omitempty"` ReplyPlaceholder string `json:"replyPlaceholder,omitempty"`
ReplyButtonTitle string `json:"replyButtonTitle,omitempty"` ReplyButtonTitle string `json:"replyButtonTitle,omitempty"`
@ -22,10 +22,10 @@ type NotificationCategory = struct {
// NotificationOptions contains configuration for a notification // NotificationOptions contains configuration for a notification
type NotificationOptions = struct { type NotificationOptions = struct {
ID string `json:"id"` ID string `json:"id,omitempty"`
Title string `json:"title"` Title string `json:"title,omitempty"`
Subtitle string `json:"subtitle,omitempty"` Subtitle string `json:"subtitle,omitempty"`
Body string `json:"body"` Body string `json:"body,omitempty"`
CategoryID string `json:"categoryId,omitempty"` CategoryID string `json:"categoryId,omitempty"`
Data map[string]interface{} `json:"data,omitempty"` Data map[string]interface{} `json:"data,omitempty"`
} }

View File

@ -71,11 +71,11 @@ func (ns *Service) CheckNotificationAuthorization() bool {
// SendNotification sends a basic notification with a name, title, and body. // SendNotification sends a basic notification with a name, title, and body.
// (subtitle is only available on macOS) // (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{ n := toast.Notification{
AppID: identifier, AppID: options.ID,
Title: title, Title: options.Title,
Body: body, Body: options.Body,
} }
err := n.Push() err := n.Push()