Parcourir la source

Merge pull request #266 from deltachat/remove_scan_qr_code_entry

remove 'scan qr code' entry in NewChatViewController
björn petersen il y a 5 ans
Parent
commit
fc8a581774

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

@@ -8,8 +8,8 @@ class NewChatViewController: UITableViewController {
     private let sectionNew = 0
     private let sectionImportedContacts = 1
     private let sectionNewRowNewGroup = 0
-    private let sectionNewRowScanQrCode = 1
-    private let sectionNewRowNewContact = 2
+    private let sectionNewRowNewContact = 1
+    private let sectionNewRowCount = 2
 
     private lazy var searchController: UISearchController = {
         let searchController = UISearchController(searchResultsController: nil)
@@ -135,7 +135,7 @@ class NewChatViewController: UITableViewController {
 
     override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
         if section == sectionNew {
-            return 3
+            return sectionNewRowCount
         } else if section == sectionImportedContacts {
             if deviceContactAccessGranted {
                 return isFiltering() ? filteredContacts.count : contacts.count
@@ -165,19 +165,6 @@ class NewChatViewController: UITableViewController {
 
                 return cell
             }
-            if row == sectionNewRowScanQrCode {
-                // scan QR code row
-                let cell: UITableViewCell
-                if let c = tableView.dequeueReusableCell(withIdentifier: "scanGroupCell") {
-                    cell = c
-                } else {
-                    cell = UITableViewCell(style: .default, reuseIdentifier: "scanGroupCell")
-                }
-                cell.textLabel?.text = String.localized("qrscan_title")
-                cell.textLabel?.textColor = view.tintColor
-
-                return cell
-            }
 
             if row == sectionNewRowNewContact {
                 // new contact row
@@ -239,17 +226,6 @@ class NewChatViewController: UITableViewController {
             if row == sectionNewRowNewGroup {
                 coordinator?.showNewGroupController()
             }
-            if row == sectionNewRowScanQrCode {
-                if UIImagePickerController.isSourceTypeAvailable(.camera) {
-                    coordinator?.showQRCodeController()
-                } else {
-                    let alert = UIAlertController(title: String.localized("chat_camera_unavailable"), message: nil, preferredStyle: .alert)
-                    alert.addAction(UIAlertAction(title: String.localized("ok"), style: .cancel, handler: { _ in
-                        self.dismiss(animated: true, completion: nil)
-                    }))
-                    present(alert, animated: true, completion: nil)
-                }
-            }
             if row == sectionNewRowNewContact {
                 coordinator?.showNewContactController()
             }

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

@@ -293,12 +293,6 @@ class NewChatCoordinator: Coordinator {
         navigationController.pushViewController(newGroupController, animated: true)
     }
 
-    func showQRCodeController() {
-        _ = QrCodeReaderController()
-        // controller.delegate = self
-        // present(controller, animated: true, completion: nil)
-    }
-
     func showNewContactController() {
         let newContactController = NewContactController()
         let coordinator = EditContactCoordinator(dcContext: dcContext, navigationController: navigationController)