Преглед изворни кода

refactoring - removed accessory symbol in contact cell

Bastian van de Wetering пре 6 година
родитељ
комит
c03f11c9aa

+ 10 - 31
deltachat-ios/Controller/NewChatViewController.swift

@@ -115,6 +115,8 @@ class NewChatViewController: UITableViewController {
 
 	override func viewWillDisappear(_ animated: Bool) {
 		hidesBottomBarWhenPushed = false
+		title = "Chats"	/* hack: when navigating to chatView (removing this viewController), there was a delayed backButton update (showing 'New Chat' for a moment) */
+
 	}
 
   override func viewDidDisappear(_ animated: Bool) {
@@ -245,8 +247,7 @@ class NewChatViewController: UITableViewController {
     if section == 0 {
       if row == 0 {
 				coordinator?.showNewGroupController()
-//        let newGroupController = NewGroupViewController()
-//        navigationController?.pushViewController(newGroupController, animated: true)
+
       }
       if row == 1 {
         if UIImagePickerController.isSourceTypeAvailable(.camera) {
@@ -260,8 +261,7 @@ class NewChatViewController: UITableViewController {
         }
       }
       if row == 2 {
-        let newContactController = NewContactController()
-        navigationController?.pushViewController(newContactController, animated: true)
+				coordinator?.showNewContactController()
       }
     } else if section == 1 {
       if deviceContactAccessGranted {
@@ -269,41 +269,21 @@ class NewChatViewController: UITableViewController {
           // edge case: when searchController is active but searchBar is empty -> filteredContacts is empty, so we fallback to contactIds
           let contactId = isFiltering() ? filteredContacts[row].contact.id : contactIds[row]
           searchController.dismiss(animated: false, completion: {
-            //self.dismiss(animated: false, completion: {
-							self.coordinator?.showNewChat(contactId: contactId)
-            //})
-          })
+            	self.coordinator?.showNewChat(contactId: contactId)
+            })
         } else {
           let contactId = contactIds[row]
-          //dismiss(animated: false) {
-						self.coordinator?.showNewChat(contactId: contactId)
-          //}
-        }
+         	self.coordinator?.showNewChat(contactId: contactId)
+         }
       } else {
         showSettingsAlert()
       }
     } else {
       let contactIndex = row
       let contactId = contactIds[contactIndex]
-      //dismiss(animated: false) {
-				self.coordinator?.showNewChat(contactId: contactId)
-			//}
-    }
-  }
-
-	/*
-  override func tableView(_: UITableView, accessoryButtonTappedForRowWith indexPath: IndexPath) {
-    let row = indexPath.row
-    if row > 2 {
-      let contactIndex = row - 3
-      let contactId = contactIds[contactIndex]
-      // let newContactController = NewContactController(contactIdForUpdate: contactId)
-      // navigationController?.pushViewController(newContactController, animated: true)
-      let contactProfileController = ContactProfileViewController(contactId: contactId)
-      navigationController?.pushViewController(contactProfileController, animated: true)
-    }
+     	self.coordinator?.showNewChat(contactId: contactId)
+		}
   }
-	*/
 
   private func updateContactCell(cell: ContactCell, contactWithHighlight: ContactWithSearchResults) {
     let contact = contactWithHighlight.contact
@@ -322,7 +302,6 @@ class NewChatViewController: UITableViewController {
     }
     cell.initialsLabel.text = Utils.getInitials(inputName: contact.name)
     cell.setColor(contact.color)
-    cell.accessoryType = .detailDisclosureButton
   }
 
   private func searchBarIsEmpty() -> Bool {

+ 10 - 6
deltachat-ios/Coordinator/AppCoordinator.swift

@@ -164,7 +164,10 @@ class SettingsCoordinator: Coordinator {
 	}
 
 	func showAccountSetupController() {
-		navigationController.pushViewController(AccountSetupController(), animated: true)
+		let accountSetupVC = AccountSetupController()
+		accountSetupVC.hidesBottomBarWhenPushed = true
+
+		navigationController.pushViewController(accountSetupVC, animated: true)
 	}
 }
 
@@ -179,7 +182,8 @@ class NewChatCoordinator: Coordinator {
 
 
 	func showNewGroupController() {
-
+		let newGroupController = NewGroupViewController()
+		navigationController.pushViewController(newGroupController, animated: true)
 	}
 
 	func showQRCodeController() {
@@ -190,7 +194,8 @@ class NewChatCoordinator: Coordinator {
 	}
 
 	func showNewContactController() {
-
+		let newContactController = NewContactController()
+		navigationController.pushViewController(newContactController, animated: true)
 	}
 
 	func showNewChat(contactId: Int) {
@@ -200,10 +205,9 @@ class NewChatCoordinator: Coordinator {
 
 	func showChat(chatId: Int) {
 		let chatViewController = ChatViewController(chatId: chatId)
-		navigationController.popViewController(animated: false)
-		navigationController.pushViewController(chatViewController, animated: true)
+		self.navigationController.pushViewController(chatViewController, animated: true)
+		navigationController.viewControllers.remove(at: 1)
 	}
-
 }