mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
29678db680
2 changed files with 17 additions and 9 deletions
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue