diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2020-06-16 21:28:48 +0200 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2020-06-26 12:12:41 +0200 |
commit | c17b5f6f7b6b28c890764688ff5e966ecebece63 (patch) | |
tree | 4c9931b10e7cddd9050f76aff95205dbf04d6d26 /pkg/config | |
parent | a18e61aa1be37aa568552c69fbd743d25498b9bb (diff) |
[feat] re-implement donation reminders
first pass on giving functionality to the donation reminder
Diffstat (limited to 'pkg/config')
-rw-r--r-- | pkg/config/gui.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/config/gui.go b/pkg/config/gui.go index ce3f14d..5fa4886 100644 --- a/pkg/config/gui.go +++ b/pkg/config/gui.go @@ -37,7 +37,7 @@ var ( // Config holds the configuration of the systray type Config struct { file struct { - LastNotification time.Time + LastReminded time.Time Donated time.Time SelectGateway bool Obfs4 bool @@ -77,16 +77,16 @@ func (c *Config) SetUserStoppedVPN(vpnStopped bool) error { return c.save() } -func (c *Config) HasDonated() bool { - return c.file.Donated.Add(oneMonth).After(time.Now()) +func (c *Config) NeedsDonationReminder() bool { + return !c.hasDonated() && c.file.LastReminded.Add(oneDay).Before(time.Now()) } -func (c *Config) NeedsNotification() bool { - return !c.HasDonated() && c.file.LastNotification.Add(oneDay).Before(time.Now()) +func (c *Config) hasDonated() bool { + return c.file.Donated.Add(oneMonth).After(time.Now()) } -func (c *Config) SetNotification() error { - c.file.LastNotification = time.Now() +func (c *Config) SetLastReminded() error { + c.file.LastReminded = time.Now() return c.save() } |