Skip to content
Snippets Groups Projects
Unverified Commit c4bfc046 authored by Kali Kaneko's avatar Kali Kaneko Committed by meskio
Browse files

[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
parent 27d770b0
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,11 @@ func DonateAccepted() { ...@@ -40,6 +40,11 @@ func DonateAccepted() {
backend.DonateAccepted() backend.DonateAccepted()
} }
//export DonateSeen
func DonateSeen() {
backend.DonateSeen()
}
//export SubscribeToEvent //export SubscribeToEvent
func SubscribeToEvent(event string, f unsafe.Pointer) { func SubscribeToEvent(event string, f unsafe.Pointer) {
backend.SubscribeToEvent(event, f) backend.SubscribeToEvent(event, f)
......
...@@ -37,6 +37,11 @@ void Backend::donateAccepted() ...@@ -37,6 +37,11 @@ void Backend::donateAccepted()
DonateAccepted(); DonateAccepted();
} }
void Backend::donateSeen()
{
DonateSeen();
}
void Backend::login(QString username, QString password) void Backend::login(QString username, QString password)
{ {
Login(toGoStr(username), toGoStr(password)); Login(toGoStr(username), toGoStr(password));
......
...@@ -35,6 +35,7 @@ public slots: ...@@ -35,6 +35,7 @@ public slots:
void switchOn(); void switchOn();
void switchOff(); void switchOff();
void donateAccepted(); void donateAccepted();
void donateSeen();
void login(QString username, QString password); void login(QString username, QString password);
void resetError(QString errlabel); void resetError(QString errlabel);
void resetNotification(QString label); void resetNotification(QString label);
......
...@@ -21,11 +21,10 @@ ApplicationWindow { ...@@ -21,11 +21,10 @@ ApplicationWindow {
onDataChanged: { onDataChanged: {
ctx = JSON.parse(jsonModel.getJson()) ctx = JSON.parse(jsonModel.getJson())
// FIXME -- we need to inform the backend that we've already seen
// this. Otherwise this keeps popping randonmly on state changes.
if (ctx.donateDialog == 'true') { if (ctx.donateDialog == 'true') {
console.debug(jsonModel.getJson()) console.debug(jsonModel.getJson())
donate.visible = true donate.visible = true
backend.donateSeen()
} }
if (ctx.loginDialog == 'true') { if (ctx.loginDialog == 'true') {
console.debug(jsonModel.getJson()) console.debug(jsonModel.getJson())
......
...@@ -68,6 +68,10 @@ func DonateAccepted() { ...@@ -68,6 +68,10 @@ func DonateAccepted() {
donateAccepted() donateAccepted()
} }
func DonateSeen() {
donateSeen()
}
func SubscribeToEvent(event string, f unsafe.Pointer) { func SubscribeToEvent(event string, f unsafe.Pointer) {
subscribe(event, f) subscribe(event, f)
} }
......
...@@ -4,12 +4,12 @@ import ( ...@@ -4,12 +4,12 @@ import (
"time" "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. // and trigger the launching of the dialog if needed.
func runDonationReminder() { func runDonationReminder() {
go func() { go func() {
for { for {
time.Sleep(time.Hour) time.Sleep(time.Hour * 6)
if needsDonationReminder() { if needsDonationReminder() {
showDonate() showDonate()
} }
...@@ -21,6 +21,14 @@ func needsDonationReminder() bool { ...@@ -21,6 +21,14 @@ func needsDonationReminder() bool {
return ctx.cfg.NeedsDonationReminder() 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() { func donateAccepted() {
statusMutex.Lock() statusMutex.Lock()
defer statusMutex.Unlock() defer statusMutex.Unlock()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment