From 48e3bd3dd41e2a9556d2f53e791c25ada5607e21 Mon Sep 17 00:00:00 2001 From: Zach Botterman <6074435+popaprozac@users.noreply.github.com> Date: Wed, 30 Jul 2025 05:40:58 -0700 Subject: [PATCH] [v3] bugfix/windows linux notifications (#4450) * fix windows encoding --------- Co-authored-by: Lea Anthony --- v3/UNRELEASED_CHANGELOG.md | 1 + .../notifications/notifications_windows.go | 30 ++++++++----------- 2 files changed, 14 insertions(+), 17 deletions(-) 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()