From 9dd21255d309724bc0310a51a21ffb113a99cf0c Mon Sep 17 00:00:00 2001 From: Philipp Heckel Date: Fri, 17 Jun 2022 20:57:51 -0400 Subject: [PATCH] Add additional attachment extras --- .../main/java/io/heckel/ntfy/msg/BroadcastService.kt | 10 ++++++++-- fastlane/metadata/android/en-US/changelog/28.txt | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/heckel/ntfy/msg/BroadcastService.kt b/app/src/main/java/io/heckel/ntfy/msg/BroadcastService.kt index 36133e2..a15f09a 100644 --- a/app/src/main/java/io/heckel/ntfy/msg/BroadcastService.kt +++ b/app/src/main/java/io/heckel/ntfy/msg/BroadcastService.kt @@ -31,10 +31,16 @@ class BroadcastService(private val ctx: Context) { intent.putExtra("tags", notification.tags) intent.putExtra("tags_map", joinTagsMap(splitTags(notification.tags))) intent.putExtra("priority", notification.priority) + intent.putExtra("click", notification.click) intent.putExtra("muted", muted) intent.putExtra("muted_str", muted.toString()) - intent.putExtra("attachment_name", notification.attachment?.name) - intent.putExtra("attachment_url", notification.attachment?.url) + intent.putExtra("attachment_name", notification.attachment?.name ?: "") + intent.putExtra("attachment_type", notification.attachment?.type ?: "") + intent.putExtra("attachment_size", notification.attachment?.size ?: 0L) + intent.putExtra("attachment_size_str", notification.attachment?.size?.toString() ?: "") + intent.putExtra("attachment_expires", notification.attachment?.expires ?: 0L) + intent.putExtra("attachment_expires_str", notification.attachment?.expires?.toString() ?: "") + intent.putExtra("attachment_url", notification.attachment?.url ?: "") Log.d(TAG, "Sending message intent broadcast: ${intent.action} with extras ${intent.extras}") ctx.sendBroadcast(intent) diff --git a/fastlane/metadata/android/en-US/changelog/28.txt b/fastlane/metadata/android/en-US/changelog/28.txt index 3243140..e08bbbe 100644 --- a/fastlane/metadata/android/en-US/changelog/28.txt +++ b/fastlane/metadata/android/en-US/changelog/28.txt @@ -1,5 +1,6 @@ Bugs: * Fixed: Long-click selecting of notifications scrolls to the top (#235, thanks to @wunter8) +* Add attachment and click URL extras to MESSAGE_RECEIVED broadcast (#330, thanks to @wunter8) Additional translations: * Italian (thanks to @Genio2003)