private fun AnnotatedString.Builder.appendAttachmentText(attachments: List<Attachment>,attachmentFactories: List<AttachmentFactory>,attachmentTextStyle: TextStyle,) {if (attachments.isNotEmpty()) {attachmentFactories.firstOrNull { it.canHandle(attachments) }?.textFormatter?.let { textFormatter ->attachments.mapNotNull { attachment ->textFormatter.invoke(attachment).let { previewText ->previewText.ifEmpty { null }}}.joinToString()}?.let { attachmentText ->val startIndex = this.lengthappend(attachmentText) addStyle(SpanStyle(fontStyle = attachmentTextStyle.fontStyle,fontFamily = attachmentTextStyle.fontFamily),start = startIndex,end = startIndex + attachmentText.length)}}}}
Appends a string representations of [attachments] to the [AnnotatedString].