Improved push notifications

This commit is contained in:
2017-07-15 01:32:06 +02:00
parent 92a540e024
commit 460d90d957
7 changed files with 78 additions and 22 deletions

View File

@ -1,10 +1,10 @@
package notifications
import (
"fmt"
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/utils"
)
@ -16,13 +16,13 @@ func Test(ctx *aero.Context) string {
return ctx.Error(http.StatusBadRequest, "Not logged in", nil)
}
for _, sub := range user.PushSubscriptions().Items {
err := sub.SendNotification("Yay, it works!")
if err != nil {
fmt.Println(err)
}
notification := &arn.Notification{
Title: "Anime Notifier",
Message: "Yay, it works!",
Icon: "https://" + ctx.App.Config.Domain + "/images/brand/300",
}
user.SendNotification(notification)
return "ok"
}