diff --git a/app/src/main/java/se/ajpanton/notificationlog/capture/NotificationSnapshot.kt b/app/src/main/java/se/ajpanton/notificationlog/capture/NotificationSnapshot.kt index 51bebfc..8536639 100644 --- a/app/src/main/java/se/ajpanton/notificationlog/capture/NotificationSnapshot.kt +++ b/app/src/main/java/se/ajpanton/notificationlog/capture/NotificationSnapshot.kt @@ -21,25 +21,14 @@ data class NotificationSnapshot( object NotificationContents { fun extract(notification: Notification): String? { - val extras = notification.extras ?: Bundle.EMPTY - messagingContents(extras)?.let { return it } - val parts = linkedSetOf() + val extras = notification.extras ?: Bundle.EMPTY extras.getCharSequence(Notification.EXTRA_TITLE)?.addTo(parts) extras.getCharSequence(Notification.EXTRA_TEXT)?.addTo(parts) extras.getCharSequence(Notification.EXTRA_BIG_TEXT)?.addTo(parts) extras.getCharSequence(Notification.EXTRA_SUB_TEXT)?.addTo(parts) extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT)?.addTo(parts) extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES)?.forEach { it?.addTo(parts) } - return parts.takeIf { it.isNotEmpty() }?.joinToString(" — ") - } - - /** - * MessagingStyle also fills generic title and text fields. Those fields commonly duplicate - * the newest structured message, so structured messages are the canonical representation. - */ - private fun messagingContents(extras: Bundle): String? { - val parts = linkedSetOf() Notification.MessagingStyle.Message.getMessagesFromBundleArray( extras.getParcelableArray(Notification.EXTRA_MESSAGES, Bundle::class.java), ).forEach { message ->