2019-05-03 18:28:11 +00:00
|
|
|
package android
|
2019-04-16 21:11:29 +00:00
|
|
|
|
|
|
|
import (
|
2020-02-11 23:39:42 +00:00
|
|
|
"git.openprivacy.ca/openprivacy/log"
|
2019-04-16 21:11:29 +00:00
|
|
|
"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"`
|
|
|
|
|
2020-11-25 00:45:50 +00:00
|
|
|
_ string `property:"channel"`
|
2019-04-16 21:11:29 +00:00
|
|
|
_ string `property:"notification"`
|
|
|
|
|
|
|
|
_ func(string) `slot:"updateAndroidNotification"`
|
2019-09-13 23:24:58 +00:00
|
|
|
|
|
|
|
_ func() `signal:"rootHomeButtonHandle,auto"`
|
2019-04-16 21:11:29 +00:00
|
|
|
}
|
|
|
|
|
2019-05-03 18:28:11 +00:00
|
|
|
func (c *CwtchActivity) init() {
|
2019-09-13 23:24:58 +00:00
|
|
|
log.Debugln("CwtchActivity.init()")
|
2019-04-16 21:11:29 +00:00
|
|
|
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",
|
2020-11-25 00:45:50 +00:00
|
|
|
"(Ljava/lang/String;Ljava/lang/String;)V",
|
|
|
|
n, c.Channel(),
|
2019-04-16 21:11:29 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
if err != nil {
|
2019-09-13 23:24:58 +00:00
|
|
|
log.Errorf("Error calling Java CwtchActivity.notify(): %v\n", err.Error())
|
2019-04-16 21:11:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-13 23:24:58 +00:00
|
|
|
func (c *CwtchActivity) rootHomeButtonHandle() {
|
|
|
|
log.Infoln("CwtchActivity.rootHomeButtonHandle()!")
|
|
|
|
var err = androidextras.QAndroidJniObject_CallStaticMethodVoid2Caught(
|
|
|
|
"ca/openprivacy/cwtch/ui/CwtchActivity",
|
|
|
|
"rootHomeHandle",
|
|
|
|
"()V",
|
|
|
|
)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Errorf("Error calling Java CwtchActivity.rootHomeButtonHandle(): %v\n", err.Error())
|
2019-04-16 21:11:29 +00:00
|
|
|
}
|
|
|
|
}
|