Browse Source

renamed contactCell into AvatarTextCell

nayooti 5 years ago
parent
commit
2c687ba804

+ 4 - 4
deltachat-ios.xcodeproj/project.pbxproj

@@ -95,7 +95,7 @@
 		7070FB9B2101ECBB000DC258 /* NewGroupController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7070FB9A2101ECBB000DC258 /* NewGroupController.swift */; };
 		7092474120B3869500AF8799 /* ContactDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7092474020B3869500AF8799 /* ContactDetailViewController.swift */; };
 		70B08FCD21073B910097D3EA /* NewGroupMemberChoiceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70B08FCC21073B910097D3EA /* NewGroupMemberChoiceController.swift */; };
-		70B8882E2091B8550074812E /* ContactCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70B8882D2091B8550074812E /* ContactCell.swift */; };
+		70B8882E2091B8550074812E /* AvatarTextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70B8882D2091B8550074812E /* AvatarTextCell.swift */; };
 		7837B64021E54DC600CDE126 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 7837B63F21E54DC600CDE126 /* .swiftlint.yml */; };
 		785BE16821E247F1003BE98C /* MessageInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 785BE16721E247F1003BE98C /* MessageInfoViewController.swift */; };
 		787D669A229F2237000A7A9D /* libdeltachat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 787D6699229F2237000A7A9D /* libdeltachat.a */; };
@@ -311,7 +311,7 @@
 		7070FB9A2101ECBB000DC258 /* NewGroupController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewGroupController.swift; sourceTree = "<group>"; };
 		7092474020B3869500AF8799 /* ContactDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactDetailViewController.swift; sourceTree = "<group>"; };
 		70B08FCC21073B910097D3EA /* NewGroupMemberChoiceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewGroupMemberChoiceController.swift; sourceTree = "<group>"; };
-		70B8882D2091B8550074812E /* ContactCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactCell.swift; sourceTree = "<group>"; };
+		70B8882D2091B8550074812E /* AvatarTextCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarTextCell.swift; sourceTree = "<group>"; };
 		7837B63F21E54DC600CDE126 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = "<group>"; };
 		785BE16721E247F1003BE98C /* MessageInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageInfoViewController.swift; sourceTree = "<group>"; };
 		787D6699229F2237000A7A9D /* libdeltachat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libdeltachat.a; path = "deltachat-ios/libraries/deltachat-core-rust/target/universal/debug/libdeltachat.a"; sourceTree = "<group>"; };
@@ -724,7 +724,7 @@
 			children = (
 				B26B3BC6236DC3DC008ED35A /* SwitchCell.swift */,
 				78E45E4B21D404AE00D4B15E /* CustomMessageCell.swift */,
-				70B8882D2091B8550074812E /* ContactCell.swift */,
+				70B8882D2091B8550074812E /* AvatarTextCell.swift */,
 				78ED839321D5AF8A00243125 /* QrCodeView.swift */,
 				78ED838221D5379000243125 /* TextFieldCell.swift */,
 				30260CA6238F02F700D8D52C /* MultilineTextFieldCell.swift */,
@@ -1151,7 +1151,7 @@
 				AE851ACE227CA54400ED86F0 /* InitialsBadge.swift in Sources */,
 				305961DA2346125100C80F33 /* MediaItem.swift in Sources */,
 				305961EB2346125100C80F33 /* MessageKitError.swift in Sources */,
-				70B8882E2091B8550074812E /* ContactCell.swift in Sources */,
+				70B8882E2091B8550074812E /* AvatarTextCell.swift in Sources */,
 				305961F82346125100C80F33 /* AudioMessageCell.swift in Sources */,
 				7A451D941FB1B1DB00177250 /* wrapper.c in Sources */,
 				305961EC2346125100C80F33 /* Avatar.swift in Sources */,

+ 7 - 7
deltachat-ios/Controller/ChatListController.swift

