full gomobile and ffi support + new GetMessages #3

Merged
dan merged 6 commits from gomobile into trunk 2021-01-28 20:25:40 +00:00
1 changed files with 17 additions and 0 deletions
Showing only changes of commit 9c7a22d472 - Show all commits

17
lib.go
View File

@ -21,6 +21,7 @@ import (
)
var application app.Application
var appBusQueue event.Queue
var acnQueue event.Queue
var contactEventsQueue event.Queue
@ -59,6 +60,16 @@ func StartCwtch(appDir string, torPath string) {
newApp := app.NewApp(acn, appDir)
acnQueue = event.NewQueue()
newApp.GetPrimaryBus().Subscribe(event.ACNStatus, acnQueue)
appBusQueue = event.NewQueue()
newApp.GetPrimaryBus().Subscribe(event.NewPeer, appBusQueue)
newApp.GetPrimaryBus().Subscribe(event.PeerError, appBusQueue)
newApp.GetPrimaryBus().Subscribe(event.AppError, appBusQueue)
newApp.GetPrimaryBus().Subscribe(event.ACNStatus, appBusQueue)
newApp.GetPrimaryBus().Subscribe(event.ReloadDone, appBusQueue)
newApp.GetPrimaryBus().Subscribe(event.ACNVersion, appBusQueue)
// Lol this wasn't an intended use
peer.DefaultEventsToHandle = []event.Type{
event.EncryptedGroupMessage,
event.NewMessageFromPeer,
@ -89,6 +100,12 @@ func ACNEvents() string {
}
}
// GetAppBusEvent blocks until an event
func GetAppBusEvent() string {
event := appBusQueue.Next()
return fmt.Sprintf("%v", event)
}
//export c_GetProfiles
func c_GetProfiles() *C.char {
return C.CString(GetProfiles())