diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-03-10 22:36:26 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2021-03-11 17:05:46 +0100 |
commit | c4bfc04603c361e6a3833f5846d311a73073cd18 (patch) | |
tree | 51064c031fc0863b0e6c2a2a9c98fd93039074c2 /pkg | |
parent | 27d770b0bed12fb6b42b4e1a94b549ac559985d2 (diff) |
[bug] inform backend when donate dialog is shown
a rather annoying bug, since it keeps popping up for every status
change. to be included in a hotfix for 0.21.2 release.
- Release: 0.21.2
- Closes: #459
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/backend/api.go | 4 | ||||
-rw-r--r-- | pkg/backend/donate.go | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go index 4390fef..a799b0e 100644 --- a/pkg/backend/api.go +++ b/pkg/backend/api.go @@ -68,6 +68,10 @@ func DonateAccepted() { donateAccepted() } +func DonateSeen() { + donateSeen() +} + func SubscribeToEvent(event string, f unsafe.Pointer) { subscribe(event, f) } diff --git a/pkg/backend/donate.go b/pkg/backend/donate.go index f87934a..c16c0f4 100644 --- a/pkg/backend/donate.go +++ b/pkg/backend/donate.go @@ -4,12 +4,12 @@ import ( "time" ) -// runDonationReminder checks every hour if we need to show the reminder, +// runDonationReminder checks every six hours if we need to show the reminder, // and trigger the launching of the dialog if needed. func runDonationReminder() { go func() { for { - time.Sleep(time.Hour) + time.Sleep(time.Hour * 6) if needsDonationReminder() { showDonate() } @@ -21,6 +21,14 @@ func needsDonationReminder() bool { return ctx.cfg.NeedsDonationReminder() } +/* to be called from the gui, the visibility toggle will be updated on the next + status change */ +func donateSeen() { + statusMutex.Lock() + defer statusMutex.Unlock() + ctx.DonateDialog = false +} + func donateAccepted() { statusMutex.Lock() defer statusMutex.Unlock() |