mirror of
https://github.com/lone-cloud/prism-android
synced 2026-06-03 19:54:44 -07:00
better action resolution
This commit is contained in:
parent
79cf5bddd6
commit
c25fb8dfb0
2 changed files with 9 additions and 7 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
0.2.0
|
0.2.1
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,19 @@ class NotificationActionReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
Log.d(TAG, "Notification action triggered: $actionLabel ($actionID) for channel $channelID")
|
Log.d(TAG, "Notification action triggered: $actionLabel ($actionID) for channel $channelID")
|
||||||
|
|
||||||
|
if (notificationTag.isNotEmpty() && notificationId != -1) {
|
||||||
|
(context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager)
|
||||||
|
.cancel(notificationTag, notificationId)
|
||||||
|
}
|
||||||
|
|
||||||
|
val pendingResult = goAsync()
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
try {
|
try {
|
||||||
executeAction(context, actionEndpoint, actionMethod, data)
|
executeAction(context, actionEndpoint, actionMethod, data)
|
||||||
|
|
||||||
if (notificationTag.isNotEmpty() && notificationId != -1) {
|
|
||||||
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
|
||||||
notificationManager.cancel(notificationTag, notificationId)
|
|
||||||
Log.d(TAG, "Dismissed notification with tag: $notificationTag")
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "Failed to execute notification action: ${e.message}", e)
|
Log.e(TAG, "Failed to execute notification action: ${e.message}", e)
|
||||||
|
} finally {
|
||||||
|
pendingResult.finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue