Update API

This commit is contained in:
Ilya Laktyushin 2024-07-16 16:44:04 +04:00
parent 3808020843
commit d6052431ca
3 changed files with 15 additions and 10 deletions

View File

@ -242,7 +242,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1744710921] = { return Api.DocumentAttribute.parse_documentAttributeHasStickers($0) } dict[-1744710921] = { return Api.DocumentAttribute.parse_documentAttributeHasStickers($0) }
dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) } dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) }
dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) } dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) }
dict[-745541182] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) } dict[389652397] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[761606687] = { return Api.DraftMessage.parse_draftMessage($0) } dict[761606687] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) } dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) } dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) }
@ -1398,7 +1398,7 @@ public extension Api {
return parser(reader) return parser(reader)
} }
else { else {
telegramApiLog("Type constructor \(String(UInt32(bitPattern: signature), radix: 16, uppercase: false)) not found") telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
return nil return nil
} }
} }

View File

@ -1473,7 +1473,7 @@ public extension Api {
case documentAttributeHasStickers case documentAttributeHasStickers
case documentAttributeImageSize(w: Int32, h: Int32) case documentAttributeImageSize(w: Int32, h: Int32)
case documentAttributeSticker(flags: Int32, alt: String, stickerset: Api.InputStickerSet, maskCoords: Api.MaskCoords?) case documentAttributeSticker(flags: Int32, alt: String, stickerset: Api.InputStickerSet, maskCoords: Api.MaskCoords?)
case documentAttributeVideo(flags: Int32, duration: Double, w: Int32, h: Int32, preloadPrefixSize: Int32?) case documentAttributeVideo(flags: Int32, duration: Double, w: Int32, h: Int32, preloadPrefixSize: Int32?, videoStartTs: Double?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -1529,15 +1529,16 @@ public extension Api {
stickerset.serialize(buffer, true) stickerset.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {maskCoords!.serialize(buffer, true)} if Int(flags) & Int(1 << 0) != 0 {maskCoords!.serialize(buffer, true)}
break break
case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize): case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize, let videoStartTs):
if boxed { if boxed {
buffer.appendInt32(-745541182) buffer.appendInt32(389652397)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeDouble(duration, buffer: buffer, boxed: false) serializeDouble(duration, buffer: buffer, boxed: false)
serializeInt32(w, buffer: buffer, boxed: false) serializeInt32(w, buffer: buffer, boxed: false)
serializeInt32(h, buffer: buffer, boxed: false) serializeInt32(h, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(preloadPrefixSize!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeInt32(preloadPrefixSize!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {serializeDouble(videoStartTs!, buffer: buffer, boxed: false)}
break break
} }
} }
@ -1558,8 +1559,8 @@ public extension Api {
return ("documentAttributeImageSize", [("w", w as Any), ("h", h as Any)]) return ("documentAttributeImageSize", [("w", w as Any), ("h", h as Any)])
case .documentAttributeSticker(let flags, let alt, let stickerset, let maskCoords): case .documentAttributeSticker(let flags, let alt, let stickerset, let maskCoords):
return ("documentAttributeSticker", [("flags", flags as Any), ("alt", alt as Any), ("stickerset", stickerset as Any), ("maskCoords", maskCoords as Any)]) return ("documentAttributeSticker", [("flags", flags as Any), ("alt", alt as Any), ("stickerset", stickerset as Any), ("maskCoords", maskCoords as Any)])
case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize): case .documentAttributeVideo(let flags, let duration, let w, let h, let preloadPrefixSize, let videoStartTs):
return ("documentAttributeVideo", [("flags", flags as Any), ("duration", duration as Any), ("w", w as Any), ("h", h as Any), ("preloadPrefixSize", preloadPrefixSize as Any)]) return ("documentAttributeVideo", [("flags", flags as Any), ("duration", duration as Any), ("w", w as Any), ("h", h as Any), ("preloadPrefixSize", preloadPrefixSize as Any), ("videoStartTs", videoStartTs as Any)])
} }
} }
@ -1671,13 +1672,16 @@ public extension Api {
_4 = reader.readInt32() _4 = reader.readInt32()
var _5: Int32? var _5: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_5 = reader.readInt32() } if Int(_1!) & Int(1 << 2) != 0 {_5 = reader.readInt32() }
var _6: Double?
if Int(_1!) & Int(1 << 4) != 0 {_6 = reader.readDouble() }
let _c1 = _1 != nil let _c1 = _1 != nil
let _c2 = _2 != nil let _c2 = _2 != nil
let _c3 = _3 != nil let _c3 = _3 != nil
let _c4 = _4 != nil let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 { let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
return Api.DocumentAttribute.documentAttributeVideo(flags: _1!, duration: _2!, w: _3!, h: _4!, preloadPrefixSize: _5) if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.DocumentAttribute.documentAttributeVideo(flags: _1!, duration: _2!, w: _3!, h: _4!, preloadPrefixSize: _5, videoStartTs: _6)
} }
else { else {
return nil return nil

View File

@ -99,7 +99,8 @@ func telegramMediaFileAttributesFromApiAttributes(_ attributes: [Api.DocumentAtt
result.append(.ImageSize(size: PixelDimensions(width: w, height: h))) result.append(.ImageSize(size: PixelDimensions(width: w, height: h)))
case .documentAttributeAnimated: case .documentAttributeAnimated:
result.append(.Animated) result.append(.Animated)
case let .documentAttributeVideo(flags, duration, w, h, preloadSize): case let .documentAttributeVideo(flags, duration, w, h, preloadSize, videoStartTime):
let _ = videoStartTime
var videoFlags = TelegramMediaVideoFlags() var videoFlags = TelegramMediaVideoFlags()
if (flags & (1 << 0)) != 0 { if (flags & (1 << 0)) != 0 {
videoFlags.insert(.instantRoundVideo) videoFlags.insert(.instantRoundVideo)