|
@@ -1,4 +1,5 @@
|
|
|
import UIKit
|
|
|
+import MessageKit
|
|
|
|
|
|
class MailboxViewController: ChatViewController {
|
|
|
|
|
@@ -21,4 +22,35 @@ class MailboxViewController: ChatViewController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ override func didTapMessage(in cell: MessageCollectionViewCell) {
|
|
|
+ askToChat(cell: cell)
|
|
|
+ }
|
|
|
+
|
|
|
+ override func didTapCellTopLabel(in cell: MessageCollectionViewCell) {
|
|
|
+ askToChat(cell: cell)
|
|
|
+ }
|
|
|
+
|
|
|
+ override func didTapAvatar(in cell: MessageCollectionViewCell) {
|
|
|
+ askToChat(cell: cell)
|
|
|
+ }
|
|
|
+
|
|
|
+ override func didTapBackground(in cell: MessageCollectionViewCell) {
|
|
|
+ askToChat(cell: cell)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private func askToChat(cell: MessageCollectionViewCell) {
|
|
|
+ if let indexPath = messagesCollectionView.indexPath(for: cell) {
|
|
|
+
|
|
|
+ let message = messageList[indexPath.section]
|
|
|
+ let dcContact = message.fromContact
|
|
|
+ let alert = UIAlertController(title: String.localizedStringWithFormat(String.localized("ask_start_chat_with"), dcContact.nameNAddr), message: nil, preferredStyle: .actionSheet)
|
|
|
+ alert.addAction(UIAlertAction(title: String.localized("start_chat"), style: .default, handler: { _ in
|
|
|
+ let chat = message.createChat()
|
|
|
+ self.coordinator?.showChat(chatId: chat.id)
|
|
|
+ }))
|
|
|
+ alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel))
|
|
|
+ present(alert, animated: true, completion: nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|