Monoforums

This commit is contained in:
Isaac
2025-05-27 00:56:39 +08:00
parent 60f2b98ee8
commit c984cb956b
12 changed files with 83 additions and 53 deletions

View File

@@ -1262,21 +1262,28 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
let starsString = strings.Notification_PaidMessagePriceChanged_Stars(Int32(stars))
if message.author?.id == accountPeerId {
let resultString: PresentationStrings.FormattedString
if broadcastMessagesAllowed {
resultString = strings.Notification_PaidMessagePriceChangedAndEnabledChannelMessageYou(starsString)
} else {
resultString = strings.Notification_PaidMessagePriceChangedYou(starsString)
}
resultString = strings.Notification_PaidMessagePriceChangedYou(starsString)
attributedString = addAttributesToStringWithRanges(resultString._tuple, body: bodyAttributes, argumentAttributes: [0: boldAttributes])
} else {
let peerName = message.author?.compactDisplayTitle ?? ""
var attributes = peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)])
attributes[1] = boldAttributes
let resultString: PresentationStrings.FormattedString
if broadcastMessagesAllowed {
resultString = strings.Notification_PaidMessagePriceChangedAndEnabledChannelMessage(peerName, starsString)
if stars == 0 {
resultString = strings.Notification_ChannelMessagePriceZeroChanged(peerName)
} else {
var rawString = strings.Notification_ChannelMessagePriceChanged(Int32(stars))
rawString = rawString.replacingOccurrences(of: "{name}", with: peerName)
resultString = PresentationStrings.FormattedString(string: rawString, ranges: [])
}
} else {
resultString = strings.Notification_PaidMessagePriceChanged(peerName, starsString)
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
resultString = strings.Notification_ChannelMessageDisabled(peerName)
} else {
resultString = strings.Notification_PaidMessagePriceChanged(peerName, starsString)
}
}
attributedString = addAttributesToStringWithRanges(resultString._tuple, body: bodyAttributes, argumentAttributes: attributes)
}