getAppBusEvents for gomobile
This commit is contained in:
parent
120dc5f468
commit
9c7a22d472
17
lib.go
17
lib.go
|
@ -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())
|
||||
|
|
Loading…
Reference in New Issue