Ver Fonte

open contact details of a group member on tap on the whole cell

cyberta há 5 anos atrás
pai
commit
833e23cbff

+ 4 - 8
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -1,6 +1,6 @@
 import UIKit
 
-class GroupChatDetailViewController: UIViewController, ContactCellDelegate {
+class GroupChatDetailViewController: UIViewController {
 
     private let sectionConfig = 0
     private let sectionMembers = 1
@@ -185,8 +185,6 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
                     contactCell.emailLabel.text = contact.email
                     contactCell.initialsLabel.text = Utils.getInitials(inputName: displayName)
                     contactCell.setColor(contact.color)
-                    contactCell.rowIndex = indexPath.row
-                    contactCell.delegate = self
                 }
                 return cell
             }
@@ -212,6 +210,9 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
                 coordinator?.showAddGroupMember(chatId: chat.id)
             } else if row == sectionMembersRowJoinQR {
                 coordinator?.showQrCodeInvite(chatId: chat.id)
+            } else {
+                let contact = getGroupMember(at: row)
+                coordinator?.showContactDetail(of: contact.id)
             }
             // ignore for now - in Telegram tapping a contactCell leads into ContactDetail
         } else if section == sectionLeaveGroup {
@@ -265,9 +266,4 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
         return DcContact(id: memberId)
     }
 
-    func onAvatarTapped(at index: Int) {
-        let contact = getGroupMember(at: index)
-        coordinator?.showContactDetail(of: contact.id)
-    }
-
 }

+ 5 - 2
deltachat-ios/View/ContactCell.swift

@@ -165,8 +165,11 @@ class ContactCell: UITableViewCell {
         imgView.center.x = avatar.center.x + (avatar.frame.width / 2) + imgSize - 5
         imgView.center.y = avatar.center.y + (avatar.frame.height / 2) + imgSize - 5
 
-        let tap = UITapGestureRecognizer(target: self, action: #selector(onAvatarTapped))
-        avatar.addGestureRecognizer(tap)
+        if delegate != nil {
+            let tap = UITapGestureRecognizer(target: self, action: #selector(onAvatarTapped))
+            avatar.addGestureRecognizer(tap)
+        }
+
     }
 
     func setVerified(isVerified: Bool) {