1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
//+build darwin
package notify
import (
"gioui.org/x/notify/macos"
)
type macosManager struct {
channel macos.NotificationChannel
}
func newManager() (Manager, error) {
c := macos.NewNotificationChannel("Gio App")
return Manager{
&macosManager{channel: c},
}, nil
}
func (a *macosManager) CreateNotification(title, text string) (*Notification, error) {
notification, err := a.channel.Send(title, text)
if err != nil {
return nil, err
}
return &Notification{notification}, nil
}