Re-commit

This commit is contained in:
Isaac 2026-02-04 18:01:47 +08:00
parent cb802c524e
commit 2bed5fab18

View file

@ -1978,13 +1978,18 @@ private final class NotificationServiceHandler {
if let media = message.media.first {
parsedMedia = media
}
if enableInlineEmoji, let textEntitiesAttribute = message.textEntitiesAttribute {
content.body = message.text
if enableInlineEmoji, let textEntitiesAttribute = message.textEntitiesAttribute, let author = message.author {
let authorTitle = author.debugDisplayTitle
let messagePrefix = "\(authorTitle): "
let messagePrefixLength = (messagePrefix as NSString).length
for entity in textEntitiesAttribute.entities {
if case let .CustomEmoji(_, fileId) = entity.type {
content.customEmoji.append(NotificationContent.CustomEmoji(range: entity.range, fileId: fileId))
content.customEmoji.append(NotificationContent.CustomEmoji(range: (entity.range.lowerBound + messagePrefixLength) ..< (entity.range.upperBound + messagePrefixLength), fileId: fileId))
}
}
if !content.customEmoji.isEmpty {
content.body = messagePrefix + message.text
}
}
}