diff options
Diffstat (limited to 'notificator.go')
-rw-r--r-- | notificator.go | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/notificator.go b/notificator.go index 1e60221..2a46b00 100644 --- a/notificator.go +++ b/notificator.go @@ -8,18 +8,23 @@ import ( "github.com/0xAX/notificator" ) -const notificationText = `The RiseupVPN service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month at https://riseup.net/donate-vpn` +const ( + notificationText = `The RiseupVPN service is expensive to run. Because we don't want to store personal information about you, there is no accounts or billing for this service. But if you want the service to continue, donate at least $5 each month at https://riseup.net/donate-vpn` +) -func notificate() { +func notificate(conf *systrayConfig) { wd, _ := os.Getwd() notify := notificator.New(notificator.Options{ DefaultIcon: path.Join(wd, "riseupvpn.svg"), AppName: "RiseupVPN", }) + time.Sleep(time.Minute * 5) for { - time.Sleep(time.Minute * 5) - notify.Push("Donate to RiseupVPN", notificationText, "", notificator.UR_NORMAL) - time.Sleep(time.Hour * 24) + if conf.needsNotification() { + notify.Push("Donate to RiseupVPN", notificationText, "", notificator.UR_NORMAL) + conf.setNotification() + } + time.Sleep(time.Hour) } } |