@@ -736,29 +736,37 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
736736 case let . webViewData( text) :
737737 attributedString = NSAttributedString ( string: strings. Notification_WebAppSentData ( text) . string, font: titleFont, textColor: primaryTextColor)
738738 case let . giftPremium( currency, amount, _, _, _, _, _) :
739- let price = formatCurrencyAmount ( amount, currency: currency)
740- if message. author? . id == accountPeerId {
741- attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_SentYou ( price) . _tuple, body: bodyAttributes, argumentAttributes: [ 0 : boldAttributes] )
739+ if !forAdditionalServiceMessage {
740+ attributedString = NSAttributedString ( string: strings. Notification_Gift, font: titleFont, textColor: primaryTextColor)
742741 } else {
743- var attributes = peerMentionsAttributes ( primaryTextColor: primaryTextColor, peerIds: [ ( 0 , message. author? . id) ] )
744- attributes [ 1 ] = boldAttributes
745- attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_Sent ( compactAuthorName, price) . _tuple, body: bodyAttributes, argumentAttributes: attributes)
742+ let price = formatCurrencyAmount ( amount, currency: currency)
743+ if message. author? . id == accountPeerId {
744+ attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_SentYou ( price) . _tuple, body: bodyAttributes, argumentAttributes: [ 0 : boldAttributes] )
745+ } else {
746+ var attributes = peerMentionsAttributes ( primaryTextColor: primaryTextColor, peerIds: [ ( 0 , message. author? . id) ] )
747+ attributes [ 1 ] = boldAttributes
748+ attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_Sent ( compactAuthorName, price) . _tuple, body: bodyAttributes, argumentAttributes: attributes)
749+ }
746750 }
747751 case let . giftStars( currency, amount, count, _, _, _) :
748752 let _ = count
749- let price = formatCurrencyAmount ( amount, currency: currency)
750- if message. author? . id == accountPeerId {
751- attributedString = addAttributesToStringWithRanges ( strings. Notification_StarsGift_SentYou ( price) . _tuple, body: bodyAttributes, argumentAttributes: [ 0 : boldAttributes] )
753+ if !forAdditionalServiceMessage {
754+ attributedString = NSAttributedString ( string: strings. Notification_Gift, font: titleFont, textColor: primaryTextColor)
752755 } else {
753- var authorName = compactAuthorName
754- var peerIds : [ ( Int , EnginePeer . Id ? ) ] = [ ( 0 , message. author? . id) ]
755- if message. id. peerId. namespace == Namespaces . Peer. CloudUser && message. id. peerId. id. _internalGetInt64Value ( ) == 777000 {
756- authorName = strings. Notification_StarsGift_UnknownUser
757- peerIds = [ ]
756+ let price = formatCurrencyAmount ( amount, currency: currency)
757+ if message. author? . id == accountPeerId {
758+ attributedString = addAttributesToStringWithRanges ( strings. Notification_StarsGift_SentYou ( price) . _tuple, body: bodyAttributes, argumentAttributes: [ 0 : boldAttributes] )
759+ } else {
760+ var authorName = compactAuthorName
761+ var peerIds : [ ( Int , EnginePeer . Id ? ) ] = [ ( 0 , message. author? . id) ]
762+ if message. id. peerId. namespace == Namespaces . Peer. CloudUser && message. id. peerId. id. _internalGetInt64Value ( ) == 777000 {
763+ authorName = strings. Notification_StarsGift_UnknownUser
764+ peerIds = [ ]
765+ }
766+ var attributes = peerMentionsAttributes ( primaryTextColor: primaryTextColor, peerIds: peerIds)
767+ attributes [ 1 ] = boldAttributes
768+ attributedString = addAttributesToStringWithRanges ( strings. Notification_StarsGift_Sent ( authorName, price) . _tuple, body: bodyAttributes, argumentAttributes: attributes)
758769 }
759- var attributes = peerMentionsAttributes ( primaryTextColor: primaryTextColor, peerIds: peerIds)
760- attributes [ 1 ] = boldAttributes
761- attributedString = addAttributesToStringWithRanges ( strings. Notification_StarsGift_Sent ( authorName, price) . _tuple, body: bodyAttributes, argumentAttributes: attributes)
762770 }
763771 case let . topicCreated( title, iconColor, iconFileId) :
764772 if forForumOverview {
@@ -957,13 +965,17 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
957965 let mutableAttributedString = NSMutableAttributedString ( attributedString: stringWithAppliedEntities ( text, entities: entities ?? [ ] , baseColor: primaryTextColor, linkColor: primaryTextColor, baseFont: titleFont, linkFont: titleBoldFont, boldFont: titleBoldFont, italicFont: titleFont, boldItalicFont: titleBoldFont, fixedFont: titleFont, blockQuoteFont: titleFont, underlineLinks: false , message: message. _asMessage ( ) ) )
958966 attributedString = mutableAttributedString
959967 } else if boostPeerId == nil , let currency, let amount {
960- let price = formatCurrencyAmount ( amount, currency: currency)
961- if message. author? . id == accountPeerId {
962- attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_SentYou ( price) . _tuple, body: bodyAttributes, argumentAttributes: [ 0 : boldAttributes] )
968+ if !forAdditionalServiceMessage {
969+ attributedString = NSAttributedString ( string: strings. Notification_Gift, font: titleFont, textColor: primaryTextColor)
963970 } else {
964- var attributes = peerMentionsAttributes ( primaryTextColor: primaryTextColor, peerIds: [ ( 0 , message. author? . id) ] )
965- attributes [ 1 ] = boldAttributes
966- attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_Sent ( compactAuthorName, price) . _tuple, body: bodyAttributes, argumentAttributes: attributes)
971+ let price = formatCurrencyAmount ( amount, currency: currency)
972+ if message. author? . id == accountPeerId {
973+ attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_SentYou ( price) . _tuple, body: bodyAttributes, argumentAttributes: [ 0 : boldAttributes] )
974+ } else {
975+ var attributes = peerMentionsAttributes ( primaryTextColor: primaryTextColor, peerIds: [ ( 0 , message. author? . id) ] )
976+ attributes [ 1 ] = boldAttributes
977+ attributedString = addAttributesToStringWithRanges ( strings. Notification_PremiumGift_Sent ( compactAuthorName, price) . _tuple, body: bodyAttributes, argumentAttributes: attributes)
978+ }
967979 }
968980 } else {
969981 attributedString = NSAttributedString ( string: strings. Notification_GiftLink, font: titleFont, textColor: primaryTextColor)
@@ -1055,9 +1067,13 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
10551067 case . prizeStars:
10561068 attributedString = NSAttributedString ( string: strings. Notification_StarsPrize, font: titleFont, textColor: primaryTextColor)
10571069 case let . starGift( gift, _, text, entities, _, _, _) :
1058- if !forAdditionalServiceMessage, let text {
1059- let mutableAttributedString = NSMutableAttributedString ( attributedString: stringWithAppliedEntities ( text, entities: entities ?? [ ] , baseColor: primaryTextColor, linkColor: primaryTextColor, baseFont: titleFont, linkFont: titleBoldFont, boldFont: titleBoldFont, italicFont: titleFont, boldItalicFont: titleBoldFont, fixedFont: titleFont, blockQuoteFont: titleFont, underlineLinks: false , message: message. _asMessage ( ) ) )
1060- attributedString = mutableAttributedString
1070+ if !forAdditionalServiceMessage {
1071+ if let text {
1072+ let mutableAttributedString = NSMutableAttributedString ( attributedString: stringWithAppliedEntities ( text, entities: entities ?? [ ] , baseColor: primaryTextColor, linkColor: primaryTextColor, baseFont: titleFont, linkFont: titleBoldFont, boldFont: titleBoldFont, italicFont: titleFont, boldItalicFont: titleBoldFont, fixedFont: titleFont, blockQuoteFont: titleFont, underlineLinks: false , message: message. _asMessage ( ) ) )
1073+ attributedString = mutableAttributedString
1074+ } else {
1075+ attributedString = NSAttributedString ( string: strings. Notification_Gift, font: titleFont, textColor: primaryTextColor)
1076+ }
10611077 } else {
10621078 let starsPrice = strings. Notification_StarsGift_Stars ( Int32 ( gift. price) )
10631079 var authorName = compactAuthorName
0 commit comments