android work
This commit is contained in:
parent
ddefcb8ff2
commit
fa6e399aab
|
@ -67,6 +67,22 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
val data = JSONObject(evt.Data)
|
val data = JSONObject(evt.Data)
|
||||||
val handle = if (evt.EventType == "NewMessageFromPeer") data.getString("RemotePeer") else data.getString("GroupID");
|
val handle = if (evt.EventType == "NewMessageFromPeer") data.getString("RemotePeer") else data.getString("GroupID");
|
||||||
if (data["RemotePeer"] != data["ProfileOnion"]) {
|
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 =
|
val channelId =
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
createMessageNotificationChannel(handle, handle)
|
createMessageNotificationChannel(handle, handle)
|
||||||
|
@ -77,7 +93,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
}
|
}
|
||||||
|
|
||||||
val loader = FlutterInjector.instance().flutterLoader()
|
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)
|
val fh = applicationContext.assets.open(key)
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,6 +114,7 @@ class FlwtchWorker(context: Context, parameters: WorkerParameters) :
|
||||||
.build()
|
.build()
|
||||||
notificationManager.notify(getNotificationID(data.getString("ProfileOnion"), handle), newNotification)
|
notificationManager.notify(getNotificationID(data.getString("ProfileOnion"), handle), newNotification)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (evt.EventType == "FileDownloadProgressUpdate") {
|
} else if (evt.EventType == "FileDownloadProgressUpdate") {
|
||||||
try {
|
try {
|
||||||
val data = JSONObject(evt.Data);
|
val data = JSONObject(evt.Data);
|
||||||
|
|
Loading…
Reference in New Issue