|
@@ -8,6 +8,7 @@
|
|
|
|
|
|
import UIKit
|
|
import UIKit
|
|
|
|
|
|
|
|
+
|
|
class ChatListController: UIViewController {
|
|
class ChatListController: UIViewController {
|
|
var chatList:MRChatList?
|
|
var chatList:MRChatList?
|
|
|
|
|
|
@@ -81,6 +82,7 @@ class ChatListController: UIViewController {
|
|
|
|
|
|
@objc func addChat() {
|
|
@objc func addChat() {
|
|
let ncv = NewChatViewController()
|
|
let ncv = NewChatViewController()
|
|
|
|
+ ncv.chatDisplayer = self
|
|
let nav = UINavigationController(rootViewController: ncv)
|
|
let nav = UINavigationController(rootViewController: ncv)
|
|
present(nav, animated: true, completion: nil)
|
|
present(nav, animated: true, completion: nil)
|
|
}
|
|
}
|
|
@@ -92,6 +94,7 @@ class ChatListController: UIViewController {
|
|
}
|
|
}
|
|
|
|
|
|
extension ChatListController: ChatPresenter {
|
|
extension ChatListController: ChatPresenter {
|
|
|
|
+
|
|
func displayChat(index: Int) {
|
|
func displayChat(index: Int) {
|
|
guard let chatList = self.chatList else {
|
|
guard let chatList = self.chatList else {
|
|
fatalError("chatList was nil in ChatPresenter extension")
|
|
fatalError("chatList was nil in ChatPresenter extension")
|
|
@@ -99,12 +102,25 @@ extension ChatListController: ChatPresenter {
|
|
|
|
|
|
let chatId = chatList.getChatId(index: index)
|
|
let chatId = chatList.getChatId(index: index)
|
|
let chatVC = ChatViewController(chatId: chatId)
|
|
let chatVC = ChatViewController(chatId: chatId)
|
|
|
|
+
|
|
|
|
|
|
chatVC.hidesBottomBarWhenPushed = true
|
|
chatVC.hidesBottomBarWhenPushed = true
|
|
self.navigationController?.pushViewController(chatVC, animated: true)
|
|
self.navigationController?.pushViewController(chatVC, animated: true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+extension ChatListController: ChatDisplayer {
|
|
|
|
+ func displayNewChat(contactId: Int) {
|
|
|
|
+ let chatId = mrmailbox_create_chat_by_contact_id(mailboxPointer, UInt32(contactId))
|
|
|
|
+ let chatVC = ChatViewController(chatId: Int(chatId))
|
|
|
|
+
|
|
|
|
+ chatVC.hidesBottomBarWhenPushed = true
|
|
|
|
+ self.navigationController?.pushViewController(chatVC, animated: true)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
class ChatTableDataSource: NSObject, UITableViewDataSource {
|
|
class ChatTableDataSource: NSObject, UITableViewDataSource {
|
|
weak var chatList:MRChatList?
|
|
weak var chatList:MRChatList?
|
|
|
|
|