diff --git a/v3/pkg/services/notifications/notifications.go b/v3/pkg/services/notifications/notifications.go index bfa0b4489..1f50d6031 100644 --- a/v3/pkg/services/notifications/notifications.go +++ b/v3/pkg/services/notifications/notifications.go @@ -16,6 +16,8 @@ import ( "context" "fmt" "sync" + + "github.com/wailsapp/wails/v3/pkg/application" ) type notificationImpl interface { @@ -133,7 +135,7 @@ func (ns *Service) handleNotificationResult(result NotificationResult) { } // ServiceStartup is called when the service is loaded -func (ns *Service) ServiceStartup(ctx context.Context, options interface{}) error { +func (ns *Service) ServiceStartup(ctx context.Context, options application.ServiceOptions) error { return ns.impl.Startup(ctx) } diff --git a/v3/pkg/services/notifications/notifications_linux.go b/v3/pkg/services/notifications/notifications_linux.go index cff22b336..349756e21 100644 --- a/v3/pkg/services/notifications/notifications_linux.go +++ b/v3/pkg/services/notifications/notifications_linux.go @@ -78,6 +78,7 @@ func New() *Service { impl: impl, } }) + return NotificationService } diff --git a/v3/pkg/services/notifications/notifications_windows.go b/v3/pkg/services/notifications/notifications_windows.go index 064a6343f..ef4aacc85 100644 --- a/v3/pkg/services/notifications/notifications_windows.go +++ b/v3/pkg/services/notifications/notifications_windows.go @@ -209,8 +209,6 @@ func (wn *windowsNotifier) SendNotificationWithActions(options NotificationOptio // Registering a category with the same name as a previously registered NotificationCategory will override it. func (wn *windowsNotifier) RegisterNotificationCategory(category NotificationCategory) error { wn.categoriesLock.Lock() - defer wn.categoriesLock.Unlock() - wn.categories[category.ID] = NotificationCategory{ ID: category.ID, Actions: category.Actions, @@ -218,6 +216,7 @@ func (wn *windowsNotifier) RegisterNotificationCategory(category NotificationCat ReplyPlaceholder: category.ReplyPlaceholder, ReplyButtonTitle: category.ReplyButtonTitle, } + wn.categoriesLock.Unlock() return wn.saveCategoriesToRegistry() } @@ -225,9 +224,8 @@ func (wn *windowsNotifier) RegisterNotificationCategory(category NotificationCat // RemoveNotificationCategory removes a previously registered NotificationCategory. func (wn *windowsNotifier) RemoveNotificationCategory(categoryId string) error { wn.categoriesLock.Lock() - defer wn.categoriesLock.Unlock() - delete(wn.categories, categoryId) + wn.categoriesLock.Unlock() return wn.saveCategoriesToRegistry() }