Capture later structured messaging updates
This commit is contained in:
@@ -56,10 +56,12 @@ object NotificationContents {
|
||||
/** MessagingStyle also populates generic title/text fields with an alternate rendering. */
|
||||
private fun messagingContents(extras: Bundle): String? {
|
||||
val parts = linkedSetOf<String>()
|
||||
Notification.MessagingStyle.Message.getMessagesFromBundleArray(
|
||||
extras.getParcelableArray(Notification.EXTRA_MESSAGES, Bundle::class.java),
|
||||
).forEach { message ->
|
||||
listOfNotNull(message.senderPerson?.name, message.text).joinToString(": ").addTo(parts)
|
||||
listOf(Notification.EXTRA_HISTORIC_MESSAGES, Notification.EXTRA_MESSAGES).forEach { key ->
|
||||
Notification.MessagingStyle.Message.getMessagesFromBundleArray(
|
||||
extras.getParcelableArray(key, Bundle::class.java),
|
||||
).forEach { message ->
|
||||
listOfNotNull(message.senderPerson?.name, message.text).joinToString(": ").addTo(parts)
|
||||
}
|
||||
}
|
||||
return parts.takeIf { it.isNotEmpty() }?.joinToString("\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user