Cherry-pick various fixes

This commit is contained in:
Ilya Laktyushin 2021-09-26 10:14:56 +03:00
parent c315e84d5e
commit b90e16d94e
16 changed files with 105 additions and 39 deletions

View File

@ -774,7 +774,7 @@ class ChatListItemNode: ItemListRevealOptionsItemNode {
return return
} }
if case let .peer(_, peer, _, _, _, _, _, _, promoInfo, _, _, _) = item.content { if case let .peer(_, peer, _, _, _, _, _, _, promoInfo, _, _, _) = item.content {
if promoInfo == nil, let mainPeer = peer.chatMainPeer { if promoInfo == nil, let mainPeer = peer.peer {
item.interaction.togglePeerSelected(mainPeer) item.interaction.togglePeerSelected(mainPeer)
} }
} }

View File

@ -100,7 +100,15 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
textIsReady = true textIsReady = true
} }
case .generic: case .generic:
break var messageTypes = Set<MessageGroupType>()
for message in messages {
messageTypes.insert(singleMessageType(message: message))
}
if messageTypes.count == 2 && messageTypes.contains(.photos) && messageTypes.contains(.videos) {
if !messageText.isEmpty {
textIsReady = true
}
}
} }
} }

View File

@ -6,9 +6,11 @@ import CoreText
private let defaultFont = UIFont.systemFont(ofSize: 15.0) private let defaultFont = UIFont.systemFont(ofSize: 15.0)
private final class TextNodeStrikethrough { private final class TextNodeStrikethrough {
let range: NSRange
let frame: CGRect let frame: CGRect
init(frame: CGRect) { init(range: NSRange, frame: CGRect) {
self.range = range
self.frame = frame self.frame = frame
} }
} }
@ -990,7 +992,7 @@ public class TextNode: ASDisplayNode {
let lowerX = floor(CTLineGetOffsetForStringIndex(coreTextLine, range.location, nil)) let lowerX = floor(CTLineGetOffsetForStringIndex(coreTextLine, range.location, nil))
let upperX = ceil(CTLineGetOffsetForStringIndex(coreTextLine, range.location + range.length, nil)) let upperX = ceil(CTLineGetOffsetForStringIndex(coreTextLine, range.location + range.length, nil))
let x = lowerX < upperX ? lowerX : upperX let x = lowerX < upperX ? lowerX : upperX
strikethroughs.append(TextNodeStrikethrough(frame: CGRect(x: x, y: 0.0, width: abs(upperX - lowerX), height: fontLineHeight))) strikethroughs.append(TextNodeStrikethrough(range: range, frame: CGRect(x: x, y: 0.0, width: abs(upperX - lowerX), height: fontLineHeight)))
} else if let paragraphStyle = attributes[NSAttributedString.Key.paragraphStyle] as? NSParagraphStyle { } else if let paragraphStyle = attributes[NSAttributedString.Key.paragraphStyle] as? NSParagraphStyle {
headIndent = paragraphStyle.headIndent headIndent = paragraphStyle.headIndent
@ -1042,7 +1044,7 @@ public class TextNode: ASDisplayNode {
let lowerX = floor(CTLineGetOffsetForStringIndex(coreTextLine, range.location, nil)) let lowerX = floor(CTLineGetOffsetForStringIndex(coreTextLine, range.location, nil))
let upperX = ceil(CTLineGetOffsetForStringIndex(coreTextLine, range.location + range.length, nil)) let upperX = ceil(CTLineGetOffsetForStringIndex(coreTextLine, range.location + range.length, nil))
let x = lowerX < upperX ? lowerX : upperX let x = lowerX < upperX ? lowerX : upperX
strikethroughs.append(TextNodeStrikethrough(frame: CGRect(x: x, y: 0.0, width: abs(upperX - lowerX), height: fontLineHeight))) strikethroughs.append(TextNodeStrikethrough(range: range, frame: CGRect(x: x, y: 0.0, width: abs(upperX - lowerX), height: fontLineHeight)))
} else if let paragraphStyle = attributes[NSAttributedString.Key.paragraphStyle] as? NSParagraphStyle { } else if let paragraphStyle = attributes[NSAttributedString.Key.paragraphStyle] as? NSParagraphStyle {
headIndent = paragraphStyle.headIndent headIndent = paragraphStyle.headIndent
} }
@ -1190,6 +1192,15 @@ public class TextNode: ASDisplayNode {
if !line.strikethroughs.isEmpty { if !line.strikethroughs.isEmpty {
for strikethrough in line.strikethroughs { for strikethrough in line.strikethroughs {
var textColor: UIColor?
layout.attributedString?.enumerateAttributes(in: NSMakeRange(line.range.location, line.range.length), options: []) { attributes, range, _ in
if range == strikethrough.range, let color = attributes[NSAttributedString.Key.foregroundColor] as? UIColor {
textColor = color
}
}
if let textColor = textColor {
context.setFillColor(textColor.cgColor)
}
let frame = strikethrough.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY) let frame = strikethrough.frame.offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
context.fill(CGRect(x: frame.minX, y: frame.minY - 5.0, width: frame.width, height: 1.0)) context.fill(CGRect(x: frame.minX, y: frame.minY - 5.0, width: frame.width, height: 1.0))
} }

View File

@ -587,8 +587,12 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
} else if let media = media as? TelegramMediaFile, !media.isAnimated { } else if let media = media as? TelegramMediaFile, !media.isAnimated {
for attribute in media.attributes { for attribute in media.attributes {
switch attribute { switch attribute {
case .Video: case let .Video(_, dimensions, _):
canFullscreen = true if dimensions.height > 0 {
if CGFloat(dimensions.width) / CGFloat(dimensions.height) > 1.33 {
canFullscreen = true
}
}
default: default:
break break
} }
@ -1114,7 +1118,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
} }
var preferredAction = ShareControllerPreferredAction.default var preferredAction = ShareControllerPreferredAction.default
var actionCompletionText: String = "" var actionCompletionText: String?
if let generalMessageContentKind = generalMessageContentKind { if let generalMessageContentKind = generalMessageContentKind {
switch generalMessageContentKind { switch generalMessageContentKind {
case .image: case .image:
@ -1164,6 +1168,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
} else if let image = content.image { } else if let image = content.image {
subject = .media(.webPage(webPage: WebpageReference(webpage), media: image)) subject = .media(.webPage(webPage: WebpageReference(webpage), media: image))
preferredAction = .saveToCameraRoll preferredAction = .saveToCameraRoll
actionCompletionText = strongSelf.presentationData.strings.Gallery_ImageSaved
} }
} }
} else if let file = m as? TelegramMediaFile { } else if let file = m as? TelegramMediaFile {
@ -1185,7 +1190,7 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
self?.interacting?(false) self?.interacting?(false)
} }
shareController.actionCompleted = { [weak self] in shareController.actionCompleted = { [weak self] in
if let strongSelf = self { if let strongSelf = self, let actionCompletionText = actionCompletionText {
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .mediaSaved(text: actionCompletionText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil) strongSelf.controllerInteraction?.presentController(UndoOverlayController(presentationData: presentationData, content: .mediaSaved(text: actionCompletionText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
} }

View File

@ -899,6 +899,8 @@ public final class ListMessageFileItemNode: ListMessageNode {
if isVoice { if isVoice {
iconStatusBackgroundColor = item.presentationData.theme.theme.list.itemAccentColor iconStatusBackgroundColor = item.presentationData.theme.theme.list.itemAccentColor
iconStatusForegroundColor = item.presentationData.theme.theme.list.itemCheckColors.foregroundColor iconStatusForegroundColor = item.presentationData.theme.theme.list.itemCheckColors.foregroundColor
} else if isAudio {
iconStatusForegroundColor = item.presentationData.theme.theme.list.itemCheckColors.foregroundColor
} }
if !isAudio && !isInstantVideo { if !isAudio && !isInstantVideo {
@ -929,6 +931,7 @@ public final class ListMessageFileItemNode: ListMessageNode {
} }
self.iconStatusNode.backgroundNodeColor = iconStatusBackgroundColor self.iconStatusNode.backgroundNodeColor = iconStatusBackgroundColor
self.iconStatusNode.foregroundNodeColor = iconStatusForegroundColor self.iconStatusNode.foregroundNodeColor = iconStatusForegroundColor
self.iconStatusNode.overlayForegroundNodeColor = .white
self.iconStatusNode.transitionToState(iconStatusState) self.iconStatusNode.transitionToState(iconStatusState)
} }

View File

@ -151,10 +151,10 @@ private enum ChannelDiscussionGroupSetupControllerEntry: ItemListNodeEntry {
let text: String let text: String
if let peer = peer as? TelegramChannel, let addressName = peer.addressName, !addressName.isEmpty { if let peer = peer as? TelegramChannel, let addressName = peer.addressName, !addressName.isEmpty {
text = "@\(addressName)" text = "@\(addressName)"
} else if let peer = peer as? TelegramChannel, case .group = peer.info { } else if let peer = peer as? TelegramChannel, case .broadcast = peer.info {
text = strings.Channel_DiscussionGroup_PrivateGroup
} else {
text = strings.Channel_DiscussionGroup_PrivateChannel text = strings.Channel_DiscussionGroup_PrivateChannel
} else {
text = strings.Channel_DiscussionGroup_PrivateGroup
} }
return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: nameOrder, context: arguments.context, peer: peer, aliasHandling: .standard, nameStyle: .plain, presence: nil, text: .text(text, .secondary), label: .none, editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), revealOptions: nil, switchValue: nil, enabled: true, selectable: true, sectionId: self.section, action: { return ItemListPeerItem(presentationData: presentationData, dateTimeFormat: PresentationDateTimeFormat(), nameDisplayOrder: nameOrder, context: arguments.context, peer: peer, aliasHandling: .standard, nameStyle: .plain, presence: nil, text: .text(text, .secondary), label: .none, editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), revealOptions: nil, switchValue: nil, enabled: true, selectable: true, sectionId: self.section, action: {
arguments.selectGroup(peer.id) arguments.selectGroup(peer.id)

View File

@ -280,6 +280,9 @@ public final class PhoneInputNode: ASDisplayNode, UITextFieldDelegate {
if !realRegionPrefix.hasPrefix("+") { if !realRegionPrefix.hasPrefix("+") {
realRegionPrefix = "+" + realRegionPrefix realRegionPrefix = "+" + realRegionPrefix
} }
if !text.hasPrefix("+") {
text = "+" + text
}
numberText = cleanPrefix(String(text[realRegionPrefix.endIndex...])) numberText = cleanPrefix(String(text[realRegionPrefix.endIndex...]))
} else { } else {
realRegionPrefix = text realRegionPrefix = text

View File

@ -436,7 +436,7 @@ final class ThemeAccentColorController: ViewController {
if case let .colors(initialThemeReference, true) = strongSelf.mode { if case let .colors(initialThemeReference, true) = strongSelf.mode {
let themeSpecificAccentColor = settings.themeSpecificAccentColors[themeReference.index] let themeSpecificAccentColor = settings.themeSpecificAccentColors[themeReference.index]
var customAccentColor: UIColor? var customAccentColor: UIColor?
if let color = themeSpecificAccentColor?.color { if let color = themeSpecificAccentColor?.color, color != .clear {
accentColor = color accentColor = color
customAccentColor = accentColor customAccentColor = accentColor
} else if case let .cloud(cloudTheme) = initialThemeReference, let settings = cloudTheme.theme.settings { } else if case let .cloud(cloudTheme) = initialThemeReference, let settings = cloudTheme.theme.settings {

View File

@ -892,7 +892,7 @@ public final class ShareController: ViewController {
} else { } else {
context = self.sharedContext.makeTempAccountContext(account: self.currentAccount) context = self.sharedContext.makeTempAccountContext(account: self.currentAccount)
} }
self.controllerNode.transitionToProgressWithValue(signal: SaveToCameraRoll.saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: mediaReference) |> map(Optional.init)) self.controllerNode.transitionToProgressWithValue(signal: SaveToCameraRoll.saveToCameraRoll(context: context, postbox: context.account.postbox, mediaReference: mediaReference) |> map(Optional.init), dismissImmediately: true)
} }
private func switchToAccount(account: Account, animateIn: Bool) { private func switchToAccount(account: Account, animateIn: Bool) {

View File

@ -1851,7 +1851,7 @@ public final class VoiceChatController: ViewController {
self.listContainer.addSubnode(self.topCornersNode) self.listContainer.addSubnode(self.topCornersNode)
self.contentContainer.addSubnode(self.bottomGradientNode) self.contentContainer.addSubnode(self.bottomGradientNode)
self.contentContainer.addSubnode(self.bottomPanelBackgroundNode) self.contentContainer.addSubnode(self.bottomPanelBackgroundNode)
self.contentContainer.addSubnode(self.participantsNode) // self.contentContainer.addSubnode(self.participantsNode)
self.contentContainer.addSubnode(self.tileGridNode) self.contentContainer.addSubnode(self.tileGridNode)
self.contentContainer.addSubnode(self.mainStageContainerNode) self.contentContainer.addSubnode(self.mainStageContainerNode)
self.contentContainer.addSubnode(self.transitionContainerNode) self.contentContainer.addSubnode(self.transitionContainerNode)
@ -1975,7 +1975,6 @@ public final class VoiceChatController: ViewController {
} }
}) })
let titleAndRecording: Signal<(String?, Bool), NoError> = self.call.state let titleAndRecording: Signal<(String?, Bool), NoError> = self.call.state
|> map { state -> (String?, Bool) in |> map { state -> (String?, Bool) in
return (state.title, state.recordingStartTimestamp != nil) return (state.title, state.recordingStartTimestamp != nil)
@ -1993,7 +1992,7 @@ public final class VoiceChatController: ViewController {
} else { } else {
isLivestream = false isLivestream = false
} }
strongSelf.participantsNode.isHidden = !isLivestream strongSelf.participantsNode.isHidden = !isLivestream || strongSelf.isScheduled
strongSelf.peer = peer strongSelf.peer = peer
strongSelf.currentTitleIsCustom = title != nil strongSelf.currentTitleIsCustom = title != nil
@ -5020,12 +5019,12 @@ public final class VoiceChatController: ViewController {
displayPanelVideos = self.displayPanelVideos displayPanelVideos = self.displayPanelVideos
} }
let isLivestream: Bool // let isLivestream: Bool
if let channel = self.peer as? TelegramChannel, case .broadcast = channel.info { // if let channel = self.peer as? TelegramChannel, case .broadcast = channel.info {
isLivestream = true // isLivestream = true
} else { // } else {
isLivestream = false // isLivestream = false
} // }
let canManageCall = self.callState?.canManageCall ?? false let canManageCall = self.callState?.canManageCall ?? false
@ -5042,9 +5041,9 @@ public final class VoiceChatController: ViewController {
let memberState: VoiceChatPeerEntry.State let memberState: VoiceChatPeerEntry.State
var memberMuteState: GroupCallParticipantsContext.Participant.MuteState? var memberMuteState: GroupCallParticipantsContext.Participant.MuteState?
if member.hasRaiseHand && !(member.muteState?.canUnmute ?? true) { if member.hasRaiseHand && !(member.muteState?.canUnmute ?? true) {
if isLivestream && !canManageCall { // if isLivestream && !canManageCall {
continue // continue
} // }
memberState = .raisedHand memberState = .raisedHand
memberMuteState = member.muteState memberMuteState = member.muteState
@ -5081,9 +5080,9 @@ public final class VoiceChatController: ViewController {
self.raisedHandDisplayDisposables[member.peer.id] = nil self.raisedHandDisplayDisposables[member.peer.id] = nil
} }
if isLivestream && !(memberMuteState?.canUnmute ?? true) { // if isLivestream && !(memberMuteState?.canUnmute ?? true) {
continue // continue
} // }
} }
var memberPeer = member.peer var memberPeer = member.peer

View File

@ -7,7 +7,9 @@ private final class LinkHelperClass: NSObject {
} }
public func canSendMessagesToPeer(_ peer: Peer) -> Bool { public func canSendMessagesToPeer(_ peer: Peer) -> Bool {
if peer is TelegramUser || peer is TelegramGroup { if let peer = peer as? TelegramUser, peer.username == "replies" {
return false
} else if peer is TelegramUser || peer is TelegramGroup {
return !peer.isDeleted return !peer.isDeleted
} else if let peer = peer as? TelegramSecretChat { } else if let peer = peer as? TelegramSecretChat {
return peer.embeddedState == .active return peer.embeddedState == .active

View File

@ -59,6 +59,11 @@ public func customizeDefaultDarkPresentationTheme(theme: PresentationTheme, edit
} else { } else {
bubbleColors = [accentColor.withMultiplied(hue: 0.966, saturation: 0.61, brightness: 0.98).rgb, accentColor.rgb] bubbleColors = [accentColor.withMultiplied(hue: 0.966, saturation: 0.61, brightness: 0.98).rgb, accentColor.rgb]
} }
} else {
let accentColor = accentColor ?? UIColor(rgb: 0xffffff)
if accentColor.rgb == 0xffffff {
monochrome = true
}
} }
var badgeFillColor: UIColor? var badgeFillColor: UIColor?

View File

@ -47,6 +47,10 @@ public func makePresentationTheme(cloudTheme: TelegramTheme) -> PresentationThem
} }
public func makePresentationTheme(mediaBox: MediaBox, themeReference: PresentationThemeReference, extendingThemeReference: PresentationThemeReference? = nil, accentColor: UIColor? = nil, outgoingAccentColor: UIColor? = nil, backgroundColors: [UInt32] = [], bubbleColors: [UInt32] = [], animateBubbleColors: Bool? = nil, wallpaper: TelegramWallpaper? = nil, baseColor: PresentationThemeBaseColor? = nil, serviceBackgroundColor: UIColor? = nil, preview: Bool = false) -> PresentationTheme? { public func makePresentationTheme(mediaBox: MediaBox, themeReference: PresentationThemeReference, extendingThemeReference: PresentationThemeReference? = nil, accentColor: UIColor? = nil, outgoingAccentColor: UIColor? = nil, backgroundColors: [UInt32] = [], bubbleColors: [UInt32] = [], animateBubbleColors: Bool? = nil, wallpaper: TelegramWallpaper? = nil, baseColor: PresentationThemeBaseColor? = nil, serviceBackgroundColor: UIColor? = nil, preview: Bool = false) -> PresentationTheme? {
var accentColor = accentColor
if accentColor == .clear {
accentColor = nil
}
let theme: PresentationTheme let theme: PresentationTheme
switch themeReference { switch themeReference {
case let .builtin(reference): case let .builtin(reference):

View File

@ -281,12 +281,20 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
string = strings.Conversation_AutoremoveTimerSetUser(authorString, timeValue).string string = strings.Conversation_AutoremoveTimerSetUser(authorString, timeValue).string
} }
} else if let _ = messagePeer as? TelegramGroup { } else if let _ = messagePeer as? TelegramGroup {
string = strings.Conversation_AutoremoveTimerSetGroup(timeValue).string if message.author?.id == accountPeerId {
} else if let channel = messagePeer as? TelegramChannel { string = strings.Conversation_AutoremoveTimerSetUserYou(timeValue).string
if case .group = channel.info {
string = strings.Conversation_AutoremoveTimerSetGroup(timeValue).string
} else { } else {
string = strings.Conversation_AutoremoveTimerSetChannel(timeValue).string string = strings.Conversation_AutoremoveTimerSetGroup(timeValue).string
}
} else if let channel = messagePeer as? TelegramChannel {
if message.author?.id == accountPeerId {
string = strings.Conversation_AutoremoveTimerSetUserYou(timeValue).string
} else {
if case .group = channel.info {
string = strings.Conversation_AutoremoveTimerSetGroup(timeValue).string
} else {
string = strings.Conversation_AutoremoveTimerSetChannel(timeValue).string
}
} }
} else { } else {
if message.author?.id == accountPeerId { if message.author?.id == accountPeerId {

View File

@ -797,6 +797,10 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
isMediaEnabled = false isMediaEnabled = false
} }
} }
var isRecording = false
if let _ = interfaceState.inputTextPanelState.mediaRecordingState {
isRecording = true
}
var isScheduledMessages = false var isScheduledMessages = false
if case .scheduledMessages = interfaceState.subject { if case .scheduledMessages = interfaceState.subject {
@ -811,7 +815,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
} }
} }
transition.updateAlpha(layer: self.attachmentButton.layer, alpha: isMediaEnabled ? 1.0 : 0.4) transition.updateAlpha(layer: self.attachmentButton.layer, alpha: isMediaEnabled ? 1.0 : 0.4)
self.attachmentButton.isEnabled = isMediaEnabled self.attachmentButton.isEnabled = isMediaEnabled && !isRecording
self.attachmentButton.accessibilityTraits = (!isSlowmodeActive || isMediaEnabled) ? [.button] : [.button, .notEnabled] self.attachmentButton.accessibilityTraits = (!isSlowmodeActive || isMediaEnabled) ? [.button] : [.button, .notEnabled]
self.attachmentButtonDisabledNode.isHidden = !isSlowmodeActive || isMediaEnabled self.attachmentButtonDisabledNode.isHidden = !isSlowmodeActive || isMediaEnabled
@ -840,6 +844,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
if self.theme == nil || !self.theme!.chat.inputPanel.inputTextColor.isEqual(interfaceState.theme.chat.inputPanel.inputTextColor) { if self.theme == nil || !self.theme!.chat.inputPanel.inputTextColor.isEqual(interfaceState.theme.chat.inputPanel.inputTextColor) {
let textColor = interfaceState.theme.chat.inputPanel.inputTextColor let textColor = interfaceState.theme.chat.inputPanel.inputTextColor
let tintColor = interfaceState.theme.list.itemAccentColor
let baseFontSize = max(minInputFontSize, interfaceState.fontSize.baseDisplaySize) let baseFontSize = max(minInputFontSize, interfaceState.fontSize.baseDisplaySize)
if let textInputNode = self.textInputNode { if let textInputNode = self.textInputNode {
@ -849,6 +854,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
textInputNode.selectedRange = range textInputNode.selectedRange = range
} }
textInputNode.typingAttributes = [NSAttributedString.Key.font.rawValue: Font.regular(baseFontSize), NSAttributedString.Key.foregroundColor.rawValue: textColor] textInputNode.typingAttributes = [NSAttributedString.Key.font.rawValue: Font.regular(baseFontSize), NSAttributedString.Key.foregroundColor.rawValue: textColor]
textInputNode.tintColor = tintColor
} }
} }

View File

@ -2009,13 +2009,25 @@ final class PeerInfoHeaderNode: ASDisplayNode {
} }
if let peer = peer { if let peer = peer {
var title: String
if peer.id == self.context.account.peerId && !self.isSettings { if peer.id == self.context.account.peerId && !self.isSettings {
titleString = NSAttributedString(string: presentationData.strings.Conversation_SavedMessages, font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) title = presentationData.strings.Conversation_SavedMessages
} else if peer.id == self.context.account.peerId && !self.isSettings { } else if peer.id == self.context.account.peerId && !self.isSettings {
titleString = NSAttributedString(string: presentationData.strings.DialogList_Replies, font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) title = presentationData.strings.DialogList_Replies
} else { } else {
titleString = NSAttributedString(string: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor) title = peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)
} }
title = title.replacingOccurrences(of: "\u{1160}", with: "").replacingOccurrences(of: "\u{3164}", with: "")
if title.isEmpty {
if let peer = peer as? TelegramUser, let phone = peer.phone {
title = formatPhoneNumber(phone)
} else if let addressName = peer.addressName {
title = "@\(addressName)"
} else {
title = " "
}
}
titleString = NSAttributedString(string: title, font: Font.semibold(24.0), textColor: presentationData.theme.list.itemPrimaryTextColor)
if self.isSettings, let user = peer as? TelegramUser { if self.isSettings, let user = peer as? TelegramUser {
let formattedPhone = formatPhoneNumber(user.phone ?? "") let formattedPhone = formatPhoneNumber(user.phone ?? "")