mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Fix contact with empty name presentation
This commit is contained in:
@@ -396,7 +396,7 @@ private enum DeviceContactInfoEntry: ItemListNodeEntry {
|
|||||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||||
let arguments = arguments as! DeviceContactInfoControllerArguments
|
let arguments = arguments as! DeviceContactInfoControllerArguments
|
||||||
switch self {
|
switch self {
|
||||||
case let .info(_, _, strings, dateTimeFormat, peer, state, jobSummary, isPlain):
|
case let .info(_, _, _, dateTimeFormat, peer, state, jobSummary, _):
|
||||||
return ItemListAvatarAndNameInfoItem(accountContext: arguments.context, presentationData: presentationData, dateTimeFormat: dateTimeFormat, mode: .contact, peer: peer, presence: nil, label: jobSummary, cachedData: nil, state: state, sectionId: self.section, style: arguments.isPlain ? .plain : .blocks(withTopInset: false, withExtendedBottomInset: true), editingNameUpdated: { editingName in
|
return ItemListAvatarAndNameInfoItem(accountContext: arguments.context, presentationData: presentationData, dateTimeFormat: dateTimeFormat, mode: .contact, peer: peer, presence: nil, label: jobSummary, cachedData: nil, state: state, sectionId: self.section, style: arguments.isPlain ? .plain : .blocks(withTopInset: false, withExtendedBottomInset: true), editingNameUpdated: { editingName in
|
||||||
arguments.updateEditingName(editingName)
|
arguments.updateEditingName(editingName)
|
||||||
}, avatarTapped: {
|
}, avatarTapped: {
|
||||||
@@ -647,8 +647,13 @@ private func deviceContactInfoEntries(account: Account, presentationData: Presen
|
|||||||
let jobSummary = jobComponents.joined(separator: " — ")
|
let jobSummary = jobComponents.joined(separator: " — ")
|
||||||
|
|
||||||
let isOrganization = personName.0.isEmpty && personName.1.isEmpty && !contactData.organization.isEmpty
|
let isOrganization = personName.0.isEmpty && personName.1.isEmpty && !contactData.organization.isEmpty
|
||||||
|
|
||||||
|
var firstName: String = isOrganization ? contactData.organization : personName.0
|
||||||
|
if firstName.isEmpty {
|
||||||
|
firstName = presentationData.strings.Message_Contact
|
||||||
|
}
|
||||||
|
|
||||||
entries.append(.info(entries.count, presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer: peer ?? TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: isOrganization ? contactData.organization : personName.0, lastName: isOrganization ? nil : personName.1, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []), state: ItemListAvatarAndNameInfoItemState(editingName: editingName, updatingName: nil), job: isOrganization ? nil : jobSummary, isPlain: !isShare))
|
entries.append(.info(entries.count, presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer: peer ?? TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: firstName, lastName: isOrganization ? nil : personName.1, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []), state: ItemListAvatarAndNameInfoItemState(editingName: editingName, updatingName: nil), job: isOrganization ? nil : jobSummary, isPlain: !isShare))
|
||||||
|
|
||||||
if !selecting {
|
if !selecting {
|
||||||
if let _ = peer {
|
if let _ = peer {
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
|
|||||||
} else {
|
} else {
|
||||||
displayName = selectedContact.lastName
|
displayName = selectedContact.lastName
|
||||||
}
|
}
|
||||||
|
if displayName.isEmpty {
|
||||||
|
displayName = item.presentationData.strings.Message_Contact
|
||||||
|
}
|
||||||
|
|
||||||
let info: String
|
let info: String
|
||||||
if let previousContact = previousContact, previousContact.isEqual(to: selectedContact), let contactInfo = previousContactInfo {
|
if let previousContact = previousContact, previousContact.isEqual(to: selectedContact), let contactInfo = previousContactInfo {
|
||||||
|
|||||||
Reference in New Issue
Block a user