diff --git a/TelegramCore/AccountStateManagementUtils.swift b/TelegramCore/AccountStateManagementUtils.swift index f4186325af..6e0c989515 100644 --- a/TelegramCore/AccountStateManagementUtils.swift +++ b/TelegramCore/AccountStateManagementUtils.swift @@ -827,13 +827,12 @@ private func finalStateWithUpdates(account: Account, state: AccountMutableState, updatedState.readInbox(MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: maxId)) case let .updateReadHistoryOutbox(peer, maxId, _, _): updatedState.readOutbox(MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: maxId)) - /*%layer76*/ - /*case let .updateReadFeed(_, feedId, maxPosition, unreadCount, unreadMutedCount): + case let .updateReadFeed(_, feedId, maxPosition, unreadCount, unreadMutedCount): switch maxPosition { case let .feedPosition(date, peer, id): let index = MessageIndex(id: MessageId(peerId: peer.peerId, namespace: Namespaces.Message.Cloud, id: id), timestamp: date) updatedState.readGroupFeedInbox(groupId: PeerGroupId(rawValue: feedId), index: index) - }*/ + } case let .updateWebPage(apiWebpage, _, _): switch apiWebpage { case let .webPageEmpty(id): @@ -1002,14 +1001,12 @@ private func finalStateWithUpdates(account: Account, state: AccountMutableState, updatedState.addPeerInputActivity(chatPeerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: chatId), peerId: nil, activity: .typingText) case let .updateDialogPinned(flags, peer): let item: PinnedItemId - /*%layer76*/ - /*switch peer { + switch peer { case let .dialogPeer(peer): item = .peer(peer.peerId) case let .dialogPeerFeed(feedId): item = .group(PeerGroupId(rawValue: feedId)) - }*/ - item = .peer(peer.peerId) + } if (flags & (1 << 0)) != 0 { updatedState.addUpdatePinnedItemIds(.pin(item)) } else { @@ -1019,14 +1016,12 @@ private func finalStateWithUpdates(account: Account, state: AccountMutableState, if let order = order { updatedState.addUpdatePinnedItemIds(.reorder(order.map { let item: PinnedItemId - /*%layer76*/ - /*switch $0 { + switch $0 { case let .dialogPeer(peer): item = .peer(peer.peerId) case let .dialogPeerFeed(feedId): item = .group(PeerGroupId(rawValue: feedId)) - }*/ - item = .peer($0.peerId) + } return item })) } else { @@ -1317,18 +1312,11 @@ func keepPollingChannel(account: Account, peerId: PeerId, stateManager: AccountS } private func resetChannels(_ account: Account, peers: [Peer], state: AccountMutableState) -> Signal { - /*%layer76*/ - /*var inputPeers: [Api.InputDialogPeer] = [] + var inputPeers: [Api.InputDialogPeer] = [] for peer in peers { if let inputPeer = apiInputPeer(peer) { inputPeers.append(.inputDialogPeer(peer: inputPeer)) } - }*/ - var inputPeers: [Api.InputPeer] = [] - for peer in peers { - if let inputPeer = apiInputPeer(peer) { - inputPeers.append(inputPeer) - } } return account.network.request(Api.functions.messages.getPeerDialogs(peers: inputPeers)) |> map(Optional.init) @@ -1376,10 +1364,9 @@ private func resetChannels(_ account: Account, peers: [Peer], state: AccountMuta apiUnreadMentionsCount = unreadMentionsCount apiNotificationSettings = peerNotificationSettings apiChannelPts = pts - /*%layer76*/ - /*case .dialogFeed: + case .dialogFeed: assertionFailure() - continue loop*/ + continue loop } let peerId: PeerId @@ -2091,8 +2078,7 @@ func replayFinalState(accountPeerId: PeerId, mediaBox: MediaBox, modifier: Modif } switch set { - /*%layer76*/ - case let .stickerSet(flags, _, _, _, _, _, _): + case let .stickerSet(flags, _, _, _, _, _, _, _): if (flags & (1 << 3)) != 0 { namespace = Namespaces.ItemCollection.CloudMaskPacks } else { diff --git a/TelegramCore/AccountStateReset.swift b/TelegramCore/AccountStateReset.swift index 251af6abd7..a4c6b3457c 100644 --- a/TelegramCore/AccountStateReset.swift +++ b/TelegramCore/AccountStateReset.swift @@ -16,8 +16,7 @@ func accountStateReset(postbox: Postbox, network: Network) -> Signal retryRequest - /*%layer76*/ - return combineLatest(network.request(Api.functions.messages.getDialogs(flags: 0/*, feedId: nil*/, offsetDate: 0, offsetId: 0, offsetPeer: .inputPeerEmpty, limit: 100)) + return combineLatest(network.request(Api.functions.messages.getDialogs(flags: 0, feedId: nil, offsetDate: 0, offsetId: 0, offsetPeer: .inputPeerEmpty, limit: 100)) |> retryRequest, pinnedChats, state) |> mapToSignal { result, pinnedChats, state -> Signal in var dialogsDialogs: [Api.Dialog] = [] @@ -55,10 +54,9 @@ func accountStateReset(postbox: Postbox, network: Network) -> Signal Signal Signal Any?] = { dict[-652419756] = { return Api.Chat.parse_chat($0) } dict[120753115] = { return Api.Chat.parse_chatForbidden($0) } dict[681420594] = { return Api.Chat.parse_channelForbidden($0) } - dict[1158377749] = { return Api.Chat.parse_channel($0) } + dict[-930515796] = { return Api.Chat.parse_channel($0) } dict[1516793212] = { return Api.ChatInvite.parse_chatInviteAlready($0) } dict[-613092008] = { return Api.ChatInvite.parse_chatInvite($0) } dict[1678812626] = { return Api.StickerSetCovered.parse_stickerSetCovered($0) } @@ -126,6 +126,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[129960444] = { return Api.UserStatus.parse_userStatusLastWeek($0) } dict[2011940674] = { return Api.UserStatus.parse_userStatusLastMonth($0) } dict[-455150117] = { return Api.Dialog.parse_dialog($0) } + dict[906521922] = { return Api.Dialog.parse_dialogFeed($0) } + dict[1330637553] = { return Api.FeedBroadcasts.parse_feedBroadcasts($0) } + dict[-1704428358] = { return Api.FeedBroadcasts.parse_feedBroadcastsUngrouped($0) } dict[381645902] = { return Api.SendMessageAction.parse_sendMessageTypingAction($0) } dict[-44119819] = { return Api.SendMessageAction.parse_sendMessageCancelAction($0) } dict[-1584933265] = { return Api.SendMessageAction.parse_sendMessageRecordVideoAction($0) } @@ -195,8 +198,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1574314746] = { return Api.Update.parse_updateConfig($0) } dict[861169551] = { return Api.Update.parse_updatePtsChanged($0) } dict[1081547008] = { return Api.Update.parse_updateChannelWebPage($0) } - dict[-686710068] = { return Api.Update.parse_updateDialogPinned($0) } - dict[-657787251] = { return Api.Update.parse_updatePinnedDialogs($0) } dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) } dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) } dict[-523384512] = { return Api.Update.parse_updateBotShippingQuery($0) } @@ -208,6 +209,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1987495099] = { return Api.Update.parse_updateChannelReadMessagesContents($0) } dict[1887741886] = { return Api.Update.parse_updateContactsReset($0) } dict[1893427255] = { return Api.Update.parse_updateChannelAvailableMessages($0) } + dict[1873186369] = { return Api.Update.parse_updateReadFeed($0) } + dict[433225532] = { return Api.Update.parse_updateDialogPinned($0) } + dict[-364071333] = { return Api.Update.parse_updatePinnedDialogs($0) } dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) } dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) } dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } @@ -216,6 +220,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[573315206] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) } dict[471043349] = { return Api.contacts.Blocked.parse_blocked($0) } dict[-1878523231] = { return Api.contacts.Blocked.parse_blockedSlice($0) } + dict[741914831] = { return Api.InputDialogPeer.parse_inputDialogPeerFeed($0) } + dict[-55902537] = { return Api.InputDialogPeer.parse_inputDialogPeer($0) } dict[-994444869] = { return Api.Error.parse_error($0) } dict[-1560655744] = { return Api.KeyboardButton.parse_keyboardButton($0) } dict[629866245] = { return Api.KeyboardButton.parse_keyboardButtonUrl($0) } @@ -258,7 +264,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1262639204] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageGame($0) } dict[864077702] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaAuto($0) } dict[2002815875] = { return Api.KeyboardButtonRow.parse_keyboardButtonRow($0) } - dict[-852477119] = { return Api.StickerSet.parse_stickerSet($0) } + dict[1434820921] = { return Api.StickerSet.parse_stickerSet($0) } dict[539045032] = { return Api.photos.Photo.parse_photo($0) } dict[-208488460] = { return Api.InputContact.parse_inputPhoneContact($0) } dict[-1419371685] = { return Api.TopPeerCategory.parse_topPeerCategoryBotsPM($0) } @@ -304,6 +310,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1800845601] = { return Api.payments.PaymentResult.parse_paymentVerficationNeeded($0) } dict[1694474197] = { return Api.messages.Chats.parse_chats($0) } dict[-1663561404] = { return Api.messages.Chats.parse_chatsSlice($0) } + dict[1348066419] = { return Api.FeedPosition.parse_feedPosition($0) } dict[834420005] = { return Api.InputSingleMedia.parse_inputSingleMedia($0) } dict[218751099] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowContacts($0) } dict[407582158] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowAll($0) } @@ -329,12 +336,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-714643696] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantToggleAdmin($0) } dict[-1312568665] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeStickerSet($0) } dict[1599903217] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionTogglePreHistoryHidden($0) } + dict[1182322895] = { return Api.messages.FeedMessages.parse_feedMessagesNotModified($0) } + dict[1438884273] = { return Api.messages.FeedMessages.parse_feedMessages($0) } dict[-543777747] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) } dict[-1269012015] = { return Api.messages.AffectedHistory.parse_affectedHistory($0) } dict[-2037289493] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) } dict[649453030] = { return Api.messages.MessageEditData.parse_messageEditData($0) } dict[-886477832] = { return Api.LabeledPrice.parse_labeledPrice($0) } dict[-438840932] = { return Api.messages.ChatFull.parse_chatFull($0) } + dict[-313079300] = { return Api.account.WebAuthorizations.parse_webAuthorizations($0) } dict[-236044656] = { return Api.help.TermsOfService.parse_termsOfService($0) } dict[1490799288] = { return Api.ReportReason.parse_inputReportReasonSpam($0) } dict[505595789] = { return Api.ReportReason.parse_inputReportReasonViolence($0) } @@ -449,7 +459,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1642487306] = { return Api.Message.parse_messageService($0) } dict[1157215293] = { return Api.Message.parse_message($0) } dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) } - dict[1558317424] = { return Api.messages.RecentStickers.parse_recentStickers($0) } + dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) } dict[342061462] = { return Api.InputFileLocation.parse_inputFileLocation($0) } dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) } dict[1125058340] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) } @@ -487,6 +497,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1816636575] = { return Api.LangPackString.parse_langPackStringPluralized($0) } dict[695856818] = { return Api.LangPackString.parse_langPackStringDeleted($0) } dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) } + dict[-2001655273] = { return Api.channels.FeedSources.parse_feedSourcesNotModified($0) } + dict[-1903441347] = { return Api.channels.FeedSources.parse_feedSources($0) } dict[1436466797] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) } dict[398898678] = { return Api.help.Support.parse_support($0) } dict[1474492012] = { return Api.MessagesFilter.parse_inputMessagesFilterEmpty($0) } @@ -568,6 +580,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) } dict[-1378534221] = { return Api.PeerNotifyEvents.parse_peerNotifyEventsEmpty($0) } dict[1830677896] = { return Api.PeerNotifyEvents.parse_peerNotifyEventsAll($0) } + dict[-633170927] = { return Api.DialogPeer.parse_dialogPeerFeed($0) } + dict[-445792507] = { return Api.DialogPeer.parse_dialogPeer($0) } dict[1599050311] = { return Api.ContactLink.parse_contactLinkUnknown($0) } dict[-17968211] = { return Api.ContactLink.parse_contactLinkNone($0) } dict[646922073] = { return Api.ContactLink.parse_contactLinkHasPhone($0) } @@ -616,6 +630,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[922273905] = { return Api.Document.parse_documentEmpty($0) } dict[-2027738169] = { return Api.Document.parse_document($0) } dict[-1707344487] = { return Api.messages.HighScores.parse_highScores($0) } + dict[-892779534] = { return Api.WebAuthorization.parse_webAuthorization($0) } dict[-805141448] = { return Api.ImportedContact.parse_importedContact($0) } return dict }() @@ -740,6 +755,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.Dialog: _1.serialize(buffer, boxed) + case let _1 as Api.FeedBroadcasts: + _1.serialize(buffer, boxed) case let _1 as Api.SendMessageAction: _1.serialize(buffer, boxed) case let _1 as Api.PrivacyKey: @@ -752,6 +769,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.contacts.Blocked: _1.serialize(buffer, boxed) + case let _1 as Api.InputDialogPeer: + _1.serialize(buffer, boxed) case let _1 as Api.Error: _1.serialize(buffer, boxed) case let _1 as Api.KeyboardButton: @@ -816,6 +835,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.messages.Chats: _1.serialize(buffer, boxed) + case let _1 as Api.FeedPosition: + _1.serialize(buffer, boxed) case let _1 as Api.InputSingleMedia: _1.serialize(buffer, boxed) case let _1 as Api.InputPrivacyRule: @@ -824,6 +845,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.ChannelAdminLogEventAction: _1.serialize(buffer, boxed) + case let _1 as Api.messages.FeedMessages: + _1.serialize(buffer, boxed) case let _1 as Api.auth.ExportedAuthorization: _1.serialize(buffer, boxed) case let _1 as Api.messages.AffectedHistory: @@ -836,6 +859,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.messages.ChatFull: _1.serialize(buffer, boxed) + case let _1 as Api.account.WebAuthorizations: + _1.serialize(buffer, boxed) case let _1 as Api.help.TermsOfService: _1.serialize(buffer, boxed) case let _1 as Api.ReportReason: @@ -992,6 +1017,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.InputWebFileLocation: _1.serialize(buffer, boxed) + case let _1 as Api.channels.FeedSources: + _1.serialize(buffer, boxed) case let _1 as Api.MessageFwdHeader: _1.serialize(buffer, boxed) case let _1 as Api.help.Support: @@ -1036,6 +1063,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.PeerNotifyEvents: _1.serialize(buffer, boxed) + case let _1 as Api.DialogPeer: + _1.serialize(buffer, boxed) case let _1 as Api.ContactLink: _1.serialize(buffer, boxed) case let _1 as Api.WebDocument: @@ -1074,6 +1103,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.messages.HighScores: _1.serialize(buffer, boxed) + case let _1 as Api.WebAuthorization: + _1.serialize(buffer, boxed) case let _1 as Api.ImportedContact: _1.serialize(buffer, boxed) default: @@ -1534,6 +1565,92 @@ public struct Api { } + public enum FeedMessages { + case feedMessagesNotModified + case feedMessages(flags: Int32, maxPosition: Api.FeedPosition?, minPosition: Api.FeedPosition?, readMaxPosition: Api.FeedPosition?, messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .feedMessagesNotModified: + if boxed { + buffer.appendInt32(1182322895) + } + + break + case .feedMessages(let flags, let maxPosition, let minPosition, let readMaxPosition, let messages, let chats, let users): + if boxed { + buffer.appendInt32(1438884273) + } + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {maxPosition!.serialize(buffer, true)} + if Int(flags) & Int(1 << 1) != 0 {minPosition!.serialize(buffer, true)} + if Int(flags) & Int(1 << 2) != 0 {readMaxPosition!.serialize(buffer, true)} + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(messages.count)) + for item in messages { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(chats.count)) + for item in chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(users.count)) + for item in users { + item.serialize(buffer, true) + } + break + } + } + + fileprivate static func parse_feedMessagesNotModified(_ reader: BufferReader) -> FeedMessages? { + return Api.messages.FeedMessages.feedMessagesNotModified + } + fileprivate static func parse_feedMessages(_ reader: BufferReader) -> FeedMessages? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.FeedPosition? + if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.FeedPosition + } } + var _3: Api.FeedPosition? + if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.FeedPosition + } } + var _4: Api.FeedPosition? + if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.FeedPosition + } } + var _5: [Api.Message]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + var _6: [Api.Chat]? + if let _ = reader.readInt32() { + _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _7: [Api.User]? + if let _ = reader.readInt32() { + _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { + return Api.messages.FeedMessages.feedMessages(flags: _1!, maxPosition: _2, minPosition: _3, readMaxPosition: _4, messages: _5!, chats: _6!, users: _7!) + } + else { + return nil + } + } + + } + public enum AffectedHistory { case affectedHistory(pts: Int32, ptsCount: Int32, offset: Int32) @@ -2020,7 +2137,7 @@ public struct Api { public enum RecentStickers { case recentStickersNotModified - case recentStickers(hash: Int32, stickers: [Api.Document]) + case recentStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -2030,16 +2147,26 @@ public struct Api { } break - case .recentStickers(let hash, let stickers): + case .recentStickers(let hash, let packs, let stickers, let dates): if boxed { - buffer.appendInt32(1558317424) + buffer.appendInt32(586395571) } serializeInt32(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) + buffer.appendInt32(Int32(packs.count)) + for item in packs { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) buffer.appendInt32(Int32(stickers.count)) for item in stickers { item.serialize(buffer, true) } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(dates.count)) + for item in dates { + serializeInt32(item, buffer: buffer, boxed: false) + } break } } @@ -2050,14 +2177,24 @@ public struct Api { fileprivate static func parse_recentStickers(_ reader: BufferReader) -> RecentStickers? { var _1: Int32? _1 = reader.readInt32() - var _2: [Api.Document]? + var _2: [Api.StickerPack]? if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self) + } + var _3: [Api.Document]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) + } + var _4: [Int32]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) } let _c1 = _1 != nil let _c2 = _2 != nil - if _c1 && _c2 { - return Api.messages.RecentStickers.recentStickers(hash: _1!, stickers: _2!) + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.messages.RecentStickers.recentStickers(hash: _1!, packs: _2!, stickers: _3!, dates: _4!) } else { return nil @@ -3360,7 +3497,7 @@ public struct Api { case chat(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?) case chatForbidden(id: Int32, title: String) case channelForbidden(flags: Int32, id: Int32, accessHash: Int64, title: String, untilDate: Int32?) - case channel(flags: Int32, id: Int32, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, version: Int32, restrictionReason: String?, adminRights: Api.ChannelAdminRights?, bannedRights: Api.ChannelBannedRights?, participantsCount: Int32?) + case channel(flags: Int32, id: Int32, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, version: Int32, restrictionReason: String?, adminRights: Api.ChannelAdminRights?, bannedRights: Api.ChannelBannedRights?, participantsCount: Int32?, feedId: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -3400,9 +3537,9 @@ public struct Api { serializeString(title, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 16) != 0 {serializeInt32(untilDate!, buffer: buffer, boxed: false)} break - case .channel(let flags, let id, let accessHash, let title, let username, let photo, let date, let version, let restrictionReason, let adminRights, let bannedRights, let participantsCount): + case .channel(let flags, let id, let accessHash, let title, let username, let photo, let date, let version, let restrictionReason, let adminRights, let bannedRights, let participantsCount, let feedId): if boxed { - buffer.appendInt32(1158377749) + buffer.appendInt32(-930515796) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) @@ -3416,6 +3553,7 @@ public struct Api { if Int(flags) & Int(1 << 14) != 0 {adminRights!.serialize(buffer, true)} if Int(flags) & Int(1 << 15) != 0 {bannedRights!.serialize(buffer, true)} if Int(flags) & Int(1 << 17) != 0 {serializeInt32(participantsCount!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 18) != 0 {serializeInt32(feedId!, buffer: buffer, boxed: false)} break } } @@ -3535,6 +3673,8 @@ public struct Api { } } var _12: Int32? if Int(_1!) & Int(1 << 17) != 0 {_12 = reader.readInt32() } + var _13: Int32? + if Int(_1!) & Int(1 << 18) != 0 {_13 = reader.readInt32() } let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = (Int(_1!) & Int(1 << 13) == 0) || _3 != nil @@ -3547,8 +3687,9 @@ public struct Api { let _c10 = (Int(_1!) & Int(1 << 14) == 0) || _10 != nil let _c11 = (Int(_1!) & Int(1 << 15) == 0) || _11 != nil let _c12 = (Int(_1!) & Int(1 << 17) == 0) || _12 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { - return Api.Chat.channel(flags: _1!, id: _2!, accessHash: _3, title: _4!, username: _5, photo: _6!, date: _7!, version: _8!, restrictionReason: _9, adminRights: _10, bannedRights: _11, participantsCount: _12) + let _c13 = (Int(_1!) & Int(1 << 18) == 0) || _13 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 { + return Api.Chat.channel(flags: _1!, id: _2!, accessHash: _3, title: _4!, username: _5, photo: _6!, date: _7!, version: _8!, restrictionReason: _9, adminRights: _10, bannedRights: _11, participantsCount: _12, feedId: _13) } else { return nil @@ -4683,6 +4824,7 @@ public struct Api { public enum Dialog { case dialog(flags: Int32, peer: Api.Peer, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, notifySettings: Api.PeerNotifySettings, pts: Int32?, draft: Api.DraftMessage?) + case dialogFeed(flags: Int32, peer: Api.Peer, topMessage: Int32, feedId: Int32, feedOtherChannels: [Int32], readMaxPosition: Api.FeedPosition?, unreadCount: Int32, unreadMutedCount: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -4701,6 +4843,23 @@ public struct Api { if Int(flags) & Int(1 << 0) != 0 {serializeInt32(pts!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {draft!.serialize(buffer, true)} break + case .dialogFeed(let flags, let peer, let topMessage, let feedId, let feedOtherChannels, let readMaxPosition, let unreadCount, let unreadMutedCount): + if boxed { + buffer.appendInt32(906521922) + } + serializeInt32(flags, buffer: buffer, boxed: false) + peer.serialize(buffer, true) + serializeInt32(topMessage, buffer: buffer, boxed: false) + serializeInt32(feedId, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(feedOtherChannels.count)) + for item in feedOtherChannels { + serializeInt32(item, buffer: buffer, boxed: false) + } + if Int(flags) & Int(1 << 3) != 0 {readMaxPosition!.serialize(buffer, true)} + serializeInt32(unreadCount, buffer: buffer, boxed: false) + serializeInt32(unreadMutedCount, buffer: buffer, boxed: false) + break } } @@ -4748,6 +4907,106 @@ public struct Api { return nil } } + fileprivate static func parse_dialogFeed(_ reader: BufferReader) -> Dialog? { + 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]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + var _6: Api.FeedPosition? + if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { + _6 = Api.parse(reader, signature: signature) as? Api.FeedPosition + } } + var _7: Int32? + _7 = reader.readInt32() + var _8: Int32? + _8 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil + let _c7 = _7 != nil + let _c8 = _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.Dialog.dialogFeed(flags: _1!, peer: _2!, topMessage: _3!, feedId: _4!, feedOtherChannels: _5!, readMaxPosition: _6, unreadCount: _7!, unreadMutedCount: _8!) + } + else { + return nil + } + } + + } + + public enum FeedBroadcasts { + case feedBroadcasts(feedId: Int32, channels: [Int32]) + case feedBroadcastsUngrouped(channels: [Int32]) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .feedBroadcasts(let feedId, let channels): + if boxed { + buffer.appendInt32(1330637553) + } + serializeInt32(feedId, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(channels.count)) + for item in channels { + serializeInt32(item, buffer: buffer, boxed: false) + } + break + case .feedBroadcastsUngrouped(let channels): + if boxed { + buffer.appendInt32(-1704428358) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(channels.count)) + for item in channels { + serializeInt32(item, buffer: buffer, boxed: false) + } + break + } + } + + fileprivate static func parse_feedBroadcasts(_ reader: BufferReader) -> FeedBroadcasts? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Int32]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.FeedBroadcasts.feedBroadcasts(feedId: _1!, channels: _2!) + } + else { + return nil + } + } + fileprivate static func parse_feedBroadcastsUngrouped(_ reader: BufferReader) -> FeedBroadcasts? { + var _1: [Int32]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + let _c1 = _1 != nil + if _c1 { + return Api.FeedBroadcasts.feedBroadcastsUngrouped(channels: _1!) + } + else { + return nil + } + } } @@ -5017,8 +5276,6 @@ public struct Api { case updateConfig case updatePtsChanged case updateChannelWebPage(channelId: Int32, webpage: Api.WebPage, pts: Int32, ptsCount: Int32) - case updateDialogPinned(flags: Int32, peer: Api.Peer) - case updatePinnedDialogs(flags: Int32, order: [Api.Peer]?) case updateBotWebhookJSON(data: Api.DataJSON) case updateBotWebhookJSONQuery(queryId: Int64, data: Api.DataJSON, timeout: Int32) case updateBotShippingQuery(queryId: Int64, userId: Int32, payload: Buffer, shippingAddress: Api.PostAddress) @@ -5030,6 +5287,9 @@ public struct Api { case updateChannelReadMessagesContents(channelId: Int32, messages: [Int32]) case updateContactsReset case updateChannelAvailableMessages(channelId: Int32, availableMinId: Int32) + case updateReadFeed(flags: Int32, feedId: Int32, maxPosition: Api.FeedPosition, unreadCount: Int32?, unreadMutedCount: Int32?) + case updateDialogPinned(flags: Int32, peer: Api.DialogPeer) + case updatePinnedDialogs(flags: Int32, order: [Api.DialogPeer]?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -5475,24 +5735,6 @@ public struct Api { serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) break - case .updateDialogPinned(let flags, let peer): - if boxed { - buffer.appendInt32(-686710068) - } - serializeInt32(flags, buffer: buffer, boxed: false) - peer.serialize(buffer, true) - break - case .updatePinnedDialogs(let flags, let order): - if boxed { - buffer.appendInt32(-657787251) - } - serializeInt32(flags, buffer: buffer, boxed: false) - if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261) - buffer.appendInt32(Int32(order!.count)) - for item in order! { - item.serialize(buffer, true) - }} - break case .updateBotWebhookJSON(let data): if boxed { buffer.appendInt32(-2095595325) @@ -5577,6 +5819,34 @@ public struct Api { serializeInt32(channelId, buffer: buffer, boxed: false) serializeInt32(availableMinId, buffer: buffer, boxed: false) break + case .updateReadFeed(let flags, let feedId, let maxPosition, let unreadCount, let unreadMutedCount): + if boxed { + buffer.appendInt32(1873186369) + } + serializeInt32(flags, buffer: buffer, boxed: false) + serializeInt32(feedId, buffer: buffer, boxed: false) + maxPosition.serialize(buffer, true) + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(unreadCount!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(unreadMutedCount!, buffer: buffer, boxed: false)} + break + case .updateDialogPinned(let flags, let peer): + if boxed { + buffer.appendInt32(433225532) + } + serializeInt32(flags, buffer: buffer, boxed: false) + peer.serialize(buffer, true) + break + case .updatePinnedDialogs(let flags, let order): + if boxed { + buffer.appendInt32(-364071333) + } + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261) + buffer.appendInt32(Int32(order!.count)) + for item in order! { + item.serialize(buffer, true) + }} + break } } @@ -6483,38 +6753,6 @@ public struct Api { return nil } } - fileprivate static func parse_updateDialogPinned(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Peer? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Peer - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.Update.updateDialogPinned(flags: _1!, peer: _2!) - } - else { - return nil - } - } - fileprivate static func parse_updatePinnedDialogs(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.Peer]? - if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) - } } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - if _c1 && _c2 { - return Api.Update.updatePinnedDialogs(flags: _1!, order: _2) - } - else { - return nil - } - } fileprivate static func parse_updateBotWebhookJSON(_ reader: BufferReader) -> Update? { var _1: Api.DataJSON? if let signature = reader.readInt32() { @@ -6668,6 +6906,63 @@ public struct Api { return nil } } + fileprivate static func parse_updateReadFeed(_ reader: BufferReader) -> Update? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Api.FeedPosition? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.FeedPosition + } + var _4: Int32? + if Int(_1!) & Int(1 << 0) != 0 {_4 = reader.readInt32() } + var _5: Int32? + if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.Update.updateReadFeed(flags: _1!, feedId: _2!, maxPosition: _3!, unreadCount: _4, unreadMutedCount: _5) + } + else { + return nil + } + } + fileprivate static func parse_updateDialogPinned(_ reader: BufferReader) -> Update? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.DialogPeer? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.DialogPeer + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.Update.updateDialogPinned(flags: _1!, peer: _2!) + } + else { + return nil + } + } + fileprivate static func parse_updatePinnedDialogs(_ reader: BufferReader) -> Update? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.DialogPeer]? + if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogPeer.self) + } } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + if _c1 && _c2 { + return Api.Update.updatePinnedDialogs(flags: _1!, order: _2) + } + else { + return nil + } + } } @@ -6855,6 +7150,54 @@ public struct Api { } + public enum InputDialogPeer { + case inputDialogPeerFeed(feedId: Int32) + case inputDialogPeer(peer: Api.InputPeer) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .inputDialogPeerFeed(let feedId): + if boxed { + buffer.appendInt32(741914831) + } + serializeInt32(feedId, buffer: buffer, boxed: false) + break + case .inputDialogPeer(let peer): + if boxed { + buffer.appendInt32(-55902537) + } + peer.serialize(buffer, true) + break + } + } + + fileprivate static func parse_inputDialogPeerFeed(_ reader: BufferReader) -> InputDialogPeer? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.InputDialogPeer.inputDialogPeerFeed(feedId: _1!) + } + else { + return nil + } + } + fileprivate static func parse_inputDialogPeer(_ reader: BufferReader) -> InputDialogPeer? { + var _1: Api.InputPeer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.InputPeer + } + let _c1 = _1 != nil + if _c1 { + return Api.InputDialogPeer.inputDialogPeer(peer: _1!) + } + else { + return nil + } + } + + } + public enum Error { case error(code: Int32, text: String) @@ -7928,15 +8271,16 @@ public struct Api { } public enum StickerSet { - case stickerSet(flags: Int32, id: Int64, accessHash: Int64, title: String, shortName: String, count: Int32, hash: Int32) + case stickerSet(flags: Int32, installedDate: Int32?, id: Int64, accessHash: Int64, title: String, shortName: String, count: Int32, hash: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .stickerSet(let flags, let id, let accessHash, let title, let shortName, let count, let hash): + case .stickerSet(let flags, let installedDate, let id, let accessHash, let title, let shortName, let count, let hash): if boxed { - buffer.appendInt32(-852477119) + buffer.appendInt32(1434820921) } serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(installedDate!, buffer: buffer, boxed: false)} serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) @@ -7950,27 +8294,30 @@ public struct Api { fileprivate static func parse_stickerSet(_ reader: BufferReader) -> StickerSet? { var _1: Int32? _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() + var _2: Int32? + if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() } var _3: Int64? _3 = reader.readInt64() - var _4: String? - _4 = parseString(reader) + var _4: Int64? + _4 = reader.readInt64() var _5: String? _5 = parseString(reader) - var _6: Int32? - _6 = reader.readInt32() + var _6: String? + _6 = parseString(reader) var _7: Int32? _7 = reader.readInt32() + var _8: Int32? + _8 = reader.readInt32() let _c1 = _1 != nil - let _c2 = _2 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _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.StickerSet.stickerSet(flags: _1!, id: _2!, accessHash: _3!, title: _4!, shortName: _5!, count: _6!, hash: _7!) + let _c8 = _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.StickerSet.stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, count: _7!, hash: _8!) } else { return nil @@ -8867,6 +9214,44 @@ public struct Api { } + public enum FeedPosition { + case feedPosition(date: Int32, peer: Api.Peer, id: Int32) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .feedPosition(let date, let peer, let id): + if boxed { + buffer.appendInt32(1348066419) + } + serializeInt32(date, buffer: buffer, boxed: false) + peer.serialize(buffer, true) + serializeInt32(id, buffer: buffer, boxed: false) + break + } + } + + fileprivate static func parse_feedPosition(_ reader: BufferReader) -> FeedPosition? { + 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.FeedPosition.feedPosition(date: _1!, peer: _2!, id: _3!) + } + else { + return nil + } + } + + } + public enum InputSingleMedia { case inputSingleMedia(media: Api.InputMedia, flags: Int32, randomId: Int64, message: String, entities: [Api.MessageEntity]?) @@ -14755,6 +15140,54 @@ public struct Api { } + public enum DialogPeer { + case dialogPeerFeed(feedId: Int32) + case dialogPeer(peer: Api.Peer) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .dialogPeerFeed(let feedId): + if boxed { + buffer.appendInt32(-633170927) + } + serializeInt32(feedId, buffer: buffer, boxed: false) + break + case .dialogPeer(let peer): + if boxed { + buffer.appendInt32(-445792507) + } + peer.serialize(buffer, true) + break + } + } + + fileprivate static func parse_dialogPeerFeed(_ reader: BufferReader) -> DialogPeer? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.DialogPeer.dialogPeerFeed(feedId: _1!) + } + else { + return nil + } + } + fileprivate static func parse_dialogPeer(_ reader: BufferReader) -> DialogPeer? { + var _1: Api.Peer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Peer + } + let _c1 = _1 != nil + if _c1 { + return Api.DialogPeer.dialogPeer(peer: _1!) + } + else { + return nil + } + } + + } + public enum ContactLink { case contactLinkUnknown case contactLinkNone @@ -15699,6 +16132,66 @@ public struct Api { } + public enum WebAuthorization { + case webAuthorization(hash: Int64, botId: Int32, domain: String, browser: String, platform: String, dateCreated: Int32, dateActive: Int32, ip: String, region: String) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .webAuthorization(let hash, let botId, let domain, let browser, let platform, let dateCreated, let dateActive, let ip, let region): + if boxed { + buffer.appendInt32(-892779534) + } + serializeInt64(hash, buffer: buffer, boxed: false) + serializeInt32(botId, buffer: buffer, boxed: false) + serializeString(domain, buffer: buffer, boxed: false) + serializeString(browser, buffer: buffer, boxed: false) + serializeString(platform, buffer: buffer, boxed: false) + serializeInt32(dateCreated, buffer: buffer, boxed: false) + serializeInt32(dateActive, buffer: buffer, boxed: false) + serializeString(ip, buffer: buffer, boxed: false) + serializeString(region, buffer: buffer, boxed: false) + break + } + } + + fileprivate static func parse_webAuthorization(_ reader: BufferReader) -> WebAuthorization? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() + var _3: String? + _3 = parseString(reader) + var _4: String? + _4 = parseString(reader) + var _5: String? + _5 = parseString(reader) + var _6: Int32? + _6 = reader.readInt32() + var _7: Int32? + _7 = reader.readInt32() + var _8: String? + _8 = parseString(reader) + var _9: String? + _9 = parseString(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 + let _c8 = _8 != nil + let _c9 = _9 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { + return Api.WebAuthorization.webAuthorization(hash: _1!, botId: _2!, domain: _3!, browser: _4!, platform: _5!, dateCreated: _6!, dateActive: _7!, ip: _8!, region: _9!) + } + else { + return nil + } + } + + } + public enum ImportedContact { case importedContact(userId: Int32, clientId: Int64) @@ -15830,6 +16323,78 @@ public struct Api { } + public enum FeedSources { + case feedSourcesNotModified + case feedSources(flags: Int32, newlyJoinedFeed: Int32?, feeds: [Api.FeedBroadcasts], chats: [Api.Chat], users: [Api.User]) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .feedSourcesNotModified: + if boxed { + buffer.appendInt32(-2001655273) + } + + break + case .feedSources(let flags, let newlyJoinedFeed, let feeds, let chats, let users): + if boxed { + buffer.appendInt32(-1903441347) + } + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(newlyJoinedFeed!, buffer: buffer, boxed: false)} + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(feeds.count)) + for item in feeds { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(chats.count)) + for item in chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(users.count)) + for item in users { + item.serialize(buffer, true) + } + break + } + } + + fileprivate static func parse_feedSourcesNotModified(_ reader: BufferReader) -> FeedSources? { + return Api.channels.FeedSources.feedSourcesNotModified + } + fileprivate static func parse_feedSources(_ reader: BufferReader) -> FeedSources? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() } + var _3: [Api.FeedBroadcasts]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.FeedBroadcasts.self) + } + var _4: [Api.Chat]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _5: [Api.User]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.channels.FeedSources.feedSources(flags: _1!, newlyJoinedFeed: _2, feeds: _3!, chats: _4!, users: _5!) + } + else { + return nil + } + } + + } + public enum AdminLogResults { case adminLogResults(events: [Api.ChannelAdminLogEvent], chats: [Api.Chat], users: [Api.User]) @@ -17896,6 +18461,50 @@ public struct Api { } + public enum WebAuthorizations { + case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User]) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .webAuthorizations(let authorizations, let users): + if boxed { + buffer.appendInt32(-313079300) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(authorizations.count)) + for item in authorizations { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(users.count)) + for item in users { + item.serialize(buffer, true) + } + break + } + } + + fileprivate static func parse_webAuthorizations(_ reader: BufferReader) -> WebAuthorizations? { + var _1: [Api.WebAuthorization]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebAuthorization.self) + } + var _2: [Api.User]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.account.WebAuthorizations.webAuthorizations(authorizations: _1!, users: _2!) + } + else { + return nil + } + } + + } + public enum Authorizations { case authorizations(authorizations: [Api.Authorization]) @@ -18229,24 +18838,6 @@ public struct Api { }) } - public static func getDialogs(flags: Int32, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Dialogs?) { - let buffer = Buffer() - buffer.appendInt32(421243333) - serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(offsetDate, buffer: buffer, boxed: false) - serializeInt32(offsetId, buffer: buffer, boxed: false) - offsetPeer.serialize(buffer, true) - serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getDialogs flags: \(flags), offsetDate: \(offsetDate), offsetId: \(offsetId), offsetPeer: \(offsetPeer), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Dialogs? in - let reader = BufferReader(buffer) - var result: Api.messages.Dialogs? - if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.messages.Dialogs - } - return result - }) - } - public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { let buffer = Buffer() buffer.appendInt32(-591691168) @@ -19162,24 +19753,6 @@ public struct Api { }) } - public static func getPeerDialogs(peers: [Api.InputPeer]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.PeerDialogs?) { - let buffer = Buffer() - buffer.appendInt32(764901049) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(peers.count)) - for item in peers { - item.serialize(buffer, true) - } - return (FunctionDescription({return "(messages.getPeerDialogs peers: \(peers))"}), buffer, { (buffer: Buffer) -> Api.messages.PeerDialogs? in - let reader = BufferReader(buffer) - var result: Api.messages.PeerDialogs? - if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.messages.PeerDialogs - } - return result - }) - } - public static func saveDraft(flags: Int32, replyToMsgId: Int32?, peer: Api.InputPeer, message: String, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { let buffer = Buffer() buffer.appendInt32(-1137057461) @@ -19452,40 +20025,6 @@ public struct Api { }) } - public static func toggleDialogPin(flags: Int32, peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { - let buffer = Buffer() - buffer.appendInt32(847887978) - serializeInt32(flags, buffer: buffer, boxed: false) - peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.toggleDialogPin flags: \(flags), peer: \(peer))"}), buffer, { (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 - }) - } - - public static func reorderPinnedDialogs(flags: Int32, order: [Api.InputPeer]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { - let buffer = Buffer() - buffer.appendInt32(-1784678844) - serializeInt32(flags, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(order.count)) - for item in order { - item.serialize(buffer, true) - } - return (FunctionDescription({return "(messages.reorderPinnedDialogs flags: \(flags), order: \(order))"}), buffer, { (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 - }) - } - public static func getPinnedDialogs() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.PeerDialogs?) { let buffer = Buffer() buffer.appendInt32(-497756594) @@ -19582,31 +20121,6 @@ public struct Api { }) } - public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { - let buffer = Buffer() - buffer.appendInt32(60726944) - serializeInt32(flags, buffer: buffer, boxed: false) - peer.serialize(buffer, true) - serializeString(q, buffer: buffer, boxed: false) - if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)} - filter.serialize(buffer, true) - serializeInt32(minDate, buffer: buffer, boxed: false) - serializeInt32(maxDate, buffer: buffer, boxed: false) - serializeInt32(offsetId, buffer: buffer, boxed: false) - serializeInt32(addOffset, buffer: buffer, boxed: false) - serializeInt32(limit, buffer: buffer, boxed: false) - serializeInt32(maxId, buffer: buffer, boxed: false) - serializeInt32(minId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.search flags: \(flags), peer: \(peer), q: \(q), fromId: \(String(describing: fromId)), filter: \(filter), minDate: \(minDate), maxDate: \(maxDate), offsetId: \(offsetId), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in - let reader = BufferReader(buffer) - var result: Api.messages.Messages? - if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.messages.Messages - } - return result - }) - } - public static func getUnreadMentions(peer: Api.InputPeer, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { let buffer = Buffer() buffer.appendInt32(1180140658) @@ -19657,21 +20171,6 @@ public struct Api { }) } - public static func getRecentLocations(peer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { - let buffer = Buffer() - buffer.appendInt32(613691874) - peer.serialize(buffer, true) - serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getRecentLocations peer: \(peer), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in - let reader = BufferReader(buffer) - var result: Api.messages.Messages? - if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.messages.Messages - } - return result - }) - } - public static func uploadMedia(peer: Api.InputPeer, media: Api.InputMedia) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.MessageMedia?) { let buffer = Buffer() buffer.appendInt32(1369162417) @@ -19793,6 +20292,135 @@ public struct Api { return result }) } + + public static func getDialogs(flags: Int32, feedId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Dialogs?) { + let buffer = Buffer() + buffer.appendInt32(96533218) + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 1) != 0 {serializeInt32(feedId!, buffer: buffer, boxed: false)} + serializeInt32(offsetDate, buffer: buffer, boxed: false) + serializeInt32(offsetId, buffer: buffer, boxed: false) + offsetPeer.serialize(buffer, true) + serializeInt32(limit, buffer: buffer, boxed: false) + return (FunctionDescription({return "(messages.getDialogs flags: \(flags), feedId: \(String(describing: feedId)), offsetDate: \(offsetDate), offsetId: \(offsetId), offsetPeer: \(offsetPeer), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Dialogs? in + let reader = BufferReader(buffer) + var result: Api.messages.Dialogs? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.Dialogs + } + return result + }) + } + + public static func toggleDialogPin(flags: Int32, peer: Api.InputDialogPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + let buffer = Buffer() + buffer.appendInt32(-1489903017) + serializeInt32(flags, buffer: buffer, boxed: false) + peer.serialize(buffer, true) + return (FunctionDescription({return "(messages.toggleDialogPin flags: \(flags), peer: \(peer))"}), buffer, { (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 + }) + } + + public static func reorderPinnedDialogs(flags: Int32, order: [Api.InputDialogPeer]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + let buffer = Buffer() + buffer.appendInt32(1532089919) + serializeInt32(flags, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(order.count)) + for item in order { + item.serialize(buffer, true) + } + return (FunctionDescription({return "(messages.reorderPinnedDialogs flags: \(flags), order: \(order))"}), buffer, { (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 + }) + } + + public static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.PeerDialogs?) { + let buffer = Buffer() + buffer.appendInt32(-462373635) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(peers.count)) + for item in peers { + item.serialize(buffer, true) + } + return (FunctionDescription({return "(messages.getPeerDialogs peers: \(peers))"}), buffer, { (buffer: Buffer) -> Api.messages.PeerDialogs? in + let reader = BufferReader(buffer) + var result: Api.messages.PeerDialogs? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.PeerDialogs + } + return result + }) + } + + public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + let buffer = Buffer() + buffer.appendInt32(-1144759543) + peer.serialize(buffer, true) + serializeInt32(limit, buffer: buffer, boxed: false) + serializeInt32(hash, buffer: buffer, boxed: false) + return (FunctionDescription({return "(messages.getRecentLocations peer: \(peer), limit: \(limit), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + let reader = BufferReader(buffer) + var result: Api.messages.Messages? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.Messages + } + return result + }) + } + + public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + let buffer = Buffer() + buffer.appendInt32(-2045448344) + serializeInt32(flags, buffer: buffer, boxed: false) + peer.serialize(buffer, true) + serializeString(q, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)} + filter.serialize(buffer, true) + serializeInt32(minDate, buffer: buffer, boxed: false) + serializeInt32(maxDate, buffer: buffer, boxed: false) + serializeInt32(offsetId, buffer: buffer, boxed: false) + serializeInt32(addOffset, buffer: buffer, boxed: false) + serializeInt32(limit, buffer: buffer, boxed: false) + serializeInt32(maxId, buffer: buffer, boxed: false) + serializeInt32(minId, buffer: buffer, boxed: false) + serializeInt32(hash, buffer: buffer, boxed: false) + return (FunctionDescription({return "(messages.search flags: \(flags), peer: \(peer), q: \(q), fromId: \(String(describing: fromId)), filter: \(filter), minDate: \(minDate), maxDate: \(maxDate), offsetId: \(offsetId), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + let reader = BufferReader(buffer) + var result: Api.messages.Messages? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.Messages + } + return result + }) + } + + public static func getStickers(flags: Int32, emoticon: String, hash: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Stickers?) { + let buffer = Buffer() + buffer.appendInt32(-2050272894) + serializeInt32(flags, buffer: buffer, boxed: false) + serializeString(emoticon, buffer: buffer, boxed: false) + serializeString(hash, buffer: buffer, boxed: false) + return (FunctionDescription({return "(messages.getStickers flags: \(flags), emoticon: \(emoticon), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Stickers? in + let reader = BufferReader(buffer) + var result: Api.messages.Stickers? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.Stickers + } + return result + }) + } } public struct channels { public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { @@ -20326,6 +20954,114 @@ public struct Api { return result }) } + + public static func getFeed(flags: Int32, feedId: Int32, offsetPosition: Api.FeedPosition?, addOffset: Int32, limit: Int32, maxPosition: Api.FeedPosition?, minPosition: Api.FeedPosition?, sourcesHash: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FeedMessages?) { + let buffer = Buffer() + buffer.appendInt32(403799538) + serializeInt32(flags, buffer: buffer, boxed: false) + serializeInt32(feedId, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {offsetPosition!.serialize(buffer, true)} + serializeInt32(addOffset, buffer: buffer, boxed: false) + serializeInt32(limit, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 1) != 0 {maxPosition!.serialize(buffer, true)} + if Int(flags) & Int(1 << 2) != 0 {minPosition!.serialize(buffer, true)} + serializeInt32(sourcesHash, buffer: buffer, boxed: false) + serializeInt32(hash, buffer: buffer, boxed: false) + return (FunctionDescription({return "(channels.getFeed flags: \(flags), feedId: \(feedId), offsetPosition: \(String(describing: offsetPosition)), addOffset: \(addOffset), limit: \(limit), maxPosition: \(String(describing: maxPosition)), minPosition: \(String(describing: minPosition)), sourcesHash: \(sourcesHash), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.FeedMessages? in + let reader = BufferReader(buffer) + var result: Api.messages.FeedMessages? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.FeedMessages + } + return result + }) + } + + public static func searchFeed(feedId: Int32, q: String, offsetDate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + let buffer = Buffer() + buffer.appendInt32(-2009967767) + serializeInt32(feedId, buffer: buffer, boxed: false) + serializeString(q, buffer: buffer, boxed: false) + serializeInt32(offsetDate, buffer: buffer, boxed: false) + offsetPeer.serialize(buffer, true) + serializeInt32(offsetId, buffer: buffer, boxed: false) + serializeInt32(limit, buffer: buffer, boxed: false) + return (FunctionDescription({return "(channels.searchFeed feedId: \(feedId), q: \(q), offsetDate: \(offsetDate), offsetPeer: \(offsetPeer), offsetId: \(offsetId), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + let reader = BufferReader(buffer) + var result: Api.messages.Messages? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.messages.Messages + } + return result + }) + } + + public static func getFeedSources(flags: Int32, feedId: Int32?, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.channels.FeedSources?) { + let buffer = Buffer() + buffer.appendInt32(-657579154) + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(feedId!, buffer: buffer, boxed: false)} + serializeInt32(hash, buffer: buffer, boxed: false) + return (FunctionDescription({return "(channels.getFeedSources flags: \(flags), feedId: \(String(describing: feedId)), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.channels.FeedSources? in + let reader = BufferReader(buffer) + var result: Api.channels.FeedSources? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.channels.FeedSources + } + return result + }) + } + + public static func changeFeedBroadcast(flags: Int32, channel: Api.InputChannel, feedId: Int32?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + let buffer = Buffer() + buffer.appendInt32(623413022) + serializeInt32(flags, buffer: buffer, boxed: false) + channel.serialize(buffer, true) + if Int(flags) & Int(1 << 0) != 0 {serializeInt32(feedId!, buffer: buffer, boxed: false)} + return (FunctionDescription({return "(channels.changeFeedBroadcast flags: \(flags), channel: \(channel), feedId: \(String(describing: feedId)))"}), buffer, { (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 + }) + } + + public static func setFeedBroadcasts(feedId: Int32, channels: [Api.InputChannel], alsoNewlyJoined: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + let buffer = Buffer() + buffer.appendInt32(2123479282) + serializeInt32(feedId, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(channels.count)) + for item in channels { + item.serialize(buffer, true) + } + alsoNewlyJoined.serialize(buffer, true) + return (FunctionDescription({return "(channels.setFeedBroadcasts feedId: \(feedId), channels: \(channels), alsoNewlyJoined: \(alsoNewlyJoined))"}), buffer, { (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 + }) + } + + public static func readFeed(feedId: Int32, maxPosition: Api.FeedPosition) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + let buffer = Buffer() + buffer.appendInt32(163774749) + serializeInt32(feedId, buffer: buffer, boxed: false) + maxPosition.serialize(buffer, true) + return (FunctionDescription({return "(channels.readFeed feedId: \(feedId), maxPosition: \(maxPosition))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + let reader = BufferReader(buffer) + var result: Api.Updates? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.Updates + } + return result + }) + } } public struct payments { public static func getPaymentForm(msgId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.payments.PaymentForm?) { @@ -21725,6 +22461,48 @@ public struct Api { return result }) } + + public static func getWebAuthorizations() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.WebAuthorizations?) { + let buffer = Buffer() + buffer.appendInt32(405695855) + + return (FunctionDescription({return "(account.getWebAuthorizations )"}), buffer, { (buffer: Buffer) -> Api.account.WebAuthorizations? in + let reader = BufferReader(buffer) + var result: Api.account.WebAuthorizations? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.account.WebAuthorizations + } + return result + }) + } + + public static func resetWebAuthorization(hash: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + let buffer = Buffer() + buffer.appendInt32(755087855) + serializeInt64(hash, buffer: buffer, boxed: false) + return (FunctionDescription({return "(account.resetWebAuthorization hash: \(hash))"}), buffer, { (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 + }) + } + + public static func resetWebAuthorizations() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + let buffer = Buffer() + buffer.appendInt32(1747789204) + + return (FunctionDescription({return "(account.resetWebAuthorizations )"}), buffer, { (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 + }) + } } public struct langpack { public static func getLangPack(langCode: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.LangPackDifference?) { diff --git a/TelegramCore/ApiGroupOrChannel.swift b/TelegramCore/ApiGroupOrChannel.swift index 03618ba6c1..2bdb6db61a 100644 --- a/TelegramCore/ApiGroupOrChannel.swift +++ b/TelegramCore/ApiGroupOrChannel.swift @@ -50,9 +50,7 @@ public func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], migrationReference: nil, creationDate: 0, version: 0) case let .chatForbidden(id, title): return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: id), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], migrationReference: nil, creationDate: 0, version: 0) - /*%layer76*/ - case let .channel(flags, id, accessHash, title, username, photo, date, version, restrictionReason, adminRights, bannedRights, _): - let feedId: Int32? = nil + case let .channel(flags, id, accessHash, title, username, photo, date, version, restrictionReason, adminRights, bannedRights, _, feedId): let participationStatus: TelegramChannelParticipationStatus if (flags & Int32(1 << 1)) != 0 { participationStatus = .kicked @@ -109,9 +107,7 @@ func mergeGroupOrChannel(lhs: Peer?, rhs: Api.Chat) -> Peer? { switch rhs { case .chat, .chatEmpty, .chatForbidden, .channelForbidden: return parseTelegramGroupOrChannel(chat: rhs) - /*%layer76*/ - case let .channel(flags, _, accessHash, title, username, photo, date, version, restrictionReason, adminRights, bannedRights, _): - let feedId: Int32? = nil + case let .channel(flags, _, accessHash, title, username, photo, date, version, restrictionReason, adminRights, bannedRights, _, feedId): if accessHash != nil && (flags & (1 << 12)) == 0 { return parseTelegramGroupOrChannel(chat: rhs) } else if let lhs = lhs as? TelegramChannel { diff --git a/TelegramCore/FetchChatList.swift b/TelegramCore/FetchChatList.swift index 97d219ee49..337b31237a 100644 --- a/TelegramCore/FetchChatList.swift +++ b/TelegramCore/FetchChatList.swift @@ -106,10 +106,9 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message], } notificationSettings[peerId] = TelegramPeerNotificationSettings(apiSettings: apiNotificationSettings) - /*%layer76*/ - /*case let .dialogFeed(_, _, _, feedId, _, _, _, _): + case let .dialogFeed(_, _, _, feedId, _, _, _, _): itemIds.append(.group(PeerGroupId(rawValue: feedId))) - referencedFeeds.insert(PeerGroupId(rawValue: feedId))*/ + referencedFeeds.insert(PeerGroupId(rawValue: feedId)) } } @@ -216,8 +215,7 @@ func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLo requestFeedId = groupId.rawValue flags |= 1 << 1 } - /*%layer76*/ - let requestChats = network.request(Api.functions.messages.getDialogs(flags: flags/*, feedId: requestFeedId*/, offsetDate: timestamp, offsetId: id, offsetPeer: peer, limit: 100)) + let requestChats = network.request(Api.functions.messages.getDialogs(flags: flags, feedId: requestFeedId, offsetDate: timestamp, offsetId: id, offsetPeer: peer, limit: 100)) |> retryRequest return combineLatest(requestChats, additionalPinnedChats) @@ -237,8 +235,7 @@ func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLo } var feedSignals: [Signal<(PeerGroupId, ParsedDialogs), NoError>] = [] - /*%layer76*/ - /*if case .general = location { + if case .general = location { for groupId in combinedReferencedFeeds { let flags: Int32 = 1 << 1 let requestFeed = network.request(Api.functions.messages.getDialogs(flags: flags, feedId: groupId.rawValue, offsetDate: 0, offsetId: 0, offsetPeer: .inputPeerEmpty, limit: 4)) @@ -250,7 +247,7 @@ func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLo } feedSignals.append(requestFeed) } - }*/ + } return combineLatest(feedSignals) |> map { feeds -> FetchedChatList in diff --git a/TelegramCore/GroupFeedPeers.swift b/TelegramCore/GroupFeedPeers.swift index 80a2bbc80f..34760222e2 100644 --- a/TelegramCore/GroupFeedPeers.swift +++ b/TelegramCore/GroupFeedPeers.swift @@ -8,9 +8,7 @@ import Foundation #endif public func availableGroupFeedPeers(postbox: Postbox, network: Network, groupId: PeerGroupId) -> Signal<[(Peer, Bool)], NoError> { - /*%layer76*/ - return .single([]) - /*return network.request(Api.functions.channels.getFeedSources(flags: 0, feedId: groupId.rawValue, hash: 0)) + return network.request(Api.functions.channels.getFeedSources(flags: 0, feedId: groupId.rawValue, hash: 0)) |> retryRequest |> mapToSignal { result -> Signal<[(Peer, Bool)], NoError> in return postbox.modify { modifier -> [(Peer, Bool)] in @@ -48,5 +46,5 @@ public func availableGroupFeedPeers(postbox: Postbox, network: Network, groupId: return peers } } - }*/ + } } diff --git a/TelegramCore/Holes.swift b/TelegramCore/Holes.swift index f4bf5e9055..018017d9d7 100644 --- a/TelegramCore/Holes.swift +++ b/TelegramCore/Holes.swift @@ -88,8 +88,7 @@ func fetchMessageHistoryHole(source: FetchMessageHistoryHoleSource, postbox: Pos default: assertionFailure() } - /*%layer76*/ - request = source.request(Api.functions.messages.getRecentLocations(peer: inputPeer, limit: Int32(selectedLimit)/*, hash: 0*/)) + request = source.request(Api.functions.messages.getRecentLocations(peer: inputPeer, limit: Int32(selectedLimit), hash: 0)) } else if let filter = messageFilterForTagMask(tagMask) { let offsetId: Int32 let addOffset: Int32 @@ -119,8 +118,7 @@ func fetchMessageHistoryHole(source: FetchMessageHistoryHoleSource, postbox: Pos maxId = Int32.max minId = 1 } - /*%layer76*/ - request = source.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: filter, minDate: 0, maxDate: hole.maxIndex.timestamp, offsetId: offsetId, addOffset: addOffset, limit: Int32(selectedLimit), maxId: maxId, minId: minId/*, hash: 0*/)) + request = source.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: filter, minDate: 0, maxDate: hole.maxIndex.timestamp, offsetId: offsetId, addOffset: addOffset, limit: Int32(selectedLimit), maxId: maxId, minId: minId, hash: 0)) } else { assertionFailure() request = .never() @@ -283,9 +281,7 @@ private func groupBoundaryPeer(_ peerId: PeerId, accountPeerId: PeerId) -> Api.P } func fetchGroupFeedHole(source: FetchMessageHistoryHoleSource, accountPeerId: PeerId, postbox: Postbox, groupId: PeerGroupId, minIndex: MessageIndex, maxIndex: MessageIndex, direction: MessageHistoryViewRelativeHoleDirection, limit: Int = 100) -> Signal { - /*%layer76*/ - return .never() - /*return postbox.modify { modifier -> (Peer?, Peer?) in + return postbox.modify { modifier -> (Peer?, Peer?) in return (modifier.getPeer(minIndex.id.peerId), modifier.getPeer(maxIndex.id.peerId)) } |> mapToSignal { lowerPeer, upperPeer in @@ -451,7 +447,7 @@ func fetchGroupFeedHole(source: FetchMessageHistoryHoleSource, accountPeerId: Pe } } } - return .complete()*/ + return .complete() } func fetchChatListHole(postbox: Postbox, network: Network, groupId: PeerGroupId?, hole: ChatListHole) -> Signal { @@ -510,8 +506,7 @@ func fetchCallListHole(network: Network, postbox: Postbox, holeIndex: MessageInd offset = single((holeIndex.timestamp, min(holeIndex.id.id, Int32.max - 1) + 1, Api.InputPeer.inputPeerEmpty), NoError.self) return offset |> mapToSignal { (timestamp, id, peer) -> Signal in - /*%layer76*/ - let searchResult = network.request(Api.functions.messages.search(flags: 0, peer: .inputPeerEmpty, q: "", fromId: nil, filter: .inputMessagesFilterPhoneCalls(flags: 0), minDate: 0, maxDate: holeIndex.timestamp, offsetId: 0, addOffset: 0, limit: limit, maxId: holeIndex.id.id, minId: 0/*, hash: 0*/)) + let searchResult = network.request(Api.functions.messages.search(flags: 0, peer: .inputPeerEmpty, q: "", fromId: nil, filter: .inputMessagesFilterPhoneCalls(flags: 0), minDate: 0, maxDate: holeIndex.timestamp, offsetId: 0, addOffset: 0, limit: limit, maxId: holeIndex.id.id, minId: 0, hash: 0)) |> retryRequest |> mapToSignal { result -> Signal in let messages: [Api.Message] diff --git a/TelegramCore/LoadedStickerPack.swift b/TelegramCore/LoadedStickerPack.swift index 49035481fd..5315529899 100644 --- a/TelegramCore/LoadedStickerPack.swift +++ b/TelegramCore/LoadedStickerPack.swift @@ -45,13 +45,12 @@ func remoteStickerPack(network: Network, reference: StickerPackReference) -> Sig case let .stickerSet(set, packs, documents): let namespace: ItemCollectionId.Namespace switch set { - /*%layer76*/ - case let .stickerSet(flags, _, _, _, _, _, _): - if (flags & (1 << 3)) != 0 { - namespace = Namespaces.ItemCollection.CloudMaskPacks - } else { - namespace = Namespaces.ItemCollection.CloudStickerPacks - } + case let .stickerSet(flags, _, _, _, _, _, _, _): + if (flags & (1 << 3)) != 0 { + namespace = Namespaces.ItemCollection.CloudMaskPacks + } else { + namespace = Namespaces.ItemCollection.CloudStickerPacks + } } info = StickerPackCollectionInfo(apiSet: set, namespace: namespace) var indexKeysByFile: [MediaId: [MemoryBuffer]] = [:] diff --git a/TelegramCore/ManagedConsumePersonalMessagesActions.swift b/TelegramCore/ManagedConsumePersonalMessagesActions.swift index 2cb4d1883d..a4765a0494 100644 --- a/TelegramCore/ManagedConsumePersonalMessagesActions.swift +++ b/TelegramCore/ManagedConsumePersonalMessagesActions.swift @@ -226,9 +226,7 @@ private func synchronizeConsumeMessageContents(modifier: Modifier, postbox: Post private func synchronizeUnseenPersonalMentionsTag(postbox: Postbox, network: Network, entry: InvalidatedMessageHistoryTagsSummaryEntry) -> Signal { return postbox.modify { modifier -> Signal in if let peer = modifier.getPeer(entry.key.peerId), let inputPeer = apiInputPeer(peer) { - /*%layer76*/ - //return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)])) - return network.request(Api.functions.messages.getPeerDialogs(peers: [inputPeer])) + return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)])) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) @@ -244,10 +242,9 @@ private func synchronizeUnseenPersonalMentionsTag(postbox: Postbox, network: Net case let .dialog(_, _, topMessage, _, _, _, unreadMentionsCount, _, _, _): apiTopMessage = topMessage apiUnreadMentionsCount = unreadMentionsCount - /*%layer76*/ - /*case .dialogFeed: + case .dialogFeed: assertionFailure() - return .complete()*/ + return .complete() } return postbox.modify { modifier -> Void in diff --git a/TelegramCore/ManagedGroupFeedReadStateSyncOperations.swift b/TelegramCore/ManagedGroupFeedReadStateSyncOperations.swift index 68e4ab0289..1143dc9882 100644 --- a/TelegramCore/ManagedGroupFeedReadStateSyncOperations.swift +++ b/TelegramCore/ManagedGroupFeedReadStateSyncOperations.swift @@ -94,9 +94,7 @@ func managedGroupFeedReadStateSyncOperations(postbox: Postbox, network: Network, } private func fetchReadStateNext(network: Network, groupId: PeerGroupId) -> Signal { - /*%layer76*/ - return .single(nil) - /*return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeerFeed(feedId: groupId.rawValue)])) + return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeerFeed(feedId: groupId.rawValue)])) |> retryRequest |> map { result -> GroupFeedReadState? in switch result { @@ -122,13 +120,11 @@ private func fetchReadStateNext(network: Network, groupId: PeerGroupId) -> Signa } return nil } - }*/ + } } private func fetchReadState(network: Network, groupId: PeerGroupId) -> Signal { - /*%layer76*/ - return .single(nil) - /*return network.request(Api.functions.channels.getFeed(flags: 0, feedId: groupId.rawValue, offsetPosition: nil, addOffset: 0, limit: 1, maxPosition: nil, minPosition: nil, sourcesHash: 0, hash: 0)) + return network.request(Api.functions.channels.getFeed(flags: 0, feedId: groupId.rawValue, offsetPosition: nil, addOffset: 0, limit: 1, maxPosition: nil, minPosition: nil, sourcesHash: 0, hash: 0)) |> retryRequest |> map { result -> GroupFeedReadState? in switch result { @@ -157,7 +153,7 @@ private func fetchReadState(network: Network, groupId: PeerGroupId) -> Signal Api.Peer { @@ -174,16 +170,14 @@ private func groupBoundaryPeer(_ peerId: PeerId, accountPeerId: PeerId) -> Api.P } private func pushReadState(network: Network, accountPeerId: PeerId, groupId: PeerGroupId, state: GroupFeedReadState) -> Signal { - /*%layer76*/ - return .single(nil) - /*let position: Api.FeedPosition = .feedPosition(date: state.maxReadIndex.timestamp, peer: groupBoundaryPeer(state.maxReadIndex.id.peerId, accountPeerId: accountPeerId), id: state.maxReadIndex.id.id) + let position: Api.FeedPosition = .feedPosition(date: state.maxReadIndex.timestamp, peer: groupBoundaryPeer(state.maxReadIndex.id.peerId, accountPeerId: accountPeerId), id: state.maxReadIndex.id.id) if GlobalTelegramCoreConfiguration.readMessages { return network.request(Api.functions.channels.readFeed(feedId: groupId.rawValue, maxPosition: position)) |> retryRequest |> map(Optional.init) } else { return .single(nil) - }*/ + } } private func performSyncOperation(postbox: Postbox, network: Network, accountPeerId: PeerId, stateManager: AccountStateManager, groupId: PeerGroupId, operation: GroupFeedReadStateSyncOperation) -> Signal { diff --git a/TelegramCore/ManagedRecentStickers.swift b/TelegramCore/ManagedRecentStickers.swift index 587e4127cc..135809407e 100644 --- a/TelegramCore/ManagedRecentStickers.swift +++ b/TelegramCore/ManagedRecentStickers.swift @@ -49,8 +49,7 @@ func managedRecentStickers(postbox: Postbox, network: Network) -> Signal Int32 { } private func synchronizeGroupedPeers(modifier: Modifier, postbox: Postbox, network: Network, operation: SynchronizeGroupedPeersOperation) -> Signal { - /*%layer76*/ - return .complete() - /*let initialRemotePeerIds = operation.initialPeerIds + let initialRemotePeerIds = operation.initialPeerIds let localPeerIds = modifier.getPeerIdsInGroup(operation.groupId) return network.request(Api.functions.channels.getFeedSources(flags: 1 << 0, feedId: operation.groupId.rawValue, hash: hashForIds(localPeerIds.map({ $0.id }).sorted()))) @@ -208,6 +206,6 @@ private func synchronizeGroupedPeers(modifier: Modifier, postbox: Postbox, netwo } } |> switchToLatest } - }*/ + } } diff --git a/TelegramCore/ManagedSynchronizePinnedChatsOperations.swift b/TelegramCore/ManagedSynchronizePinnedChatsOperations.swift index 5ffde20063..a548513889 100644 --- a/TelegramCore/ManagedSynchronizePinnedChatsOperations.swift +++ b/TelegramCore/ManagedSynchronizePinnedChatsOperations.swift @@ -185,10 +185,9 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ apiUnreadCount = unreadCount apiNotificationSettings = peerNotificationSettings apiChannelPts = pts - /*%layer76*/ - /*case let .dialogFeed(_, _, _, feedId, _, _, _, _): + case let .dialogFeed(_, _, _, feedId, _, _, _, _): remoteItemIds.append(.group(PeerGroupId(rawValue: feedId))) - continue loop*/ + continue loop } let peerId: PeerId @@ -264,8 +263,7 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ if remoteItemIds == resultingItemIds { return .complete() } else { - /*%layer76*/ - /*var inputDialogPeers: [Api.InputDialogPeer] = [] + var inputDialogPeers: [Api.InputDialogPeer] = [] for itemId in resultingItemIds { switch itemId { case let .peer(peerId): @@ -275,17 +273,6 @@ private func synchronizePinnedChats(modifier: Modifier, postbox: Postbox, networ case let .group(groupId): inputDialogPeers.append(.inputDialogPeerFeed(feedId: groupId.rawValue)) } - }*/ - var inputDialogPeers: [Api.InputPeer] = [] - for itemId in resultingItemIds { - switch itemId { - case let .peer(peerId): - if let peer = modifier.getPeer(peerId), let inputPeer = apiInputPeer(peer) { - inputDialogPeers.append(inputPeer) - } - case .group: - break - } } return network.request(Api.functions.messages.reorderPinnedDialogs(flags: 1 << 0, order: inputDialogPeers)) diff --git a/TelegramCore/RequestUserPhotos.swift b/TelegramCore/RequestUserPhotos.swift index 376c2f7be4..1632000afb 100644 --- a/TelegramCore/RequestUserPhotos.swift +++ b/TelegramCore/RequestUserPhotos.swift @@ -64,8 +64,7 @@ public func requestPeerPhotos(account:Account, peerId:PeerId) -> Signal<[Telegra } } } else if let peer = peer, let inputPeer = apiInputPeer(peer) { - /*%layer76*/ - return account.network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: .inputMessagesFilterChatPhotos, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1000, maxId: 0, minId: 0/*, hash: 0*/)) |> map {Optional($0)} + return account.network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, filter: .inputMessagesFilterChatPhotos, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1000, maxId: 0, minId: 0, hash: 0)) |> map {Optional($0)} |> mapError {_ in} |> `catch` { return Signal.single(nil) diff --git a/TelegramCore/SearchMessages.swift b/TelegramCore/SearchMessages.swift index 1ef76563ad..a0029d9eaa 100644 --- a/TelegramCore/SearchMessages.swift +++ b/TelegramCore/SearchMessages.swift @@ -79,8 +79,7 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q flags |= (1 << 0) } } - /*%layer76*/ - return account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputUser, filter: filter, minDate: 0, maxDate: Int32.max - 1, offsetId: 0, addOffset: 0, limit: 100, maxId: Int32.max - 1, minId: 0/*, hash: 0*/)) + return account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputUser, filter: filter, minDate: 0, maxDate: Int32.max - 1, offsetId: 0, addOffset: 0, limit: 100, maxId: Int32.max - 1, minId: 0, hash: 0)) |> map {Optional($0)} |> `catch` { _ -> Signal in return .single(nil) @@ -90,10 +89,8 @@ public func searchMessages(account: Account, location: SearchMessagesLocation, q } } case let .group(groupId): - /*%layer76*/ - remoteSearchResult = .single(nil) - /*remoteSearchResult = account.network.request(Api.functions.channels.searchFeed(feedId: groupId.rawValue, q: query, offsetDate: 0, offsetPeer: Api.InputPeer.inputPeerEmpty, offsetId: 0, limit: 64)) - |> mapError { _ in } |> map(Optional.init)*/ + remoteSearchResult = account.network.request(Api.functions.channels.searchFeed(feedId: groupId.rawValue, q: query, offsetDate: 0, offsetPeer: Api.InputPeer.inputPeerEmpty, offsetId: 0, limit: 64)) + |> mapError { _ in } |> map(Optional.init) case .general: remoteSearchResult = account.network.request(Api.functions.messages.searchGlobal(q: query, offsetDate: 0, offsetPeer: Api.InputPeer.inputPeerEmpty, offsetId: 0, limit: 64)) |> mapError { _ in } |> map(Optional.init) diff --git a/TelegramCore/SearchPeers.swift b/TelegramCore/SearchPeers.swift index 0cec071b0f..783da91cbb 100644 --- a/TelegramCore/SearchPeers.swift +++ b/TelegramCore/SearchPeers.swift @@ -47,8 +47,7 @@ public func searchPeers(account: Account, query: String) -> Signal<([FoundPeer], if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) { peers[groupOrChannel.id] = groupOrChannel switch chat { - /*%layer76*/ - case let .channel(_, _, _, _, _, _, _, _, _, _, _, participantsCount): + case let .channel(_, _, _, _, _, _, _, _, _, _, _, participantsCount, _): if let participantsCount = participantsCount { subscribers[groupOrChannel.id] = participantsCount } diff --git a/TelegramCore/Serialization.swift b/TelegramCore/Serialization.swift index ce0ac83adc..35146f1eb5 100644 --- a/TelegramCore/Serialization.swift +++ b/TelegramCore/Serialization.swift @@ -20,7 +20,7 @@ public class BoxedMessage: NSObject { public class Serialization: NSObject, MTSerialization { public func currentLayer() -> UInt { - return 75 + return 76 } public func parseMessage(_ data: Data!) -> Any! { diff --git a/TelegramCore/StickerPack.swift b/TelegramCore/StickerPack.swift index eb06d87b0e..c3afc014eb 100644 --- a/TelegramCore/StickerPack.swift +++ b/TelegramCore/StickerPack.swift @@ -148,8 +148,7 @@ public final class StickerPackItem: ItemCollectionItem, Equatable { extension StickerPackCollectionInfo { convenience init(apiSet: Api.StickerSet, namespace: ItemCollectionId.Namespace) { switch apiSet { - /*%layer76*/ - case let .stickerSet(flags/*, _*/, id, accessHash, title, shortName, count, nHash): + case let .stickerSet(flags, _, id, accessHash, title, shortName, count, nHash): var setFlags: StickerPackCollectionInfoFlags = StickerPackCollectionInfoFlags() if (flags & (1 << 2)) != 0 { setFlags.insert(.official) diff --git a/TelegramCore/SynchronizePeerReadState.swift b/TelegramCore/SynchronizePeerReadState.swift index 6ce3043e2a..bf6657f340 100644 --- a/TelegramCore/SynchronizePeerReadState.swift +++ b/TelegramCore/SynchronizePeerReadState.swift @@ -66,9 +66,7 @@ private func dialogTopMessage(network: Network, postbox: Postbox, peerId: PeerId } func fetchPeerCloudReadState(network: Network, postbox: Postbox, peerId: PeerId, inputPeer: Api.InputPeer) -> Signal { - /*%layer76*/ - //return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)])) - return network.request(Api.functions.messages.getPeerDialogs(peers: [inputPeer])) + return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)])) |> map { result -> PeerReadState? in switch result { case let .peerDialogs(dialogs, _, _, _, _): @@ -83,10 +81,9 @@ func fetchPeerCloudReadState(network: Network, postbox: Postbox, peerId: PeerId, apiReadInboxMaxId = readInboxMaxId apiReadOutboxMaxId = readOutboxMaxId apiUnreadCount = unreadCount - /*%layer76*/ - /*case .dialogFeed: + case .dialogFeed: assertionFailure() - return nil*/ + return nil } return .idBased(maxIncomingReadId: apiReadInboxMaxId, maxOutgoingReadId: apiReadOutboxMaxId, maxKnownId: apiTopMessage, count: apiUnreadCount) @@ -105,9 +102,7 @@ private func dialogReadState(network: Network, postbox: Postbox, peerId: PeerId) |> mapToSignal { topMessage -> Signal<(PeerReadState, PeerReadStateMarker), VerifyReadStateError> in return inputPeer(postbox: postbox, peerId: peerId) |> mapToSignal { inputPeer -> Signal<(PeerReadState, PeerReadStateMarker), VerifyReadStateError> in - /*%layer76*/ - //return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)])) - return network.request(Api.functions.messages.getPeerDialogs(peers: [inputPeer])) + return network.request(Api.functions.messages.getPeerDialogs(peers: [.inputDialogPeer(peer: inputPeer)])) |> retryRequest |> mapToSignalPromotingError { result -> Signal<(PeerReadState, PeerReadStateMarker), VerifyReadStateError> in switch result { @@ -127,10 +122,9 @@ private func dialogReadState(network: Network, postbox: Postbox, peerId: PeerId) if let pts = pts { apiChannelPts = pts } - /*%layer76*/ - /*case .dialogFeed: + case .dialogFeed: assertionFailure() - return .fail(.Abort)*/ + return .fail(.Abort) } let marker: PeerReadStateMarker diff --git a/TelegramCore/UpdateCachedPeerData.swift b/TelegramCore/UpdateCachedPeerData.swift index af4d1dcd5e..81782fa21e 100644 --- a/TelegramCore/UpdateCachedPeerData.swift +++ b/TelegramCore/UpdateCachedPeerData.swift @@ -291,8 +291,7 @@ func fetchAndUpdateCachedPeerData(peerId: PeerId, network: Network, postbox: Pos let stickerPack: StickerPackCollectionInfo? = stickerSet.flatMap { apiSet -> StickerPackCollectionInfo in let namespace: ItemCollectionId.Namespace switch apiSet { - /*%layer76*/ - case let .stickerSet(flags, _, _, _, _, _, _): + case let .stickerSet(flags, _, _, _, _, _, _, _): if (flags & (1 << 3)) != 0 { namespace = Namespaces.ItemCollection.CloudMaskPacks } else { diff --git a/TelegramCore/UpdatesApiUtils.swift b/TelegramCore/UpdatesApiUtils.swift index 59cc3edc1c..bda93aa795 100644 --- a/TelegramCore/UpdatesApiUtils.swift +++ b/TelegramCore/UpdatesApiUtils.swift @@ -122,8 +122,7 @@ extension Api.Chat { return PeerId(namespace: Namespaces.Peer.CloudGroup, id: id) case let .chatForbidden(id, _): return PeerId(namespace: Namespaces.Peer.CloudGroup, id: id) - /*%layer76*/ - case let .channel(_, id, _, _, _, _, _, _, _, _, _, _): + case let .channel(_, id, _, _, _, _, _, _, _, _, _, _, _): return PeerId(namespace: Namespaces.Peer.CloudChannel, id: id) case let .channelForbidden(_, id, _, _, _): return PeerId(namespace: Namespaces.Peer.CloudChannel, id: id) @@ -160,9 +159,8 @@ extension Api.Dialog { switch self { case let .dialog(_, peer, _, _, _, _, _, _, _, _): return peer.peerId - /*%layer76*/ - /*case .dialogFeed: - return nil*/ + case .dialogFeed: + return nil } } }