|
@@ -25,6 +25,7 @@ class ChatViewController: UITableViewController {
|
|
|
var isInitial = true
|
|
|
var ignoreInputBarChange = false
|
|
|
private var isVisibleToUser: Bool = false
|
|
|
+ private var keepKeyboard: Bool = false
|
|
|
|
|
|
lazy var isGroupChat: Bool = {
|
|
|
return dcContext.getChat(chatId: chatId).isGroup
|
|
@@ -858,6 +859,7 @@ class ChatViewController: UITableViewController {
|
|
|
messageInputBar.inputTextView.layer.masksToBounds = true
|
|
|
messageInputBar.inputTextView.scrollIndicatorInsets = UIEdgeInsets(top: 8, left: 0, bottom: 8, right: 0)
|
|
|
configureInputBarItems()
|
|
|
+ messageInputBar.inputTextView.delegate = self
|
|
|
}
|
|
|
|
|
|
private func evaluateInputBar(draft: DraftModel) {
|
|
@@ -1453,6 +1455,7 @@ extension ChatViewController: MediaPickerDelegate {
|
|
|
// MARK: - MessageInputBarDelegate
|
|
|
extension ChatViewController: InputBarAccessoryViewDelegate {
|
|
|
func inputBar(_ inputBar: InputBarAccessoryView, didPressSendButtonWith text: String) {
|
|
|
+ keepKeyboard = true
|
|
|
let trimmedText = text.replacingOccurrences(of: "\u{FFFC}", with: "", options: .literal, range: nil)
|
|
|
.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
|
if let filePath = draft.attachment, let viewType = draft.viewType {
|
|
@@ -1570,3 +1573,18 @@ extension ChatViewController: AudioControllerDelegate {
|
|
|
self.present(alert, animated: true, completion: nil)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// MARK: - UITextViewDelegate
|
|
|
+extension ChatViewController: UITextViewDelegate {
|
|
|
+ func textViewShouldEndEditing(_ textView: UITextView) -> Bool {
|
|
|
+ if keepKeyboard {
|
|
|
+ DispatchQueue.main.async { [weak self] in
|
|
|
+ self?.messageInputBar.inputTextView.becomeFirstResponder()
|
|
|
+ }
|
|
|
+ keepKeyboard = false
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ return true
|
|
|
+ }
|
|
|
+}
|