Commit 68b0ddb2 authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

messages: trim before sending

Change-Id: I60720ab7c95ae0ce18bd395794de33c641b3a8be
parent ff7b266b
......@@ -525,7 +525,12 @@ class ConversationViewController: UIViewController,
guard let payload = self.messageAccessoryView.messageTextView.text, !payload.isEmpty else {
return
}
self.viewModel.sendMessage(withContent: payload)
let trimmed = payload.trimmingCharacters(in: .whitespacesAndNewlines)
if trimmed.isEmpty {
self.messageAccessoryView.messageTextView.text = ""
return
}
self.viewModel.sendMessage(withContent: trimmed)
self.messageAccessoryView.messageTextView.text = ""
self.messageAccessoryView.setEmojiButtonVisibility(hide: false)
}).disposed(by: self.disposeBag)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment