diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 8e4648038..258952cdd 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -23,6 +23,7 @@ After processing, the content will be moved to the main changelog and this file ## Fixed +- Fixed notification parsing on Windows @popaprozac in [PR](https://github.com/wailsapp/wails/pull/4450) ## Deprecated diff --git a/v3/pkg/services/notifications/notifications_windows.go b/v3/pkg/services/notifications/notifications_windows.go index 8556f392a..1a1a6dd85 100644 --- a/v3/pkg/services/notifications/notifications_windows.go +++ b/v3/pkg/services/notifications/notifications_windows.go @@ -177,13 +177,11 @@ func (wn *windowsNotifier) SendNotification(options NotificationOptions) error { ActivationArguments: DefaultActionIdentifier, } - if options.Data != nil { - encodedPayload, err := wn.encodePayload(DefaultActionIdentifier, options) - if err != nil { - return fmt.Errorf("failed to encode notification payload: %w", err) - } - n.ActivationArguments = encodedPayload + encodedPayload, err := wn.encodePayload(DefaultActionIdentifier, options) + if err != nil { + return fmt.Errorf("failed to encode notification payload: %w", err) } + n.ActivationArguments = encodedPayload return n.Push() } @@ -232,20 +230,18 @@ func (wn *windowsNotifier) SendNotificationWithActions(options NotificationOptio }) } - if options.Data != nil { - encodedPayload, err := wn.encodePayload(n.ActivationArguments, options) + encodedPayload, err := wn.encodePayload(n.ActivationArguments, options) + if err != nil { + return fmt.Errorf("failed to encode notification payload: %w", err) + } + n.ActivationArguments = encodedPayload + + for index := range n.Actions { + encodedPayload, err := wn.encodePayload(n.Actions[index].Arguments, options) if err != nil { return fmt.Errorf("failed to encode notification payload: %w", err) } - n.ActivationArguments = encodedPayload - - for index := range n.Actions { - encodedPayload, err := wn.encodePayload(n.Actions[index].Arguments, options) - if err != nil { - return fmt.Errorf("failed to encode notification payload: %w", err) - } - n.Actions[index].Arguments = encodedPayload - } + n.Actions[index].Arguments = encodedPayload } return n.Push()