Skip to content

Commit 2bed5fa

Browse files
author
Isaac
committed
Re-commit
1 parent cb802c5 commit 2bed5fa

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

Telegram/NotificationService/Sources/NotificationService.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1978,13 +1978,18 @@ private final class NotificationServiceHandler {
19781978
if let media = message.media.first {
19791979
parsedMedia = media
19801980
}
1981-
if enableInlineEmoji, let textEntitiesAttribute = message.textEntitiesAttribute {
1982-
content.body = message.text
1981+
if enableInlineEmoji, let textEntitiesAttribute = message.textEntitiesAttribute, let author = message.author {
1982+
let authorTitle = author.debugDisplayTitle
1983+
let messagePrefix = "\(authorTitle): "
1984+
let messagePrefixLength = (messagePrefix as NSString).length
19831985
for entity in textEntitiesAttribute.entities {
19841986
if case let .CustomEmoji(_, fileId) = entity.type {
1985-
content.customEmoji.append(NotificationContent.CustomEmoji(range: entity.range, fileId: fileId))
1987+
content.customEmoji.append(NotificationContent.CustomEmoji(range: (entity.range.lowerBound + messagePrefixLength) ..< (entity.range.upperBound + messagePrefixLength), fileId: fileId))
19861988
}
19871989
}
1990+
if !content.customEmoji.isEmpty {
1991+
content.body = messagePrefix + message.text
1992+
}
19881993
}
19891994
}
19901995

0 commit comments

Comments
 (0)