Forked from git.sr.ht/~whereswaldon/niotify
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
673 B

package niotify
import (
"git.sr.ht/~whereswaldon/niotify/android"
)
type androidManager struct {
channel *android.NotificationChannel
}
var _ managerInterface = &androidManager{}
func newManager() (Manager, error) {
channel, err := android.NewChannel(android.ImportanceDefault, "DEFAULT", "niotify", "background notifications")
if err != nil {
return Manager{}, err
}
return Manager{
&androidManager{
channel: channel,
},
}, nil
}
func (a *androidManager) CreateNotification(title, text string) (*Notification, error) {
notification, err := a.channel.Send(title, text)
if err != nil {
return nil, err
}
return &Notification{notification}, nil
}