Closed saurabhPV closed 5 years ago
@saurabhPV This behaviour is intentional and can be seen in Messages.app.
You can override this behaviour by handling the inputViewPrimaryActionTriggered
method in your MSGMessengerViewController
subclass:
First, check if the message contains only emojis, if it does then set the MSGMessageBody
type to .emoji
, else default to .text
, then instantiate your message variable and insert it into the collection view or dataSource.
override func inputViewPrimaryActionTriggered(inputView: MSGInputView) {
id += 1
let body: MSGMessageBody = inputView.message.containsOnlyEmoji ? .emoji(inputView.message) : .text(inputView.message)
let message = MSGMessage(id: id, body: body, user: user, sentAt: Date())
insert(message)
}
However, any more than 5 emojis, and the message will truncate. You will need to create a custom style in order to handle the wrapping of the emoji messages if that's what you want.