From 37595d6236ba66b82d7ec2c61dfed3215ebbbce4 Mon Sep 17 00:00:00 2001 From: Redume Date: Mon, 1 May 2023 20:47:25 +0300 Subject: [PATCH] Added web-push and system-push notifications --- utils/notify.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 utils/notify.go diff --git a/utils/notify.go b/utils/notify.go new file mode 100644 index 0000000..c894217 --- /dev/null +++ b/utils/notify.go @@ -0,0 +1,20 @@ +package utils + +import "gopkg.in/toast.v1" + +func Notify(title, message string, action toast.Action) { + notification := toast.Notification{ + AppID: "EveryNASA", + Title: title, + Message: message, + Duration: toast.Long, + Actions: []toast.Action{ + action, + }, + } + + err := notification.Push() + if err != nil { + panic(err) + } +}