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() {
backend.DonateAccepted()
}
//export DonateSeen
func DonateSeen() {
backend.DonateSeen()
}
//export SubscribeToEvent
func SubscribeToEvent(event string, f unsafe.Pointer) {
backend.SubscribeToEvent(event, f)
......
......@@ -37,6 +37,11 @@ void Backend::donateAccepted()
DonateAccepted();
}
void Backend::donateSeen()
{
DonateSeen();
}
void Backend::login(QString username, QString password)
{
Login(toGoStr(username), toGoStr(password));
......
......@@ -35,6 +35,7 @@ public slots:
void switchOn();
void switchOff();
void donateAccepted();
void donateSeen();
void login(QString username, QString password);
void resetError(QString errlabel);
void resetNotification(QString label);
......
......@@ -21,11 +21,10 @@ ApplicationWindow {
onDataChanged: {
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') {
console.debug(jsonModel.getJson())
donate.visible = true
backend.donateSeen()
}
if (ctx.loginDialog == 'true') {
console.debug(jsonModel.getJson())
......
......@@ -68,6 +68,10 @@ func DonateAccepted() {
donateAccepted()
}
func DonateSeen() {
donateSeen()
}
func SubscribeToEvent(event string, f unsafe.Pointer) {
subscribe(event, f)
}
......
......@@ -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()
......
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