Ver código fonte

revert unneeded changes in NewChatViewController and little cleanup

cyberta 4 anos atrás
pai
commit
7017a10d98

+ 3 - 8
deltachat-ios/Controller/NewChatViewController.swift

@@ -98,7 +98,6 @@ class NewChatViewController: UITableViewController {
 
 
     // MARK: - actions
     // MARK: - actions
     @objc func cancelButtonPressed() {
     @objc func cancelButtonPressed() {
-
         dismiss(animated: true, completion: nil)
         dismiss(animated: true, completion: nil)
     }
     }
 
 
@@ -326,8 +325,8 @@ class NewChatViewController: UITableViewController {
 
 
     private func showChat(chatId: Int) {
     private func showChat(chatId: Int) {
         let chatViewController = ChatViewController(dcContext: dcContext, chatId: chatId)
         let chatViewController = ChatViewController(dcContext: dcContext, chatId: chatId)
-        self.navigationController?.pushViewController(chatViewController, animated: true)
-        self.navigationController?.viewControllers.remove(at: 1)
+        navigationController?.pushViewController(chatViewController, animated: true)
+        navigationController?.viewControllers.remove(at: 1)
     }
     }
 
 
     private func showContactDetail(contactId: Int) {
     private func showContactDetail(contactId: Int) {
@@ -375,12 +374,9 @@ extension NewChatViewController {
             preferredStyle: .safeActionSheet
             preferredStyle: .safeActionSheet
         )
         )
         alert.addAction(UIAlertAction(title: String.localized("delete"), style: .destructive, handler: { [weak self] _ in
         alert.addAction(UIAlertAction(title: String.localized("delete"), style: .destructive, handler: { [weak self] _ in
-            self?.dismiss(animated: true, completion: nil)
             self?.deleteContact(contactId: contactId, indexPath: indexPath)
             self?.deleteContact(contactId: contactId, indexPath: indexPath)
         }))
         }))
-        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { [weak self] _ in
-            self?.dismiss(animated: true, completion: nil)
-        }))
+        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
         present(alert, animated: true, completion: nil)
         present(alert, animated: true, completion: nil)
     }
     }
 
 
@@ -394,7 +390,6 @@ extension NewChatViewController {
                                           message: nil,
                                           message: nil,
                                           preferredStyle: .safeActionSheet)
                                           preferredStyle: .safeActionSheet)
             alert.addAction(UIAlertAction(title: String.localized("start_chat"), style: .default, handler: { _ in
             alert.addAction(UIAlertAction(title: String.localized("start_chat"), style: .default, handler: { _ in
-                self.dismiss(animated: true, completion: nil)
                 self.showNewChat(contactId: contactId)
                 self.showNewChat(contactId: contactId)
             }))
             }))
             alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { _ in
             alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: { _ in