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/backend/donate.go | |
parent | a18e61aa1be37aa568552c69fbd743d25498b9bb (diff) |
[feat] re-implement donation reminders
first pass on giving functionality to the donation reminder
Diffstat (limited to 'pkg/backend/donate.go')
-rw-r--r-- | pkg/backend/donate.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pkg/backend/donate.go b/pkg/backend/donate.go new file mode 100644 index 0000000..d216687 --- /dev/null +++ b/pkg/backend/donate.go @@ -0,0 +1,35 @@ +package backend + +import ( + "log" + "time" +) + +func needsDonationReminder() bool { + return ctx.cfg.NeedsDonationReminder() +} + +func donateAccepted() { + stmut.Lock() + defer stmut.Unlock() + ctx.DonateDialog = false + log.Println("marking as donated") + ctx.cfg.SetDonated() + go trigger(OnStatusChanged) +} + +func donateRejected() { + timer := time.NewTimer(time.Hour) + go func() { + <-timer.C + showDonate() + }() +} + +func showDonate() { + stmut.Lock() + defer stmut.Unlock() + ctx.DonateDialog = true + ctx.cfg.SetLastReminded() + go trigger(OnStatusChanged) +} |