Prechádzať zdrojové kódy

use appropriate contact-names - name, displayName or nameNAddr

B. Petersen 5 rokov pred
rodič
commit
064d8f62c5

+ 2 - 2
deltachat-ios/Controller/ChatViewController.swift

@@ -481,7 +481,7 @@ extension ChatViewController: MessagesDataSource {
     func avatar(for message: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) -> Avatar {
         let message = messageList[indexPath.section]
         let contact = message.fromContact
-        return Avatar(image: contact.profileImage, initials: Utils.getInitials(inputName: contact.name))
+        return Avatar(image: contact.profileImage, initials: Utils.getInitials(inputName: contact.displayName))
     }
 
     func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
@@ -706,7 +706,7 @@ extension ChatViewController: MessagesDisplayDelegate {
     func configureAvatarView(_ avatarView: AvatarView, for message: MessageType, at indexPath: IndexPath, in _: MessagesCollectionView) {
         let message = messageList[indexPath.section]
         let contact = message.fromContact
-        let avatar = Avatar(image: contact.profileImage, initials: Utils.getInitials(inputName: contact.name))
+        let avatar = Avatar(image: contact.profileImage, initials: Utils.getInitials(inputName: contact.displayName))
         avatarView.set(avatar: avatar)
         avatarView.isHidden = isNextMessageSameSender(at: indexPath) || message.isInfo
         avatarView.backgroundColor = contact.color

+ 4 - 3
deltachat-ios/Controller/ContactDetailViewController.swift

@@ -31,7 +31,7 @@ class ContactDetailViewController: UITableViewController {
         let cell = ActionCell()
         cell.accessibilityIdentifier = CellIdentifiers.chat.rawValue
         cell.actionColor = SystemColor.blue.uiColor
-        cell.actionTitle = String.localizedStringWithFormat(String.localized("ask_start_chat_with"), contact.name)
+        cell.actionTitle = String.localizedStringWithFormat(String.localized("ask_start_chat_with"), contact.nameNAddr)
         cell.selectionStyle = .none
         return cell
     }()
@@ -116,11 +116,12 @@ class ContactDetailViewController: UITableViewController {
     override func tableView(_: UITableView, viewForHeaderInSection section: Int) -> UIView? {
         if section == 0 {
             let header = ContactDetailHeader()
-            header.updateDetails(title: contact.name, subtitle: contact.email)
+            let displayName = contact.displayName
+            header.updateDetails(title: displayName, subtitle: contact.email)
             if let img = contact.profileImage {
                 header.setImage(img)
             } else {
-                header.setBackupImage(name: contact.name, color: contact.color)
+                header.setBackupImage(name: displayName, color: contact.color)
             }
             header.setVerified(isVerified: contact.isVerified)
             return header

+ 4 - 3
deltachat-ios/Controller/ContactListController.swift

@@ -185,6 +185,7 @@ class ContactListController: UITableViewController {
 
     private func updateContactCell(cell: ContactCell, contactWithHighlight: ContactWithSearchResults) {
         let contact = contactWithHighlight.contact
+        let displayName = contact.displayName
 
         if let nameHighlightedIndexes = contactWithHighlight.indexesToHighlight.filter({ $0.contactDetail == .NAME }).first,
             let emailHighlightedIndexes = contactWithHighlight.indexesToHighlight.filter({ $0.contactDetail == .EMAIL }).first {
@@ -192,13 +193,13 @@ class ContactListController: UITableViewController {
             let nameLabelFontSize = cell.nameLabel.font.pointSize
             let emailLabelFontSize = cell.emailLabel.font.pointSize
 
-            cell.nameLabel.attributedText = contact.name.boldAt(indexes: nameHighlightedIndexes.indexes, fontSize: nameLabelFontSize)
+            cell.nameLabel.attributedText = displayName.boldAt(indexes: nameHighlightedIndexes.indexes, fontSize: nameLabelFontSize)
             cell.emailLabel.attributedText = contact.email.boldAt(indexes: emailHighlightedIndexes.indexes, fontSize: emailLabelFontSize)
         } else {
-            cell.nameLabel.text = contact.name
+            cell.nameLabel.text = displayName
             cell.emailLabel.text = contact.email
         }
-        cell.initialsLabel.text = Utils.getInitials(inputName: contact.name)
+        cell.initialsLabel.text = Utils.getInitials(inputName: displayName)
         cell.setColor(contact.color)
     }
 

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

@@ -159,9 +159,10 @@ extension GroupChatDetailViewController: UITableViewDelegate, UITableViewDataSou
                 let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
                 if let contactCell = cell as? ContactCell {
                     let contact = groupMembers[row - staticCellCountMemberSection]
-                    contactCell.nameLabel.text = contact.name
+                    let displayName = contact.displayName
+                    contactCell.nameLabel.text = displayName
                     contactCell.emailLabel.text = contact.email
-                    contactCell.initialsLabel.text = Utils.getInitials(inputName: contact.name)
+                    contactCell.initialsLabel.text = Utils.getInitials(inputName: displayName)
                     contactCell.setColor(contact.color)
                 }
                 return cell

+ 3 - 2
deltachat-ios/Controller/GroupMembersViewController.swift

@@ -134,9 +134,10 @@ class GroupMembersViewController: UITableViewController {
         let contactRow = row
 
         let contact = DcContact(id: contactIds[contactRow])
-        cell.nameLabel.text = contact.name
+        let displayName = contact.displayName
+        cell.nameLabel.text = displayName
         cell.emailLabel.text = contact.email
-        cell.initialsLabel.text = Utils.getInitials(inputName: contact.name)
+        cell.initialsLabel.text = Utils.getInitials(inputName: displayName)
         cell.accessoryType = selectedContactIds.contains(contactIds[row]) ? .checkmark : .none
         cell.setColor(contact.color)
 

+ 3 - 2
deltachat-ios/Controller/GroupNameController.swift

@@ -69,9 +69,10 @@ class GroupNameController: UITableViewController {
             let cell = tableView.dequeueReusableCell(withIdentifier: "contactCell", for: indexPath)
             if let contactCell = cell as? ContactCell {
                 let contact = DcContact(id: groupContactIds[row])
-                contactCell.nameLabel.text = contact.name
+                let displayName = contact.displayName
+                contactCell.nameLabel.text = displayName
                 contactCell.emailLabel.text = contact.email
-                contactCell.initialsLabel.text = Utils.getInitials(inputName: contact.name)
+                contactCell.initialsLabel.text = Utils.getInitials(inputName: displayName)
                 contactCell.setColor(contact.color)
             }
             return cell

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

@@ -275,6 +275,7 @@ class NewChatViewController: UITableViewController {
 
     private func updateContactCell(cell: ContactCell, contactWithHighlight: ContactWithSearchResults) {
         let contact = contactWithHighlight.contact
+        let displayName = contact.displayName
 
         if let nameHighlightedIndexes = contactWithHighlight.indexesToHighlight.filter({ $0.contactDetail == .NAME }).first,
             let emailHighlightedIndexes = contactWithHighlight.indexesToHighlight.filter({ $0.contactDetail == .EMAIL }).first {
@@ -282,13 +283,13 @@ class NewChatViewController: UITableViewController {
             let nameLabelFontSize = cell.nameLabel.font.pointSize
             let emailLabelFontSize = cell.emailLabel.font.pointSize
 
-            cell.nameLabel.attributedText = contact.name.boldAt(indexes: nameHighlightedIndexes.indexes, fontSize: nameLabelFontSize)
+            cell.nameLabel.attributedText = displayName.boldAt(indexes: nameHighlightedIndexes.indexes, fontSize: nameLabelFontSize)
             cell.emailLabel.attributedText = contact.email.boldAt(indexes: emailHighlightedIndexes.indexes, fontSize: emailLabelFontSize)
         } else {
-            cell.nameLabel.text = contact.name
+            cell.nameLabel.text = displayName
             cell.emailLabel.text = contact.email
         }
-        cell.initialsLabel.text = Utils.getInitials(inputName: contact.name)
+        cell.initialsLabel.text = Utils.getInitials(inputName: displayName)
         cell.setColor(contact.color)
     }
 

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

@@ -277,7 +277,7 @@ class NewProfileViewController: UIViewController, QrCodeReaderDelegate {
 
         let profileView = ProfileView(frame: CGRect())
         if let contact = self.contact {
-            let name = DcConfig.displayname ?? contact.name
+            let name = DcConfig.displayname ?? contact.displayName
             profileView.setBackgroundColor(bg)
             profileView.nameLabel.text = name
             profileView.emailLabel.text = contact.email

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

@@ -138,7 +138,7 @@ class ProfileViewController: UITableViewController {
         if section == 0 {
             let contactCell = ContactCell()
             if let contact = self.contact {
-                let name = DcConfig.displayname ?? contact.name
+                let name = DcConfig.displayname ?? contact.displayName
                 contactCell.backgroundColor = bg
                 contactCell.nameLabel.text = name
                 contactCell.emailLabel.text = contact.email

+ 1 - 1
deltachat-ios/DC/Wrapper.swift

@@ -421,7 +421,7 @@ class DcMsg: MessageType {
     }
 
     lazy var sender: SenderType = {
-        Sender(id: "\(fromContactId)", displayName: fromContact.name)
+        Sender(id: "\(fromContactId)", displayName: fromContact.displayName)
     }()
 
     lazy var sentDate: Date = {

+ 1 - 1
deltachat-ios/DC/events.swift

@@ -126,7 +126,7 @@ public func callbackSwift(event: CInt, data1: CUnsignedLong, data2: CUnsignedLon
 
             let content = UNMutableNotificationContent()
             let msg = DcMsg(id: Int(data2))
-            content.title = msg.fromContact.name
+            content.title = msg.fromContact.displayName
             content.body = msg.summary(chars: 40) ?? ""
             content.badge = 1
             content.userInfo = userInfo