MessageKit Version:
iOS Version(s):
Swift Version:
Devices/Simulators: iPhone X
Reproducible in ChatExample? (Yes/No): Yes
The message including emoticons should be considered as 1 single message and shouldn't automatically split.
Looks related to #541. I'm confused why this is happening? This can't be a MessageKit problem. Please share your code for the MessageType creation.
Thanks for the fast reply. I've simply used the default Example that came along with the library and when I use a text with emoticon For eg. "Hello EMOTICON Peter" it breaks the text in 3 parts "Hello", "EMOTICON", "Peter". I am not able to use emoticons in a single text message. So, I was wondering if the library allows it or not ? Thanks again. Its a great effort by you guys anyways. :)
I think you are incorrectly using the InputTextView.components property. What is your code for when the send button is tapped
Hi @ankitpolaris ,
I have used below code and working properly for text with emojies: -
func messageInputBar(_ inputBar: MessageInputBar, didPressSendButtonWith text: String) {
let attributedText = NSAttributedString(string: text, attributes: [.font: UIFont.systemFont(ofSize: 15), .foregroundColor: UIColor.blue])
let message = MockMessage(attributedText: attributedText, sender: currentSender(), messageId: UUID().uuidString, date: Date())
messageList.append(message)
messagesCollectionView.insertSections([messageList.count - 1])
inputBar.inputTextView.text = String()
messagesCollectionView.scrollToBottom()
}
Hello, Thanks a lot for the update. The above code solved my concern :)
Hi, I have the similar problem. The hybrid multilingual message is splitted into separate parts. For example,
the single message "浣犲ソJane" is separated two messages: "浣犲ソ" and "Jane".
@ankitpolaris Sorry to have sent you in the wrong direction in this one. It took the same thing happening with Chinese characters to realize that it was indeed a bug in MessageKit. This has been resolved in #577
why we were using InputTextView.components?
Why we were using the single component as text?
I think emojis treated as another component that's why message split into two parts.
I have resolved my bug to remove this loop for components
for component in inputBar.inputTextView.components {}
and simply use inputBar.inputTextView.text
components separates strings and images. If you aren't allowing image paste it's not needed.
Sent with GitHawk