Преглед на файлове

Merge pull request #279 from deltachat/tweak-contact-flow

tweak contacts
cyBerta преди 5 години
родител
ревизия
ceb1293597
променени са 2 файла, в които са добавени 18 реда и са изтрити 3 реда
  1. 17 2
      deltachat-ios/Controller/ContactDetailViewController.swift
  2. 1 1
      deltachat-ios/Controller/NewChatViewController.swift

+ 17 - 2
deltachat-ios/Controller/ContactDetailViewController.swift

@@ -144,8 +144,23 @@ class ContactDetailViewController: UITableViewController {
     }
 
     private func toggleBlockContact() {
-        contact.isBlocked ? contact.unblock() : contact.block()
-        updateBlockContactCell()
+        if contact.isBlocked {
+            let alert = UIAlertController(title: String.localized("ask_unblock_contact"), message: nil, preferredStyle: .actionSheet)
+            alert.addAction(UIAlertAction(title: String.localized("menu_unblock_contact"), style: .default, handler: { _ in
+                self.contact.unblock()
+                self.updateBlockContactCell()
+            }))
+            alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
+            present(alert, animated: true, completion: nil)
+        } else {
+            let alert = UIAlertController(title: String.localized("ask_block_contact"), message: nil, preferredStyle: .actionSheet)
+            alert.addAction(UIAlertAction(title: String.localized("menu_block_contact"), style: .destructive, handler: { _ in
+                self.contact.block()
+                self.updateBlockContactCell()
+            }))
+            alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
+            present(alert, animated: true, completion: nil)
+        }
     }
 
     private func updateBlockContactCell() {

+ 1 - 1
deltachat-ios/Controller/NewChatViewController.swift

@@ -243,7 +243,7 @@ class NewChatViewController: UITableViewController {
     override func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]? {
         let contactId = contactIdByRow(indexPath.row)
 
-        let edit = UITableViewRowAction(style: .normal, title: String.localized("global_menu_edit_desktop")) { [unowned self] _, _ in
+        let edit = UITableViewRowAction(style: .normal, title: String.localized("info")) { [unowned self] _, _ in
             if self.searchController.isActive {
                 self.searchController.dismiss(animated: false) {
                     self.coordinator?.showContactDetail(contactId: contactId)