summaryrefslogtreecommitdiff
path: root/pkg/config
diff options
context:
space:
mode:
authorkali kaneko (leap communications) <kali@leap.se>2020-06-16 21:28:48 +0200
committerkali kaneko (leap communications) <kali@leap.se>2020-06-26 12:12:41 +0200
commitc17b5f6f7b6b28c890764688ff5e966ecebece63 (patch)
tree4c9931b10e7cddd9050f76aff95205dbf04d6d26 /pkg/config
parenta18e61aa1be37aa568552c69fbd743d25498b9bb (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.go14
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()
}