mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-04 11:00:32 +08:00
pass service options
This commit is contained in:
parent
be1da68dbc
commit
ef3b7d2bc3
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user