mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
@@ -88,7 +87,7 @@ public enum MessageContentKind: Equatable {
|
||||
}
|
||||
}
|
||||
|
||||
public func messageContentKind(contentSettings: ContentSettings, message: Message, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, accountPeerId: PeerId) -> MessageContentKind {
|
||||
public func messageContentKind(contentSettings: ContentSettings, message: EngineMessage, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, accountPeerId: EnginePeer.Id) -> MessageContentKind {
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? RestrictedContentMessageAttribute {
|
||||
if let text = attribute.platformText(platform: "ios", contentSettings: contentSettings) {
|
||||
@@ -98,25 +97,25 @@ public func messageContentKind(contentSettings: ContentSettings, message: Messag
|
||||
}
|
||||
}
|
||||
for media in message.media {
|
||||
if let kind = mediaContentKind(media, message: message, strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, accountPeerId: accountPeerId) {
|
||||
if let kind = mediaContentKind(EngineMedia(media), message: message, strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, accountPeerId: accountPeerId) {
|
||||
return kind
|
||||
}
|
||||
}
|
||||
return .text(message.text)
|
||||
}
|
||||
|
||||
public func mediaContentKind(_ media: Media, message: Message? = nil, strings: PresentationStrings? = nil, nameDisplayOrder: PresentationPersonNameOrder? = nil, dateTimeFormat: PresentationDateTimeFormat? = nil, accountPeerId: PeerId? = nil) -> MessageContentKind? {
|
||||
public func mediaContentKind(_ media: EngineMedia, message: EngineMessage? = nil, strings: PresentationStrings? = nil, nameDisplayOrder: PresentationPersonNameOrder? = nil, dateTimeFormat: PresentationDateTimeFormat? = nil, accountPeerId: EnginePeer.Id? = nil) -> MessageContentKind? {
|
||||
switch media {
|
||||
case let expiredMedia as TelegramMediaExpiredContent:
|
||||
case let .expiredContent(expiredMedia):
|
||||
switch expiredMedia.data {
|
||||
case .image:
|
||||
return .expiredImage
|
||||
case .file:
|
||||
return .expiredVideo
|
||||
}
|
||||
case _ as TelegramMediaImage:
|
||||
case .image:
|
||||
return .image
|
||||
case let file as TelegramMediaFile:
|
||||
case let .file(file):
|
||||
var fileName: String = ""
|
||||
for attribute in file.attributes {
|
||||
switch attribute {
|
||||
@@ -154,27 +153,27 @@ public func mediaContentKind(_ media: Media, message: Message? = nil, strings: P
|
||||
return .sticker("")
|
||||
}
|
||||
return .file(fileName)
|
||||
case _ as TelegramMediaContact:
|
||||
case .contact:
|
||||
return .contact
|
||||
case let game as TelegramMediaGame:
|
||||
case let .game(game):
|
||||
return .game(game.title)
|
||||
case let location as TelegramMediaMap:
|
||||
case let .geo(location):
|
||||
if location.liveBroadcastingTimeout != nil {
|
||||
return .liveLocation
|
||||
} else {
|
||||
return .location
|
||||
}
|
||||
case _ as TelegramMediaAction:
|
||||
case .action:
|
||||
if let message = message, let strings = strings, let nameDisplayOrder = nameDisplayOrder, let accountPeerId = accountPeerId {
|
||||
return .text(plainServiceMessageString(strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat ?? PresentationDateTimeFormat(timeFormat: .military, dateFormat: .dayFirst, dateSeparator: ".", dateSuffix: "", requiresFullYear: false, decimalSeparator: ".", groupingSeparator: ""), message: message, accountPeerId: accountPeerId, forChatList: false) ?? "")
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
case let poll as TelegramMediaPoll:
|
||||
case let .poll(poll):
|
||||
return .poll(poll.text)
|
||||
case let dice as TelegramMediaDice:
|
||||
case let .dice(dice):
|
||||
return .dice(dice.emoji)
|
||||
case let invoice as TelegramMediaInvoice:
|
||||
case let .invoice(invoice):
|
||||
return .invoice(invoice.title)
|
||||
default:
|
||||
return nil
|
||||
@@ -230,7 +229,7 @@ public func stringForMediaKind(_ kind: MessageContentKind, strings: Presentation
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionStringForMessage(contentSettings: ContentSettings, message: Message, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, accountPeerId: PeerId) -> (String, Bool) {
|
||||
public func descriptionStringForMessage(contentSettings: ContentSettings, message: EngineMessage, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, accountPeerId: EnginePeer.Id) -> (String, Bool) {
|
||||
let contentKind = messageContentKind(contentSettings: contentSettings, message: message, strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, accountPeerId: accountPeerId)
|
||||
if !message.text.isEmpty && ![.expiredImage, .expiredVideo].contains(contentKind.key) {
|
||||
return (foldLineBreaks(message.text), false)
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
import TelegramCore
|
||||
|
||||
public func stringForFullAuthorName(message: Message, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, accountPeerId: PeerId) -> String {
|
||||
public func stringForFullAuthorName(message: EngineMessage, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, accountPeerId: EnginePeer.Id) -> String {
|
||||
var authorString = ""
|
||||
if let author = message.author, [Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(message.id.peerId.namespace) {
|
||||
var authorName = ""
|
||||
@@ -13,12 +12,12 @@ public func stringForFullAuthorName(message: Message, strings: PresentationStrin
|
||||
} else {
|
||||
authorName = author.compactDisplayTitle
|
||||
}
|
||||
if let peer = message.peers[message.id.peerId], author.id != peer.id {
|
||||
if let peer = message.peers[message.id.peerId].flatMap(EnginePeer.init), author.id != peer.id {
|
||||
authorString = "\(authorName) → \(peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder))"
|
||||
} else {
|
||||
authorString = authorName
|
||||
}
|
||||
} else if let peer = message.peers[message.id.peerId] {
|
||||
} else if let peer = message.peers[message.id.peerId].flatMap(EnginePeer.init) {
|
||||
if message.id.peerId.namespace == Namespaces.Peer.CloudChannel {
|
||||
authorString = peer.displayTitle(strings: strings, displayOrder: nameDisplayOrder)
|
||||
} else {
|
||||
|
||||
@@ -345,10 +345,8 @@ public func stringForRelativeLiveLocationUpdateTimestamp(strings: PresentationSt
|
||||
}
|
||||
}
|
||||
|
||||
public func stringAndActivityForUserPresence(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, presence: TelegramUserPresence, relativeTo timestamp: Int32, expanded: Bool = false) -> (String, Bool) {
|
||||
public func stringAndActivityForUserPresence(strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, presence: EnginePeer.Presence, relativeTo timestamp: Int32, expanded: Bool = false) -> (String, Bool) {
|
||||
switch presence.status {
|
||||
case .none:
|
||||
return (strings.LastSeen_Offline, false)
|
||||
case let .present(statusTimestamp):
|
||||
if statusTimestamp >= timestamp {
|
||||
return (strings.Presence_online, true)
|
||||
@@ -402,6 +400,8 @@ public func stringAndActivityForUserPresence(strings: PresentationStrings, dateT
|
||||
return (strings.LastSeen_WithinAWeek, false)
|
||||
case .lastMonth:
|
||||
return (strings.LastSeen_WithinAMonth, false)
|
||||
case .longTimeAgo:
|
||||
return (strings.LastSeen_ALongTimeAgo, false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import TelegramPresentationData
|
||||
import TelegramUIPreferences
|
||||
@@ -12,11 +11,11 @@ import Markdown
|
||||
private let titleFont = Font.regular(13.0)
|
||||
private let titleBoldFont = Font.bold(13.0)
|
||||
|
||||
private func peerMentionAttributes(primaryTextColor: UIColor, peerId: PeerId) -> MarkdownAttributeSet {
|
||||
private func peerMentionAttributes(primaryTextColor: UIColor, peerId: EnginePeer.Id) -> MarkdownAttributeSet {
|
||||
return MarkdownAttributeSet(font: titleBoldFont, textColor: primaryTextColor, additionalAttributes: [TelegramTextAttributes.PeerMention: TelegramPeerMention(peerId: peerId, mention: "")])
|
||||
}
|
||||
|
||||
private func peerMentionsAttributes(primaryTextColor: UIColor, peerIds: [(Int, PeerId?)]) -> [Int: MarkdownAttributeSet] {
|
||||
private func peerMentionsAttributes(primaryTextColor: UIColor, peerIds: [(Int, EnginePeer.Id?)]) -> [Int: MarkdownAttributeSet] {
|
||||
var result: [Int: MarkdownAttributeSet] = [:]
|
||||
for (index, peerId) in peerIds {
|
||||
if let peerId = peerId {
|
||||
@@ -26,11 +25,11 @@ private func peerMentionsAttributes(primaryTextColor: UIColor, peerIds: [(Int, P
|
||||
return result
|
||||
}
|
||||
|
||||
public func plainServiceMessageString(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: Message, accountPeerId: PeerId, forChatList: Bool) -> String? {
|
||||
public func plainServiceMessageString(strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id, forChatList: Bool) -> String? {
|
||||
return universalServiceMessageString(presentationData: nil, strings: strings, nameDisplayOrder: nameDisplayOrder, dateTimeFormat: dateTimeFormat, message: message, accountPeerId: accountPeerId, forChatList: forChatList)?.string
|
||||
}
|
||||
|
||||
public func universalServiceMessageString(presentationData: (PresentationTheme, TelegramWallpaper)?, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: Message, accountPeerId: PeerId, forChatList: Bool) -> NSAttributedString? {
|
||||
public func universalServiceMessageString(presentationData: (PresentationTheme, TelegramWallpaper)?, strings: PresentationStrings, nameDisplayOrder: PresentationPersonNameOrder, dateTimeFormat: PresentationDateTimeFormat, message: EngineMessage, accountPeerId: EnginePeer.Id, forChatList: Bool) -> NSAttributedString? {
|
||||
var attributedString: NSAttributedString?
|
||||
|
||||
let primaryTextColor: UIColor
|
||||
@@ -71,7 +70,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedChat(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, peerId)]))
|
||||
}
|
||||
} else {
|
||||
var attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
var attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
let resultTitleString: PresentationStrings.FormattedString
|
||||
if peerIds.count == 1 {
|
||||
attributePeerIds.append((1, peerIds.first))
|
||||
@@ -90,7 +89,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_LeftChat(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
||||
}
|
||||
} else {
|
||||
var attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
var attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
if peerIds.count == 1 {
|
||||
attributePeerIds.append((1, peerIds.first))
|
||||
}
|
||||
@@ -153,10 +152,10 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
case deleted
|
||||
}
|
||||
|
||||
var pinnedMessage: Message?
|
||||
var pinnedMessage: EngineMessage?
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? ReplyMessageAttribute, let message = message.associatedMessages[attribute.messageId] {
|
||||
pinnedMessage = message
|
||||
pinnedMessage = EngineMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +332,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
break
|
||||
case .historyScreenshot:
|
||||
let text: String
|
||||
if message.effectivelyIncoming(accountPeerId) {
|
||||
if message._asMessage().effectivelyIncoming(accountPeerId) {
|
||||
text = strings.Notification_SecretChatMessageScreenshot(message.author?.compactDisplayTitle ?? "").string
|
||||
} else {
|
||||
text = strings.Notification_SecretChatMessageScreenshotSelf
|
||||
@@ -380,10 +379,10 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
argumentAttributes[1] = MarkdownAttributeSet(font: titleBoldFont, textColor: primaryTextColor, additionalAttributes: [:])
|
||||
attributedString = addAttributesToStringWithRanges(formatWithArgumentRanges(baseString, ranges, [authorName, gameTitle ?? ""]), body: bodyAttributes, argumentAttributes: argumentAttributes)
|
||||
case let .paymentSent(currency, totalAmount):
|
||||
var invoiceMessage: Message?
|
||||
var invoiceMessage: EngineMessage?
|
||||
for attribute in message.attributes {
|
||||
if let attribute = attribute as? ReplyMessageAttribute, let message = message.associatedMessages[attribute.messageId] {
|
||||
invoiceMessage = message
|
||||
invoiceMessage = EngineMessage(message)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +448,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
if let scheduleDate = scheduleDate {
|
||||
if message.author?.id.namespace == Namespaces.Peer.CloudChannel {
|
||||
let titleString: PresentationStrings.FormattedString
|
||||
if let channel = message.author as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = message.author, case .broadcast = channel.info {
|
||||
titleString = humanReadableStringForTimestamp(strings: strings, dateTimeFormat: dateTimeFormat, timestamp: scheduleDate, alwaysShowTime: true, allowYesterday: false, format: HumanReadableStringFormat(dateFormatString: { strings.Notification_LiveStreamScheduled($0) }, tomorrowFormatString: { strings.Notification_LiveStreamScheduledTomorrow($0) }, todayFormatString: { strings.Notification_LiveStreamScheduledToday($0) }))
|
||||
} else {
|
||||
titleString = humanReadableStringForTimestamp(strings: strings, dateTimeFormat: dateTimeFormat, timestamp: scheduleDate, alwaysShowTime: true, allowYesterday: false, format: HumanReadableStringFormat(dateFormatString: { strings.Notification_VoiceChatScheduledChannel($0) }, tomorrowFormatString: { strings.Notification_VoiceChatScheduledTomorrowChannel($0) }, todayFormatString: { strings.Notification_VoiceChatScheduledTodayChannel($0) }))
|
||||
@@ -457,34 +456,34 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
attributedString = NSAttributedString(string: titleString.string, font: titleFont, textColor: primaryTextColor)
|
||||
} else {
|
||||
let titleString = humanReadableStringForTimestamp(strings: strings, dateTimeFormat: dateTimeFormat, timestamp: scheduleDate, alwaysShowTime: true, allowYesterday: false, format: HumanReadableStringFormat(dateFormatString: { strings.Notification_VoiceChatScheduled(authorName, $0) }, tomorrowFormatString: { strings.Notification_VoiceChatScheduledTomorrow(authorName, $0) }, todayFormatString: { strings.Notification_VoiceChatScheduledToday(authorName, $0) }))
|
||||
let attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
let attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
attributedString = addAttributesToStringWithRanges(titleString._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: attributePeerIds))
|
||||
}
|
||||
} else if let duration = duration {
|
||||
if message.author?.id.namespace == Namespaces.Peer.CloudChannel {
|
||||
let titleString: String
|
||||
if let channel = message.author as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = message.author, case .broadcast = channel.info {
|
||||
titleString = strings.Notification_LiveStreamEnded(callDurationString(strings: strings, value: duration)).string
|
||||
} else {
|
||||
titleString = strings.Notification_VoiceChatEnded(callDurationString(strings: strings, value: duration)).string
|
||||
}
|
||||
attributedString = NSAttributedString(string: titleString, font: titleFont, textColor: primaryTextColor)
|
||||
} else {
|
||||
let attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
let attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
let titleString = strings.Notification_VoiceChatEndedGroup(authorName, callDurationString(strings: strings, value: duration))
|
||||
attributedString = addAttributesToStringWithRanges(titleString._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: attributePeerIds))
|
||||
}
|
||||
} else {
|
||||
if message.author?.id.namespace == Namespaces.Peer.CloudChannel {
|
||||
let titleString: String
|
||||
if let channel = message.author as? TelegramChannel, case .broadcast = channel.info {
|
||||
if case let .channel(channel) = message.author, case .broadcast = channel.info {
|
||||
titleString = strings.Notification_LiveStreamStarted
|
||||
} else {
|
||||
titleString = strings.Notification_VoiceChatStartedChannel
|
||||
}
|
||||
attributedString = NSAttributedString(string: titleString, font: titleFont, textColor: primaryTextColor)
|
||||
} else {
|
||||
let attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
let attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
let titleString = strings.Notification_VoiceChatStarted(authorName)
|
||||
attributedString = addAttributesToStringWithRanges(titleString._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: attributePeerIds))
|
||||
}
|
||||
@@ -522,7 +521,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
typesString.append(strings.Notification_PassportValueEmail)
|
||||
}
|
||||
}
|
||||
attributedString = NSAttributedString(string: strings.Notification_PassportValuesSentMessage(message.peers[message.id.peerId]?.compactDisplayTitle ?? "", typesString).string, font: titleFont, textColor: primaryTextColor)
|
||||
attributedString = NSAttributedString(string: strings.Notification_PassportValuesSentMessage(message.peers[message.id.peerId].flatMap(EnginePeer.init)?.compactDisplayTitle ?? "", typesString).string, font: titleFont, textColor: primaryTextColor)
|
||||
case .peerJoined:
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_Joined(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)]))
|
||||
case .phoneNumberRequest:
|
||||
@@ -530,14 +529,14 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
case let .geoProximityReached(fromId, toId, distance):
|
||||
let distanceString = stringForDistance(strings: strings, distance: Double(distance))
|
||||
if fromId == accountPeerId {
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_ProximityYouReached(distanceString, message.peers[toId]?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "")._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(1, toId)]))
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_ProximityYouReached(distanceString, message.peers[toId].flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "")._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(1, toId)]))
|
||||
} else if toId == accountPeerId {
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_ProximityReachedYou(message.peers[fromId]?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "", distanceString)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, fromId)]))
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_ProximityReachedYou(message.peers[fromId].flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "", distanceString)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, fromId)]))
|
||||
} else {
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_ProximityReached(message.peers[fromId]?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "", distanceString, message.peers[toId]?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "")._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, fromId), (2, toId)]))
|
||||
attributedString = addAttributesToStringWithRanges(strings.Notification_ProximityReached(message.peers[fromId].flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "", distanceString, message.peers[toId].flatMap(EnginePeer.init)?.displayTitle(strings: strings, displayOrder: nameDisplayOrder) ?? "")._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, fromId), (2, toId)]))
|
||||
}
|
||||
case let .inviteToGroupPhoneCall(_, _, peerIds):
|
||||
var attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
var attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
let resultTitleString: PresentationStrings.FormattedString
|
||||
if peerIds.count == 1 {
|
||||
if peerIds[0] == accountPeerId {
|
||||
@@ -559,7 +558,7 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
|
||||
} else if message.author?.id == accountPeerId {
|
||||
attributedString = NSAttributedString(string: strings.Notification_YouDisabledTheme, font: titleFont, textColor: primaryTextColor)
|
||||
} else {
|
||||
let attributePeerIds: [(Int, PeerId?)] = [(0, message.author?.id)]
|
||||
let attributePeerIds: [(Int, EnginePeer.Id?)] = [(0, message.author?.id)]
|
||||
let resultTitleString = strings.Notification_DisabledTheme(authorName)
|
||||
attributedString = addAttributesToStringWithRanges(resultTitleString._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: attributePeerIds))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user