From ef3b7d2bc3bcef30752ddd40a4f17a5d1b965b6a Mon Sep 17 00:00:00 2001 From: popaprozac Date: Sat, 22 Mar 2025 11:51:02 -0700 Subject: [PATCH] pass service options --- v3/pkg/services/notifications/notifications.go | 8 ++++---- v3/pkg/services/notifications/notifications_darwin.go | 4 +++- v3/pkg/services/notifications/notifications_linux.go | 2 +- v3/pkg/services/notifications/notifications_windows.go | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/v3/pkg/services/notifications/notifications.go b/v3/pkg/services/notifications/notifications.go index 1f50d6031..d7549fbf9 100644 --- a/v3/pkg/services/notifications/notifications.go +++ b/v3/pkg/services/notifications/notifications.go @@ -20,9 +20,9 @@ import ( "github.com/wailsapp/wails/v3/pkg/application" ) -type notificationImpl interface { +type platformNotifier interface { // Lifecycle methods - Startup(ctx context.Context) error + Startup(ctx context.Context, options application.ServiceOptions) error Shutdown() error // Core notification methods @@ -45,7 +45,7 @@ type notificationImpl interface { // Service represents the notifications service type Service struct { - impl notificationImpl + impl platformNotifier // notificationResponseCallback is called when a notification result is received. // Only one callback can be assigned at a time. @@ -136,7 +136,7 @@ func (ns *Service) handleNotificationResult(result NotificationResult) { // ServiceStartup is called when the service is loaded func (ns *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { - return ns.impl.Startup(ctx) + return ns.impl.Startup(ctx, options) } // ServiceShutdown is called when the service is unloaded diff --git a/v3/pkg/services/notifications/notifications_darwin.go b/v3/pkg/services/notifications/notifications_darwin.go index 380460f43..c97e80531 100644 --- a/v3/pkg/services/notifications/notifications_darwin.go +++ b/v3/pkg/services/notifications/notifications_darwin.go @@ -15,6 +15,8 @@ import ( "sync" "time" "unsafe" + + "github.com/wailsapp/wails/v3/pkg/application" ) type darwinNotifier struct { @@ -56,7 +58,7 @@ func New() *Service { return NotificationService } -func (dn *darwinNotifier) Startup(ctx context.Context) error { +func (dn *darwinNotifier) Startup(ctx context.Context, options application.ServiceOptions) error { return nil } diff --git a/v3/pkg/services/notifications/notifications_linux.go b/v3/pkg/services/notifications/notifications_linux.go index 349756e21..2050c84df 100644 --- a/v3/pkg/services/notifications/notifications_linux.go +++ b/v3/pkg/services/notifications/notifications_linux.go @@ -83,7 +83,7 @@ func New() *Service { } // Startup is called when the service is loaded -func (ln *linuxNotifier) Startup(ctx context.Context) error { +func (ln *linuxNotifier) Startup(ctx context.Context, options application.ServiceOptions) error { ln.appName = application.Get().Config().Name if err := ln.loadCategories(); err != nil { diff --git a/v3/pkg/services/notifications/notifications_windows.go b/v3/pkg/services/notifications/notifications_windows.go index ef4aacc85..6219665f6 100644 --- a/v3/pkg/services/notifications/notifications_windows.go +++ b/v3/pkg/services/notifications/notifications_windows.go @@ -57,7 +57,7 @@ func New() *Service { // Startup is called when the service is loaded // Sets an activation callback to emit an event when notifications are interacted with. -func (wn *windowsNotifier) Startup(ctx context.Context) error { +func (wn *windowsNotifier) Startup(ctx context.Context, options application.ServiceOptions) error { wn.appName = application.Get().Config().Name guid, err := wn.getGUID()