android work

This commit is contained in:
Dan Ballard 2022-02-08 11:32:05 -05:00
parent ddefcb8ff2
commit fa6e399aab
1 changed files with 40 additions and 23 deletions

View File

@ -67,6 +67,22 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
val data = JSONObject(evt.Data)
val handle = if (evt.EventType == "NewMessageFromPeer") data.getString("RemotePeer") else data.getString("GroupID");
if (data["RemotePeer"] != data["ProfileOnion"]) {
val loader = FlutterInjector.instance().flutterLoader()
val key = loader.getLookupKeyForAsset("assets/" + data.getString("picture"))//"assets/profiles/001-centaur.png")
val fh = applicationContext.assets.open(key)
val notification = data["notification"]
if (notification != "None") {
if (notification == "SimpleEvent") {
} else if (notification == "ContactInfo") {
}
val channelId =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createMessageNotificationChannel(handle, handle)
@ -77,7 +93,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
}
val loader = FlutterInjector.instance().flutterLoader()
val key = loader.getLookupKeyForAsset("assets/" + data.getString("picture"))//"assets/profiles/001-centaur.png")
val key = loader.getLookupKeyForAsset("assets/" + data.getString("Picture"))//"assets/profiles/001-centaur.png")
val fh = applicationContext.assets.open(key)
@ -98,6 +114,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
.build()
notificationManager.notify(getNotificationID(data.getString("ProfileOnion"), handle), newNotification)
}
}
} else if (evt.EventType == "FileDownloadProgressUpdate") {
try {
val data = JSONObject(evt.Data);