diff options
author | Ruben Pollan <meskio@sindominio.net> | 2018-02-08 21:41:31 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2018-02-08 21:41:31 +0100 |
commit | a846cb2a424fd17d43e3edf885cca7d79820fa9f (patch) | |
tree | 8b22a77ee70f87516fb11712b3597e238a2c7943 /notificator.go | |
parent | b32bcc834620a5c30ab4d7f7b8dde9ffdafd348f (diff) |
[feat] use a config file to check when to produce the next notification
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) } } |