|
@@ -115,6 +115,13 @@ class ChatViewController: MessagesViewController {
|
|
selector: #selector(setTextDraft),
|
|
selector: #selector(setTextDraft),
|
|
name: UIApplication.willResignActiveNotification,
|
|
name: UIApplication.willResignActiveNotification,
|
|
object: nil)
|
|
object: nil)
|
|
|
|
+ notificationCenter.addObserver(self, selector: #selector(rotated),
|
|
|
|
+ name: UIDevice.orientationDidChangeNotification,
|
|
|
|
+ object: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ deinit {
|
|
|
|
+ NotificationCenter.default.removeObserver(self, name: UIDevice.orientationDidChangeNotification, object: nil)
|
|
}
|
|
}
|
|
|
|
|
|
private func startTimer() {
|
|
private func startTimer() {
|
|
@@ -382,6 +389,13 @@ class ChatViewController: MessagesViewController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc private func rotated() {
|
|
|
|
+ self.messagesCollectionView.reloadDataAndKeepOffset()
|
|
|
|
+ if self.isLastSectionVisible() {
|
|
|
|
+ self.messagesCollectionView.scrollToBottom(animated: true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private func configureMessageMenu() {
|
|
private func configureMessageMenu() {
|
|
var menuItems: [UIMenuItem]
|
|
var menuItems: [UIMenuItem]
|
|
|
|
|