This commit is contained in:
isaac 2026-05-20 00:10:13 +08:00
parent 562de27c30
commit 3f09a1f325
21 changed files with 1700 additions and 1122 deletions

View file

@ -117,8 +117,9 @@ extension RichText {
return "Photo"
case let .anchor(value, _):
return value.previewText()
case let .formula(latex):
return latex
case .formula:
//TODO:localize
return "Fx"
}
}
}
@ -168,8 +169,8 @@ extension InstantPageBlock {
return text.previewText()
case let .heading(text, _):
return text.previewText()
case let .formula(latex):
return latex
case .formula:
return "Fx"
case let .paragraph(text):
return text.previewText()
case let .preformatted(text, _):

View file

@ -1342,6 +1342,7 @@ final class InstantPageV2TableView: UIView, InstantPageItemView {
self.scrollView.alwaysBounceVertical = false
self.scrollView.showsHorizontalScrollIndicator = item.contentSize.width > item.frame.width
self.scrollView.showsVerticalScrollIndicator = false
self.scrollView.disablesInteractiveTransitionGestureRecognizer = true
self.addSubview(self.scrollView)
self.contentView.frame = CGRect(origin: .zero, size: item.contentSize)
@ -1677,6 +1678,7 @@ final class InstantPageV2FormulaView: UIView, InstantPageItemView {
scroll.alwaysBounceHorizontal = false
scroll.alwaysBounceVertical = false
scroll.contentInsetAdjustmentBehavior = .never
scroll.disablesInteractiveTransitionGestureRecognizer = true
self.addSubview(scroll)
// Layers don't autoresize with their superview; host the image layer inside a UIView

View file

@ -259,7 +259,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) }
dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) }
dict[1137015880] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) }
dict[-1763006997] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[-1743452271] = { 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) }
@ -495,7 +495,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1003796418] = { return Api.InputReplyTo.parse_inputReplyToMessage($0) }
dict[1775660101] = { return Api.InputReplyTo.parse_inputReplyToMonoForum($0) }
dict[1484862010] = { return Api.InputReplyTo.parse_inputReplyToStory($0) }
dict[-1865309654] = { return Api.InputRichMessage.parse_inputRichMessage($0) }
dict[-456898052] = { return Api.InputRichMessage.parse_inputRichMessage($0) }
dict[-722815663] = { return Api.InputRichMessage.parse_inputRichMessageHTML($0) }
dict[162300294] = { return Api.InputRichMessage.parse_inputRichMessageMarkdown($0) }
dict[-251549057] = { return Api.InputSavedStarGift.parse_inputSavedStarGiftChat($0) }
dict[545636920] = { return Api.InputSavedStarGift.parse_inputSavedStarGiftSlug($0) }
dict[1764202389] = { return Api.InputSavedStarGift.parse_inputSavedStarGiftUser($0) }
@ -753,11 +755,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1261946036] = { return Api.NotifyPeer.parse_notifyUsers($0) }
dict[1001931436] = { return Api.OutboxReadDate.parse_outboxReadDate($0) }
dict[-1738178803] = { return Api.Page.parse_page($0) }
dict[-1715334046] = { return Api.PageBlock.parse_inputPageBlockAudio($0) }
dict[1464557951] = { return Api.PageBlock.parse_inputPageBlockMap($0) }
dict[-1186155733] = { return Api.PageBlock.parse_inputPageBlockOrderedList($0) }
dict[719646565] = { return Api.PageBlock.parse_inputPageBlockPhoto($0) }
dict[-249943466] = { return Api.PageBlock.parse_inputPageBlockVideo($0) }
dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) }
dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($0) }
dict[-1162877472] = { return Api.PageBlock.parse_pageBlockAuthorDate($0) }
@ -942,20 +941,30 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-444472087] = { return Api.RequirementToContact.parse_requirementToContactPremium($0) }
dict[-797791052] = { return Api.RestrictionReason.parse_restrictionReason($0) }
dict[-1158439541] = { return Api.RichMessage.parse_richMessage($0) }
dict[764156522] = { return Api.RichText.parse_inputTextImage($0) }
dict[894777186] = { return Api.RichText.parse_textAnchor($0) }
dict[-984177571] = { return Api.RichText.parse_textAutoEmail($0) }
dict[616720265] = { return Api.RichText.parse_textAutoPhone($0) }
dict[-1402305622] = { return Api.RichText.parse_textAutoUrl($0) }
dict[-1185513171] = { return Api.RichText.parse_textBankCard($0) }
dict[1730456516] = { return Api.RichText.parse_textBold($0) }
dict[50276819] = { return Api.RichText.parse_textBotCommand($0) }
dict[2073958401] = { return Api.RichText.parse_textCashtag($0) }
dict[2120376535] = { return Api.RichText.parse_textConcat($0) }
dict[-1570679104] = { return Api.RichText.parse_textCustomEmoji($0) }
dict[-1514906069] = { return Api.RichText.parse_textDate($0) }
dict[-564523562] = { return Api.RichText.parse_textEmail($0) }
dict[-599948721] = { return Api.RichText.parse_textEmpty($0) }
dict[1816074681] = { return Api.RichText.parse_textFixed($0) }
dict[1368728810] = { return Api.RichText.parse_textHashtag($0) }
dict[136105807] = { return Api.RichText.parse_textImage($0) }
dict[-653089380] = { return Api.RichText.parse_textItalic($0) }
dict[55281185] = { return Api.RichText.parse_textMarked($0) }
dict[-1657885545] = { return Api.RichText.parse_textMath($0) }
dict[-853225660] = { return Api.RichText.parse_textMention($0) }
dict[27917308] = { return Api.RichText.parse_textMentionName($0) }
dict[483104362] = { return Api.RichText.parse_textPhone($0) }
dict[1950782688] = { return Api.RichText.parse_textPlain($0) }
dict[1277844834] = { return Api.RichText.parse_textSpoiler($0) }
dict[-1678197867] = { return Api.RichText.parse_textStrike($0) }
dict[-311786236] = { return Api.RichText.parse_textSubscript($0) }
dict[-939827711] = { return Api.RichText.parse_textSuperscript($0) }
@ -1006,6 +1015,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-368907213] = { return Api.SecureValueType.parse_secureValueTypeTemporaryRegistration($0) }
dict[-63531698] = { return Api.SecureValueType.parse_secureValueTypeUtilityBill($0) }
dict[-1206095820] = { return Api.SendAsPeer.parse_sendAsPeer($0) }
dict[-491635887] = { return Api.SendMessageAction.parse_inputSendMessageRichMessageDraftAction($0) }
dict[-44119819] = { return Api.SendMessageAction.parse_sendMessageCancelAction($0) }
dict[1653390447] = { return Api.SendMessageAction.parse_sendMessageChooseContactAction($0) }
dict[-1336228175] = { return Api.SendMessageAction.parse_sendMessageChooseStickerAction($0) }
@ -1017,6 +1027,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-718310409] = { return Api.SendMessageAction.parse_sendMessageRecordAudioAction($0) }
dict[-1997373508] = { return Api.SendMessageAction.parse_sendMessageRecordRoundAction($0) }
dict[-1584933265] = { return Api.SendMessageAction.parse_sendMessageRecordVideoAction($0) }
dict[-1563745031] = { return Api.SendMessageAction.parse_sendMessageRichMessageDraftAction($0) }
dict[929929052] = { return Api.SendMessageAction.parse_sendMessageTextDraftAction($0) }
dict[381645902] = { return Api.SendMessageAction.parse_sendMessageTypingAction($0) }
dict[-212740181] = { return Api.SendMessageAction.parse_sendMessageUploadAudioAction($0) }

View file

