summaryrefslogtreecommitdiff
path: root/pkg/backend/api.go
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/backend/api.go
parenta18e61aa1be37aa568552c69fbd743d25498b9bb (diff)
[feat] re-implement donation reminders
first pass on giving functionality to the donation reminder
Diffstat (limited to 'pkg/backend/api.go')
-rw-r--r--pkg/backend/api.go29
1 files changed, 19 insertions, 10 deletions
diff --git a/pkg/backend/api.go b/pkg/backend/api.go
index f924cbd..5cb0304 100644
--- a/pkg/backend/api.go
+++ b/pkg/backend/api.go
@@ -6,6 +6,7 @@ import (
"C"
"fmt"
"log"
+ "time"
"unsafe"
"0xacab.org/leap/bitmask-vpn/pkg/bitmask"
@@ -23,18 +24,24 @@ func SwitchOff() {
}
func Unblock() {
+ //TODO
fmt.Println("unblock... [not implemented]")
}
func Quit() {
if ctx.Status != off {
go setStatus(stopping)
+ ctx.cfg.SetUserStoppedVPN(true)
stopVPN()
}
}
-func ToggleDonate() {
- toggleDonate()
+func DonateAccepted() {
+ donateAccepted()
+}
+
+func DonateRejected() {
+ donateRejected()
}
func SubscribeToEvent(event string, f unsafe.Pointer) {
@@ -42,21 +49,23 @@ func SubscribeToEvent(event string, f unsafe.Pointer) {
}
func InitializeBitmaskContext() {
- pi := bitmask.GetConfiguredProvider()
+ p := bitmask.GetConfiguredProvider()
initOnce.Do(func() {
- initializeContext(pi.Provider, pi.AppName)
+ initializeContext(
+ p.Provider, p.AppName)
})
go ctx.updateStatus()
- /* DEBUG
- timer := time.NewTimer(time.Second * 3)
go func() {
- <-timer.C
- fmt.Println("donate timer fired")
- toggleDonate()
+ if needsDonationReminder() {
+ // wait a bit before launching reminder
+ timer := time.NewTimer(time.Minute * 5)
+ <-timer.C
+ showDonate()
+ }
+
}()
- */
}
func RefreshContext() *C.char {