mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-05 14:02:48 +00:00
temp ios attribute
This commit is contained in:
parent
985a8f9135
commit
bed97623a7
@ -375,7 +375,7 @@ func messageTextEntitiesFromApiEntities(_ entities: [Api.MessageEntity]) -> [Mes
|
||||
case let .messageEntitySpoiler(offset, length):
|
||||
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .Spoiler))
|
||||
case let .messageEntityAnimatedEmoji(offset, length):
|
||||
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .AnimatedEmoji))
|
||||
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .AnimatedEmoji(nil)))
|
||||
}
|
||||
}
|
||||
return result
|
||||
|
||||
@ -21,7 +21,7 @@ public enum MessageTextEntityType: Equatable {
|
||||
case Underline
|
||||
case BankCard
|
||||
case Spoiler
|
||||
case AnimatedEmoji
|
||||
case AnimatedEmoji(MediaId?)
|
||||
case Custom(type: CustomEntityType)
|
||||
}
|
||||
|
||||
@ -73,7 +73,7 @@ public struct MessageTextEntity: PostboxCoding, Codable, Equatable {
|
||||
case 17:
|
||||
self.type = .Spoiler
|
||||
case 18:
|
||||
self.type = .AnimatedEmoji
|
||||
self.type = .AnimatedEmoji(decoder.decodeObjectForKey("mediaId") as? MediaId)
|
||||
case Int32.max:
|
||||
self.type = .Custom(type: decoder.decodeInt32ForKey("type", orElse: 0))
|
||||
default:
|
||||
@ -130,7 +130,7 @@ public struct MessageTextEntity: PostboxCoding, Codable, Equatable {
|
||||
case 17:
|
||||
self.type = .Spoiler
|
||||
case 18:
|
||||
self.type = .AnimatedEmoji
|
||||
self.type = .AnimatedEmoji(try? container.decode(MediaId.self, forKey: "mediaId"))
|
||||
case Int32.max:
|
||||
let customType: Int32 = (try? container.decode(Int32.self, forKey: "type")) ?? 0
|
||||
self.type = .Custom(type: customType)
|
||||
@ -181,8 +181,13 @@ public struct MessageTextEntity: PostboxCoding, Codable, Equatable {
|
||||
encoder.encodeInt32(16, forKey: "_rawValue")
|
||||
case .Spoiler:
|
||||
encoder.encodeInt32(17, forKey: "_rawValue")
|
||||
case .AnimatedEmoji:
|
||||
case let .AnimatedEmoji(mediaId):
|
||||
encoder.encodeInt32(18, forKey: "_rawValue")
|
||||
if let mediaId = mediaId {
|
||||
encoder.encodeObject(mediaId, forKey: "mediaId")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "mediaId")
|
||||
}
|
||||
case let .Custom(type):
|
||||
encoder.encodeInt32(Int32.max, forKey: "_rawValue")
|
||||
encoder.encodeInt32(type, forKey: "type")
|
||||
@ -233,8 +238,11 @@ public struct MessageTextEntity: PostboxCoding, Codable, Equatable {
|
||||
try container.encode(16 as Int32, forKey: "_rawValue")
|
||||
case .Spoiler:
|
||||
try container.encode(17 as Int32, forKey: "_rawValue")
|
||||
case .AnimatedEmoji:
|
||||
case let .AnimatedEmoji(mediaId):
|
||||
try container.encode(18 as Int32, forKey: "_rawValue")
|
||||
if let mediaId = mediaId {
|
||||
try container.encode(mediaId, forKey: "mediaId")
|
||||
}
|
||||
case let .Custom(type):
|
||||
try container.encode(Int32.max as Int32, forKey: "_rawValue")
|
||||
try container.encode(type as Int32, forKey: "type")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user