@@ -20,8 +20,8 @@ class ChatListController: UIViewController {
     private lazy var chatTable: UITableView = {
         let chatTable = UITableView(frame: .zero, style: .grouped)
         chatTable.register(UITableViewCell.self, forCellReuseIdentifier: archivedCellReuseIdentifier)
-        chatTable.register(ContactCell.self, forCellReuseIdentifier: deadDropCellReuseIdentifier)
-        chatTable.register(ContactCell.self, forCellReuseIdentifier: contactCellReuseIdentifier)
+        chatTable.register(AvatarTextCell.self, forCellReuseIdentifier: deadDropCellReuseIdentifier)
+        chatTable.register(AvatarTextCell.self, forCellReuseIdentifier: contactCellReuseIdentifier)
         chatTable.dataSource = self
         chatTable.delegate = self
         chatTable.rowHeight = 80
@@ -169,19 +169,19 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
             }
 
             if chatId == DC_CHAT_ID_DEADDROP, let msgId = viewModel.msgIdFor(indexPath: indexPath) {
-                let deaddropCell = tableView.dequeueReusableCell(withIdentifier: deadDropCellReuseIdentifier, for: indexPath) as! ContactCell
+                let deaddropCell = tableView.dequeueReusableCell(withIdentifier: deadDropCellReuseIdentifier, for: indexPath) as! AvatarTextCell
                 update(deaddropCell: deaddropCell, msgId: msgId)
                 return deaddropCell
             }
 
             // default chatCells
-            let chatCell = tableView.dequeueReusableCell(withIdentifier: contactCellReuseIdentifier, for: indexPath) as! ContactCell
+            let chatCell = tableView.dequeueReusableCell(withIdentifier: contactCellReuseIdentifier, for: indexPath) as! AvatarTextCell
             let cellViewModel = viewModel.getCellViewModelFor(indexPath: indexPath)
 
             update(avatarCell: chatCell, cellViewModel: cellViewModel)
             return chatCell
         case .CONTACT(let contactData):
-            let contactCell = tableView.dequeueReusableCell(withIdentifier: contactCellReuseIdentifier, for: indexPath) as! ContactCell
+            let contactCell = tableView.dequeueReusableCell(withIdentifier: contactCellReuseIdentifier, for: indexPath) as! AvatarTextCell
             update(avatarCell: contactCell, cellViewModel: cellViewModel)
             return contactCell
         }
@@ -252,7 +252,7 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
 
     // MARK: cell updates
 
