This repository has been archived on 2021-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
2019-05-03 18:28:11 +00:00
|
|
|
package android
|
2019-04-16 21:11:29 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/therecipe/qt/androidextras"
|
|
|
|
"github.com/therecipe/qt/core"
|
|
|
|
)
|
|
|
|
|
2019-05-03 18:28:11 +00:00
|
|
|
type CwtchActivity struct {
|
2019-04-16 21:11:29 +00:00
|
|
|
core.QObject
|
|
|
|
|
|
|
|
_ func() `constructor:"init"`
|
|
|
|
|
|
|
|
_ string `property:"notification"`
|
|
|
|
|
|
|
|
_ func(string) `slot:"updateAndroidNotification"`
|
|
|
|
}
|
|
|
|
|
2019-05-03 18:28:11 +00:00
|
|
|
func (c *CwtchActivity) init() {
|
2019-04-16 21:11:29 +00:00
|
|
|
|
|
|
|
c.createOngoingNotification()
|
|
|
|
c.ConnectNotificationChanged(c.updateAndroidNotification)
|
|
|
|
}
|
|
|
|
|
2019-05-03 18:28:11 +00:00
|
|
|
func (c *CwtchActivity) updateAndroidNotification(n string) {
|
2019-04-16 21:11:29 +00:00
|
|
|
|
|
|
|
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
|
|
|
|
"ca/openprivacy/cwtch/ui/CwtchActivity",
|
|
|
|
"notify",
|
|
|
|
"(Ljava/lang/String;)V",
|
|
|
|
n,
|
|
|
|
)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
println(err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-03 18:28:11 +00:00
|
|
|
func (c *CwtchActivity) createOngoingNotification() {
|
2019-04-16 21:11:29 +00:00
|
|
|
|
|
|
|
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
|
|
|
|
"ca/openprivacy/cwtch/ui/CwtchActivity",
|
|
|
|
"ongoingNotify",
|
|
|
|
"(Ljava/lang/String;)V",
|
|
|
|
"Cwtch is running",
|
|
|
|
)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
println(err.Error())
|
|
|
|
}
|
|
|
|
}
|