Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2026-02-04 16:36:18 +04:00
commit 29678db680
2 changed files with 17 additions and 9 deletions

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
}
}
}

View file

@ -363,13 +363,16 @@ public class BufferReader {
if count == 0 {
return 0
}
else if count > 0 && count <= 4 || self.offset + UInt(count) <= self.buffer._size {
var value: Int32 = 0
memcpy(&value, self.buffer.data?.advanced(by: Int(self.offset)), count)
self.offset += UInt(count)
return value
guard count > 0, count <= 4, self.offset + UInt(count) <= self.buffer._size else {
return nil
}
return nil
guard let bufferData = self.buffer.data else {
return nil
}
var value: Int32 = 0
memcpy(&value, bufferData.advanced(by: Int(self.offset)), count)
self.offset += UInt(count)
return value
}
public func readBuffer(_ count: Int) -> Buffer? {