-    private func update(deaddropCell: ContactCell, msgId: Int) {
+    private func update(deaddropCell: AvatarTextCell, msgId: Int) {
         deaddropCell.backgroundColor = DcColors.deaddropBackground
         deaddropCell.contentView.backgroundColor = DcColors.deaddropBackground
 
@@ -274,7 +274,7 @@ extension ChatListController: UITableViewDataSource, UITableViewDelegate {
         archiveCell.textLabel?.textColor = .systemBlue
     }
 
-    private func update(avatarCell cell: ContactCell, cellViewModel: AvatarCellViewModel) {
+    private func update(avatarCell cell: AvatarTextCell, cellViewModel: AvatarCellViewModel) {
         cell.updateCell(cellViewModel: cellViewModel)
     }
 

+ 3 - 3
deltachat-ios/Controller/GroupChatDetailViewController.swift

@@ -25,7 +25,7 @@ class GroupChatDetailViewController: UIViewController {
         table.bounces = false
         table.register(UITableViewCell.self, forCellReuseIdentifier: "tableCell")
         table.register(ActionCell.self, forCellReuseIdentifier: "actionCell")
-        table.register(ContactCell.self, forCellReuseIdentifier: "contactCell")
+        table.register(AvatarTextCell.self, forCellReuseIdentifier: "contactCell")
 
         return table
     }()
@@ -152,7 +152,7 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
             case sectionMembersRowJoinQR:
                 return Constants.defaultCellHeight
             default:
-                return ContactCell.cellHeight
+                return AvatarTextCell.cellHeight
             }
         case sectionLeaveGroup:
             return Constants.defaultCellHeight
@@ -183,7 +183,7 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
                 return cell
             default:
                 let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
-                if let contactCell = cell as? ContactCell {
+                if let contactCell = cell as? AvatarTextCell {
                     let contact = groupMembers[row - sectionMembersStaticRowCount]
                     let displayName = contact.displayName
                     contactCell.nameLabel.text = displayName

+ 5 - 5
deltachat-ios/Controller/GroupMembersViewController.swift

@@ -162,7 +162,7 @@ class AddGroupMembersViewController: GroupMembersViewController {
         case sectionNewContact:
             return Constants.defaultCellHeight
         case sectionMemberList:
-            return ContactCell.cellHeight
+            return AvatarTextCell.cellHeight
         default:
             return Constants.defaultCellHeight
         }
@@ -334,7 +334,7 @@ class GroupMembersViewController: UITableViewController, UISearchResultsUpdating
     }
 
     override func viewDidLoad() {
-        tableView.register(ContactCell.self, forCellReuseIdentifier: contactCellReuseIdentifier)
+        tableView.register(AvatarTextCell.self, forCellReuseIdentifier: contactCellReuseIdentifier)
         navigationItem.searchController = searchController
         if #available(iOS 11.0, *) {
             navigationItem.hidesSearchBarWhenScrolling = false
@@ -351,7 +351,7 @@ class GroupMembersViewController: UITableViewController, UISearchResultsUpdating
     }
 
     override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
-        return ContactCell.cellHeight
+        return AvatarTextCell.cellHeight
     }
 
     override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
@@ -367,7 +367,7 @@ class GroupMembersViewController: UITableViewController, UISearchResultsUpdating
     }
 
     func getContactCell(cellForRowAt indexPath: IndexPath) -> UITableViewCell {
-        guard let cell: ContactCell = tableView.dequeueReusableCell(withIdentifier: contactCellReuseIdentifier, for: indexPath) as? ContactCell else {
+        guard let cell: AvatarTextCell = tableView.dequeueReusableCell(withIdentifier: contactCellReuseIdentifier, for: indexPath) as? AvatarTextCell else {
             fatalError("shouldn't happen")
         }
 
@@ -416,7 +416,7 @@ class GroupMembersViewController: UITableViewController, UISearchResultsUpdating
         tableView.reloadData()
     }
 
-    private func updateContactCell(cell: ContactCell, contactWithHighlight: ContactWithSearchResults) {
+    private func updateContactCell(cell: AvatarTextCell, contactWithHighlight: ContactWithSearchResults) {
         let contact = contactWithHighlight.contact
         let displayName = contact.displayName
 

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

@@ -82,7 +82,7 @@ class NewChatViewController: UITableViewController {
             navigationItem.hidesSearchBarWhenScrolling = false
         }
         tableView.register(ActionCell.self, forCellReuseIdentifier: "actionCell")
-        tableView.register(ContactCell.self, forCellReuseIdentifier: "contactCell")
+        tableView.register(AvatarTextCell.self, forCellReuseIdentifier: "contactCell")
     }
 
     override func viewWillAppear(_ animated: Bool) {
@@ -155,12 +155,12 @@ class NewChatViewController: UITableViewController {
             return Constants.defaultCellHeight
         } else if section == sectionImportedContacts {
             if deviceContactAccessGranted {
-                return ContactCell.cellHeight
+                return AvatarTextCell.cellHeight
             } else {
                 return Constants.defaultCellHeight
             }
         } else {
-            return ContactCell.cellHeight
+            return AvatarTextCell.cellHeight
         }
     }
 
@@ -185,7 +185,7 @@ class NewChatViewController: UITableViewController {
             // import device contacts section
             if deviceContactAccessGranted {
                 let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
-                if let contactCell = cell as? ContactCell {
+                if let contactCell = cell as? AvatarTextCell {
                     let contact: ContactWithSearchResults = contactSearchResultByRow(row)
                     updateContactCell(cell: contactCell, contactWithHighlight: contact)
                 }
@@ -200,7 +200,7 @@ class NewChatViewController: UITableViewController {
         } else {
             // section contact list if device contacts are not imported
             let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
-            if let contactCell = cell as? ContactCell {
+            if let contactCell = cell as? AvatarTextCell {
                 let contact: ContactWithSearchResults = contactSearchResultByRow(row)
                 updateContactCell(cell: contactCell, contactWithHighlight: contact)
             }
@@ -318,7 +318,7 @@ class NewChatViewController: UITableViewController {
         }
     }
 
-    private func updateContactCell(cell: ContactCell, contactWithHighlight: ContactWithSearchResults) {
+    private func updateContactCell(cell: AvatarTextCell, contactWithHighlight: ContactWithSearchResults) {
         let contact = contactWithHighlight.contact
         let displayName = contact.displayName
 

+ 3 - 3
deltachat-ios/Controller/NewGroupController.swift

@@ -62,7 +62,7 @@ class NewGroupController: UITableViewController, MediaPickerDelegate {
         navigationItem.rightBarButtonItem = doneButton
         tableView.bounces = false
         doneButton.isEnabled = false
-        tableView.register(ContactCell.self, forCellReuseIdentifier: "contactCell")
+        tableView.register(AvatarTextCell.self, forCellReuseIdentifier: "contactCell")
         tableView.register(ActionCell.self, forCellReuseIdentifier: "actionCell")
         self.hideKeyboardOnTap()
     }
@@ -178,7 +178,7 @@ class NewGroupController: UITableViewController, MediaPickerDelegate {
             }
         default:
             let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
-            if let contactCell = cell as? ContactCell {
+            if let contactCell = cell as? AvatarTextCell {
                 let contact = DcContact(id: groupContactIds[row])
                 let displayName = contact.displayName
                 contactCell.nameLabel.text = displayName
@@ -214,7 +214,7 @@ class NewGroupController: UITableViewController, MediaPickerDelegate {
         case sectionInvite:
             return Constants.defaultCellHeight
         default:
-            return ContactCell.cellHeight
+            return AvatarTextCell.cellHeight
         }
     }
 

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

@@ -4,7 +4,8 @@ protocol ContactCellDelegate: class {
     func onAvatarTapped(at index: Int)
 }
 
-class ContactCell: UITableViewCell {
+// cell is used for displaying chats and contacts
+class AvatarTextCell: UITableViewCell {
 
     static let cellHeight: CGFloat = 74.5
 
@@ -25,10 +26,12 @@ class ContactCell: UITableViewCell {
         label.font = UIFont.systemFont(ofSize: 16, weight: .medium)
         label.lineBreakMode = .byTruncatingTail
         label.textColor = DcColors.defaultTextColor
+<<<<<<< HEAD:deltachat-ios/View/ContactCell.swift
         label.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 1), for: NSLayoutConstraint.Axis.horizontal)
         // label.makeBorder()
+=======
+>>>>>>> renamed contactCell into AvatarTextCell:deltachat-ios/View/AvatarTextCell.swift
         return label
-
     }()
 
     let emailLabel: UILabel = {

+ 1 - 1
deltachat-ios/View/ContactDetailHeader.swift

@@ -1,6 +1,6 @@
 import UIKit
 
-class ContactDetailHeader: ContactCell {
+class ContactDetailHeader: AvatarTextCell {
     init() {
         super.init(style: .default, reuseIdentifier: nil)
         let bg = UIColor(red: 248 / 255, green: 248 / 255, blue: 255 / 255, alpha: 1.0)