@@ -61,7 +61,9 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
62 self.tableView.delegate = self
62 self.tableView.delegate = self
63 self.tableView.dataSource = self
63 self.tableView.dataSource = self
65+ tableView.setContentOffset(CGPoint(x: 0, y: 50), animated: false)
65 navigationItem.largeTitleDisplayMode = .never
67 navigationItem.largeTitleDisplayMode = .never
67 tableView.keyboardDismissMode = .onDrag
69 tableView.keyboardDismissMode = .onDrag
@@ -114,6 +116,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
114 let button = UIButton()
116 let button = UIButton()
115 button.setTitle("Send", for: .normal)
117 button.setTitle("Send", for: .normal)
116 button.setTitleColor(.blue, for: .normal)
118 button.setTitleColor(.blue, for: .normal)
119+ button.titleLabel?.font = UIFont.systemFont(ofSize: 17, weight: .semibold)
117 button.addTarget(self, action: #selector(sendMessage), for: .touchUpInside)
120 button.addTarget(self, action: #selector(sendMessage), for: .touchUpInside)
118 return button
121 return button
@@ -132,8 +135,13 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
133 Model.sendMessage(message: Model.SendMessage(body: Model.Attachments(markdown: messageTextView.text), destination: destination)) { [unowned self] in
136 Model.sendMessage(message: Model.SendMessage(body: Model.Attachments(markdown: messageTextView.text), destination: destination)) { [unowned self] in
139+ case .success, .success1:
135− self.getMessagesNew(for: self.dialog!)
140+ self.getMessagesNew(for: self.dialog!)
136− self.messageTextView.text = ""
141+ self.messageTextView.text = ""
143+ self.showAlertOn(result: $0)
139 prevLast = -1
147 prevLast = -1
@@ -158,7 +166,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
159 messageSendView.edgesToSuperview(excluding: [.top,.bottom])
167 messageSendView.edgesToSuperview(excluding: [.top,.bottom])
161− bottomConstraint = NSLayoutConstraint(item: messageSendView, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0)
169+ bottomConstraint = NSLayoutConstraint(item: messageSendView, attribute: .bottom, relatedBy: .equal, toItem: self.view.safeAreaLayoutGuide, attribute: .bottom, multiplier: 1, constant: 0)
162 view.addConstraint(bottomConstraint)
170 view.addConstraint(bottomConstraint)
164 messageSendView.height(60)
172 messageSendView.height(60)
@@ -191,7 +199,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
192 let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
200 let keyBoardFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
194− bottomConstraint.constant = notification.name == UIResponder.keyboardWillShowNotification ? -(keyBoardFrame.height) : 0
202+ bottomConstraint.constant = notification.name == UIResponder.keyboardWillShowNotification ? -(keyBoardFrame.height) + self.view.safeAreaInsets.bottom : 0
196 UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
204 UIView.animate(withDuration: 0, delay: 0, options: .curveEaseOut, animations: {
197 self.view.layoutIfNeeded()
205 self.view.layoutIfNeeded()
@@ -315,7 +323,7 @@ class DialogViewController: UIViewController, UpdatableGroup, UITableViewDelegat
315 var canBePaginated = false
323 var canBePaginated = false
316 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
324 func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
318− if indexPath.row == cellData.count - 1 && prevLast != indexPath.row && canBePaginated && cellData.count >= 9
326+ if indexPath.row == cellData.count - 1 && prevLast != indexPath.row && canBePaginated && cellData.count >= 24
320 print("exclusiveFrom \(currentMessagesInChat.last?.id ?? 0)")
328 print("exclusiveFrom \(currentMessagesInChat.last?.id ?? 0)")
321 if let dialog = dialog
329 if let dialog = dialog