2020-06-26 21:29:29 -04:00
|
|
|
package niotify
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.sr.ht/~whereswaldon/niotify/macos"
|
|
|
|
)
|
|
|
|
|
|
|
|
type macosManager struct {
|
|
|
|
channel macos.NotificationChannel
|
|
|
|
}
|
|
|
|
|
|
|
|
func newManager() (Manager, error) {
|
|
|
|
c := macos.NewNotificationChannel("Gio App")
|
2020-07-03 16:34:29 -04:00
|
|
|
|
2020-06-26 21:29:29 -04:00
|
|
|
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
|
|
|
|
}
|