@ -527,21 +527,63 @@ public extension Api {
public class Cons_inputRichMessage: TypeConstructorDescription {
public var flags: Int32
public var blocks: [Api.PageBlock]
public init(flags: Int32, blocks: [Api.PageBlock]) {
public var photos: [Api.InputPhoto]?
public var documents: [Api.InputDocument]?
public var users: [Api.InputUser]?
public init(flags: Int32, blocks: [Api.PageBlock], photos: [Api.InputPhoto]?, documents: [Api.InputDocument]?, users: [Api.InputUser]?) {
self.flags = flags
self.blocks = blocks
self.photos = photos
self.documents = documents
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputRichMessage", [("flags", ConstructorParameterDescription(self.flags)), ("blocks", ConstructorParameterDescription(self.blocks))])
return ("inputRichMessage", [("flags", ConstructorParameterDescription(self.flags)), ("blocks", ConstructorParameterDescription(self.blocks)), ("photos", ConstructorParameterDescription(self.photos)), ("documents", ConstructorParameterDescription(self.documents)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_inputRichMessageHTML: TypeConstructorDescription {
public var flags: Int32
public var html: String
public var photos: [Api.InputPhoto]?
public var documents: [Api.InputDocument]?
public var users: [Api.InputUser]?
public init(flags: Int32, html: String, photos: [Api.InputPhoto]?, documents: [Api.InputDocument]?, users: [Api.InputUser]?) {
self.flags = flags
self.html = html
self.photos = photos
self.documents = documents
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputRichMessageHTML", [("flags", ConstructorParameterDescription(self.flags)), ("html", ConstructorParameterDescription(self.html)), ("photos", ConstructorParameterDescription(self.photos)), ("documents", ConstructorParameterDescription(self.documents)), ("users", ConstructorParameterDescription(self.users))])
}
}
public class Cons_inputRichMessageMarkdown: TypeConstructorDescription {
public var flags: Int32
public var markdown: String
public var photos: [Api.InputPhoto]?
public var documents: [Api.InputDocument]?
public var users: [Api.InputUser]?
public init(flags: Int32, markdown: String, photos: [Api.InputPhoto]?, documents: [Api.InputDocument]?, users: [Api.InputUser]?) {
self.flags = flags
self.markdown = markdown
self.photos = photos
self.documents = documents
self.users = users
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputRichMessageMarkdown", [("flags", ConstructorParameterDescription(self.flags)), ("markdown", ConstructorParameterDescription(self.markdown)), ("photos", ConstructorParameterDescription(self.photos)), ("documents", ConstructorParameterDescription(self.documents)), ("users", ConstructorParameterDescription(self.users))])
}
}
case inputRichMessage(Cons_inputRichMessage)
case inputRichMessageHTML(Cons_inputRichMessageHTML)
case inputRichMessageMarkdown(Cons_inputRichMessageMarkdown)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputRichMessage(let _data):
if boxed {
buffer.appendInt32(-1865309654)
buffer.appendInt32(-456898052)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
@ -549,6 +591,83 @@ public extension Api {
for item in _data.blocks {
item.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 2) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.photos!.count))
for item in _data.photos! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 3) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.documents!.count))
for item in _data.documents! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 4) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users!.count))
for item in _data.users! {
item.serialize(buffer, true)
}
}
break
case .inputRichMessageHTML(let _data):
if boxed {
buffer.appendInt32(-722815663)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeString(_data.html, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.photos!.count))
for item in _data.photos! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 3) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.documents!.count))
for item in _data.documents! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 4) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users!.count))
for item in _data.users! {
item.serialize(buffer, true)
}
}
break
case .inputRichMessageMarkdown(let _data):
if boxed {
buffer.appendInt32(162300294)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeString(_data.markdown, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 2) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.photos!.count))
for item in _data.photos! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 3) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.documents!.count))
for item in _data.documents! {
item.serialize(buffer, true)
}
}
if Int(_data.flags) & Int(1 << 4) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.users!.count))
for item in _data.users! {
item.serialize(buffer, true)
}
}
break
}
}
@ -556,7 +675,11 @@ public extension Api {
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputRichMessage(let _data):
return ("inputRichMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("blocks", ConstructorParameterDescription(_data.blocks))])
return ("inputRichMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("blocks", ConstructorParameterDescription(_data.blocks)), ("photos", ConstructorParameterDescription(_data.photos)), ("documents", ConstructorParameterDescription(_data.documents)), ("users", ConstructorParameterDescription(_data.users))])
case .inputRichMessageHTML(let _data):
return ("inputRichMessageHTML", [("flags", ConstructorParameterDescription(_data.flags)), ("html", ConstructorParameterDescription(_data.html)), ("photos", ConstructorParameterDescription(_data.photos)), ("documents", ConstructorParameterDescription(_data.documents)), ("users", ConstructorParameterDescription(_data.users))])
case .inputRichMessageMarkdown(let _data):
return ("inputRichMessageMarkdown", [("flags", ConstructorParameterDescription(_data.flags)), ("markdown", ConstructorParameterDescription(_data.markdown)), ("photos", ConstructorParameterDescription(_data.photos)), ("documents", ConstructorParameterDescription(_data.documents)), ("users", ConstructorParameterDescription(_data.users))])
}
}
@ -567,10 +690,101 @@ public extension Api {
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self)
}
var _3: [Api.InputPhoto]?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputPhoto.self)
}
}
var _4: [Api.InputDocument]?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
}
}
var _5: [Api.InputUser]?
if Int(_1 ?? 0) & Int(1 << 4) != 0 {
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputRichMessage.inputRichMessage(Cons_inputRichMessage(flags: _1!, blocks: _2!))
let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputRichMessage.inputRichMessage(Cons_inputRichMessage(flags: _1!, blocks: _2!, photos: _3, documents: _4, users: _5))
}
else {
return nil
}
}
public static func parse_inputRichMessageHTML(_ reader: BufferReader) -> InputRichMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: [Api.InputPhoto]?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputPhoto.self)
}
}
var _4: [Api.InputDocument]?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
}
}
var _5: [Api.InputUser]?
if Int(_1 ?? 0) & Int(1 << 4) != 0 {
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputRichMessage.inputRichMessageHTML(Cons_inputRichMessageHTML(flags: _1!, html: _2!, photos: _3, documents: _4, users: _5))
}
else {
return nil
}
}
public static func parse_inputRichMessageMarkdown(_ reader: BufferReader) -> InputRichMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: [Api.InputPhoto]?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputPhoto.self)
}
}
var _4: [Api.InputDocument]?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputDocument.self)
}
}
var _5: [Api.InputUser]?
if Int(_1 ?? 0) & Int(1 << 4) != 0 {
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputRichMessage.inputRichMessageMarkdown(Cons_inputRichMessageMarkdown(flags: _1!, markdown: _2!, photos: _3, documents: _4, users: _5))
}
else {
return nil

View file

@ -413,17 +413,6 @@ public extension Api {
}
public extension Api {
indirect enum PageBlock: TypeConstructorDescription {
public class Cons_inputPageBlockAudio: TypeConstructorDescription {
public var audio: Api.InputDocument
public var caption: Api.PageCaption
public init(audio: Api.InputDocument, caption: Api.PageCaption) {
self.audio = audio
self.caption = caption
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPageBlockAudio", [("audio", ConstructorParameterDescription(self.audio)), ("caption", ConstructorParameterDescription(self.caption))])
}
}
public class Cons_inputPageBlockMap: TypeConstructorDescription {
public var geo: Api.InputGeoPoint
public var zoom: Int32
@ -456,34 +445,6 @@ public extension Api {
return ("inputPageBlockOrderedList", [("flags", ConstructorParameterDescription(self.flags)), ("items", ConstructorParameterDescription(self.items)), ("start", ConstructorParameterDescription(self.start)), ("type", ConstructorParameterDescription(self.type))])
}
}
public class Cons_inputPageBlockPhoto: TypeConstructorDescription {
public var flags: Int32
public var photo: Api.InputPhoto
public var caption: Api.PageCaption
public var url: String?
public init(flags: Int32, photo: Api.InputPhoto, caption: Api.PageCaption, url: String?) {
self.flags = flags
self.photo = photo
self.caption = caption
self.url = url
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPageBlockPhoto", [("flags", ConstructorParameterDescription(self.flags)), ("photo", ConstructorParameterDescription(self.photo)), ("caption", ConstructorParameterDescription(self.caption)), ("url", ConstructorParameterDescription(self.url))])
}
}
public class Cons_inputPageBlockVideo: TypeConstructorDescription {
public var flags: Int32
public var video: Api.InputDocument
public var caption: Api.PageCaption
public init(flags: Int32, video: Api.InputDocument, caption: Api.PageCaption) {
self.flags = flags
self.video = video
self.caption = caption
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputPageBlockVideo", [("flags", ConstructorParameterDescription(self.flags)), ("video", ConstructorParameterDescription(self.video)), ("caption", ConstructorParameterDescription(self.caption))])
}
}
public class Cons_pageBlockAnchor: TypeConstructorDescription {
public var name: String
public init(name: String) {
@ -858,11 +819,8 @@ public extension Api {
return ("pageBlockVideo", [("flags", ConstructorParameterDescription(self.flags)), ("videoId", ConstructorParameterDescription(self.videoId)), ("caption", ConstructorParameterDescription(self.caption))])
}
}
case inputPageBlockAudio(Cons_inputPageBlockAudio)
case inputPageBlockMap(Cons_inputPageBlockMap)
case inputPageBlockOrderedList(Cons_inputPageBlockOrderedList)
case inputPageBlockPhoto(Cons_inputPageBlockPhoto)
case inputPageBlockVideo(Cons_inputPageBlockVideo)
case pageBlockAnchor(Cons_pageBlockAnchor)
case pageBlockAudio(Cons_pageBlockAudio)
case pageBlockAuthorDate(Cons_pageBlockAuthorDate)
@ -902,13 +860,6 @@ public extension Api {
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPageBlockAudio(let _data):
if boxed {
buffer.appendInt32(-1715334046)
}
_data.audio.serialize(buffer, true)
_data.caption.serialize(buffer, true)
break
case .inputPageBlockMap(let _data):
if boxed {
buffer.appendInt32(1464557951)
@ -936,25 +887,6 @@ public extension Api {
serializeString(_data.type!, buffer: buffer, boxed: false)
}
break
case .inputPageBlockPhoto(let _data):
if boxed {
buffer.appendInt32(719646565)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.photo.serialize(buffer, true)
_data.caption.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.url!, buffer: buffer, boxed: false)
}
break
case .inputPageBlockVideo(let _data):
if boxed {
buffer.appendInt32(-249943466)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.video.serialize(buffer, true)
_data.caption.serialize(buffer, true)
break
case .pageBlockAnchor(let _data):
if boxed {
buffer.appendInt32(-837994576)
@ -1254,16 +1186,10 @@ public extension Api {
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputPageBlockAudio(let _data):
return ("inputPageBlockAudio", [("audio", ConstructorParameterDescription(_data.audio)), ("caption", ConstructorParameterDescription(_data.caption))])
case .inputPageBlockMap(let _data):
return ("inputPageBlockMap", [("geo", ConstructorParameterDescription(_data.geo)), ("zoom", ConstructorParameterDescription(_data.zoom)), ("w", ConstructorParameterDescription(_data.w)), ("h", ConstructorParameterDescription(_data.h)), ("caption", ConstructorParameterDescription(_data.caption))])
case .inputPageBlockOrderedList(let _data):
return ("inputPageBlockOrderedList", [("flags", ConstructorParameterDescription(_data.flags)), ("items", ConstructorParameterDescription(_data.items)), ("start", ConstructorParameterDescription(_data.start)), ("type", ConstructorParameterDescription(_data.type))])
case .inputPageBlockPhoto(let _data):
return ("inputPageBlockPhoto", [("flags", ConstructorParameterDescription(_data.flags)), ("photo", ConstructorParameterDescription(_data.photo)), ("caption", ConstructorParameterDescription(_data.caption)), ("url", ConstructorParameterDescription(_data.url))])
case .inputPageBlockVideo(let _data):
return ("inputPageBlockVideo", [("flags", ConstructorParameterDescription(_data.flags)), ("video", ConstructorParameterDescription(_data.video)), ("caption", ConstructorParameterDescription(_data.caption))])
case .pageBlockAnchor(let _data):
return ("pageBlockAnchor", [("name", ConstructorParameterDescription(_data.name))])
case .pageBlockAudio(let _data):
@ -1339,24 +1265,6 @@ public extension Api {
}
}
public static func parse_inputPageBlockAudio(_ reader: BufferReader) -> PageBlock? {
var _1: Api.InputDocument?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
var _2: Api.PageCaption?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PageCaption
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.PageBlock.inputPageBlockAudio(Cons_inputPageBlockAudio(audio: _1!, caption: _2!))
}
else {
return nil
}
}
public static func parse_inputPageBlockMap(_ reader: BufferReader) -> PageBlock? {
var _1: Api.InputGeoPoint?
if let signature = reader.readInt32() {
@ -1410,53 +1318,6 @@ public extension Api {
return nil
}
}
public static func parse_inputPageBlockPhoto(_ reader: BufferReader) -> PageBlock? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputPhoto?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
var _3: Api.PageCaption?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.PageCaption
}
var _4: String?
if Int(_1 ?? 0) & Int(1 << 0) != 0 {
_4 = parseString(reader)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.PageBlock.inputPageBlockPhoto(Cons_inputPageBlockPhoto(flags: _1!, photo: _2!, caption: _3!, url: _4))
}
else {
return nil
}
}
public static func parse_inputPageBlockVideo(_ reader: BufferReader) -> PageBlock? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputDocument?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
var _3: Api.PageCaption?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.PageCaption
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.PageBlock.inputPageBlockVideo(Cons_inputPageBlockVideo(flags: _1!, video: _2!, caption: _3!))
}
else {
return nil
}
}
public static func parse_pageBlockAnchor(_ reader: BufferReader) -> PageBlock? {
var _1: String?
_1 = parseString(reader)

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,819 @@
public extension Api {
indirect enum SavedDialog: TypeConstructorDescription {
public class Cons_monoForumDialog: TypeConstructorDescription {
public var flags: Int32
public var peer: Api.Peer
public var topMessage: Int32
public var readInboxMaxId: Int32
public var readOutboxMaxId: Int32
public var unreadCount: Int32
public var unreadReactionsCount: Int32
public var draft: Api.DraftMessage?
public init(flags: Int32, peer: Api.Peer, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadReactionsCount: Int32, draft: Api.DraftMessage?) {
self.flags = flags
self.peer = peer
self.topMessage = topMessage
self.readInboxMaxId = readInboxMaxId
self.readOutboxMaxId = readOutboxMaxId
self.unreadCount = unreadCount
self.unreadReactionsCount = unreadReactionsCount
self.draft = draft
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("monoForumDialog", [("flags", ConstructorParameterDescription(self.flags)), ("peer", ConstructorParameterDescription(self.peer)), ("topMessage", ConstructorParameterDescription(self.topMessage)), ("readInboxMaxId", ConstructorParameterDescription(self.readInboxMaxId)), ("readOutboxMaxId", ConstructorParameterDescription(self.readOutboxMaxId)), ("unreadCount", ConstructorParameterDescription(self.unreadCount)), ("unreadReactionsCount", ConstructorParameterDescription(self.unreadReactionsCount)), ("draft", ConstructorParameterDescription(self.draft))])
}
}
public class Cons_savedDialog: TypeConstructorDescription {
public var flags: Int32
public var peer: Api.Peer
public var topMessage: Int32
public init(flags: Int32, peer: Api.Peer, topMessage: Int32) {
self.flags = flags
self.peer = peer
self.topMessage = topMessage
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("savedDialog", [("flags", ConstructorParameterDescription(self.flags)), ("peer", ConstructorParameterDescription(self.peer)), ("topMessage", ConstructorParameterDescription(self.topMessage))])
}
}
case monoForumDialog(Cons_monoForumDialog)
case savedDialog(Cons_savedDialog)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .monoForumDialog(let _data):
if boxed {
buffer.appendInt32(1681948327)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.peer.serialize(buffer, true)
serializeInt32(_data.topMessage, buffer: buffer, boxed: false)
serializeInt32(_data.readInboxMaxId, buffer: buffer, boxed: false)
serializeInt32(_data.readOutboxMaxId, buffer: buffer, boxed: false)
serializeInt32(_data.unreadCount, buffer: buffer, boxed: false)
serializeInt32(_data.unreadReactionsCount, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 1) != 0 {
_data.draft!.serialize(buffer, true)
}
break
case .savedDialog(let _data):
if boxed {
buffer.appendInt32(-1115174036)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.peer.serialize(buffer, true)
serializeInt32(_data.topMessage, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .monoForumDialog(let _data):
return ("monoForumDialog", [("flags", ConstructorParameterDescription(_data.flags)), ("peer", ConstructorParameterDescription(_data.peer)), ("topMessage", ConstructorParameterDescription(_data.topMessage)), ("readInboxMaxId", ConstructorParameterDescription(_data.readInboxMaxId)), ("readOutboxMaxId", ConstructorParameterDescription(_data.readOutboxMaxId)), ("unreadCount", ConstructorParameterDescription(_data.unreadCount)), ("unreadReactionsCount", ConstructorParameterDescription(_data.unreadReactionsCount)), ("draft", ConstructorParameterDescription(_data.draft))])
case .savedDialog(let _data):
return ("savedDialog", [("flags", ConstructorParameterDescription(_data.flags)), ("peer", ConstructorParameterDescription(_data.peer)), ("topMessage", ConstructorParameterDescription(_data.topMessage))])
}
}
public static func parse_monoForumDialog(_ reader: BufferReader) -> SavedDialog? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Peer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
var _6: Int32?
_6 = reader.readInt32()
var _7: Int32?
_7 = reader.readInt32()
var _8: Api.DraftMessage?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.DraftMessage
}
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.SavedDialog.monoForumDialog(Cons_monoForumDialog(flags: _1!, peer: _2!, topMessage: _3!, readInboxMaxId: _4!, readOutboxMaxId: _5!, unreadCount: _6!, unreadReactionsCount: _7!, draft: _8))
}
else {
return nil
}
}
public static func parse_savedDialog(_ reader: BufferReader) -> SavedDialog? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Peer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.SavedDialog.savedDialog(Cons_savedDialog(flags: _1!, peer: _2!, topMessage: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SavedReactionTag: TypeConstructorDescription {
public class Cons_savedReactionTag: TypeConstructorDescription {
public var flags: Int32
public var reaction: Api.Reaction
public var title: String?
public var count: Int32
public init(flags: Int32, reaction: Api.Reaction, title: String?, count: Int32) {
self.flags = flags
self.reaction = reaction
self.title = title
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("savedReactionTag", [("flags", ConstructorParameterDescription(self.flags)), ("reaction", ConstructorParameterDescription(self.reaction)), ("title", ConstructorParameterDescription(self.title)), ("count", ConstructorParameterDescription(self.count))])
}
}
case savedReactionTag(Cons_savedReactionTag)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedReactionTag(let _data):
if boxed {
buffer.appendInt32(-881854424)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
_data.reaction.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 0) != 0 {
serializeString(_data.title!, buffer: buffer, boxed: false)
}
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .savedReactionTag(let _data):
return ("savedReactionTag", [("flags", ConstructorParameterDescription(_data.flags)), ("reaction", ConstructorParameterDescription(_data.reaction)), ("title", ConstructorParameterDescription(_data.title)), ("count", ConstructorParameterDescription(_data.count))])
}
}
public static func parse_savedReactionTag(_ reader: BufferReader) -> SavedReactionTag? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Reaction?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Reaction
}
var _3: String?
if Int(_1 ?? 0) & Int(1 << 0) != 0 {
_3 = parseString(reader)
}
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.SavedReactionTag.savedReactionTag(Cons_savedReactionTag(flags: _1!, reaction: _2!, title: _3, count: _4!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SavedStarGift: TypeConstructorDescription {
public class Cons_savedStarGift: TypeConstructorDescription {
public var flags: Int32
public var fromId: Api.Peer?
public var date: Int32
public var gift: Api.StarGift
public var message: Api.TextWithEntities?
public var msgId: Int32?
public var savedId: Int64?
public var convertStars: Int64?
public var upgradeStars: Int64?
public var canExportAt: Int32?
public var transferStars: Int64?
public var canTransferAt: Int32?
public var canResellAt: Int32?
public var collectionId: [Int32]?
public var prepaidUpgradeHash: String?
public var dropOriginalDetailsStars: Int64?
public var giftNum: Int32?
public var canCraftAt: Int32?
public init(flags: Int32, fromId: Api.Peer?, date: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, msgId: Int32?, savedId: Int64?, convertStars: Int64?, upgradeStars: Int64?, canExportAt: Int32?, transferStars: Int64?, canTransferAt: Int32?, canResellAt: Int32?, collectionId: [Int32]?, prepaidUpgradeHash: String?, dropOriginalDetailsStars: Int64?, giftNum: Int32?, canCraftAt: Int32?) {
self.flags = flags
self.fromId = fromId
self.date = date
self.gift = gift
self.message = message
self.msgId = msgId
self.savedId = savedId
self.convertStars = convertStars
self.upgradeStars = upgradeStars
self.canExportAt = canExportAt
self.transferStars = transferStars
self.canTransferAt = canTransferAt
self.canResellAt = canResellAt
self.collectionId = collectionId
self.prepaidUpgradeHash = prepaidUpgradeHash
self.dropOriginalDetailsStars = dropOriginalDetailsStars
self.giftNum = giftNum
self.canCraftAt = canCraftAt
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("savedStarGift", [("flags", ConstructorParameterDescription(self.flags)), ("fromId", ConstructorParameterDescription(self.fromId)), ("date", ConstructorParameterDescription(self.date)), ("gift", ConstructorParameterDescription(self.gift)), ("message", ConstructorParameterDescription(self.message)), ("msgId", ConstructorParameterDescription(self.msgId)), ("savedId", ConstructorParameterDescription(self.savedId)), ("convertStars", ConstructorParameterDescription(self.convertStars)), ("upgradeStars", ConstructorParameterDescription(self.upgradeStars)), ("canExportAt", ConstructorParameterDescription(self.canExportAt)), ("transferStars", ConstructorParameterDescription(self.transferStars)), ("canTransferAt", ConstructorParameterDescription(self.canTransferAt)), ("canResellAt", ConstructorParameterDescription(self.canResellAt)), ("collectionId", ConstructorParameterDescription(self.collectionId)), ("prepaidUpgradeHash", ConstructorParameterDescription(self.prepaidUpgradeHash)), ("dropOriginalDetailsStars", ConstructorParameterDescription(self.dropOriginalDetailsStars)), ("giftNum", ConstructorParameterDescription(self.giftNum)), ("canCraftAt", ConstructorParameterDescription(self.canCraftAt))])
}
}
case savedStarGift(Cons_savedStarGift)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedStarGift(let _data):
if boxed {
buffer.appendInt32(1105150972)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 1) != 0 {
_data.fromId!.serialize(buffer, true)
}
serializeInt32(_data.date, buffer: buffer, boxed: false)
_data.gift.serialize(buffer, true)
if Int(_data.flags) & Int(1 << 2) != 0 {
_data.message!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 3) != 0 {
serializeInt32(_data.msgId!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 11) != 0 {
serializeInt64(_data.savedId!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 4) != 0 {
serializeInt64(_data.convertStars!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 6) != 0 {
serializeInt64(_data.upgradeStars!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 7) != 0 {
serializeInt32(_data.canExportAt!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 8) != 0 {
serializeInt64(_data.transferStars!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 13) != 0 {
serializeInt32(_data.canTransferAt!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 14) != 0 {
serializeInt32(_data.canResellAt!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 15) != 0 {
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(_data.collectionId!.count))
for item in _data.collectionId! {
serializeInt32(item, buffer: buffer, boxed: false)
}
}
if Int(_data.flags) & Int(1 << 16) != 0 {
serializeString(_data.prepaidUpgradeHash!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 18) != 0 {
serializeInt64(_data.dropOriginalDetailsStars!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 19) != 0 {
serializeInt32(_data.giftNum!, buffer: buffer, boxed: false)
}
if Int(_data.flags) & Int(1 << 20) != 0 {
serializeInt32(_data.canCraftAt!, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .savedStarGift(let _data):
return ("savedStarGift", [("flags", ConstructorParameterDescription(_data.flags)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("date", ConstructorParameterDescription(_data.date)), ("gift", ConstructorParameterDescription(_data.gift)), ("message", ConstructorParameterDescription(_data.message)), ("msgId", ConstructorParameterDescription(_data.msgId)), ("savedId", ConstructorParameterDescription(_data.savedId)), ("convertStars", ConstructorParameterDescription(_data.convertStars)), ("upgradeStars", ConstructorParameterDescription(_data.upgradeStars)), ("canExportAt", ConstructorParameterDescription(_data.canExportAt)), ("transferStars", ConstructorParameterDescription(_data.transferStars)), ("canTransferAt", ConstructorParameterDescription(_data.canTransferAt)), ("canResellAt", ConstructorParameterDescription(_data.canResellAt)), ("collectionId", ConstructorParameterDescription(_data.collectionId)), ("prepaidUpgradeHash", ConstructorParameterDescription(_data.prepaidUpgradeHash)), ("dropOriginalDetailsStars", ConstructorParameterDescription(_data.dropOriginalDetailsStars)), ("giftNum", ConstructorParameterDescription(_data.giftNum)), ("canCraftAt", ConstructorParameterDescription(_data.canCraftAt))])
}
}
public static func parse_savedStarGift(_ reader: BufferReader) -> SavedStarGift? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Peer?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
}
var _3: Int32?
_3 = reader.readInt32()
var _4: Api.StarGift?
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.StarGift
}
var _5: Api.TextWithEntities?
if Int(_1 ?? 0) & Int(1 << 2) != 0 {
if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
}
}
var _6: Int32?
if Int(_1 ?? 0) & Int(1 << 3) != 0 {
_6 = reader.readInt32()
}
var _7: Int64?
if Int(_1 ?? 0) & Int(1 << 11) != 0 {
_7 = reader.readInt64()
}
var _8: Int64?
if Int(_1 ?? 0) & Int(1 << 4) != 0 {
_8 = reader.readInt64()
}
var _9: Int64?
if Int(_1 ?? 0) & Int(1 << 6) != 0 {
_9 = reader.readInt64()
}
var _10: Int32?
if Int(_1 ?? 0) & Int(1 << 7) != 0 {
_10 = reader.readInt32()
}
var _11: Int64?
if Int(_1 ?? 0) & Int(1 << 8) != 0 {
_11 = reader.readInt64()
}
var _12: Int32?
if Int(_1 ?? 0) & Int(1 << 13) != 0 {
_12 = reader.readInt32()
}
var _13: Int32?
if Int(_1 ?? 0) & Int(1 << 14) != 0 {
_13 = reader.readInt32()
}
var _14: [Int32]?
if Int(_1 ?? 0) & Int(1 << 15) != 0 {
if let _ = reader.readInt32() {
_14 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
}
var _15: String?
if Int(_1 ?? 0) & Int(1 << 16) != 0 {
_15 = parseString(reader)
}
var _16: Int64?
if Int(_1 ?? 0) & Int(1 << 18) != 0 {
_16 = reader.readInt64()
}
var _17: Int32?
if Int(_1 ?? 0) & Int(1 << 19) != 0 {
_17 = reader.readInt32()
}
var _18: Int32?
if Int(_1 ?? 0) & Int(1 << 20) != 0 {
_18 = reader.readInt32()
}
let _c1 = _1 != nil
let _c2 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1 ?? 0) & Int(1 << 11) == 0) || _7 != nil
let _c8 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1 ?? 0) & Int(1 << 6) == 0) || _9 != nil
let _c10 = (Int(_1 ?? 0) & Int(1 << 7) == 0) || _10 != nil
let _c11 = (Int(_1 ?? 0) & Int(1 << 8) == 0) || _11 != nil
let _c12 = (Int(_1 ?? 0) & Int(1 << 13) == 0) || _12 != nil
let _c13 = (Int(_1 ?? 0) & Int(1 << 14) == 0) || _13 != nil
let _c14 = (Int(_1 ?? 0) & Int(1 << 15) == 0) || _14 != nil
let _c15 = (Int(_1 ?? 0) & Int(1 << 16) == 0) || _15 != nil
let _c16 = (Int(_1 ?? 0) & Int(1 << 18) == 0) || _16 != nil
let _c17 = (Int(_1 ?? 0) & Int(1 << 19) == 0) || _17 != nil
let _c18 = (Int(_1 ?? 0) & Int(1 << 20) == 0) || _18 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 {
return Api.SavedStarGift.savedStarGift(Cons_savedStarGift(flags: _1!, fromId: _2, date: _3!, gift: _4!, message: _5, msgId: _6, savedId: _7, convertStars: _8, upgradeStars: _9, canExportAt: _10, transferStars: _11, canTransferAt: _12, canResellAt: _13, collectionId: _14, prepaidUpgradeHash: _15, dropOriginalDetailsStars: _16, giftNum: _17, canCraftAt: _18))
}
else {
return nil
}
}
}
}
public extension Api {
enum SearchPostsFlood: TypeConstructorDescription {
public class Cons_searchPostsFlood: TypeConstructorDescription {
public var flags: Int32
public var totalDaily: Int32
public var remains: Int32
public var waitTill: Int32?
public var starsAmount: Int64
public init(flags: Int32, totalDaily: Int32, remains: Int32, waitTill: Int32?, starsAmount: Int64) {
self.flags = flags
self.totalDaily = totalDaily
self.remains = remains
self.waitTill = waitTill
self.starsAmount = starsAmount
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("searchPostsFlood", [("flags", ConstructorParameterDescription(self.flags)), ("totalDaily", ConstructorParameterDescription(self.totalDaily)), ("remains", ConstructorParameterDescription(self.remains)), ("waitTill", ConstructorParameterDescription(self.waitTill)), ("starsAmount", ConstructorParameterDescription(self.starsAmount))])
}
}
case searchPostsFlood(Cons_searchPostsFlood)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .searchPostsFlood(let _data):
if boxed {
buffer.appendInt32(1040931690)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
serializeInt32(_data.totalDaily, buffer: buffer, boxed: false)
serializeInt32(_data.remains, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 1) != 0 {
serializeInt32(_data.waitTill!, buffer: buffer, boxed: false)
}
serializeInt64(_data.starsAmount, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .searchPostsFlood(let _data):
return ("searchPostsFlood", [("flags", ConstructorParameterDescription(_data.flags)), ("totalDaily", ConstructorParameterDescription(_data.totalDaily)), ("remains", ConstructorParameterDescription(_data.remains)), ("waitTill", ConstructorParameterDescription(_data.waitTill)), ("starsAmount", ConstructorParameterDescription(_data.starsAmount))])
}
}
public static func parse_searchPostsFlood(_ reader: BufferReader) -> SearchPostsFlood? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
if Int(_1 ?? 0) & Int(1 << 1) != 0 {
_4 = reader.readInt32()
}
var _5: Int64?
_5 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.SearchPostsFlood.searchPostsFlood(Cons_searchPostsFlood(flags: _1!, totalDaily: _2!, remains: _3!, waitTill: _4, starsAmount: _5!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SearchResultsCalendarPeriod: TypeConstructorDescription {
public class Cons_searchResultsCalendarPeriod: TypeConstructorDescription {
public var date: Int32
public var minMsgId: Int32
public var maxMsgId: Int32
public var count: Int32
public init(date: Int32, minMsgId: Int32, maxMsgId: Int32, count: Int32) {
self.date = date
self.minMsgId = minMsgId
self.maxMsgId = maxMsgId
self.count = count
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("searchResultsCalendarPeriod", [("date", ConstructorParameterDescription(self.date)), ("minMsgId", ConstructorParameterDescription(self.minMsgId)), ("maxMsgId", ConstructorParameterDescription(self.maxMsgId)), ("count", ConstructorParameterDescription(self.count))])
}
}
case searchResultsCalendarPeriod(Cons_searchResultsCalendarPeriod)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .searchResultsCalendarPeriod(let _data):
if boxed {
buffer.appendInt32(-911191137)
}
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt32(_data.minMsgId, buffer: buffer, boxed: false)
serializeInt32(_data.maxMsgId, buffer: buffer, boxed: false)
serializeInt32(_data.count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .searchResultsCalendarPeriod(let _data):
return ("searchResultsCalendarPeriod", [("date", ConstructorParameterDescription(_data.date)), ("minMsgId", ConstructorParameterDescription(_data.minMsgId)), ("maxMsgId", ConstructorParameterDescription(_data.maxMsgId)), ("count", ConstructorParameterDescription(_data.count))])
}
}
public static func parse_searchResultsCalendarPeriod(_ reader: BufferReader) -> SearchResultsCalendarPeriod? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.SearchResultsCalendarPeriod.searchResultsCalendarPeriod(Cons_searchResultsCalendarPeriod(date: _1!, minMsgId: _2!, maxMsgId: _3!, count: _4!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SearchResultsPosition: TypeConstructorDescription {
public class Cons_searchResultPosition: TypeConstructorDescription {
public var msgId: Int32
public var date: Int32
public var offset: Int32
public init(msgId: Int32, date: Int32, offset: Int32) {
self.msgId = msgId
self.date = date
self.offset = offset
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("searchResultPosition", [("msgId", ConstructorParameterDescription(self.msgId)), ("date", ConstructorParameterDescription(self.date)), ("offset", ConstructorParameterDescription(self.offset))])
}
}
case searchResultPosition(Cons_searchResultPosition)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .searchResultPosition(let _data):
if boxed {
buffer.appendInt32(2137295719)
}
serializeInt32(_data.msgId, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeInt32(_data.offset, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .searchResultPosition(let _data):
return ("searchResultPosition", [("msgId", ConstructorParameterDescription(_data.msgId)), ("date", ConstructorParameterDescription(_data.date)), ("offset", ConstructorParameterDescription(_data.offset))])
}
}
public static func parse_searchResultPosition(_ reader: BufferReader) -> SearchResultsPosition? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.SearchResultsPosition.searchResultPosition(Cons_searchResultPosition(msgId: _1!, date: _2!, offset: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SecureCredentialsEncrypted: TypeConstructorDescription {
public class Cons_secureCredentialsEncrypted: TypeConstructorDescription {
public var data: Buffer
public var hash: Buffer
public var secret: Buffer
public init(data: Buffer, hash: Buffer, secret: Buffer) {
self.data = data
self.hash = hash
self.secret = secret
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("secureCredentialsEncrypted", [("data", ConstructorParameterDescription(self.data)), ("hash", ConstructorParameterDescription(self.hash)), ("secret", ConstructorParameterDescription(self.secret))])
}
}
case secureCredentialsEncrypted(Cons_secureCredentialsEncrypted)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureCredentialsEncrypted(let _data):
if boxed {
buffer.appendInt32(871426631)
}
serializeBytes(_data.data, buffer: buffer, boxed: false)
serializeBytes(_data.hash, buffer: buffer, boxed: false)
serializeBytes(_data.secret, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .secureCredentialsEncrypted(let _data):
return ("secureCredentialsEncrypted", [("data", ConstructorParameterDescription(_data.data)), ("hash", ConstructorParameterDescription(_data.hash)), ("secret", ConstructorParameterDescription(_data.secret))])
}
}
public static func parse_secureCredentialsEncrypted(_ reader: BufferReader) -> SecureCredentialsEncrypted? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.SecureCredentialsEncrypted.secureCredentialsEncrypted(Cons_secureCredentialsEncrypted(data: _1!, hash: _2!, secret: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SecureData: TypeConstructorDescription {
public class Cons_secureData: TypeConstructorDescription {
public var data: Buffer
public var dataHash: Buffer
public var secret: Buffer
public init(data: Buffer, dataHash: Buffer, secret: Buffer) {
self.data = data
self.dataHash = dataHash
self.secret = secret
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("secureData", [("data", ConstructorParameterDescription(self.data)), ("dataHash", ConstructorParameterDescription(self.dataHash)), ("secret", ConstructorParameterDescription(self.secret))])
}
}
case secureData(Cons_secureData)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureData(let _data):
if boxed {
buffer.appendInt32(-1964327229)
}
serializeBytes(_data.data, buffer: buffer, boxed: false)
serializeBytes(_data.dataHash, buffer: buffer, boxed: false)
serializeBytes(_data.secret, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .secureData(let _data):
return ("secureData", [("data", ConstructorParameterDescription(_data.data)), ("dataHash", ConstructorParameterDescription(_data.dataHash)), ("secret", ConstructorParameterDescription(_data.secret))])
}
}
public static func parse_secureData(_ reader: BufferReader) -> SecureData? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.SecureData.secureData(Cons_secureData(data: _1!, dataHash: _2!, secret: _3!))
}
else {
return nil
}
}
}
}
public extension Api {
enum SecureFile: TypeConstructorDescription {
public class Cons_secureFile: TypeConstructorDescription {
public var id: Int64
public var accessHash: Int64
public var size: Int64
public var dcId: Int32
public var date: Int32
public var fileHash: Buffer
public var secret: Buffer
public init(id: Int64, accessHash: Int64, size: Int64, dcId: Int32, date: Int32, fileHash: Buffer, secret: Buffer) {
self.id = id
self.accessHash = accessHash
self.size = size
self.dcId = dcId
self.date = date
self.fileHash = fileHash
self.secret = secret
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("secureFile", [("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("size", ConstructorParameterDescription(self.size)), ("dcId", ConstructorParameterDescription(self.dcId)), ("date", ConstructorParameterDescription(self.date)), ("fileHash", ConstructorParameterDescription(self.fileHash)), ("secret", ConstructorParameterDescription(self.secret))])
}
}
case secureFile(Cons_secureFile)
case secureFileEmpty
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .secureFile(let _data):
if boxed {
buffer.appendInt32(2097791614)
}
serializeInt64(_data.id, buffer: buffer, boxed: false)
serializeInt64(_data.accessHash, buffer: buffer, boxed: false)
serializeInt64(_data.size, buffer: buffer, boxed: false)
serializeInt32(_data.dcId, buffer: buffer, boxed: false)
serializeInt32(_data.date, buffer: buffer, boxed: false)
serializeBytes(_data.fileHash, buffer: buffer, boxed: false)
serializeBytes(_data.secret, buffer: buffer, boxed: false)
break
case .secureFileEmpty:
if boxed {
buffer.appendInt32(1679398724)
}
break
}
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .secureFile(let _data):
return ("secureFile", [("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("size", ConstructorParameterDescription(_data.size)), ("dcId", ConstructorParameterDescription(_data.dcId)), ("date", ConstructorParameterDescription(_data.date)), ("fileHash", ConstructorParameterDescription(_data.fileHash)), ("secret", ConstructorParameterDescription(_data.secret))])
case .secureFileEmpty:
return ("secureFileEmpty", [])
}
}
public static func parse_secureFile(_ reader: BufferReader) -> SecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
var _6: Buffer?
_6 = parseBytes(reader)
var _7: Buffer?
_7 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.SecureFile.secureFile(Cons_secureFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, date: _5!, fileHash: _6!, secret: _7!))
}
else {
return nil
}
}
public static func parse_secureFileEmpty(_ reader: BufferReader) -> SecureFile? {
return Api.SecureFile.secureFileEmpty
}
}
}
public extension Api {
enum SecurePasswordKdfAlgo: TypeConstructorDescription {
public class Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000: TypeConstructorDescription {

View file

@ -52,6 +52,17 @@ public extension Api {
}
public extension Api {
enum SendMessageAction: TypeConstructorDescription {
public class Cons_inputSendMessageRichMessageDraftAction: TypeConstructorDescription {
public var randomId: Int64
public var richMessage: Api.InputRichMessage
public init(randomId: Int64, richMessage: Api.InputRichMessage) {
self.randomId = randomId
self.richMessage = richMessage
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("inputSendMessageRichMessageDraftAction", [("randomId", ConstructorParameterDescription(self.randomId)), ("richMessage", ConstructorParameterDescription(self.richMessage))])
}
}
public class Cons_sendMessageEmojiInteraction: TypeConstructorDescription {
public var emoticon: String
public var msgId: Int32
@ -83,6 +94,17 @@ public extension Api {
return ("sendMessageHistoryImportAction", [("progress", ConstructorParameterDescription(self.progress))])
}
}
public class Cons_sendMessageRichMessageDraftAction: TypeConstructorDescription {
public var randomId: Int64
public var richMessage: Api.RichMessage
public init(randomId: Int64, richMessage: Api.RichMessage) {
self.randomId = randomId
self.richMessage = richMessage
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("sendMessageRichMessageDraftAction", [("randomId", ConstructorParameterDescription(self.randomId)), ("richMessage", ConstructorParameterDescription(self.richMessage))])
}
}
public class Cons_sendMessageTextDraftAction: TypeConstructorDescription {
public var randomId: Int64
public var text: Api.TextWithEntities
@ -139,6 +161,7 @@ public extension Api {
return ("sendMessageUploadVideoAction", [("progress", ConstructorParameterDescription(self.progress))])
}
}
case inputSendMessageRichMessageDraftAction(Cons_inputSendMessageRichMessageDraftAction)
case sendMessageCancelAction
case sendMessageChooseContactAction
case sendMessageChooseStickerAction
@ -150,6 +173,7 @@ public extension Api {
case sendMessageRecordAudioAction
case sendMessageRecordRoundAction
case sendMessageRecordVideoAction
case sendMessageRichMessageDraftAction(Cons_sendMessageRichMessageDraftAction)
case sendMessageTextDraftAction(Cons_sendMessageTextDraftAction)
case sendMessageTypingAction
case sendMessageUploadAudioAction(Cons_sendMessageUploadAudioAction)
@ -161,6 +185,13 @@ public extension Api {
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSendMessageRichMessageDraftAction(let _data):
if boxed {
buffer.appendInt32(-491635887)
}
serializeInt64(_data.randomId, buffer: buffer, boxed: false)
_data.richMessage.serialize(buffer, true)
break
case .sendMessageCancelAction:
if boxed {
buffer.appendInt32(-44119819)
@ -221,6 +252,13 @@ public extension Api {
buffer.appendInt32(-1584933265)
}
break
case .sendMessageRichMessageDraftAction(let _data):
if boxed {
buffer.appendInt32(-1563745031)
}
serializeInt64(_data.randomId, buffer: buffer, boxed: false)
_data.richMessage.serialize(buffer, true)
break
case .sendMessageTextDraftAction(let _data):
if boxed {
buffer.appendInt32(929929052)
@ -273,6 +311,8 @@ public extension Api {
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .inputSendMessageRichMessageDraftAction(let _data):
return ("inputSendMessageRichMessageDraftAction", [("randomId", ConstructorParameterDescription(_data.randomId)), ("richMessage", ConstructorParameterDescription(_data.richMessage))])
case .sendMessageCancelAction:
return ("sendMessageCancelAction", [])
case .sendMessageChooseContactAction:
@ -295,6 +335,8 @@ public extension Api {
return ("sendMessageRecordRoundAction", [])
case .sendMessageRecordVideoAction:
return ("sendMessageRecordVideoAction", [])
case .sendMessageRichMessageDraftAction(let _data):
return ("sendMessageRichMessageDraftAction", [("randomId", ConstructorParameterDescription(_data.randomId)), ("richMessage", ConstructorParameterDescription(_data.richMessage))])
case .sendMessageTextDraftAction(let _data):
return ("sendMessageTextDraftAction", [("randomId", ConstructorParameterDescription(_data.randomId)), ("text", ConstructorParameterDescription(_data.text))])
case .sendMessageTypingAction:
@ -314,6 +356,22 @@ public extension Api {
}
}
public static func parse_inputSendMessageRichMessageDraftAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Api.InputRichMessage?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputRichMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.SendMessageAction.inputSendMessageRichMessageDraftAction(Cons_inputSendMessageRichMessageDraftAction(randomId: _1!, richMessage: _2!))
}
else {
return nil
}
}
public static func parse_sendMessageCancelAction(_ reader: BufferReader) -> SendMessageAction? {
return Api.SendMessageAction.sendMessageCancelAction
}
@ -379,6 +437,22 @@ public extension Api {
public static func parse_sendMessageRecordVideoAction(_ reader: BufferReader) -> SendMessageAction? {
return Api.SendMessageAction.sendMessageRecordVideoAction
}
public static func parse_sendMessageRichMessageDraftAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Api.RichMessage?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.RichMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.SendMessageAction.sendMessageRichMessageDraftAction(Cons_sendMessageRichMessageDraftAction(randomId: _1!, richMessage: _2!))
}
else {
return nil
}
}
public static func parse_sendMessageTextDraftAction(_ reader: BufferReader) -> SendMessageAction? {
var _1: Int64?
_1 = reader.readInt64()

View file

@ -9011,9 +9011,9 @@ public extension Api.functions.messages {
}
}
public extension Api.functions.messages {
static func saveDraft(flags: Int32, replyTo: Api.InputReplyTo?, peer: Api.InputPeer, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, effect: Int64?, suggestedPost: Api.SuggestedPost?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
static func saveDraft(flags: Int32, replyTo: Api.InputReplyTo?, peer: Api.InputPeer, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, effect: Int64?, suggestedPost: Api.SuggestedPost?, richMessage: Api.InputRichMessage?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1420701838)
buffer.appendInt32(-1391484580)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 4) != 0 {
replyTo!.serialize(buffer, true)
@ -9036,7 +9036,10 @@ public extension Api.functions.messages {
if Int(flags) & Int(1 << 8) != 0 {
suggestedPost!.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.saveDraft", parameters: [("flags", ConstructorParameterDescription(flags)), ("replyTo", ConstructorParameterDescription(replyTo)), ("peer", ConstructorParameterDescription(peer)), ("message", ConstructorParameterDescription(message)), ("entities", ConstructorParameterDescription(entities)), ("media", ConstructorParameterDescription(media)), ("effect", ConstructorParameterDescription(effect)), ("suggestedPost", ConstructorParameterDescription(suggestedPost))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
if Int(flags) & Int(1 << 9) != 0 {
richMessage!.serialize(buffer, true)
}
return (FunctionDescription(name: "messages.saveDraft", parameters: [("flags", ConstructorParameterDescription(flags)), ("replyTo", ConstructorParameterDescription(replyTo)), ("peer", ConstructorParameterDescription(peer)), ("message", ConstructorParameterDescription(message)), ("entities", ConstructorParameterDescription(entities)), ("media", ConstructorParameterDescription(media)), ("effect", ConstructorParameterDescription(effect)), ("suggestedPost", ConstructorParameterDescription(suggestedPost)), ("richMessage", ConstructorParameterDescription(richMessage))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {

View file

@ -553,7 +553,8 @@ public extension Api {
public var date: Int32
public var effect: Int64?
public var suggestedPost: Api.SuggestedPost?
public init(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32, effect: Int64?, suggestedPost: Api.SuggestedPost?) {
public var richMessage: Api.InputRichMessage?
public init(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32, effect: Int64?, suggestedPost: Api.SuggestedPost?, richMessage: Api.InputRichMessage?) {
self.flags = flags
self.replyTo = replyTo
self.message = message
@ -562,9 +563,10 @@ public extension Api {
self.date = date
self.effect = effect
self.suggestedPost = suggestedPost
self.richMessage = richMessage
}
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
return ("draftMessage", [("flags", ConstructorParameterDescription(self.flags)), ("replyTo", ConstructorParameterDescription(self.replyTo)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("media", ConstructorParameterDescription(self.media)), ("date", ConstructorParameterDescription(self.date)), ("effect", ConstructorParameterDescription(self.effect)), ("suggestedPost", ConstructorParameterDescription(self.suggestedPost))])
return ("draftMessage", [("flags", ConstructorParameterDescription(self.flags)), ("replyTo", ConstructorParameterDescription(self.replyTo)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("media", ConstructorParameterDescription(self.media)), ("date", ConstructorParameterDescription(self.date)), ("effect", ConstructorParameterDescription(self.effect)), ("suggestedPost", ConstructorParameterDescription(self.suggestedPost)), ("richMessage", ConstructorParameterDescription(self.richMessage))])
}
}
public class Cons_draftMessageEmpty: TypeConstructorDescription {
@ -585,7 +587,7 @@ public extension Api {
switch self {
case .draftMessage(let _data):
if boxed {
buffer.appendInt32(-1763006997)
buffer.appendInt32(-1743452271)
}
serializeInt32(_data.flags, buffer: buffer, boxed: false)
if Int(_data.flags) & Int(1 << 4) != 0 {
@ -609,6 +611,9 @@ public extension Api {
if Int(_data.flags) & Int(1 << 8) != 0 {
_data.suggestedPost!.serialize(buffer, true)
}
if Int(_data.flags) & Int(1 << 9) != 0 {
_data.richMessage!.serialize(buffer, true)
}
break
case .draftMessageEmpty(let _data):
if boxed {
@ -625,7 +630,7 @@ public extension Api {
public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) {
switch self {
case .draftMessage(let _data):
return ("draftMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("replyTo", ConstructorParameterDescription(_data.replyTo)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("media", ConstructorParameterDescription(_data.media)), ("date", ConstructorParameterDescription(_data.date)), ("effect", ConstructorParameterDescription(_data.effect)), ("suggestedPost", ConstructorParameterDescription(_data.suggestedPost))])
return ("draftMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("replyTo", ConstructorParameterDescription(_data.replyTo)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("media", ConstructorParameterDescription(_data.media)), ("date", ConstructorParameterDescription(_data.date)), ("effect", ConstructorParameterDescription(_data.effect)), ("suggestedPost", ConstructorParameterDescription(_data.suggestedPost)), ("richMessage", ConstructorParameterDescription(_data.richMessage))])
case .draftMessageEmpty(let _data):
return ("draftMessageEmpty", [("flags", ConstructorParameterDescription(_data.flags)), ("date", ConstructorParameterDescription(_data.date))])
}
@ -666,6 +671,12 @@ public extension Api {
_8 = Api.parse(reader, signature: signature) as? Api.SuggestedPost
}
}
var _9: Api.InputRichMessage?
if Int(_1 ?? 0) & Int(1 << 9) != 0 {
if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.InputRichMessage
}
}
let _c1 = _1 != nil
let _c2 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _2 != nil
let _c3 = _3 != nil
@ -674,8 +685,9 @@ public extension Api {
let _c6 = _6 != nil
let _c7 = (Int(_1 ?? 0) & Int(1 << 7) == 0) || _7 != nil
let _c8 = (Int(_1 ?? 0) & Int(1 << 8) == 0) || _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.DraftMessage.draftMessage(Cons_draftMessage(flags: _1!, replyTo: _2, message: _3!, entities: _4, media: _5, date: _6!, effect: _7, suggestedPost: _8))
let _c9 = (Int(_1 ?? 0) & Int(1 << 9) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.DraftMessage.draftMessage(Cons_draftMessage(flags: _1!, replyTo: _2, message: _3!, entities: _4, media: _5, date: _6!, effect: _7, suggestedPost: _8, richMessage: _9))
}
else {
return nil

View file

@ -13,6 +13,11 @@ struct AccountStateChannelState: Equatable {
var pts: Int32
}
enum PeerLiveTypingDraftUpdateContent {
case plain(text: String, entities: [MessageTextEntity])
case rich(RichTextMessageAttribute)
}
final class AccountInitialState {
let state: AuthorizedAccountState.State
let peerIds: Set<PeerId>
@ -93,7 +98,7 @@ enum AccountStateMutationOperation {
case AddSecretMessages([Api.EncryptedMessage])
case ReadSecretOutbox(peerId: PeerId, maxTimestamp: Int32, actionTimestamp: Int32)
case AddPeerInputActivity(chatPeerId: PeerActivitySpace, peerId: PeerId?, activity: PeerInputActivity?)
case AddPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId, id: Int64, timestamp: Int32, peerId: PeerId, text: String, entities: [MessageTextEntity])
case AddPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId, id: Int64, timestamp: Int32, peerId: PeerId, content: PeerLiveTypingDraftUpdateContent)
case UpdatePinnedItemIds(PeerGroupId, AccountStateUpdatePinnedItemIdsOperation)
case UpdatePinnedSavedItemIds(AccountStateUpdatePinnedItemIdsOperation)
case UpdatePinnedTopic(peerId: PeerId, threadId: Int64, isPinned: Bool)
@ -608,8 +613,8 @@ struct AccountMutableState {
self.addOperation(.AddPeerInputActivity(chatPeerId: chatPeerId, peerId: peerId, activity: activity))
}
mutating func addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId, id: Int64, timestamp: Int32, peerId: PeerId, text: String, entities: [MessageTextEntity]) {
self.addOperation(.AddPeerLiveTypingDraftUpdate(peerAndThreadId: peerAndThreadId, id: id, timestamp: timestamp, peerId: peerId, text: text, entities: entities))
mutating func addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId, id: Int64, timestamp: Int32, peerId: PeerId, content: PeerLiveTypingDraftUpdateContent) {
self.addOperation(.AddPeerLiveTypingDraftUpdate(peerAndThreadId: peerAndThreadId, id: id, timestamp: timestamp, peerId: peerId, content: content))
}
mutating func addUpdatePinnedItemIds(groupId: PeerGroupId, operation: AccountStateUpdatePinnedItemIdsOperation) {

View file

@ -302,7 +302,7 @@ extension InstantPageBlock {
self = .heading(text: RichText(apiText: pageBlockHeading6.text), level: 6)
case let .pageBlockMath(pageBlockMath):
self = .formula(latex: pageBlockMath.source)
case .inputPageBlockPhoto, .inputPageBlockVideo, .inputPageBlockAudio, .inputPageBlockMap, .inputPageBlockOrderedList:
case .inputPageBlockMap, .inputPageBlockOrderedList:
self = .unsupported
}
}
@ -350,21 +350,23 @@ extension InstantPageBlock {
return .pageBlockBlockquote(Api.PageBlock.Cons_pageBlockBlockquote(text: text.apiRichText(), caption: caption.apiRichText()))
case let .pullQuote(text, caption):
return .pageBlockPullquote(Api.PageBlock.Cons_pageBlockPullquote(text: text.apiRichText(), caption: caption.apiRichText()))
case let .image(id, caption, url, _):
//TODO:localize
let _ = id
assertionFailure()
return .inputPageBlockPhoto(Api.PageBlock.Cons_inputPageBlockPhoto(flags: 0, photo: .inputPhotoEmpty, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText())), url: url))
case let .image(id, caption, url, webpageId):
var flags: Int32 = 0
if url != nil && webpageId != nil {
flags |= 1 << 0
}
return .pageBlockPhoto(Api.PageBlock.Cons_pageBlockPhoto(flags: flags, photoId: id.id, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText())), url: url, webpageId: webpageId?.id))
case let .video(id, caption, autoplay, loop):
//TODO:localize
let _ = autoplay
let _ = loop
let _ = id
assertionFailure()
return .inputPageBlockVideo(Api.PageBlock.Cons_inputPageBlockVideo(flags: 0, video: .inputDocumentEmpty, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText()))))
var flags: Int32 = 0
if autoplay {
flags |= 1 << 0
}
if loop {
flags |= 1 << 1
}
return .pageBlockVideo(Api.PageBlock.Cons_pageBlockVideo(flags: flags, videoId: id.id, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText()))))
case let .audio(id, caption):
let _ = id
return .inputPageBlockAudio(Api.PageBlock.Cons_inputPageBlockAudio(audio: .inputDocumentEmpty, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText()))))
return .pageBlockAudio(Api.PageBlock.Cons_pageBlockAudio(audioId: id.id, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText()))))
case let .collage(items, caption):
return .pageBlockCollage(Api.PageBlock.Cons_pageBlockCollage(items: items.compactMap { $0.apiInputBlock() }, caption: .pageCaption(Api.PageCaption.Cons_pageCaption(text: caption.text.apiRichText(), credit: caption.credit.apiRichText()))))
case let .slideshow(items, caption):

View file

@ -53,13 +53,55 @@ extension RichText {
case let .textAnchor(textAnchorData):
let (text, name) = (textAnchorData.text, textAnchorData.name)
self = .anchor(text: RichText(apiText: text), name: name)
case .inputTextImage:
self = .plain("")
case .textCustomEmoji:
//TODO:localize
self = .plain("")
case let .textMath(textMath):
self = .formula(latex: textMath.source)
case let .textAutoEmail(email):
let _ = email
//TODO:localize
self = .plain("")
case let .textAutoPhone(phone):
let _ = phone
//TODO:localize
self = .plain("")
case let .textAutoUrl(url):
let _ = url
//TODO:localize
self = .plain("")
case let .textBankCard(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textBotCommand(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textCashtag(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textDate(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textHashtag(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textMention(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textMentionName(value):
let _ = value
//TODO:localize
self = .plain("")
case let .textSpoiler(value):
let _ = value
//TODO:localize
self = .plain("")
}
}
@ -94,10 +136,7 @@ extension RichText {
case let .phone(text, phone):
return .textPhone(Api.RichText.Cons_textPhone(text: text.apiRichText(), phone: phone))
case let .image(id, dimensions):
//TODO:localize
let _ = id
assertionFailure()
return .inputTextImage(Api.RichText.Cons_inputTextImage(document: .inputDocumentEmpty, w: dimensions.width, h: dimensions.height))
return .textImage(Api.RichText.Cons_textImage(documentId: id.id, w: dimensions.width, h: dimensions.height))
case let .anchor(text, name):
return .textAnchor(Api.RichText.Cons_textAnchor(text: text.apiRichText(), name: name))
case let .formula(latex):

View file

@ -924,6 +924,11 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
var missingUpdatesFromChannels = Set<PeerId>()
enum TypingDraftText {
case plain(Api.TextWithEntities)
case rich(Api.RichMessage)
}
for update in sortedUpdates(updates) {
switch update {
case let .updateChannelTooLong(updateChannelTooLongData):
@ -1516,12 +1521,22 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
let threadId = topMsgId.flatMap { Int64($0) }
if let date = updatesDate, date + 60 > serverTime {
var typingDraftData: (randomId: Int64, text: TypingDraftText)?
if case let .sendMessageTextDraftAction(sendMessageTextDraftActionData) = type {
let (randomId, text) = (sendMessageTextDraftActionData.randomId, sendMessageTextDraftActionData.text)
switch text {
case let .textWithEntities(textWithEntitiesData):
let (text, entities) = (textWithEntitiesData.text, textWithEntitiesData.entities)
updatedState.addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), threadId: threadId), id: randomId, timestamp: date, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), text: text, entities: messageTextEntitiesFromApiEntities(entities))
typingDraftData = (sendMessageTextDraftActionData.randomId, .plain(sendMessageTextDraftActionData.text))
} else if case let .sendMessageRichMessageDraftAction(sendMessageRichMessageDraftActionData) = type {
typingDraftData = (sendMessageRichMessageDraftActionData.randomId, .rich(sendMessageRichMessageDraftActionData.richMessage))
}
if let typingDraftData {
switch typingDraftData.text {
case let .plain(plain):
if case let .textWithEntities(textWithEntitiesData) = plain {
updatedState.addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), threadId: threadId), id: typingDraftData.randomId, timestamp: date, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), content: .plain(text: textWithEntitiesData.text, entities: messageTextEntitiesFromApiEntities(textWithEntitiesData.entities)))
}
case let .rich(richMessage):
let parsedRichMessage = RichTextMessageAttribute(apiRichMessage: richMessage)
updatedState.addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), threadId: threadId), id: typingDraftData.randomId, timestamp: date, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), content: .rich(parsedRichMessage))
}
} else {
let activity = PeerInputActivity(apiType: type, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), timestamp: date)
@ -1555,8 +1570,11 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
switch text {
case let .textWithEntities(textWithEntitiesData):
let (text, entities) = (textWithEntitiesData.text, textWithEntitiesData.entities)
updatedState.addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId(peerId: channelPeerId, threadId: threadId), id: randomId, timestamp: date, peerId: userId.peerId, text: text, entities: messageTextEntitiesFromApiEntities(entities))
updatedState.addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId(peerId: channelPeerId, threadId: threadId), id: randomId, timestamp: date, peerId: userId.peerId, content: .plain(text: text, entities: messageTextEntitiesFromApiEntities(entities)))
}
} else if case let .sendMessageRichMessageDraftAction(sendMessageRichMessageDraftActionData) = type {
let parsedRichMessage = RichTextMessageAttribute(apiRichMessage: sendMessageRichMessageDraftActionData.richMessage)
updatedState.addPeerLiveTypingDraftUpdate(peerAndThreadId: PeerAndThreadId(peerId: channelPeerId, threadId: threadId), id: sendMessageRichMessageDraftActionData.randomId, timestamp: date, peerId: userId.peerId, content: .rich(parsedRichMessage))
} else {
let activity = PeerInputActivity(apiType: type, peerId: nil, timestamp: date)
var category: PeerActivitySpace.Category = .global
@ -4004,16 +4022,14 @@ func replayFinalState(
var threadId: Int64?
var authorId: PeerId
var timestamp: Int32
var text: String
var entities: [MessageTextEntity]
var content: PeerLiveTypingDraftUpdateContent
init(id: Int64, threadId: Int64?, authorId: PeerId, timestamp: Int32, text: String, entities: [MessageTextEntity]) {
init(id: Int64, threadId: Int64?, authorId: PeerId, timestamp: Int32, content: PeerLiveTypingDraftUpdateContent) {
self.id = id
self.threadId = threadId
self.authorId = authorId
self.timestamp = timestamp
self.text = text
self.entities = entities
self.content = content
}
}
@ -4949,7 +4965,7 @@ func replayFinalState(
} else if chatPeerId.peerId.namespace == Namespaces.Peer.SecretChat {
updatedSecretChatTypingActivities.insert(chatPeerId.peerId)
}
case let .AddPeerLiveTypingDraftUpdate(peerAndThreadId, id, timestamp, authorId, text, entities):
case let .AddPeerLiveTypingDraftUpdate(peerAndThreadId, id, timestamp, authorId, content):
if liveTypingDraftUpdates[peerAndThreadId] == nil {
liveTypingDraftUpdates[peerAndThreadId] = []
}
@ -4958,8 +4974,7 @@ func replayFinalState(
threadId: peerAndThreadId.threadId,
authorId: authorId,
timestamp: timestamp,
text: text,
entities: entities
content: content
)))
if peerAndThreadId.threadId != nil {
let allKey = PeerAndThreadId(peerId: peerAndThreadId.peerId, threadId: nil)
@ -4971,8 +4986,7 @@ func replayFinalState(
threadId: peerAndThreadId.threadId,
authorId: authorId,
timestamp: timestamp,
text: text,
entities: entities
content: content
)))
}
case let .UpdatePinnedItemIds(groupId, pinnedOperation):
@ -6127,17 +6141,32 @@ func replayFinalState(
timestamp = max(timestamp, index.timestamp)
}
}
let draftText: String
let draftAttributes: [MessageAttribute]
switch update.content {
case let .plain(text, entities):
draftText = text
draftAttributes = [
TypingDraftMessageAttribute(),
TextEntitiesMessageAttribute(entities: entities)
]
case let .rich(richData):
draftText = ""
draftAttributes = [
TypingDraftMessageAttribute(),
richData
]
}
return (
update.id,
Namespaces.Message.Cloud,
update.threadId,
update.authorId,
timestamp,
update.text,
[
TypingDraftMessageAttribute(),
TextEntitiesMessageAttribute(entities: update.entities)
]
draftText,
draftAttributes
)
case .cancel:
return nil

View file

@ -251,7 +251,7 @@ private func synchronizeChatInputState(transaction: Transaction, postbox: Postbo
flags |= 1 << 8
}
return network.request(Api.functions.messages.saveDraft(flags: flags, replyTo: replyTo, peer: inputPeer, message: inputState?.text ?? "", entities: apiEntitiesFromMessageTextEntities(inputState?.entities ?? [], associatedPeers: SimpleDictionary()), media: nil, effect: nil, suggestedPost: suggestedPost))
return network.request(Api.functions.messages.saveDraft(flags: flags, replyTo: replyTo, peer: inputPeer, message: inputState?.text ?? "", entities: apiEntitiesFromMessageTextEntities(inputState?.entities ?? [], associatedPeers: SimpleDictionary()), media: nil, effect: nil, suggestedPost: suggestedPost, richMessage: nil))
|> delay(2.0, queue: Queue.concurrentDefaultQueue())
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)

View file

@ -117,46 +117,50 @@ public enum PeerInputActivity: Comparable {
extension PeerInputActivity {
init?(apiType: Api.SendMessageAction, peerId: PeerId?, timestamp: Int32) {
switch apiType {
case .sendMessageCancelAction, .sendMessageChooseContactAction, .sendMessageGeoLocationAction, .sendMessageRecordVideoAction:
return nil
case .sendMessageGamePlayAction:
self = .playingGame
case .sendMessageRecordAudioAction, .sendMessageUploadAudioAction:
self = .recordingVoice
case .sendMessageTypingAction:
self = .typingText
case let .sendMessageUploadDocumentAction(sendMessageUploadDocumentActionData):
let progress = sendMessageUploadDocumentActionData.progress
self = .uploadingFile(progress: progress)
case let .sendMessageUploadPhotoAction(sendMessageUploadPhotoActionData):
let progress = sendMessageUploadPhotoActionData.progress
self = .uploadingPhoto(progress: progress)
case let .sendMessageUploadVideoAction(sendMessageUploadVideoActionData):
let progress = sendMessageUploadVideoActionData.progress
self = .uploadingVideo(progress: progress)
case .sendMessageRecordRoundAction:
self = .recordingInstantVideo
case let .sendMessageUploadRoundAction(sendMessageUploadRoundActionData):
let progress = sendMessageUploadRoundActionData.progress
self = .uploadingInstantVideo(progress: progress)
case .speakingInGroupCallAction:
self = .speakingInGroupCall(timestamp: timestamp)
case .sendMessageChooseStickerAction:
self = .choosingSticker
case .sendMessageHistoryImportAction:
return nil
case let .sendMessageEmojiInteraction(sendMessageEmojiInteractionData):
let (emoticon, messageId, interaction) = (sendMessageEmojiInteractionData.emoticon, sendMessageEmojiInteractionData.msgId, sendMessageEmojiInteractionData.interaction)
if let peerId = peerId {
self = .interactingWithEmoji(emoticon: emoticon, messageId: MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: messageId), interaction: EmojiInteraction(apiDataJson: interaction))
} else {
return nil
}
case let .sendMessageEmojiInteractionSeen(sendMessageEmojiInteractionSeenData):
let emoticon = sendMessageEmojiInteractionSeenData.emoticon
self = .seeingEmojiInteraction(emoticon: emoticon)
case .sendMessageTextDraftAction:
case .sendMessageCancelAction, .sendMessageChooseContactAction, .sendMessageGeoLocationAction, .sendMessageRecordVideoAction:
return nil
case .sendMessageGamePlayAction:
self = .playingGame
case .sendMessageRecordAudioAction, .sendMessageUploadAudioAction:
self = .recordingVoice
case .sendMessageTypingAction:
self = .typingText
case let .sendMessageUploadDocumentAction(sendMessageUploadDocumentActionData):
let progress = sendMessageUploadDocumentActionData.progress
self = .uploadingFile(progress: progress)
case let .sendMessageUploadPhotoAction(sendMessageUploadPhotoActionData):
let progress = sendMessageUploadPhotoActionData.progress
self = .uploadingPhoto(progress: progress)
case let .sendMessageUploadVideoAction(sendMessageUploadVideoActionData):
let progress = sendMessageUploadVideoActionData.progress
self = .uploadingVideo(progress: progress)
case .sendMessageRecordRoundAction:
self = .recordingInstantVideo
case let .sendMessageUploadRoundAction(sendMessageUploadRoundActionData):
let progress = sendMessageUploadRoundActionData.progress
self = .uploadingInstantVideo(progress: progress)
case .speakingInGroupCallAction:
self = .speakingInGroupCall(timestamp: timestamp)
case .sendMessageChooseStickerAction:
self = .choosingSticker
case .sendMessageHistoryImportAction:
return nil
case let .sendMessageEmojiInteraction(sendMessageEmojiInteractionData):
let (emoticon, messageId, interaction) = (sendMessageEmojiInteractionData.emoticon, sendMessageEmojiInteractionData.msgId, sendMessageEmojiInteractionData.interaction)
if let peerId = peerId {
self = .interactingWithEmoji(emoticon: emoticon, messageId: MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: messageId), interaction: EmojiInteraction(apiDataJson: interaction))
} else {
return nil
}
case let .sendMessageEmojiInteractionSeen(sendMessageEmojiInteractionSeenData):
let emoticon = sendMessageEmojiInteractionSeenData.emoticon
self = .seeingEmojiInteraction(emoticon: emoticon)
case .sendMessageTextDraftAction:
return nil
case .sendMessageRichMessageDraftAction:
return nil
case .inputSendMessageRichMessageDraftAction:
return nil
}
}
}

View file

@ -84,7 +84,10 @@ extension RichTextMessageAttribute {
return Api.InputRichMessage.inputRichMessage(Api.InputRichMessage.Cons_inputRichMessage(
flags: flags,
blocks: self.instantPage.blocks.compactMap { $0.apiInputBlock() }
blocks: self.instantPage.blocks.compactMap { $0.apiInputBlock() },
photos: nil,
documents: nil,
users: nil
))
}
}

View file

@ -62,7 +62,7 @@ func _internal_clearCloudDraftsInteractively(postbox: Postbox, network: Network,
flags |= (1 << 0)
replyTo = .inputReplyToMonoForum(.init(monoforumPeerId: monoforumPeerId))
}
signals.append(network.request(Api.functions.messages.saveDraft(flags: flags, replyTo: replyTo, peer: inputPeer, message: "", entities: nil, media: nil, effect: nil, suggestedPost: nil))
signals.append(network.request(Api.functions.messages.saveDraft(flags: flags, replyTo: replyTo, peer: inputPeer, message: "", entities: nil, media: nil, effect: nil, suggestedPost: nil, richMessage: nil))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}

View file

@ -329,8 +329,16 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
if let updatingMedia = itemAttributes.updatingMedia {
messageText = updatingMedia.text
}
var richText: RichTextMessageAttribute?
for attribute in item.message.attributes {
if let attribute = attribute as? RichTextMessageAttribute {
richText = attribute
break
}
}
if !messageText.isEmpty || message.attributes.contains(where: { $0 is TypingDraftMessageAttribute }) || isUnsupportedMedia || isStoryWithText {
if !messageText.isEmpty || (message.attributes.contains(where: { $0 is TypingDraftMessageAttribute }) && richText == nil) || isUnsupportedMedia || isStoryWithText {
if !skipText {
if case .group = item.content, !isFile {
messageWithCaptionToAdd = (message, itemAttributes)
@ -391,15 +399,7 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
}
}
var richText: RichTextMessageAttribute?
for attribute in item.message.attributes {
if let attribute = attribute as? RichTextMessageAttribute {
richText = attribute
break
}
}
if richText != nil {
if richText != nil && !skipText {
result.append((message, ChatMessageRichDataBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: .default)))
}

View file

@ -19,10 +19,12 @@ public final class TextRevealController {
public private(set) var latestLength: Int
public private(set) var isFinalizing: Bool = false
private var lastFrameTime: Double?
public var durationMultiplier: Double
public init(initialRevealedCount: Int, initialLength: Int) {
public init(initialRevealedCount: Int, initialLength: Int, durationMultiplier: Double = 1.0) {
self.revealedCount = Double(initialRevealedCount)
self.latestLength = initialLength
self.durationMultiplier = max(0.0001, durationMultiplier)
}
public var currentGlyphCount: Int {
@ -80,7 +82,7 @@ public final class TextRevealController {
}
let smoothing = min(1.0, dt / TextRevealController.velocityTau)
self.velocity += (targetVelocity - self.velocity) * smoothing
self.revealedCount = min(Double(self.latestLength), self.revealedCount + self.velocity * dt)
self.revealedCount = min(Double(self.latestLength), self.revealedCount + self.velocity * dt / self.durationMultiplier)
self.lastFrameTime = now
let isComplete = self.isFinalizing && self.revealedCount >= Double(self.latestLength)
return (Int(self.revealedCount), isComplete)

View file

@ -652,7 +652,7 @@ public final class TextSelectionNode: ASDisplayNode {
highlightOverlay.innerRadius = 2.0
highlightOverlay.outerRadius = 2.0
highlightOverlay.inset = 1.0
highlightOverlay.useModernPathCalculation = false
highlightOverlay.useModernPathCalculation = true
self.highlightOverlay = highlightOverlay
self.highlightAreaNode.addSubnode(highlightOverlay)