소스 검색

add missing button actions

Alla Reinsch 7 년 전
부모
커밋
2bb25299c0
2개의 변경된 파일17개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      deltachat-ios/ChatListController.swift
  2. 11 0
      deltachat-ios/ContactProfileViewController.swift

+ 6 - 2
deltachat-ios/ChatListController.swift

@@ -85,7 +85,11 @@ class ChatListController: UIViewController {
         let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
         actionSheet.addAction(UIAlertAction(title: "New chat",
                                             style: .default,
-                                            handler: {a in print("New chat")}))
+                                            handler: {
+                                                [unowned self]
+                                                a in
+                                                self.didPressNewChat()
+        }))
         actionSheet.addAction(UIAlertAction(title: "New group",
                                             style: .default,
                                             handler: {a in print("New group")}))
@@ -109,7 +113,7 @@ class ChatListController: UIViewController {
         
     }
     
-    @objc func addChat() {
+    @objc func didPressNewChat() {
         let ncv = NewChatViewController()
         ncv.chatDisplayer = self
         let nav = UINavigationController(rootViewController: ncv)

+ 11 - 0
deltachat-ios/ContactProfileViewController.swift

@@ -40,6 +40,14 @@ class ContactProfileViewController: UITableViewController {
         self.navigationItem.rightBarButtonItem = dotsButton
     }
 
+    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)
+    }
+    
     @objc func didPressDotsButton() {
         print("pressed")
         let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
@@ -115,5 +123,8 @@ class ContactProfileViewController: UITableViewController {
             let newContactController = NewContactController(contactIdForUpdate: contactId)
             navigationController?.pushViewController(newContactController, animated: true)
         }
+        if row == 4 {
+            displayNewChat(contactId: contactId)
+        }
     }
 }