|
@@ -8,8 +8,8 @@ class NewChatViewController: UITableViewController {
|
|
private let sectionNew = 0
|
|
private let sectionNew = 0
|
|
private let sectionImportedContacts = 1
|
|
private let sectionImportedContacts = 1
|
|
private let sectionNewRowNewGroup = 0
|
|
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 = {
|
|
private lazy var searchController: UISearchController = {
|
|
let searchController = UISearchController(searchResultsController: nil)
|
|
let searchController = UISearchController(searchResultsController: nil)
|
|
@@ -135,7 +135,7 @@ class NewChatViewController: UITableViewController {
|
|
|
|
|
|
override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
override func tableView(_: UITableView, numberOfRowsInSection section: Int) -> Int {
|
|
if section == sectionNew {
|
|
if section == sectionNew {
|
|
- return 3
|
|
|
|
|
|
+ return sectionNewRowCount
|
|
} else if section == sectionImportedContacts {
|
|
} else if section == sectionImportedContacts {
|
|
if deviceContactAccessGranted {
|
|
if deviceContactAccessGranted {
|
|
return isFiltering() ? filteredContacts.count : contacts.count
|
|
return isFiltering() ? filteredContacts.count : contacts.count
|
|
@@ -165,19 +165,6 @@ class NewChatViewController: UITableViewController {
|
|
|
|
|
|
return cell
|
|
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 {
|
|
if row == sectionNewRowNewContact {
|
|
// new contact row
|
|
// new contact row
|
|
@@ -239,17 +226,6 @@ class NewChatViewController: UITableViewController {
|
|
if row == sectionNewRowNewGroup {
|
|
if row == sectionNewRowNewGroup {
|
|
coordinator?.showNewGroupController()
|
|
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 {
|
|
if row == sectionNewRowNewContact {
|
|
coordinator?.showNewContactController()
|
|
coordinator?.showNewContactController()
|
|
}
|
|
}
|