diff --git a/.bazelrc b/.bazelrc index c695ce1357..c4cde87693 100644 --- a/.bazelrc +++ b/.bazelrc @@ -16,4 +16,4 @@ build --strategy=Genrule=standalone build --spawn_strategy=standalone build --strategy=SwiftCompile=standalone -build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1 \ No newline at end of file +build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1 diff --git a/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m b/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m index eef89382ce..5352a36622 100644 --- a/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m +++ b/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m @@ -3,7 +3,7 @@ @implementation Serialization - (NSUInteger)currentLayer { - return 132; + return 133; } - (id _Nullable)parseMessage:(NSData * _Nullable)data { @@ -16,7 +16,7 @@ }; } -- (NSData * _Nonnull)importAuthorization:(int32_t)authId bytes:(NSData * _Nonnull)bytes { +- (NSData * _Nonnull)importAuthorization:(int64_t)authId bytes:(NSData * _Nonnull)bytes { return [NSData data]; } diff --git a/Telegram/SiriIntents/IntentContacts.swift b/Telegram/SiriIntents/IntentContacts.swift index a1c0baab37..dc338bef52 100644 --- a/Telegram/SiriIntents/IntentContacts.swift +++ b/Telegram/SiriIntents/IntentContacts.swift @@ -33,8 +33,8 @@ private func parseAppSpecificContactReference(_ value: String) -> PeerId? { return nil } let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...]) - if let id = Int32(idString) { - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + if let id = Int64(idString) { + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) } return nil } diff --git a/Telegram/SiriIntents/IntentMessages.swift b/Telegram/SiriIntents/IntentMessages.swift index 4e925f0c2f..fc3287b7ae 100644 --- a/Telegram/SiriIntents/IntentMessages.swift +++ b/Telegram/SiriIntents/IntentMessages.swift @@ -165,7 +165,7 @@ private func callWithTelegramMessage(_ telegramMessage: Message, account: Accoun @available(iOSApplicationExtension 10.0, iOS 10.0, *) private func messageWithTelegramMessage(_ telegramMessage: Message) -> INMessage? { - guard let author = telegramMessage.author, let user = telegramMessage.peers[author.id] as? TelegramUser, user.id.id._internalGetInt32Value() != 777000 else { + guard let author = telegramMessage.author, let user = telegramMessage.peers[author.id] as? TelegramUser, user.id.id._internalGetInt64Value() != 777000 else { return nil } diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 236b64105b..799d68451e 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -6793,3 +6793,6 @@ Sorry for the inconvenience."; "Gif.Emotion.Party" = "Party"; "Conversation.ForwardFrom" = "From: %@"; + +"Conversation.ContextMenuSeen_1" = "1 Seen"; +"Conversation.ContextMenuSeen_any" = "%@ Seen"; diff --git a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h index 45225a04f6..cdea027feb 100644 --- a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h +++ b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h @@ -3,7 +3,7 @@ @interface TGBridgeContext : NSObject @property (nonatomic, readonly) bool authorized; -@property (nonatomic, readonly) int32_t userId; +@property (nonatomic, readonly) int64_t userId; @property (nonatomic, readonly) bool micAccessAllowed; @property (nonatomic, readonly) NSDictionary *preheatData; @property (nonatomic, readonly) NSInteger preheatVersion; diff --git a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m index 4b0600e2fc..df70505a06 100644 --- a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m +++ b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m @@ -40,7 +40,7 @@ NSString *const TGBridgeContextStartupDataVersion = @"version"; return dictionary; } -- (TGBridgeContext *)updatedWithAuthorized:(bool)authorized peerId:(int32_t)peerId +- (TGBridgeContext *)updatedWithAuthorized:(bool)authorized peerId:(int64_t)peerId { TGBridgeContext *context = [[TGBridgeContext alloc] init]; context->_authorized = authorized; diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 7d2a8ea525..86267a434e 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -503,7 +503,7 @@ public enum ChatListSearchFilter: Equatable { case peer(PeerId, Bool, String, String) case date(Int32?, Int32, String) - public var id: Int32 { + public var id: Int64 { switch self { case .chats: return 0 @@ -518,9 +518,9 @@ public enum ChatListSearchFilter: Equatable { case .voice: return 5 case let .peer(peerId, _, _, _): - return peerId.id._internalGetInt32Value() + return peerId.id._internalGetInt64Value() case let .date(_, date, _): - return date + return Int64(date) } } } diff --git a/submodules/AccountContext/Sources/DeviceContactData.swift b/submodules/AccountContext/Sources/DeviceContactData.swift index d9351befda..fe5aca7de9 100644 --- a/submodules/AccountContext/Sources/DeviceContactData.swift +++ b/submodules/AccountContext/Sources/DeviceContactData.swift @@ -200,8 +200,8 @@ public func parseAppSpecificContactReference(_ value: String) -> PeerId? { return nil } let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...]) - if let id = Int32(idString) { - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + if let id = Int64(idString) { + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) } return nil } diff --git a/submodules/AnimatedAvatarSetNode/Sources/AnimatedAvatarSetNode.swift b/submodules/AnimatedAvatarSetNode/Sources/AnimatedAvatarSetNode.swift index fcf565bc4b..a4d269394a 100644 --- a/submodules/AnimatedAvatarSetNode/Sources/AnimatedAvatarSetNode.swift +++ b/submodules/AnimatedAvatarSetNode/Sources/AnimatedAvatarSetNode.swift @@ -11,14 +11,17 @@ import AudioBlob public final class AnimatedAvatarSetContext { public final class Content { fileprivate final class Item { - fileprivate struct Key: Hashable { - var peerId: EnginePeer.Id + fileprivate enum Key: Hashable { + case peer(EnginePeer.Id) + case placeholder(Int) } - fileprivate let peer: EnginePeer + fileprivate let peer: EnginePeer? + fileprivate let placeholderColor: UIColor - fileprivate init(peer: EnginePeer) { + fileprivate init(peer: EnginePeer?, placeholderColor: UIColor) { self.peer = peer + self.placeholderColor = placeholderColor } } @@ -46,7 +49,15 @@ public final class AnimatedAvatarSetContext { public func update(peers: [EnginePeer], animated: Bool) -> Content { var items: [(Content.Item.Key, Content.Item)] = [] for peer in peers { - items.append((Content.Item.Key(peerId: peer.id), Content.Item(peer: peer))) + items.append((.peer(peer.id), Content.Item(peer: peer, placeholderColor: .white))) + } + return Content(items: items) + } + + public func updatePlaceholder(color: UIColor, count: Int, animated: Bool) -> Content { + var items: [(Content.Item.Key, Content.Item)] = [] + for i in 0 ..< count { + items.append((.placeholder(i), Content.Item(peer: nil, placeholderColor: color))) } return Content(items: items) } @@ -59,10 +70,16 @@ private final class ContentNode: ASDisplayNode { private var audioLevelBlobOverlay: UIImageView? private let unclippedNode: ASImageNode private let clippedNode: ASImageNode + + private var size: CGSize + private var spacing: CGFloat private var disposable: Disposable? - init(context: AccountContext, peer: EnginePeer, synchronousLoad: Bool) { + init(context: AccountContext, peer: EnginePeer?, placeholderColor: UIColor, synchronousLoad: Bool, size: CGSize, spacing: CGFloat) { + self.size = size + self.spacing = spacing + self.unclippedNode = ASImageNode() self.clippedNode = ASImageNode() @@ -70,38 +87,47 @@ private final class ContentNode: ASDisplayNode { self.addSubnode(self.unclippedNode) self.addSubnode(self.clippedNode) - - if let representation = peer.smallProfileImage, let signal = peerAvatarImage(account: context.account, peerReference: PeerReference(peer._asPeer()), authorOfMessage: nil, representation: representation, displayDimensions: CGSize(width: 30.0, height: 30.0), synchronousLoad: synchronousLoad) { - let image = generateImage(CGSize(width: 30.0, height: 30.0), rotatedContext: { size, context in + + if let peer = peer { + if let representation = peer.smallProfileImage, let signal = peerAvatarImage(account: context.account, peerReference: PeerReference(peer._asPeer()), authorOfMessage: nil, representation: representation, displayDimensions: size, synchronousLoad: synchronousLoad) { + let image = generateImage(size, rotatedContext: { size, context in + context.clear(CGRect(origin: CGPoint(), size: size)) + context.setFillColor(UIColor.lightGray.cgColor) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) + })! + self.updateImage(image: image, size: size, spacing: spacing) + + let disposable = (signal + |> deliverOnMainQueue).start(next: { [weak self] imageVersions in + guard let strongSelf = self else { + return + } + let image = imageVersions?.0 + if let image = image { + strongSelf.updateImage(image: image, size: size, spacing: spacing) + } + }) + self.disposable = disposable + } else { + let image = generateImage(size, rotatedContext: { size, context in + context.clear(CGRect(origin: CGPoint(), size: size)) + drawPeerAvatarLetters(context: context, size: size, font: avatarFont, letters: peer.displayLetters, peerId: peer.id) + })! + self.updateImage(image: image, size: size, spacing: spacing) + } + } else { + let image = generateImage(size, rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) - context.setFillColor(UIColor.lightGray.cgColor) + context.setFillColor(placeholderColor.cgColor) context.fillEllipse(in: CGRect(origin: CGPoint(), size: size)) })! - self.updateImage(image: image) - - let disposable = (signal - |> deliverOnMainQueue).start(next: { [weak self] imageVersions in - guard let strongSelf = self else { - return - } - let image = imageVersions?.0 - if let image = image { - strongSelf.updateImage(image: image) - } - }) - self.disposable = disposable - } else { - let image = generateImage(CGSize(width: 30.0, height: 30.0), rotatedContext: { size, context in - context.clear(CGRect(origin: CGPoint(), size: size)) - drawPeerAvatarLetters(context: context, size: size, font: avatarFont, letters: peer.displayLetters, peerId: peer.id) - })! - self.updateImage(image: image) + self.updateImage(image: image, size: size, spacing: spacing) } } - private func updateImage(image: UIImage) { + private func updateImage(image: UIImage, size: CGSize, spacing: CGFloat) { self.unclippedNode.image = image - self.clippedNode.image = generateImage(CGSize(width: 30.0, height: 30.0), rotatedContext: { size, context in + self.clippedNode.image = generateImage(size, rotatedContext: { size, context in context.clear(CGRect(origin: CGPoint(), size: size)) context.translateBy(x: size.width / 2.0, y: size.height / 2.0) context.scaleBy(x: 1.0, y: -1.0) @@ -113,7 +139,7 @@ private final class ContentNode: ASDisplayNode { context.setBlendMode(.copy) context.setFillColor(UIColor.clear.cgColor) - context.fillEllipse(in: CGRect(origin: CGPoint(), size: size).insetBy(dx: -1.5, dy: -1.5).offsetBy(dx: -20.0, dy: 0.0)) + context.fillEllipse(in: CGRect(origin: CGPoint(), size: size).insetBy(dx: -1.5, dy: -1.5).offsetBy(dx: spacing - size.width, dy: 0.0)) }) } @@ -192,9 +218,16 @@ public final class AnimatedAvatarSetNode: ASDisplayNode { super.init() } - public func update(context: AccountContext, content: AnimatedAvatarSetContext.Content, itemSize: CGSize = CGSize(width: 30.0, height: 30.0), animated: Bool, synchronousLoad: Bool) -> CGSize { + public func update(context: AccountContext, content: AnimatedAvatarSetContext.Content, itemSize: CGSize = CGSize(width: 30.0, height: 30.0), customSpacing: CGFloat? = nil, animated: Bool, synchronousLoad: Bool) -> CGSize { var contentWidth: CGFloat = 0.0 let contentHeight: CGFloat = itemSize.height + + let spacing: CGFloat + if let customSpacing = customSpacing { + spacing = customSpacing + } else { + spacing = 10.0 + } let transition: ContainedViewLayoutTransition if animated { @@ -218,7 +251,7 @@ public final class AnimatedAvatarSetNode: ASDisplayNode { itemNode.updateLayout(size: itemSize, isClipped: index != 0, animated: animated) transition.updateFrame(node: itemNode, frame: itemFrame) } else { - itemNode = ContentNode(context: context, peer: item.peer, synchronousLoad: synchronousLoad) + itemNode = ContentNode(context: context, peer: item.peer, placeholderColor: item.placeholderColor, synchronousLoad: synchronousLoad, size: itemSize, spacing: spacing) self.addSubnode(itemNode) self.contentNodes[key] = itemNode itemNode.updateLayout(size: itemSize, isClipped: index != 0, animated: false) @@ -229,7 +262,7 @@ public final class AnimatedAvatarSetNode: ASDisplayNode { } } itemNode.zPosition = CGFloat(100 - i) - contentWidth += itemSize.width - 10.0 + contentWidth += itemSize.width - spacing index += 1 } var removeKeys: [AnimatedAvatarSetContext.Content.Item.Key] = [] @@ -253,7 +286,7 @@ public final class AnimatedAvatarSetNode: ASDisplayNode { public func updateAudioLevels(color: UIColor, backgroundColor: UIColor, levels: [EnginePeer.Id: Float]) { for (key, itemNode) in self.contentNodes { - if let value = levels[key.peerId] { + if case let .peer(peerId) = key, let value = levels[peerId] { itemNode.updateAudioLevel(color: color, backgroundColor: backgroundColor, value: value) } else { itemNode.updateAudioLevel(color: color, backgroundColor: backgroundColor, value: 0.0) diff --git a/submodules/AvatarNode/Sources/AvatarNode.swift b/submodules/AvatarNode/Sources/AvatarNode.swift index c0cfad6ed2..38608a14e7 100644 --- a/submodules/AvatarNode/Sources/AvatarNode.swift +++ b/submodules/AvatarNode/Sources/AvatarNode.swift @@ -454,7 +454,7 @@ public final class AvatarNode: ASDisplayNode { if peerId.namespace == .max { colorIndex = -1 } else { - colorIndex = abs(Int(clamping: peerId.id._internalGetInt32Value())) + colorIndex = abs(Int(clamping: peerId.id._internalGetInt64Value())) } } else { colorIndex = -1 @@ -633,7 +633,7 @@ public func drawPeerAvatarLetters(context: CGContext, size: CGSize, round: Bool if peerId.namespace == .max { colorIndex = -1 } else { - colorIndex = Int(abs(peerId.id._internalGetInt32Value())) + colorIndex = Int(clamping: abs(peerId.id._internalGetInt64Value())) } let colorsArray: NSArray diff --git a/submodules/ChatListUI/Sources/ChatContextMenus.swift b/submodules/ChatListUI/Sources/ChatContextMenus.swift index 7fb0f8adc7..52f12478f7 100644 --- a/submodules/ChatListUI/Sources/ChatContextMenus.swift +++ b/submodules/ChatListUI/Sources/ChatContextMenus.swift @@ -271,7 +271,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch }))) } - let archiveEnabled = !isSavedMessages && peerId != PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) && peerId == context.account.peerId + let archiveEnabled = !isSavedMessages && peerId != PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) && peerId == context.account.peerId if let (group, _) = groupAndIndex { if archiveEnabled { let isArchived = group == Namespaces.PeerGroup.archive diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 0971c9c5b7..5e20fd528e 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -927,7 +927,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } if archiveEnabled { for peerId in peerIds { - if peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) { + if peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) { archiveEnabled = false break } else if peerId == strongSelf.context.account.peerId { diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index abb2350bed..6ff6c48ad8 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -178,7 +178,7 @@ private final class ChatListShimmerNode: ASDisplayNode { let chatListPresentationData = ChatListPresentationData(theme: presentationData.theme, fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp1: Int32 = 100000 let peers = SimpleDictionary() let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, togglePeersSelection: { _, _ in }, additionalCategorySelected: { _ in diff --git a/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift index 7d7b51f020..d3ccd0b522 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift @@ -150,7 +150,7 @@ private final class ItemNode: ASDisplayNode { } enum ChatListSearchFilterEntryId: Hashable { - case filter(Int32) + case filter(Int64) } enum ChatListSearchFilterEntry: Equatable { diff --git a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift index 04cc6fd186..30b18e6ca3 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift @@ -2329,7 +2329,7 @@ private final class ChatListSearchShimmerNode: ASDisplayNode { let chatListPresentationData = ChatListPresentationData(theme: presentationData.theme, fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp1: Int32 = 100000 var peers = SimpleDictionary() peers[peer1.id] = peer1 diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index c32eb1d010..3cce18b827 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -196,7 +196,7 @@ private enum RevealOptionKey: Int32 { } private func canArchivePeer(id: PeerId, accountPeerId: PeerId) -> Bool { - if id.namespace == Namespaces.Peer.CloudUser && id.id._internalGetInt32Value() == 777000 { + if id.namespace == Namespaces.Peer.CloudUser && id.id._internalGetInt64Value() == 777000 { return false } if id == accountPeerId { diff --git a/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift b/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift index 93df9f8c64..13c1fc2757 100644 --- a/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift +++ b/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift @@ -57,7 +57,7 @@ private enum InviteContactsEntry: Comparable, Identifiable { } else { status = .none } - let peer = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: contact.firstName, lastName: contact.lastName, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: contact.firstName, lastName: contact.lastName, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .peer, peer: .peer(peer: peer, chatPeer: peer), status: status, enabled: true, selection: selection, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: ChatListSearchItemHeader(type: .contacts, theme: theme, strings: strings, actionTitle: nil, action: nil), action: { _ in interaction.toggleContact(id) }) diff --git a/submodules/ContextUI/Sources/ContextActionNode.swift b/submodules/ContextUI/Sources/ContextActionNode.swift index cafd458e1c..32f877e005 100644 --- a/submodules/ContextUI/Sources/ContextActionNode.swift +++ b/submodules/ContextUI/Sources/ContextActionNode.swift @@ -13,6 +13,7 @@ enum ContextActionSibling { public protocol ContextActionNodeProtocol: ASDisplayNode { func setIsHighlighted(_ value: Bool) func performAction() + var isActionEnabled: Bool { get } } final class ContextActionNode: ASDisplayNode, ContextActionNodeProtocol { @@ -32,6 +33,10 @@ final class ContextActionNode: ASDisplayNode, ContextActionNodeProtocol { private var iconDisposable: Disposable? private var pointerInteraction: PointerInteraction? + + var isActionEnabled: Bool { + return true + } init(presentationData: PresentationData, action: ContextMenuActionItem, getController: @escaping () -> ContextControllerProtocol?, actionSelected: @escaping (ContextMenuActionResult) -> Void) { self.action = action diff --git a/submodules/ContextUI/Sources/ContextActionsContainerNode.swift b/submodules/ContextUI/Sources/ContextActionsContainerNode.swift index 2325b2bd92..1ec0352676 100644 --- a/submodules/ContextUI/Sources/ContextActionsContainerNode.swift +++ b/submodules/ContextUI/Sources/ContextActionsContainerNode.swift @@ -139,7 +139,10 @@ private final class InnerActionsContainerNode: ASDisplayNode { guard let strongSelf = self else { return } - let actionNode = strongSelf.actionNode(at: point) + var actionNode = strongSelf.actionNode(at: point) + if let actionNodeValue = actionNode, !actionNodeValue.isActionEnabled { + actionNode = nil + } if actionNode !== strongSelf.currentHighlightedActionNode { if actionNode != nil, moved { strongSelf.feedbackTap() diff --git a/submodules/ContextUI/Sources/ContextController.swift b/submodules/ContextUI/Sources/ContextController.swift index 1dbdb6a225..92a6fa16d2 100644 --- a/submodules/ContextUI/Sources/ContextController.swift +++ b/submodules/ContextUI/Sources/ContextController.swift @@ -368,7 +368,11 @@ private final class ContextControllerNode: ViewControllerTracingNode, UIScrollVi } if strongSelf.didMoveFromInitialGesturePoint { let actionPoint = strongSelf.view.convert(localPoint, to: strongSelf.actionsContainerNode.view) - let actionNode = strongSelf.actionsContainerNode.actionNode(at: actionPoint) + var actionNode = strongSelf.actionsContainerNode.actionNode(at: actionPoint) + if let actionNodeValue = actionNode, !actionNodeValue.isActionEnabled { + actionNode = nil + } + if strongSelf.highlightedActionNode !== actionNode { strongSelf.highlightedActionNode?.setIsHighlighted(false) strongSelf.highlightedActionNode = actionNode diff --git a/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift b/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift index f8439221e5..50b71f819d 100644 --- a/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift +++ b/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift @@ -1276,7 +1276,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { }, openUrl: { _ in }, openPeer: { _ in }, showAll: false) - let peer = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let message = Message(stableId: 0, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: 0, id: 0), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 0, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peer, text: "", attributes: [], media: [map], peers: SimpleDictionary(), associatedMessages: SimpleDictionary(), associatedMessageIds: []) let controller = LocationViewController(context: self.context, subject: message, params: controllerParams) diff --git a/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift b/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift index 852b558575..6a30a33fc5 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift @@ -605,7 +605,7 @@ public final class InviteLinkViewController: ViewController { if state.importers.isEmpty && state.isLoadingMore { count = min(4, state.count) loading = true - let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) for i in 0 ..< count { entries.append(.importer(Int32(i), presentationData.theme, presentationData.dateTimeFormat, fakeUser, 0, true)) } diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/HPGrowingTextView.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/HPGrowingTextView.h index f5f84d3e67..1916a3f9fe 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/HPGrowingTextView.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/HPGrowingTextView.h @@ -110,7 +110,7 @@ extern NSString *TGMentionBoldAttributeName; - (NSString *)textWithEntities:(__autoreleasing NSArray **)entities; -+ (void)replaceMention:(NSString *)mention inputField:(HPGrowingTextView *)inputField username:(bool)username userId:(int32_t)userId; ++ (void)replaceMention:(NSString *)mention inputField:(HPGrowingTextView *)inputField username:(bool)username userId:(int64_t)userId; + (void)replaceHashtag:(NSString *)hashtag inputField:(HPGrowingTextView *)inputField; @end diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGLetteredAvatarView.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGLetteredAvatarView.h index 4c3cc4a574..cb8f25175f 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGLetteredAvatarView.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGLetteredAvatarView.h @@ -9,7 +9,7 @@ - (void)setTitleNeedsDisplay; -- (void)loadUserPlaceholderWithSize:(CGSize)size uid:(int)uid firstName:(NSString *)firstName lastName:(NSString *)lastName placeholder:(UIImage *)placeholder; +- (void)loadUserPlaceholderWithSize:(CGSize)size uid:(int64_t)uid firstName:(NSString *)firstName lastName:(NSString *)lastName placeholder:(UIImage *)placeholder; - (void)loadGroupPlaceholderWithSize:(CGSize)size conversationId:(int64_t)conversationId title:(NSString *)title placeholder:(UIImage *)placeholder; - (void)loadSavedMessagesWithSize:(CGSize)size placeholder:(UIImage *)placeholder; diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h index 1a8f563283..bc8dc3ab2c 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h @@ -55,7 +55,7 @@ typedef enum { + (instancetype)mediaOriginInfoForFavoriteStickerWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; + (instancetype)mediaOriginInfoForRecentGifWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; + (instancetype)mediaOriginInfoForRecentMaskWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; -+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int32_t)userId offset:(int32_t)offset; ++ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int64_t)userId offset:(int32_t)offset; + (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences url:(NSString *)url; + (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences peerId:(int64_t)peerId; + (instancetype)mediaOriginInfoWithFileReferences:(NSDictionary *)fileReferences wallpaperId:(int32_t)wallpaperId; diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaPickerCaptionInputPanel.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaPickerCaptionInputPanel.h index 3f8530a4b6..d58441d07a 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaPickerCaptionInputPanel.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaPickerCaptionInputPanel.h @@ -22,7 +22,7 @@ - (void)setCollapsed:(bool)collapsed animated:(bool)animated; - (void)replaceMention:(NSString *)mention; -- (void)replaceMention:(NSString *)mention username:(bool)username userId:(int32_t)userId; +- (void)replaceMention:(NSString *)mention username:(bool)username userId:(int64_t)userId; - (void)replaceHashtag:(NSString *)hashtag; - (void)adjustForOrientation:(UIInterfaceOrientation)orientation keyboardHeight:(CGFloat)keyboardHeight duration:(NSTimeInterval)duration animationCurve:(NSInteger)animationCurve; diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h index 8a23f9cf54..09ba58b166 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h @@ -66,7 +66,7 @@ typedef enum { @interface TGUser : NSObject -@property (nonatomic) int uid; +@property (nonatomic) int64_t uid; @property (nonatomic, strong) NSString *phoneNumber; @property (nonatomic) int64_t phoneNumberHash; @property (nonatomic, strong) NSString *firstName; diff --git a/submodules/LegacyComponents/Sources/HPGrowingTextView.m b/submodules/LegacyComponents/Sources/HPGrowingTextView.m index 99e53f2370..bb93dba309 100644 --- a/submodules/LegacyComponents/Sources/HPGrowingTextView.m +++ b/submodules/LegacyComponents/Sources/HPGrowingTextView.m @@ -805,7 +805,7 @@ NSString *TGMentionBoldAttributeName = @"TGMentionBoldAttributeName"; return string.string; } -+ (void)replaceMention:(NSString *)mention inputField:(HPGrowingTextView *)inputField username:(bool)username userId:(int32_t)userId ++ (void)replaceMention:(NSString *)mention inputField:(HPGrowingTextView *)inputField username:(bool)username userId:(int64_t)userId { NSString *replacementText = [mention stringByAppendingString:@" "]; diff --git a/submodules/LegacyComponents/Sources/TGLetteredAvatarView.m b/submodules/LegacyComponents/Sources/TGLetteredAvatarView.m index fcdc4ea406..8bfa451d48 100644 --- a/submodules/LegacyComponents/Sources/TGLetteredAvatarView.m +++ b/submodules/LegacyComponents/Sources/TGLetteredAvatarView.m @@ -158,7 +158,7 @@ static bool isEmojiCharacter(NSString *singleChar) _label.hidden = true; } -- (void)loadUserPlaceholderWithSize:(CGSize)size uid:(int)uid firstName:(NSString *)firstName lastName:(NSString *)lastName placeholder:(UIImage *)placeholder +- (void)loadUserPlaceholderWithSize:(CGSize)size uid:(int64_t)uid firstName:(NSString *)firstName lastName:(NSString *)lastName placeholder:(UIImage *)placeholder { _label.font = _doubleFont; _usingSingleFont = false; diff --git a/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m b/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m index b7b62db4d2..0a62731f5f 100644 --- a/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m +++ b/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m @@ -275,7 +275,7 @@ return info; } -+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int32_t)userId offset:(int32_t)offset ++ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int64_t)userId offset:(int32_t)offset { TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init]; info->_type = TGMediaOriginTypeProfilePhoto; diff --git a/submodules/LegacyComponents/Sources/TGMediaPickerCaptionInputPanel.m b/submodules/LegacyComponents/Sources/TGMediaPickerCaptionInputPanel.m index 446bccd311..de6fc90aa8 100644 --- a/submodules/LegacyComponents/Sources/TGMediaPickerCaptionInputPanel.m +++ b/submodules/LegacyComponents/Sources/TGMediaPickerCaptionInputPanel.m @@ -815,7 +815,7 @@ static void setViewFrame(UIView *view, CGRect frame) [HPGrowingTextView replaceMention:mention inputField:_inputField username:true userId:0]; } -- (void)replaceMention:(NSString *)mention username:(bool)username userId:(int32_t)userId { +- (void)replaceMention:(NSString *)mention username:(bool)username userId:(int64_t)userId { [HPGrowingTextView replaceMention:mention inputField:_inputField username:username userId:userId]; } diff --git a/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift b/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift index 04ae6c6b7a..d2803cf30e 100644 --- a/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift +++ b/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift @@ -18,7 +18,7 @@ public func legacySuggestionContext(context: AccountContext, peerId: PeerId, cha for peer in peers { if case let .user(peer) = peer { let user = TGUser() - user.uid = peer.id.id._internalGetInt32Value() + user.uid = peer.id.id._internalGetInt64Value() user.firstName = peer.firstName user.lastName = peer.lastName user.userName = peer.addressName diff --git a/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift b/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift index b3342df14a..847b4f7b92 100644 --- a/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift +++ b/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift @@ -62,10 +62,10 @@ final class LegacyPeerAvatarPlaceholderDataSource: TGImageDataSource { var peerId = PeerId(0) - if let uid = args["uid"] as? String, let nUid = Int32(uid) { - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(nUid)) - } else if let cid = args["cid"] as? String, let nCid = Int32(cid) { - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(nCid)) + if let uid = args["uid"] as? String, let nUid = Int64(uid) { + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(nUid)) + } else if let cid = args["cid"] as? String, let nCid = Int64(cid) { + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(nCid)) } let image = generateImage(CGSize(width: CGFloat(width), height: CGFloat(height)), rotatedContext: { size, context in @@ -76,10 +76,10 @@ final class LegacyPeerAvatarPlaceholderDataSource: TGImageDataSource { context.clip() let colorIndex: Int - if peerId.id._internalGetInt32Value() == 0 { + if peerId.id._internalGetInt64Value() == 0 { colorIndex = -1 } else { - colorIndex = abs(Int(account.peerId.id._internalGetInt32Value() &+ peerId.id._internalGetInt32Value())) + colorIndex = abs(Int(clamping: account.peerId.id._internalGetInt64Value() &+ peerId.id._internalGetInt64Value())) } let colorsArray: NSArray diff --git a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h index e22992dc38..5570ba9f47 100644 --- a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h +++ b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h @@ -3,8 +3,8 @@ @interface MTExportedAuthorizationData : NSObject @property (nonatomic, strong, readonly) NSData *authorizationBytes; -@property (nonatomic, readonly) int32_t authorizationId; +@property (nonatomic, readonly) int64_t authorizationId; -- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId; +- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int64_t)authorizationId; @end diff --git a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h index bc197ee876..d08cd0faf0 100644 --- a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h +++ b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h @@ -18,7 +18,7 @@ typedef id (^MTRequestNoopParser)(NSData *); - (id)parseMessage:(NSData *)data; - (MTExportAuthorizationResponseParser)exportAuthorization:(int32_t)datacenterId data:(__autoreleasing NSData **)data; -- (NSData *)importAuthorization:(int32_t)authId bytes:(NSData *)bytes; +- (NSData *)importAuthorization:(int64_t)authId bytes:(NSData *)bytes; - (MTRequestDatacenterAddressListParser)requestDatacenterAddressWithData:(__autoreleasing NSData **)data; - (MTRequestNoopParser)requestNoop:(__autoreleasing NSData **)data; diff --git a/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m b/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m index 325f4928a9..3fb45e3f85 100644 --- a/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m +++ b/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m @@ -113,7 +113,7 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) { } - (BOOL)hasAcceptableStatusCode { - return !self.acceptableStatusCodes || [self.acceptableStatusCodes containsIndex:[self.response statusCode]]; + return !self.acceptableStatusCodes || [self.acceptableStatusCodes containsIndex:(NSUInteger)[self.response statusCode]]; } - (BOOL)hasAcceptableContentType { diff --git a/submodules/MtProtoKit/Sources/MTBindKeyMessageService.m b/submodules/MtProtoKit/Sources/MTBindKeyMessageService.m index 96d723d844..54eef47d40 100644 --- a/submodules/MtProtoKit/Sources/MTBindKeyMessageService.m +++ b/submodules/MtProtoKit/Sources/MTBindKeyMessageService.m @@ -10,6 +10,8 @@ #import #import #import +#import +#import #import "MTInternalMessageParser.h" #import "MTRpcResultMessage.h" #import "MTBuffer.h" @@ -142,6 +144,14 @@ if (rpcResultMessage.data.length >= 4) { uint32_t signature = 0; [rpcResultMessage.data getBytes:&signature range:NSMakeRange(0, 4)]; + + id parsedMessage = [MTInternalMessageParser parseMessage:rpcResultMessage.data]; + if ([parsedMessage isKindOfClass:[MTRpcError class]]) { + if (MTLogEnabled()) { + MTRpcError *rpcError = (MTRpcError *)parsedMessage; + MTLog(@"[MTRequestMessageService#%p response for %" PRId64 " is error: %d: %@]", self, _currentMessageId, (int)rpcError.errorCode, rpcError.errorDescription); + } + } //boolTrue#997275b5 = Bool; if (signature == 0x997275b5U) { diff --git a/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m b/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m index 9cfccea07d..cf1740f7af 100644 --- a/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m +++ b/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m @@ -116,7 +116,7 @@ [requestService addRequest:request]; } -- (void)beginTransferWithId:(int32_t)dataId data:(NSData *)authData +- (void)beginTransferWithId:(int64_t)dataId data:(NSData *)authData { [_sourceDatacenterMtProto stop]; _sourceDatacenterMtProto = nil; diff --git a/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m b/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m index 9b4933d791..9cdc6fd3cd 100644 --- a/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m +++ b/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m @@ -2,7 +2,7 @@ @implementation MTExportedAuthorizationData -- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId +- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int64_t)authorizationId { self = [super init]; if (self != nil) diff --git a/submodules/MurMurHash32/Sources/MurMurHash32.m b/submodules/MurMurHash32/Sources/MurMurHash32.m index 9096171c74..afbf1d2f83 100644 --- a/submodules/MurMurHash32/Sources/MurMurHash32.m +++ b/submodules/MurMurHash32/Sources/MurMurHash32.m @@ -28,7 +28,7 @@ static FORCE_INLINE uint32_t fmix ( uint32_t h ) return h; } -static void murMurHash32Impl(const void *key, int len, uint32_t seed, void *out) +static void murMurHash32Impl(const void *key, uint32_t len, uint32_t seed, void *out) { const uint8_t * data = (const uint8_t*)key; const int nblocks = len / 4; diff --git a/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift b/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift index 8018f2d404..7c878bf1f2 100644 --- a/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift +++ b/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift @@ -256,7 +256,7 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode { id = mediaId.id category = categoryValue } else { - id = Int64(entry.peer?.id.id._internalGetInt32Value() ?? 0) + id = Int64(entry.peer?.id.id._internalGetInt64Value() ?? 0) if let resource = entry.videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } diff --git a/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift b/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift index 3e155545cf..a65e7a42bb 100644 --- a/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift +++ b/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift @@ -379,7 +379,7 @@ public final class PeerInfoAvatarListItemNode: ASDisplayNode { representations = topRepresentations videoRepresentations = videoRepresentationsValue immediateThumbnailData = immediateThumbnail - id = Int64(self.peer.id.id._internalGetInt32Value()) + id = self.peer.id.id._internalGetInt64Value() if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } @@ -390,7 +390,7 @@ public final class PeerInfoAvatarListItemNode: ASDisplayNode { if case let .cloud(imageId, _, _) = reference { id = imageId } else { - id = Int64(self.peer.id.id._internalGetInt32Value()) + id = self.peer.id.id._internalGetInt64Value() } } self.imageNode.setSignal(chatAvatarGalleryPhoto(account: self.context.account, representations: representations, immediateThumbnailData: immediateThumbnailData, autoFetchFullSize: true, attemptSynchronously: synchronous, skipThumbnail: fullSizeOnly), attemptSynchronously: synchronous, dispatchOnDisplayLink: false) diff --git a/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift b/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift index 2d3a6d22ec..c63e72654f 100644 --- a/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift +++ b/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift @@ -652,7 +652,7 @@ private func deviceContactInfoEntries(account: Account, presentationData: Presen firstName = presentationData.strings.Message_Contact } - entries.append(.info(entries.count, presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer: peer ?? TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: firstName, lastName: isOrganization ? nil : personName.1, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []), state: ItemListAvatarAndNameInfoItemState(editingName: editingName, updatingName: nil), job: isOrganization ? nil : jobSummary, isPlain: !isShare)) + entries.append(.info(entries.count, presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer: peer ?? TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: firstName, lastName: isOrganization ? nil : personName.1, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []), state: ItemListAvatarAndNameInfoItemState(editingName: editingName, updatingName: nil), job: isOrganization ? nil : jobSummary, isPlain: !isShare)) if !selecting { if let _ = peer { diff --git a/submodules/Postbox/Sources/Peer.swift b/submodules/Postbox/Sources/Peer.swift index c85b4f1af9..370f162e74 100644 --- a/submodules/Postbox/Sources/Peer.swift +++ b/submodules/Postbox/Sources/Peer.swift @@ -60,7 +60,7 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { return Id(rawValue: 0x000000007fffffff) } - fileprivate var rawValue: Int32 + fileprivate var rawValue: Int64 var predecessor: Id { if self.rawValue != 0 { @@ -82,17 +82,21 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { return "\(self.rawValue)" } - fileprivate init(rawValue: Int32) { - //precondition((rawValue | 0x000FFFFFFFFFFFFF) == 0x000FFFFFFFFFFFFF) + fileprivate init(rawValue: Int64) { + if rawValue < 0 { + assert(abs(rawValue) == (abs(rawValue) & 0x007fffffffffffff)) + } else { + assert(abs(rawValue) == (abs(rawValue) & 0x00ffffffffffffff)) + } self.rawValue = rawValue } - public static func _internalFromInt32Value(_ value: Int32) -> Id { + public static func _internalFromInt64Value(_ value: Int64) -> Id { return Id(rawValue: value) } - public func _internalGetInt32Value() -> Int32 { + public func _internalGetInt64Value() -> Int64 { return self.rawValue } @@ -144,21 +148,37 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { public init(_ n: Int64) { let data = UInt64(bitPattern: n) + // Bits: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + // |___________________________|__| |______________________________| + // id high bits (29) ns id low bits (32) + let legacyNamespaceBits = ((data >> 32) & 0xffffffff) let idLowBits = data & 0xffffffff if legacyNamespaceBits == 0x7fffffff && idLowBits == 0 { self.namespace = .max - self.id = Id(rawValue: Int32(bitPattern: UInt32(clamping: idLowBits))) + self.id = Id(rawValue: Int64(bitPattern: UInt64(clamping: idLowBits))) } else { + // 0x7 == 0b111 let namespaceBits = ((data >> 32) & 0x7) self.namespace = Namespace(rawValue: UInt32(namespaceBits)) - let idHighBits = (data >> (32 + 3)) & 0xffffffff - //assert(idHighBits == 0) + let offsetIdHighBits = (data >> (32 + 3)) & 0xffffffff + let idHighBits = offsetIdHighBits << 32 - self.id = Id(rawValue: Int32(bitPattern: UInt32(clamping: idLowBits))) + if idHighBits == 0 { + if let uint32Value = UInt32(exactly: idLowBits) { + self.id = Id(rawValue: Int64(Int32(bitPattern: uint32Value))) + } else { + preconditionFailure() + } + } else { + let idAbs: UInt64 = idHighBits | idLowBits + self.id = Id(rawValue: Int64(bitPattern: idAbs)) + } } + + assert(self._toInt64() == n) } public init(from decoder: Decoder) throws { @@ -173,7 +193,26 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { } public func toInt64() -> Int64 { - let idLowBits = UInt32(bitPattern: self.id.rawValue) + let result = self._toInt64() + assert(PeerId(result) == self) + return result + } + + private func _toInt64() -> Int64 { + let data: UInt64 + + if self.id.rawValue < 0 { + if let int32Value = Int32(exactly: self.id.rawValue) { + data = UInt64(UInt32(bitPattern: int32Value)) + } else { + preconditionFailure() + } + } else { + data = UInt64(bitPattern: self.id.rawValue) + } + + let idLowBits = data & 0xffffffff + let idHighBits = (data >> 32) & 0xffffffff let result: Int64 if self.namespace == .max && self.id.rawValue == 0 { @@ -181,25 +220,20 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { let namespaceBits: UInt64 = 0x7fffffff data |= namespaceBits << 32 - - data |= UInt64(idLowBits) + data |= idLowBits result = Int64(bitPattern: data) } else { var data: UInt64 = 0 - data |= UInt64(self.namespace.rawValue) << 32 - - let idValue = UInt32(bitPattern: self.id.rawValue) - let idHighBits = (idValue >> 32) & 0x3FFFFFFF - assert(idHighBits == 0) - - data |= UInt64(idLowBits) + assert(self.namespace.rawValue & 0x7 == self.namespace.rawValue) + let offsetIdHighBits = idHighBits << (32 + 3) + data |= UInt64(self.namespace.rawValue & 0x7) << 32 + data |= offsetIdHighBits + data |= idLowBits result = Int64(bitPattern: data) } - assert(PeerId(result) == self) - return result } diff --git a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift index d49b8588aa..2c1ebf9cd2 100644 --- a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift +++ b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift @@ -159,7 +159,7 @@ private final class BubbleSettingsControllerNode: ASDisplayNode, UIScrollViewDel let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift index 828478a78a..e9413858f4 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift @@ -140,7 +140,7 @@ class ForwardPrivacyChatPreviewItemNode: ListViewItemNode { let insets: UIEdgeInsets let separatorHeight = UIScreenPixel - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) var peers = SimpleDictionary() let messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift index ceefe04ed2..a72209d63b 100644 --- a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift +++ b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift @@ -220,13 +220,13 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView let peers = SimpleDictionary() let messages = SimpleDictionary() let selfPeer = TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp = self.referenceTimestamp @@ -304,7 +304,7 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift index 78e5ea4337..0c4c034718 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift @@ -818,11 +818,11 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate let peers = SimpleDictionary() let messages = SimpleDictionary() let selfPeer = TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp = self.referenceTimestamp @@ -884,7 +884,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.theme, strings: self.presentationData.strings, wallpaper: self.wallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift index 3cf8104a6d..270c9d715f 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift @@ -365,14 +365,14 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { let peers = SimpleDictionary() let messages = SimpleDictionary() let selfPeer = TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer7 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer7 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp = self.referenceTimestamp @@ -452,7 +452,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.previewTheme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift index e115dc5dc7..f1fa0b89e8 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift @@ -146,8 +146,8 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { let insets: UIEdgeInsets let separatorHeight = UIScreenPixel - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) - let otherPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) + let otherPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)) var items: [ListViewItem] = [] for messageItem in item.messageItems.reversed() { var peers = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift index a2ffa742fa..55a93b4304 100644 --- a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift +++ b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift @@ -1029,7 +1029,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode { } var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() let messages = SimpleDictionary() diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 2ed896fbec..8fb8cf30f4 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -11,12 +11,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) } dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) } dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) } - dict[1235264985] = { return Api.ChatFull.parse_chatFull($0) } - dict[793980732] = { return Api.ChatFull.parse_channelFull($0) } - dict[-1159937629] = { return Api.PollResults.parse_pollResults($0) } - dict[-925415106] = { return Api.ChatParticipant.parse_chatParticipant($0) } - dict[-636267638] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) } - dict[-489233354] = { return Api.ChatParticipant.parse_chatParticipantAdmin($0) } + dict[1304281241] = { return Api.ChatFull.parse_chatFull($0) } + dict[-374179305] = { return Api.ChatFull.parse_channelFull($0) } + dict[-591909213] = { return Api.PollResults.parse_pollResults($0) } + dict[-1070776313] = { return Api.ChatParticipant.parse_chatParticipant($0) } + dict[-462696732] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) } + dict[-1600962725] = { return Api.ChatParticipant.parse_chatParticipantAdmin($0) } dict[1567990072] = { return Api.updates.Difference.parse_differenceEmpty($0) } dict[16030880] = { return Api.updates.Difference.parse_difference($0) } dict[-1459938943] = { return Api.updates.Difference.parse_differenceSlice($0) } @@ -65,11 +65,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1715350371] = { return Api.JSONValue.parse_jsonObject($0) } dict[590459437] = { return Api.Photo.parse_photoEmpty($0) } dict[-82216347] = { return Api.Photo.parse_photo($0) } - dict[-1683826688] = { return Api.Chat.parse_chatEmpty($0) } - dict[1004149726] = { return Api.Chat.parse_chat($0) } - dict[120753115] = { return Api.Chat.parse_chatForbidden($0) } - dict[-753232354] = { return Api.Chat.parse_channel($0) } - dict[681420594] = { return Api.Chat.parse_channelForbidden($0) } + dict[693512293] = { return Api.Chat.parse_chatEmpty($0) } + dict[1103884886] = { return Api.Chat.parse_chat($0) } + dict[1704108455] = { return Api.Chat.parse_chatForbidden($0) } + dict[-2107528095] = { return Api.Chat.parse_channel($0) } + dict[399807445] = { return Api.Chat.parse_channelForbidden($0) } dict[1202287072] = { return Api.StatsURL.parse_statsURL($0) } dict[1516793212] = { return Api.ChatInvite.parse_chatInviteAlready($0) } dict[-540871282] = { return Api.ChatInvite.parse_chatInvite($0) } @@ -83,8 +83,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1678812626] = { return Api.StickerSetCovered.parse_stickerSetCovered($0) } dict[872932635] = { return Api.StickerSetCovered.parse_stickerSetMultiCovered($0) } dict[1189204285] = { return Api.RecentMeUrl.parse_recentMeUrlUnknown($0) } - dict[-1917045962] = { return Api.RecentMeUrl.parse_recentMeUrlUser($0) } - dict[-1608834311] = { return Api.RecentMeUrl.parse_recentMeUrlChat($0) } + dict[-1188296222] = { return Api.RecentMeUrl.parse_recentMeUrlUser($0) } + dict[-1294306862] = { return Api.RecentMeUrl.parse_recentMeUrlChat($0) } dict[-347535331] = { return Api.RecentMeUrl.parse_recentMeUrlChatInvite($0) } dict[-1140172836] = { return Api.RecentMeUrl.parse_recentMeUrlStickerSet($0) } dict[-797791052] = { return Api.RestrictionReason.parse_restrictionReason($0) } @@ -108,8 +108,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[894777186] = { return Api.RichText.parse_textAnchor($0) } dict[-694681851] = { return Api.UserFull.parse_userFull($0) } dict[-292807034] = { return Api.InputChannel.parse_inputChannelEmpty($0) } - dict[-1343524562] = { return Api.InputChannel.parse_inputChannel($0) } - dict[707290417] = { return Api.InputChannel.parse_inputChannelFromMessage($0) } + dict[-212145112] = { return Api.InputChannel.parse_inputChannel($0) } + dict[1536380829] = { return Api.InputChannel.parse_inputChannelFromMessage($0) } dict[414687501] = { return Api.DcOption.parse_dcOption($0) } dict[997055186] = { return Api.PollAnswerVoters.parse_pollAnswerVoters($0) } dict[-1705233435] = { return Api.account.PasswordSettings.parse_passwordSettings($0) } @@ -121,7 +121,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-209337866] = { return Api.LangPackDifference.parse_langPackDifference($0) } dict[499236004] = { return Api.WallPaperSettings.parse_wallPaperSettings($0) } dict[-1519029347] = { return Api.EmojiURL.parse_emojiURL($0) } - dict[1611985938] = { return Api.StatsGroupTopAdmin.parse_statsGroupTopAdmin($0) } + dict[-682079097] = { return Api.StatsGroupTopAdmin.parse_statsGroupTopAdmin($0) } dict[-541588713] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) } dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) } dict[-763367294] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordSRP($0) } @@ -151,9 +151,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1148485274] = { return Api.auth.Authorization.parse_authorizationSignUpRequired($0) } dict[-181407105] = { return Api.InputFile.parse_inputFile($0) } dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) } - dict[-1649296275] = { return Api.Peer.parse_peerUser($0) } - dict[-1160714821] = { return Api.Peer.parse_peerChat($0) } - dict[-1109531342] = { return Api.Peer.parse_peerChannel($0) } + dict[1498486562] = { return Api.Peer.parse_peerUser($0) } + dict[918946202] = { return Api.Peer.parse_peerChat($0) } + dict[-1566230754] = { return Api.Peer.parse_peerChannel($0) } dict[410107472] = { return Api.messages.ExportedChatInvite.parse_exportedChatInvite($0) } dict[572915951] = { return Api.messages.ExportedChatInvite.parse_exportedChatInviteReplaced($0) } dict[-1868808300] = { return Api.PaymentRequestedInfo.parse_paymentRequestedInfo($0) } @@ -193,64 +193,64 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[522914557] = { return Api.Update.parse_updateNewMessage($0) } dict[1318109142] = { return Api.Update.parse_updateMessageID($0) } dict[-1576161051] = { return Api.Update.parse_updateDeleteMessages($0) } - dict[1548249383] = { return Api.Update.parse_updateUserTyping($0) } - dict[-2033525908] = { return Api.Update.parse_updateChatUserTyping($0) } + dict[-1071741569] = { return Api.Update.parse_updateUserTyping($0) } + dict[-2092401936] = { return Api.Update.parse_updateChatUserTyping($0) } dict[125178264] = { return Api.Update.parse_updateChatParticipants($0) } - dict[469489699] = { return Api.Update.parse_updateUserStatus($0) } - dict[-1489818765] = { return Api.Update.parse_updateUserName($0) } - dict[-1791935732] = { return Api.Update.parse_updateUserPhoto($0) } + dict[-440534818] = { return Api.Update.parse_updateUserStatus($0) } + dict[-1007549728] = { return Api.Update.parse_updateUserName($0) } + dict[-232290676] = { return Api.Update.parse_updateUserPhoto($0) } dict[314359194] = { return Api.Update.parse_updateNewEncryptedMessage($0) } dict[386986326] = { return Api.Update.parse_updateEncryptedChatTyping($0) } dict[-1264392051] = { return Api.Update.parse_updateEncryption($0) } dict[956179895] = { return Api.Update.parse_updateEncryptedMessagesRead($0) } - dict[-364179876] = { return Api.Update.parse_updateChatParticipantAdd($0) } - dict[1851755554] = { return Api.Update.parse_updateChatParticipantDelete($0) } + dict[1037718609] = { return Api.Update.parse_updateChatParticipantAdd($0) } + dict[-483443337] = { return Api.Update.parse_updateChatParticipantDelete($0) } dict[-1906403213] = { return Api.Update.parse_updateDcOptions($0) } dict[-1094555409] = { return Api.Update.parse_updateNotifySettings($0) } dict[-337352679] = { return Api.Update.parse_updateServiceNotification($0) } dict[-298113238] = { return Api.Update.parse_updatePrivacy($0) } - dict[314130811] = { return Api.Update.parse_updateUserPhone($0) } + dict[88680979] = { return Api.Update.parse_updateUserPhone($0) } dict[-1667805217] = { return Api.Update.parse_updateReadHistoryInbox($0) } dict[791617983] = { return Api.Update.parse_updateReadHistoryOutbox($0) } dict[2139689491] = { return Api.Update.parse_updateWebPage($0) } dict[1757493555] = { return Api.Update.parse_updateReadMessagesContents($0) } - dict[-352032773] = { return Api.Update.parse_updateChannelTooLong($0) } - dict[-1227598250] = { return Api.Update.parse_updateChannel($0) } + dict[277713951] = { return Api.Update.parse_updateChannelTooLong($0) } + dict[1666927625] = { return Api.Update.parse_updateChannel($0) } dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) } - dict[856380452] = { return Api.Update.parse_updateReadChannelInbox($0) } - dict[-1015733815] = { return Api.Update.parse_updateDeleteChannelMessages($0) } - dict[-1734268085] = { return Api.Update.parse_updateChannelMessageViews($0) } - dict[-1232070311] = { return Api.Update.parse_updateChatParticipantAdmin($0) } + dict[-1842450928] = { return Api.Update.parse_updateReadChannelInbox($0) } + dict[-1020437742] = { return Api.Update.parse_updateDeleteChannelMessages($0) } + dict[-232346616] = { return Api.Update.parse_updateChannelMessageViews($0) } + dict[-674602590] = { return Api.Update.parse_updateChatParticipantAdmin($0) } dict[1753886890] = { return Api.Update.parse_updateNewStickerSet($0) } dict[196268545] = { return Api.Update.parse_updateStickerSetsOrder($0) } dict[1135492588] = { return Api.Update.parse_updateStickerSets($0) } dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($0) } - dict[1059076315] = { return Api.Update.parse_updateBotInlineQuery($0) } - dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) } + dict[1232025500] = { return Api.Update.parse_updateBotInlineQuery($0) } + dict[317794823] = { return Api.Update.parse_updateBotInlineSend($0) } dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) } - dict[-415938591] = { return Api.Update.parse_updateBotCallbackQuery($0) } + dict[-1177566067] = { return Api.Update.parse_updateBotCallbackQuery($0) } dict[-469536605] = { return Api.Update.parse_updateEditMessage($0) } - dict[-103646630] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) } - dict[634833351] = { return Api.Update.parse_updateReadChannelOutbox($0) } + dict[1763610706] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) } + dict[-1218471511] = { return Api.Update.parse_updateReadChannelOutbox($0) } dict[-299124375] = { return Api.Update.parse_updateDraftMessage($0) } dict[1461528386] = { return Api.Update.parse_updateReadFeaturedStickers($0) } dict[-1706939360] = { return Api.Update.parse_updateRecentStickers($0) } 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[791390623] = { return Api.Update.parse_updateChannelWebPage($0) } dict[1852826908] = { return Api.Update.parse_updateDialogPinned($0) } dict[-99664734] = { 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) } - dict[1563376297] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) } + dict[-1246823043] = { return Api.Update.parse_updateBotShippingQuery($0) } + dict[-1934976362] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) } dict[-1425052898] = { return Api.Update.parse_updatePhoneCall($0) } dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) } dict[1442983757] = { return Api.Update.parse_updateLangPack($0) } dict[-451831443] = { return Api.Update.parse_updateFavedStickers($0) } - dict[-1987495099] = { return Api.Update.parse_updateChannelReadMessagesContents($0) } + dict[1153291573] = { return Api.Update.parse_updateChannelReadMessagesContents($0) } dict[1887741886] = { return Api.Update.parse_updateContactsReset($0) } - dict[1893427255] = { return Api.Update.parse_updateChannelAvailableMessages($0) } + dict[-1304443240] = { return Api.Update.parse_updateChannelAvailableMessages($0) } dict[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) } dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) } dict[1421875280] = { return Api.Update.parse_updateChatDefaultBannedRights($0) } @@ -262,40 +262,40 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-2112423005] = { return Api.Update.parse_updateTheme($0) } dict[-2027964103] = { return Api.Update.parse_updateGeoLiveViewed($0) } dict[1448076945] = { return Api.Update.parse_updateLoginToken($0) } - dict[938909451] = { return Api.Update.parse_updateMessagePollVote($0) } + dict[274961865] = { return Api.Update.parse_updateMessagePollVote($0) } dict[654302845] = { return Api.Update.parse_updateDialogFilter($0) } dict[-1512627963] = { return Api.Update.parse_updateDialogFilterOrder($0) } dict[889491791] = { return Api.Update.parse_updateDialogFilters($0) } dict[643940105] = { return Api.Update.parse_updatePhoneCallSignalingData($0) } - dict[1854571743] = { return Api.Update.parse_updateChannelMessageForwards($0) } - dict[482860628] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) } - dict[1178116716] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) } + dict[-761649164] = { return Api.Update.parse_updateChannelMessageForwards($0) } + dict[-693004986] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) } + dict[1767677564] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) } dict[610945826] = { return Api.Update.parse_updatePeerBlocked($0) } - dict[1796675352] = { return Api.Update.parse_updateChannelUserTyping($0) } + dict[-1937192669] = { return Api.Update.parse_updateChannelUserTyping($0) } dict[-309990731] = { return Api.Update.parse_updatePinnedMessages($0) } - dict[-2054649973] = { return Api.Update.parse_updatePinnedChannelMessages($0) } - dict[321954198] = { return Api.Update.parse_updateChat($0) } + dict[1538885128] = { return Api.Update.parse_updatePinnedChannelMessages($0) } + dict[-124097970] = { return Api.Update.parse_updateChat($0) } dict[-219423922] = { return Api.Update.parse_updateGroupCallParticipants($0) } - dict[-1537295973] = { return Api.Update.parse_updateGroupCall($0) } + dict[347227392] = { return Api.Update.parse_updateGroupCall($0) } dict[-1147422299] = { return Api.Update.parse_updatePeerHistoryTTL($0) } - dict[-206342113] = { return Api.Update.parse_updateChatParticipant($0) } - dict[2146218476] = { return Api.Update.parse_updateChannelParticipant($0) } - dict[133777546] = { return Api.Update.parse_updateBotStopped($0) } + dict[-796432838] = { return Api.Update.parse_updateChatParticipant($0) } + dict[-1738720581] = { return Api.Update.parse_updateChannelParticipant($0) } + dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) } dict[192428418] = { return Api.Update.parse_updateGroupCallConnection($0) } - dict[-813823885] = { return Api.Update.parse_updateBotCommands($0) } + dict[1299263278] = { return Api.Update.parse_updateBotCommands($0) } dict[136574537] = { return Api.messages.VotesList.parse_votesList($0) } dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) } dict[-592373577] = { return Api.GroupCallParticipantVideoSourceGroup.parse_groupCallParticipantVideoSourceGroup($0) } dict[-373643672] = { return Api.FolderPeer.parse_folderPeer($0) } - dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) } - dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } - dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) } - dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) } - dict[1352785878] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) } + dict[-1072953408] = { return Api.ChannelParticipant.parse_channelParticipant($0) } + dict[682146919] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } + dict[803602899] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) } + dict[885242707] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) } + dict[1844969806] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) } dict[453242886] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) } - dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) } - dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) } - dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) } + dict[886196148] = { return Api.MessageUserVote.parse_messageUserVote($0) } + dict[1017491692] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) } + dict[-1973033641] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) } dict[182326673] = { return Api.contacts.Blocked.parse_blocked($0) } dict[-513392236] = { return Api.contacts.Blocked.parse_blockedSlice($0) } dict[-55902537] = { return Api.InputDialogPeer.parse_inputDialogPeer($0) } @@ -311,11 +311,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[280464681] = { return Api.KeyboardButton.parse_keyboardButtonUrlAuth($0) } dict[-802258988] = { return Api.KeyboardButton.parse_inputKeyboardButtonUrlAuth($0) } dict[-1144565411] = { return Api.KeyboardButton.parse_keyboardButtonRequestPoll($0) } - dict[-748155807] = { return Api.ContactStatus.parse_contactStatus($0) } + dict[383348795] = { return Api.ContactStatus.parse_contactStatus($0) } dict[1679398724] = { return Api.SecureFile.parse_secureFileEmpty($0) } dict[-534283678] = { return Api.SecureFile.parse_secureFile($0) } dict[-199313886] = { return Api.account.Themes.parse_themesNotModified($0) } - dict[2137482273] = { return Api.account.Themes.parse_themes($0) } + dict[-1707242387] = { return Api.account.Themes.parse_themes($0) } dict[236446268] = { return Api.PhotoSize.parse_photoSizeEmpty($0) } dict[1976012384] = { return Api.PhotoSize.parse_photoSize($0) } dict[35527382] = { return Api.PhotoSize.parse_photoCachedSize($0) } @@ -323,13 +323,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-96535659] = { return Api.PhotoSize.parse_photoSizeProgressive($0) } dict[-668906175] = { return Api.PhotoSize.parse_photoPathSize($0) } dict[-244016606] = { return Api.messages.Stickers.parse_stickersNotModified($0) } - dict[-463889475] = { return Api.messages.Stickers.parse_stickers($0) } + dict[816245886] = { return Api.messages.Stickers.parse_stickers($0) } dict[-1096616924] = { return Api.GlobalPrivacySettings.parse_globalPrivacySettings($0) } dict[1008755359] = { return Api.InlineBotSwitchPM.parse_inlineBotSwitchPM($0) } dict[223655517] = { return Api.messages.FoundStickerSets.parse_foundStickerSetsNotModified($0) } - dict[1359533640] = { return Api.messages.FoundStickerSets.parse_foundStickerSets($0) } + dict[-1963942446] = { return Api.messages.FoundStickerSets.parse_foundStickerSets($0) } dict[471437699] = { return Api.account.WallPapers.parse_wallPapersNotModified($0) } - dict[1881892265] = { return Api.account.WallPapers.parse_wallPapers($0) } + dict[-842824308] = { return Api.account.WallPapers.parse_wallPapers($0) } dict[1012306921] = { return Api.InputTheme.parse_inputTheme($0) } dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) } dict[-2032041631] = { return Api.Poll.parse_poll($0) } @@ -376,7 +376,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-353862078] = { return Api.contacts.Contacts.parse_contacts($0) } dict[-1798033689] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilterEmpty($0) } dict[-847783593] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilter($0) } - dict[-539872497] = { return Api.ChatAdminWithInvites.parse_chatAdminWithInvites($0) } + dict[-219353309] = { return Api.ChatAdminWithInvites.parse_chatAdminWithInvites($0) } dict[2004110666] = { return Api.DialogFilterSuggested.parse_dialogFilterSuggested($0) } dict[326715557] = { return Api.auth.PasswordRecovery.parse_passwordRecovery($0) } dict[-1803769784] = { return Api.messages.BotResults.parse_botResults($0) } @@ -402,13 +402,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) } dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) } dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) } - dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) } - dict[2072935910] = { return Api.InputPeer.parse_inputPeerUser($0) } - dict[548253432] = { return Api.InputPeer.parse_inputPeerChannel($0) } - dict[398123750] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) } - dict[-1667893317] = { return Api.InputPeer.parse_inputPeerChannelFromMessage($0) } + dict[900291769] = { return Api.InputPeer.parse_inputPeerChat($0) } + dict[-571955892] = { return Api.InputPeer.parse_inputPeerUser($0) } + dict[666680316] = { return Api.InputPeer.parse_inputPeerChannel($0) } + dict[-1468331492] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) } + dict[-1121318848] = { return Api.InputPeer.parse_inputPeerChannelFromMessage($0) } dict[568808380] = { return Api.upload.WebFile.parse_webFile($0) } - dict[-116274796] = { return Api.Contact.parse_contact($0) } + dict[341499403] = { return Api.Contact.parse_contact($0) } dict[-1078332329] = { return Api.help.PassportConfig.parse_passportConfigNotModified($0) } dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) } dict[1648543603] = { return Api.FileHash.parse_fileHash($0) } @@ -429,8 +429,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[195371015] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowContacts($0) } dict[-697604407] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowAll($0) } dict[-1877932953] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowUsers($0) } - dict[1283572154] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowChatParticipants($0) } - dict[-668769361] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowChatParticipants($0) } + dict[-2079962673] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowChatParticipants($0) } + dict[-380694650] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowChatParticipants($0) } dict[-1058912715] = { return Api.messages.DhConfig.parse_dhConfigNotModified($0) } dict[740433629] = { return Api.messages.DhConfig.parse_dhConfig($0) } dict[-421545947] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeTitle($0) } @@ -451,7 +451,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1599903217] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionTogglePreHistoryHidden($0) } dict[771095562] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionDefaultBannedRights($0) } dict[-1895328189] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStopPoll($0) } - dict[-1569748965] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLinkedChat($0) } + dict[84703944] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLinkedChat($0) } dict[241923758] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLocation($0) } dict[1401984889] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleSlowMode($0) } dict[589338437] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStartGroupCall($0) } @@ -466,7 +466,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1048537159] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantVolume($0) } dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) } dict[-26672755] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeTheme($0) } - dict[-543777747] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) } + dict[-1271602504] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) } dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) } dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) } dict[-1269012015] = { return Api.messages.AffectedHistory.parse_affectedHistory($0) } @@ -501,7 +501,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) } dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) } dict[-1014526429] = { return Api.help.Country.parse_country($0) } - dict[418631927] = { return Api.StatsGroupTopPoster.parse_statsGroupTopPoster($0) } + dict[-1660637285] = { return Api.StatsGroupTopPoster.parse_statsGroupTopPoster($0) } dict[-2128640689] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) } dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) } dict[1248893260] = { return Api.EncryptedFile.parse_encryptedFile($0) } @@ -537,7 +537,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-2049074735] = { return Api.ReplyMarkup.parse_replyKeyboardMarkup($0) } dict[1218642516] = { return Api.ReplyMarkup.parse_replyInlineMarkup($0) } dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) } - dict[1493171408] = { return Api.HighScore.parse_highScore($0) } + dict[1940093419] = { return Api.HighScore.parse_highScore($0) } dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) } dict[-1495959709] = { return Api.MessageReplyHeader.parse_messageReplyHeader($0) } dict[411017418] = { return Api.SecureValue.parse_secureValue($0) } @@ -549,8 +549,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-386039788] = { return Api.PeerBlocked.parse_peerBlocked($0) } dict[-1182234929] = { return Api.InputUser.parse_inputUserEmpty($0) } dict[-138301121] = { return Api.InputUser.parse_inputUserSelf($0) } - dict[-668391402] = { return Api.InputUser.parse_inputUser($0) } - dict[756118935] = { return Api.InputUser.parse_inputUserFromMessage($0) } + dict[-233744186] = { return Api.InputUser.parse_inputUser($0) } + dict[497305826] = { return Api.InputUser.parse_inputUserFromMessage($0) } dict[-1738178803] = { return Api.Page.parse_page($0) } dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) } dict[-875679776] = { return Api.StatsPercentValue.parse_statsPercentValue($0) } @@ -574,12 +574,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) } dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) } dict[-193506890] = { return Api.phone.GroupParticipants.parse_groupParticipants($0) } - dict[507405952] = { return Api.ChatInviteImporter.parse_chatInviteImporter($0) } + dict[190633460] = { return Api.ChatInviteImporter.parse_chatInviteImporter($0) } dict[-2066640507] = { return Api.messages.AffectedMessages.parse_affectedMessages($0) } dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($0) } - dict[772213157] = { return Api.messages.SavedGifs.parse_savedGifs($0) } + dict[-2069878259] = { return Api.messages.SavedGifs.parse_savedGifs($0) } dict[-914167110] = { return Api.CdnPublicKey.parse_cdnPublicKey($0) } - dict[1093204652] = { return Api.MessageReplies.parse_messageReplies($0) } + dict[-2083123262] = { return Api.MessageReplies.parse_messageReplies($0) } dict[53231223] = { return Api.InputGame.parse_inputGameID($0) } dict[-1020139510] = { return Api.InputGame.parse_inputGameShortName($0) } dict[1107543535] = { return Api.help.CountryCode.parse_countryCode($0) } @@ -618,8 +618,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1387279939] = { return Api.MessageInteractionCounters.parse_messageInteractionCounters($0) } dict[-1107852396] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) } dict[-484987010] = { return Api.Updates.parse_updatesTooLong($0) } - dict[-84936653] = { return Api.Updates.parse_updateShortMessage($0) } - dict[290961496] = { return Api.Updates.parse_updateShortChatMessage($0) } + dict[826001400] = { return Api.Updates.parse_updateShortMessage($0) } + dict[1299050149] = { return Api.Updates.parse_updateShortChatMessage($0) } dict[2027216577] = { return Api.Updates.parse_updateShort($0) } dict[1918567619] = { return Api.Updates.parse_updatesCombined($0) } dict[1957577280] = { return Api.Updates.parse_updates($0) } @@ -629,7 +629,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) } dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) } dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) } - dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) } + dict[1882335561] = { return Api.MessageMedia.parse_messageMediaContact($0) } dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) } dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) } dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) } @@ -656,8 +656,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[935395612] = { return Api.ChatPhoto.parse_chatPhotoEmpty($0) } dict[476978193] = { return Api.ChatPhoto.parse_chatPhoto($0) } dict[1869903447] = { return Api.PageCaption.parse_pageCaption($0) } - dict[-1928649707] = { return Api.payments.PaymentForm.parse_paymentForm($0) } - dict[280319440] = { return Api.payments.PaymentReceipt.parse_paymentReceipt($0) } + dict[378828315] = { return Api.payments.PaymentForm.parse_paymentForm($0) } + dict[1891958275] = { return Api.payments.PaymentReceipt.parse_paymentReceipt($0) } dict[863093588] = { return Api.messages.PeerDialogs.parse_peerDialogs($0) } dict[-1831650802] = { return Api.UrlAuthResult.parse_urlAuthResultRequest($0) } dict[-1886646706] = { return Api.UrlAuthResult.parse_urlAuthResultAccepted($0) } @@ -668,17 +668,17 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[42402760] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmoji($0) } dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) } dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) } - dict[-1729618630] = { return Api.BotInfo.parse_botInfo($0) } + dict[460632885] = { return Api.BotInfo.parse_botInfo($0) } dict[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) } dict[-1519637954] = { return Api.updates.State.parse_state($0) } - dict[537022650] = { return Api.User.parse_userEmpty($0) } - dict[-1820043071] = { return Api.User.parse_user($0) } + dict[-742634630] = { return Api.User.parse_userEmpty($0) } + dict[1073147056] = { return Api.User.parse_user($0) } dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) } - dict[-1125940270] = { return Api.Message.parse_message($0) } + dict[-2049520670] = { return Api.Message.parse_message($0) } dict[721967202] = { return Api.Message.parse_messageService($0) } - dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) } + dict[1398765469] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) } dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) } - dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) } + dict[-1999405994] = { return Api.messages.RecentStickers.parse_recentStickers($0) } dict[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) } dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) } dict[-1160743548] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) } @@ -694,8 +694,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) } dict[541839704] = { return Api.phone.ExportedGroupCallInvite.parse_exportedGroupCallInvite($0) } dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) } - dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) } - dict[1061556205] = { return Api.ChatParticipants.parse_chatParticipants($0) } + dict[-2023500831] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) } + dict[1018991608] = { return Api.ChatParticipants.parse_chatParticipants($0) } dict[1949890536] = { return Api.DialogFilter.parse_dialogFilter($0) } dict[-1056001329] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsSaved($0) } dict[873977640] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentials($0) } @@ -715,7 +715,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[70813275] = { return Api.InputStickeredMedia.parse_inputStickeredMediaDocument($0) } dict[1421174295] = { return Api.WebPageAttribute.parse_webPageAttributeTheme($0) } dict[-958657434] = { return Api.messages.FeaturedStickers.parse_featuredStickersNotModified($0) } - dict[-1230257343] = { return Api.messages.FeaturedStickers.parse_featuredStickers($0) } + dict[-2067782896] = { return Api.messages.FeaturedStickers.parse_featuredStickers($0) } dict[-318022605] = { return Api.ChatTheme.parse_chatTheme($0) } dict[-2048646399] = { return Api.PhoneCallDiscardReason.parse_phoneCallDiscardReasonMissed($0) } dict[-527056480] = { return Api.PhoneCallDiscardReason.parse_phoneCallDiscardReasonDisconnect($0) } @@ -728,7 +728,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[2010127419] = { return Api.contacts.ImportedContacts.parse_importedContacts($0) } dict[-1678949555] = { return Api.InputWebDocument.parse_inputWebDocument($0) } dict[-326966976] = { return Api.phone.PhoneCall.parse_phoneCall($0) } - dict[995769920] = { return Api.ChannelAdminLogEvent.parse_channelAdminLogEvent($0) } + dict[531458253] = { return Api.ChannelAdminLogEvent.parse_channelAdminLogEvent($0) } dict[-1132882121] = { return Api.Bool.parse_boolFalse($0) } dict[-1720552011] = { return Api.Bool.parse_boolTrue($0) } dict[-892239370] = { return Api.LangPackString.parse_langPackString($0) } @@ -779,13 +779,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[894081801] = { return Api.BotInlineMessage.parse_botInlineMessageMediaInvoice($0) } dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) } dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) } - dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) } - dict[1847917725] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) } + dict[750063767] = { return Api.messages.FavedStickers.parse_favedStickers($0) } + dict[-1316944408] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) } dict[-1389486888] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) } dict[-1392388579] = { return Api.Authorization.parse_authorization($0) } dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) } dict[-395967805] = { return Api.messages.AllStickers.parse_allStickersNotModified($0) } - dict[-302170017] = { return Api.messages.AllStickers.parse_allStickers($0) } + dict[-843329861] = { return Api.messages.AllStickers.parse_allStickers($0) } dict[-1655957568] = { return Api.PhoneConnection.parse_phoneConnection($0) } dict[1667228533] = { return Api.PhoneConnection.parse_phoneConnectionWebrtc($0) } dict[-206688531] = { return Api.help.UserInfo.parse_userInfoEmpty($0) } @@ -814,23 +814,23 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1352683077] = { return Api.account.PrivacyRules.parse_privacyRules($0) } dict[-123988] = { return Api.PrivacyRule.parse_privacyValueAllowContacts($0) } dict[1698855810] = { return Api.PrivacyRule.parse_privacyValueAllowAll($0) } - dict[1297858060] = { return Api.PrivacyRule.parse_privacyValueAllowUsers($0) } + dict[-1198497870] = { return Api.PrivacyRule.parse_privacyValueAllowUsers($0) } dict[-125240806] = { return Api.PrivacyRule.parse_privacyValueDisallowContacts($0) } dict[-1955338397] = { return Api.PrivacyRule.parse_privacyValueDisallowAll($0) } - dict[209668535] = { return Api.PrivacyRule.parse_privacyValueDisallowUsers($0) } - dict[415136107] = { return Api.PrivacyRule.parse_privacyValueAllowChatParticipants($0) } - dict[-1397881200] = { return Api.PrivacyRule.parse_privacyValueDisallowChatParticipants($0) } + dict[-463335103] = { return Api.PrivacyRule.parse_privacyValueDisallowUsers($0) } + dict[1796427406] = { return Api.PrivacyRule.parse_privacyValueAllowChatParticipants($0) } + dict[1103656293] = { return Api.PrivacyRule.parse_privacyValueDisallowChatParticipants($0) } dict[-1230047312] = { return Api.MessageAction.parse_messageActionEmpty($0) } - dict[-1503425638] = { return Api.MessageAction.parse_messageActionChatCreate($0) } + dict[-1119368275] = { return Api.MessageAction.parse_messageActionChatCreate($0) } dict[-1247687078] = { return Api.MessageAction.parse_messageActionChatEditTitle($0) } dict[2144015272] = { return Api.MessageAction.parse_messageActionChatEditPhoto($0) } dict[-1780220945] = { return Api.MessageAction.parse_messageActionChatDeletePhoto($0) } - dict[1217033015] = { return Api.MessageAction.parse_messageActionChatAddUser($0) } - dict[-1297179892] = { return Api.MessageAction.parse_messageActionChatDeleteUser($0) } - dict[-123931160] = { return Api.MessageAction.parse_messageActionChatJoinedByLink($0) } + dict[365886720] = { return Api.MessageAction.parse_messageActionChatAddUser($0) } + dict[-1539362612] = { return Api.MessageAction.parse_messageActionChatDeleteUser($0) } + dict[51520707] = { return Api.MessageAction.parse_messageActionChatJoinedByLink($0) } dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) } - dict[1371385889] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) } - dict[-1336546578] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) } + dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) } + dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) } dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) } dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) } dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) } @@ -845,15 +845,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-202219658] = { return Api.MessageAction.parse_messageActionContactSignUp($0) } dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) } dict[2047704898] = { return Api.MessageAction.parse_messageActionGroupCall($0) } - dict[1991897370] = { return Api.MessageAction.parse_messageActionInviteToGroupCall($0) } + dict[1345295095] = { return Api.MessageAction.parse_messageActionInviteToGroupCall($0) } dict[-1441072131] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) } dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) } dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) } dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) } - dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) } - dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) } - dict[-1719909046] = { return Api.PhoneCall.parse_phoneCallAccepted($0) } - dict[-2025673089] = { return Api.PhoneCall.parse_phoneCall($0) } + dict[-987599081] = { return Api.PhoneCall.parse_phoneCallWaiting($0) } + dict[347139340] = { return Api.PhoneCall.parse_phoneCallRequested($0) } + dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) } + dict[-1770029977] = { return Api.PhoneCall.parse_phoneCall($0) } dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) } dict[-483352705] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdateEmpty($0) } dict[686618977] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdate($0) } @@ -868,6 +868,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1917524116] = { return Api.ThemeSettings.parse_themeSettings($0) } dict[-1353671392] = { return Api.PeerNotifySettings.parse_peerNotifySettings($0) } dict[-1995686519] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID($0) } + dict[-1227287081] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID64($0) } dict[-1282352120] = { return Api.PageRelatedArticle.parse_pageRelatedArticle($0) } dict[313694676] = { return Api.StickerPack.parse_stickerPack($0) } dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) } @@ -892,7 +893,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[681706865] = { return Api.MessageEntity.parse_messageEntityCode($0) } dict[1938967520] = { return Api.MessageEntity.parse_messageEntityPre($0) } dict[1990644519] = { return Api.MessageEntity.parse_messageEntityTextUrl($0) } - dict[892193368] = { return Api.MessageEntity.parse_messageEntityMentionName($0) } + dict[-595914432] = { return Api.MessageEntity.parse_messageEntityMentionName($0) } dict[546203849] = { return Api.MessageEntity.parse_inputMessageEntityMentionName($0) } dict[-1687559349] = { return Api.MessageEntity.parse_messageEntityPhone($0) } dict[1280209983] = { return Api.MessageEntity.parse_messageEntityCashtag($0) } @@ -912,17 +913,17 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1577484359] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) } dict[-1730311882] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) } dict[-1417756512] = { return Api.EncryptedChat.parse_encryptedChatEmpty($0) } - dict[1006044124] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) } - dict[1651608194] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) } - dict[-94974410] = { return Api.EncryptedChat.parse_encryptedChat($0) } + dict[1722964307] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) } + dict[1223809356] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) } + dict[1643173063] = { return Api.EncryptedChat.parse_encryptedChat($0) } dict[505183301] = { return Api.EncryptedChat.parse_encryptedChatDiscarded($0) } dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) } dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) } dict[922273905] = { return Api.Document.parse_documentEmpty($0) } dict[512177195] = { 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) } + dict[-1493633966] = { return Api.WebAuthorization.parse_webAuthorization($0) } + dict[-1052885936] = { return Api.ImportedContact.parse_importedContact($0) } dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) } return dict }() diff --git a/submodules/TelegramApi/Sources/Api1.swift b/submodules/TelegramApi/Sources/Api1.swift index d4a842370f..288997a593 100644 --- a/submodules/TelegramApi/Sources/Api1.swift +++ b/submodules/TelegramApi/Sources/Api1.swift @@ -368,7 +368,7 @@ public struct messages { } public enum Stickers: TypeConstructorDescription { case stickersNotModified - case stickers(hash: Int32, stickers: [Api.Document]) + case stickers(hash: Int64, stickers: [Api.Document]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -380,9 +380,9 @@ public struct messages { break case .stickers(let hash, let stickers): if boxed { - buffer.appendInt32(-463889475) + buffer.appendInt32(816245886) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(stickers.count)) for item in stickers { @@ -405,8 +405,8 @@ public struct messages { return Api.messages.Stickers.stickersNotModified } public static func parse_stickers(_ reader: BufferReader) -> Stickers? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.Document]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) @@ -424,7 +424,7 @@ public struct messages { } public enum FoundStickerSets: TypeConstructorDescription { case foundStickerSetsNotModified - case foundStickerSets(hash: Int32, sets: [Api.StickerSetCovered]) + case foundStickerSets(hash: Int64, sets: [Api.StickerSetCovered]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -436,9 +436,9 @@ public struct messages { break case .foundStickerSets(let hash, let sets): if boxed { - buffer.appendInt32(1359533640) + buffer.appendInt32(-1963942446) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(sets.count)) for item in sets { @@ -461,8 +461,8 @@ public struct messages { return Api.messages.FoundStickerSets.foundStickerSetsNotModified } public static func parse_foundStickerSets(_ reader: BufferReader) -> FoundStickerSets? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.StickerSetCovered]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self) @@ -1286,7 +1286,7 @@ public struct messages { } public enum SavedGifs: TypeConstructorDescription { case savedGifsNotModified - case savedGifs(hash: Int32, gifs: [Api.Document]) + case savedGifs(hash: Int64, gifs: [Api.Document]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -1298,9 +1298,9 @@ public struct messages { break case .savedGifs(let hash, let gifs): if boxed { - buffer.appendInt32(772213157) + buffer.appendInt32(-2069878259) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(gifs.count)) for item in gifs { @@ -1323,8 +1323,8 @@ public struct messages { return Api.messages.SavedGifs.savedGifsNotModified } public static func parse_savedGifs(_ reader: BufferReader) -> SavedGifs? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.Document]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) @@ -1852,7 +1852,7 @@ public struct messages { } public enum RecentStickers: TypeConstructorDescription { case recentStickersNotModified - case recentStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32]) + case recentStickers(hash: Int64, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -1864,9 +1864,9 @@ public struct messages { break case .recentStickers(let hash, let packs, let stickers, let dates): if boxed { - buffer.appendInt32(586395571) + buffer.appendInt32(-1999405994) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(packs.count)) for item in packs { @@ -1899,8 +1899,8 @@ public struct messages { return Api.messages.RecentStickers.recentStickersNotModified } public static func parse_recentStickers(_ reader: BufferReader) -> RecentStickers? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.StickerPack]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self) @@ -1928,7 +1928,7 @@ public struct messages { } public enum FeaturedStickers: TypeConstructorDescription { case featuredStickersNotModified(count: Int32) - case featuredStickers(hash: Int32, count: Int32, sets: [Api.StickerSetCovered], unread: [Int64]) + case featuredStickers(hash: Int64, count: Int32, sets: [Api.StickerSetCovered], unread: [Int64]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -1940,9 +1940,9 @@ public struct messages { break case .featuredStickers(let hash, let count, let sets, let unread): if boxed { - buffer.appendInt32(-1230257343) + buffer.appendInt32(-2067782896) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) serializeInt32(count, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(sets.count)) @@ -1979,8 +1979,8 @@ public struct messages { } } public static func parse_featuredStickers(_ reader: BufferReader) -> FeaturedStickers? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: [Api.StickerSetCovered]? @@ -2156,7 +2156,7 @@ public struct messages { } public enum FavedStickers: TypeConstructorDescription { case favedStickersNotModified - case favedStickers(hash: Int32, packs: [Api.StickerPack], stickers: [Api.Document]) + case favedStickers(hash: Int64, packs: [Api.StickerPack], stickers: [Api.Document]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -2168,9 +2168,9 @@ public struct messages { break case .favedStickers(let hash, let packs, let stickers): if boxed { - buffer.appendInt32(-209768682) + buffer.appendInt32(750063767) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(packs.count)) for item in packs { @@ -2198,8 +2198,8 @@ public struct messages { return Api.messages.FavedStickers.favedStickersNotModified } public static func parse_favedStickers(_ reader: BufferReader) -> FavedStickers? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.StickerPack]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self) @@ -2222,7 +2222,7 @@ public struct messages { } public enum AllStickers: TypeConstructorDescription { case allStickersNotModified - case allStickers(hash: Int32, sets: [Api.StickerSet]) + case allStickers(hash: Int64, sets: [Api.StickerSet]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -2234,9 +2234,9 @@ public struct messages { break case .allStickers(let hash, let sets): if boxed { - buffer.appendInt32(-302170017) + buffer.appendInt32(-843329861) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(sets.count)) for item in sets { @@ -2259,8 +2259,8 @@ public struct messages { return Api.messages.AllStickers.allStickersNotModified } public static func parse_allStickers(_ reader: BufferReader) -> AllStickers? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.StickerSet]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSet.self) diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift index bb90f1e4f4..219e684a9f 100644 --- a/submodules/TelegramApi/Sources/Api2.swift +++ b/submodules/TelegramApi/Sources/Api2.swift @@ -160,17 +160,17 @@ public extension Api { } public enum ChatFull: TypeConstructorDescription { - case chatFull(flags: Int32, id: Int32, about: String, participants: Api.ChatParticipants, chatPhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo]?, pinnedMsgId: Int32?, folderId: Int32?, call: Api.InputGroupCall?, ttlPeriod: Int32?, groupcallDefaultJoinAs: Api.Peer?, themeEmoticon: String?) - case channelFull(flags: Int32, id: Int32, about: String, participantsCount: Int32?, adminsCount: Int32?, kickedCount: Int32?, bannedCount: Int32?, onlineCount: Int32?, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo], migratedFromChatId: Int32?, migratedFromMaxId: Int32?, pinnedMsgId: Int32?, stickerset: Api.StickerSet?, availableMinId: Int32?, folderId: Int32?, linkedChatId: Int32?, location: Api.ChannelLocation?, slowmodeSeconds: Int32?, slowmodeNextSendDate: Int32?, statsDc: Int32?, pts: Int32, call: Api.InputGroupCall?, ttlPeriod: Int32?, pendingSuggestions: [String]?, groupcallDefaultJoinAs: Api.Peer?, themeEmoticon: String?) + case chatFull(flags: Int32, id: Int64, about: String, participants: Api.ChatParticipants, chatPhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo]?, pinnedMsgId: Int32?, folderId: Int32?, call: Api.InputGroupCall?, ttlPeriod: Int32?, groupcallDefaultJoinAs: Api.Peer?, themeEmoticon: String?) + case channelFull(flags: Int32, id: Int64, about: String, participantsCount: Int32?, adminsCount: Int32?, kickedCount: Int32?, bannedCount: Int32?, onlineCount: Int32?, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo], migratedFromChatId: Int64?, migratedFromMaxId: Int32?, pinnedMsgId: Int32?, stickerset: Api.StickerSet?, availableMinId: Int32?, folderId: Int32?, linkedChatId: Int64?, location: Api.ChannelLocation?, slowmodeSeconds: Int32?, slowmodeNextSendDate: Int32?, statsDc: Int32?, pts: Int32, call: Api.InputGroupCall?, ttlPeriod: Int32?, pendingSuggestions: [String]?, groupcallDefaultJoinAs: Api.Peer?, themeEmoticon: String?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatFull(let flags, let id, let about, let participants, let chatPhoto, let notifySettings, let exportedInvite, let botInfo, let pinnedMsgId, let folderId, let call, let ttlPeriod, let groupcallDefaultJoinAs, let themeEmoticon): if boxed { - buffer.appendInt32(1235264985) + buffer.appendInt32(1304281241) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(about, buffer: buffer, boxed: false) participants.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {chatPhoto!.serialize(buffer, true)} @@ -190,10 +190,10 @@ public extension Api { break case .channelFull(let flags, let id, let about, let participantsCount, let adminsCount, let kickedCount, let bannedCount, let onlineCount, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chatPhoto, let notifySettings, let exportedInvite, let botInfo, let migratedFromChatId, let migratedFromMaxId, let pinnedMsgId, let stickerset, let availableMinId, let folderId, let linkedChatId, let location, let slowmodeSeconds, let slowmodeNextSendDate, let statsDc, let pts, let call, let ttlPeriod, let pendingSuggestions, let groupcallDefaultJoinAs, let themeEmoticon): if boxed { - buffer.appendInt32(793980732) + buffer.appendInt32(-374179305) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(about, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(participantsCount!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeInt32(adminsCount!, buffer: buffer, boxed: false)} @@ -211,13 +211,13 @@ public extension Api { for item in botInfo { item.serialize(buffer, true) } - if Int(flags) & Int(1 << 4) != 0 {serializeInt32(migratedFromChatId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 4) != 0 {serializeInt64(migratedFromChatId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 4) != 0 {serializeInt32(migratedFromMaxId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 5) != 0 {serializeInt32(pinnedMsgId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 8) != 0 {stickerset!.serialize(buffer, true)} if Int(flags) & Int(1 << 9) != 0 {serializeInt32(availableMinId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 11) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)} - if Int(flags) & Int(1 << 14) != 0 {serializeInt32(linkedChatId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 14) != 0 {serializeInt64(linkedChatId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 15) != 0 {location!.serialize(buffer, true)} if Int(flags) & Int(1 << 17) != 0 {serializeInt32(slowmodeSeconds!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 18) != 0 {serializeInt32(slowmodeNextSendDate!, buffer: buffer, boxed: false)} @@ -248,8 +248,8 @@ public extension Api { public static func parse_chatFull(_ reader: BufferReader) -> ChatFull? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Api.ChatParticipants? @@ -312,8 +312,8 @@ public extension Api { public static func parse_channelFull(_ reader: BufferReader) -> ChatFull? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Int32? @@ -348,8 +348,8 @@ public extension Api { if let _ = reader.readInt32() { _15 = Api.parseVector(reader, elementSignature: 0, elementType: Api.BotInfo.self) } - var _16: Int32? - if Int(_1!) & Int(1 << 4) != 0 {_16 = reader.readInt32() } + var _16: Int64? + if Int(_1!) & Int(1 << 4) != 0 {_16 = reader.readInt64() } var _17: Int32? if Int(_1!) & Int(1 << 4) != 0 {_17 = reader.readInt32() } var _18: Int32? @@ -362,8 +362,8 @@ public extension Api { if Int(_1!) & Int(1 << 9) != 0 {_20 = reader.readInt32() } var _21: Int32? if Int(_1!) & Int(1 << 11) != 0 {_21 = reader.readInt32() } - var _22: Int32? - if Int(_1!) & Int(1 << 14) != 0 {_22 = reader.readInt32() } + var _22: Int64? + if Int(_1!) & Int(1 << 14) != 0 {_22 = reader.readInt64() } var _23: Api.ChannelLocation? if Int(_1!) & Int(1 << 15) != 0 {if let signature = reader.readInt32() { _23 = Api.parse(reader, signature: signature) as? Api.ChannelLocation @@ -434,13 +434,13 @@ public extension Api { } public enum PollResults: TypeConstructorDescription { - case pollResults(flags: Int32, results: [Api.PollAnswerVoters]?, totalVoters: Int32?, recentVoters: [Int32]?, solution: String?, solutionEntities: [Api.MessageEntity]?) + case pollResults(flags: Int32, results: [Api.PollAnswerVoters]?, totalVoters: Int32?, recentVoters: [Int64]?, solution: String?, solutionEntities: [Api.MessageEntity]?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .pollResults(let flags, let results, let totalVoters, let recentVoters, let solution, let solutionEntities): if boxed { - buffer.appendInt32(-1159937629) + buffer.appendInt32(-591909213) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261) @@ -452,7 +452,7 @@ public extension Api { if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(recentVoters!.count)) for item in recentVoters! { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) }} if Int(flags) & Int(1 << 4) != 0 {serializeString(solution!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261) @@ -480,9 +480,9 @@ public extension Api { } } var _3: Int32? if Int(_1!) & Int(1 << 2) != 0 {_3 = reader.readInt32() } - var _4: [Int32]? + var _4: [Int64]? if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _4 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } } var _5: String? if Int(_1!) & Int(1 << 4) != 0 {_5 = parseString(reader) } @@ -506,32 +506,32 @@ public extension Api { } public enum ChatParticipant: TypeConstructorDescription { - case chatParticipant(userId: Int32, inviterId: Int32, date: Int32) - case chatParticipantCreator(userId: Int32) - case chatParticipantAdmin(userId: Int32, inviterId: Int32, date: Int32) + case chatParticipant(userId: Int64, inviterId: Int64, date: Int32) + case chatParticipantCreator(userId: Int64) + case chatParticipantAdmin(userId: Int64, inviterId: Int64, date: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatParticipant(let userId, let inviterId, let date): if boxed { - buffer.appendInt32(-925415106) + buffer.appendInt32(-1070776313) } - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .chatParticipantCreator(let userId): if boxed { - buffer.appendInt32(-636267638) + buffer.appendInt32(-462696732) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .chatParticipantAdmin(let userId, let inviterId, let date): if boxed { - buffer.appendInt32(-489233354) + buffer.appendInt32(-1600962725) } - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break } @@ -549,10 +549,10 @@ public extension Api { } public static func parse_chatParticipant(_ reader: BufferReader) -> ChatParticipant? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -566,8 +566,8 @@ public extension Api { } } public static func parse_chatParticipantCreator(_ reader: BufferReader) -> ChatParticipant? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.ChatParticipant.chatParticipantCreator(userId: _1!) @@ -577,10 +577,10 @@ public extension Api { } } public static func parse_chatParticipantAdmin(_ reader: BufferReader) -> ChatParticipant? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -1752,26 +1752,26 @@ public extension Api { } public enum Chat: TypeConstructorDescription { - case chatEmpty(id: Int32) - case chat(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?) - case chatForbidden(id: Int32, title: String) - case channel(flags: Int32, id: Int32, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, version: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?) - case channelForbidden(flags: Int32, id: Int32, accessHash: Int64, title: String, untilDate: Int32?) + case chatEmpty(id: Int64) + case chat(flags: Int32, id: Int64, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?) + case chatForbidden(id: Int64, title: String) + case channel(flags: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?) + case channelForbidden(flags: Int32, id: Int64, accessHash: Int64, title: String, untilDate: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatEmpty(let id): if boxed { - buffer.appendInt32(-1683826688) + buffer.appendInt32(693512293) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) break case .chat(let flags, let id, let title, let photo, let participantsCount, let date, let version, let migratedTo, let adminRights, let defaultBannedRights): if boxed { - buffer.appendInt32(1004149726) + buffer.appendInt32(1103884886) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) photo.serialize(buffer, true) serializeInt32(participantsCount, buffer: buffer, boxed: false) @@ -1783,23 +1783,22 @@ public extension Api { break case .chatForbidden(let id, let title): if boxed { - buffer.appendInt32(120753115) + buffer.appendInt32(1704108455) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(title, 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 defaultBannedRights, let participantsCount): + case .channel(let flags, let id, let accessHash, let title, let username, let photo, let date, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount): if boxed { - buffer.appendInt32(-753232354) + buffer.appendInt32(-2107528095) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 13) != 0 {serializeInt64(accessHash!, buffer: buffer, boxed: false)} serializeString(title, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 6) != 0 {serializeString(username!, buffer: buffer, boxed: false)} photo.serialize(buffer, true) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(version, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 9) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(restrictionReason!.count)) for item in restrictionReason! { @@ -1812,10 +1811,10 @@ public extension Api { break case .channelForbidden(let flags, let id, let accessHash, let title, let untilDate): if boxed { - buffer.appendInt32(681420594) + buffer.appendInt32(399807445) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 16) != 0 {serializeInt32(untilDate!, buffer: buffer, boxed: false)} @@ -1831,16 +1830,16 @@ public extension Api { return ("chat", [("flags", flags), ("id", id), ("title", title), ("photo", photo), ("participantsCount", participantsCount), ("date", date), ("version", version), ("migratedTo", migratedTo), ("adminRights", adminRights), ("defaultBannedRights", defaultBannedRights)]) case .chatForbidden(let id, let title): return ("chatForbidden", [("id", id), ("title", title)]) - 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 defaultBannedRights, let participantsCount): - return ("channel", [("flags", flags), ("id", id), ("accessHash", accessHash), ("title", title), ("username", username), ("photo", photo), ("date", date), ("version", version), ("restrictionReason", restrictionReason), ("adminRights", adminRights), ("bannedRights", bannedRights), ("defaultBannedRights", defaultBannedRights), ("participantsCount", participantsCount)]) + case .channel(let flags, let id, let accessHash, let title, let username, let photo, let date, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount): + return ("channel", [("flags", flags), ("id", id), ("accessHash", accessHash), ("title", title), ("username", username), ("photo", photo), ("date", date), ("restrictionReason", restrictionReason), ("adminRights", adminRights), ("bannedRights", bannedRights), ("defaultBannedRights", defaultBannedRights), ("participantsCount", participantsCount)]) case .channelForbidden(let flags, let id, let accessHash, let title, let untilDate): return ("channelForbidden", [("flags", flags), ("id", id), ("accessHash", accessHash), ("title", title), ("untilDate", untilDate)]) } } public static func parse_chatEmpty(_ reader: BufferReader) -> Chat? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Chat.chatEmpty(id: _1!) @@ -1852,8 +1851,8 @@ public extension Api { public static func parse_chat(_ reader: BufferReader) -> Chat? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Api.ChatPhoto? @@ -1896,8 +1895,8 @@ public extension Api { } } public static func parse_chatForbidden(_ reader: BufferReader) -> Chat? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) let _c1 = _1 != nil @@ -1912,8 +1911,8 @@ public extension Api { public static func parse_channel(_ reader: BufferReader) -> Chat? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int64? if Int(_1!) & Int(1 << 13) != 0 {_3 = reader.readInt64() } var _4: String? @@ -1926,26 +1925,24 @@ public extension Api { } var _7: Int32? _7 = reader.readInt32() - var _8: Int32? - _8 = reader.readInt32() - var _9: [Api.RestrictionReason]? + var _8: [Api.RestrictionReason]? if Int(_1!) & Int(1 << 9) != 0 {if let _ = reader.readInt32() { - _9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RestrictionReason.self) + _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RestrictionReason.self) } } - var _10: Api.ChatAdminRights? + var _9: Api.ChatAdminRights? if Int(_1!) & Int(1 << 14) != 0 {if let signature = reader.readInt32() { - _10 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights + _9 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights + } } + var _10: Api.ChatBannedRights? + if Int(_1!) & Int(1 << 15) != 0 {if let signature = reader.readInt32() { + _10 = Api.parse(reader, signature: signature) as? Api.ChatBannedRights } } var _11: Api.ChatBannedRights? - if Int(_1!) & Int(1 << 15) != 0 {if let signature = reader.readInt32() { + if Int(_1!) & Int(1 << 18) != 0 {if let signature = reader.readInt32() { _11 = Api.parse(reader, signature: signature) as? Api.ChatBannedRights } } - var _12: Api.ChatBannedRights? - if Int(_1!) & Int(1 << 18) != 0 {if let signature = reader.readInt32() { - _12 = Api.parse(reader, signature: signature) as? Api.ChatBannedRights - } } - var _13: Int32? - if Int(_1!) & Int(1 << 17) != 0 {_13 = reader.readInt32() } + var _12: Int32? + if Int(_1!) & Int(1 << 17) != 0 {_12 = reader.readInt32() } let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = (Int(_1!) & Int(1 << 13) == 0) || _3 != nil @@ -1953,14 +1950,13 @@ public extension Api { let _c5 = (Int(_1!) & Int(1 << 6) == 0) || _5 != nil let _c6 = _6 != nil let _c7 = _7 != nil - let _c8 = _8 != nil - let _c9 = (Int(_1!) & Int(1 << 9) == 0) || _9 != nil - 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 << 18) == 0) || _12 != nil - let _c13 = (Int(_1!) & Int(1 << 17) == 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, defaultBannedRights: _12, participantsCount: _13) + let _c8 = (Int(_1!) & Int(1 << 9) == 0) || _8 != nil + let _c9 = (Int(_1!) & Int(1 << 14) == 0) || _9 != nil + let _c10 = (Int(_1!) & Int(1 << 15) == 0) || _10 != nil + let _c11 = (Int(_1!) & Int(1 << 18) == 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!, restrictionReason: _8, adminRights: _9, bannedRights: _10, defaultBannedRights: _11, participantsCount: _12) } else { return nil @@ -1969,8 +1965,8 @@ public extension Api { public static func parse_channelForbidden(_ reader: BufferReader) -> Chat? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int64? _3 = reader.readInt64() var _4: String? @@ -2331,8 +2327,8 @@ public extension Api { } public enum RecentMeUrl: TypeConstructorDescription { case recentMeUrlUnknown(url: String) - case recentMeUrlUser(url: String, userId: Int32) - case recentMeUrlChat(url: String, chatId: Int32) + case recentMeUrlUser(url: String, userId: Int64) + case recentMeUrlChat(url: String, chatId: Int64) case recentMeUrlChatInvite(url: String, chatInvite: Api.ChatInvite) case recentMeUrlStickerSet(url: String, set: Api.StickerSetCovered) @@ -2346,17 +2342,17 @@ public extension Api { break case .recentMeUrlUser(let url, let userId): if boxed { - buffer.appendInt32(-1917045962) + buffer.appendInt32(-1188296222) } serializeString(url, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .recentMeUrlChat(let url, let chatId): if boxed { - buffer.appendInt32(-1608834311) + buffer.appendInt32(-1294306862) } serializeString(url, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .recentMeUrlChatInvite(let url, let chatInvite): if boxed { @@ -2404,8 +2400,8 @@ public extension Api { public static func parse_recentMeUrlUser(_ reader: BufferReader) -> RecentMeUrl? { var _1: String? _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -2418,8 +2414,8 @@ public extension Api { public static func parse_recentMeUrlChat(_ reader: BufferReader) -> RecentMeUrl? { var _1: String? _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -2979,8 +2975,8 @@ public extension Api { } public enum InputChannel: TypeConstructorDescription { case inputChannelEmpty - case inputChannel(channelId: Int32, accessHash: Int64) - case inputChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int32) + case inputChannel(channelId: Int64, accessHash: Int64) + case inputChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -2992,18 +2988,18 @@ public extension Api { break case .inputChannel(let channelId, let accessHash): if boxed { - buffer.appendInt32(-1343524562) + buffer.appendInt32(-212145112) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputChannelFromMessage(let peer, let msgId, let channelId): if boxed { - buffer.appendInt32(707290417) + buffer.appendInt32(1536380829) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break } } @@ -3023,8 +3019,8 @@ public extension Api { return Api.InputChannel.inputChannelEmpty } public static func parse_inputChannel(_ reader: BufferReader) -> InputChannel? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -3043,8 +3039,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -3414,15 +3410,15 @@ public extension Api { } public enum StatsGroupTopAdmin: TypeConstructorDescription { - case statsGroupTopAdmin(userId: Int32, deleted: Int32, kicked: Int32, banned: Int32) + case statsGroupTopAdmin(userId: Int64, deleted: Int32, kicked: Int32, banned: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .statsGroupTopAdmin(let userId, let deleted, let kicked, let banned): if boxed { - buffer.appendInt32(1611985938) + buffer.appendInt32(-682079097) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(deleted, buffer: buffer, boxed: false) serializeInt32(kicked, buffer: buffer, boxed: false) serializeInt32(banned, buffer: buffer, boxed: false) @@ -3438,8 +3434,8 @@ public extension Api { } public static func parse_statsGroupTopAdmin(_ reader: BufferReader) -> StatsGroupTopAdmin? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -3858,29 +3854,29 @@ public extension Api { } public enum Peer: TypeConstructorDescription { - case peerUser(userId: Int32) - case peerChat(chatId: Int32) - case peerChannel(channelId: Int32) + case peerUser(userId: Int64) + case peerChat(chatId: Int64) + case peerChannel(channelId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .peerUser(let userId): if boxed { - buffer.appendInt32(-1649296275) + buffer.appendInt32(1498486562) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .peerChat(let chatId): if boxed { - buffer.appendInt32(-1160714821) + buffer.appendInt32(918946202) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .peerChannel(let channelId): if boxed { - buffer.appendInt32(-1109531342) + buffer.appendInt32(-1566230754) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break } } @@ -3897,8 +3893,8 @@ public extension Api { } public static func parse_peerUser(_ reader: BufferReader) -> Peer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Peer.peerUser(userId: _1!) @@ -3908,8 +3904,8 @@ public extension Api { } } public static func parse_peerChat(_ reader: BufferReader) -> Peer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Peer.peerChat(chatId: _1!) @@ -3919,8 +3915,8 @@ public extension Api { } } public static func parse_peerChannel(_ reader: BufferReader) -> Peer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Peer.peerChannel(channelId: _1!) @@ -4633,64 +4629,64 @@ public extension Api { case updateNewMessage(message: Api.Message, pts: Int32, ptsCount: Int32) case updateMessageID(id: Int32, randomId: Int64) case updateDeleteMessages(messages: [Int32], pts: Int32, ptsCount: Int32) - case updateUserTyping(userId: Int32, action: Api.SendMessageAction) - case updateChatUserTyping(chatId: Int32, fromId: Api.Peer, action: Api.SendMessageAction) + case updateUserTyping(userId: Int64, action: Api.SendMessageAction) + case updateChatUserTyping(chatId: Int64, fromId: Api.Peer, action: Api.SendMessageAction) case updateChatParticipants(participants: Api.ChatParticipants) - case updateUserStatus(userId: Int32, status: Api.UserStatus) - case updateUserName(userId: Int32, firstName: String, lastName: String, username: String) - case updateUserPhoto(userId: Int32, date: Int32, photo: Api.UserProfilePhoto, previous: Api.Bool) + case updateUserStatus(userId: Int64, status: Api.UserStatus) + case updateUserName(userId: Int64, firstName: String, lastName: String, username: String) + case updateUserPhoto(userId: Int64, date: Int32, photo: Api.UserProfilePhoto, previous: Api.Bool) case updateNewEncryptedMessage(message: Api.EncryptedMessage, qts: Int32) case updateEncryptedChatTyping(chatId: Int32) case updateEncryption(chat: Api.EncryptedChat, date: Int32) case updateEncryptedMessagesRead(chatId: Int32, maxDate: Int32, date: Int32) - case updateChatParticipantAdd(chatId: Int32, userId: Int32, inviterId: Int32, date: Int32, version: Int32) - case updateChatParticipantDelete(chatId: Int32, userId: Int32, version: Int32) + case updateChatParticipantAdd(chatId: Int64, userId: Int64, inviterId: Int64, date: Int32, version: Int32) + case updateChatParticipantDelete(chatId: Int64, userId: Int64, version: Int32) case updateDcOptions(dcOptions: [Api.DcOption]) case updateNotifySettings(peer: Api.NotifyPeer, notifySettings: Api.PeerNotifySettings) case updateServiceNotification(flags: Int32, inboxDate: Int32?, type: String, message: String, media: Api.MessageMedia, entities: [Api.MessageEntity]) case updatePrivacy(key: Api.PrivacyKey, rules: [Api.PrivacyRule]) - case updateUserPhone(userId: Int32, phone: String) + case updateUserPhone(userId: Int64, phone: String) case updateReadHistoryInbox(flags: Int32, folderId: Int32?, peer: Api.Peer, maxId: Int32, stillUnreadCount: Int32, pts: Int32, ptsCount: Int32) case updateReadHistoryOutbox(peer: Api.Peer, maxId: Int32, pts: Int32, ptsCount: Int32) case updateWebPage(webpage: Api.WebPage, pts: Int32, ptsCount: Int32) case updateReadMessagesContents(messages: [Int32], pts: Int32, ptsCount: Int32) - case updateChannelTooLong(flags: Int32, channelId: Int32, pts: Int32?) - case updateChannel(channelId: Int32) + case updateChannelTooLong(flags: Int32, channelId: Int64, pts: Int32?) + case updateChannel(channelId: Int64) case updateNewChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32) - case updateReadChannelInbox(flags: Int32, folderId: Int32?, channelId: Int32, maxId: Int32, stillUnreadCount: Int32, pts: Int32) - case updateDeleteChannelMessages(channelId: Int32, messages: [Int32], pts: Int32, ptsCount: Int32) - case updateChannelMessageViews(channelId: Int32, id: Int32, views: Int32) - case updateChatParticipantAdmin(chatId: Int32, userId: Int32, isAdmin: Api.Bool, version: Int32) + case updateReadChannelInbox(flags: Int32, folderId: Int32?, channelId: Int64, maxId: Int32, stillUnreadCount: Int32, pts: Int32) + case updateDeleteChannelMessages(channelId: Int64, messages: [Int32], pts: Int32, ptsCount: Int32) + case updateChannelMessageViews(channelId: Int64, id: Int32, views: Int32) + case updateChatParticipantAdmin(chatId: Int64, userId: Int64, isAdmin: Api.Bool, version: Int32) case updateNewStickerSet(stickerset: Api.messages.StickerSet) case updateStickerSetsOrder(flags: Int32, order: [Int64]) case updateStickerSets case updateSavedGifs - case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int32, query: String, geo: Api.GeoPoint?, peerType: Api.InlineQueryPeerType?, offset: String) - case updateBotInlineSend(flags: Int32, userId: Int32, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?) + case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int64, query: String, geo: Api.GeoPoint?, peerType: Api.InlineQueryPeerType?, offset: String) + case updateBotInlineSend(flags: Int32, userId: Int64, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?) case updateEditChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32) - case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?) + case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int64, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?) case updateEditMessage(message: Api.Message, pts: Int32, ptsCount: Int32) - case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?) - case updateReadChannelOutbox(channelId: Int32, maxId: Int32) + case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int64, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?) + case updateReadChannelOutbox(channelId: Int64, maxId: Int32) case updateDraftMessage(peer: Api.Peer, draft: Api.DraftMessage) case updateReadFeaturedStickers case updateRecentStickers case updateConfig case updatePtsChanged - case updateChannelWebPage(channelId: Int32, webpage: Api.WebPage, pts: Int32, ptsCount: Int32) + case updateChannelWebPage(channelId: Int64, webpage: Api.WebPage, pts: Int32, ptsCount: Int32) case updateDialogPinned(flags: Int32, folderId: Int32?, peer: Api.DialogPeer) case updatePinnedDialogs(flags: Int32, folderId: Int32?, order: [Api.DialogPeer]?) 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) - case updateBotPrecheckoutQuery(flags: Int32, queryId: Int64, userId: Int32, payload: Buffer, info: Api.PaymentRequestedInfo?, shippingOptionId: String?, currency: String, totalAmount: Int64) + case updateBotShippingQuery(queryId: Int64, userId: Int64, payload: Buffer, shippingAddress: Api.PostAddress) + case updateBotPrecheckoutQuery(flags: Int32, queryId: Int64, userId: Int64, payload: Buffer, info: Api.PaymentRequestedInfo?, shippingOptionId: String?, currency: String, totalAmount: Int64) case updatePhoneCall(phoneCall: Api.PhoneCall) case updateLangPackTooLong(langCode: String) case updateLangPack(difference: Api.LangPackDifference) case updateFavedStickers - case updateChannelReadMessagesContents(channelId: Int32, messages: [Int32]) + case updateChannelReadMessagesContents(channelId: Int64, messages: [Int32]) case updateContactsReset - case updateChannelAvailableMessages(channelId: Int32, availableMinId: Int32) + case updateChannelAvailableMessages(channelId: Int64, availableMinId: Int32) case updateDialogUnreadMark(flags: Int32, peer: Api.DialogPeer) case updateMessagePoll(flags: Int32, pollId: Int64, poll: Api.Poll?, results: Api.PollResults) case updateChatDefaultBannedRights(peer: Api.Peer, defaultBannedRights: Api.ChatBannedRights, version: Int32) @@ -4702,27 +4698,27 @@ public extension Api { case updateTheme(theme: Api.Theme) case updateGeoLiveViewed(peer: Api.Peer, msgId: Int32) case updateLoginToken - case updateMessagePollVote(pollId: Int64, userId: Int32, options: [Buffer], qts: Int32) + case updateMessagePollVote(pollId: Int64, userId: Int64, options: [Buffer], qts: Int32) case updateDialogFilter(flags: Int32, id: Int32, filter: Api.DialogFilter?) case updateDialogFilterOrder(order: [Int32]) case updateDialogFilters case updatePhoneCallSignalingData(phoneCallId: Int64, data: Buffer) - case updateChannelMessageForwards(channelId: Int32, id: Int32, forwards: Int32) - case updateReadChannelDiscussionInbox(flags: Int32, channelId: Int32, topMsgId: Int32, readMaxId: Int32, broadcastId: Int32?, broadcastPost: Int32?) - case updateReadChannelDiscussionOutbox(channelId: Int32, topMsgId: Int32, readMaxId: Int32) + case updateChannelMessageForwards(channelId: Int64, id: Int32, forwards: Int32) + case updateReadChannelDiscussionInbox(flags: Int32, channelId: Int64, topMsgId: Int32, readMaxId: Int32, broadcastId: Int64?, broadcastPost: Int32?) + case updateReadChannelDiscussionOutbox(channelId: Int64, topMsgId: Int32, readMaxId: Int32) case updatePeerBlocked(peerId: Api.Peer, blocked: Api.Bool) - case updateChannelUserTyping(flags: Int32, channelId: Int32, topMsgId: Int32?, fromId: Api.Peer, action: Api.SendMessageAction) + case updateChannelUserTyping(flags: Int32, channelId: Int64, topMsgId: Int32?, fromId: Api.Peer, action: Api.SendMessageAction) case updatePinnedMessages(flags: Int32, peer: Api.Peer, messages: [Int32], pts: Int32, ptsCount: Int32) - case updatePinnedChannelMessages(flags: Int32, channelId: Int32, messages: [Int32], pts: Int32, ptsCount: Int32) - case updateChat(chatId: Int32) + case updatePinnedChannelMessages(flags: Int32, channelId: Int64, messages: [Int32], pts: Int32, ptsCount: Int32) + case updateChat(chatId: Int64) case updateGroupCallParticipants(call: Api.InputGroupCall, participants: [Api.GroupCallParticipant], version: Int32) - case updateGroupCall(chatId: Int32, call: Api.GroupCall) + case updateGroupCall(chatId: Int64, call: Api.GroupCall) case updatePeerHistoryTTL(flags: Int32, peer: Api.Peer, ttlPeriod: Int32?) - case updateChatParticipant(flags: Int32, chatId: Int32, date: Int32, actorId: Int32, userId: Int32, prevParticipant: Api.ChatParticipant?, newParticipant: Api.ChatParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) - case updateChannelParticipant(flags: Int32, channelId: Int32, date: Int32, actorId: Int32, userId: Int32, prevParticipant: Api.ChannelParticipant?, newParticipant: Api.ChannelParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) - case updateBotStopped(userId: Int32, date: Int32, stopped: Api.Bool, qts: Int32) + case updateChatParticipant(flags: Int32, chatId: Int64, date: Int32, actorId: Int64, userId: Int64, prevParticipant: Api.ChatParticipant?, newParticipant: Api.ChatParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) + case updateChannelParticipant(flags: Int32, channelId: Int64, date: Int32, actorId: Int64, userId: Int64, prevParticipant: Api.ChannelParticipant?, newParticipant: Api.ChannelParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) + case updateBotStopped(userId: Int64, date: Int32, stopped: Api.Bool, qts: Int32) case updateGroupCallConnection(flags: Int32, params: Api.DataJSON) - case updateBotCommands(peer: Api.Peer, botId: Int32, commands: [Api.BotCommand]) + case updateBotCommands(peer: Api.Peer, botId: Int64, commands: [Api.BotCommand]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -4755,16 +4751,16 @@ public extension Api { break case .updateUserTyping(let userId, let action): if boxed { - buffer.appendInt32(1548249383) + buffer.appendInt32(-1071741569) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) action.serialize(buffer, true) break case .updateChatUserTyping(let chatId, let fromId, let action): if boxed { - buffer.appendInt32(-2033525908) + buffer.appendInt32(-2092401936) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) fromId.serialize(buffer, true) action.serialize(buffer, true) break @@ -4776,25 +4772,25 @@ public extension Api { break case .updateUserStatus(let userId, let status): if boxed { - buffer.appendInt32(469489699) + buffer.appendInt32(-440534818) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) status.serialize(buffer, true) break case .updateUserName(let userId, let firstName, let lastName, let username): if boxed { - buffer.appendInt32(-1489818765) + buffer.appendInt32(-1007549728) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(firstName, buffer: buffer, boxed: false) serializeString(lastName, buffer: buffer, boxed: false) serializeString(username, buffer: buffer, boxed: false) break case .updateUserPhoto(let userId, let date, let photo, let previous): if boxed { - buffer.appendInt32(-1791935732) + buffer.appendInt32(-232290676) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) photo.serialize(buffer, true) previous.serialize(buffer, true) @@ -4829,20 +4825,20 @@ public extension Api { break case .updateChatParticipantAdd(let chatId, let userId, let inviterId, let date, let version): if boxed { - buffer.appendInt32(-364179876) + buffer.appendInt32(1037718609) } - serializeInt32(chatId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) serializeInt32(version, buffer: buffer, boxed: false) break case .updateChatParticipantDelete(let chatId, let userId, let version): if boxed { - buffer.appendInt32(1851755554) + buffer.appendInt32(-483443337) } - serializeInt32(chatId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(version, buffer: buffer, boxed: false) break case .updateDcOptions(let dcOptions): @@ -4890,9 +4886,9 @@ public extension Api { break case .updateUserPhone(let userId, let phone): if boxed { - buffer.appendInt32(314130811) + buffer.appendInt32(88680979) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(phone, buffer: buffer, boxed: false) break case .updateReadHistoryInbox(let flags, let folderId, let peer, let maxId, let stillUnreadCount, let pts, let ptsCount): @@ -4938,17 +4934,17 @@ public extension Api { break case .updateChannelTooLong(let flags, let channelId, let pts): if boxed { - buffer.appendInt32(-352032773) + buffer.appendInt32(277713951) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(pts!, buffer: buffer, boxed: false)} break case .updateChannel(let channelId): if boxed { - buffer.appendInt32(-1227598250) + buffer.appendInt32(1666927625) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break case .updateNewChannelMessage(let message, let pts, let ptsCount): if boxed { @@ -4960,20 +4956,20 @@ public extension Api { break case .updateReadChannelInbox(let flags, let folderId, let channelId, let maxId, let stillUnreadCount, let pts): if boxed { - buffer.appendInt32(856380452) + buffer.appendInt32(-1842450928) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)} - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(stillUnreadCount, buffer: buffer, boxed: false) serializeInt32(pts, buffer: buffer, boxed: false) break case .updateDeleteChannelMessages(let channelId, let messages, let pts, let ptsCount): if boxed { - buffer.appendInt32(-1015733815) + buffer.appendInt32(-1020437742) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(messages.count)) for item in messages { @@ -4984,18 +4980,18 @@ public extension Api { break case .updateChannelMessageViews(let channelId, let id, let views): if boxed { - buffer.appendInt32(-1734268085) + buffer.appendInt32(-232346616) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(views, buffer: buffer, boxed: false) break case .updateChatParticipantAdmin(let chatId, let userId, let isAdmin, let version): if boxed { - buffer.appendInt32(-1232070311) + buffer.appendInt32(-674602590) } - serializeInt32(chatId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) isAdmin.serialize(buffer, true) serializeInt32(version, buffer: buffer, boxed: false) break @@ -5030,11 +5026,11 @@ public extension Api { break case .updateBotInlineQuery(let flags, let queryId, let userId, let query, let geo, let peerType, let offset): if boxed { - buffer.appendInt32(1059076315) + buffer.appendInt32(1232025500) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(query, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {geo!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {peerType!.serialize(buffer, true)} @@ -5042,10 +5038,10 @@ public extension Api { break case .updateBotInlineSend(let flags, let userId, let query, let geo, let id, let msgId): if boxed { - buffer.appendInt32(239663460) + buffer.appendInt32(317794823) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(query, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {geo!.serialize(buffer, true)} serializeString(id, buffer: buffer, boxed: false) @@ -5061,11 +5057,11 @@ public extension Api { break case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName): if boxed { - buffer.appendInt32(-415938591) + buffer.appendInt32(-1177566067) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) serializeInt64(chatInstance, buffer: buffer, boxed: false) @@ -5082,11 +5078,11 @@ public extension Api { break case .updateInlineBotCallbackQuery(let flags, let queryId, let userId, let msgId, let chatInstance, let data, let gameShortName): if boxed { - buffer.appendInt32(-103646630) + buffer.appendInt32(1763610706) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) msgId.serialize(buffer, true) serializeInt64(chatInstance, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeBytes(data!, buffer: buffer, boxed: false)} @@ -5094,9 +5090,9 @@ public extension Api { break case .updateReadChannelOutbox(let channelId, let maxId): if boxed { - buffer.appendInt32(634833351) + buffer.appendInt32(-1218471511) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) break case .updateDraftMessage(let peer, let draft): @@ -5132,9 +5128,9 @@ public extension Api { break case .updateChannelWebPage(let channelId, let webpage, let pts, let ptsCount): if boxed { - buffer.appendInt32(1081547008) + buffer.appendInt32(791390623) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) webpage.serialize(buffer, true) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) @@ -5175,20 +5171,20 @@ public extension Api { break case .updateBotShippingQuery(let queryId, let userId, let payload, let shippingAddress): if boxed { - buffer.appendInt32(-523384512) + buffer.appendInt32(-1246823043) } serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeBytes(payload, buffer: buffer, boxed: false) shippingAddress.serialize(buffer, true) break case .updateBotPrecheckoutQuery(let flags, let queryId, let userId, let payload, let info, let shippingOptionId, let currency, let totalAmount): if boxed { - buffer.appendInt32(1563376297) + buffer.appendInt32(-1934976362) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeBytes(payload, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {info!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {serializeString(shippingOptionId!, buffer: buffer, boxed: false)} @@ -5221,9 +5217,9 @@ public extension Api { break case .updateChannelReadMessagesContents(let channelId, let messages): if boxed { - buffer.appendInt32(-1987495099) + buffer.appendInt32(1153291573) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(messages.count)) for item in messages { @@ -5238,9 +5234,9 @@ public extension Api { break case .updateChannelAvailableMessages(let channelId, let availableMinId): if boxed { - buffer.appendInt32(1893427255) + buffer.appendInt32(-1304443240) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(availableMinId, buffer: buffer, boxed: false) break case .updateDialogUnreadMark(let flags, let peer): @@ -5334,10 +5330,10 @@ public extension Api { break case .updateMessagePollVote(let pollId, let userId, let options, let qts): if boxed { - buffer.appendInt32(938909451) + buffer.appendInt32(274961865) } serializeInt64(pollId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(options.count)) for item in options { @@ -5378,28 +5374,28 @@ public extension Api { break case .updateChannelMessageForwards(let channelId, let id, let forwards): if boxed { - buffer.appendInt32(1854571743) + buffer.appendInt32(-761649164) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(forwards, buffer: buffer, boxed: false) break case .updateReadChannelDiscussionInbox(let flags, let channelId, let topMsgId, let readMaxId, let broadcastId, let broadcastPost): if boxed { - buffer.appendInt32(482860628) + buffer.appendInt32(-693004986) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(topMsgId, buffer: buffer, boxed: false) serializeInt32(readMaxId, buffer: buffer, boxed: false) - if Int(flags) & Int(1 << 0) != 0 {serializeInt32(broadcastId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 0) != 0 {serializeInt64(broadcastId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 0) != 0 {serializeInt32(broadcastPost!, buffer: buffer, boxed: false)} break case .updateReadChannelDiscussionOutbox(let channelId, let topMsgId, let readMaxId): if boxed { - buffer.appendInt32(1178116716) + buffer.appendInt32(1767677564) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(topMsgId, buffer: buffer, boxed: false) serializeInt32(readMaxId, buffer: buffer, boxed: false) break @@ -5412,10 +5408,10 @@ public extension Api { break case .updateChannelUserTyping(let flags, let channelId, let topMsgId, let fromId, let action): if boxed { - buffer.appendInt32(1796675352) + buffer.appendInt32(-1937192669) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)} fromId.serialize(buffer, true) action.serialize(buffer, true) @@ -5436,10 +5432,10 @@ public extension Api { break case .updatePinnedChannelMessages(let flags, let channelId, let messages, let pts, let ptsCount): if boxed { - buffer.appendInt32(-2054649973) + buffer.appendInt32(1538885128) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(messages.count)) for item in messages { @@ -5450,9 +5446,9 @@ public extension Api { break case .updateChat(let chatId): if boxed { - buffer.appendInt32(321954198) + buffer.appendInt32(-124097970) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .updateGroupCallParticipants(let call, let participants, let version): if boxed { @@ -5468,9 +5464,9 @@ public extension Api { break case .updateGroupCall(let chatId, let call): if boxed { - buffer.appendInt32(-1537295973) + buffer.appendInt32(347227392) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) call.serialize(buffer, true) break case .updatePeerHistoryTTL(let flags, let peer, let ttlPeriod): @@ -5483,13 +5479,13 @@ public extension Api { break case .updateChatParticipant(let flags, let chatId, let date, let actorId, let userId, let prevParticipant, let newParticipant, let invite, let qts): if boxed { - buffer.appendInt32(-206342113) + buffer.appendInt32(-796432838) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(actorId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(actorId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {prevParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {newParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {invite!.serialize(buffer, true)} @@ -5497,13 +5493,13 @@ public extension Api { break case .updateChannelParticipant(let flags, let channelId, let date, let actorId, let userId, let prevParticipant, let newParticipant, let invite, let qts): if boxed { - buffer.appendInt32(2146218476) + buffer.appendInt32(-1738720581) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(actorId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(actorId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {prevParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {newParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {invite!.serialize(buffer, true)} @@ -5511,9 +5507,9 @@ public extension Api { break case .updateBotStopped(let userId, let date, let stopped, let qts): if boxed { - buffer.appendInt32(133777546) + buffer.appendInt32(-997782967) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) stopped.serialize(buffer, true) serializeInt32(qts, buffer: buffer, boxed: false) @@ -5527,10 +5523,10 @@ public extension Api { break case .updateBotCommands(let peer, let botId, let commands): if boxed { - buffer.appendInt32(-813823885) + buffer.appendInt32(1299263278) } peer.serialize(buffer, true) - serializeInt32(botId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(commands.count)) for item in commands { @@ -5784,8 +5780,8 @@ public extension Api { } } public static func parse_updateUserTyping(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.SendMessageAction? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.SendMessageAction @@ -5800,8 +5796,8 @@ public extension Api { } } public static func parse_updateChatUserTyping(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.Peer? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.Peer @@ -5834,8 +5830,8 @@ public extension Api { } } public static func parse_updateUserStatus(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.UserStatus? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.UserStatus @@ -5850,8 +5846,8 @@ public extension Api { } } public static func parse_updateUserName(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) var _3: String? @@ -5870,8 +5866,8 @@ public extension Api { } } public static func parse_updateUserPhoto(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Api.UserProfilePhoto? @@ -5954,12 +5950,12 @@ public extension Api { } } public static func parse_updateChatParticipantAdd(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Int32? @@ -5977,10 +5973,10 @@ public extension Api { } } public static func parse_updateChatParticipantDelete(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -6073,8 +6069,8 @@ public extension Api { } } public static func parse_updateUserPhone(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) let _c1 = _1 != nil @@ -6180,8 +6176,8 @@ public extension Api { public static func parse_updateChannelTooLong(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() } let _c1 = _1 != nil @@ -6195,8 +6191,8 @@ public extension Api { } } public static func parse_updateChannel(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Update.updateChannel(channelId: _1!) @@ -6229,8 +6225,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() } - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Int32? @@ -6251,8 +6247,8 @@ public extension Api { } } public static func parse_updateDeleteChannelMessages(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Int32]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) @@ -6273,8 +6269,8 @@ public extension Api { } } public static func parse_updateChannelMessageViews(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -6290,10 +6286,10 @@ public extension Api { } } public static func parse_updateChatParticipantAdmin(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Api.Bool? if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.Bool @@ -6351,8 +6347,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: String? _4 = parseString(reader) var _5: Api.GeoPoint? @@ -6382,8 +6378,8 @@ public extension Api { public static func parse_updateBotInlineSend(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Api.GeoPoint? @@ -6433,8 +6429,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.Peer? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.Peer @@ -6486,8 +6482,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.InputBotInlineMessageID? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessageID @@ -6513,8 +6509,8 @@ public extension Api { } } public static func parse_updateReadChannelOutbox(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -6557,8 +6553,8 @@ public extension Api { return Api.Update.updatePtsChanged } public static func parse_updateChannelWebPage(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.WebPage? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.WebPage @@ -6651,8 +6647,8 @@ public extension Api { public static func parse_updateBotShippingQuery(_ reader: BufferReader) -> Update? { var _1: Int64? _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Buffer? _3 = parseBytes(reader) var _4: Api.PostAddress? @@ -6675,8 +6671,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Buffer? _4 = parseBytes(reader) var _5: Api.PaymentRequestedInfo? @@ -6745,8 +6741,8 @@ public extension Api { return Api.Update.updateFavedStickers } public static func parse_updateChannelReadMessagesContents(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Int32]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) @@ -6764,8 +6760,8 @@ public extension Api { return Api.Update.updateContactsReset } public static func parse_updateChannelAvailableMessages(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -6954,8 +6950,8 @@ public extension Api { public static func parse_updateMessagePollVote(_ reader: BufferReader) -> Update? { var _1: Int64? _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: [Buffer]? if let _ = reader.readInt32() { _3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self) @@ -7023,8 +7019,8 @@ public extension Api { } } public static func parse_updateChannelMessageForwards(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -7042,14 +7038,14 @@ public extension Api { public static func parse_updateReadChannelDiscussionInbox(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() } + var _5: Int64? + if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt64() } var _6: Int32? if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt32() } let _c1 = _1 != nil @@ -7066,8 +7062,8 @@ public extension Api { } } public static func parse_updateReadChannelDiscussionOutbox(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -7103,8 +7099,8 @@ public extension Api { public static func parse_updateChannelUserTyping(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() } var _4: Api.Peer? @@ -7157,8 +7153,8 @@ public extension Api { public static func parse_updatePinnedChannelMessages(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: [Int32]? if let _ = reader.readInt32() { _3 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) @@ -7180,8 +7176,8 @@ public extension Api { } } public static func parse_updateChat(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Update.updateChat(chatId: _1!) @@ -7212,8 +7208,8 @@ public extension Api { } } public static func parse_updateGroupCall(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.GroupCall? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.GroupCall @@ -7249,14 +7245,14 @@ public extension Api { public static func parse_updateChatParticipant(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() var _6: Api.ChatParticipant? if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { _6 = Api.parse(reader, signature: signature) as? Api.ChatParticipant @@ -7290,14 +7286,14 @@ public extension Api { public static func parse_updateChannelParticipant(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() var _6: Api.ChannelParticipant? if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { _6 = Api.parse(reader, signature: signature) as? Api.ChannelParticipant @@ -7329,8 +7325,8 @@ public extension Api { } } public static func parse_updateBotStopped(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Api.Bool? @@ -7371,8 +7367,8 @@ public extension Api { if let signature = reader.readInt32() { _1 = Api.parse(reader, signature: signature) as? Api.Peer } - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: [Api.BotCommand]? if let _ = reader.readInt32() { _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.BotCommand.self) @@ -7512,58 +7508,58 @@ public extension Api { } public enum ChannelParticipant: TypeConstructorDescription { - case channelParticipant(userId: Int32, date: Int32) - case channelParticipantSelf(userId: Int32, inviterId: Int32, date: Int32) - case channelParticipantCreator(flags: Int32, userId: Int32, adminRights: Api.ChatAdminRights, rank: String?) - case channelParticipantAdmin(flags: Int32, userId: Int32, inviterId: Int32?, promotedBy: Int32, date: Int32, adminRights: Api.ChatAdminRights, rank: String?) - case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int32, date: Int32, bannedRights: Api.ChatBannedRights) + case channelParticipant(userId: Int64, date: Int32) + case channelParticipantSelf(userId: Int64, inviterId: Int64, date: Int32) + case channelParticipantCreator(flags: Int32, userId: Int64, adminRights: Api.ChatAdminRights, rank: String?) + case channelParticipantAdmin(flags: Int32, userId: Int64, inviterId: Int64?, promotedBy: Int64, date: Int32, adminRights: Api.ChatAdminRights, rank: String?) + case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int64, date: Int32, bannedRights: Api.ChatBannedRights) case channelParticipantLeft(peer: Api.Peer) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .channelParticipant(let userId, let date): if boxed { - buffer.appendInt32(367766557) + buffer.appendInt32(-1072953408) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .channelParticipantSelf(let userId, let inviterId, let date): if boxed { - buffer.appendInt32(-1557620115) + buffer.appendInt32(682146919) } - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .channelParticipantCreator(let flags, let userId, let adminRights, let rank): if boxed { - buffer.appendInt32(1149094475) + buffer.appendInt32(803602899) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) adminRights.serialize(buffer, true) if Int(flags) & Int(1 << 0) != 0 {serializeString(rank!, buffer: buffer, boxed: false)} break case .channelParticipantAdmin(let flags, let userId, let inviterId, let promotedBy, let date, let adminRights, let rank): if boxed { - buffer.appendInt32(-859915345) + buffer.appendInt32(885242707) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) - if Int(flags) & Int(1 << 1) != 0 {serializeInt32(inviterId!, buffer: buffer, boxed: false)} - serializeInt32(promotedBy, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 1) != 0 {serializeInt64(inviterId!, buffer: buffer, boxed: false)} + serializeInt64(promotedBy, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) adminRights.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {serializeString(rank!, buffer: buffer, boxed: false)} break case .channelParticipantBanned(let flags, let peer, let kickedBy, let date, let bannedRights): if boxed { - buffer.appendInt32(1352785878) + buffer.appendInt32(1844969806) } serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) - serializeInt32(kickedBy, buffer: buffer, boxed: false) + serializeInt64(kickedBy, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) bannedRights.serialize(buffer, true) break @@ -7594,8 +7590,8 @@ public extension Api { } public static func parse_channelParticipant(_ reader: BufferReader) -> ChannelParticipant? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -7608,10 +7604,10 @@ public extension Api { } } public static func parse_channelParticipantSelf(_ reader: BufferReader) -> ChannelParticipant? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -7627,8 +7623,8 @@ public extension Api { public static func parse_channelParticipantCreator(_ reader: BufferReader) -> ChannelParticipant? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Api.ChatAdminRights? if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights @@ -7649,12 +7645,12 @@ public extension Api { public static func parse_channelParticipantAdmin(_ reader: BufferReader) -> ChannelParticipant? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() } - var _4: Int32? - _4 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt64() } + var _4: Int64? + _4 = reader.readInt64() var _5: Int32? _5 = reader.readInt32() var _6: Api.ChatAdminRights? @@ -7684,8 +7680,8 @@ public extension Api { if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.Peer } - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Api.ChatBannedRights? @@ -7720,32 +7716,32 @@ public extension Api { } public enum MessageUserVote: TypeConstructorDescription { - case messageUserVote(userId: Int32, option: Buffer, date: Int32) - case messageUserVoteInputOption(userId: Int32, date: Int32) - case messageUserVoteMultiple(userId: Int32, options: [Buffer], date: Int32) + case messageUserVote(userId: Int64, option: Buffer, date: Int32) + case messageUserVoteInputOption(userId: Int64, date: Int32) + case messageUserVoteMultiple(userId: Int64, options: [Buffer], date: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .messageUserVote(let userId, let option, let date): if boxed { - buffer.appendInt32(-1567730343) + buffer.appendInt32(886196148) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeBytes(option, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .messageUserVoteInputOption(let userId, let date): if boxed { - buffer.appendInt32(909603888) + buffer.appendInt32(1017491692) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .messageUserVoteMultiple(let userId, let options, let date): if boxed { - buffer.appendInt32(244310238) + buffer.appendInt32(-1973033641) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(options.count)) for item in options { @@ -7768,8 +7764,8 @@ public extension Api { } public static func parse_messageUserVote(_ reader: BufferReader) -> MessageUserVote? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Buffer? _2 = parseBytes(reader) var _3: Int32? @@ -7785,8 +7781,8 @@ public extension Api { } } public static func parse_messageUserVoteInputOption(_ reader: BufferReader) -> MessageUserVote? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -7799,8 +7795,8 @@ public extension Api { } } public static func parse_messageUserVoteMultiple(_ reader: BufferReader) -> MessageUserVote? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Buffer]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self) @@ -8174,15 +8170,15 @@ public extension Api { } public enum ContactStatus: TypeConstructorDescription { - case contactStatus(userId: Int32, status: Api.UserStatus) + case contactStatus(userId: Int64, status: Api.UserStatus) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .contactStatus(let userId, let status): if boxed { - buffer.appendInt32(-748155807) + buffer.appendInt32(383348795) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) status.serialize(buffer, true) break } @@ -8196,8 +8192,8 @@ public extension Api { } public static func parse_contactStatus(_ reader: BufferReader) -> ContactStatus? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.UserStatus? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.UserStatus @@ -9858,15 +9854,15 @@ public extension Api { } public enum ChatAdminWithInvites: TypeConstructorDescription { - case chatAdminWithInvites(adminId: Int32, invitesCount: Int32, revokedInvitesCount: Int32) + case chatAdminWithInvites(adminId: Int64, invitesCount: Int32, revokedInvitesCount: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatAdminWithInvites(let adminId, let invitesCount, let revokedInvitesCount): if boxed { - buffer.appendInt32(-539872497) + buffer.appendInt32(-219353309) } - serializeInt32(adminId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) serializeInt32(invitesCount, buffer: buffer, boxed: false) serializeInt32(revokedInvitesCount, buffer: buffer, boxed: false) break @@ -9881,8 +9877,8 @@ public extension Api { } public static func parse_chatAdminWithInvites(_ reader: BufferReader) -> ChatAdminWithInvites? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -10606,11 +10602,11 @@ public extension Api { indirect public enum InputPeer: TypeConstructorDescription { case inputPeerEmpty case inputPeerSelf - case inputPeerChat(chatId: Int32) - case inputPeerUser(userId: Int32, accessHash: Int64) - case inputPeerChannel(channelId: Int32, accessHash: Int64) - case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int32) - case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int32) + case inputPeerChat(chatId: Int64) + case inputPeerUser(userId: Int64, accessHash: Int64) + case inputPeerChannel(channelId: Int64, accessHash: Int64) + case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64) + case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -10628,39 +10624,39 @@ public extension Api { break case .inputPeerChat(let chatId): if boxed { - buffer.appendInt32(396093539) + buffer.appendInt32(900291769) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .inputPeerUser(let userId, let accessHash): if boxed { - buffer.appendInt32(2072935910) + buffer.appendInt32(-571955892) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputPeerChannel(let channelId, let accessHash): if boxed { - buffer.appendInt32(548253432) + buffer.appendInt32(666680316) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputPeerUserFromMessage(let peer, let msgId, let userId): if boxed { - buffer.appendInt32(398123750) + buffer.appendInt32(-1468331492) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .inputPeerChannelFromMessage(let peer, let msgId, let channelId): if boxed { - buffer.appendInt32(-1667893317) + buffer.appendInt32(-1121318848) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break } } @@ -10691,8 +10687,8 @@ public extension Api { return Api.InputPeer.inputPeerSelf } public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.InputPeer.inputPeerChat(chatId: _1!) @@ -10702,8 +10698,8 @@ public extension Api { } } public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -10716,8 +10712,8 @@ public extension Api { } } public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -10736,8 +10732,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -10755,8 +10751,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -10770,15 +10766,15 @@ public extension Api { } public enum Contact: TypeConstructorDescription { - case contact(userId: Int32, mutual: Api.Bool) + case contact(userId: Int64, mutual: Api.Bool) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .contact(let userId, let mutual): if boxed { - buffer.appendInt32(-116274796) + buffer.appendInt32(341499403) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) mutual.serialize(buffer, true) break } @@ -10792,8 +10788,8 @@ public extension Api { } public static func parse_contact(_ reader: BufferReader) -> Contact? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.Bool? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.Bool @@ -11128,8 +11124,8 @@ public extension Api { case inputPrivacyValueDisallowContacts case inputPrivacyValueDisallowAll case inputPrivacyValueDisallowUsers(users: [Api.InputUser]) - case inputPrivacyValueAllowChatParticipants(chats: [Int32]) - case inputPrivacyValueDisallowChatParticipants(chats: [Int32]) + case inputPrivacyValueAllowChatParticipants(chats: [Int64]) + case inputPrivacyValueDisallowChatParticipants(chats: [Int64]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -11179,22 +11175,22 @@ public extension Api { break case .inputPrivacyValueAllowChatParticipants(let chats): if boxed { - buffer.appendInt32(1283572154) + buffer.appendInt32(-2079962673) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .inputPrivacyValueDisallowChatParticipants(let chats): if boxed { - buffer.appendInt32(-668769361) + buffer.appendInt32(-380694650) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break } @@ -11260,9 +11256,9 @@ public extension Api { } } public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -11273,9 +11269,9 @@ public extension Api { } } public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -11306,7 +11302,7 @@ public extension Api { case channelAdminLogEventActionTogglePreHistoryHidden(newValue: Api.Bool) case channelAdminLogEventActionDefaultBannedRights(prevBannedRights: Api.ChatBannedRights, newBannedRights: Api.ChatBannedRights) case channelAdminLogEventActionStopPoll(message: Api.Message) - case channelAdminLogEventActionChangeLinkedChat(prevValue: Int32, newValue: Int32) + case channelAdminLogEventActionChangeLinkedChat(prevValue: Int64, newValue: Int64) case channelAdminLogEventActionChangeLocation(prevValue: Api.ChannelLocation, newValue: Api.ChannelLocation) case channelAdminLogEventActionToggleSlowMode(prevValue: Int32, newValue: Int32) case channelAdminLogEventActionStartGroupCall(call: Api.InputGroupCall) @@ -11443,10 +11439,10 @@ public extension Api { break case .channelAdminLogEventActionChangeLinkedChat(let prevValue, let newValue): if boxed { - buffer.appendInt32(-1569748965) + buffer.appendInt32(84703944) } - serializeInt32(prevValue, buffer: buffer, boxed: false) - serializeInt32(newValue, buffer: buffer, boxed: false) + serializeInt64(prevValue, buffer: buffer, boxed: false) + serializeInt64(newValue, buffer: buffer, boxed: false) break case .channelAdminLogEventActionChangeLocation(let prevValue, let newValue): if boxed { @@ -11859,10 +11855,10 @@ public extension Api { } } public static func parse_channelAdminLogEventActionChangeLinkedChat(_ reader: BufferReader) -> ChannelAdminLogEventAction? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -12728,15 +12724,15 @@ public extension Api { } public enum StatsGroupTopPoster: TypeConstructorDescription { - case statsGroupTopPoster(userId: Int32, messages: Int32, avgChars: Int32) + case statsGroupTopPoster(userId: Int64, messages: Int32, avgChars: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .statsGroupTopPoster(let userId, let messages, let avgChars): if boxed { - buffer.appendInt32(418631927) + buffer.appendInt32(-1660637285) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(messages, buffer: buffer, boxed: false) serializeInt32(avgChars, buffer: buffer, boxed: false) break @@ -12751,8 +12747,8 @@ public extension Api { } public static func parse_statsGroupTopPoster(_ reader: BufferReader) -> StatsGroupTopPoster? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -13568,16 +13564,16 @@ public extension Api { } public enum HighScore: TypeConstructorDescription { - case highScore(pos: Int32, userId: Int32, score: Int32) + case highScore(pos: Int32, userId: Int64, score: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .highScore(let pos, let userId, let score): if boxed { - buffer.appendInt32(1493171408) + buffer.appendInt32(1940093419) } serializeInt32(pos, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(score, buffer: buffer, boxed: false) break } @@ -13593,8 +13589,8 @@ public extension Api { public static func parse_highScore(_ reader: BufferReader) -> HighScore? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -13936,8 +13932,8 @@ public extension Api { public enum InputUser: TypeConstructorDescription { case inputUserEmpty case inputUserSelf - case inputUser(userId: Int32, accessHash: Int64) - case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int32) + case inputUser(userId: Int64, accessHash: Int64) + case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -13955,18 +13951,18 @@ public extension Api { break case .inputUser(let userId, let accessHash): if boxed { - buffer.appendInt32(-668391402) + buffer.appendInt32(-233744186) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputUserFromMessage(let peer, let msgId, let userId): if boxed { - buffer.appendInt32(756118935) + buffer.appendInt32(497305826) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break } } @@ -13991,8 +13987,8 @@ public extension Api { return Api.InputUser.inputUserSelf } public static func parse_inputUser(_ reader: BufferReader) -> InputUser? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -14011,8 +14007,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -14740,15 +14736,15 @@ public extension Api { } public enum ChatInviteImporter: TypeConstructorDescription { - case chatInviteImporter(userId: Int32, date: Int32) + case chatInviteImporter(userId: Int64, date: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatInviteImporter(let userId, let date): if boxed { - buffer.appendInt32(507405952) + buffer.appendInt32(190633460) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break } @@ -14762,8 +14758,8 @@ public extension Api { } public static func parse_chatInviteImporter(_ reader: BufferReader) -> ChatInviteImporter? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -14816,13 +14812,13 @@ public extension Api { } public enum MessageReplies: TypeConstructorDescription { - case messageReplies(flags: Int32, replies: Int32, repliesPts: Int32, recentRepliers: [Api.Peer]?, channelId: Int32?, maxId: Int32?, readMaxId: Int32?) + case messageReplies(flags: Int32, replies: Int32, repliesPts: Int32, recentRepliers: [Api.Peer]?, channelId: Int64?, maxId: Int32?, readMaxId: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .messageReplies(let flags, let replies, let repliesPts, let recentRepliers, let channelId, let maxId, let readMaxId): if boxed { - buffer.appendInt32(1093204652) + buffer.appendInt32(-2083123262) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(replies, buffer: buffer, boxed: false) @@ -14832,7 +14828,7 @@ public extension Api { for item in recentRepliers! { item.serialize(buffer, true) }} - if Int(flags) & Int(1 << 0) != 0 {serializeInt32(channelId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 0) != 0 {serializeInt64(channelId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeInt32(maxId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {serializeInt32(readMaxId!, buffer: buffer, boxed: false)} break @@ -14857,8 +14853,8 @@ public extension Api { if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() { _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) } } - var _5: Int32? - if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() } + var _5: Int64? + if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt64() } var _6: Int32? if Int(_1!) & Int(1 << 2) != 0 {_6 = reader.readInt32() } var _7: Int32? @@ -15663,8 +15659,8 @@ public extension Api { } public enum Updates: TypeConstructorDescription { case updatesTooLong - case updateShortMessage(flags: Int32, id: Int32, userId: Int32, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) - case updateShortChatMessage(flags: Int32, id: Int32, fromId: Int32, chatId: Int32, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) + case updateShortMessage(flags: Int32, id: Int32, userId: Int64, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) + case updateShortChatMessage(flags: Int32, id: Int32, fromId: Int64, chatId: Int64, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) case updateShort(update: Api.Update, date: Int32) case updatesCombined(updates: [Api.Update], users: [Api.User], chats: [Api.Chat], date: Int32, seqStart: Int32, seq: Int32) case updates(updates: [Api.Update], users: [Api.User], chats: [Api.Chat], date: Int32, seq: Int32) @@ -15680,17 +15676,17 @@ public extension Api { break case .updateShortMessage(let flags, let id, let userId, let message, let pts, let ptsCount, let date, let fwdFrom, let viaBotId, let replyTo, let entities, let ttlPeriod): if boxed { - buffer.appendInt32(-84936653) + buffer.appendInt32(826001400) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)} - if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 11) != 0 {serializeInt64(viaBotId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)} if Int(flags) & Int(1 << 7) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(entities!.count)) @@ -15701,18 +15697,18 @@ public extension Api { break case .updateShortChatMessage(let flags, let id, let fromId, let chatId, let message, let pts, let ptsCount, let date, let fwdFrom, let viaBotId, let replyTo, let entities, let ttlPeriod): if boxed { - buffer.appendInt32(290961496) + buffer.appendInt32(1299050149) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) - serializeInt32(fromId, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(fromId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)} - if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 11) != 0 {serializeInt64(viaBotId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)} if Int(flags) & Int(1 << 7) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(entities!.count)) @@ -15820,8 +15816,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: String? _4 = parseString(reader) var _5: Int32? @@ -15834,8 +15830,8 @@ public extension Api { if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { _8 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader } } - var _9: Int32? - if Int(_1!) & Int(1 << 11) != 0 {_9 = reader.readInt32() } + var _9: Int64? + if Int(_1!) & Int(1 << 11) != 0 {_9 = reader.readInt64() } var _10: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { _10 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader @@ -15870,10 +15866,10 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int64? + _4 = reader.readInt64() var _5: String? _5 = parseString(reader) var _6: Int32? @@ -15886,8 +15882,8 @@ public extension Api { if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { _9 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader } } - var _10: Int32? - if Int(_1!) & Int(1 << 11) != 0 {_10 = reader.readInt32() } + var _10: Int64? + if Int(_1!) & Int(1 << 11) != 0 {_10 = reader.readInt64() } var _11: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { _11 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader @@ -16075,7 +16071,7 @@ public extension Api { case messageMediaEmpty case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?) case messageMediaGeo(geo: Api.GeoPoint) - case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int32) + case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int64) case messageMediaUnsupported case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?) case messageMediaWebPage(webpage: Api.WebPage) @@ -16110,13 +16106,13 @@ public extension Api { break case .messageMediaContact(let phoneNumber, let firstName, let lastName, let vcard, let userId): if boxed { - buffer.appendInt32(-873313984) + buffer.appendInt32(1882335561) } serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(firstName, buffer: buffer, boxed: false) serializeString(lastName, buffer: buffer, boxed: false) serializeString(vcard, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .messageMediaUnsupported: if boxed { @@ -16270,8 +16266,8 @@ public extension Api { _3 = parseString(reader) var _4: String? _4 = parseString(reader) - var _5: Int32? - _5 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -16994,15 +16990,15 @@ public extension Api { } public enum BotInfo: TypeConstructorDescription { - case botInfo(userId: Int32, description: String, commands: [Api.BotCommand]) + case botInfo(userId: Int64, description: String, commands: [Api.BotCommand]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .botInfo(let userId, let description, let commands): if boxed { - buffer.appendInt32(-1729618630) + buffer.appendInt32(460632885) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(description, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(commands.count)) @@ -17021,8 +17017,8 @@ public extension Api { } public static func parse_botInfo(_ reader: BufferReader) -> BotInfo? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) var _3: [Api.BotCommand]? @@ -17042,23 +17038,23 @@ public extension Api { } public enum User: TypeConstructorDescription { - case userEmpty(id: Int32) - case user(flags: Int32, id: Int32, accessHash: Int64?, firstName: String?, lastName: String?, username: String?, phone: String?, photo: Api.UserProfilePhoto?, status: Api.UserStatus?, botInfoVersion: Int32?, restrictionReason: [Api.RestrictionReason]?, botInlinePlaceholder: String?, langCode: String?) + case userEmpty(id: Int64) + case user(flags: Int32, id: Int64, accessHash: Int64?, firstName: String?, lastName: String?, username: String?, phone: String?, photo: Api.UserProfilePhoto?, status: Api.UserStatus?, botInfoVersion: Int32?, restrictionReason: [Api.RestrictionReason]?, botInlinePlaceholder: String?, langCode: String?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .userEmpty(let id): if boxed { - buffer.appendInt32(537022650) + buffer.appendInt32(-742634630) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) break case .user(let flags, let id, let accessHash, let firstName, let lastName, let username, let phone, let photo, let status, let botInfoVersion, let restrictionReason, let botInlinePlaceholder, let langCode): if boxed { - buffer.appendInt32(-1820043071) + buffer.appendInt32(1073147056) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt64(accessHash!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeString(firstName!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeString(lastName!, buffer: buffer, boxed: false)} @@ -17088,8 +17084,8 @@ public extension Api { } public static func parse_userEmpty(_ reader: BufferReader) -> User? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.User.userEmpty(id: _1!) @@ -17101,8 +17097,8 @@ public extension Api { public static func parse_user(_ reader: BufferReader) -> User? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int64? if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt64() } var _4: String? @@ -17155,7 +17151,7 @@ public extension Api { } public enum Message: TypeConstructorDescription { case messageEmpty(flags: Int32, id: Int32, peerId: Api.Peer?) - case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?) + case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?) case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction, ttlPeriod: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -17170,14 +17166,14 @@ public extension Api { break case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason, let ttlPeriod): if boxed { - buffer.appendInt32(-1125940270) + buffer.appendInt32(-2049520670) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 8) != 0 {fromId!.serialize(buffer, true)} peerId.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)} - if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 11) != 0 {serializeInt64(viaBotId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)} serializeInt32(date, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) @@ -17264,8 +17260,8 @@ public extension Api { if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { _5 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader } } - var _6: Int32? - if Int(_1!) & Int(1 << 11) != 0 {_6 = reader.readInt32() } + var _6: Int64? + if Int(_1!) & Int(1 << 11) != 0 {_6 = reader.readInt64() } var _7: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { _7 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader @@ -17376,15 +17372,15 @@ public extension Api { } public enum StatsGroupTopInviter: TypeConstructorDescription { - case statsGroupTopInviter(userId: Int32, invitations: Int32) + case statsGroupTopInviter(userId: Int64, invitations: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .statsGroupTopInviter(let userId, let invitations): if boxed { - buffer.appendInt32(831924812) + buffer.appendInt32(1398765469) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(invitations, buffer: buffer, boxed: false) break } @@ -17398,8 +17394,8 @@ public extension Api { } public static func parse_statsGroupTopInviter(_ reader: BufferReader) -> StatsGroupTopInviter? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -17860,24 +17856,24 @@ public extension Api { } public enum ChatParticipants: TypeConstructorDescription { - case chatParticipantsForbidden(flags: Int32, chatId: Int32, selfParticipant: Api.ChatParticipant?) - case chatParticipants(chatId: Int32, participants: [Api.ChatParticipant], version: Int32) + case chatParticipantsForbidden(flags: Int32, chatId: Int64, selfParticipant: Api.ChatParticipant?) + case chatParticipants(chatId: Int64, participants: [Api.ChatParticipant], version: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatParticipantsForbidden(let flags, let chatId, let selfParticipant): if boxed { - buffer.appendInt32(-57668565) + buffer.appendInt32(-2023500831) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {selfParticipant!.serialize(buffer, true)} break case .chatParticipants(let chatId, let participants, let version): if boxed { - buffer.appendInt32(1061556205) + buffer.appendInt32(1018991608) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(participants.count)) for item in participants { @@ -17900,8 +17896,8 @@ public extension Api { public static func parse_chatParticipantsForbidden(_ reader: BufferReader) -> ChatParticipants? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Api.ChatParticipant? if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.ChatParticipant @@ -17917,8 +17913,8 @@ public extension Api { } } public static func parse_chatParticipants(_ reader: BufferReader) -> ChatParticipants? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.ChatParticipant]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ChatParticipant.self) @@ -18866,17 +18862,17 @@ public extension Api { } public enum ChannelAdminLogEvent: TypeConstructorDescription { - case channelAdminLogEvent(id: Int64, date: Int32, userId: Int32, action: Api.ChannelAdminLogEventAction) + case channelAdminLogEvent(id: Int64, date: Int32, userId: Int64, action: Api.ChannelAdminLogEventAction) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .channelAdminLogEvent(let id, let date, let userId, let action): if boxed { - buffer.appendInt32(995769920) + buffer.appendInt32(531458253) } serializeInt64(id, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) action.serialize(buffer, true) break } @@ -18894,8 +18890,8 @@ public extension Api { _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.ChannelAdminLogEventAction? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.ChannelAdminLogEventAction @@ -20012,17 +20008,17 @@ public extension Api { } public enum ExportedChatInvite: TypeConstructorDescription { - case chatInviteExported(flags: Int32, link: String, adminId: Int32, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, usage: Int32?) + case chatInviteExported(flags: Int32, link: String, adminId: Int64, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, usage: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatInviteExported(let flags, let link, let adminId, let date, let startDate, let expireDate, let usageLimit, let usage): if boxed { - buffer.appendInt32(1847917725) + buffer.appendInt32(-1316944408) } serializeInt32(flags, buffer: buffer, boxed: false) serializeString(link, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 4) != 0 {serializeInt32(startDate!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeInt32(expireDate!, buffer: buffer, boxed: false)} @@ -20044,8 +20040,8 @@ public extension Api { _1 = reader.readInt32() var _2: String? _2 = parseString(reader) - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Int32? @@ -20746,12 +20742,12 @@ public extension Api { public enum PrivacyRule: TypeConstructorDescription { case privacyValueAllowContacts case privacyValueAllowAll - case privacyValueAllowUsers(users: [Int32]) + case privacyValueAllowUsers(users: [Int64]) case privacyValueDisallowContacts case privacyValueDisallowAll - case privacyValueDisallowUsers(users: [Int32]) - case privacyValueAllowChatParticipants(chats: [Int32]) - case privacyValueDisallowChatParticipants(chats: [Int32]) + case privacyValueDisallowUsers(users: [Int64]) + case privacyValueAllowChatParticipants(chats: [Int64]) + case privacyValueDisallowChatParticipants(chats: [Int64]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -20769,12 +20765,12 @@ public extension Api { break case .privacyValueAllowUsers(let users): if boxed { - buffer.appendInt32(1297858060) + buffer.appendInt32(-1198497870) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .privacyValueDisallowContacts: @@ -20791,32 +20787,32 @@ public extension Api { break case .privacyValueDisallowUsers(let users): if boxed { - buffer.appendInt32(209668535) + buffer.appendInt32(-463335103) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .privacyValueAllowChatParticipants(let chats): if boxed { - buffer.appendInt32(415136107) + buffer.appendInt32(1796427406) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .privacyValueDisallowChatParticipants(let chats): if boxed { - buffer.appendInt32(-1397881200) + buffer.appendInt32(1103656293) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break } @@ -20850,9 +20846,9 @@ public extension Api { return Api.PrivacyRule.privacyValueAllowAll } public static func parse_privacyValueAllowUsers(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20869,9 +20865,9 @@ public extension Api { return Api.PrivacyRule.privacyValueDisallowAll } public static func parse_privacyValueDisallowUsers(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20882,9 +20878,9 @@ public extension Api { } } public static func parse_privacyValueAllowChatParticipants(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20895,9 +20891,9 @@ public extension Api { } } public static func parse_privacyValueDisallowChatParticipants(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20911,16 +20907,16 @@ public extension Api { } public enum MessageAction: TypeConstructorDescription { case messageActionEmpty - case messageActionChatCreate(title: String, users: [Int32]) + case messageActionChatCreate(title: String, users: [Int64]) case messageActionChatEditTitle(title: String) case messageActionChatEditPhoto(photo: Api.Photo) case messageActionChatDeletePhoto - case messageActionChatAddUser(users: [Int32]) - case messageActionChatDeleteUser(userId: Int32) - case messageActionChatJoinedByLink(inviterId: Int32) + case messageActionChatAddUser(users: [Int64]) + case messageActionChatDeleteUser(userId: Int64) + case messageActionChatJoinedByLink(inviterId: Int64) case messageActionChannelCreate(title: String) - case messageActionChatMigrateTo(channelId: Int32) - case messageActionChannelMigrateFrom(title: String, chatId: Int32) + case messageActionChatMigrateTo(channelId: Int64) + case messageActionChannelMigrateFrom(title: String, chatId: Int64) case messageActionPinMessage case messageActionHistoryClear case messageActionGameScore(gameId: Int64, score: Int32) @@ -20935,7 +20931,7 @@ public extension Api { case messageActionContactSignUp case messageActionGeoProximityReached(fromId: Api.Peer, toId: Api.Peer, distance: Int32) case messageActionGroupCall(flags: Int32, call: Api.InputGroupCall, duration: Int32?) - case messageActionInviteToGroupCall(call: Api.InputGroupCall, users: [Int32]) + case messageActionInviteToGroupCall(call: Api.InputGroupCall, users: [Int64]) case messageActionSetMessagesTTL(period: Int32) case messageActionGroupCallScheduled(call: Api.InputGroupCall, scheduleDate: Int32) case messageActionSetChatTheme(emoticon: String) @@ -20950,13 +20946,13 @@ public extension Api { break case .messageActionChatCreate(let title, let users): if boxed { - buffer.appendInt32(-1503425638) + buffer.appendInt32(-1119368275) } serializeString(title, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .messageActionChatEditTitle(let title): @@ -20979,25 +20975,25 @@ public extension Api { break case .messageActionChatAddUser(let users): if boxed { - buffer.appendInt32(1217033015) + buffer.appendInt32(365886720) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .messageActionChatDeleteUser(let userId): if boxed { - buffer.appendInt32(-1297179892) + buffer.appendInt32(-1539362612) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .messageActionChatJoinedByLink(let inviterId): if boxed { - buffer.appendInt32(-123931160) + buffer.appendInt32(51520707) } - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) break case .messageActionChannelCreate(let title): if boxed { @@ -21007,16 +21003,16 @@ public extension Api { break case .messageActionChatMigrateTo(let channelId): if boxed { - buffer.appendInt32(1371385889) + buffer.appendInt32(-519864430) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break case .messageActionChannelMigrateFrom(let title, let chatId): if boxed { - buffer.appendInt32(-1336546578) + buffer.appendInt32(-365344535) } serializeString(title, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .messageActionPinMessage: if boxed { @@ -21128,13 +21124,13 @@ public extension Api { break case .messageActionInviteToGroupCall(let call, let users): if boxed { - buffer.appendInt32(1991897370) + buffer.appendInt32(1345295095) } call.serialize(buffer, true) buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .messageActionSetMessagesTTL(let period): @@ -21228,9 +21224,9 @@ public extension Api { public static func parse_messageActionChatCreate(_ reader: BufferReader) -> MessageAction? { var _1: String? _1 = parseString(reader) - var _2: [Int32]? + var _2: [Int64]? if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil let _c2 = _2 != nil @@ -21269,9 +21265,9 @@ public extension Api { return Api.MessageAction.messageActionChatDeletePhoto } public static func parse_messageActionChatAddUser(_ reader: BufferReader) -> MessageAction? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -21282,8 +21278,8 @@ public extension Api { } } public static func parse_messageActionChatDeleteUser(_ reader: BufferReader) -> MessageAction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.MessageAction.messageActionChatDeleteUser(userId: _1!) @@ -21293,8 +21289,8 @@ public extension Api { } } public static func parse_messageActionChatJoinedByLink(_ reader: BufferReader) -> MessageAction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.MessageAction.messageActionChatJoinedByLink(inviterId: _1!) @@ -21315,8 +21311,8 @@ public extension Api { } } public static func parse_messageActionChatMigrateTo(_ reader: BufferReader) -> MessageAction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.MessageAction.messageActionChatMigrateTo(channelId: _1!) @@ -21328,8 +21324,8 @@ public extension Api { public static func parse_messageActionChannelMigrateFrom(_ reader: BufferReader) -> MessageAction? { var _1: String? _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -21532,9 +21528,9 @@ public extension Api { if let signature = reader.readInt32() { _1 = Api.parse(reader, signature: signature) as? Api.InputGroupCall } - var _2: [Int32]? + var _2: [Int64]? if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil let _c2 = _2 != nil @@ -21587,10 +21583,10 @@ public extension Api { } public enum PhoneCall: TypeConstructorDescription { case phoneCallEmpty(id: Int64) - case phoneCallWaiting(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, protocol: Api.PhoneCallProtocol, receiveDate: Int32?) - case phoneCallRequested(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAHash: Buffer, protocol: Api.PhoneCallProtocol) - case phoneCallAccepted(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gB: Buffer, protocol: Api.PhoneCallProtocol) - case phoneCall(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAOrB: Buffer, keyFingerprint: Int64, protocol: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32) + case phoneCallWaiting(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, protocol: Api.PhoneCallProtocol, receiveDate: Int32?) + case phoneCallRequested(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAHash: Buffer, protocol: Api.PhoneCallProtocol) + case phoneCallAccepted(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gB: Buffer, protocol: Api.PhoneCallProtocol) + case phoneCall(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64, protocol: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32) case phoneCallDiscarded(flags: Int32, id: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -21603,53 +21599,53 @@ public extension Api { break case .phoneCallWaiting(let flags, let id, let accessHash, let date, let adminId, let participantId, let `protocol`, let receiveDate): if boxed { - buffer.appendInt32(462375633) + buffer.appendInt32(-987599081) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(receiveDate!, buffer: buffer, boxed: false)} break case .phoneCallRequested(let flags, let id, let accessHash, let date, let adminId, let participantId, let gAHash, let `protocol`): if boxed { - buffer.appendInt32(-2014659757) + buffer.appendInt32(347139340) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gAHash, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) break case .phoneCallAccepted(let flags, let id, let accessHash, let date, let adminId, let participantId, let gB, let `protocol`): if boxed { - buffer.appendInt32(-1719909046) + buffer.appendInt32(912311057) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gB, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) break case .phoneCall(let flags, let id, let accessHash, let date, let adminId, let participantId, let gAOrB, let keyFingerprint, let `protocol`, let connections, let startDate): if boxed { - buffer.appendInt32(-2025673089) + buffer.appendInt32(-1770029977) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gAOrB, buffer: buffer, boxed: false) serializeInt64(keyFingerprint, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) @@ -21709,10 +21705,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Api.PhoneCallProtocol? if let signature = reader.readInt32() { _7 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol @@ -21743,10 +21739,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Buffer? _7 = parseBytes(reader) var _8: Api.PhoneCallProtocol? @@ -21777,10 +21773,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Buffer? _7 = parseBytes(reader) var _8: Api.PhoneCallProtocol? @@ -21811,10 +21807,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Buffer? _7 = parseBytes(reader) var _8: Int64? @@ -22237,6 +22233,7 @@ public extension Api { } public enum InputBotInlineMessageID: TypeConstructorDescription { case inputBotInlineMessageID(dcId: Int32, id: Int64, accessHash: Int64) + case inputBotInlineMessageID64(dcId: Int32, ownerId: Int64, id: Int32, accessHash: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -22248,6 +22245,15 @@ public extension Api { serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break + case .inputBotInlineMessageID64(let dcId, let ownerId, let id, let accessHash): + if boxed { + buffer.appendInt32(-1227287081) + } + serializeInt32(dcId, buffer: buffer, boxed: false) + serializeInt64(ownerId, buffer: buffer, boxed: false) + serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(accessHash, buffer: buffer, boxed: false) + break } } @@ -22255,6 +22261,8 @@ public extension Api { switch self { case .inputBotInlineMessageID(let dcId, let id, let accessHash): return ("inputBotInlineMessageID", [("dcId", dcId), ("id", id), ("accessHash", accessHash)]) + case .inputBotInlineMessageID64(let dcId, let ownerId, let id, let accessHash): + return ("inputBotInlineMessageID64", [("dcId", dcId), ("ownerId", ownerId), ("id", id), ("accessHash", accessHash)]) } } @@ -22275,6 +22283,26 @@ public extension Api { return nil } } + public static func parse_inputBotInlineMessageID64(_ reader: BufferReader) -> InputBotInlineMessageID? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.InputBotInlineMessageID.inputBotInlineMessageID64(dcId: _1!, ownerId: _2!, id: _3!, accessHash: _4!) + } + else { + return nil + } + } } public enum PageRelatedArticle: TypeConstructorDescription { @@ -22535,7 +22563,7 @@ public extension Api { case messageEntityCode(offset: Int32, length: Int32) case messageEntityPre(offset: Int32, length: Int32, language: String) case messageEntityTextUrl(offset: Int32, length: Int32, url: String) - case messageEntityMentionName(offset: Int32, length: Int32, userId: Int32) + case messageEntityMentionName(offset: Int32, length: Int32, userId: Int64) case inputMessageEntityMentionName(offset: Int32, length: Int32, userId: Api.InputUser) case messageEntityPhone(offset: Int32, length: Int32) case messageEntityCashtag(offset: Int32, length: Int32) @@ -22627,11 +22655,11 @@ public extension Api { break case .messageEntityMentionName(let offset, let length, let userId): if boxed { - buffer.appendInt32(892193368) + buffer.appendInt32(-595914432) } serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(length, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .inputMessageEntityMentionName(let offset, let length, let userId): if boxed { @@ -22894,8 +22922,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -23137,9 +23165,9 @@ public extension Api { } public enum EncryptedChat: TypeConstructorDescription { case encryptedChatEmpty(id: Int32) - case encryptedChatWaiting(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32) - case encryptedChatRequested(flags: Int32, folderId: Int32?, id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gA: Buffer) - case encryptedChat(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAOrB: Buffer, keyFingerprint: Int64) + case encryptedChatWaiting(id: Int32, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64) + case encryptedChatRequested(flags: Int32, folderId: Int32?, id: Int32, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gA: Buffer) + case encryptedChat(id: Int32, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64) case encryptedChatDiscarded(flags: Int32, id: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -23152,36 +23180,36 @@ public extension Api { break case .encryptedChatWaiting(let id, let accessHash, let date, let adminId, let participantId): if boxed { - buffer.appendInt32(1006044124) + buffer.appendInt32(1722964307) } serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) break case .encryptedChatRequested(let flags, let folderId, let id, let accessHash, let date, let adminId, let participantId, let gA): if boxed { - buffer.appendInt32(1651608194) + buffer.appendInt32(1223809356) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)} serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gA, buffer: buffer, boxed: false) break case .encryptedChat(let id, let accessHash, let date, let adminId, let participantId, let gAOrB, let keyFingerprint): if boxed { - buffer.appendInt32(-94974410) + buffer.appendInt32(1643173063) } serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gAOrB, buffer: buffer, boxed: false) serializeInt64(keyFingerprint, buffer: buffer, boxed: false) break @@ -23228,10 +23256,10 @@ public extension Api { _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -23255,10 +23283,10 @@ public extension Api { _4 = reader.readInt64() var _5: Int32? _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() - var _7: Int32? - _7 = reader.readInt32() + var _6: Int64? + _6 = reader.readInt64() + var _7: Int64? + _7 = reader.readInt64() var _8: Buffer? _8 = parseBytes(reader) let _c1 = _1 != nil @@ -23283,10 +23311,10 @@ public extension Api { _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() var _6: Buffer? _6 = parseBytes(reader) var _7: Int64? @@ -23498,16 +23526,16 @@ public extension Api { } public enum WebAuthorization: TypeConstructorDescription { - case webAuthorization(hash: Int64, botId: Int32, domain: String, browser: String, platform: String, dateCreated: Int32, dateActive: Int32, ip: String, region: String) + case webAuthorization(hash: Int64, botId: Int64, 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) + buffer.appendInt32(-1493633966) } serializeInt64(hash, buffer: buffer, boxed: false) - serializeInt32(botId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) serializeString(domain, buffer: buffer, boxed: false) serializeString(browser, buffer: buffer, boxed: false) serializeString(platform, buffer: buffer, boxed: false) @@ -23529,8 +23557,8 @@ public extension Api { public static func parse_webAuthorization(_ reader: BufferReader) -> WebAuthorization? { var _1: Int64? _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: String? @@ -23564,15 +23592,15 @@ public extension Api { } public enum ImportedContact: TypeConstructorDescription { - case importedContact(userId: Int32, clientId: Int64) + case importedContact(userId: Int64, clientId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .importedContact(let userId, let clientId): if boxed { - buffer.appendInt32(-805141448) + buffer.appendInt32(-1052885936) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt64(clientId, buffer: buffer, boxed: false) break } @@ -23586,8 +23614,8 @@ public extension Api { } public static func parse_importedContact(_ reader: BufferReader) -> ImportedContact? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil diff --git a/submodules/TelegramApi/Sources/Api3.swift b/submodules/TelegramApi/Sources/Api3.swift index da75f10e38..80854e60f0 100644 --- a/submodules/TelegramApi/Sources/Api3.swift +++ b/submodules/TelegramApi/Sources/Api3.swift @@ -301,19 +301,19 @@ public struct payments { } public enum PaymentForm: TypeConstructorDescription { - case paymentForm(flags: Int32, formId: Int64, botId: Int32, invoice: Api.Invoice, providerId: Int32, url: String, nativeProvider: String?, nativeParams: Api.DataJSON?, savedInfo: Api.PaymentRequestedInfo?, savedCredentials: Api.PaymentSavedCredentials?, users: [Api.User]) + case paymentForm(flags: Int32, formId: Int64, botId: Int64, invoice: Api.Invoice, providerId: Int64, url: String, nativeProvider: String?, nativeParams: Api.DataJSON?, savedInfo: Api.PaymentRequestedInfo?, savedCredentials: Api.PaymentSavedCredentials?, users: [Api.User]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .paymentForm(let flags, let formId, let botId, let invoice, let providerId, let url, let nativeProvider, let nativeParams, let savedInfo, let savedCredentials, let users): if boxed { - buffer.appendInt32(-1928649707) + buffer.appendInt32(378828315) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(formId, buffer: buffer, boxed: false) - serializeInt32(botId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) invoice.serialize(buffer, true) - serializeInt32(providerId, buffer: buffer, boxed: false) + serializeInt64(providerId, buffer: buffer, boxed: false) serializeString(url, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 4) != 0 {serializeString(nativeProvider!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 4) != 0 {nativeParams!.serialize(buffer, true)} @@ -340,14 +340,14 @@ public struct payments { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.Invoice? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.Invoice } - var _5: Int32? - _5 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() var _6: String? _6 = parseString(reader) var _7: String? @@ -389,18 +389,18 @@ public struct payments { } public enum PaymentReceipt: TypeConstructorDescription { - case paymentReceipt(flags: Int32, date: Int32, botId: Int32, providerId: Int32, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User]) + case paymentReceipt(flags: Int32, date: Int32, botId: Int64, providerId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users): if boxed { - buffer.appendInt32(280319440) + buffer.appendInt32(1891958275) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(botId, buffer: buffer, boxed: false) - serializeInt32(providerId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) + serializeInt64(providerId, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) serializeString(description, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)} @@ -432,10 +432,10 @@ public struct payments { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int64? + _4 = reader.readInt64() var _5: String? _5 = parseString(reader) var _6: String? @@ -1081,15 +1081,15 @@ public struct auth { } public enum ExportedAuthorization: TypeConstructorDescription { - case exportedAuthorization(id: Int32, bytes: Buffer) + case exportedAuthorization(id: Int64, bytes: Buffer) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .exportedAuthorization(let id, let bytes): if boxed { - buffer.appendInt32(-543777747) + buffer.appendInt32(-1271602504) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) break } @@ -1103,8 +1103,8 @@ public struct auth { } public static func parse_exportedAuthorization(_ reader: BufferReader) -> ExportedAuthorization? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Buffer? _2 = parseBytes(reader) let _c1 = _1 != nil diff --git a/submodules/TelegramApi/Sources/Api4.swift b/submodules/TelegramApi/Sources/Api4.swift index 8e3c974239..01ee7d95e9 100644 --- a/submodules/TelegramApi/Sources/Api4.swift +++ b/submodules/TelegramApi/Sources/Api4.swift @@ -916,7 +916,7 @@ public struct account { } public enum Themes: TypeConstructorDescription { case themesNotModified - case themes(hash: Int32, themes: [Api.Theme]) + case themes(hash: Int64, themes: [Api.Theme]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -928,9 +928,9 @@ public struct account { break case .themes(let hash, let themes): if boxed { - buffer.appendInt32(2137482273) + buffer.appendInt32(-1707242387) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(themes.count)) for item in themes { @@ -953,8 +953,8 @@ public struct account { return Api.account.Themes.themesNotModified } public static func parse_themes(_ reader: BufferReader) -> Themes? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.Theme]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Theme.self) @@ -972,7 +972,7 @@ public struct account { } public enum WallPapers: TypeConstructorDescription { case wallPapersNotModified - case wallPapers(hash: Int32, wallpapers: [Api.WallPaper]) + case wallPapers(hash: Int64, wallpapers: [Api.WallPaper]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -984,9 +984,9 @@ public struct account { break case .wallPapers(let hash, let wallpapers): if boxed { - buffer.appendInt32(1881892265) + buffer.appendInt32(-842824308) } - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(wallpapers.count)) for item in wallpapers { @@ -1009,8 +1009,8 @@ public struct account { return Api.account.WallPapers.wallPapersNotModified } public static func parse_wallPapers(_ reader: BufferReader) -> WallPapers? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.WallPaper]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self) @@ -2079,16 +2079,16 @@ public extension Api { }) } - public static func getDialogs(flags: Int32, folderId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getDialogs(flags: Int32, folderId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1594999949) + buffer.appendInt32(-1594569905) serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 1) != 0 {serializeInt32(folderId!, 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) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getDialogs", parameters: [("flags", flags), ("folderId", folderId), ("offsetDate", offsetDate), ("offsetId", offsetId), ("offsetPeer", offsetPeer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Dialogs? in let reader = BufferReader(buffer) var result: Api.messages.Dialogs? @@ -2099,9 +2099,9 @@ public extension Api { }) } - public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-591691168) + buffer.appendInt32(1143203525) peer.serialize(buffer, true) serializeInt32(offsetId, buffer: buffer, boxed: false) serializeInt32(offsetDate, buffer: buffer, boxed: false) @@ -2109,7 +2109,7 @@ public extension Api { serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getHistory", parameters: [("peer", peer), ("offsetId", offsetId), ("offsetDate", offsetDate), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? @@ -2120,9 +2120,9 @@ public extension Api { }) } - public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputPeer?, topMsgId: Int32?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputPeer?, topMsgId: Int32?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(204812012) + buffer.appendInt32(-1593989278) serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) serializeString(q, buffer: buffer, boxed: false) @@ -2136,7 +2136,7 @@ public extension Api { serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.search", parameters: [("flags", flags), ("peer", peer), ("q", q), ("fromId", fromId), ("topMsgId", topMsgId), ("filter", filter), ("minDate", minDate), ("maxDate", maxDate), ("offsetId", offsetId), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? @@ -2355,13 +2355,13 @@ public extension Api { }) } - public static func getChats(id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getChats(id: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1013621127) + buffer.appendInt32(1240027791) buffer.appendInt32(481674261) buffer.appendInt32(Int32(id.count)) for item in id { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "messages.getChats", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) @@ -2373,10 +2373,10 @@ public extension Api { }) } - public static func getFullChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getFullChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(998448230) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-1364194508) + serializeInt64(chatId, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getFullChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in let reader = BufferReader(buffer) var result: Api.messages.ChatFull? @@ -2387,10 +2387,10 @@ public extension Api { }) } - public static func editChatTitle(chatId: Int32, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func editChatTitle(chatId: Int64, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-599447467) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(1937260541) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.editChatTitle", parameters: [("chatId", chatId), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) @@ -2402,10 +2402,10 @@ public extension Api { }) } - public static func editChatPhoto(chatId: Int32, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func editChatPhoto(chatId: Int64, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-900957736) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(903730804) + serializeInt64(chatId, buffer: buffer, boxed: false) photo.serialize(buffer, true) return (FunctionDescription(name: "messages.editChatPhoto", parameters: [("chatId", chatId), ("photo", photo)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) @@ -2417,10 +2417,10 @@ public extension Api { }) } - public static func addChatUser(chatId: Int32, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func addChatUser(chatId: Int64, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-106911223) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-230206493) + serializeInt64(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) serializeInt32(fwdLimit, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.addChatUser", parameters: [("chatId", chatId), ("userId", userId), ("fwdLimit", fwdLimit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in @@ -2433,11 +2433,11 @@ public extension Api { }) } - public static func deleteChatUser(flags: Int32, chatId: Int32, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func deleteChatUser(flags: Int32, chatId: Int64, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-986430054) + buffer.appendInt32(-1575461717) serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) return (FunctionDescription(name: "messages.deleteChatUser", parameters: [("flags", flags), ("chatId", chatId), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) @@ -2657,11 +2657,11 @@ public extension Api { }) } - public static func getStickers(emoticon: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getStickers(emoticon: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(71126828) + buffer.appendInt32(-710552671) serializeString(emoticon, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getStickers", parameters: [("emoticon", emoticon), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Stickers? in let reader = BufferReader(buffer) var result: Api.messages.Stickers? @@ -2672,10 +2672,10 @@ public extension Api { }) } - public static func getAllStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getAllStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(479598769) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(-1197432408) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getAllStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in let reader = BufferReader(buffer) var result: Api.messages.AllStickers? @@ -2831,10 +2831,10 @@ public extension Api { }) } - public static func editChatAdmin(chatId: Int32, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func editChatAdmin(chatId: Int64, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1444503762) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-1470377534) + serializeInt64(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) isAdmin.serialize(buffer, true) return (FunctionDescription(name: "messages.editChatAdmin", parameters: [("chatId", chatId), ("userId", userId), ("isAdmin", isAdmin)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in @@ -2847,10 +2847,10 @@ public extension Api { }) } - public static func migrateChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func migrateChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(363051235) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-1568189671) + serializeInt64(chatId, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.migrateChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? @@ -2919,10 +2919,10 @@ public extension Api { }) } - public static func getSavedGifs(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getSavedGifs(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-2084618926) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(1559270965) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getSavedGifs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SavedGifs? in let reader = BufferReader(buffer) var result: Api.messages.SavedGifs? @@ -3163,10 +3163,10 @@ public extension Api { }) } - public static func getFeaturedStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getFeaturedStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(766298703) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(1685588756) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getFeaturedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in let reader = BufferReader(buffer) var result: Api.messages.FeaturedStickers? @@ -3195,11 +3195,11 @@ public extension Api { }) } - public static func getRecentStickers(flags: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getRecentStickers(flags: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1587647177) + buffer.appendInt32(-1649852357) serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getRecentStickers", parameters: [("flags", flags), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.RecentStickers? in let reader = BufferReader(buffer) var result: Api.messages.RecentStickers? @@ -3256,10 +3256,10 @@ public extension Api { }) } - public static func getMaskStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getMaskStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1706608543) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(1678738104) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getMaskStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in let reader = BufferReader(buffer) var result: Api.messages.AllStickers? @@ -3350,11 +3350,11 @@ public extension Api { }) } - public static func getCommonChats(userId: Api.InputUser, maxId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getCommonChats(userId: Api.InputUser, maxId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(218777796) + buffer.appendInt32(-468934396) userId.serialize(buffer, true) - serializeInt32(maxId, buffer: buffer, boxed: false) + serializeInt64(maxId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getCommonChats", parameters: [("userId", userId), ("maxId", maxId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) @@ -3366,13 +3366,13 @@ public extension Api { }) } - public static func getAllChats(exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getAllChats(exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-341307408) + buffer.appendInt32(-2023787330) buffer.appendInt32(481674261) buffer.appendInt32(Int32(exceptIds.count)) for item in exceptIds { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "messages.getAllChats", parameters: [("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) @@ -3516,10 +3516,10 @@ public extension Api { }) } - public static func getFavedStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getFavedStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(567151374) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(82946729) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getFavedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FavedStickers? in let reader = BufferReader(buffer) var result: Api.messages.FavedStickers? @@ -3578,12 +3578,12 @@ public extension Api { }) } - public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1144759543) + buffer.appendInt32(1881817312) peer.serialize(buffer, true) serializeInt32(limit, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getRecentLocations", parameters: [("peer", peer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? @@ -3631,12 +3631,12 @@ public extension Api { }) } - public static func searchStickerSets(flags: Int32, q: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func searchStickerSets(flags: Int32, q: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1028140917) + buffer.appendInt32(896555914) serializeInt32(flags, buffer: buffer, boxed: false) serializeString(q, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.searchStickerSets", parameters: [("flags", flags), ("q", q), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FoundStickerSets? in let reader = BufferReader(buffer) var result: Api.messages.FoundStickerSets? @@ -3945,11 +3945,11 @@ public extension Api { }) } - public static func getScheduledHistory(peer: Api.InputPeer, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getScheduledHistory(peer: Api.InputPeer, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-490575781) + buffer.appendInt32(-183077365) peer.serialize(buffer, true) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getScheduledHistory", parameters: [("peer", peer), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? @@ -4117,12 +4117,12 @@ public extension Api { }) } - public static func getOldFeaturedStickers(offset: Int32, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getOldFeaturedStickers(offset: Int32, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1608974939) + buffer.appendInt32(2127598753) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getOldFeaturedStickers", parameters: [("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in let reader = BufferReader(buffer) var result: Api.messages.FeaturedStickers? @@ -4133,9 +4133,9 @@ public extension Api { }) } - public static func getReplies(peer: Api.InputPeer, msgId: Int32, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getReplies(peer: Api.InputPeer, msgId: Int32, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(615875002) + buffer.appendInt32(584962828) peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) serializeInt32(offsetId, buffer: buffer, boxed: false) @@ -4144,7 +4144,7 @@ public extension Api { serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getReplies", parameters: [("peer", peer), ("msgId", msgId), ("offsetId", offsetId), ("offsetDate", offsetDate), ("addOffset", addOffset), ("limit", limit), ("maxId", maxId), ("minId", minId), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? @@ -4200,10 +4200,10 @@ public extension Api { }) } - public static func deleteChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func deleteChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-2094760687) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(1540419152) + serializeInt64(chatId, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.deleteChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? @@ -4447,6 +4447,21 @@ public extension Api { return result }) } + + public static func getMessageReadParticipants(peer: Api.InputPeer, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int64]>) { + let buffer = Buffer() + buffer.appendInt32(745510839) + peer.serialize(buffer, true) + serializeInt32(msgId, buffer: buffer, boxed: false) + return (FunctionDescription(name: "messages.getMessageReadParticipants", parameters: [("peer", peer), ("msgId", msgId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int64]? in + let reader = BufferReader(buffer) + var result: [Int64]? + if let _ = reader.readInt32() { + result = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) + } + return result + }) + } } public struct channels { public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { @@ -4537,14 +4552,14 @@ public extension Api { }) } - public static func getParticipants(channel: Api.InputChannel, filter: Api.ChannelParticipantsFilter, offset: Int32, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getParticipants(channel: Api.InputChannel, filter: Api.ChannelParticipantsFilter, offset: Int32, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(306054633) + buffer.appendInt32(2010044880) channel.serialize(buffer, true) filter.serialize(buffer, true) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "channels.getParticipants", parameters: [("channel", channel), ("filter", filter), ("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.ChannelParticipants? in let reader = BufferReader(buffer) var result: Api.channels.ChannelParticipants? @@ -5343,10 +5358,10 @@ public extension Api { }) } - public static func importAuthorization(id: Int32, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func importAuthorization(id: Int64, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-470837741) - serializeInt32(id, buffer: buffer, boxed: false) + buffer.appendInt32(-1518699091) + serializeInt64(id, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) return (FunctionDescription(name: "auth.importAuthorization", parameters: [("id", id), ("bytes", bytes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) @@ -5484,15 +5499,15 @@ public extension Api { }) } - public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1313598185) + buffer.appendInt32(-1210022402) serializeInt32(apiId, buffer: buffer, boxed: false) serializeString(apiHash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(exceptIds.count)) for item in exceptIds { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "auth.exportLoginToken", parameters: [("apiId", apiId), ("apiHash", apiHash), ("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.LoginToken? in let reader = BufferReader(buffer) @@ -5680,10 +5695,10 @@ public extension Api { } } public struct contacts { - public static func getContactIDs(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int32]>) { + public static func getContactIDs(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Int32]>) { let buffer = Buffer() - buffer.appendInt32(749357634) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(2061264541) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "contacts.getContactIDs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in let reader = BufferReader(buffer) var result: [Int32]? @@ -5708,10 +5723,10 @@ public extension Api { }) } - public static func getContacts(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getContacts(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1071414113) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(1574346258) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "contacts.getContacts", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Contacts? in let reader = BufferReader(buffer) var result: Api.contacts.Contacts? @@ -5848,13 +5863,13 @@ public extension Api { }) } - public static func getTopPeers(flags: Int32, offset: Int32, limit: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getTopPeers(flags: Int32, offset: Int32, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-728224331) + buffer.appendInt32(-1758168906) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "contacts.getTopPeers", parameters: [("flags", flags), ("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.TopPeers? in let reader = BufferReader(buffer) var result: Api.contacts.TopPeers? @@ -6646,9 +6661,9 @@ public extension Api { } } public struct account { - public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1754754159) + buffer.appendInt32(-326762118) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(tokenType, buffer: buffer, boxed: false) serializeString(token, buffer: buffer, boxed: false) @@ -6657,7 +6672,7 @@ public extension Api { buffer.appendInt32(481674261) buffer.appendInt32(Int32(otherUids.count)) for item in otherUids { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "account.registerDevice", parameters: [("flags", flags), ("tokenType", tokenType), ("token", token), ("appSandbox", appSandbox), ("secret", secret), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) @@ -6669,15 +6684,15 @@ public extension Api { }) } - public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(813089983) + buffer.appendInt32(1779249670) serializeInt32(tokenType, buffer: buffer, boxed: false) serializeString(token, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(otherUids.count)) for item in otherUids { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "account.unregisterDevice", parameters: [("tokenType", tokenType), ("token", token), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) @@ -6763,10 +6778,10 @@ public extension Api { }) } - public static func getWallPapers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getWallPapers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1430579357) - serializeInt32(hash, buffer: buffer, boxed: false) + buffer.appendInt32(127302966) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "account.getWallPapers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.WallPapers? in let reader = BufferReader(buffer) var result: Api.account.WallPapers? @@ -7164,10 +7179,10 @@ public extension Api { }) } - public static func getAuthorizationForm(botId: Int32, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getAuthorizationForm(botId: Int64, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1200903967) - serializeInt32(botId, buffer: buffer, boxed: false) + buffer.appendInt32(-1456907910) + serializeInt64(botId, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false) serializeString(publicKey, buffer: buffer, boxed: false) return (FunctionDescription(name: "account.getAuthorizationForm", parameters: [("botId", botId), ("scope", scope), ("publicKey", publicKey)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.AuthorizationForm? in @@ -7180,10 +7195,10 @@ public extension Api { }) } - public static func acceptAuthorization(botId: Int32, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func acceptAuthorization(botId: Int64, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-419267436) - serializeInt32(botId, buffer: buffer, boxed: false) + buffer.appendInt32(-202552205) + serializeInt64(botId, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false) serializeString(publicKey, buffer: buffer, boxed: false) buffer.appendInt32(481674261) @@ -7583,11 +7598,11 @@ public extension Api { }) } - public static func getThemes(format: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getThemes(format: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(676939512) + buffer.appendInt32(1913054296) serializeString(format, buffer: buffer, boxed: false) - serializeInt32(hash, buffer: buffer, boxed: false) + serializeInt64(hash, buffer: buffer, boxed: false) return (FunctionDescription(name: "account.getThemes", parameters: [("format", format), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Themes? in let reader = BufferReader(buffer) var result: Api.account.Themes? diff --git a/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift b/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift index 86c7fb2049..bca3f90d24 100644 --- a/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift +++ b/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift @@ -169,7 +169,7 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate { func startCall(context: AccountContext, peerId: PeerId, isVideo: Bool, displayTitle: String) { let uuid = UUID() self.currentStartCallAccount = (uuid, context) - let handle = CXHandle(type: .generic, value: "\(peerId.id._internalGetInt32Value())") + let handle = CXHandle(type: .generic, value: "\(peerId.id._internalGetInt64Value())") let startCallAction = CXStartCallAction(call: uuid, handle: handle) startCallAction.contactIdentifier = displayTitle diff --git a/submodules/TelegramCallsUI/Sources/CallRatingController.swift b/submodules/TelegramCallsUI/Sources/CallRatingController.swift index e79ce92ec5..b2b89b7630 100644 --- a/submodules/TelegramCallsUI/Sources/CallRatingController.swift +++ b/submodules/TelegramCallsUI/Sources/CallRatingController.swift @@ -240,7 +240,7 @@ private final class CallRatingAlertContentNode: AlertContentNode { } func rateCallAndSendLogs(engine: TelegramEngine, callId: CallId, starsCount: Int, comment: String, userInitiated: Bool, includeLogs: Bool) -> Signal { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4244000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4244000)) let rate = engine.calls.rateCall(callId: callId, starsCount: Int32(starsCount), comment: comment, userInitiated: userInitiated) if includeLogs { diff --git a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift index 0769584735..f1ddbbb019 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift @@ -204,8 +204,8 @@ public final class PresentationCallManagerImpl: PresentationCallManager { }) startCallImpl = { [weak self] context, uuid, handle, isVideo in - if let strongSelf = self, let userId = Int32(handle) { - return strongSelf.startCall(context: context, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), isVideo: isVideo, internalId: uuid) + if let strongSelf = self, let userId = Int64(handle) { + return strongSelf.startCall(context: context, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), isVideo: isVideo, internalId: uuid) |> take(1) |> map { result -> Bool in return result diff --git a/submodules/TelegramCore/Sources/Account/Account.swift b/submodules/TelegramCore/Sources/Account/Account.swift index d3f7e8f9f7..f514da28e5 100644 --- a/submodules/TelegramCore/Sources/Account/Account.swift +++ b/submodules/TelegramCore/Sources/Account/Account.swift @@ -106,7 +106,9 @@ public class UnauthorizedAccount { network.context.performBatchUpdates({ var datacenterIds: [Int] = [1, 2] - if !testingEnvironment { + if testingEnvironment { + datacenterIds = [3] + } else { datacenterIds.append(contentsOf: [4]) } for id in datacenterIds { diff --git a/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift b/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift index 5f394fb703..194cf5a28c 100644 --- a/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift +++ b/submodules/TelegramCore/Sources/Account/AccountIntermediateState.swift @@ -354,7 +354,7 @@ struct AccountMutableState { for chat in chats { switch chat { - case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount): + case let .channel(_, _, _, _, _, _, _, _, _, _, _, participantsCount): if let participantsCount = participantsCount { self.addOperation(.UpdateCachedPeerData(chat.peerId, { current in var previous: CachedChannelData @@ -416,7 +416,7 @@ struct AccountMutableState { switch user { case let .user(_, id, _, _, _, _, _, _, status, _, _, _, _): if let status = status { - presences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))] = status + presences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] = status } break case .userEmpty: diff --git a/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift b/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift index 197ba7a61e..d4db336c18 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift @@ -29,7 +29,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { if let migratedTo = migratedTo { switch migratedTo { case let .inputChannel(channelId, accessHash): - migrationReference = TelegramGroupToChannelMigrationReference(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), accessHash: accessHash) + migrationReference = TelegramGroupToChannelMigrationReference(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), accessHash: accessHash) case .inputChannelEmpty: break case .inputChannelFromMessage: @@ -52,12 +52,12 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { if (flags & Int32(1 << 24)) != 0 { groupFlags.insert(.hasActiveVoiceChat) } - return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), role: role, membership: left ? .Left : .Member, flags: groupFlags, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init(apiBannedRights:)), migrationReference: migrationReference, creationDate: date, version: Int(version)) + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), role: role, membership: left ? .Left : .Member, flags: groupFlags, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init(apiBannedRights:)), migrationReference: migrationReference, creationDate: date, version: Int(version)) case let .chatEmpty(id): - return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) case let .chatForbidden(id, title): - return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) - case let .channel(flags, id, accessHash, title, username, photo, date, version, restrictionReason, adminRights, bannedRights, defaultBannedRights, _): + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + case let .channel(flags, id, accessHash, title, username, photo, date, restrictionReason, adminRights, bannedRights, defaultBannedRights, _): let isMin = (flags & (1 << 12)) != 0 let participationStatus: TelegramChannelParticipationStatus @@ -128,7 +128,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { } } - return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: version, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init)) + return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: 0, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init)) case let .channelForbidden(flags, id, accessHash, title, untilDate): let info: TelegramChannelInfo if (flags & Int32(1 << 8)) != 0 { @@ -137,7 +137,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { info = .broadcast(TelegramChannelBroadcastInfo(flags: [])) } - return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)), accessHash: .personal(accessHash), title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil, adminRights: nil, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: untilDate ?? Int32.max), defaultBannedRights: nil) + return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: .personal(accessHash), title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil, adminRights: nil, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: untilDate ?? Int32.max), defaultBannedRights: nil) } } @@ -145,7 +145,7 @@ func mergeGroupOrChannel(lhs: Peer?, rhs: Api.Chat) -> Peer? { switch rhs { case .chat, .chatEmpty, .chatForbidden, .channelForbidden: return parseTelegramGroupOrChannel(chat: rhs) - case let .channel(flags, _, accessHash, title, username, photo, _, _, _, _, _, defaultBannedRights, _): + case let .channel(flags, _, accessHash, title, username, photo, _, _, _, _, defaultBannedRights, _): let isMin = (flags & (1 << 12)) != 0 if accessHash != nil && !isMin { return parseTelegramGroupOrChannel(chat: rhs) diff --git a/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift b/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift index 7511586eb5..19bb0ca95e 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift @@ -7,11 +7,11 @@ public extension PeerReference { var id: PeerId { switch self { case let .user(id, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) case let .group(id): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)) case let .channel(id, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)) } } } @@ -48,12 +48,12 @@ extension PeerReference { func forceApiInputPeer(_ peer: Peer) -> Api.InputPeer? { switch peer { case let user as TelegramUser: - return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt32Value(), accessHash: user.accessHash?.value ?? 0) + return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt64Value(), accessHash: user.accessHash?.value ?? 0) case let group as TelegramGroup: - return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt32Value()) + return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt64Value()) case let channel as TelegramChannel: if let accessHash = channel.accessHash { - return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -65,12 +65,12 @@ func forceApiInputPeer(_ peer: Peer) -> Api.InputPeer? { func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { switch peer { case let user as TelegramUser where user.accessHash != nil: - return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt32Value(), accessHash: user.accessHash!.value) + return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt64Value(), accessHash: user.accessHash!.value) case let group as TelegramGroup: - return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt32Value()) + return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt64Value()) case let channel as TelegramChannel: if let accessHash = channel.accessHash { - return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -81,7 +81,7 @@ func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { func apiInputChannel(_ peer: Peer) -> Api.InputChannel? { if let channel = peer as? TelegramChannel, let accessHash = channel.accessHash { - return Api.InputChannel.inputChannel(channelId: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputChannel.inputChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -89,7 +89,7 @@ func apiInputChannel(_ peer: Peer) -> Api.InputChannel? { func apiInputUser(_ peer: Peer) -> Api.InputUser? { if let user = peer as? TelegramUser, let accessHash = user.accessHash { - return Api.InputUser.inputUser(userId: user.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputUser.inputUser(userId: user.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -97,7 +97,7 @@ func apiInputUser(_ peer: Peer) -> Api.InputUser? { func apiInputSecretChat(_ peer: Peer) -> Api.InputEncryptedChat? { if let chat = peer as? TelegramSecretChat { - return Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: chat.accessHash) + return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: chat.accessHash) } else { return nil } diff --git a/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift b/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift index 9308fcc9ee..d8622dc414 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift @@ -198,17 +198,17 @@ extension ChannelParticipant { init(apiParticipant: Api.ChannelParticipant) { switch apiParticipant { case let .channelParticipant(userId, date): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) case let .channelParticipantCreator(_, userId, adminRights, rank): - self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), canBeEditedByAccountPeer: true), rank: rank) + self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), canBeEditedByAccountPeer: true), rank: rank) case let .channelParticipantBanned(flags, userId, restrictedBy, date, bannedRights): let hasLeft = (flags & (1 << 0)) != 0 - let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(restrictedBy)), timestamp: date, isMember: !hasLeft) + let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(restrictedBy)), timestamp: date, isMember: !hasLeft) self = .member(id: userId.peerId, invitedAt: date, adminInfo: nil, banInfo: banInfo, rank: nil) case let .channelParticipantAdmin(flags, userId, _, promotedBy, date, adminRights, rank: rank): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedAt: date, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(promotedBy)), canBeEditedByAccountPeer: (flags & (1 << 0)) != 0), banInfo: nil, rank: rank) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(promotedBy)), canBeEditedByAccountPeer: (flags & (1 << 0)) != 0), banInfo: nil, rank: rank) case let .channelParticipantSelf(userId, _, date): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) case let .channelParticipantLeft(userId): self = .member(id: userId.peerId, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil) } diff --git a/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift b/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift index 75705d1f95..3dc2195436 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift @@ -7,11 +7,11 @@ extension GroupParticipant { init(apiParticipant: Api.ChatParticipant) { switch apiParticipant { case let .chatParticipantCreator(userId): - self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) case let .chatParticipantAdmin(userId, inviterId, date): - self = .admin(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)), invitedAt: date) + self = .admin(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)), invitedAt: date) case let .chatParticipant(userId, inviterId, date): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)), invitedAt: date) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)), invitedAt: date) } } } diff --git a/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift b/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift index ce25d8aaf3..81e7e3e49f 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ExportedInvitation.swift @@ -7,7 +7,7 @@ extension ExportedInvitation { init(apiExportedInvite: Api.ExportedChatInvite) { switch apiExportedInvite { case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage): - self = ExportedInvitation(link: link, isPermanent: (flags & (1 << 5)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage) + self = ExportedInvitation(link: link, isPermanent: (flags & (1 << 5)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage) } } } diff --git a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift index d725e46ef3..1e15edb319 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift @@ -156,14 +156,14 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] { } if let viaBotId = viaBotId { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(viaBotId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(viaBotId))) } if let media = media { switch media { case let .messageMediaContact(_, _, _, _, userId): if userId != 0 { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) } default: break @@ -174,7 +174,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] { for entity in entities { switch entity { case let .messageEntityMentionName(_, _, userId): - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) default: break } @@ -198,27 +198,27 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] { case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme: break case let .messageActionChannelMigrateFrom(_, chatId): - result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))) case let .messageActionChatAddUser(users): for id in users { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))) } case let .messageActionChatCreate(_, users): for id in users { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))) } case let .messageActionChatDeleteUser(userId): - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) case let .messageActionChatJoinedByLink(inviterId): - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId))) case let .messageActionChatMigrateTo(channelId): - result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) case let .messageActionGeoProximityReached(fromId, toId, _): result.append(fromId.peerId) result.append(toId.peerId) case let .messageActionInviteToGroupCall(_, userIds): for id in userIds { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))) } } @@ -262,7 +262,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI return (TelegramMediaExpiredContent(data: .image), nil) } case let .messageMediaContact(phoneNumber, firstName, lastName, vcard, userId): - let contactPeerId: PeerId? = userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let contactPeerId: PeerId? = userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId, vCardData: vcard.isEmpty ? nil : vcard) return (mediaContact, nil) case let .messageMediaGeo(geo): @@ -353,7 +353,7 @@ func messageTextEntitiesFromApiEntities(_ entities: [Api.MessageEntity]) -> [Mes case let .messageEntityTextUrl(offset, length, url): result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextUrl(url: url))) case let .messageEntityMentionName(offset, length, userId): - result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextMention(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))))) + result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextMention(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))))) case let .messageEntityPhone(offset, length): result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .PhoneNumber)) case let .messageEntityCashtag(offset, length): @@ -384,10 +384,10 @@ extension StoreMessage { peerId = chatPeerId.peerId authorId = resolvedFromId case let .peerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) authorId = resolvedFromId case let .peerChannel(channelId): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) authorId = resolvedFromId } @@ -501,7 +501,7 @@ extension StoreMessage { } if let viaBotId = viaBotId { - attributes.append(InlineBotMessageAttribute(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(viaBotId)), title: nil)) + attributes.append(InlineBotMessageAttribute(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(viaBotId)), title: nil)) } if namespace != Namespaces.Message.ScheduledCloud { @@ -560,7 +560,7 @@ extension StoreMessage { recentRepliersPeerIds = nil } - let commentsPeerId = channelId.flatMap { PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value($0)) } + let commentsPeerId = channelId.flatMap { PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value($0)) } attributes.append(ReplyThreadMessageAttribute(count: repliesCount, latestUsers: recentRepliersPeerIds ?? [], commentsPeerId: commentsPeerId, maxMessageId: maxId, maxReadMessageId: readMaxId)) } diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift index 3cd70e1c3f..df9db3bfb3 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift @@ -8,23 +8,23 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe case let .messageActionChannelCreate(title): return TelegramMediaAction(action: .groupCreated(title: title)) case let .messageActionChannelMigrateFrom(title, chatId): - return TelegramMediaAction(action: .channelMigratedFromGroup(title: title, groupId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)))) + return TelegramMediaAction(action: .channelMigratedFromGroup(title: title, groupId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))) case let .messageActionChatAddUser(users): - return TelegramMediaAction(action: .addedMembers(peerIds: users.map({ PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value($0)) }))) + return TelegramMediaAction(action: .addedMembers(peerIds: users.map({ PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) }))) case let .messageActionChatCreate(title, _): return TelegramMediaAction(action: .groupCreated(title: title)) case .messageActionChatDeletePhoto: return TelegramMediaAction(action: .photoUpdated(image: nil)) case let .messageActionChatDeleteUser(userId): - return TelegramMediaAction(action: .removedMembers(peerIds: [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))])) + return TelegramMediaAction(action: .removedMembers(peerIds: [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))])) case let .messageActionChatEditPhoto(photo): return TelegramMediaAction(action: .photoUpdated(image: telegramMediaImageFromApiPhoto(photo))) case let .messageActionChatEditTitle(title): return TelegramMediaAction(action: .titleUpdated(title: title)) case let .messageActionChatJoinedByLink(inviterId): - return TelegramMediaAction(action: .joinedByLink(inviter: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)))) + return TelegramMediaAction(action: .joinedByLink(inviter: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)))) case let .messageActionChatMigrateTo(channelId): - return TelegramMediaAction(action: .groupMigratedToChannel(channelId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)))) + return TelegramMediaAction(action: .groupMigratedToChannel(channelId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)))) case .messageActionHistoryClear: return TelegramMediaAction(action: .historyCleared) case .messageActionPinMessage: @@ -67,7 +67,7 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe switch call { case let .inputGroupCall(id, accessHash): return TelegramMediaAction(action: .inviteToGroupPhoneCall(callId: id, accessHash: accessHash, peerIds: userIds.map { userId in - PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) })) } case let .messageActionSetMessagesTTL(period): diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift index 0316add8e5..dfa545f2cd 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift @@ -35,7 +35,7 @@ extension TelegramMediaPollResults { } self.init(voters: results.flatMap({ $0.map(TelegramMediaPollOptionVoters.init(apiVoters:)) }), totalVoters: totalVoters, recentVoters: recentVoters.flatMap { recentVoters in - return recentVoters.map { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value($0)) } + return recentVoters.map { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) } } ?? [], solution: parsedSolution) } } diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift index 822edcf0e1..38bc91b459 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift @@ -69,9 +69,9 @@ extension TelegramUser { let restrictionInfo: PeerAccessRestrictionInfo? = restrictionReason.flatMap(PeerAccessRestrictionInfo.init(apiReasons:)) - self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)), accessHash: accessHashValue, firstName: firstName, lastName: lastName, username: username, phone: phone, photo: representations, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags) + self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, firstName: firstName, lastName: lastName, username: username, phone: phone, photo: representations, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags) case let .userEmpty(id): - self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)), accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)), accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) } } diff --git a/submodules/TelegramCore/Sources/MacOS/GroupReturnAndLeft.swift b/submodules/TelegramCore/Sources/MacOS/GroupReturnAndLeft.swift index 5073e42342..452366babe 100644 --- a/submodules/TelegramCore/Sources/MacOS/GroupReturnAndLeft.swift +++ b/submodules/TelegramCore/Sources/MacOS/GroupReturnAndLeft.swift @@ -9,7 +9,7 @@ public func returnGroup(account: Account, peerId: PeerId) -> Signal take(1) |> mapToSignal { peer -> Signal in if let inputUser = apiInputUser(peer) { - return account.network.request(Api.functions.messages.addChatUser(chatId: peerId.id._internalGetInt32Value(), userId: inputUser, fwdLimit: 50)) + return account.network.request(Api.functions.messages.addChatUser(chatId: peerId.id._internalGetInt64Value(), userId: inputUser, fwdLimit: 50)) |> retryRequest |> mapToSignal { updates -> Signal in account.stateManager.addUpdates(updates) @@ -26,7 +26,7 @@ public func leftGroup(account: Account, peerId: PeerId) -> Signal |> take(1) |> mapToSignal { peer -> Signal in if let inputUser = apiInputUser(peer) { - return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peerId.id._internalGetInt32Value(), userId: inputUser)) + return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peerId.id._internalGetInt64Value(), userId: inputUser)) |> retryRequest |> mapToSignal { updates -> Signal in account.stateManager.addUpdates(updates) diff --git a/submodules/TelegramCore/Sources/Network/Network.swift b/submodules/TelegramCore/Sources/Network/Network.swift index d374004222..9a32066ba9 100644 --- a/submodules/TelegramCore/Sources/Network/Network.swift +++ b/submodules/TelegramCore/Sources/Network/Network.swift @@ -506,7 +506,8 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa if testingEnvironment { seedAddressList = [ 1: ["149.154.175.10"], - 2: ["149.154.167.40"] + 2: ["149.154.167.40"], + 3: ["149.154.175.117"] ] } else { seedAddressList = [ diff --git a/submodules/TelegramCore/Sources/PeerStatistics.swift b/submodules/TelegramCore/Sources/PeerStatistics.swift index f3282247c4..adb54cbb4a 100644 --- a/submodules/TelegramCore/Sources/PeerStatistics.swift +++ b/submodules/TelegramCore/Sources/PeerStatistics.swift @@ -1064,7 +1064,7 @@ extension GroupStatsTopPoster { init(apiStatsGroupTopPoster: Api.StatsGroupTopPoster) { switch apiStatsGroupTopPoster { case let .statsGroupTopPoster(userId, messages, avgChars): - self = GroupStatsTopPoster(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), messageCount: messages, averageChars: avgChars) + self = GroupStatsTopPoster(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), messageCount: messages, averageChars: avgChars) } } } @@ -1073,7 +1073,7 @@ extension GroupStatsTopAdmin { init(apiStatsGroupTopAdmin: Api.StatsGroupTopAdmin) { switch apiStatsGroupTopAdmin { case let .statsGroupTopAdmin(userId, deleted, kicked, banned): - self = GroupStatsTopAdmin(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), deletedCount: deleted, kickedCount: kicked, bannedCount: banned) + self = GroupStatsTopAdmin(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), deletedCount: deleted, kickedCount: kicked, bannedCount: banned) } } } @@ -1082,7 +1082,7 @@ extension GroupStatsTopInviter { init(apiStatsGroupTopInviter: Api.StatsGroupTopInviter) { switch apiStatsGroupTopInviter { case let .statsGroupTopInviter(userId, invitations): - self = GroupStatsTopInviter(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), inviteCount: invitations) + self = GroupStatsTopInviter(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), inviteCount: invitations) } } } diff --git a/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift b/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift index 8f2e3a2516..d5c485279c 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift @@ -86,7 +86,7 @@ public func standaloneUploadedImage(account: Account, peerId: PeerId, text: Stri case let .inputSecretFile(file, _, key): return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in if let peer = transaction.getPeer(peerId) as? TelegramSecretChat { - return Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash) + return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash) } return nil } @@ -180,7 +180,7 @@ public func standaloneUploadedFile(account: Account, peerId: PeerId, text: Strin case let .inputSecretFile(file, _, key): return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in if let peer = transaction.getPeer(peerId) as? TelegramSecretChat { - return Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash) + return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash) } return nil } diff --git a/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift b/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift index ac12d5a720..f1b08a934c 100644 --- a/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift +++ b/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift @@ -16,9 +16,9 @@ extension SecretChatIncomingEncryptedOperation { convenience init(message: Api.EncryptedMessage) { switch message { case let .encryptedMessage(randomId, chatId, date, bytes, file): - self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), globallyUniqueId: randomId, timestamp: date, type: .message, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: SecretChatFileReference(file)) + self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))), globallyUniqueId: randomId, timestamp: date, type: .message, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: SecretChatFileReference(file)) case let .encryptedMessageService(randomId, chatId, date, bytes): - self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), globallyUniqueId: randomId, timestamp: date, type: .service, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: nil) + self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))), globallyUniqueId: randomId, timestamp: date, type: .service, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: nil) } } } diff --git a/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift b/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift index 5aa27b54f2..759ee4495d 100644 --- a/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift +++ b/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift @@ -18,7 +18,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee assert((currentPeer == nil) == (currentState == nil)) switch chat { case let .encryptedChat(_, _, _, adminId, _, gAOrB, remoteKeyFingerprint): - if let currentPeer = currentPeer, let currentState = currentState, adminId == accountPeerId.id._internalGetInt32Value() { + if let currentPeer = currentPeer, let currentState = currentState, adminId == accountPeerId.id._internalGetInt64Value() { if case let .handshake(handshakeState) = currentState.embeddedState, case let .requested(_, p, a) = handshakeState { let pData = p.makeData() let aData = a.makeData() @@ -87,7 +87,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee case .encryptedChatEmpty(_): break case let .encryptedChatRequested(_, folderId, _, accessHash, date, adminId, participantId, gA): - if currentPeer == nil && participantId == accountPeerId.id._internalGetInt32Value() { + if currentPeer == nil && participantId == accountPeerId.id._internalGetInt64Value() { if settings.acceptOnThisDevice { let state = SecretChatState(role: .participant, embeddedState: .handshake(.accepting), keychain: SecretChatKeychain(keys: []), keyFingerprint: nil, messageAutoremoveTimeout: nil) @@ -98,7 +98,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee let updatedState = addSecretChatOutgoingOperation(transaction: transaction, peerId: chat.peerId, operation: .initialHandshakeAccept(gA: MemoryBuffer(gA), accessHash: accessHash, b: b), state: state) transaction.setPeerChatState(chat.peerId, state: updatedState) - let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)), accessHash: accessHash, role: updatedState.role, embeddedState: updatedState.embeddedState.peerState, messageAutoremoveTimeout: nil) + let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), accessHash: accessHash, role: updatedState.role, embeddedState: updatedState.embeddedState.peerState, messageAutoremoveTimeout: nil) updatePeers(transaction: transaction, peers: [peer], update: { _, updated in return updated }) if folderId != nil { transaction.updatePeerChatListInclusion(peer.id, inclusion: .ifHasMessagesOrOneOf(groupId: Namespaces.PeerGroup.archive, pinningIndex: nil, minTimestamp: date)) @@ -121,9 +121,9 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee Logger.shared.log("State", "got encryptedChatRequested, but peer already exists or this account is creator") } case let .encryptedChatWaiting(_, accessHash, date, adminId, participantId): - if let requestData = requestData, currentPeer == nil && adminId == accountPeerId.id._internalGetInt32Value() { + if let requestData = requestData, currentPeer == nil && adminId == accountPeerId.id._internalGetInt64Value() { let state = SecretChatState(role: .creator, embeddedState: .handshake(.requested(g: requestData.g, p: requestData.p, a: requestData.a)), keychain: SecretChatKeychain(keys: []), keyFingerprint: nil, messageAutoremoveTimeout: nil) - let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(participantId)), accessHash: accessHash, role: state.role, embeddedState: state.embeddedState.peerState, messageAutoremoveTimeout: nil) + let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(participantId)), accessHash: accessHash, role: state.role, embeddedState: state.embeddedState.peerState, messageAutoremoveTimeout: nil) updatePeers(transaction: transaction, peers: [peer], update: { _, updated in return updated }) transaction.setPeerChatState(peer.id, state: state) transaction.resetIncomingReadStates([peer.id: [ diff --git a/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift b/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift index 07aed7e121..c4e99bdb74 100644 --- a/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift +++ b/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift @@ -161,7 +161,7 @@ extension SelectivePrivacySettings { current = .enableContacts(enableFor: [:], disableFor: [:]) case let .privacyValueAllowUsers(users): for id in users { - if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))] { + if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] { enableFor[peer.peer.id] = peer } } @@ -171,13 +171,13 @@ extension SelectivePrivacySettings { break case let .privacyValueDisallowUsers(users): for id in users { - if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))] { + if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] { disableFor[peer.peer.id] = peer } } case let .privacyValueAllowChatParticipants(chats): for id in chats { - for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id))] { + for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))] { if let peer = peers[possibleId] { enableFor[peer.peer.id] = peer } @@ -185,7 +185,7 @@ extension SelectivePrivacySettings { } case let .privacyValueDisallowChatParticipants(chats): for id in chats { - for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id))] { + for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))] { if let peer = peers[possibleId] { disableFor[peer.peer.id] = peer } diff --git a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift index 788cf10fb5..22ccb24623 100644 --- a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift +++ b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift @@ -22,7 +22,7 @@ private func peerIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set { } switch group { case let .updateChannelPts(channelId, _, _): - peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) default: break } @@ -76,7 +76,7 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update]) } switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) peerIds.insert(peerId) case let .updateFolderPeers(folderPeers, _, _): for peer in folderPeers { @@ -86,7 +86,7 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update]) } } case let .updateReadChannelInbox(_, _, channelId, _, _, _): - peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) case let .updateReadHistoryInbox(_, _, peer, _, _, _, _): peerIds.insert(peer.peerId) case let .updateDraftMessage(peer, draft): @@ -113,7 +113,7 @@ private func peerIdsRequiringLocalChatStateFromUpdateGroups(_ groups: [UpdateGro for update in group.updates { switch update { case let .updateChannel(channelId): - channelUpdates.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + channelUpdates.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) default: break } @@ -146,7 +146,7 @@ private func locallyGeneratedMessageTimestampsFromUpdateGroups(_ groups: [Update switch update { case let .updateServiceNotification(_, date, _, _, _, _): if let date = date { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) if messageTimestamps[peerId] == nil { messageTimestamps[peerId] = [(Namespaces.Message.Local, date)] } else { @@ -302,7 +302,7 @@ private func peerIdsRequiringLocalChatStateFromDifference(_ difference: Api.upda } switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) peerIds.insert(peerId) default: break @@ -324,7 +324,7 @@ private func peerIdsRequiringLocalChatStateFromDifference(_ difference: Api.upda } switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) peerIds.insert(peerId) default: break @@ -357,7 +357,7 @@ private func locallyGeneratedMessageTimestampsFromDifference(_ difference: Api.u switch update { case let .updateServiceNotification(_, date, _, _, _, _): if let date = date { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) if messageTimestamps[peerId] == nil { messageTimestamps[peerId] = [(Namespaces.Message.Local, date)] } else { @@ -683,21 +683,21 @@ private func sortedUpdates(_ updates: [Api.Update]) -> [Api.Update] { for update in updates { switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { updatesByChannel[peerId]!.append(update) } case let .updateDeleteChannelMessages(channelId, _, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { updatesByChannel[peerId]!.append(update) } case let .updatePinnedChannelMessages(_, channelId, _, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { @@ -724,14 +724,14 @@ private func sortedUpdates(_ updates: [Api.Update]) -> [Api.Update] { otherUpdates.append(update) } case let .updateChannelWebPage(channelId, _, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { updatesByChannel[peerId]!.append(update) } case let .updateChannelAvailableMessages(channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { @@ -816,7 +816,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo for update in sortedUpdates(updates) { switch update { case let .updateChannelTooLong(_, channelId, channelPts): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if !channelsToPoll.contains(peerId) { if let channelPts = channelPts, let channelState = state.channelStates[peerId], channelState.pts >= channelPts { Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip updateChannelTooLong by pts") @@ -825,7 +825,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } } case let .updateDeleteChannelMessages(channelId, messages, pts: pts, ptsCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old delete update") @@ -876,7 +876,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo Logger.shared.log("State", "Invalid updateEditChannelMessage") } case let .updateChannelWebPage(channelId, apiWebpage, pts, ptsCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { } else if previousState.pts + ptsCount == pts { @@ -902,7 +902,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } } case let .updateChannelAvailableMessages(channelId, minId): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) updatedState.updateMinAvailableMessage(MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: minId)) case let .updateDeleteMessages(messages, _, _): updatedState.deleteMessagesWithGlobalIds(messages) @@ -979,7 +979,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo if popup { updatedState.addDisplayAlert(text, isDropAuth: type.hasPrefix("AUTH_KEY_DROP_")) } else if let date = date { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) if updatedState.peers[peerId] == nil { updatedState.updatePeer(peerId, { peer in @@ -1028,13 +1028,13 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } } case let .updateReadChannelInbox(_, folderId, channelId, maxId, stillUnreadCount, pts): - updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) + updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) case let .updateReadChannelOutbox(channelId, maxId): - updatedState.readOutbox(MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: maxId), timestamp: nil) + updatedState.readOutbox(MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: maxId), timestamp: nil) case let .updateChannel(channelId): - updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) case let .updateChat(chatId): - updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))) + updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))) case let .updateReadHistoryInbox(_, folderId, peer, maxId, stillUnreadCount, pts, _): updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: peer.peerId, namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) case let .updateReadHistoryOutbox(peer, maxId, _, _): @@ -1042,11 +1042,11 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateReadChannelDiscussionInbox(_, channelId, topMsgId, readMaxId, mainChannelId, mainChannelPost): var mainChannelMessage: MessageId? if let mainChannelId = mainChannelId, let mainChannelPost = mainChannelPost { - mainChannelMessage = MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(mainChannelId)), namespace: Namespaces.Message.Cloud, id: mainChannelPost) + mainChannelMessage = MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(mainChannelId)), namespace: Namespaces.Message.Cloud, id: mainChannelPost) } - updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: true, mainChannelMessage: mainChannelMessage) + updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: true, mainChannelMessage: mainChannelMessage) case let .updateReadChannelDiscussionOutbox(channelId, topMsgId, readMaxId): - updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: false, mainChannelMessage: nil) + updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: false, mainChannelMessage: nil) case let .updateDialogUnreadMark(flags, peer): switch peer { case let .dialogPeer(peer): @@ -1080,9 +1080,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo let groupPeerId: PeerId switch participants { case let .chatParticipants(chatId, _, _): - groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .chatParticipantsForbidden(_, chatId, _): - groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) } updatedState.updateCachedPeerData(groupPeerId, { current in let previous: CachedGroupData @@ -1094,9 +1094,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo return previous.withUpdatedParticipants(CachedGroupParticipants(apiParticipants: participants)) }) case let .updateChatParticipantAdd(chatId, userId, inviterId, date, _): - let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) - let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) - let inviterPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)) + let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) + let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) + let inviterPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)) updatedState.updateCachedPeerData(groupPeerId, { current in if let current = current as? CachedGroupData, let participants = current.participants { var updatedParticipants = participants.participants @@ -1109,8 +1109,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateChatParticipantDelete(chatId, userId, _): - let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) - let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) + let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) updatedState.updateCachedPeerData(groupPeerId, { current in if let current = current as? CachedGroupData, let participants = current.participants { var updatedParticipants = participants.participants @@ -1123,8 +1123,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateChatParticipantAdmin(chatId, userId, isAdmin, _): - let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) - let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) + let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) updatedState.updateCachedPeerData(groupPeerId, { current in if let current = current as? CachedGroupData, let participants = current.participants { var updatedParticipants = participants.participants @@ -1155,12 +1155,12 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updatePinnedChannelMessages(flags, channelId, messages, pts, ptsCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old pinned messages update") } else if previousState.pts + ptsCount == pts { - let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) updatedState.updateMessagesPinned(ids: messages.map { id in MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id) }, pinned: (flags & (1 << 0)) != 0) @@ -1189,10 +1189,10 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo return previous.withUpdatedIsBlocked(blocked == .boolTrue) }) case let .updateUserStatus(userId, status): - updatedState.mergePeerPresences([PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)): status], explicit: true) + updatedState.mergePeerPresences([PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)): status], explicit: true) case let .updateUserName(userId, firstName, lastName, username): //TODO add contact checking for apply first and last name - updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), { peer in + updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), { peer in if let user = peer as? TelegramUser { return user.withUpdatedUsername(username) } else { @@ -1200,7 +1200,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateUserPhoto(userId, _, photo, _): - updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), { peer in + updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), { peer in if let user = peer as? TelegramUser { return user.withUpdatedPhoto(parsedTelegramProfilePhoto(photo)) } else { @@ -1208,7 +1208,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateUserPhone(userId, phone): - updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), { peer in + updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), { peer in if let user = peer as? TelegramUser { return user.withUpdatedPhone(phone.isEmpty ? nil : phone) } else { @@ -1251,7 +1251,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateNewEncryptedMessage(message, _): updatedState.addSecretMessages([message]) case let .updateEncryptedMessagesRead(chatId, maxDate, date): - updatedState.readSecretOutbox(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), timestamp: maxDate, actionTimestamp: date) + updatedState.readSecretOutbox(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))), timestamp: maxDate, actionTimestamp: date) case let .updateUserTyping(userId, type): if let date = updatesDate, date + 60 > serverTime { let activity = PeerInputActivity(apiType: type, timestamp: date) @@ -1260,7 +1260,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo category = .voiceChat } - updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), category: category), peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), activity: activity) + updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), category: category), peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), activity: activity) } case let .updateChatUserTyping(chatId, userId, type): if let date = updatesDate, date + 60 > serverTime { @@ -1270,11 +1270,11 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo category = .voiceChat } - updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), category: category), peerId: userId.peerId, activity: activity) + updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), category: category), peerId: userId.peerId, activity: activity) } case let .updateChannelUserTyping(_, channelId, topMsgId, userId, type): if let date = updatesDate, date + 60 > serverTime { - let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) let threadId = topMsgId.flatMap { makeMessageThreadId(MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: $0)) } let activity = PeerInputActivity(apiType: type, timestamp: date) @@ -1289,7 +1289,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } case let .updateEncryptedChatTyping(chatId): if let date = updatesDate, date + 60 > serverTime { - updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), category: .global), peerId: nil, activity: .typingText) + updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))), category: .global), peerId: nil, activity: .typingText) } case let .updateDialogPinned(flags, folderId, peer): let groupId: PeerGroupId = folderId.flatMap(PeerGroupId.init(rawValue:)) ?? .root @@ -1324,9 +1324,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateReadMessagesContents(messages, _, _): updatedState.addReadMessagesContents((nil, messages)) case let .updateChannelReadMessagesContents(channelId, messages): - updatedState.addReadMessagesContents((PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), messages)) + updatedState.addReadMessagesContents((PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), messages)) case let .updateChannelMessageViews(channelId, id, views): - updatedState.addUpdateMessageImpressionCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: id), count: views) + updatedState.addUpdateMessageImpressionCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: id), count: views) /*case let .updateChannelMessageForwards(channelId, id, forwards): updatedState.addUpdateMessageForwardsCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId), namespace: Namespaces.Message.Cloud, id: id), count: forwards)*/ case let .updateNewStickerSet(stickerset): @@ -1366,8 +1366,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo updatedState.updateGroupCallParticipants(id: id, accessHash: accessHash, participants: participants, version: version) } case let .updateGroupCall(channelId, call): - updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), call: call) - updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(channelId)), call: call) + updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), call: call) + updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(channelId)), call: call) case let .updatePeerHistoryTTL(_, peer, ttl): updatedState.updateAutoremoveTimeout(peer: peer, value: CachedPeerAutoremoveTimeout.Value(ttl)) case let .updateLangPackTooLong(langCode): @@ -1422,7 +1422,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateDialogFilter(_, id, filter): updatedState.addUpdateChatListFilter(id: id, filter: filter) case let .updateBotCommands(peer, botId, apiCommands): - let botPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)) + let botPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)) let commands: [BotCommand] = apiCommands.map { command in switch command { case let .botCommand(command, description): @@ -1988,7 +1988,7 @@ private func pollChannel(network: Network, peer: Peer, state: AccountMutableStat Logger.shared.log("State", "Invalid updateEditChannelMessage") } case let .updatePinnedChannelMessages(flags, channelId, messages, _, _): - let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) updatedState.updateMessagesPinned(ids: messages.map { id in MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id) }, pinned: (flags & (1 << 0)) != 0) diff --git a/submodules/TelegramCore/Sources/State/AccountViewTracker.swift b/submodules/TelegramCore/Sources/State/AccountViewTracker.swift index ef5b142044..992161c9c6 100644 --- a/submodules/TelegramCore/Sources/State/AccountViewTracker.swift +++ b/submodules/TelegramCore/Sources/State/AccountViewTracker.swift @@ -728,7 +728,7 @@ public final class AccountViewTracker { switch replies { case let .messageReplies(_, repliesCountValue, _, recentRepliers, channelId, maxId, readMaxId): if let channelId = channelId { - commentsChannelId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + commentsChannelId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) } repliesCount = repliesCountValue if let recentRepliers = recentRepliers { diff --git a/submodules/TelegramCore/Sources/State/CallSessionManager.swift b/submodules/TelegramCore/Sources/State/CallSessionManager.swift index 4d884ade9f..82ed3e0ab0 100644 --- a/submodules/TelegramCore/Sources/State/CallSessionManager.swift +++ b/submodules/TelegramCore/Sources/State/CallSessionManager.swift @@ -819,7 +819,7 @@ private final class CallSessionManagerContext { versions = libraryVersions } if self.contextIdByStableId[id] == nil { - let internalId = self.addIncoming(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)), stableId: id, accessHash: accessHash, timestamp: date, gAHash: gAHash.makeData(), versions: versions, isVideo: isVideo) + let internalId = self.addIncoming(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), stableId: id, accessHash: accessHash, timestamp: date, gAHash: gAHash.makeData(), versions: versions, isVideo: isVideo) if let internalId = internalId { var resultRingingStateValue: CallSessionRingingState? for ringingState in self.ringingStatesValue() { diff --git a/submodules/TelegramCore/Sources/State/ChannelState.swift b/submodules/TelegramCore/Sources/State/ChannelState.swift index a8a60781ec..41cf6ec493 100644 --- a/submodules/TelegramCore/Sources/State/ChannelState.swift +++ b/submodules/TelegramCore/Sources/State/ChannelState.swift @@ -17,11 +17,11 @@ func channelUpdatesByPeerId(updates: [ChannelUpdate]) -> [PeerId: [ChannelUpdate case let .updateNewChannelMessage(message, _, _): peerId = apiMessagePeerId(message) case let .updateDeleteChannelMessages(channelId, _, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) case let .updateEditChannelMessage(message, _, _): peerId = apiMessagePeerId(message) case let .updateChannelWebPage(channelId, _, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: break } diff --git a/submodules/TelegramCore/Sources/State/ContactSyncManager.swift b/submodules/TelegramCore/Sources/State/ContactSyncManager.swift index dc8fd6edfe..c7ceaded56 100644 --- a/submodules/TelegramCore/Sources/State/ContactSyncManager.swift +++ b/submodules/TelegramCore/Sources/State/ContactSyncManager.swift @@ -344,7 +344,7 @@ private func pushDeviceContactData(postbox: Postbox, network: Network, contacts: for item in imported { switch item { case let .importedContact(userId, _): - addedContactPeerIds.insert(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + addedContactPeerIds.insert(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) } } for item in retryContacts { @@ -398,7 +398,7 @@ private func updateContactPresences(postbox: Postbox, network: Network, accountP for status in statuses { switch status { case let .contactStatus(userId, status): - peerPresences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] = TelegramUserPresence(apiStatus: status) + peerPresences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] = TelegramUserPresence(apiStatus: status) } } updatePeerPresences(transaction: transaction, accountPeerId: accountPeerId, peerPresences: peerPresences) diff --git a/submodules/TelegramCore/Sources/State/FetchChatList.swift b/submodules/TelegramCore/Sources/State/FetchChatList.swift index 933f493ccf..3bf3163eeb 100644 --- a/submodules/TelegramCore/Sources/State/FetchChatList.swift +++ b/submodules/TelegramCore/Sources/State/FetchChatList.swift @@ -112,11 +112,11 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message], let peerId: PeerId switch apiPeer { case let .peerUser(userId): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .peerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .peerChannel(channelId): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) } if readStates[peerId] == nil { @@ -200,7 +200,7 @@ struct FetchedChatList { let peerGroupIds: [PeerId: PeerGroupId] } -func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLocation, upperBound: MessageIndex, hash: Int32, limit: Int32) -> Signal { +func fetchChatList(postbox: Postbox, network: Network, location: FetchChatListLocation, upperBound: MessageIndex, hash: Int64, limit: Int32) -> Signal { return postbox.stateView() |> mapToSignal { view -> Signal in if let state = view.state as? AuthorizedAccountState { diff --git a/submodules/TelegramCore/Sources/State/HistoryViewStateValidation.swift b/submodules/TelegramCore/Sources/State/HistoryViewStateValidation.swift index cdfa7ccda3..ea190a7647 100644 --- a/submodules/TelegramCore/Sources/State/HistoryViewStateValidation.swift +++ b/submodules/TelegramCore/Sources/State/HistoryViewStateValidation.swift @@ -382,13 +382,14 @@ final class HistoryViewStateValidationContexts { } } -private func hashForScheduledMessages(_ messages: [Message]) -> Int32 { - var acc: UInt32 = 0 +private func hashForScheduledMessages(_ messages: [Message]) -> Int64 { + var acc: UInt64 = 0 let sorted = messages.sorted(by: { $0.timestamp > $1.timestamp }) for message in sorted { - acc = (acc &* 20261) &+ UInt32(message.id.id) + combineInt64Hash(&acc, with: UInt64(message.id.id)) + var editTimestamp: Int32 = 0 inner: for attribute in message.attributes { if let attribute = attribute as? EditedMessageAttribute { @@ -396,23 +397,40 @@ private func hashForScheduledMessages(_ messages: [Message]) -> Int32 { break inner } } - acc = (acc &* 20261) &+ UInt32(editTimestamp) - acc = (acc &* 20261) &+ UInt32(message.timestamp) + combineInt64Hash(&acc, with: UInt64(editTimestamp)) + combineInt64Hash(&acc, with: UInt64(message.timestamp)) } - return Int32(bitPattern: acc & UInt32(0x7FFFFFFF)) + return finalizeInt64Hash(acc) } -private func hashForMessages(_ messages: [Message], withChannelIds: Bool) -> Int32 { - var acc: UInt32 = 0 +public func combineInt64Hash(_ acc: inout UInt64, with value: UInt64) { + acc ^= (acc >> 21) + acc ^= (acc << 35) + acc ^= (acc >> 4) + acc = acc &+ value +} + +public func combineInt64Hash(_ acc: inout UInt64, with peerId: PeerId) { + let value = UInt64(bitPattern: peerId.id._internalGetInt64Value()) + combineInt64Hash(&acc, with: value) +} + +public func finalizeInt64Hash(_ acc: UInt64) -> Int64 { + return Int64(bitPattern: acc) +} + +private func hashForMessages(_ messages: [Message], withChannelIds: Bool) -> Int64 { + var acc: UInt64 = 0 let sorted = messages.sorted(by: { $0.index > $1.index }) for message in sorted { if withChannelIds { - acc = (acc &* 20261) &+ UInt32(message.id.peerId.id._internalGetInt32Value()) + combineInt64Hash(&acc, with: message.id.peerId) } - - acc = (acc &* 20261) &+ UInt32(message.id.id) + + combineInt64Hash(&acc, with: UInt64(message.id.id)) + var timestamp = message.timestamp inner: for attribute in message.attributes { if let attribute = attribute as? EditedMessageAttribute { @@ -421,22 +439,22 @@ private func hashForMessages(_ messages: [Message], withChannelIds: Bool) -> Int } } if message.tags.contains(.pinned) { - acc = (acc &* 20261) &+ UInt32(1) + combineInt64Hash(&acc, with: UInt64(1)) } - acc = (acc &* 20261) &+ UInt32(timestamp) + combineInt64Hash(&acc, with: UInt64(timestamp)) } - return Int32(bitPattern: acc & UInt32(0x7FFFFFFF)) + return finalizeInt64Hash(acc) } -private func hashForMessages(_ messages: [StoreMessage], withChannelIds: Bool) -> Int32 { - var acc: UInt32 = 0 +private func hashForMessages(_ messages: [StoreMessage], withChannelIds: Bool) -> Int64 { + var acc: UInt64 = 0 for message in messages { if case let .Id(id) = message.id { if withChannelIds { - acc = (acc &* 20261) &+ UInt32(id.peerId.id._internalGetInt32Value()) + combineInt64Hash(&acc, with: id.peerId) } - acc = (acc &* 20261) &+ UInt32(id.id) + combineInt64Hash(&acc, with: UInt64(id.id)) var timestamp = message.timestamp inner: for attribute in message.attributes { if let attribute = attribute as? EditedMessageAttribute { @@ -444,10 +462,10 @@ private func hashForMessages(_ messages: [StoreMessage], withChannelIds: Bool) - break inner } } - acc = (acc &* 20261) &+ UInt32(timestamp) + combineInt64Hash(&acc, with: UInt64(timestamp)) } } - return Int32(bitPattern: acc & UInt32(0x7FFFFFFF)) + return finalizeInt64Hash(acc) } private enum ValidatedMessages { diff --git a/submodules/TelegramCore/Sources/State/Holes.swift b/submodules/TelegramCore/Sources/State/Holes.swift index 492af14958..24a1d0ced5 100644 --- a/submodules/TelegramCore/Sources/State/Holes.swift +++ b/submodules/TelegramCore/Sources/State/Holes.swift @@ -173,7 +173,7 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH } |> take(1) |> mapToSignal { _ -> Signal in - return postbox.transaction { transaction -> (Api.InputPeer?, Int32) in + return postbox.transaction { transaction -> (Api.InputPeer?, Int64) in switch peerInput { case let .direct(peerId, _): return (transaction.getPeer(peerId).flatMap(forceApiInputPeer), 0) @@ -572,13 +572,13 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH func groupBoundaryPeer(_ peerId: PeerId, accountPeerId: PeerId) -> Api.Peer { switch peerId.namespace { case Namespaces.Peer.CloudUser: - return Api.Peer.peerUser(userId: peerId.id._internalGetInt32Value()) + return Api.Peer.peerUser(userId: peerId.id._internalGetInt64Value()) case Namespaces.Peer.CloudGroup: - return Api.Peer.peerChat(chatId: peerId.id._internalGetInt32Value()) + return Api.Peer.peerChat(chatId: peerId.id._internalGetInt64Value()) case Namespaces.Peer.CloudChannel: - return Api.Peer.peerChannel(channelId: peerId.id._internalGetInt32Value()) + return Api.Peer.peerChannel(channelId: peerId.id._internalGetInt64Value()) default: - return Api.Peer.peerUser(userId: accountPeerId.id._internalGetInt32Value()) + return Api.Peer.peerUser(userId: accountPeerId.id._internalGetInt64Value()) } } diff --git a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift index 3888eb3484..94012f9a5e 100644 --- a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift @@ -176,7 +176,7 @@ private func removeMessages(postbox: Postbox, network: Network, stateManager: Ac if let result = result { switch result { case let .affectedMessages(pts, ptsCount): - stateManager.addUpdateGroups([.updateChannelPts(channelId: peer.id.id._internalGetInt32Value(), pts: pts, ptsCount: ptsCount)]) + stateManager.addUpdateGroups([.updateChannelPts(channelId: peer.id.id._internalGetInt64Value(), pts: pts, ptsCount: ptsCount)]) } } return .complete() @@ -266,7 +266,7 @@ private func removeChat(transaction: Transaction, postbox: Postbox, network: Net } else if peer.id.namespace == Namespaces.Peer.CloudGroup { let deleteUser: Signal if operation.deleteGloballyIfPossible { - deleteUser = network.request(Api.functions.messages.deleteChat(chatId: peer.id.id._internalGetInt32Value())) + deleteUser = network.request(Api.functions.messages.deleteChat(chatId: peer.id.id._internalGetInt64Value())) |> `catch` { _ in return .single(.boolFalse) } @@ -274,7 +274,7 @@ private func removeChat(transaction: Transaction, postbox: Postbox, network: Net return .complete() } } else { - deleteUser = network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peer.id.id._internalGetInt32Value(), userId: Api.InputUser.inputUserSelf)) + deleteUser = network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peer.id.id._internalGetInt64Value(), userId: Api.InputUser.inputUserSelf)) |> map { result -> Api.Updates? in return result } diff --git a/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift b/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift index b0c73b6652..f06531a28b 100644 --- a/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift +++ b/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift @@ -186,7 +186,7 @@ private func requestActivity(postbox: Postbox, network: Network, accountPeerId: } } else if let peer = peer as? TelegramSecretChat, activity == .typingText { let _ = PeerId(peer.id.toInt64()) - return network.request(Api.functions.messages.setEncryptedTyping(peer: .inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash), typing: .boolTrue)) + return network.request(Api.functions.messages.setEncryptedTyping(peer: .inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash), typing: .boolTrue)) |> `catch` { _ -> Signal in return .single(.boolFalse) } diff --git a/submodules/TelegramCore/Sources/State/ManagedRecentStickers.swift b/submodules/TelegramCore/Sources/State/ManagedRecentStickers.swift index ab6ba118be..178d0ace56 100644 --- a/submodules/TelegramCore/Sources/State/ManagedRecentStickers.swift +++ b/submodules/TelegramCore/Sources/State/ManagedRecentStickers.swift @@ -3,21 +3,16 @@ import Postbox import TelegramApi import SwiftSignalKit - -private func hashForIds(_ ids: [Int64]) -> Int32 { - var acc: UInt32 = 0 +private func hashForIds(_ ids: [Int64]) -> Int64 { + var acc: UInt64 = 0 for id in ids { - let low = UInt32(UInt64(bitPattern: id) & (0xffffffff as UInt64)) - let high = UInt32((UInt64(bitPattern: id) >> 32) & (0xffffffff as UInt64)) - - acc = (acc &* 20261) &+ high - acc = (acc &* 20261) &+ low + combineInt64Hash(&acc, with: UInt64(bitPattern: id)) } - return Int32(bitPattern: acc & UInt32(0x7FFFFFFF)) + return finalizeInt64Hash(acc) } -private func managedRecentMedia(postbox: Postbox, network: Network, collectionId: Int32, reverseHashOrder: Bool, forceFetch: Bool, fetch: @escaping (Int32) -> Signal<[OrderedItemListEntry]?, NoError>) -> Signal { +private func managedRecentMedia(postbox: Postbox, network: Network, collectionId: Int32, reverseHashOrder: Bool, forceFetch: Bool, fetch: @escaping (Int64) -> Signal<[OrderedItemListEntry]?, NoError>) -> Signal { return postbox.transaction { transaction -> Signal in var itemIds = transaction.getOrderedListItemIds(collectionId: collectionId).map { RecentMediaItemId($0).mediaId.id diff --git a/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift b/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift index 540b4d33f0..146d0ac618 100644 --- a/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift @@ -226,7 +226,7 @@ private func initialHandshakeAccept(postbox: Postbox, network: Network, peerId: memcpy(&keyFingerprint, bytes.advanced(by: keyHash.count - 8), 8) } - let result = network.request(Api.functions.messages.acceptEncryption(peer: .inputEncryptedChat(chatId: peerId.id._internalGetInt32Value(), accessHash: accessHash), gB: Buffer(data: gb), keyFingerprint: keyFingerprint)) + let result = network.request(Api.functions.messages.acceptEncryption(peer: .inputEncryptedChat(chatId: Int32(peerId.id._internalGetInt64Value()), accessHash: accessHash), gB: Buffer(data: gb), keyFingerprint: keyFingerprint)) let response = result |> map { result -> Api.EncryptedChat? in @@ -1635,7 +1635,7 @@ private func sendBoxedDecryptedMessage(postbox: Postbox, network: Network, peer: decryptedMessage.serialize(payload, role: state.role, sequenceInfo: sequenceInfo) let encryptedPayload = encryptedMessageContents(parameters: parameters, data: MemoryBuffer(payload)) let sendMessage: Signal - let inputPeer = Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash) + let inputPeer = Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash) var flags: Int32 = 0 if silent { @@ -1675,7 +1675,7 @@ private func requestTerminateSecretChat(postbox: Postbox, network: Network, peer if requestRemoteHistoryRemoval { flags |= 1 << 0 } - return network.request(Api.functions.messages.discardEncryption(flags: flags, chatId: peerId.id._internalGetInt32Value())) + return network.request(Api.functions.messages.discardEncryption(flags: flags, chatId: Int32(peerId.id._internalGetInt64Value()))) |> map(Optional.init) |> `catch` { _ in return .single(nil) @@ -1691,7 +1691,7 @@ private func requestTerminateSecretChat(postbox: Postbox, network: Network, peer } |> mapToSignal { peer -> Signal in if let peer = peer { - return network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash))) + return network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/State/ManagedSynchronizeInstalledStickerPacksOperations.swift b/submodules/TelegramCore/Sources/State/ManagedSynchronizeInstalledStickerPacksOperations.swift index dea3b12676..b482aa427f 100644 --- a/submodules/TelegramCore/Sources/State/ManagedSynchronizeInstalledStickerPacksOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedSynchronizeInstalledStickerPacksOperations.swift @@ -123,14 +123,14 @@ func managedSynchronizeInstalledStickerPacksOperations(postbox: Postbox, network } } -private func hashForStickerPackInfos(_ infos: [StickerPackCollectionInfo]) -> Int32 { - var acc: UInt32 = 0 +private func hashForStickerPackInfos(_ infos: [StickerPackCollectionInfo]) -> Int64 { + var acc: UInt64 = 0 for info in infos { - acc = UInt32(bitPattern: Int32(bitPattern: acc &* UInt32(20261)) &+ info.hash) + combineInt64Hash(&acc, with: UInt64(UInt32(bitPattern: info.hash))) } - return Int32(bitPattern: acc & 0x7FFFFFFF) + return finalizeInt64Hash(acc) } private enum SynchronizeInstalledStickerPacksError { diff --git a/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift b/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift index 479b4b9019..bac5ff138d 100644 --- a/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift @@ -82,7 +82,7 @@ func managedSynchronizePinnedChatsOperations(postbox: Postbox, network: Network, let signal = withTakenOperation(postbox: postbox, peerId: entry.peerId, tagLocalIndex: entry.tagLocalIndex, { transaction, entry -> Signal in if let entry = entry { if let operation = entry.contents as? SynchronizePinnedChatsOperation { - return synchronizePinnedChats(transaction: transaction, postbox: postbox, network: network, accountPeerId: accountPeerId, stateManager: stateManager, groupId: PeerGroupId(rawValue: entry.peerId.id._internalGetInt32Value()), operation: operation) + return synchronizePinnedChats(transaction: transaction, postbox: postbox, network: network, accountPeerId: accountPeerId, stateManager: stateManager, groupId: PeerGroupId(rawValue: Int32(entry.peerId.id._internalGetInt64Value())), operation: operation) } else { assertionFailure() } diff --git a/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift b/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift index 54a0e8843c..80816b4681 100644 --- a/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift +++ b/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift @@ -795,7 +795,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32 case let .decryptedMessageMediaGeoPoint(lat, long): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): - parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), vCardData: nil)) + parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(userId))), vCardData: nil)) case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case .decryptedMessageMediaEmpty: @@ -1014,7 +1014,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32 case let .decryptedMessageMediaGeoPoint(lat, long): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): - parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), vCardData: nil)) + parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(userId))), vCardData: nil)) case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case .decryptedMessageMediaEmpty: @@ -1252,7 +1252,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32 case let .decryptedMessageMediaGeoPoint(lat, long): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): - parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), vCardData: nil)) + parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(userId))), vCardData: nil)) case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case .decryptedMessageMediaEmpty: diff --git a/submodules/TelegramCore/Sources/State/Serialization.swift b/submodules/TelegramCore/Sources/State/Serialization.swift index 5975b76068..6186d380d5 100644 --- a/submodules/TelegramCore/Sources/State/Serialization.swift +++ b/submodules/TelegramCore/Sources/State/Serialization.swift @@ -210,7 +210,7 @@ public class BoxedMessage: NSObject { public class Serialization: NSObject, MTSerialization { public func currentLayer() -> UInt { - return 132 + return 133 } public func parseMessage(_ data: Data!) -> Any! { @@ -236,7 +236,7 @@ public class Serialization: NSObject, MTSerialization { } } - public func importAuthorization(_ authId: Int32, bytes: Data!) -> Data! { + public func importAuthorization(_ authId: Int64, bytes: Data!) -> Data! { return Api.functions.auth.importAuthorization(id: authId, bytes: Buffer(data: bytes)).1.makeData() } diff --git a/submodules/TelegramCore/Sources/State/StickerManagement.swift b/submodules/TelegramCore/Sources/State/StickerManagement.swift index 9a745f00c8..f6109865d7 100644 --- a/submodules/TelegramCore/Sources/State/StickerManagement.swift +++ b/submodules/TelegramCore/Sources/State/StickerManagement.swift @@ -5,16 +5,12 @@ import SwiftSignalKit private func hashForIdsReverse(_ ids: [Int64]) -> Int32 { - var acc: UInt32 = 0 + var acc: UInt64 = 0 for id in ids { - let low = UInt32(UInt64(bitPattern: id) & (0xffffffff as UInt64)) - let high = UInt32((UInt64(bitPattern: id) >> 32) & (0xffffffff as UInt64)) - - acc = (acc &* 20261) &+ high - acc = (acc &* 20261) &+ low + combineInt64Hash(&acc, with: UInt64(bitPattern: id)) } - return Int32(bitPattern: acc & UInt32(0x7FFFFFFF)) + return Int32(bitPattern: UInt32(clamping: acc & UInt64(0x7FFFFFFF))) } func manageStickerPacks(network: Network, postbox: Postbox) -> Signal { diff --git a/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift b/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift index f4d43adf56..be67c65a80 100644 --- a/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift +++ b/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift @@ -5,7 +5,7 @@ import MurMurHash32 func addSynchronizeEmojiKeywordsOperation(transaction: Transaction, inputLanguageCode: String, languageCode: String?, fromVersion: Int32?) { let tag = OperationLogTags.SynchronizeEmojiKeywords - let peerId = PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(murMurHashString32(inputLanguageCode))) + let peerId = PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(murMurHashString32(inputLanguageCode)))) var hasExistingOperation = false transaction.operationLogEnumerateEntries(peerId: peerId, tag: tag) { entry -> Bool in diff --git a/submodules/TelegramCore/Sources/State/UpdateGroup.swift b/submodules/TelegramCore/Sources/State/UpdateGroup.swift index 8ae8b4c168..85ac1f8424 100644 --- a/submodules/TelegramCore/Sources/State/UpdateGroup.swift +++ b/submodules/TelegramCore/Sources/State/UpdateGroup.swift @@ -9,7 +9,7 @@ enum UpdateGroup { case withDate(updates: [Api.Update], date: Int32, users: [Api.User], chats: [Api.Chat]) case reset case updatePts(pts: Int32, ptsCount: Int32) - case updateChannelPts(channelId: Int32, pts: Int32, ptsCount: Int32) + case updateChannelPts(channelId: Int64, pts: Int32, ptsCount: Int32) case ensurePeerHasLocalState(id: PeerId) var updates: [Api.Update] { diff --git a/submodules/TelegramCore/Sources/State/UpdateMessageService.swift b/submodules/TelegramCore/Sources/State/UpdateMessageService.swift index fc375938cc..bbfbd80aec 100644 --- a/submodules/TelegramCore/Sources/State/UpdateMessageService.swift +++ b/submodules/TelegramCore/Sources/State/UpdateMessageService.swift @@ -67,7 +67,7 @@ class UpdateMessageService: NSObject, MTMessageService { case let .updateShortMessage(flags, id, userId, message, pts, ptsCount, date, fwdFrom, viaBotId, replyHeader, entities, ttlPeriod): let generatedFromId: Api.Peer if (Int(flags) & 1 << 1) != 0 { - generatedFromId = Api.Peer.peerUser(userId: self.peerId.id._internalGetInt32Value()) + generatedFromId = Api.Peer.peerUser(userId: self.peerId.id._internalGetInt64Value()) } else { generatedFromId = Api.Peer.peerUser(userId: userId) } diff --git a/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift b/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift index bf8183fa99..91dcb3b5ef 100644 --- a/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift +++ b/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift @@ -145,15 +145,15 @@ extension Api.Chat { var peerId: PeerId { switch self { case let .chat(chat): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chat.id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chat.id)) case let .chatEmpty(id): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)) case let .chatForbidden(id, _): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)) case let .channel(channel): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channel.id)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channel.id)) case let .channelForbidden(_, id, _, _, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)) } } } @@ -162,9 +162,9 @@ extension Api.User { var peerId: PeerId { switch self { case .user(_, let id, _, _, _, _, _, _, _, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) case let .userEmpty(id): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) } } } @@ -173,11 +173,11 @@ extension Api.Peer { var peerId: PeerId { switch self { case let .peerChannel(channelId): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) case let .peerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .peerUser(userId): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) } } } @@ -247,40 +247,40 @@ extension Api.Update { var peerIds: [PeerId] { switch self { case let .updateChannel(channelId): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateChat(chatId): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))] case let .updateChannelTooLong(_, channelId, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateChatParticipantAdd(chatId, userId, inviterId, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId))] case let .updateChatParticipantAdmin(chatId, userId, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateChatParticipantDelete(chatId, userId, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateChatParticipants(participants): switch participants { case let .chatParticipants(chatId, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))] case let .chatParticipantsForbidden(_, chatId, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))] } case let .updateDeleteChannelMessages(channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updatePinnedChannelMessages(_, channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateNewChannelMessage(message, _, _): return apiMessagePeerIds(message) case let .updateEditChannelMessage(message, _, _): return apiMessagePeerIds(message) case let .updateChannelWebPage(channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateNewMessage(message, _, _): return apiMessagePeerIds(message) case let .updateEditMessage(message, _, _): return apiMessagePeerIds(message) case let .updateReadChannelInbox(_, _, channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateNotifySettings(peer, _): switch peer { case let .notifyPeer(peer): @@ -289,14 +289,14 @@ extension Api.Update { return [] } case let .updateUserName(userId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateUserPhone(userId, _): - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateUserPhoto(userId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateServiceNotification(_, inboxDate, _, _, _, _): if let _ = inboxDate { - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000))] } else { return [] } @@ -417,9 +417,9 @@ extension Api.Updates { case .updatesTooLong: return [] case let .updateShortMessage(_, id, userId, _, _, _, _, _, _, _, _, _): - return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), namespace: Namespaces.Message.Cloud, id: id)] + return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), namespace: Namespaces.Message.Cloud, id: id)] case let .updateShortChatMessage(_, id, _, chatId, _, _, _, _, _, _, _, _, _): - return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), namespace: Namespaces.Message.Cloud, id: id)] + return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), namespace: Namespaces.Message.Cloud, id: id)] } } @@ -451,9 +451,9 @@ extension Api.Updates { return [:] case .updatesTooLong: return [:] - case let .updateShortMessage(_, id, userId, _, _, _, _, _, _, _, _, _): + case .updateShortMessage: return [:] - case let .updateShortChatMessage(_, id, _, chatId, _, _, _, _, _, _, _, _, _): + case .updateShortChatMessage: return [:] } } @@ -548,15 +548,15 @@ extension Api.EncryptedChat { var peerId: PeerId { switch self { case let .encryptedChat(id, _, _, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatDiscarded(_, id): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatEmpty(id): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatRequested(_, _, id, _, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatWaiting(id, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) } } } @@ -565,9 +565,9 @@ extension Api.EncryptedMessage { var peerId: PeerId { switch self { case let .encryptedMessage(_, chatId, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))) case let .encryptedMessageService(_, chatId, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))) } } } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedStickerQueryResult.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedStickerQueryResult.swift index c9c908af1b..7a0d7769ec 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedStickerQueryResult.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedStickerQueryResult.swift @@ -2,10 +2,10 @@ import Postbox public final class CachedStickerQueryResult: PostboxCoding { public let items: [TelegramMediaFile] - public let hash: Int32 + public let hash: Int64 public let timestamp: Int32 - public init(items: [TelegramMediaFile], hash: Int32, timestamp: Int32) { + public init(items: [TelegramMediaFile], hash: Int64, timestamp: Int32) { self.items = items self.hash = hash self.timestamp = timestamp @@ -13,13 +13,13 @@ public final class CachedStickerQueryResult: PostboxCoding { public init(decoder: PostboxDecoder) { self.items = decoder.decodeObjectArrayForKey("it").map { $0 as! TelegramMediaFile } - self.hash = decoder.decodeInt32ForKey("h", orElse: 0) + self.hash = decoder.decodeInt64ForKey("h6", orElse: 0) self.timestamp = decoder.decodeInt32ForKey("t", orElse: 0) } public func encode(_ encoder: PostboxEncoder) { encoder.encodeObjectArray(self.items, forKey: "it") - encoder.encodeInt32(self.hash, forKey: "h") + encoder.encodeInt64(self.hash, forKey: "h6") encoder.encodeInt32(self.timestamp, forKey: "t") } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedThemesConfiguration.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedThemesConfiguration.swift index f8e473bbfd..2b9f2127d7 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedThemesConfiguration.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedThemesConfiguration.swift @@ -1,17 +1,17 @@ import Postbox public final class CachedThemesConfiguration: PostboxCoding { - public let hash: Int32 + public let hash: Int64 - public init(hash: Int32) { + public init(hash: Int64) { self.hash = hash } public init(decoder: PostboxDecoder) { - self.hash = decoder.decodeInt32ForKey("hash", orElse: 0) + self.hash = decoder.decodeInt64ForKey("hash6", orElse: 0) } public func encode(_ encoder: PostboxEncoder) { - encoder.encodeInt32(self.hash, forKey: "hash") + encoder.encodeInt64(self.hash, forKey: "hash6") } } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedWallpapersConfiguration.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedWallpapersConfiguration.swift index fa22f16806..0d6d2ac9da 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedWallpapersConfiguration.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_CachedWallpapersConfiguration.swift @@ -1,17 +1,17 @@ import Postbox public final class CachedWallpapersConfiguration: PostboxCoding { - public let hash: Int32 + public let hash: Int64 - public init(hash: Int32) { + public init(hash: Int64) { self.hash = hash } public init(decoder: PostboxDecoder) { - self.hash = decoder.decodeInt32ForKey("hash", orElse: 0) + self.hash = decoder.decodeInt64ForKey("hash6", orElse: 0) } public func encode(_ encoder: PostboxEncoder) { - encoder.encodeInt32(self.hash, forKey: "hash") + encoder.encodeInt64(self.hash, forKey: "hash6") } } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_PeerReference.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_PeerReference.swift index 9b93b4f6e6..6830c2b3f7 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_PeerReference.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_PeerReference.swift @@ -1,18 +1,36 @@ import Postbox public enum PeerReference: PostboxCoding, Hashable, Equatable { - case user(id: Int32, accessHash: Int64) - case group(id: Int32) - case channel(id: Int32, accessHash: Int64) + case user(id: Int64, accessHash: Int64) + case group(id: Int64) + case channel(id: Int64, accessHash: Int64) public init(decoder: PostboxDecoder) { switch decoder.decodeInt32ForKey("_r", orElse: 0) { case 0: - self = .user(id: decoder.decodeInt32ForKey("i", orElse: 0), accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) + let id: Int64 + if let idValue = decoder.decodeOptionalInt64ForKey("i") { + id = idValue + } else { + id = Int64(decoder.decodeInt32ForKey("i", orElse: 0)) + } + self = .user(id: id, accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) case 1: - self = .group(id: decoder.decodeInt32ForKey("i", orElse: 0)) + let id: Int64 + if let idValue = decoder.decodeOptionalInt64ForKey("i") { + id = idValue + } else { + id = Int64(decoder.decodeInt32ForKey("i", orElse: 0)) + } + self = .group(id: id) case 2: - self = .channel(id: decoder.decodeInt32ForKey("i", orElse: 0), accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) + let id: Int64 + if let idValue = decoder.decodeOptionalInt64ForKey("i") { + id = idValue + } else { + id = Int64(decoder.decodeInt32ForKey("i", orElse: 0)) + } + self = .channel(id: id, accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) default: assertionFailure() self = .user(id: 0, accessHash: 0) @@ -23,14 +41,14 @@ public enum PeerReference: PostboxCoding, Hashable, Equatable { switch self { case let .user(id, accessHash): encoder.encodeInt32(0, forKey: "_r") - encoder.encodeInt32(id, forKey: "i") + encoder.encodeInt64(id, forKey: "i") encoder.encodeInt64(accessHash, forKey: "h") case let .group(id): encoder.encodeInt32(1, forKey: "_r") - encoder.encodeInt32(id, forKey: "i") + encoder.encodeInt64(id, forKey: "i") case let .channel(id, accessHash): encoder.encodeInt32(2, forKey: "_r") - encoder.encodeInt32(id, forKey: "i") + encoder.encodeInt64(id, forKey: "i") encoder.encodeInt64(accessHash, forKey: "h") } } @@ -39,15 +57,15 @@ public enum PeerReference: PostboxCoding, Hashable, Equatable { switch peer { case let user as TelegramUser: if let accessHash = user.accessHash { - self = .user(id: user.id.id._internalGetInt32Value(), accessHash: accessHash.value) + self = .user(id: user.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } case let group as TelegramGroup: - self = .group(id: group.id.id._internalGetInt32Value()) + self = .group(id: group.id.id._internalGetInt64Value()) case let channel as TelegramChannel: if let accessHash = channel.accessHash { - self = .channel(id: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + self = .channel(id: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_StandaloneAccountTransaction.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_StandaloneAccountTransaction.swift index 3fa2fbac52..f2d9a9b19a 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_StandaloneAccountTransaction.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_StandaloneAccountTransaction.swift @@ -34,7 +34,7 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = { globalMessageIdsPeerIdNamespaces.insert(GlobalMessageIdsNamespace(peerIdNamespace: peerIdNamespace, messageIdNamespace: Namespaces.Message.Cloud)) } - return SeedConfiguration(globalMessageIdsPeerIdNamespaces: globalMessageIdsPeerIdNamespaces, initializeChatListWithHole: (topLevel: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1)), groups: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1))), messageHoles: messageHoles, upgradedMessageHoles: upgradedMessageHoles, messageThreadHoles: messageThreadHoles, existingMessageTags: MessageTags.all, messageTagsWithSummary: [.unseenPersonalMessage, .pinned], existingGlobalMessageTags: GlobalMessageTags.all, peerNamespacesRequiringMessageTextIndex: [Namespaces.Peer.SecretChat], peerSummaryCounterTags: { peer, isContact in + return SeedConfiguration(globalMessageIdsPeerIdNamespaces: globalMessageIdsPeerIdNamespaces, initializeChatListWithHole: (topLevel: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1)), groups: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1))), messageHoles: messageHoles, upgradedMessageHoles: upgradedMessageHoles, messageThreadHoles: messageThreadHoles, existingMessageTags: MessageTags.all, messageTagsWithSummary: [.unseenPersonalMessage, .pinned], existingGlobalMessageTags: GlobalMessageTags.all, peerNamespacesRequiringMessageTextIndex: [Namespaces.Peer.SecretChat], peerSummaryCounterTags: { peer, isContact in if let peer = peer as? TelegramUser { if peer.botInfo != nil { return .bot diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_SynchronizePinnedChatsOperation.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_SynchronizePinnedChatsOperation.swift index 02b21573c2..24dd5195fe 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_SynchronizePinnedChatsOperation.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_SynchronizePinnedChatsOperation.swift @@ -48,7 +48,7 @@ public func addSynchronizePinnedChatsOperation(transaction: Transaction, groupId var previousItemIds = transaction.getPinnedItemIds(groupId: groupId) var updateLocalIndex: Int32? - transaction.operationLogEnumerateEntries(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(rawId)), tag: OperationLogTags.SynchronizePinnedChats, { entry in + transaction.operationLogEnumerateEntries(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(rawId))), tag: OperationLogTags.SynchronizePinnedChats, { entry in updateLocalIndex = entry.tagLocalIndex if let contents = entry.contents as? SynchronizePinnedChatsOperation { previousItemIds = contents.previousItemIds @@ -57,7 +57,7 @@ public func addSynchronizePinnedChatsOperation(transaction: Transaction, groupId }) let operationContents = SynchronizePinnedChatsOperation(previousItemIds: previousItemIds) if let updateLocalIndex = updateLocalIndex { - let _ = transaction.operationLogRemoveEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(rawId)), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: updateLocalIndex) + let _ = transaction.operationLogRemoveEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(rawId))), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: updateLocalIndex) } - transaction.operationLogAddEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(rawId)), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: operationContents) + transaction.operationLogAddEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(rawId))), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: operationContents) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/AccountData/RegisterNotificationToken.swift b/submodules/TelegramCore/Sources/TelegramEngine/AccountData/RegisterNotificationToken.swift index 4eaf3a7c92..25a5d71201 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/AccountData/RegisterNotificationToken.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/AccountData/RegisterNotificationToken.swift @@ -17,7 +17,7 @@ func _internal_unregisterNotificationToken(account: Account, token: Data, type: case .voip: mappedType = 9 } - return account.network.request(Api.functions.account.unregisterDevice(tokenType: mappedType, token: hexString(token), otherUids: otherAccountUserIds.map({ $0._internalGetInt32Value() }))) + return account.network.request(Api.functions.account.unregisterDevice(tokenType: mappedType, token: hexString(token), otherUids: otherAccountUserIds.map({ $0._internalGetInt64Value() }))) |> retryRequest |> ignoreValues } @@ -41,7 +41,7 @@ func _internal_registerNotificationToken(account: Account, token: Data, type: No if excludeMutedChats { flags |= 1 << 0 } - return account.network.request(Api.functions.account.registerDevice(flags: flags, tokenType: mappedType, token: hexString(token), appSandbox: sandbox ? .boolTrue : .boolFalse, secret: Buffer(data: keyData), otherUids: otherAccountUserIds.map({ $0._internalGetInt32Value() }))) + return account.network.request(Api.functions.account.registerDevice(flags: flags, tokenType: mappedType, token: hexString(token), appSandbox: sandbox ? .boolTrue : .boolFalse, secret: Buffer(data: keyData), otherUids: otherAccountUserIds.map({ $0._internalGetInt64Value() }))) |> retryRequest |> ignoreValues } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift index 0f0a569a89..21ceaf85e8 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift @@ -21,7 +21,7 @@ public enum ExportAuthTransferTokenResult { } func _internal_exportAuthTransferToken(accountManager: AccountManager, account: UnauthorizedAccount, otherAccountUserIds: [PeerId.Id], syncContacts: Bool) -> Signal { - return account.network.request(Api.functions.auth.exportLoginToken(apiId: account.networkArguments.apiId, apiHash: account.networkArguments.apiHash, exceptIds: otherAccountUserIds.map({ $0._internalGetInt32Value() }))) + return account.network.request(Api.functions.auth.exportLoginToken(apiId: account.networkArguments.apiId, apiHash: account.networkArguments.apiHash, exceptIds: otherAccountUserIds.map({ $0._internalGetInt64Value() }))) |> map(Optional.init) |> `catch` { error -> Signal in if error.errorDescription == "SESSION_PASSWORD_NEEDED" { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift index 884c143858..e4255094a1 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift @@ -2239,7 +2239,7 @@ func _internal_groupCallDisplayAsAvailablePeers(network: Network, postbox: Postb for chat in chats { if let groupOrChannel = parseTelegramGroupOrChannel(chat: chat) { switch chat { - case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount): + case let .channel(_, _, _, _, _, _, _, _, _, _, _, participantsCount): if let participantsCount = participantsCount { subscribers[groupOrChannel.id] = participantsCount } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift b/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift index a39575d6f3..74ab3af05c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Contacts/ContactManagement.swift @@ -10,7 +10,7 @@ private func md5(_ data: Data) -> Data { } } -private func updatedRemoteContactPeers(network: Network, hash: Int32) -> Signal<([Peer], [PeerId: PeerPresence], Int32)?, NoError> { +private func updatedRemoteContactPeers(network: Network, hash: Int64) -> Signal<([Peer], [PeerId: PeerPresence], Int32)?, NoError> { return network.request(Api.functions.contacts.getContacts(hash: hash), automaticFloodWait: false) |> map(Optional.init) |> `catch` { _ -> Signal in @@ -38,24 +38,23 @@ private func updatedRemoteContactPeers(network: Network, hash: Int32) -> Signal< } } -private func hashForCountAndIds(count: Int32, ids: [Int32]) -> Int32 { - var acc: Int64 = 0 +private func hashForCountAndIds(count: Int32, ids: [Int64]) -> Int64 { + var acc: UInt64 = 0 - acc = (acc &* 20261) &+ Int64(count) + combineInt64Hash(&acc, with: UInt64(count)) for id in ids { - acc = (acc &* 20261) &+ Int64(id) - acc = acc & Int64(0x7FFFFFFF) + combineInt64Hash(&acc, with: UInt64(bitPattern: id)) } - return Int32(acc & Int64(0x7FFFFFFF)) + return finalizeInt64Hash(acc) } func syncContactsOnce(network: Network, postbox: Postbox, accountPeerId: PeerId) -> Signal { - let initialContactPeerIdsHash = postbox.transaction { transaction -> Int32 in + let initialContactPeerIdsHash = postbox.transaction { transaction -> Int64 in let contactPeerIds = transaction.getContactPeerIds() let totalCount = transaction.getRemoteContactCount() let peerIds = Set(contactPeerIds.filter({ $0.namespace == Namespaces.Peer.CloudUser })) - return hashForCountAndIds(count: totalCount, ids: peerIds.map({ $0.id._internalGetInt32Value() }).sorted()) + return hashForCountAndIds(count: totalCount, ids: peerIds.map({ $0.id._internalGetInt64Value() }).sorted()) } let updatedPeers = initialContactPeerIdsHash diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/MessageReadStats.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/MessageReadStats.swift new file mode 100644 index 0000000000..a46d37b78b --- /dev/null +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/MessageReadStats.swift @@ -0,0 +1,71 @@ +import Postbox +import SwiftSignalKit +import TelegramApi + +public final class MessageReadStats { + public let peers: [EnginePeer] + + public init(peers: [EnginePeer]) { + self.peers = peers + } +} + +func _internal_messageReadStats(account: Account, id: MessageId) -> Signal { + return account.postbox.transaction { transaction -> Api.InputPeer? in + return transaction.getPeer(id.peerId).flatMap(apiInputPeer) + } + |> mapToSignal { inputPeer -> Signal in + guard let inputPeer = inputPeer else { + return .single(nil) + } + if id.namespace != Namespaces.Message.Cloud { + return .single(nil) + } + + return account.network.request(Api.functions.messages.getMessageReadParticipants(peer: inputPeer, msgId: id.id)) + |> map(Optional.init) + |> `catch` { _ -> Signal<[Int64]?, NoError> in + return .single(nil) + } + |> mapToSignal { result -> Signal in + guard let result = result else { + return .single(nil) + } + return account.postbox.transaction { transaction -> (peerIds: [PeerId], missingPeerIds: [PeerId]) in + var peerIds: [PeerId] = [] + var missingPeerIds: [PeerId] = [] + + for id in result { + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) + if peerId == account.peerId { + continue + } + peerIds.append(peerId) + if transaction.getPeer(peerId) == nil { + missingPeerIds.append(peerId) + } + } + + return (peerIds: peerIds, missingPeerIds: missingPeerIds) + } + |> mapToSignal { peerIds, missingPeerIds -> Signal in + if missingPeerIds.isEmpty || id.peerId.namespace != Namespaces.Peer.CloudChannel { + return account.postbox.transaction { transaction -> MessageReadStats? in + return MessageReadStats(peers: peerIds.compactMap { peerId -> EnginePeer? in + return transaction.getPeer(peerId).flatMap(EnginePeer.init) + }) + } + } else { + return _internal_channelMembers(postbox: account.postbox, network: account.network, accountPeerId: account.peerId, peerId: id.peerId, category: .recent(.all), offset: 0, limit: 50, hash: 0) + |> mapToSignal { _ -> Signal in + return account.postbox.transaction { transaction -> MessageReadStats? in + return MessageReadStats(peers: peerIds.compactMap { peerId -> EnginePeer? in + return transaction.getPeer(peerId).flatMap(EnginePeer.init) + }) + } + } + } + } + } + } +} diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift index d73686707a..e8edd1a520 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift @@ -285,11 +285,11 @@ private final class PollResultsOptionContext { let peerId: PeerId switch vote { case let .messageUserVote(userId, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .messageUserVoteInputOption(userId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .messageUserVoteMultiple(userId, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) } if let peer = transaction.getPeer(peerId) { resultPeers.append(RenderedPeer(peer: peer)) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift index 4dd7be6908..934a54d47f 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift @@ -203,5 +203,9 @@ public extension TelegramEngine { public func adMessages(peerId: PeerId) -> AdMessagesHistoryContext { return AdMessagesHistoryContext(account: self.account, peerId: peerId) } + + public func messageReadStats(id: MessageId) -> Signal { + return _internal_messageReadStats(account: self.account, id: id) + } } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift index 8b297fa09a..8c50af3d59 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift @@ -224,7 +224,7 @@ func _internal_fetchBotPaymentForm(postbox: Postbox, network: Network, messageId parsedSavedCredentials = .card(id: id, title: title) } } - return BotPaymentForm(id: id, canSaveCredentials: (flags & (1 << 2)) != 0, passwordMissing: (flags & (1 << 3)) != 0, invoice: parsedInvoice, paymentBotId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(providerId)), url: url, nativeProvider: parsedNativeProvider, savedInfo: parsedSavedInfo, savedCredentials: parsedSavedCredentials) + return BotPaymentForm(id: id, canSaveCredentials: (flags & (1 << 2)) != 0, passwordMissing: (flags & (1 << 3)) != 0, invoice: parsedInvoice, paymentBotId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(providerId)), url: url, nativeProvider: parsedNativeProvider, savedInfo: parsedSavedInfo, savedCredentials: parsedSavedCredentials) } } |> mapError { _ -> BotPaymentFormRequestError in } @@ -488,26 +488,6 @@ func _internal_requestBotPaymentReceipt(account: Account, messageId: MessageId) let parsedInfo = info.flatMap(BotPaymentRequestedInfo.init) let shippingOption = shipping.flatMap(BotPaymentShippingOption.init) - /*let fields = BotPaymentInvoiceFields() - - let form = BotPaymentForm( - id: 0, - canSaveCredentials: false, - passwordMissing: false, - invoice: BotPaymentInvoice( - isTest: false, - requestedFields: fields, - currency: currency, - prices: [], - tip: nil - ), - providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(providerId)), - url: "", - nativeProvider: nil, - savedInfo: nil, - savedCredentials: nil - )*/ - let invoiceMedia = TelegramMediaInvoice( title: title, description: description, @@ -519,7 +499,7 @@ func _internal_requestBotPaymentReceipt(account: Account, messageId: MessageId) flags: [] ) - let botPaymentId = PeerId.init(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)) + let botPaymentId = PeerId.init(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)) return BotPaymentReceipt(invoice: parsedInvoice, info: parsedInfo, shippingOption: shippingOption, credentialsTitle: credentialsTitle, invoiceMedia: invoiceMedia, tipAmount: tipAmount, botPaymentId: botPaymentId) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/AddPeerMember.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/AddPeerMember.swift index 826f15047d..ab4f0daf18 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/AddPeerMember.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/AddPeerMember.swift @@ -17,7 +17,7 @@ func _internal_addGroupMember(account: Account, peerId: PeerId, memberId: PeerId return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let memberPeer = transaction.getPeer(memberId), let inputUser = apiInputUser(memberPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.addChatUser(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, fwdLimit: 100)) + return account.network.request(Api.functions.messages.addChatUser(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, fwdLimit: 100)) |> mapError { error -> AddGroupMemberError in switch error.errorDescription { case "USERS_TOO_MUCH": diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift index f6a6a051f5..6c2b20eb56 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift @@ -220,7 +220,7 @@ func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: PeerId, m action = .pollStopped(rendered) } case let .channelAdminLogEventActionChangeLinkedChat(prevValue, newValue): - action = .linkedPeerUpdated(previous: prevValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(prevValue))], updated: newValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(newValue))]) + action = .linkedPeerUpdated(previous: prevValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(prevValue))], updated: newValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(newValue))]) case let .channelAdminLogEventActionChangeLocation(prevValue, newValue): action = .changeGeoLocation(previous: PeerGeoLocation(apiLocation: prevValue), updated: PeerGeoLocation(apiLocation: newValue)) case let .channelAdminLogEventActionToggleSlowMode(prevValue, newValue): @@ -253,7 +253,7 @@ func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: PeerId, m case let .channelAdminLogEventActionChangeTheme(prevValue, newValue): action = .changeTheme(previous: prevValue, updated: newValue) } - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) if let action = action { events.append(AdminLogEvent(id: id, peerId: peerId, date: date, action: action)) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift index 6e9b01691c..c90226eb26 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift @@ -20,7 +20,7 @@ public enum ChannelMembersCategory { case mentions(threadId: MessageId?, filter: ChannelMembersCategoryFilter) } -func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64, hash: Int32 = 0) -> Signal<[RenderedChannelParticipant]?, NoError> { +func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId: PeerId, peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64, hash: Int64 = 0) -> Signal<[RenderedChannelParticipant]?, NoError> { return postbox.transaction { transaction -> Signal<[RenderedChannelParticipant]?, NoError> in if let peer = transaction.getPeer(peerId), let inputChannel = apiInputChannel(peer) { let apiFilter: Api.ChannelParticipantsFilter diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChatListFiltering.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChatListFiltering.swift index 81f323abc2..30eff8ab1e 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChatListFiltering.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChatListFiltering.swift @@ -297,22 +297,22 @@ extension ChatListFilter { includePeers: ChatListFilterIncludePeers(rawPeers: includePeers.compactMap { peer -> PeerId? in switch peer { case let .inputPeerUser(userId, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: return nil } }, rawPinnedPeers: pinnedPeers.compactMap { peer -> PeerId? in switch peer { case let .inputPeerUser(userId, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: return nil } @@ -320,11 +320,11 @@ extension ChatListFilter { excludePeers: excludePeers.compactMap { peer -> PeerId? in switch peer { case let .inputPeerUser(userId, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: return nil } @@ -425,11 +425,11 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net var peerId: PeerId? switch peer { case let .inputPeerUser(userId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: break } @@ -445,11 +445,11 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net var peerId: PeerId? switch peer { case let .inputPeerUser(userId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: break } @@ -470,7 +470,7 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net var missingUsers: [Api.InputUser] = [] var missingChannels: [Api.InputChannel] = [] - var missingGroups: [Int32] = [] + var missingGroups: [Int64] = [] for peer in missingPeers { switch peer { case let .inputPeerUser(userId, accessHash): diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift index 2edaf4434c..26f89f9310 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift @@ -10,7 +10,7 @@ public enum ConvertGroupToSupergroupError { } func _internal_convertGroupToSupergroup(account: Account, peerId: PeerId) -> Signal { - return account.network.request(Api.functions.messages.migrateChat(chatId: peerId.id._internalGetInt32Value())) + return account.network.request(Api.functions.messages.migrateChat(chatId: peerId.id._internalGetInt64Value())) |> mapError { error -> ConvertGroupToSupergroupError in if error.errorDescription == "CHANNELS_TOO_MUCH" { return .tooManyChannels diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift index 9d288f6278..7393db32fa 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift @@ -3,7 +3,7 @@ import SwiftSignalKit import Postbox import TelegramApi -func _internal_findChannelById(postbox: Postbox, network: Network, channelId: Int32) -> Signal { +func _internal_findChannelById(postbox: Postbox, network: Network, channelId: Int64) -> Signal { return network.request(Api.functions.channels.getChannels(id: [.inputChannel(channelId: channelId, accessHash: 0)])) |> map(Optional.init) |> `catch` { _ -> Signal in diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/GroupsInCommon.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/GroupsInCommon.swift index 9fad743857..e7734d21d2 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/GroupsInCommon.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/GroupsInCommon.swift @@ -58,7 +58,7 @@ private final class GroupsInCommonContextImpl { guard let inputUser = inputUser else { return .single(([], 0)) } - return network.request(Api.functions.messages.getCommonChats(userId: inputUser, maxId: maxId?._internalGetInt32Value() ?? 0, limit: limit)) + return network.request(Api.functions.messages.getCommonChats(userId: inputUser, maxId: maxId?._internalGetInt64Value() ?? 0, limit: limit)) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift index 8c0b1d6403..e7ce8e3463 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/InvitationLinks.swift @@ -651,12 +651,12 @@ final class CachedPeerInvitationImporters: PostboxCoding { self.peerIds = decoder.decodeInt64ArrayForKey("peerIds").map(PeerId.init) var dates: [PeerId: Int32] = [:] - let datesArray = decoder.decodeInt32ArrayForKey("dates") + let datesArray = decoder.decodeInt64ArrayForKey("dates") for index in stride(from: 0, to: datesArray.endIndex, by: 2) { let userId = datesArray[index] let date = datesArray[index + 1] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) - dates[peerId] = date + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) + dates[peerId] = Int32(clamping: date) } self.dates = dates @@ -666,12 +666,12 @@ final class CachedPeerInvitationImporters: PostboxCoding { func encode(_ encoder: PostboxEncoder) { encoder.encodeInt64Array(self.peerIds.map { $0.toInt64() }, forKey: "peerIds") - var dates: [Int32] = [] + var dates: [Int64] = [] for (peerId, date) in self.dates { - dates.append(peerId.id._internalGetInt32Value()) - dates.append(date) + dates.append(peerId.id._internalGetInt64Value()) + dates.append(Int64(date)) } - encoder.encodeInt32Array(dates, forKey: "dates") + encoder.encodeInt64Array(dates, forKey: "dates") encoder.encodeInt32(self.count, forKey: "count") } @@ -788,7 +788,7 @@ private final class PeerInvitationImportersContextImpl { let date: Int32 switch importer { case let .chatInviteImporter(userId, dateValue): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) date = dateValue } if let peer = transaction.getPeer(peerId) { @@ -908,7 +908,7 @@ func _internal_peerExportedInvitationsCreators(account: Account, peerId: PeerId) for admin in admins { switch admin { case let .chatAdminWithInvites(adminId, invitesCount, revokedInvitesCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)) if let peer = peersMap[peerId], peerId != account.peerId { creators.append(ExportedInvitationCreator(peer: RenderedPeer(peer: peer), count: invitesCount, revokedCount: revokedInvitesCount)) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/NotificationExceptionsList.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/NotificationExceptionsList.swift index 7d261fe6a6..b2c6c17892 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/NotificationExceptionsList.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/NotificationExceptionsList.swift @@ -48,11 +48,11 @@ func _internal_notificationExceptionsList(postbox: Postbox, network: Network) -> let peerId: PeerId switch notifyPeer { case let .peerUser(userId): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .peerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .peerChannel(channelId): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) } settings[peerId] = TelegramPeerNotificationSettings(apiSettings: notifySettings) default: diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/Peer.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/Peer.swift index 501c75e0f1..092be92c31 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/Peer.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/Peer.swift @@ -138,7 +138,7 @@ public extension EnginePeer { if peer.id.isReplies { return true } - return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id._internalGetInt32Value() == 777000 || peer.id.id._internalGetInt32Value() == 333000)) + return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id._internalGetInt64Value() == 777000 || peer.id.id._internalGetInt64Value() == 333000)) } return false } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift index 6896019984..8d6e5b9777 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift @@ -13,7 +13,7 @@ func _internal_removeGroupAdmin(account: Account, peerId: PeerId, adminId: PeerI return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let adminPeer = transaction.getPeer(adminId), let inputUser = apiInputUser(adminPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, isAdmin: .boolFalse)) + return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, isAdmin: .boolFalse)) |> mapError { _ -> RemoveGroupAdminError in return .generic } |> mapToSignal { result -> Signal in return account.postbox.transaction { transaction -> Void in @@ -61,7 +61,7 @@ func _internal_addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let adminPeer = transaction.getPeer(adminId), let inputUser = apiInputUser(adminPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, isAdmin: .boolTrue)) + return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, isAdmin: .boolTrue)) |> `catch` { error -> Signal in if error.errorDescription == "USER_NOT_PARTICIPANT" { return _internal_addGroupMember(account: account, peerId: peerId, memberId: adminId) @@ -72,7 +72,7 @@ func _internal_addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) return .complete() } |> then( - account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, isAdmin: .boolTrue)) + account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, isAdmin: .boolTrue)) |> mapError { error -> AddGroupAdminError in return .generic } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerPhotoUpdater.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerPhotoUpdater.swift index f4abfe1612..f5888f1e09 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerPhotoUpdater.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerPhotoUpdater.swift @@ -213,7 +213,7 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state let request: Signal if let peer = peer as? TelegramGroup { - request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt32Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp))) + request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp))) } else if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) { request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp))) } else { @@ -301,7 +301,7 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state } else { let request: Signal if let peer = peer as? TelegramGroup { - request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt32Value(), photo: .inputChatPhotoEmpty)) + request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatPhotoEmpty)) } else if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) { request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatPhotoEmpty)) } else { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/RemovePeerMember.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/RemovePeerMember.swift index d6aaf0c030..a317b51706 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/RemovePeerMember.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/RemovePeerMember.swift @@ -16,7 +16,7 @@ func _internal_removePeerMember(account: Account, peerId: PeerId, memberId: Peer return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let memberPeer = transaction.getPeer(memberId), let inputUser = apiInputUser(memberPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: group.id.id._internalGetInt32Value(), userId: inputUser)) + return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: group.id.id._internalGetInt64Value(), userId: inputUser)) |> mapError { error -> Void in return Void() } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ReportPeer.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ReportPeer.swift index 98ca1a7867..73b3242312 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ReportPeer.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ReportPeer.swift @@ -9,7 +9,7 @@ func _internal_reportPeer(account: Account, peerId: PeerId) -> Signal Signal in if let peer = transaction.getPeer(peerId) { if let peer = peer as? TelegramSecretChat { - return account.network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash))) + return account.network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift index 17e018ff02..8a889a86b7 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift @@ -74,7 +74,7 @@ public extension TelegramEngine { } } - public func findChannelById(channelId: Int32) -> Signal { + public func findChannelById(channelId: Int64) -> Signal { return _internal_findChannelById(postbox: self.account.postbox, network: self.account.network, channelId: channelId) } @@ -215,7 +215,7 @@ public extension TelegramEngine { return _internal_updateChannelHistoryAvailabilitySettingsInteractively(postbox: self.account.postbox, network: self.account.network, accountStateManager: self.account.stateManager, peerId: peerId, historyAvailableForNewMembers: historyAvailableForNewMembers) } - public func channelMembers(peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64, hash: Int32 = 0) -> Signal<[RenderedChannelParticipant]?, NoError> { + public func channelMembers(peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64, hash: Int64 = 0) -> Signal<[RenderedChannelParticipant]?, NoError> { return _internal_channelMembers(postbox: self.account.postbox, network: self.account.network, accountPeerId: self.account.peerId, peerId: peerId, category: category, offset: offset, limit: limit, hash: hash) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift index c53536bbd5..a2bfc8fc3c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift @@ -217,7 +217,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee } } } else if peerId.namespace == Namespaces.Peer.CloudGroup { - return network.request(Api.functions.messages.getFullChat(chatId: peerId.id._internalGetInt32Value())) + return network.request(Api.functions.messages.getFullChat(chatId: peerId.id._internalGetInt64Value())) |> retryRequest |> mapToSignal { result -> Signal in return postbox.transaction { transaction -> Bool in @@ -236,7 +236,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee for botInfo in chatFull.botInfo ?? [] { switch botInfo { case let .botInfo(userId, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) let parsedBotInfo = BotInfo(apiBotInfo: botInfo) botInfos.append(CachedPeerBotInfo(peerId: peerId, botInfo: parsedBotInfo)) } @@ -382,7 +382,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee let linkedDiscussionPeerId: PeerId? if let linkedChatId = linkedChatId, linkedChatId != 0 { - linkedDiscussionPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(linkedChatId)) + linkedDiscussionPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(linkedChatId))) } else { linkedDiscussionPeerId = nil } @@ -400,7 +400,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee for botInfo in apiBotInfos { switch botInfo { case let .botInfo(userId, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) let parsedBotInfo = BotInfo(apiBotInfo: botInfo) botInfos.append(CachedPeerBotInfo(peerId: peerId, botInfo: parsedBotInfo)) } @@ -422,7 +422,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee var migrationReference: ChannelMigrationReference? if let migratedFromChatId = migratedFromChatId, let migratedFromMaxId = migratedFromMaxId { - migrationReference = ChannelMigrationReference(maxMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(migratedFromChatId)), namespace: Namespaces.Message.Cloud, id: migratedFromMaxId)) + migrationReference = ChannelMigrationReference(maxMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(migratedFromChatId)), namespace: Namespaces.Message.Cloud, id: migratedFromMaxId)) } var peers: [Peer] = [] @@ -491,7 +491,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee case let.channelParticipant(participant, _, _): switch participant { case let .channelParticipantSelf(_, inviterId, _): - invitedBy = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)) + invitedBy = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)) default: break } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdatePeerInfo.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdatePeerInfo.swift index 305660764e..27bacc080f 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdatePeerInfo.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdatePeerInfo.swift @@ -29,7 +29,7 @@ func _internal_updatePeerTitle(account: Account, peerId: PeerId, title: String) } |> mapError { _ -> UpdatePeerTitleError in } } } else if let peer = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.editChatTitle(chatId: peer.id.id._internalGetInt32Value(), title: title)) + return account.network.request(Api.functions.messages.editChatTitle(chatId: peer.id.id._internalGetInt64Value(), title: title)) |> mapError { _ -> UpdatePeerTitleError in return .generic } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Privacy/RecentWebSessions.swift b/submodules/TelegramCore/Sources/TelegramEngine/Privacy/RecentWebSessions.swift index 09056fb00c..c1dc5a6d3e 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Privacy/RecentWebSessions.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Privacy/RecentWebSessions.swift @@ -31,7 +31,7 @@ func webSessions(network: Network) -> Signal<([WebAuthorization], [PeerId: Peer] for authorization in authorizations { switch authorization { case let .webAuthorization(hash, botId, domain, browser, platform, dateCreated, dateActive, ip, region): - sessions.append(WebAuthorization(hash: hash, botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), domain: domain, browser: browser, platform: platform, dateCreated: dateCreated, dateActive: dateActive, ip: ip, region: region)) + sessions.append(WebAuthorization(hash: hash, botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), domain: domain, browser: browser, platform: platform, dateCreated: dateCreated, dateActive: dateActive, ip: ip, region: region)) } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Privacy/UpdatedAccountPrivacySettings.swift b/submodules/TelegramCore/Sources/TelegramEngine/Privacy/UpdatedAccountPrivacySettings.swift index 847cccced8..b9ec6fbb66 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Privacy/UpdatedAccountPrivacySettings.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Privacy/UpdatedAccountPrivacySettings.swift @@ -232,7 +232,7 @@ func _internal_updateSelectiveAccountPrivacySettings(account: Account, type: Upd rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: apiInputUsers(transaction: transaction, peerIds: enablePeers.users))) } if !enablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowAll) @@ -244,14 +244,14 @@ func _internal_updateSelectiveAccountPrivacySettings(account: Account, type: Upd rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: apiInputUsers(transaction: transaction, peerIds: enablePeers.users))) } if !enablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } if !disablePeers.users.isEmpty { rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: apiInputUsers(transaction: transaction, peerIds: disablePeers.users))) } if !disablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowContacts) @@ -262,7 +262,7 @@ func _internal_updateSelectiveAccountPrivacySettings(account: Account, type: Upd rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: apiInputUsers(transaction: transaction, peerIds: disablePeers.users))) } if !disablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowAll) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift index 77b586b24d..a046d3524c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift @@ -332,7 +332,7 @@ public func grantSecureIdAccess(network: Network, peerId: PeerId, publicKey: Str valueHashes.append(.secureValueHash(type: apiSecureValueType(value: value.value), hash: Buffer(data: value.opaqueHash))) } - return network.request(Api.functions.account.acceptAuthorization(botId: peerId.id._internalGetInt32Value(), scope: scope, publicKey: publicKey, valueHashes: valueHashes, credentials: .secureCredentialsEncrypted(data: Buffer(data: encryptedCredentialsData), hash: Buffer(data: decryptedCredentialsHash), secret: Buffer(data: encryptedSecretData)))) + return network.request(Api.functions.account.acceptAuthorization(botId: peerId.id._internalGetInt64Value(), scope: scope, publicKey: publicKey, valueHashes: valueHashes, credentials: .secureCredentialsEncrypted(data: Buffer(data: encryptedCredentialsData), hash: Buffer(data: decryptedCredentialsHash), secret: Buffer(data: encryptedSecretData)))) |> mapError { error -> GrantSecureIdAccessError in return .generic } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift index 03d4e2a505..9bea496571 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift @@ -250,7 +250,7 @@ public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: Peer if publicKey.isEmpty { return .fail(.serverError("PUBLIC_KEY_REQUIRED")) } - return network.request(Api.functions.account.getAuthorizationForm(botId: peerId.id._internalGetInt32Value(), scope: scope, publicKey: publicKey)) + return network.request(Api.functions.account.getAuthorizationForm(botId: peerId.id._internalGetInt64Value(), scope: scope, publicKey: publicKey)) |> mapError { error -> RequestSecureIdFormError in switch error.errorDescription { case "APP_VERSION_OUTDATED": diff --git a/submodules/TelegramCore/Sources/Themes.swift b/submodules/TelegramCore/Sources/Themes.swift index 6a6a879f6d..5c6ab6d937 100644 --- a/submodules/TelegramCore/Sources/Themes.swift +++ b/submodules/TelegramCore/Sources/Themes.swift @@ -12,10 +12,10 @@ let telegramThemeFileExtension = "tgios-theme" #endif public func telegramThemes(postbox: Postbox, network: Network, accountManager: AccountManager?, forceUpdate: Bool = false) -> Signal<[TelegramTheme], NoError> { - let fetch: ([TelegramTheme]?, Int32?) -> Signal<[TelegramTheme], NoError> = { current, hash in + let fetch: ([TelegramTheme]?, Int64?) -> Signal<[TelegramTheme], NoError> = { current, hash in network.request(Api.functions.account.getThemes(format: telegramThemeFormat, hash: hash ?? 0)) |> retryRequest - |> mapToSignal { result -> Signal<([TelegramTheme], Int32), NoError> in + |> mapToSignal { result -> Signal<([TelegramTheme], Int64), NoError> in switch result { case let .themes(hash, themes): let result = themes.compactMap { TelegramTheme(apiTheme: $0) } @@ -70,7 +70,7 @@ public func telegramThemes(postbox: Postbox, network: Network, accountManager: A if forceUpdate { return fetch(nil, nil) } else { - return postbox.transaction { transaction -> ([TelegramTheme], Int32?) in + return postbox.transaction { transaction -> ([TelegramTheme], Int64?) in let configuration = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedThemesConfiguration, key: ValueBoxKey(length: 0))) as? CachedThemesConfiguration let items = transaction.getOrderedListItems(collectionId: Namespaces.OrderedItemList.CloudThemes) return (items.map { $0.contents as! TelegramTheme }, configuration?.hash) diff --git a/submodules/TelegramCore/Sources/Utils/PeerUtils.swift b/submodules/TelegramCore/Sources/Utils/PeerUtils.swift index 99f70eea33..70f32297a1 100644 --- a/submodules/TelegramCore/Sources/Utils/PeerUtils.swift +++ b/submodules/TelegramCore/Sources/Utils/PeerUtils.swift @@ -240,7 +240,7 @@ public func isServicePeer(_ peer: Peer) -> Bool { if peer.id.isReplies { return true } - return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id._internalGetInt32Value() == 777000 || peer.id.id._internalGetInt32Value() == 333000)) + return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id._internalGetInt64Value() == 777000 || peer.id.id._internalGetInt64Value() == 333000)) } return false } @@ -248,7 +248,7 @@ public func isServicePeer(_ peer: Peer) -> Bool { public extension PeerId { var isReplies: Bool { if self.namespace == Namespaces.Peer.CloudUser { - if self.id._internalGetInt32Value() == 708513 || self.id._internalGetInt32Value() == 1271266957 { + if self.id._internalGetInt64Value() == 708513 || self.id._internalGetInt64Value() == 1271266957 { return true } } @@ -267,7 +267,7 @@ public extension PeerId { var isImport: Bool { if self.namespace == Namespaces.Peer.CloudUser { - if self.id._internalGetInt32Value() == 225079 { + if self.id._internalGetInt64Value() == 225079 { return true } } diff --git a/submodules/TelegramCore/Sources/Wallpapers.swift b/submodules/TelegramCore/Sources/Wallpapers.swift index 56c724eadc..fa323e0ff0 100644 --- a/submodules/TelegramCore/Sources/Wallpapers.swift +++ b/submodules/TelegramCore/Sources/Wallpapers.swift @@ -5,10 +5,10 @@ import TelegramApi public func telegramWallpapers(postbox: Postbox, network: Network, forceUpdate: Bool = false) -> Signal<[TelegramWallpaper], NoError> { - let fetch: ([TelegramWallpaper]?, Int32?) -> Signal<[TelegramWallpaper], NoError> = { current, hash in + let fetch: ([TelegramWallpaper]?, Int64?) -> Signal<[TelegramWallpaper], NoError> = { current, hash in network.request(Api.functions.account.getWallPapers(hash: 0)) |> retryRequest - |> mapToSignal { result -> Signal<([TelegramWallpaper], Int32), NoError> in + |> mapToSignal { result -> Signal<([TelegramWallpaper], Int64), NoError> in switch result { case let .wallPapers(hash, wallpapers): var items: [TelegramWallpaper] = [] @@ -55,7 +55,7 @@ public func telegramWallpapers(postbox: Postbox, network: Network, forceUpdate: if forceUpdate { return fetch(nil, nil) } else { - return postbox.transaction { transaction -> ([TelegramWallpaper], Int32?) in + return postbox.transaction { transaction -> ([TelegramWallpaper], Int64?) in let configuration = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedWallpapersConfiguration, key: ValueBoxKey(length: 0))) as? CachedWallpapersConfiguration let items = transaction.getOrderedListItems(collectionId: Namespaces.OrderedItemList.CloudWallpapers) if items.count == 0 { diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index e8b0702b72..5483fabe3b 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -290,13 +290,13 @@ final class SharedApplicationContext { var peerId: PeerId? if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let msgId = payload["msg_id"] { @@ -1705,8 +1705,8 @@ final class SharedApplicationContext { } if let startCallContacts = startCallContacts { - let startCall: (Int32) -> Void = { userId in - self.startCallWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), isVideo: startCallIsVideo) + let startCall: (Int64) -> Void = { userId in + self.startCallWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), isVideo: startCallIsVideo) } func cleanPhoneNumber(_ text: String) -> String { @@ -1737,7 +1737,7 @@ final class SharedApplicationContext { var processed = false if let handle = contact.customIdentifier, handle.hasPrefix("tg") { let string = handle.suffix(from: handle.index(handle.startIndex, offsetBy: 2)) - if let userId = Int32(string) { + if let userId = Int64(string) { startCall(userId) processed = true } @@ -1745,7 +1745,7 @@ final class SharedApplicationContext { if !processed, let handle = contact.personHandle, let value = handle.value { switch handle.type { case .unknown: - if let userId = Int32(value) { + if let userId = Int64(value) { startCall(userId) processed = true } @@ -1768,7 +1768,7 @@ final class SharedApplicationContext { return result } |> deliverOnMainQueue).start(next: { peerId in if let peerId = peerId { - startCall(peerId.id._internalGetInt32Value()) + startCall(peerId.id._internalGetInt64Value()) } }) processed = true @@ -1782,8 +1782,8 @@ final class SharedApplicationContext { } else if let sendMessageIntent = userActivity.interaction?.intent as? INSendMessageIntent { if let contact = sendMessageIntent.recipients?.first, let handle = contact.customIdentifier, handle.hasPrefix("tg") { let string = handle.suffix(from: handle.index(handle.startIndex, offsetBy: 2)) - if let userId = Int32(string) { - self.openChatWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), activateInput: true) + if let userId = Int64(string) { + self.openChatWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), activateInput: true) } } } @@ -2325,7 +2325,7 @@ private func accountIdFromNotification(_ notification: UNNotification, sharedCon |> take(1) |> map { _, contexts, _ -> AccountRecordId? in for (_, context, _) in contexts { - if Int(context.account.peerId.id._internalGetInt32Value()) == userId { + if Int(context.account.peerId.id._internalGetInt64Value()) == userId { return context.account.id } } @@ -2347,16 +2347,16 @@ private func peerIdFromNotification(_ notification: UNNotification) -> PeerId? { var peerId: PeerId? if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["encryption_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } return peerId } diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 7a48c4c9dd..9a07fa961d 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -18,6 +18,9 @@ import PresentationDataUtils import TelegramPresentationData import TelegramStringFormatting import UndoUI +import ShimmerEffect +import AnimatedAvatarSetNode +import AvatarNode private struct MessageContextMenuData { let starStatus: Bool? @@ -136,6 +139,51 @@ private func canEditMessage(accountPeerId: PeerId, limitsConfiguration: LimitsCo return false } +private func canViewReadStats(message: Message, appConfig: AppConfiguration) -> Bool { + if message.flags.contains(.Incoming) { + return false + } + guard let peer = message.peers[message.id.peerId] else { + return false + } + for media in message.media { + if let _ = media as? TelegramMediaAction { + return false + } + } + + var maxParticipantCount = 50 + var maxTimeout = 7 * 86400 + if let data = appConfig.data { + if let value = data["chat_read_mark_size_threshold"] as? Double { + maxParticipantCount = Int(value) + } + if let value = data["chat_read_mark_expire_period"] as? Double { + maxTimeout = Int(value) + } + } + + switch peer { + case let channel as TelegramChannel: + if case .broadcast = channel.info { + return false + } + case let group as TelegramGroup: + if group.participantCount > maxParticipantCount { + return false + } + default: + return false + } + + let timestamp = Int32(CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970) + if Int64(message.timestamp) + Int64(maxTimeout) < Int64(timestamp) { + return false + } + + return true +} + func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceState) -> Bool { guard let peer = chatPresentationInterfaceState.renderedPeer?.peer else { return false @@ -284,7 +332,7 @@ func updatedChatEditInterfaceMessageState(state: ChatPresentationInterfaceState, return updated } -func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, messages: [Message], controllerInteraction: ChatControllerInteraction?, selectAll: Bool, interfaceInteraction: ChatPanelInterfaceInteraction?) -> Signal<[ContextMenuItem], NoError> { +func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, messages: [Message], controllerInteraction: ChatControllerInteraction?, selectAll: Bool, interfaceInteraction: ChatPanelInterfaceInteraction?, readStats: MessageReadStats? = nil) -> Signal<[ContextMenuItem], NoError> { guard let interfaceInteraction = interfaceInteraction, let controllerInteraction = controllerInteraction else { return .single([]) } @@ -422,8 +470,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState canPin = true } } - /*case .group: - break*/ } } else { canReply = false @@ -463,15 +509,17 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState |> map(Optional.init) } - let loadLimits = context.account.postbox.transaction { transaction -> LimitsConfiguration in - return transaction.getPreferencesEntry(key: PreferencesKeys.limitsConfiguration) as? LimitsConfiguration ?? LimitsConfiguration.defaultValue + let loadLimits = context.account.postbox.transaction { transaction -> (LimitsConfiguration, AppConfiguration) in + let limitsConfiguration = transaction.getPreferencesEntry(key: PreferencesKeys.limitsConfiguration) as? LimitsConfiguration ?? LimitsConfiguration.defaultValue + let appConfig = transaction.getPreferencesEntry(key: PreferencesKeys.appConfiguration) as? AppConfiguration ?? AppConfiguration.defaultValue + return (limitsConfiguration, appConfig) } let cachedData = context.account.postbox.transaction { transaction -> CachedPeerData? in return transaction.getPeerCachedData(peerId: messages[0].id.peerId) } - let dataSignal: Signal<(MessageContextMenuData, [MessageId: ChatUpdatingMessageMedia], CachedPeerData?), NoError> = combineLatest( + let dataSignal: Signal<(MessageContextMenuData, [MessageId: ChatUpdatingMessageMedia], CachedPeerData?, AppConfiguration), NoError> = combineLatest( loadLimits, loadStickerSaveStatusSignal, loadResourceStatusSignal, @@ -480,19 +528,20 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState |> take(1), cachedData ) - |> map { limitsConfiguration, stickerSaveStatus, resourceStatus, messageActions, updatingMessageMedia, cachedData -> (MessageContextMenuData, [MessageId: ChatUpdatingMessageMedia], CachedPeerData?) in + |> map { limitsAndAppConfig, stickerSaveStatus, resourceStatus, messageActions, updatingMessageMedia, cachedData -> (MessageContextMenuData, [MessageId: ChatUpdatingMessageMedia], CachedPeerData?, AppConfiguration) in + let (limitsConfiguration, appConfig) = limitsAndAppConfig var canEdit = false if !isAction { let message = messages[0] canEdit = canEditMessage(context: context, limitsConfiguration: limitsConfiguration, message: message) } - return (MessageContextMenuData(starStatus: stickerSaveStatus, canReply: canReply, canPin: canPin, canEdit: canEdit, canSelect: canSelect, resourceStatus: resourceStatus, messageActions: messageActions), updatingMessageMedia, cachedData) + return (MessageContextMenuData(starStatus: stickerSaveStatus, canReply: canReply, canPin: canPin, canEdit: canEdit, canSelect: canSelect, resourceStatus: resourceStatus, messageActions: messageActions), updatingMessageMedia, cachedData, appConfig) } return dataSignal |> deliverOnMainQueue - |> map { data, updatingMessageMedia, cachedData -> [ContextMenuItem] in + |> map { data, updatingMessageMedia, cachedData, appConfig -> [ContextMenuItem] in var actions: [ContextMenuItem] = [] var isPinnedMessages = false @@ -950,13 +999,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } } } - /*if !isReplyThreadHead, !data.messageActions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty && isAction { - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuDelete, textColor: .destructive, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor) - }, action: { controller, f in - interfaceInteraction.deleteMessages(messages, controller, f) - }))) - }*/ if data.messageActions.options.contains(.viewStickerPack) { actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.StickerPack_ViewPack, icon: { theme in @@ -1012,6 +1054,28 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState clearCacheAsDelete = true } + if !isPinnedMessages, !isReplyThreadHead, data.canSelect { + if !selectAll || messages.count == 1 { + actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelect, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + interfaceInteraction.beginMessageSelection(selectAll ? messages.map { $0.id } : [message.id], { transition in + f(.custom(transition)) + }) + }))) + } + + if messages.count > 1 { + actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelectAll(Int32(messages.count)), icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/SelectAll"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + interfaceInteraction.beginMessageSelection(messages.map { $0.id }, { transition in + f(.custom(transition)) + }) + }))) + } + } + if !isReplyThreadHead, (!data.messageActions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty || clearCacheAsDelete) { var autoremoveDeadline: Int32? for attribute in message.attributes { @@ -1036,7 +1100,12 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } else { title = chatPresentationInterfaceState.strings.Conversation_ContextMenuDelete } + if let autoremoveDeadline = autoremoveDeadline, !isEditing, !isSending { + if !actions.isEmpty { + actions.append(.separator) + } + actions.append(.custom(ChatDeleteMessageContextItem(timestamp: Double(autoremoveDeadline), action: { controller, f in if isEditing { context.account.pendingUpdateMessageManager.cancel(messageId: message.id) @@ -1046,6 +1115,10 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } }), false)) } else if !isUnremovableAction { + if !actions.isEmpty { + actions.append(.separator) + } + actions.append(.action(ContextMenuActionItem(text: title, textColor: .destructive, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: isSending ? "Chat/Context Menu/Clear" : "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor) }, action: { controller, f in @@ -1058,29 +1131,66 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState }))) } } - - if !isPinnedMessages, !isReplyThreadHead, data.canSelect { - if !actions.isEmpty { - actions.append(.separator) + + if let peer = message.peers[message.id.peerId], canViewReadStats(message: message, appConfig: appConfig) { + var hasReadReports = false + if let channel = peer as? TelegramChannel { + if case .group = channel.info { + if let cachedData = cachedData as? CachedChannelData, let memberCount = cachedData.participantsSummary.memberCount, memberCount <= 50 { + hasReadReports = true + } + } + } else if let group = peer as? TelegramGroup { + if group.participantCount <= 50 { + hasReadReports = true + } } - if !selectAll || messages.count == 1 { - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelect, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in - interfaceInteraction.beginMessageSelection(selectAll ? messages.map { $0.id } : [message.id], { transition in - f(.custom(transition)) - }) - }))) - } - - if messages.count > 1 { - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelectAll(Int32(messages.count)), icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/SelectAll"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in - interfaceInteraction.beginMessageSelection(messages.map { $0.id }, { transition in - f(.custom(transition)) - }) - }))) + + if hasReadReports { + if !actions.isEmpty { + actions.insert(.separator, at: 0) + } + + actions.insert(.custom(ChatReadReportContextItem(context: context, message: message, stats: readStats, action: { c, f, stats in + if stats.peers.count == 1 { + c.dismiss(completion: { + controllerInteraction.openPeer(stats.peers[0].id, .default, nil) + }) + } else if !stats.peers.isEmpty { + var subActions: [ContextMenuItem] = [] + + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + + subActions.append(.action(ContextMenuActionItem(text: presentationData.strings.Common_Back, textColor: .primary, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Back"), color: theme.actionSheet.primaryTextColor) + }, action: { controller, _ in + controller.setItems(contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState: chatPresentationInterfaceState, context: context, messages: messages, controllerInteraction: controllerInteraction, selectAll: selectAll, interfaceInteraction: interfaceInteraction, readStats: stats)) + }))) + + let debugRepeatCount: Int + #if DEBUG + debugRepeatCount = stats.peers.count == 1 ? 1 : 50 + #else + debugRepeatCount = 1 + #endif + + for _ in 0 ..< debugRepeatCount { + for peer in stats.peers { + let avatarSignal = peerAvatarCompleteImage(account: context.account, peer: peer._asPeer(), size: CGSize(width: 30.0, height: 30.0)) + + subActions.append(.action(ContextMenuActionItem(text: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), textLayout: .singleLine, icon: { _ in nil }, iconSource: ContextMenuActionItemIconSource(size: CGSize(width: 30.0, height: 30.0), signal: avatarSignal), action: { _, f in + c.dismiss(completion: { + controllerInteraction.openPeer(peer.id, .default, nil) + }) + }))) + } + } + + c.setItems(.single(subActions)) + } else { + f(.default) + } + }), false), at: 0) } } @@ -1394,6 +1504,10 @@ private final class ChatDeleteMessageContextItemNode: ASDisplayNode, ContextMenu private var pointerInteraction: PointerInteraction? + var isActionEnabled: Bool { + return true + } + init(presentationData: PresentationData, item: ChatDeleteMessageContextItem, getController: @escaping () -> ContextControllerProtocol?, actionSelected: @escaping (ContextMenuActionResult) -> Void) { self.item = item self.presentationData = presentationData @@ -1569,6 +1683,279 @@ private final class ChatDeleteMessageContextItemNode: ASDisplayNode, ContextMenu } } +final class ChatReadReportContextItem: ContextMenuCustomItem { + fileprivate let context: AccountContext + fileprivate let message: Message + fileprivate let stats: MessageReadStats? + fileprivate let action: (ContextControllerProtocol, @escaping (ContextMenuActionResult) -> Void, MessageReadStats) -> Void + + init(context: AccountContext, message: Message, stats: MessageReadStats?, action: @escaping (ContextControllerProtocol, @escaping (ContextMenuActionResult) -> Void, MessageReadStats) -> Void) { + self.context = context + self.message = message + self.stats = stats + self.action = action + } + + func node(presentationData: PresentationData, getController: @escaping () -> ContextControllerProtocol?, actionSelected: @escaping (ContextMenuActionResult) -> Void) -> ContextMenuCustomNode { + return ChatReadReportContextItemNode(presentationData: presentationData, item: self, getController: getController, actionSelected: actionSelected) + } +} + +private final class ChatReadReportContextItemNode: ASDisplayNode, ContextMenuCustomNode, ContextActionNodeProtocol { + private let item: ChatReadReportContextItem + private var presentationData: PresentationData + private let getController: () -> ContextControllerProtocol? + private let actionSelected: (ContextMenuActionResult) -> Void + + private let backgroundNode: ASDisplayNode + private let highlightedBackgroundNode: ASDisplayNode + private let textNode: ImmediateTextNode + private let shimmerNode: ShimmerEffectNode + private let iconNode: ASImageNode + + private let avatarsNode: AnimatedAvatarSetNode + private let avatarsContext: AnimatedAvatarSetContext + + private let placeholderAvatarsNode: AnimatedAvatarSetNode + private let placeholderAvatarsContext: AnimatedAvatarSetContext + + private let buttonNode: HighlightTrackingButtonNode + + private var pointerInteraction: PointerInteraction? + + private var disposable: Disposable? + private var currentStats: MessageReadStats? + + init(presentationData: PresentationData, item: ChatReadReportContextItem, getController: @escaping () -> ContextControllerProtocol?, actionSelected: @escaping (ContextMenuActionResult) -> Void) { + self.item = item + self.presentationData = presentationData + self.getController = getController + self.actionSelected = actionSelected + self.currentStats = item.stats + + let textFont = Font.regular(presentationData.listsFontSize.baseDisplaySize) + + self.backgroundNode = ASDisplayNode() + self.backgroundNode.isAccessibilityElement = false + self.backgroundNode.backgroundColor = presentationData.theme.contextMenu.itemBackgroundColor + self.highlightedBackgroundNode = ASDisplayNode() + self.highlightedBackgroundNode.isAccessibilityElement = false + self.highlightedBackgroundNode.backgroundColor = presentationData.theme.contextMenu.itemHighlightedBackgroundColor + self.highlightedBackgroundNode.alpha = 0.0 + + self.textNode = ImmediateTextNode() + self.textNode.isAccessibilityElement = false + self.textNode.isUserInteractionEnabled = false + self.textNode.displaysAsynchronously = false + self.textNode.attributedText = NSAttributedString(string: " ", font: textFont, textColor: presentationData.theme.contextMenu.destructiveColor) + self.textNode.maximumNumberOfLines = 1 + self.textNode.alpha = 0.0 + + self.shimmerNode = ShimmerEffectNode() + self.shimmerNode.clipsToBounds = true + + self.buttonNode = HighlightTrackingButtonNode() + self.buttonNode.isAccessibilityElement = true + self.buttonNode.accessibilityLabel = presentationData.strings.VoiceChat_StopRecording + + self.iconNode = ASImageNode() + self.iconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: presentationData.theme.actionSheet.primaryTextColor) + + self.avatarsNode = AnimatedAvatarSetNode() + self.avatarsContext = AnimatedAvatarSetContext() + + self.placeholderAvatarsNode = AnimatedAvatarSetNode() + self.placeholderAvatarsContext = AnimatedAvatarSetContext() + + super.init() + + self.addSubnode(self.backgroundNode) + self.addSubnode(self.highlightedBackgroundNode) + self.addSubnode(self.shimmerNode) + self.addSubnode(self.textNode) + self.addSubnode(self.iconNode) + self.addSubnode(self.avatarsNode) + self.addSubnode(self.placeholderAvatarsNode) + self.addSubnode(self.buttonNode) + + self.buttonNode.highligthedChanged = { [weak self] highligted in + guard let strongSelf = self else { + return + } + if highligted { + strongSelf.highlightedBackgroundNode.alpha = 1.0 + } else { + strongSelf.highlightedBackgroundNode.alpha = 0.0 + strongSelf.highlightedBackgroundNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.3) + } + } + self.buttonNode.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: .touchUpInside) + + if let currentStats = self.currentStats { + self.buttonNode.isUserInteractionEnabled = !currentStats.peers.isEmpty + } else { + self.buttonNode.isUserInteractionEnabled = false + + self.disposable = (item.context.engine.messages.messageReadStats(id: item.message.id) + |> deliverOnMainQueue).start(next: { [weak self] value in + guard let strongSelf = self else { + return + } + if let value = value { + strongSelf.updateStats(stats: value, transition: .animated(duration: 0.2, curve: .easeInOut)) + } + }) + } + } + + deinit { + self.disposable?.dispose() + } + + override func didLoad() { + super.didLoad() + + self.pointerInteraction = PointerInteraction(node: self.buttonNode, style: .hover, willEnter: { [weak self] in + if let strongSelf = self { + strongSelf.highlightedBackgroundNode.alpha = 0.75 + } + }, willExit: { [weak self] in + if let strongSelf = self { + strongSelf.highlightedBackgroundNode.alpha = 0.0 + } + }) + } + + private var validLayout: (calculatedWidth: CGFloat, size: CGSize)? + + func updateStats(stats: MessageReadStats, transition: ContainedViewLayoutTransition) { + self.buttonNode.isUserInteractionEnabled = !stats.peers.isEmpty + + guard let (calculatedWidth, size) = self.validLayout else { + return + } + + self.currentStats = stats + + let (_, apply) = self.updateLayout(constrainedWidth: calculatedWidth) + apply(size, transition) + } + + func updateLayout(constrainedWidth: CGFloat) -> (CGSize, (CGSize, ContainedViewLayoutTransition) -> Void) { + let sideInset: CGFloat = 14.0 + let verticalInset: CGFloat = 12.0 + + let iconSize: CGSize = self.iconNode.image?.size ?? CGSize(width: 10.0, height: 10.0) + + let rightTextInset: CGFloat = sideInset + 36.0 + + let calculatedWidth = min(constrainedWidth, 260.0) + + let textFont = Font.regular(self.presentationData.listsFontSize.baseDisplaySize) + + if let currentStats = self.currentStats { + if currentStats.peers.isEmpty { + //TODO:localize + self.textNode.attributedText = NSAttributedString(string: "No Views", font: textFont, textColor: self.presentationData.theme.contextMenu.secondaryColor) + } else if currentStats.peers.count == 1 { + self.textNode.attributedText = NSAttributedString(string: currentStats.peers[0].displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder), font: textFont, textColor: self.presentationData.theme.contextMenu.primaryColor) + } else { + self.textNode.attributedText = NSAttributedString(string: self.presentationData.strings.Conversation_ContextMenuSeen(Int32(currentStats.peers.count)), font: textFont, textColor: self.presentationData.theme.contextMenu.primaryColor) + } + } else { + self.textNode.attributedText = NSAttributedString(string: " ", font: textFont, textColor: self.presentationData.theme.contextMenu.primaryColor) + } + + let textSize = self.textNode.updateLayout(CGSize(width: calculatedWidth - sideInset - rightTextInset - iconSize.width - 4.0, height: .greatestFiniteMagnitude)) + + let combinedTextHeight = textSize.height + return (CGSize(width: calculatedWidth, height: verticalInset * 2.0 + combinedTextHeight), { size, transition in + self.validLayout = (calculatedWidth: calculatedWidth, size: size) + let verticalOrigin = floor((size.height - combinedTextHeight) / 2.0) + let textFrame = CGRect(origin: CGPoint(x: sideInset + iconSize.width + 4.0, y: verticalOrigin), size: textSize) + transition.updateFrameAdditive(node: self.textNode, frame: textFrame) + transition.updateAlpha(node: self.textNode, alpha: self.currentStats == nil ? 0.0 : 1.0) + + let shimmerHeight: CGFloat = 8.0 + + self.shimmerNode.frame = CGRect(origin: CGPoint(x: textFrame.minX, y: floor((size.height - shimmerHeight) / 2.0)), size: CGSize(width: min(100.0, size.width - 40.0), height: shimmerHeight)) + self.shimmerNode.cornerRadius = shimmerHeight / 2.0 + let shimmeringForegroundColor = self.presentationData.theme.contextMenu.itemSeparatorColor.blitOver(self.presentationData.theme.list.plainBackgroundColor, alpha: 0.9) + let shimmeringColor = self.presentationData.theme.list.itemBlocksBackgroundColor.withAlphaComponent(0.2) + self.shimmerNode.update(backgroundColor: self.presentationData.theme.list.plainBackgroundColor, foregroundColor: shimmeringForegroundColor, shimmeringColor: shimmeringColor, shapes: [.rect(rect: self.shimmerNode.bounds)], horizontal: true, size: self.shimmerNode.bounds.size) + self.shimmerNode.updateAbsoluteRect(self.shimmerNode.frame, within: size) + transition.updateAlpha(node: self.shimmerNode, alpha: self.currentStats == nil ? 1.0 : 0.0) + + if !iconSize.width.isZero { + transition.updateFrameAdditive(node: self.iconNode, frame: CGRect(origin: CGPoint(x: sideInset - 2.0, y: floor((size.height - iconSize.height) / 2.0)), size: iconSize)) + } + + let avatarsContent: AnimatedAvatarSetContext.Content + let placeholderAvatarsContent: AnimatedAvatarSetContext.Content + + var avatarsPeers: [EnginePeer] = [] + if let peers = self.currentStats?.peers { + for i in 0 ..< min(3, peers.count) { + avatarsPeers.append(peers[i]) + } + } + avatarsContent = self.avatarsContext.update(peers: avatarsPeers, animated: false) + placeholderAvatarsContent = self.avatarsContext.updatePlaceholder(color: shimmeringForegroundColor, count: 3, animated: false) + + let avatarsSize = self.avatarsNode.update(context: self.item.context, content: avatarsContent, itemSize: CGSize(width: 24.0, height: 24.0), customSpacing: 10.0, animated: false, synchronousLoad: true) + self.avatarsNode.frame = CGRect(origin: CGPoint(x: size.width - sideInset - 8.0 - avatarsSize.width, y: floor((size.height - avatarsSize.height) / 2.0)), size: avatarsSize) + transition.updateAlpha(node: self.avatarsNode, alpha: self.currentStats == nil ? 0.0 : 1.0) + + let placeholderAvatarsSize = self.placeholderAvatarsNode.update(context: self.item.context, content: placeholderAvatarsContent, itemSize: CGSize(width: 24.0, height: 24.0), customSpacing: 10.0, animated: false, synchronousLoad: true) + self.placeholderAvatarsNode.frame = CGRect(origin: CGPoint(x: size.width - sideInset - 8.0 - placeholderAvatarsSize.width, y: floor((size.height - placeholderAvatarsSize.height) / 2.0)), size: placeholderAvatarsSize) + transition.updateAlpha(node: self.placeholderAvatarsNode, alpha: self.currentStats == nil ? 1.0 : 0.0) + + transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: size.height))) + transition.updateFrame(node: self.highlightedBackgroundNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: size.height))) + transition.updateFrame(node: self.buttonNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: size.width, height: size.height))) + }) + } + + func updateTheme(presentationData: PresentationData) { + self.presentationData = presentationData + + self.backgroundNode.backgroundColor = presentationData.theme.contextMenu.itemBackgroundColor + self.highlightedBackgroundNode.backgroundColor = presentationData.theme.contextMenu.itemHighlightedBackgroundColor + + let textFont = Font.regular(presentationData.listsFontSize.baseDisplaySize) + + self.textNode.attributedText = NSAttributedString(string: self.textNode.attributedText?.string ?? "", font: textFont, textColor: presentationData.theme.contextMenu.primaryColor) + } + + @objc private func buttonPressed() { + self.performAction() + } + + func performAction() { + guard let controller = self.getController(), let currentStats = self.currentStats else { + return + } + self.item.action(controller, { [weak self] result in + self?.actionSelected(result) + }, currentStats) + } + + var isActionEnabled: Bool { + guard let currentStats = self.currentStats else { + return false + } + return !currentStats.peers.isEmpty + } + + func setIsHighlighted(_ value: Bool) { + if value { + self.highlightedBackgroundNode.alpha = 1.0 + } else { + self.highlightedBackgroundNode.alpha = 0.0 + } + } +} + private func stringForRemainingTime(_ duration: Int32, strings: PresentationStrings) -> String { let days = duration / (3600 * 24) let hours = duration / 3600 diff --git a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift index ff1afcb8a4..84e05988ae 100644 --- a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift @@ -1167,7 +1167,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode ignoreForward = true effectiveAuthor = forwardInfo.author if effectiveAuthor == nil, let authorSignature = forwardInfo.authorSignature { - effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(Int32(clamping: authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) + effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) } } displayAuthorInfo = !mergedTop.merged && incoming && effectiveAuthor != nil @@ -1183,7 +1183,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode displayAuthorInfo = !mergedTop.merged && incoming } else if let forwardInfo = item.content.firstMessage.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature { ignoreForward = true - effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(Int32(clamping: authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) + effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) displayAuthorInfo = !mergedTop.merged && incoming } else if let _ = item.content.firstMessage.adAttribute, let author = item.content.firstMessage.author { ignoreForward = true @@ -1572,12 +1572,12 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode if initialDisplayHeader && displayAuthorInfo { if let peer = firstMessage.peers[firstMessage.id.peerId] as? TelegramChannel, case .broadcast = peer.info, item.content.firstMessage.adAttribute == nil { authorNameString = peer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) - authorNameColor = chatMessagePeerIdColors[Int(peer.id.id._internalGetInt32Value() % 7)] + authorNameColor = chatMessagePeerIdColors[Int(clamping: peer.id.id._internalGetInt64Value() % 7)] } else if let effectiveAuthor = effectiveAuthor { authorNameString = effectiveAuthor.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) if incoming { - authorNameColor = chatMessagePeerIdColors[Int(effectiveAuthor.id.id._internalGetInt32Value() % 7)] + authorNameColor = chatMessagePeerIdColors[Int(clamping: effectiveAuthor.id.id._internalGetInt64Value() % 7)] } else { authorNameColor = item.presentationData.theme.theme.chat.message.outgoing.accentTextColor } diff --git a/submodules/TelegramUI/Sources/ChatMessageItem.swift b/submodules/TelegramUI/Sources/ChatMessageItem.swift index d4db0237a4..02c67b230a 100644 --- a/submodules/TelegramUI/Sources/ChatMessageItem.swift +++ b/submodules/TelegramUI/Sources/ChatMessageItem.swift @@ -305,7 +305,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { if let forwardInfo = content.firstMessage.forwardInfo { effectiveAuthor = forwardInfo.author if effectiveAuthor == nil, let authorSignature = forwardInfo.authorSignature { - effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(Int32(clamping: authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) + effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) } } displayAuthorInfo = incoming && effectiveAuthor != nil diff --git a/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift b/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift index 3b92d64542..7155a6e7cc 100644 --- a/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift +++ b/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift @@ -281,7 +281,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable { case .header: var peers = SimpleDictionary() var author: Peer? - if self.entry.event.peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(136817688)) { + if self.entry.event.peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(136817688)) { author = message?.effectiveAuthor } else if let peer = self.entry.peers[self.entry.event.peerId] { author = peer diff --git a/submodules/TelegramUI/Sources/CreateChannelController.swift b/submodules/TelegramUI/Sources/CreateChannelController.swift index 78f87fadb4..9e907e7507 100644 --- a/submodules/TelegramUI/Sources/CreateChannelController.swift +++ b/submodules/TelegramUI/Sources/CreateChannelController.swift @@ -196,7 +196,7 @@ private func CreateChannelEntries(presentationData: PresentationData, state: Cre let groupInfoState = ItemListAvatarAndNameInfoItemState(editingName: state.editingName, updatingName: nil) - let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) entries.append(.channelInfo(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer, groupInfoState, state.avatar)) diff --git a/submodules/TelegramUI/Sources/CreateGroupController.swift b/submodules/TelegramUI/Sources/CreateGroupController.swift index b3f79558bd..0df811dd31 100644 --- a/submodules/TelegramUI/Sources/CreateGroupController.swift +++ b/submodules/TelegramUI/Sources/CreateGroupController.swift @@ -297,7 +297,7 @@ private func createGroupEntries(presentationData: PresentationData, state: Creat let groupInfoState = ItemListAvatarAndNameInfoItemState(editingName: state.editingName, updatingName: nil) - let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) entries.append(.groupInfo(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer, groupInfoState, state.avatar)) diff --git a/submodules/TelegramUI/Sources/OpenUrl.swift b/submodules/TelegramUI/Sources/OpenUrl.swift index 9f3775d5f6..5114643757 100644 --- a/submodules/TelegramUI/Sources/OpenUrl.swift +++ b/submodules/TelegramUI/Sources/OpenUrl.swift @@ -41,7 +41,7 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? { if url.host == "passport" || url.host == "resolve" { if let components = URLComponents(string: "/?" + query) { var domain: String? - var botId: Int32? + var botId: Int64? var scope: String? var publicKey: String? var callbackUrl: String? @@ -53,7 +53,7 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? { if queryItem.name == "domain" { domain = value } else if queryItem.name == "bot_id" { - botId = Int32(value) + botId = Int64(value) } else if queryItem.name == "scope" { scope = value } else if queryItem.name == "public_key" { @@ -95,7 +95,7 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? { return nil } - return ParsedSecureIdUrl(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce) + return ParsedSecureIdUrl(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce) } } } @@ -394,7 +394,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur } else if parsedUrl.host == "passport" || parsedUrl.host == "resolve" { if let components = URLComponents(string: "/?" + query) { var domain: String? - var botId: Int32? + var botId: Int64? var scope: String? var publicKey: String? var callbackUrl: String? @@ -406,7 +406,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur if queryItem.name == "domain" { domain = value } else if queryItem.name == "bot_id" { - botId = Int32(value) + botId = Int64(value) } else if queryItem.name == "scope" { scope = value } else if queryItem.name == "public_key" { @@ -450,7 +450,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur if case .chat = urlContext { return } - let controller = SecureIdAuthController(context: context, mode: .form(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce)) + let controller = SecureIdAuthController(context: context, mode: .form(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce)) if let navigationController = navigationController { context.sharedContext.applicationBindings.dismissNativeController() @@ -475,9 +475,9 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur } } - if let id = id, !id.isEmpty, let idValue = Int32(id), idValue > 0 { + if let id = id, !id.isEmpty, let idValue = Int64(id), idValue > 0 { let _ = (context.account.postbox.transaction { transaction -> Peer? in - return transaction.getPeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(idValue))) + return transaction.getPeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(idValue))) } |> deliverOnMainQueue).start(next: { peer in if let peer = peer, let controller = context.sharedContext.makePeerInfoController(context: context, updatedPresentationData: nil, peer: peer, mode: .generic, avatarInitiallyExpanded: false, fromChat: false) { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift index f4d788d26a..758a112568 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift @@ -414,7 +414,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode { representations = topRepresentations videoRepresentations = videoRepresentationsValue immediateThumbnailData = immediateThumbnail - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } @@ -425,7 +425,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode { if case let .cloud(imageId, _, _) = reference { id = imageId } else { - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() } } @@ -709,7 +709,7 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode { representations = topRepresentations videoRepresentations = videoRepresentationsValue immediateThumbnailData = immediateThumbnail - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } @@ -720,7 +720,7 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode { if case let .cloud(imageId, _, _) = reference { id = imageId } else { - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() } } diff --git a/submodules/TelegramUI/Sources/PollResultsController.swift b/submodules/TelegramUI/Sources/PollResultsController.swift index e669d85ee7..a6e213ab76 100644 --- a/submodules/TelegramUI/Sources/PollResultsController.swift +++ b/submodules/TelegramUI/Sources/PollResultsController.swift @@ -251,7 +251,7 @@ private func pollResultsControllerEntries(presentationData: PresentationData, po displayCount = Int(voterCount) } for peerIndex in 0 ..< displayCount { - let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let peer = RenderedPeer(peer: fakeUser) entries.append(.optionPeer(optionId: i, index: peerIndex, peer: peer, optionText: optionTextHeader, optionAdditionalText: optionAdditionalTextHeader, optionCount: voterCount, optionExpanded: false, opaqueIdentifier: option.opaqueIdentifier, shimmeringAlternation: peerIndex % 2, isFirstInOption: peerIndex == 0)) } diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index a58ea0267c..46928694bf 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -563,7 +563,8 @@ public final class SharedAccountContextImpl: SharedAccountContext { } if self.activeAccountsValue!.primary == nil && self.activeAccountsValue!.currentAuth == nil { - self.beginNewAuth(testingEnvironment: false) + //TODO:change to production after merging + self.beginNewAuth(testingEnvironment: true) } })) }) diff --git a/submodules/TelegramUI/Sources/SharedNotificationManager.swift b/submodules/TelegramUI/Sources/SharedNotificationManager.swift index a6c89c34d7..51118a6d08 100644 --- a/submodules/TelegramUI/Sources/SharedNotificationManager.swift +++ b/submodules/TelegramUI/Sources/SharedNotificationManager.swift @@ -249,13 +249,13 @@ public final class SharedNotificationManager { var peerId: PeerId? if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let peerId = peerId { if let messageIds = payload["messages"] as? String { @@ -313,13 +313,13 @@ public final class SharedNotificationManager { if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let msgId = payload["msg_id"] { @@ -330,8 +330,8 @@ public final class SharedNotificationManager { } else if let randomId = payload["random_id"] { let randomIdValue = randomId as! NSString var peerId: PeerId? - if let encryptionIdString = payload["encryption_id"] as? String, let encryptionId = Int32(encryptionIdString) { - peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(encryptionId)) + if let encryptionIdString = payload["encryption_id"] as? String, let encryptionId = Int64(encryptionIdString) { + peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(encryptionId)) } notificationRequestId = .globallyUniqueId(randomIdValue.longLongValue, peerId) } else { @@ -343,13 +343,13 @@ public final class SharedNotificationManager { if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let peerId = peerId { diff --git a/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift b/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift index 6c36304629..fa7a55fe50 100644 --- a/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift +++ b/submodules/TelegramUIPreferences/Sources/PresentationThemeSettings.swift @@ -210,7 +210,7 @@ public enum PresentationThemeReference: PostboxCoding, Equatable { let high = UInt32((UInt64(bitPattern: id) >> 32) & (0xffffffff as UInt64)) acc = (acc &* 20261) &+ high acc = (acc &* 20261) &+ low - + return Int32(bitPattern: acc & UInt32(0x7fffffff)) } diff --git a/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift b/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift index d2054d3fb5..55766dd473 100644 --- a/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift +++ b/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift @@ -205,7 +205,7 @@ private final class ChannelMemberSingleCategoryListContext: ChannelMemberCategor } } - private func loadSignal(offset: Int32, count: Int32, hash: Int32) -> Signal<[RenderedChannelParticipant]?, NoError> { + private func loadSignal(offset: Int32, count: Int32, hash: Int64) -> Signal<[RenderedChannelParticipant]?, NoError> { let requestCategory: ChannelMembersCategory var adminQuery: String? = nil switch self.category { @@ -312,14 +312,14 @@ private final class ChannelMemberSingleCategoryListContext: ChannelMemberCategor return } - var hash: UInt32 = 0 + var acc: UInt64 = 0 for i in 0 ..< min(strongSelf.listStateValue.list.count, Int(initialBatchSize)) { let peerId = strongSelf.listStateValue.list[i].peer.id - hash = (hash &* 20261) &+ UInt32(bitPattern: peerId.id._internalGetInt32Value()) + combineInt64Hash(&acc, with: peerId) } - hash = hash % 0x7FFFFFFF - strongSelf.headUpdateDisposable.set((strongSelf.loadSignal(offset: 0, count: initialBatchSize, hash: Int32(bitPattern: hash)) + let hashResult = finalizeInt64Hash(acc) + strongSelf.headUpdateDisposable.set((strongSelf.loadSignal(offset: 0, count: initialBatchSize, hash: hashResult) |> deliverOnMainQueue).start(next: { members in self?.updateHeadMembers(members) })) diff --git a/submodules/TgVoipWebrtc/tgcalls b/submodules/TgVoipWebrtc/tgcalls index d32407171f..aaede253be 160000 --- a/submodules/TgVoipWebrtc/tgcalls +++ b/submodules/TgVoipWebrtc/tgcalls @@ -1 +1 @@ -Subproject commit d32407171f21ee8055a9621cf67238a8996eaaa4 +Subproject commit aaede253be4dbfdfcb2258cdb6faa843785192e6 diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index fe9b8aefdf..bed77ec35c 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -144,8 +144,8 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } } } - } else if pathComponents[0].hasPrefix(phonebookUsernamePathPrefix), let idValue = Int32(String(pathComponents[0][pathComponents[0].index(pathComponents[0].startIndex, offsetBy: phonebookUsernamePathPrefix.count)...])) { - return .peerId(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(idValue))) + } else if pathComponents[0].hasPrefix(phonebookUsernamePathPrefix), let idValue = Int64(String(pathComponents[0][pathComponents[0].index(pathComponents[0].startIndex, offsetBy: phonebookUsernamePathPrefix.count)...])) { + return .peerId(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(idValue))) } else if pathComponents[0].hasPrefix("+") || pathComponents[0].hasPrefix("%20") { return .join(String(pathComponents[0].dropFirst())) } @@ -278,7 +278,7 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } else if pathComponents[0] == "addtheme" { return .theme(pathComponents[1]) } else if pathComponents.count == 3 && pathComponents[0] == "c" { - if let channelId = Int32(pathComponents[1]), let messageId = Int32(pathComponents[2]) { + if let channelId = Int64(pathComponents[1]), let messageId = Int32(pathComponents[2]) { var threadId: Int32? var timecode: Double? if let queryItems = components.queryItems { @@ -296,7 +296,7 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } } } - return .privateMessage(messageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: messageId), threadId: threadId, timecode: timecode) + return .privateMessage(messageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: messageId), threadId: threadId, timecode: timecode) } else { return nil } @@ -406,7 +406,7 @@ private func resolveInternalUrl(context: AccountContext, url: ParsedInternalUrl) if let peer = peer { foundPeer = .single(peer) } else { - foundPeer = TelegramEngine(account: context.account).peers.findChannelById(channelId: messageId.peerId.id._internalGetInt32Value()) + foundPeer = TelegramEngine(account: context.account).peers.findChannelById(channelId: messageId.peerId.id._internalGetInt64Value()) } return foundPeer |> mapToSignal { foundPeer -> Signal in diff --git a/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h b/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h index af60186ca5..d28a8b0320 100644 --- a/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h +++ b/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h @@ -15,7 +15,7 @@ - (SSignal * _Nonnull)watchAppInstalledSignal; - (SSignal * _Nonnull)runningRequestsSignal; -- (void)setAuthorized:(bool)authorized userId:(int32_t)userId; +- (void)setAuthorized:(bool)authorized userId:(int64_t)userId; - (void)setMicAccessAllowed:(bool)allowed; - (void)setStartupData:(NSDictionary * _Nullable)data; - (void)pushContext; diff --git a/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m b/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m index 6bbf49c4de..7cca68f376 100644 --- a/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m +++ b/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m @@ -135,7 +135,7 @@ #pragma mark - -- (void)setAuthorized:(bool)authorized userId:(int32_t)userId +- (void)setAuthorized:(bool)authorized userId:(int64_t)userId { _activeContext = [_activeContext updatedWithAuthorized:authorized peerId:userId]; } diff --git a/submodules/WatchBridge/Sources/WatchBridge.swift b/submodules/WatchBridge/Sources/WatchBridge.swift index 18a6502fbc..9b914000cc 100644 --- a/submodules/WatchBridge/Sources/WatchBridge.swift +++ b/submodules/WatchBridge/Sources/WatchBridge.swift @@ -8,11 +8,11 @@ import PhoneNumberFormat func makePeerIdFromBridgeIdentifier(_ identifier: Int64) -> PeerId? { if identifier < 0 && identifier > Int32.min { - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(clamping: -identifier))) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(-identifier)) } else if identifier < Int64(Int32.min) * 2 && identifier > Int64(Int32.min) * 3 { - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(clamping: Int64(Int32.min) &* 2 &- identifier))) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(Int32.min) &* 2 &- identifier)) } else if identifier > 0 && identifier < Int32.max { - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(clamping: identifier))) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(identifier)) } else { return nil } @@ -21,11 +21,11 @@ func makePeerIdFromBridgeIdentifier(_ identifier: Int64) -> PeerId? { func makeBridgeIdentifier(_ peerId: PeerId) -> Int64 { switch peerId.namespace { case Namespaces.Peer.CloudGroup: - return -Int64(peerId.id._internalGetInt32Value()) + return -Int64(peerId.id._internalGetInt64Value()) case Namespaces.Peer.CloudChannel: - return Int64(Int32.min) * 2 - Int64(peerId.id._internalGetInt32Value()) + return Int64(Int32.min) * 2 - Int64(peerId.id._internalGetInt64Value()) default: - return Int64(peerId.id._internalGetInt32Value()) + return Int64(peerId.id._internalGetInt64Value()) } } diff --git a/submodules/WatchBridge/Sources/WatchCommunicationManager.swift b/submodules/WatchBridge/Sources/WatchCommunicationManager.swift index 8739700b5b..fdc6f30dfa 100644 --- a/submodules/WatchBridge/Sources/WatchCommunicationManager.swift +++ b/submodules/WatchBridge/Sources/WatchCommunicationManager.swift @@ -88,7 +88,7 @@ public final class WatchCommunicationManager { } if let context = appContext { strongSelf.accountContext.set(.single(context.context)) - strongSelf.server.setAuthorized(true, userId: context.context.account.peerId.id._internalGetInt32Value()) + strongSelf.server.setAuthorized(true, userId: context.context.account.peerId.id._internalGetInt64Value()) strongSelf.server.setMicAccessAllowed(false) strongSelf.server.pushContext() strongSelf.server.setMicAccessAllowed(true)