diff --git a/TelegramCore/Api0.swift b/TelegramCore/Api0.swift index 54d3ad819b..b8a27e24e0 100644 --- a/TelegramCore/Api0.swift +++ b/TelegramCore/Api0.swift @@ -447,9 +447,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1160215659] = { return Api.InputMessage.parse_inputMessageReplyTo($0) } dict[-2037963464] = { return Api.InputMessage.parse_inputMessagePinned($0) } dict[-1564789301] = { return Api.PhoneCallProtocol.parse_phoneCallProtocol($0) } - dict[-860866985] = { return Api.WallPaper.parse_wallPaper($0) } - dict[1662091044] = { return Api.WallPaper.parse_wallPaperSolid($0) } - dict[-1338674530] = { return Api.WallPaper.parse_wallPaperDocument($0) } + dict[-1695098544] = { return Api.WallPaper.parse_wallPaper($0) } dict[-1938715001] = { return Api.messages.Messages.parse_messages($0) } dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) } dict[-1497072982] = { return Api.messages.Messages.parse_messagesSlice($0) } diff --git a/TelegramCore/Api1.swift b/TelegramCore/Api1.swift index 7960252822..b01d93b3c2 100644 --- a/TelegramCore/Api1.swift +++ b/TelegramCore/Api1.swift @@ -11234,42 +11234,17 @@ extension Api { } enum WallPaper: TypeConstructorDescription { - case wallPaper(id: Int32, title: String, sizes: [Api.PhotoSize], color: Int32) - case wallPaperSolid(id: Int32, title: String, bgColor: Int32, color: Int32) - case wallPaperDocument(flags: Int32, id: Int64, accessHash: Int64, title: String, slug: String, document: Api.Document, color: Int32?) + case wallPaper(id: Int64, flags: Int32, accessHash: Int64, slug: String, document: Api.Document, color: Int32?) func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .wallPaper(let id, let title, let sizes, let color): + case .wallPaper(let id, let flags, let accessHash, let slug, let document, let color): if boxed { - buffer.appendInt32(-860866985) + buffer.appendInt32(-1695098544) } - serializeInt32(id, buffer: buffer, boxed: false) - serializeString(title, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(sizes.count)) - for item in sizes { - item.serialize(buffer, true) - } - serializeInt32(color, buffer: buffer, boxed: false) - break - case .wallPaperSolid(let id, let title, let bgColor, let color): - if boxed { - buffer.appendInt32(1662091044) - } - serializeInt32(id, buffer: buffer, boxed: false) - serializeString(title, buffer: buffer, boxed: false) - serializeInt32(bgColor, buffer: buffer, boxed: false) - serializeInt32(color, buffer: buffer, boxed: false) - break - case .wallPaperDocument(let flags, let id, let accessHash, let title, let slug, let document, let color): - if boxed { - buffer.appendInt32(-1338674530) - } - serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) + serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) - serializeString(title, buffer: buffer, boxed: false) serializeString(slug, buffer: buffer, boxed: false) document.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {serializeInt32(color!, buffer: buffer, boxed: false)} @@ -11279,83 +11254,34 @@ extension Api { func descriptionFields() -> (String, [(String, Any)]) { switch self { - case .wallPaper(let id, let title, let sizes, let color): - return ("wallPaper", [("id", id), ("title", title), ("sizes", sizes), ("color", color)]) - case .wallPaperSolid(let id, let title, let bgColor, let color): - return ("wallPaperSolid", [("id", id), ("title", title), ("bgColor", bgColor), ("color", color)]) - case .wallPaperDocument(let flags, let id, let accessHash, let title, let slug, let document, let color): - return ("wallPaperDocument", [("flags", flags), ("id", id), ("accessHash", accessHash), ("title", title), ("slug", slug), ("document", document), ("color", color)]) + case .wallPaper(let id, let flags, let accessHash, let slug, let document, let color): + return ("wallPaper", [("id", id), ("flags", flags), ("accessHash", accessHash), ("slug", slug), ("document", document), ("color", color)]) } } static func parse_wallPaper(_ reader: BufferReader) -> WallPaper? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: [Api.PhotoSize]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhotoSize.self) - } - 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.WallPaper.wallPaper(id: _1!, title: _2!, sizes: _3!, color: _4!) - } - else { - return nil - } - } - static func parse_wallPaperSolid(_ reader: BufferReader) -> WallPaper? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - 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.WallPaper.wallPaperSolid(id: _1!, title: _2!, bgColor: _3!, color: _4!) - } - else { - return nil - } - } - static func parse_wallPaperDocument(_ reader: BufferReader) -> WallPaper? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() var _3: Int64? _3 = reader.readInt64() var _4: String? _4 = parseString(reader) - var _5: String? - _5 = parseString(reader) - var _6: Api.Document? + var _5: Api.Document? if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) as? Api.Document + _5 = Api.parse(reader, signature: signature) as? Api.Document } - var _7: Int32? - if Int(_1!) & Int(1 << 2) != 0 {_7 = reader.readInt32() } + var _6: Int32? + if Int(_2!) & Int(1 << 2) != 0 {_6 = reader.readInt32() } 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 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.WallPaper.wallPaperDocument(flags: _1!, id: _2!, accessHash: _3!, title: _4!, slug: _5!, document: _6!, color: _7) + let _c6 = (Int(_2!) & Int(1 << 2) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.WallPaper.wallPaper(id: _1!, flags: _2!, accessHash: _3!, slug: _4!, document: _5!, color: _6) } else { return nil diff --git a/TelegramCore/Api3.swift b/TelegramCore/Api3.swift index f32feceb35..96ae4537eb 100644 --- a/TelegramCore/Api3.swift +++ b/TelegramCore/Api3.swift @@ -5109,6 +5109,20 @@ extension Api { }) } + static func installWallPaper(wallpaper: Api.InputWallPaper) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(1241741518) + wallpaper.serialize(buffer, true) + return (FunctionDescription(name: "account.installWallPaper", parameters: [("wallpaper", wallpaper)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + let reader = BufferReader(buffer) + var result: Api.Bool? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.Bool + } + return result + }) + } + static func getWallPapers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1430579357)