Update API

This commit is contained in:
Ali 2023-10-24 23:35:34 +04:00
parent a50ad9d52d
commit 9d30f02b76
3 changed files with 34 additions and 18 deletions

View File

@ -216,7 +216,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) }
dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) }
dict[-745541182] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[-620277848] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[1070397423] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) }
dict[-1842457175] = { return Api.EmailVerification.parse_emailVerificationCode($0) }

View File

@ -1,13 +1,13 @@
public extension Api {
indirect enum DraftMessage: TypeConstructorDescription {
case draftMessage(flags: Int32, replyTo: Api.MessageReplyHeader?, message: String, entities: [Api.MessageEntity]?, media: Api.MessageMedia?, date: Int32)
case draftMessage(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32)
case draftMessageEmpty(flags: Int32, date: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .draftMessage(let flags, let replyTo, let message, let entities, let media, let date):
if boxed {
buffer.appendInt32(-620277848)
buffer.appendInt32(1070397423)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 4) != 0 {replyTo!.serialize(buffer, true)}
@ -42,9 +42,9 @@ public extension Api {
public static func parse_draftMessage(_ reader: BufferReader) -> DraftMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.MessageReplyHeader?
var _2: Api.InputReplyTo?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader
_2 = Api.parse(reader, signature: signature) as? Api.InputReplyTo
} }
var _3: String?
_3 = parseString(reader)
@ -52,9 +52,9 @@ public extension Api {
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
var _5: Api.MessageMedia?
var _5: Api.InputMedia?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.MessageMedia
_5 = Api.parse(reader, signature: signature) as? Api.InputMedia
} }
var _6: Int32?
_6 = reader.readInt32()

View File

@ -1538,27 +1538,43 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
var replySubject: EngineMessageReplySubject?
if let replyToMsgHeader = replyToMsgHeader {
switch replyToMsgHeader {
case let .messageReplyHeader(_, replyToMsgId, replyToPeerId, replyHeader, replyMedia, replyToTopId, quoteText, quoteEntities):
let _ = replyHeader
let _ = replyMedia
let _ = replyToTopId
case let .inputReplyToMessage(_, replyToMsgId, topMsgId, replyToPeerId, quoteText, quoteEntities):
let _ = topMsgId
var quote: EngineMessageReplyQuote?
if let quoteText = quoteText {
quote = EngineMessageReplyQuote(
text: quoteText,
entities: messageTextEntitiesFromApiEntities(quoteEntities ?? []),
media: textMediaAndExpirationTimerFromApiMedia(replyMedia, accountPeerId).media
media: nil
)
}
if let replyToMsgId = replyToMsgId {
replySubject = EngineMessageReplySubject(
messageId: MessageId(peerId: replyToPeerId?.peerId ?? peer.peerId, namespace: Namespaces.Message.Cloud, id: replyToMsgId),
quote: quote
)
var parsedReplyToPeerId: PeerId?
switch replyToPeerId {
case let .inputPeerChannel(channelId, _):
parsedReplyToPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))
case let .inputPeerChannelFromMessage(_, _, channelId):
parsedReplyToPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))
case let .inputPeerChat(chatId):
parsedReplyToPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))
case .inputPeerEmpty:
break
case .inputPeerSelf:
parsedReplyToPeerId = accountPeerId
case let .inputPeerUser(userId, _):
parsedReplyToPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
case let .inputPeerUserFromMessage(_, _, userId):
parsedReplyToPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
case .none:
break
}
case .messageReplyStoryHeader:
replySubject = EngineMessageReplySubject(
messageId: MessageId(peerId: parsedReplyToPeerId ?? peer.peerId, namespace: Namespaces.Message.Cloud, id: replyToMsgId),
quote: quote
)
case .inputReplyToStory:
break
}
}