private fun handleValidationErrors() {validationErrors.value = mutableListOf<ValidationError>().apply {val message = input.valueval messageLength = message.length if (messageLength > maxMessageLength) {add( ValidationError.MessageLengthExceeded(messageLength = messageLength,maxMessageLength = maxMessageLength))} val attachmentCount = selectedAttachments.value.size if (attachmentCount > maxAttachmentCount) { add( ValidationError.AttachmentCountExceeded( attachmentCount = attachmentCount, maxAttachmentCount = maxAttachmentCount ) ) }  val attachments: List<Attachment> = selectedAttachments.value .filter { it.fileSize > maxAttachmentSize } if (attachments.isNotEmpty()) { add( ValidationError.AttachmentSizeExceeded( attachments = attachments, maxAttachmentSize = maxAttachmentSize ) ) } if (!canSendLinks.value && message.containsLinks()) { add( ValidationError.ContainsLinksWhenNotAllowed ) } } }
Checks the current input for validation errors.