Merge branch 'master' into postbox-refactoring-1

This commit is contained in:
Ali 2021-09-03 12:49:58 +04:00
commit f0f02dc4b9
224 changed files with 2988 additions and 2385 deletions

View File

@ -16,4 +16,4 @@ build --strategy=Genrule=standalone
build --spawn_strategy=standalone build --spawn_strategy=standalone
build --strategy=SwiftCompile=standalone build --strategy=SwiftCompile=standalone
build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1 build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1

View File

@ -3,7 +3,7 @@
@implementation Serialization @implementation Serialization
- (NSUInteger)currentLayer { - (NSUInteger)currentLayer {
return 132; return 133;
} }
- (id _Nullable)parseMessage:(NSData * _Nullable)data { - (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]; return [NSData data];
} }

View File

@ -33,8 +33,8 @@ private func parseAppSpecificContactReference(_ value: String) -> PeerId? {
return nil return nil
} }
let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...]) let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...])
if let id = Int32(idString) { if let id = Int64(idString) {
return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))
} }
return nil return nil
} }

View File

@ -165,7 +165,7 @@ private func callWithTelegramMessage(_ telegramMessage: Message, account: Accoun
@available(iOSApplicationExtension 10.0, iOS 10.0, *) @available(iOSApplicationExtension 10.0, iOS 10.0, *)
private func messageWithTelegramMessage(_ telegramMessage: Message) -> INMessage? { 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 return nil
} }

View File

@ -3,7 +3,7 @@
@interface TGBridgeContext : NSObject @interface TGBridgeContext : NSObject
@property (nonatomic, readonly) bool authorized; @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) bool micAccessAllowed;
@property (nonatomic, readonly) NSDictionary *preheatData; @property (nonatomic, readonly) NSDictionary *preheatData;
@property (nonatomic, readonly) NSInteger preheatVersion; @property (nonatomic, readonly) NSInteger preheatVersion;

View File

@ -40,7 +40,7 @@ NSString *const TGBridgeContextStartupDataVersion = @"version";
return dictionary; return dictionary;
} }
- (TGBridgeContext *)updatedWithAuthorized:(bool)authorized peerId:(int32_t)peerId - (TGBridgeContext *)updatedWithAuthorized:(bool)authorized peerId:(int64_t)peerId
{ {
TGBridgeContext *context = [[TGBridgeContext alloc] init]; TGBridgeContext *context = [[TGBridgeContext alloc] init];
context->_authorized = authorized; context->_authorized = authorized;

View File

@ -501,7 +501,7 @@ public enum ChatListSearchFilter: Equatable {
case peer(PeerId, Bool, String, String) case peer(PeerId, Bool, String, String)
case date(Int32?, Int32, String) case date(Int32?, Int32, String)
public var id: Int32 { public var id: Int64 {
switch self { switch self {
case .chats: case .chats:
return 0 return 0
@ -516,9 +516,9 @@ public enum ChatListSearchFilter: Equatable {
case .voice: case .voice:
return 5 return 5
case let .peer(peerId, _, _, _): case let .peer(peerId, _, _, _):
return peerId.id._internalGetInt32Value() return peerId.id._internalGetInt64Value()
case let .date(_, date, _): case let .date(_, date, _):
return date return Int64(date)
} }
} }
} }

View File

@ -200,8 +200,8 @@ public func parseAppSpecificContactReference(_ value: String) -> PeerId? {
return nil return nil
} }
let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...]) let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...])
if let id = Int32(idString) { if let id = Int64(idString) {
return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))
} }
return nil return nil
} }

View File

@ -6,6 +6,7 @@ import SwiftSignalKit
import Display import Display
import AsyncDisplayKit import AsyncDisplayKit
import UniversalMediaPlayer import UniversalMediaPlayer
import TelegramPresentationData
public enum ChatControllerInteractionOpenMessageMode { public enum ChatControllerInteractionOpenMessageMode {
case `default` case `default`
@ -18,6 +19,7 @@ public enum ChatControllerInteractionOpenMessageMode {
public final class OpenChatMessageParams { public final class OpenChatMessageParams {
public let context: AccountContext public let context: AccountContext
public let updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?
public let chatLocation: ChatLocation? public let chatLocation: ChatLocation?
public let chatLocationContextHolder: Atomic<ChatLocationContextHolder?>? public let chatLocationContextHolder: Atomic<ChatLocationContextHolder?>?
public let message: Message public let message: Message
@ -44,6 +46,7 @@ public final class OpenChatMessageParams {
public init( public init(
context: AccountContext, context: AccountContext,
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
chatLocation: ChatLocation?, chatLocation: ChatLocation?,
chatLocationContextHolder: Atomic<ChatLocationContextHolder?>?, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>?,
message: Message, message: Message,
@ -69,6 +72,7 @@ public final class OpenChatMessageParams {
centralItemUpdated: ((MessageId) -> Void)? = nil centralItemUpdated: ((MessageId) -> Void)? = nil
) { ) {
self.context = context self.context = context
self.updatedPresentationData = updatedPresentationData
self.chatLocation = chatLocation self.chatLocation = chatLocation
self.chatLocationContextHolder = chatLocationContextHolder self.chatLocationContextHolder = chatLocationContextHolder
self.message = message self.message = message

View File

@ -454,7 +454,7 @@ public final class AvatarNode: ASDisplayNode {
if peerId.namespace == .max { if peerId.namespace == .max {
colorIndex = -1 colorIndex = -1
} else { } else {
colorIndex = abs(Int(clamping: peerId.id._internalGetInt32Value())) colorIndex = abs(Int(clamping: peerId.id._internalGetInt64Value()))
} }
} else { } else {
colorIndex = -1 colorIndex = -1
@ -633,7 +633,7 @@ public func drawPeerAvatarLetters(context: CGContext, size: CGSize, round: Bool
if peerId.namespace == .max { if peerId.namespace == .max {
colorIndex = -1 colorIndex = -1
} else { } else {
colorIndex = Int(abs(peerId.id._internalGetInt32Value())) colorIndex = Int(clamping: abs(peerId.id._internalGetInt64Value()))
} }
let colorsArray: NSArray let colorsArray: NSArray

View File

@ -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 let (group, _) = groupAndIndex {
if archiveEnabled { if archiveEnabled {
let isArchived = group == Namespaces.PeerGroup.archive let isArchived = group == Namespaces.PeerGroup.archive

View File

@ -927,7 +927,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
} }
if archiveEnabled { if archiveEnabled {
for peerId in peerIds { 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 archiveEnabled = false
break break
} else if peerId == strongSelf.context.account.peerId { } else if peerId == strongSelf.context.account.peerId {

View File

@ -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 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 timestamp1: Int32 = 100000
let peers = SimpleDictionary<PeerId, Peer>() let peers = SimpleDictionary<PeerId, Peer>()
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, togglePeersSelection: { _, _ in }, additionalCategorySelected: { _ in let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, togglePeersSelection: { _, _ in }, additionalCategorySelected: { _ in

View File

@ -150,7 +150,7 @@ private final class ItemNode: ASDisplayNode {
} }
enum ChatListSearchFilterEntryId: Hashable { enum ChatListSearchFilterEntryId: Hashable {
case filter(Int32) case filter(Int64)
} }
enum ChatListSearchFilterEntry: Equatable { enum ChatListSearchFilterEntry: Equatable {

View File

@ -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 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 timestamp1: Int32 = 100000
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
peers[peer1.id] = peer1 peers[peer1.id] = peer1

View File

@ -196,7 +196,7 @@ private enum RevealOptionKey: Int32 {
} }
private func canArchivePeer(id: PeerId, accountPeerId: PeerId) -> Bool { 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 return false
} }
if id == accountPeerId { if id == accountPeerId {

View File

@ -101,7 +101,7 @@ class ChatChoosingStickerActivityContentNode: ChatTitleActivityContentNode {
self.indicatorNode = ChatChoosingStickerActivityIndicatorNode(color: color) self.indicatorNode = ChatChoosingStickerActivityIndicatorNode(color: color)
var text = text var text = text
self.advanced = text.string == "choosing sticker" self.advanced = text.string == "choosing a sticker"
if self.advanced { if self.advanced {
let mutable = text.mutableCopy() as? NSMutableAttributedString let mutable = text.mutableCopy() as? NSMutableAttributedString
mutable?.replaceCharacters(in: NSMakeRange(2, 2), with: " ") mutable?.replaceCharacters(in: NSMakeRange(2, 2), with: " ")

View File

@ -57,7 +57,7 @@ private enum InviteContactsEntry: Comparable, Identifiable {
} else { } else {
status = .none 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 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) interaction.toggleContact(id)
}) })

View File

@ -136,7 +136,7 @@ public extension String {
continue continue
} }
string.unicodeScalars.append(scalar) string.unicodeScalars.append(scalar)
if scalar.value == 0x2764, self.unicodeScalars.count > 1, self.emojis.count == 1 { if scalar.value == 0x2764 && self.unicodeScalars.count < 3 {
break break
} }
} }

View File

@ -1276,7 +1276,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
}, openUrl: { _ in }, openPeer: { _ in }, openUrl: { _ in }, openPeer: { _ in
}, showAll: false) }, 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 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) let controller = LocationViewController(context: self.context, subject: message, params: controllerParams)

View File

@ -597,7 +597,7 @@ public final class InviteLinkViewController: ViewController {
if state.importers.isEmpty && state.isLoadingMore { if state.importers.isEmpty && state.isLoadingMore {
count = min(4, state.count) count = min(4, state.count)
loading = true 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 { for i in 0 ..< count {
entries.append(.importer(Int32(i), presentationData.theme, presentationData.dateTimeFormat, fakeUser, 0, true)) entries.append(.importer(Int32(i), presentationData.theme, presentationData.dateTimeFormat, fakeUser, 0, true))
} }

View File

@ -110,7 +110,7 @@ extern NSString *TGMentionBoldAttributeName;
- (NSString *)textWithEntities:(__autoreleasing NSArray<TGMessageEntity *> **)entities; - (NSString *)textWithEntities:(__autoreleasing NSArray<TGMessageEntity *> **)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; + (void)replaceHashtag:(NSString *)hashtag inputField:(HPGrowingTextView *)inputField;
@end @end

View File

@ -9,7 +9,7 @@
- (void)setTitleNeedsDisplay; - (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)loadGroupPlaceholderWithSize:(CGSize)size conversationId:(int64_t)conversationId title:(NSString *)title placeholder:(UIImage *)placeholder;
- (void)loadSavedMessagesWithSize:(CGSize)size placeholder:(UIImage *)placeholder; - (void)loadSavedMessagesWithSize:(CGSize)size placeholder:(UIImage *)placeholder;

View File

@ -55,7 +55,7 @@ typedef enum {
+ (instancetype)mediaOriginInfoForFavoriteStickerWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; + (instancetype)mediaOriginInfoForFavoriteStickerWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences;
+ (instancetype)mediaOriginInfoForRecentGifWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; + (instancetype)mediaOriginInfoForRecentGifWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences;
+ (instancetype)mediaOriginInfoForRecentMaskWithFileReference:(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 url:(NSString *)url;
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences peerId:(int64_t)peerId; + (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences peerId:(int64_t)peerId;
+ (instancetype)mediaOriginInfoWithFileReferences:(NSDictionary *)fileReferences wallpaperId:(int32_t)wallpaperId; + (instancetype)mediaOriginInfoWithFileReferences:(NSDictionary *)fileReferences wallpaperId:(int32_t)wallpaperId;

View File

@ -22,7 +22,7 @@
- (void)setCollapsed:(bool)collapsed animated:(bool)animated; - (void)setCollapsed:(bool)collapsed animated:(bool)animated;
- (void)replaceMention:(NSString *)mention; - (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)replaceHashtag:(NSString *)hashtag;
- (void)adjustForOrientation:(UIInterfaceOrientation)orientation keyboardHeight:(CGFloat)keyboardHeight duration:(NSTimeInterval)duration animationCurve:(NSInteger)animationCurve; - (void)adjustForOrientation:(UIInterfaceOrientation)orientation keyboardHeight:(CGFloat)keyboardHeight duration:(NSTimeInterval)duration animationCurve:(NSInteger)animationCurve;

View File

@ -66,7 +66,7 @@ typedef enum {
@interface TGUser : NSObject <PSCoding> @interface TGUser : NSObject <PSCoding>
@property (nonatomic) int uid; @property (nonatomic) int64_t uid;
@property (nonatomic, strong) NSString *phoneNumber; @property (nonatomic, strong) NSString *phoneNumber;
@property (nonatomic) int64_t phoneNumberHash; @property (nonatomic) int64_t phoneNumberHash;
@property (nonatomic, strong) NSString *firstName; @property (nonatomic, strong) NSString *firstName;

View File

@ -805,7 +805,7 @@ NSString *TGMentionBoldAttributeName = @"TGMentionBoldAttributeName";
return string.string; 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:@" "]; NSString *replacementText = [mention stringByAppendingString:@" "];

View File

@ -158,7 +158,7 @@ static bool isEmojiCharacter(NSString *singleChar)
_label.hidden = true; _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; _label.font = _doubleFont;
_usingSingleFont = false; _usingSingleFont = false;

View File

@ -275,7 +275,7 @@
return info; 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]; TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init];
info->_type = TGMediaOriginTypeProfilePhoto; info->_type = TGMediaOriginTypeProfilePhoto;

View File

@ -815,7 +815,7 @@ static void setViewFrame(UIView *view, CGRect frame)
[HPGrowingTextView replaceMention:mention inputField:_inputField username:true userId:0]; [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]; [HPGrowingTextView replaceMention:mention inputField:_inputField username:username userId:userId];
} }

View File

@ -18,7 +18,7 @@ public func legacySuggestionContext(context: AccountContext, peerId: PeerId, cha
for peer in peers { for peer in peers {
if case let .user(peer) = peer { if case let .user(peer) = peer {
let user = TGUser() let user = TGUser()
user.uid = peer.id.id._internalGetInt32Value() user.uid = peer.id.id._internalGetInt64Value()
user.firstName = peer.firstName user.firstName = peer.firstName
user.lastName = peer.lastName user.lastName = peer.lastName
user.userName = peer.addressName user.userName = peer.addressName

View File

@ -62,10 +62,10 @@ final class LegacyPeerAvatarPlaceholderDataSource: TGImageDataSource {
var peerId = PeerId(0) var peerId = PeerId(0)
if let uid = args["uid"] as? String, let nUid = Int32(uid) { if let uid = args["uid"] as? String, let nUid = Int64(uid) {
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(nUid)) peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(nUid))
} else if let cid = args["cid"] as? String, let nCid = Int32(cid) { } else if let cid = args["cid"] as? String, let nCid = Int64(cid) {
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(nCid)) 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 let image = generateImage(CGSize(width: CGFloat(width), height: CGFloat(height)), rotatedContext: { size, context in
@ -76,10 +76,10 @@ final class LegacyPeerAvatarPlaceholderDataSource: TGImageDataSource {
context.clip() context.clip()
let colorIndex: Int let colorIndex: Int
if peerId.id._internalGetInt32Value() == 0 { if peerId.id._internalGetInt64Value() == 0 {
colorIndex = -1 colorIndex = -1
} else { } 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 let colorsArray: NSArray

View File

@ -70,11 +70,11 @@ public final class LocationPickerController: ViewController {
private var interaction: LocationPickerInteraction? private var interaction: LocationPickerInteraction?
public init(context: AccountContext, mode: LocationPickerMode, completion: @escaping (TelegramMediaMap, String?) -> Void) { public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, mode: LocationPickerMode, completion: @escaping (TelegramMediaMap, String?) -> Void) {
self.context = context self.context = context
self.mode = mode self.mode = mode
self.completion = completion self.completion = completion
self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme).withUpdatedSeparatorColor(.clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings))) super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme).withUpdatedSeparatorColor(.clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings)))
@ -85,7 +85,7 @@ public final class LocationPickerController: ViewController {
self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.searchPressed)) self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.searchPressed))
self.navigationItem.rightBarButtonItem?.accessibilityLabel = self.presentationData.strings.Common_Search self.navigationItem.rightBarButtonItem?.accessibilityLabel = self.presentationData.strings.Common_Search
self.presentationDataDisposable = (context.sharedContext.presentationData self.presentationDataDisposable = ((updatedPresentationData?.signal ?? context.sharedContext.presentationData)
|> deliverOnMainQueue).start(next: { [weak self] presentationData in |> deliverOnMainQueue).start(next: { [weak self] presentationData in
guard let strongSelf = self, strongSelf.presentationData.theme !== presentationData.theme else { guard let strongSelf = self, strongSelf.presentationData.theme !== presentationData.theme else {
return return

View File

@ -85,12 +85,12 @@ public final class LocationViewController: ViewController {
private var rightBarButtonAction: LocationViewRightBarButton = .none private var rightBarButtonAction: LocationViewRightBarButton = .none
public init(context: AccountContext, subject: Message, params: LocationViewParams) { public init(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, subject: Message, params: LocationViewParams) {
self.context = context self.context = context
self.subject = subject self.subject = subject
self.showAll = params.showAll self.showAll = params.showAll
self.presentationData = context.sharedContext.currentPresentationData.with { $0 } self.presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme).withUpdatedSeparatorColor(.clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings))) super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: NavigationBarTheme(rootControllerTheme: self.presentationData.theme).withUpdatedSeparatorColor(.clear), strings: NavigationBarStrings(presentationStrings: self.presentationData.strings)))
@ -99,7 +99,7 @@ public final class LocationViewController: ViewController {
self.title = self.presentationData.strings.Map_LocationTitle self.title = self.presentationData.strings.Map_LocationTitle
self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Close, style: .plain, target: self, action: #selector(self.cancelPressed)) self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Close, style: .plain, target: self, action: #selector(self.cancelPressed))
self.presentationDataDisposable = (context.sharedContext.presentationData self.presentationDataDisposable = ((updatedPresentationData?.signal ?? context.sharedContext.presentationData)
|> deliverOnMainQueue).start(next: { [weak self] presentationData in |> deliverOnMainQueue).start(next: { [weak self] presentationData in
guard let strongSelf = self, strongSelf.presentationData.theme !== presentationData.theme else { guard let strongSelf = self, strongSelf.presentationData.theme !== presentationData.theme else {
return return

View File

@ -293,3 +293,22 @@ public final class CachedAnimatedStickerRepresentation: CachedMediaResourceRepre
} }
} }
} }
public final class CachedPreparedPatternWallpaperRepresentation: CachedMediaResourceRepresentation {
public let keepDuration: CachedMediaRepresentationKeepDuration = .general
public var uniqueId: String {
return "prepared-pattern-wallpaper"
}
public init() {
}
public func isEqual(to: CachedMediaResourceRepresentation) -> Bool {
if to is CachedPreparedPatternWallpaperRepresentation {
return true
} else {
return false
}
}
}

View File

@ -3,8 +3,8 @@
@interface MTExportedAuthorizationData : NSObject @interface MTExportedAuthorizationData : NSObject
@property (nonatomic, strong, readonly) NSData *authorizationBytes; @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 @end

View File

@ -18,7 +18,7 @@ typedef id (^MTRequestNoopParser)(NSData *);
- (id)parseMessage:(NSData *)data; - (id)parseMessage:(NSData *)data;
- (MTExportAuthorizationResponseParser)exportAuthorization:(int32_t)datacenterId data:(__autoreleasing 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; - (MTRequestDatacenterAddressListParser)requestDatacenterAddressWithData:(__autoreleasing NSData **)data;
- (MTRequestNoopParser)requestNoop:(__autoreleasing NSData **)data; - (MTRequestNoopParser)requestNoop:(__autoreleasing NSData **)data;

View File

@ -113,7 +113,7 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) {
} }
- (BOOL)hasAcceptableStatusCode { - (BOOL)hasAcceptableStatusCode {
return !self.acceptableStatusCodes || [self.acceptableStatusCodes containsIndex:[self.response statusCode]]; return !self.acceptableStatusCodes || [self.acceptableStatusCodes containsIndex:(NSUInteger)[self.response statusCode]];
} }
- (BOOL)hasAcceptableContentType { - (BOOL)hasAcceptableContentType {

View File

@ -10,6 +10,8 @@
#import <MtProtoKit/MTMessageTransaction.h> #import <MtProtoKit/MTMessageTransaction.h>
#import <MtProtoKit/MTDatacenterSaltInfo.h> #import <MtProtoKit/MTDatacenterSaltInfo.h>
#import <MtProtoKit/MTSessionInfo.h> #import <MtProtoKit/MTSessionInfo.h>
#import <MtProtoKit/MTRpcError.h>
#import <MtProtoKit/MTLogging.h>
#import "MTInternalMessageParser.h" #import "MTInternalMessageParser.h"
#import "MTRpcResultMessage.h" #import "MTRpcResultMessage.h"
#import "MTBuffer.h" #import "MTBuffer.h"
@ -142,6 +144,14 @@
if (rpcResultMessage.data.length >= 4) { if (rpcResultMessage.data.length >= 4) {
uint32_t signature = 0; uint32_t signature = 0;
[rpcResultMessage.data getBytes:&signature range:NSMakeRange(0, 4)]; [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; //boolTrue#997275b5 = Bool;
if (signature == 0x997275b5U) { if (signature == 0x997275b5U) {

View File

@ -116,7 +116,7 @@
[requestService addRequest:request]; [requestService addRequest:request];
} }
- (void)beginTransferWithId:(int32_t)dataId data:(NSData *)authData - (void)beginTransferWithId:(int64_t)dataId data:(NSData *)authData
{ {
[_sourceDatacenterMtProto stop]; [_sourceDatacenterMtProto stop];
_sourceDatacenterMtProto = nil; _sourceDatacenterMtProto = nil;

View File

@ -2,7 +2,7 @@
@implementation MTExportedAuthorizationData @implementation MTExportedAuthorizationData
- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId - (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int64_t)authorizationId
{ {
self = [super init]; self = [super init];
if (self != nil) if (self != nil)

View File

@ -28,7 +28,7 @@ static FORCE_INLINE uint32_t fmix ( uint32_t h )
return 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 uint8_t * data = (const uint8_t*)key;
const int nblocks = len / 4; const int nblocks = len / 4;

View File

@ -256,7 +256,7 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode {
id = mediaId.id id = mediaId.id
category = categoryValue category = categoryValue
} else { } 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 { if let resource = entry.videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource {
id = id &+ resource.photoId id = id &+ resource.photoId
} }

View File

@ -379,7 +379,7 @@ public final class PeerInfoAvatarListItemNode: ASDisplayNode {
representations = topRepresentations representations = topRepresentations
videoRepresentations = videoRepresentationsValue videoRepresentations = videoRepresentationsValue
immediateThumbnailData = immediateThumbnail immediateThumbnailData = immediateThumbnail
id = Int64(self.peer.id.id._internalGetInt32Value()) id = self.peer.id.id._internalGetInt64Value()
if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource {
id = id &+ resource.photoId id = id &+ resource.photoId
} }
@ -390,7 +390,7 @@ public final class PeerInfoAvatarListItemNode: ASDisplayNode {
if case let .cloud(imageId, _, _) = reference { if case let .cloud(imageId, _, _) = reference {
id = imageId id = imageId
} else { } 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) self.imageNode.setSignal(chatAvatarGalleryPhoto(account: self.context.account, representations: representations, immediateThumbnailData: immediateThumbnailData, autoFetchFullSize: true, attemptSynchronously: synchronous, skipThumbnail: fullSizeOnly), attemptSynchronously: synchronous, dispatchOnDisplayLink: false)

View File

@ -652,7 +652,7 @@ private func deviceContactInfoEntries(account: Account, presentationData: Presen
firstName = presentationData.strings.Message_Contact 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 !selecting {
if let _ = peer { if let _ = peer {

View File

@ -60,7 +60,7 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
return Id(rawValue: 0x000000007fffffff) return Id(rawValue: 0x000000007fffffff)
} }
fileprivate var rawValue: Int32 fileprivate var rawValue: Int64
var predecessor: Id { var predecessor: Id {
if self.rawValue != 0 { if self.rawValue != 0 {
@ -82,17 +82,21 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
return "\(self.rawValue)" return "\(self.rawValue)"
} }
fileprivate init(rawValue: Int32) { fileprivate init(rawValue: Int64) {
//precondition((rawValue | 0x000FFFFFFFFFFFFF) == 0x000FFFFFFFFFFFFF) if rawValue < 0 {
assert(abs(rawValue) == (abs(rawValue) & 0x007fffffffffffff))
} else {
assert(abs(rawValue) == (abs(rawValue) & 0x00ffffffffffffff))
}
self.rawValue = rawValue self.rawValue = rawValue
} }
public static func _internalFromInt32Value(_ value: Int32) -> Id { public static func _internalFromInt64Value(_ value: Int64) -> Id {
return Id(rawValue: value) return Id(rawValue: value)
} }
public func _internalGetInt32Value() -> Int32 { public func _internalGetInt64Value() -> Int64 {
return self.rawValue return self.rawValue
} }
@ -144,21 +148,37 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
public init(_ n: Int64) { public init(_ n: Int64) {
let data = UInt64(bitPattern: n) let data = UInt64(bitPattern: n)
// Bits: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// |___________________________|__| |______________________________|
// id high bits (29) ns id low bits (32)
let legacyNamespaceBits = ((data >> 32) & 0xffffffff) let legacyNamespaceBits = ((data >> 32) & 0xffffffff)
let idLowBits = data & 0xffffffff let idLowBits = data & 0xffffffff
if legacyNamespaceBits == 0x7fffffff && idLowBits == 0 { if legacyNamespaceBits == 0x7fffffff && idLowBits == 0 {
self.namespace = .max self.namespace = .max
self.id = Id(rawValue: Int32(bitPattern: UInt32(clamping: idLowBits))) self.id = Id(rawValue: Int64(bitPattern: UInt64(clamping: idLowBits)))
} else { } else {
// 0x7 == 0b111
let namespaceBits = ((data >> 32) & 0x7) let namespaceBits = ((data >> 32) & 0x7)
self.namespace = Namespace(rawValue: UInt32(namespaceBits)) self.namespace = Namespace(rawValue: UInt32(namespaceBits))
//let idHighBits = (data >> (32 + 3)) & 0xffffffff let offsetIdHighBits = (data >> (32 + 3)) & 0xffffffff
//assert(idHighBits == 0) 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 { public init(from decoder: Decoder) throws {
@ -173,7 +193,26 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
} }
public func toInt64() -> Int64 { 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 let result: Int64
if self.namespace == .max && self.id.rawValue == 0 { if self.namespace == .max && self.id.rawValue == 0 {
@ -181,25 +220,20 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable {
let namespaceBits: UInt64 = 0x7fffffff let namespaceBits: UInt64 = 0x7fffffff
data |= namespaceBits << 32 data |= namespaceBits << 32
data |= idLowBits
data |= UInt64(idLowBits)
result = Int64(bitPattern: data) result = Int64(bitPattern: data)
} else { } else {
var data: UInt64 = 0 var data: UInt64 = 0
data |= UInt64(self.namespace.rawValue) << 32 assert(self.namespace.rawValue & 0x7 == self.namespace.rawValue)
let offsetIdHighBits = idHighBits << (32 + 3)
let idValue = UInt32(bitPattern: self.id.rawValue) data |= UInt64(self.namespace.rawValue & 0x7) << 32
let idHighBits = (idValue >> 32) & 0x3FFFFFFF data |= offsetIdHighBits
assert(idHighBits == 0) data |= idLowBits
data |= UInt64(idLowBits)
result = Int64(bitPattern: data) result = Int64(bitPattern: data)
} }
assert(PeerId(result) == self)
return result return result
} }

View File

@ -1,14 +1,6 @@
import Foundation import Foundation
public class PeerNotificationSettingsDecodeHelper { public enum PeerNotificationSettingsBehavior: PostboxCoding {
public let decode: (_ data: Data) -> PeerNotificationSettings?
public init(decode: @escaping (_ data: Data) -> PeerNotificationSettings?) {
self.decode = decode
}
}
public enum PeerNotificationSettingsBehavior {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case _case = "_v" case _case = "_v"
case toValue case toValue
@ -18,14 +10,12 @@ public enum PeerNotificationSettingsBehavior {
case none case none
case reset(atTimestamp: Int32, toValue: PeerNotificationSettings) case reset(atTimestamp: Int32, toValue: PeerNotificationSettings)
public init(from decoder: Decoder, helper: PeerNotificationSettingsDecodeHelper) throws { public init(decoder: PostboxDecoder) {
let container = try decoder.container(keyedBy: StringCodingKey.self)
switch decoder.decodeInt32ForKey("_v", orElse: 0) { switch decoder.decodeInt32ForKey("_v", orElse: 0) {
case 0: case 0:
self = .none self = .none
case 1: case 1:
if let toValue = helper.decode(PeerNotificationSettings.self, forKey: "toValue") { if let toValue = decoder.decodeObjectForKey("toValue") as? PeerNotificationSettings {
self = .reset(atTimestamp: decoder.decodeInt32ForKey("atTimestamp", orElse: 0), toValue: toValue) self = .reset(atTimestamp: decoder.decodeInt32ForKey("atTimestamp", orElse: 0), toValue: toValue)
} else { } else {
assertionFailure() assertionFailure()
@ -44,15 +34,17 @@ public enum PeerNotificationSettingsBehavior {
case let .reset(atTimestamp, toValue): case let .reset(atTimestamp, toValue):
encoder.encodeInt32(1, forKey: "_v") encoder.encodeInt32(1, forKey: "_v")
encoder.encodeInt32(atTimestamp, forKey: "atTimestamp") encoder.encodeInt32(atTimestamp, forKey: "atTimestamp")
encoder.encode(toValue, forKey: "toValue") encoder.encodeObject(toValue, forKey: "toValue")
} }
} }
} }
public protocol PeerNotificationSettings: Codable { public protocol PeerNotificationSettings: PostboxCoding {
func isRemovedFromTotalUnreadCount(`default`: Bool) -> Bool func isRemovedFromTotalUnreadCount(`default`: Bool) -> Bool
var behavior: PeerNotificationSettingsBehavior { get } var behavior: PeerNotificationSettingsBehavior { get }
func isEqual(to other: PeerNotificationSettings) -> Bool
} }
public final class PostboxGlobalNotificationSettings { public final class PostboxGlobalNotificationSettings {

View File

@ -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) 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] = [] 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 let otherPeerId = self.context.account.peerId
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>() var messages = SimpleDictionary<MessageId, Message>()

View File

@ -140,7 +140,7 @@ class ForwardPrivacyChatPreviewItemNode: ListViewItemNode {
let insets: UIEdgeInsets let insets: UIEdgeInsets
let separatorHeight = UIScreenPixel 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<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>() let messages = SimpleDictionary<MessageId, Message>()

View File

@ -220,13 +220,13 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
let peers = SimpleDictionary<PeerId, Peer>() let peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>() let messages = SimpleDictionary<MessageId, Message>()
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 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 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._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 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._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 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._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 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._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 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._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 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._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 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 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) 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] = [] 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 let otherPeerId = self.context.account.peerId
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>() var messages = SimpleDictionary<MessageId, Message>()

View File

@ -818,11 +818,11 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
let peers = SimpleDictionary<PeerId, Peer>() let peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>() let messages = SimpleDictionary<MessageId, Message>()
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 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 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._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 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._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 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._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 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._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 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 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) 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] = [] 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 let otherPeerId = self.context.account.peerId
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>() var messages = SimpleDictionary<MessageId, Message>()

View File

@ -365,14 +365,14 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
let peers = SimpleDictionary<PeerId, Peer>() let peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>() let messages = SimpleDictionary<MessageId, Message>()
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 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 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._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 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._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 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._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 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._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 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._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 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._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 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._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 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 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) 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] = [] 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 let otherPeerId = self.context.account.peerId
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>() var messages = SimpleDictionary<MessageId, Message>()

View File

@ -146,8 +146,8 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode {
let insets: UIEdgeInsets let insets: UIEdgeInsets
let separatorHeight = UIScreenPixel 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))
let otherPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)) let otherPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2))
var items: [ListViewItem] = [] var items: [ListViewItem] = []
for messageItem in item.messageItems.reversed() { for messageItem in item.messageItems.reversed() {
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()

View File

@ -1029,7 +1029,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode {
} }
var items: [ListViewItem] = [] 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 let otherPeerId = self.context.account.peerId
var peers = SimpleDictionary<PeerId, Peer>() var peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>() let messages = SimpleDictionary<MessageId, Message>()

View File

@ -329,11 +329,11 @@ public final class ShareController: ViewController {
public var debugAction: (() -> Void)? public var debugAction: (() -> Void)?
public convenience init(context: AccountContext, subject: ShareControllerSubject, presetText: String? = nil, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, fromForeignApp: Bool = false, segmentedValues: [ShareControllerSegmentedValue]? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = [], immediatePeerId: PeerId? = nil, forceTheme: PresentationTheme? = nil, forcedActionTitle: String? = nil) { public convenience init(context: AccountContext, subject: ShareControllerSubject, presetText: String? = nil, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, fromForeignApp: Bool = false, segmentedValues: [ShareControllerSegmentedValue]? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = [], immediatePeerId: PeerId? = nil, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, forcedActionTitle: String? = nil) {
self.init(sharedContext: context.sharedContext, currentContext: context, subject: subject, presetText: presetText, preferredAction: preferredAction, showInChat: showInChat, fromForeignApp: fromForeignApp, segmentedValues: segmentedValues, externalShare: externalShare, immediateExternalShare: immediateExternalShare, switchableAccounts: switchableAccounts, immediatePeerId: immediatePeerId, forceTheme: forceTheme, forcedActionTitle: forcedActionTitle) self.init(sharedContext: context.sharedContext, currentContext: context, subject: subject, presetText: presetText, preferredAction: preferredAction, showInChat: showInChat, fromForeignApp: fromForeignApp, segmentedValues: segmentedValues, externalShare: externalShare, immediateExternalShare: immediateExternalShare, switchableAccounts: switchableAccounts, immediatePeerId: immediatePeerId, updatedPresentationData: updatedPresentationData, forceTheme: forceTheme, forcedActionTitle: forcedActionTitle)
} }
public init(sharedContext: SharedAccountContext, currentContext: AccountContext, subject: ShareControllerSubject, presetText: String? = nil, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, fromForeignApp: Bool = false, segmentedValues: [ShareControllerSegmentedValue]? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = [], immediatePeerId: PeerId? = nil, forceTheme: PresentationTheme? = nil, forcedActionTitle: String? = nil) { public init(sharedContext: SharedAccountContext, currentContext: AccountContext, subject: ShareControllerSubject, presetText: String? = nil, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, fromForeignApp: Bool = false, segmentedValues: [ShareControllerSegmentedValue]? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = [], immediatePeerId: PeerId? = nil, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, forcedActionTitle: String? = nil) {
self.sharedContext = sharedContext self.sharedContext = sharedContext
self.currentContext = currentContext self.currentContext = currentContext
self.currentAccount = currentContext.account self.currentAccount = currentContext.account
@ -347,7 +347,7 @@ public final class ShareController: ViewController {
self.segmentedValues = segmentedValues self.segmentedValues = segmentedValues
self.forceTheme = forceTheme self.forceTheme = forceTheme
self.presentationData = self.sharedContext.currentPresentationData.with { $0 } self.presentationData = updatedPresentationData?.initial ?? sharedContext.currentPresentationData.with { $0 }
if let forceTheme = self.forceTheme { if let forceTheme = self.forceTheme {
self.presentationData = self.presentationData.withUpdated(theme: forceTheme) self.presentationData = self.presentationData.withUpdated(theme: forceTheme)
} }
@ -463,7 +463,7 @@ public final class ShareController: ViewController {
}) })
} }
self.presentationDataDisposable = (self.sharedContext.presentationData self.presentationDataDisposable = ((updatedPresentationData?.signal ?? self.sharedContext.presentationData)
|> deliverOnMainQueue).start(next: { [weak self] presentationData in |> deliverOnMainQueue).start(next: { [weak self] presentationData in
if let strongSelf = self, strongSelf.isNodeLoaded { if let strongSelf = self, strongSelf.isNodeLoaded {
strongSelf.controllerNode.updatePresentationData(presentationData) strongSelf.controllerNode.updatePresentationData(presentationData)
@ -484,7 +484,7 @@ public final class ShareController: ViewController {
} }
override public func loadDisplayNode() { override public func loadDisplayNode() {
self.displayNode = ShareControllerNode(sharedContext: self.sharedContext, presetText: self.presetText, defaultAction: self.defaultAction, requestLayout: { [weak self] transition in self.displayNode = ShareControllerNode(sharedContext: self.sharedContext, presentationData: self.presentationData, presetText: self.presetText, defaultAction: self.defaultAction, requestLayout: { [weak self] transition in
self?.requestLayout(transition: transition) self?.requestLayout(transition: transition)
}, presentError: { [weak self] title, text in }, presentError: { [weak self] title, text in
guard let strongSelf = self else { guard let strongSelf = self else {

View File

@ -80,9 +80,9 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
private let presetText: String? private let presetText: String?
init(sharedContext: SharedAccountContext, presetText: String?, defaultAction: ShareControllerAction?, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, presentError: @escaping (String?, String) -> Void, externalShare: Bool, immediateExternalShare: Bool, immediatePeerId: PeerId?, fromForeignApp: Bool, forceTheme: PresentationTheme?, segmentedValues: [ShareControllerSegmentedValue]?) { init(sharedContext: SharedAccountContext, presentationData: PresentationData, presetText: String?, defaultAction: ShareControllerAction?, requestLayout: @escaping (ContainedViewLayoutTransition) -> Void, presentError: @escaping (String?, String) -> Void, externalShare: Bool, immediateExternalShare: Bool, immediatePeerId: PeerId?, fromForeignApp: Bool, forceTheme: PresentationTheme?, segmentedValues: [ShareControllerSegmentedValue]?) {
self.sharedContext = sharedContext self.sharedContext = sharedContext
self.presentationData = sharedContext.currentPresentationData.with { $0 } self.presentationData = presentationData
self.forceTheme = forceTheme self.forceTheme = forceTheme
self.externalShare = externalShare self.externalShare = externalShare
self.immediateExternalShare = immediateExternalShare self.immediateExternalShare = immediateExternalShare

View File

@ -4,6 +4,9 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
NSData * _Nullable prepareSvgImage(NSData * _Nonnull data);
UIImage * _Nullable renderPreparedImage(NSData * _Nonnull data, CGSize size);
UIImage * _Nullable drawSvgImage(NSData * _Nonnull data, CGSize size, UIColor * _Nullable backgroundColor, UIColor * _Nullable foregroundColor); UIImage * _Nullable drawSvgImage(NSData * _Nonnull data, CGSize size, UIColor * _Nullable backgroundColor, UIColor * _Nullable foregroundColor);
#endif /* Lottie_h */ #endif /* Lottie_h */

View File

@ -229,3 +229,431 @@ UIImage * _Nullable drawSvgImage(NSData * _Nonnull data, CGSize size, UIColor *b
return resultImage; return resultImage;
} }
@interface CGContextCoder : NSObject {
NSMutableData *_data;
}
@property (nonatomic, readonly) NSData *data;
@end
@implementation CGContextCoder
- (instancetype)initWithSize:(CGSize)size {
self = [super init];
if (self != nil) {
_data = [[NSMutableData alloc] init];
int32_t intWidth = size.width;
int32_t intHeight = size.height;
[_data appendBytes:&intWidth length:sizeof(intWidth)];
[_data appendBytes:&intHeight length:sizeof(intHeight)];
}
return self;
}
- (void)setFillColorWithOpacity:(CGFloat)opacity {
uint8_t command = 1;
[_data appendBytes:&command length:sizeof(command)];
uint8_t intOpacity = opacity * 255.0;
[_data appendBytes:&intOpacity length:sizeof(intOpacity)];
}
- (void)setupStrokeOpacity:(CGFloat)opacity mitterLimit:(CGFloat)mitterLimit lineWidth:(CGFloat)lineWidth lineCap:(CGLineCap)lineCap lineJoin:(CGLineJoin)lineJoin {
uint8_t command = 2;
[_data appendBytes:&command length:sizeof(command)];
uint8_t intOpacity = opacity * 255.0;
[_data appendBytes:&intOpacity length:sizeof(intOpacity)];
float floatMitterLimit = mitterLimit;
[_data appendBytes:&floatMitterLimit length:sizeof(floatMitterLimit)];
float floatLineWidth = lineWidth;
[_data appendBytes:&floatLineWidth length:sizeof(floatLineWidth)];
uint8_t intLineCap = lineCap;
[_data appendBytes:&intLineCap length:sizeof(intLineCap)];
uint8_t intLineJoin = lineJoin;
[_data appendBytes:&intLineJoin length:sizeof(intLineJoin)];
}
- (void)beginPath {
uint8_t command = 3;
[_data appendBytes:&command length:sizeof(command)];
}
- (void)moveToPoint:(CGPoint)point {
uint8_t command = 4;
[_data appendBytes:&command length:sizeof(command)];
float floatX = point.x;
[_data appendBytes:&floatX length:sizeof(floatX)];
float floatY = point.y;
[_data appendBytes:&floatY length:sizeof(floatY)];
}
- (void)addLineToPoint:(CGPoint)point {
uint8_t command = 5;
[_data appendBytes:&command length:sizeof(command)];
float floatX = point.x;
[_data appendBytes:&floatX length:sizeof(floatX)];
float floatY = point.y;
[_data appendBytes:&floatY length:sizeof(floatY)];
}
- (void)addCurveToPoint:(CGPoint)p1 p2:(CGPoint)p2 p3:(CGPoint)p3 {
uint8_t command = 6;
[_data appendBytes:&command length:sizeof(command)];
float floatX1 = p1.x;
[_data appendBytes:&floatX1 length:sizeof(floatX1)];
float floatY1 = p1.y;
[_data appendBytes:&floatY1 length:sizeof(floatY1)];
float floatX2 = p2.x;
[_data appendBytes:&floatX2 length:sizeof(floatX2)];
float floatY2 = p2.y;
[_data appendBytes:&floatY2 length:sizeof(floatY2)];
float floatX3 = p3.x;
[_data appendBytes:&floatX3 length:sizeof(floatX3)];
float floatY3 = p3.y;
[_data appendBytes:&floatY3 length:sizeof(floatY3)];
}
- (void)closePath {
uint8_t command = 7;
[_data appendBytes:&command length:sizeof(command)];
}
- (void)eoFillPath {
uint8_t command = 8;
[_data appendBytes:&command length:sizeof(command)];
}
- (void)fillPath {
uint8_t command = 9;
[_data appendBytes:&command length:sizeof(command)];
}
- (void)strokePath {
uint8_t command = 10;
[_data appendBytes:&command length:sizeof(command)];
}
@end
UIImage * _Nullable renderPreparedImage(NSData * _Nonnull data, CGSize size) {
NSDate *startTime = [NSDate date];
UIColor *foregroundColor = [UIColor whiteColor];
UIColor *backgroundColor = [UIColor blackColor];
int32_t ptr = 0;
int32_t width;
int32_t height;
[data getBytes:&width range:NSMakeRange(ptr, sizeof(width))];
ptr += sizeof(width);
[data getBytes:&height range:NSMakeRange(ptr, sizeof(height))];
ptr += sizeof(height);
UIGraphicsBeginImageContextWithOptions(size, true, 1.0);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, backgroundColor.CGColor);
CGContextFillRect(context, CGRectMake(0.0f, 0.0f, size.width, size.height));
CGSize svgSize = CGSizeMake(width, height);
CGSize drawingSize = aspectFillSize(svgSize, size);
CGFloat scale = MAX(size.width / MAX(1.0, svgSize.width), size.height / MAX(1.0, svgSize.height));
CGContextScaleCTM(context, scale, scale);
CGContextTranslateCTM(context, (size.width - drawingSize.width) / 2.0, (size.height - drawingSize.height) / 2.0);
while (ptr < data.length) {
uint8_t cmd;
[data getBytes:&cmd range:NSMakeRange(ptr, sizeof(cmd))];
ptr += sizeof(cmd);
switch (cmd) {
case 1:
{
uint8_t opacity;
[data getBytes:&opacity range:NSMakeRange(ptr, sizeof(opacity))];
ptr += sizeof(opacity);
CGContextSetFillColorWithColor(context, [foregroundColor colorWithAlphaComponent:opacity / 255.0].CGColor);
}
break;
case 2:
{
uint8_t opacity;
[data getBytes:&opacity range:NSMakeRange(ptr, sizeof(opacity))];
ptr += sizeof(opacity);
CGContextSetStrokeColorWithColor(context, [foregroundColor colorWithAlphaComponent:opacity / 255.0].CGColor);
float mitterLimit;
[data getBytes:&mitterLimit range:NSMakeRange(ptr, sizeof(mitterLimit))];
ptr += sizeof(mitterLimit);
CGContextSetMiterLimit(context, mitterLimit);
float lineWidth;
[data getBytes:&lineWidth range:NSMakeRange(ptr, sizeof(lineWidth))];
ptr += sizeof(lineWidth);
CGContextSetLineWidth(context, lineWidth);
uint8_t lineCap;
[data getBytes:&lineCap range:NSMakeRange(ptr, sizeof(lineCap))];
ptr += sizeof(lineCap);
CGContextSetLineCap(context, lineCap);
uint8_t lineJoin;
[data getBytes:&lineJoin range:NSMakeRange(ptr, sizeof(lineJoin))];
ptr += sizeof(lineJoin);
CGContextSetLineCap(context, lineJoin);
}
break;
case 3:
{
CGContextBeginPath(context);
}
break;
case 4:
{
float x;
[data getBytes:&x range:NSMakeRange(ptr, sizeof(x))];
ptr += sizeof(x);
float y;
[data getBytes:&y range:NSMakeRange(ptr, sizeof(y))];
ptr += sizeof(y);
CGContextMoveToPoint(context, x, y);
}
break;
case 5:
{
float x;
[data getBytes:&x range:NSMakeRange(ptr, sizeof(x))];
ptr += sizeof(x);
float y;
[data getBytes:&y range:NSMakeRange(ptr, sizeof(y))];
ptr += sizeof(y);
CGContextAddLineToPoint(context, x, y);
}
break;
case 6:
{
float x1;
[data getBytes:&x1 range:NSMakeRange(ptr, sizeof(x1))];
ptr += sizeof(x1);
float y1;
[data getBytes:&y1 range:NSMakeRange(ptr, sizeof(y1))];
ptr += sizeof(y1);
float x2;
[data getBytes:&x2 range:NSMakeRange(ptr, sizeof(x2))];
ptr += sizeof(x2);
float y2;
[data getBytes:&y2 range:NSMakeRange(ptr, sizeof(y2))];
ptr += sizeof(y2);
float x3;
[data getBytes:&x3 range:NSMakeRange(ptr, sizeof(x3))];
ptr += sizeof(x3);
float y3;
[data getBytes:&y3 range:NSMakeRange(ptr, sizeof(y3))];
ptr += sizeof(y3);
CGContextAddCurveToPoint(context, x1, y1, x2, y2, x3, y3);
}
break;
case 7:
{
CGContextClosePath(context);
}
break;
case 8:
{
CGContextEOFillPath(context);
}
break;
case 9:
{
CGContextFillPath(context);
}
break;
case 10:
{
CGContextStrokePath(context);
}
break;
default:
break;
}
}
UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
double deltaTime = -1.0f * [startTime timeIntervalSinceNow];
printf("drawingTime %fx%f = %f\n", size.width, size.height, deltaTime);
return resultImage;
}
NSData * _Nullable prepareSvgImage(NSData * _Nonnull data) {
NSDate *startTime = [NSDate date];
NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
if (parser == nil) {
return nil;
}
SvgXMLParsingDelegate *delegate = [[SvgXMLParsingDelegate alloc] init];
parser.delegate = delegate;
[parser parse];
NSMutableString *xmlString = [[NSMutableString alloc] initWithData:data encoding:NSUTF8StringEncoding];
if (xmlString == nil) {
return nil;
}
for (NSString *styleName in delegate.styles) {
NSString *styleValue = delegate.styles[styleName];
[xmlString replaceOccurrencesOfString:[NSString stringWithFormat:@"class=\"%@\"", styleName] withString:[NSString stringWithFormat:@"style=\"%@\"", styleValue] options:0 range:NSMakeRange(0, xmlString.length)];
}
const char *zeroTerminatedData = xmlString.UTF8String;
NSVGimage *image = nsvgParse((char *)zeroTerminatedData, "px", 96);
if (image == nil || image->width < 1.0f || image->height < 1.0f) {
return nil;
}
double deltaTime = -1.0f * [startTime timeIntervalSinceNow];
printf("parseTime = %f\n", deltaTime);
startTime = [NSDate date];
CGContextCoder *context = [[CGContextCoder alloc] initWithSize:CGSizeMake(image->width, image->height)];
for (NSVGshape *shape = image->shapes; shape != NULL; shape = shape->next) {
if (!(shape->flags & NSVG_FLAGS_VISIBLE)) {
continue;
}
if (shape->fill.type != NSVG_PAINT_NONE) {
[context setFillColorWithOpacity:shape->opacity];
bool isFirst = true;
bool hasStartPoint = false;
CGPoint startPoint;
for (NSVGpath *path = shape->paths; path != NULL; path = path->next) {
if (isFirst) {
[context beginPath];
isFirst = false;
hasStartPoint = true;
startPoint.x = path->pts[0];
startPoint.y = path->pts[1];
}
[context moveToPoint:CGPointMake(path->pts[0], path->pts[1])];
for (int i = 0; i < path->npts - 1; i += 3) {
float *p = &path->pts[i * 2];
[context addCurveToPoint:CGPointMake(p[2], p[3]) p2:CGPointMake(p[4], p[5]) p3:CGPointMake(p[6], p[7])];
}
if (path->closed) {
if (hasStartPoint) {
hasStartPoint = false;
[context addLineToPoint:startPoint];
}
}
}
switch (shape->fillRule) {
case NSVG_FILLRULE_EVENODD:
[context eoFillPath];
break;
default:
[context fillPath];
break;
}
}
if (shape->stroke.type != NSVG_PAINT_NONE) {
CGLineCap lineCap = kCGLineCapButt;
CGLineJoin lineJoin = kCGLineJoinMiter;
switch (shape->strokeLineCap) {
case NSVG_CAP_BUTT:
lineCap = kCGLineCapButt;
break;
case NSVG_CAP_ROUND:
lineCap = kCGLineCapRound;
break;
case NSVG_CAP_SQUARE:
lineCap = kCGLineCapSquare;
break;
default:
break;
}
switch (shape->strokeLineJoin) {
case NSVG_JOIN_BEVEL:
lineJoin = kCGLineJoinBevel;
break;
case NSVG_JOIN_MITER:
lineJoin = kCGLineJoinMiter;
break;
case NSVG_JOIN_ROUND:
lineJoin = kCGLineJoinRound;
break;
default:
break;
}
[context setupStrokeOpacity:shape->opacity mitterLimit:shape->miterLimit lineWidth:shape->strokeWidth lineCap:lineCap lineJoin:lineJoin];
for (NSVGpath *path = shape->paths; path != NULL; path = path->next) {
[context beginPath];
[context moveToPoint:CGPointMake(path->pts[0], path->pts[1])];
for (int i = 0; i < path->npts - 1; i += 3) {
float *p = &path->pts[i * 2];
[context addCurveToPoint:CGPointMake(p[2], p[3]) p2:CGPointMake(p[4], p[5]) p3:CGPointMake(p[6], p[7])];
}
if (path->closed) {
[context closePath];
}
[context strokePath];
}
}
}
nsvgDelete(image);
return context.data;
}

View File

@ -11,12 +11,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) } dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) }
dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) } dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) } dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
dict[1235264985] = { return Api.ChatFull.parse_chatFull($0) } dict[1304281241] = { return Api.ChatFull.parse_chatFull($0) }
dict[793980732] = { return Api.ChatFull.parse_channelFull($0) } dict[-374179305] = { return Api.ChatFull.parse_channelFull($0) }
dict[-1159937629] = { return Api.PollResults.parse_pollResults($0) } dict[-591909213] = { return Api.PollResults.parse_pollResults($0) }
dict[-925415106] = { return Api.ChatParticipant.parse_chatParticipant($0) } dict[-1070776313] = { return Api.ChatParticipant.parse_chatParticipant($0) }
dict[-636267638] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) } dict[-462696732] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) }
dict[-489233354] = { return Api.ChatParticipant.parse_chatParticipantAdmin($0) } dict[-1600962725] = { return Api.ChatParticipant.parse_chatParticipantAdmin($0) }
dict[1567990072] = { return Api.updates.Difference.parse_differenceEmpty($0) } dict[1567990072] = { return Api.updates.Difference.parse_differenceEmpty($0) }
dict[16030880] = { return Api.updates.Difference.parse_difference($0) } dict[16030880] = { return Api.updates.Difference.parse_difference($0) }
dict[-1459938943] = { return Api.updates.Difference.parse_differenceSlice($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[-1715350371] = { return Api.JSONValue.parse_jsonObject($0) }
dict[590459437] = { return Api.Photo.parse_photoEmpty($0) } dict[590459437] = { return Api.Photo.parse_photoEmpty($0) }
dict[-82216347] = { return Api.Photo.parse_photo($0) } dict[-82216347] = { return Api.Photo.parse_photo($0) }
dict[-1683826688] = { return Api.Chat.parse_chatEmpty($0) } dict[693512293] = { return Api.Chat.parse_chatEmpty($0) }
dict[1004149726] = { return Api.Chat.parse_chat($0) } dict[1103884886] = { return Api.Chat.parse_chat($0) }
dict[120753115] = { return Api.Chat.parse_chatForbidden($0) } dict[1704108455] = { return Api.Chat.parse_chatForbidden($0) }
dict[-753232354] = { return Api.Chat.parse_channel($0) } dict[-2107528095] = { return Api.Chat.parse_channel($0) }
dict[681420594] = { return Api.Chat.parse_channelForbidden($0) } dict[399807445] = { return Api.Chat.parse_channelForbidden($0) }
dict[1202287072] = { return Api.StatsURL.parse_statsURL($0) } dict[1202287072] = { return Api.StatsURL.parse_statsURL($0) }
dict[1516793212] = { return Api.ChatInvite.parse_chatInviteAlready($0) } dict[1516793212] = { return Api.ChatInvite.parse_chatInviteAlready($0) }
dict[-540871282] = { return Api.ChatInvite.parse_chatInvite($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[1678812626] = { return Api.StickerSetCovered.parse_stickerSetCovered($0) }
dict[872932635] = { return Api.StickerSetCovered.parse_stickerSetMultiCovered($0) } dict[872932635] = { return Api.StickerSetCovered.parse_stickerSetMultiCovered($0) }
dict[1189204285] = { return Api.RecentMeUrl.parse_recentMeUrlUnknown($0) } dict[1189204285] = { return Api.RecentMeUrl.parse_recentMeUrlUnknown($0) }
dict[-1917045962] = { return Api.RecentMeUrl.parse_recentMeUrlUser($0) } dict[-1188296222] = { return Api.RecentMeUrl.parse_recentMeUrlUser($0) }
dict[-1608834311] = { return Api.RecentMeUrl.parse_recentMeUrlChat($0) } dict[-1294306862] = { return Api.RecentMeUrl.parse_recentMeUrlChat($0) }
dict[-347535331] = { return Api.RecentMeUrl.parse_recentMeUrlChatInvite($0) } dict[-347535331] = { return Api.RecentMeUrl.parse_recentMeUrlChatInvite($0) }
dict[-1140172836] = { return Api.RecentMeUrl.parse_recentMeUrlStickerSet($0) } dict[-1140172836] = { return Api.RecentMeUrl.parse_recentMeUrlStickerSet($0) }
dict[-797791052] = { return Api.RestrictionReason.parse_restrictionReason($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[894777186] = { return Api.RichText.parse_textAnchor($0) }
dict[-694681851] = { return Api.UserFull.parse_userFull($0) } dict[-694681851] = { return Api.UserFull.parse_userFull($0) }
dict[-292807034] = { return Api.InputChannel.parse_inputChannelEmpty($0) } dict[-292807034] = { return Api.InputChannel.parse_inputChannelEmpty($0) }
dict[-1343524562] = { return Api.InputChannel.parse_inputChannel($0) } dict[-212145112] = { return Api.InputChannel.parse_inputChannel($0) }
dict[707290417] = { return Api.InputChannel.parse_inputChannelFromMessage($0) } dict[1536380829] = { return Api.InputChannel.parse_inputChannelFromMessage($0) }
dict[414687501] = { return Api.DcOption.parse_dcOption($0) } dict[414687501] = { return Api.DcOption.parse_dcOption($0) }
dict[997055186] = { return Api.PollAnswerVoters.parse_pollAnswerVoters($0) } dict[997055186] = { return Api.PollAnswerVoters.parse_pollAnswerVoters($0) }
dict[-1705233435] = { return Api.account.PasswordSettings.parse_passwordSettings($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[-209337866] = { return Api.LangPackDifference.parse_langPackDifference($0) }
dict[499236004] = { return Api.WallPaperSettings.parse_wallPaperSettings($0) } dict[499236004] = { return Api.WallPaperSettings.parse_wallPaperSettings($0) }
dict[-1519029347] = { return Api.EmojiURL.parse_emojiURL($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[-541588713] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) }
dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) } dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) }
dict[-763367294] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordSRP($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[1148485274] = { return Api.auth.Authorization.parse_authorizationSignUpRequired($0) }
dict[-181407105] = { return Api.InputFile.parse_inputFile($0) } dict[-181407105] = { return Api.InputFile.parse_inputFile($0) }
dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) } dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) }
dict[-1649296275] = { return Api.Peer.parse_peerUser($0) } dict[1498486562] = { return Api.Peer.parse_peerUser($0) }
dict[-1160714821] = { return Api.Peer.parse_peerChat($0) } dict[918946202] = { return Api.Peer.parse_peerChat($0) }
dict[-1109531342] = { return Api.Peer.parse_peerChannel($0) } dict[-1566230754] = { return Api.Peer.parse_peerChannel($0) }
dict[410107472] = { return Api.messages.ExportedChatInvite.parse_exportedChatInvite($0) } dict[410107472] = { return Api.messages.ExportedChatInvite.parse_exportedChatInvite($0) }
dict[572915951] = { return Api.messages.ExportedChatInvite.parse_exportedChatInviteReplaced($0) } dict[572915951] = { return Api.messages.ExportedChatInvite.parse_exportedChatInviteReplaced($0) }
dict[-1868808300] = { return Api.PaymentRequestedInfo.parse_paymentRequestedInfo($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[522914557] = { return Api.Update.parse_updateNewMessage($0) }
dict[1318109142] = { return Api.Update.parse_updateMessageID($0) } dict[1318109142] = { return Api.Update.parse_updateMessageID($0) }
dict[-1576161051] = { return Api.Update.parse_updateDeleteMessages($0) } dict[-1576161051] = { return Api.Update.parse_updateDeleteMessages($0) }
dict[1548249383] = { return Api.Update.parse_updateUserTyping($0) } dict[-1071741569] = { return Api.Update.parse_updateUserTyping($0) }
dict[-2033525908] = { return Api.Update.parse_updateChatUserTyping($0) } dict[-2092401936] = { return Api.Update.parse_updateChatUserTyping($0) }
dict[125178264] = { return Api.Update.parse_updateChatParticipants($0) } dict[125178264] = { return Api.Update.parse_updateChatParticipants($0) }
dict[469489699] = { return Api.Update.parse_updateUserStatus($0) } dict[-440534818] = { return Api.Update.parse_updateUserStatus($0) }
dict[-1489818765] = { return Api.Update.parse_updateUserName($0) } dict[-1007549728] = { return Api.Update.parse_updateUserName($0) }
dict[-1791935732] = { return Api.Update.parse_updateUserPhoto($0) } dict[-232290676] = { return Api.Update.parse_updateUserPhoto($0) }
dict[314359194] = { return Api.Update.parse_updateNewEncryptedMessage($0) } dict[314359194] = { return Api.Update.parse_updateNewEncryptedMessage($0) }
dict[386986326] = { return Api.Update.parse_updateEncryptedChatTyping($0) } dict[386986326] = { return Api.Update.parse_updateEncryptedChatTyping($0) }
dict[-1264392051] = { return Api.Update.parse_updateEncryption($0) } dict[-1264392051] = { return Api.Update.parse_updateEncryption($0) }
dict[956179895] = { return Api.Update.parse_updateEncryptedMessagesRead($0) } dict[956179895] = { return Api.Update.parse_updateEncryptedMessagesRead($0) }
dict[-364179876] = { return Api.Update.parse_updateChatParticipantAdd($0) } dict[1037718609] = { return Api.Update.parse_updateChatParticipantAdd($0) }
dict[1851755554] = { return Api.Update.parse_updateChatParticipantDelete($0) } dict[-483443337] = { return Api.Update.parse_updateChatParticipantDelete($0) }
dict[-1906403213] = { return Api.Update.parse_updateDcOptions($0) } dict[-1906403213] = { return Api.Update.parse_updateDcOptions($0) }
dict[-1094555409] = { return Api.Update.parse_updateNotifySettings($0) } dict[-1094555409] = { return Api.Update.parse_updateNotifySettings($0) }
dict[-337352679] = { return Api.Update.parse_updateServiceNotification($0) } dict[-337352679] = { return Api.Update.parse_updateServiceNotification($0) }
dict[-298113238] = { return Api.Update.parse_updatePrivacy($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[-1667805217] = { return Api.Update.parse_updateReadHistoryInbox($0) }
dict[791617983] = { return Api.Update.parse_updateReadHistoryOutbox($0) } dict[791617983] = { return Api.Update.parse_updateReadHistoryOutbox($0) }
dict[2139689491] = { return Api.Update.parse_updateWebPage($0) } dict[2139689491] = { return Api.Update.parse_updateWebPage($0) }
dict[1757493555] = { return Api.Update.parse_updateReadMessagesContents($0) } dict[1757493555] = { return Api.Update.parse_updateReadMessagesContents($0) }
dict[-352032773] = { return Api.Update.parse_updateChannelTooLong($0) } dict[277713951] = { return Api.Update.parse_updateChannelTooLong($0) }
dict[-1227598250] = { return Api.Update.parse_updateChannel($0) } dict[1666927625] = { return Api.Update.parse_updateChannel($0) }
dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) } dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) }
dict[856380452] = { return Api.Update.parse_updateReadChannelInbox($0) } dict[-1842450928] = { return Api.Update.parse_updateReadChannelInbox($0) }
dict[-1015733815] = { return Api.Update.parse_updateDeleteChannelMessages($0) } dict[-1020437742] = { return Api.Update.parse_updateDeleteChannelMessages($0) }
dict[-1734268085] = { return Api.Update.parse_updateChannelMessageViews($0) } dict[-232346616] = { return Api.Update.parse_updateChannelMessageViews($0) }
dict[-1232070311] = { return Api.Update.parse_updateChatParticipantAdmin($0) } dict[-674602590] = { return Api.Update.parse_updateChatParticipantAdmin($0) }
dict[1753886890] = { return Api.Update.parse_updateNewStickerSet($0) } dict[1753886890] = { return Api.Update.parse_updateNewStickerSet($0) }
dict[196268545] = { return Api.Update.parse_updateStickerSetsOrder($0) } dict[196268545] = { return Api.Update.parse_updateStickerSetsOrder($0) }
dict[1135492588] = { return Api.Update.parse_updateStickerSets($0) } dict[1135492588] = { return Api.Update.parse_updateStickerSets($0) }
dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($0) } dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($0) }
dict[1059076315] = { return Api.Update.parse_updateBotInlineQuery($0) } dict[1232025500] = { return Api.Update.parse_updateBotInlineQuery($0) }
dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) } dict[317794823] = { return Api.Update.parse_updateBotInlineSend($0) }
dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($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[-469536605] = { return Api.Update.parse_updateEditMessage($0) }
dict[-103646630] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) } dict[1763610706] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) }
dict[634833351] = { return Api.Update.parse_updateReadChannelOutbox($0) } dict[-1218471511] = { return Api.Update.parse_updateReadChannelOutbox($0) }
dict[-299124375] = { return Api.Update.parse_updateDraftMessage($0) } dict[-299124375] = { return Api.Update.parse_updateDraftMessage($0) }
dict[1461528386] = { return Api.Update.parse_updateReadFeaturedStickers($0) } dict[1461528386] = { return Api.Update.parse_updateReadFeaturedStickers($0) }
dict[-1706939360] = { return Api.Update.parse_updateRecentStickers($0) } dict[-1706939360] = { return Api.Update.parse_updateRecentStickers($0) }
dict[-1574314746] = { return Api.Update.parse_updateConfig($0) } dict[-1574314746] = { return Api.Update.parse_updateConfig($0) }
dict[861169551] = { return Api.Update.parse_updatePtsChanged($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[1852826908] = { return Api.Update.parse_updateDialogPinned($0) }
dict[-99664734] = { return Api.Update.parse_updatePinnedDialogs($0) } dict[-99664734] = { return Api.Update.parse_updatePinnedDialogs($0) }
dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) } dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) }
dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) } dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) }
dict[-523384512] = { return Api.Update.parse_updateBotShippingQuery($0) } dict[-1246823043] = { return Api.Update.parse_updateBotShippingQuery($0) }
dict[1563376297] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) } dict[-1934976362] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) }
dict[-1425052898] = { return Api.Update.parse_updatePhoneCall($0) } dict[-1425052898] = { return Api.Update.parse_updatePhoneCall($0) }
dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) } dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) }
dict[1442983757] = { return Api.Update.parse_updateLangPack($0) } dict[1442983757] = { return Api.Update.parse_updateLangPack($0) }
dict[-451831443] = { return Api.Update.parse_updateFavedStickers($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[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[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) }
dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) } dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) }
dict[1421875280] = { return Api.Update.parse_updateChatDefaultBannedRights($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[-2112423005] = { return Api.Update.parse_updateTheme($0) }
dict[-2027964103] = { return Api.Update.parse_updateGeoLiveViewed($0) } dict[-2027964103] = { return Api.Update.parse_updateGeoLiveViewed($0) }
dict[1448076945] = { return Api.Update.parse_updateLoginToken($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[654302845] = { return Api.Update.parse_updateDialogFilter($0) }
dict[-1512627963] = { return Api.Update.parse_updateDialogFilterOrder($0) } dict[-1512627963] = { return Api.Update.parse_updateDialogFilterOrder($0) }
dict[889491791] = { return Api.Update.parse_updateDialogFilters($0) } dict[889491791] = { return Api.Update.parse_updateDialogFilters($0) }
dict[643940105] = { return Api.Update.parse_updatePhoneCallSignalingData($0) } dict[643940105] = { return Api.Update.parse_updatePhoneCallSignalingData($0) }
dict[1854571743] = { return Api.Update.parse_updateChannelMessageForwards($0) } dict[-761649164] = { return Api.Update.parse_updateChannelMessageForwards($0) }
dict[482860628] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) } dict[-693004986] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) }
dict[1178116716] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) } dict[1767677564] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) }
dict[610945826] = { return Api.Update.parse_updatePeerBlocked($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[-309990731] = { return Api.Update.parse_updatePinnedMessages($0) }
dict[-2054649973] = { return Api.Update.parse_updatePinnedChannelMessages($0) } dict[1538885128] = { return Api.Update.parse_updatePinnedChannelMessages($0) }
dict[321954198] = { return Api.Update.parse_updateChat($0) } dict[-124097970] = { return Api.Update.parse_updateChat($0) }
dict[-219423922] = { return Api.Update.parse_updateGroupCallParticipants($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[-1147422299] = { return Api.Update.parse_updatePeerHistoryTTL($0) }
dict[-206342113] = { return Api.Update.parse_updateChatParticipant($0) } dict[-796432838] = { return Api.Update.parse_updateChatParticipant($0) }
dict[2146218476] = { return Api.Update.parse_updateChannelParticipant($0) } dict[-1738720581] = { return Api.Update.parse_updateChannelParticipant($0) }
dict[133777546] = { return Api.Update.parse_updateBotStopped($0) } dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) }
dict[192428418] = { return Api.Update.parse_updateGroupCallConnection($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[136574537] = { return Api.messages.VotesList.parse_votesList($0) }
dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) } dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) }
dict[-592373577] = { return Api.GroupCallParticipantVideoSourceGroup.parse_groupCallParticipantVideoSourceGroup($0) } dict[-592373577] = { return Api.GroupCallParticipantVideoSourceGroup.parse_groupCallParticipantVideoSourceGroup($0) }
dict[-373643672] = { return Api.FolderPeer.parse_folderPeer($0) } dict[-373643672] = { return Api.FolderPeer.parse_folderPeer($0) }
dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) } dict[-1072953408] = { return Api.ChannelParticipant.parse_channelParticipant($0) }
dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } dict[682146919] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) }
dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) } dict[803602899] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) }
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) } dict[885242707] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
dict[1352785878] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) } dict[1844969806] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
dict[453242886] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) } dict[453242886] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) }
dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) } dict[886196148] = { return Api.MessageUserVote.parse_messageUserVote($0) }
dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) } dict[1017491692] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) }
dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) } dict[-1973033641] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) }
dict[182326673] = { return Api.contacts.Blocked.parse_blocked($0) } dict[182326673] = { return Api.contacts.Blocked.parse_blocked($0) }
dict[-513392236] = { return Api.contacts.Blocked.parse_blockedSlice($0) } dict[-513392236] = { return Api.contacts.Blocked.parse_blockedSlice($0) }
dict[-55902537] = { return Api.InputDialogPeer.parse_inputDialogPeer($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[280464681] = { return Api.KeyboardButton.parse_keyboardButtonUrlAuth($0) }
dict[-802258988] = { return Api.KeyboardButton.parse_inputKeyboardButtonUrlAuth($0) } dict[-802258988] = { return Api.KeyboardButton.parse_inputKeyboardButtonUrlAuth($0) }
dict[-1144565411] = { return Api.KeyboardButton.parse_keyboardButtonRequestPoll($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[1679398724] = { return Api.SecureFile.parse_secureFileEmpty($0) }
dict[-534283678] = { return Api.SecureFile.parse_secureFile($0) } dict[-534283678] = { return Api.SecureFile.parse_secureFile($0) }
dict[-199313886] = { return Api.account.Themes.parse_themesNotModified($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[236446268] = { return Api.PhotoSize.parse_photoSizeEmpty($0) }
dict[1976012384] = { return Api.PhotoSize.parse_photoSize($0) } dict[1976012384] = { return Api.PhotoSize.parse_photoSize($0) }
dict[35527382] = { return Api.PhotoSize.parse_photoCachedSize($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[-96535659] = { return Api.PhotoSize.parse_photoSizeProgressive($0) }
dict[-668906175] = { return Api.PhotoSize.parse_photoPathSize($0) } dict[-668906175] = { return Api.PhotoSize.parse_photoPathSize($0) }
dict[-244016606] = { return Api.messages.Stickers.parse_stickersNotModified($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[-1096616924] = { return Api.GlobalPrivacySettings.parse_globalPrivacySettings($0) }
dict[1008755359] = { return Api.InlineBotSwitchPM.parse_inlineBotSwitchPM($0) } dict[1008755359] = { return Api.InlineBotSwitchPM.parse_inlineBotSwitchPM($0) }
dict[223655517] = { return Api.messages.FoundStickerSets.parse_foundStickerSetsNotModified($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[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[1012306921] = { return Api.InputTheme.parse_inputTheme($0) }
dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) } dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) }
dict[-2032041631] = { return Api.Poll.parse_poll($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[-353862078] = { return Api.contacts.Contacts.parse_contacts($0) }
dict[-1798033689] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilterEmpty($0) } dict[-1798033689] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilterEmpty($0) }
dict[-847783593] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilter($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[2004110666] = { return Api.DialogFilterSuggested.parse_dialogFilterSuggested($0) }
dict[326715557] = { return Api.auth.PasswordRecovery.parse_passwordRecovery($0) } dict[326715557] = { return Api.auth.PasswordRecovery.parse_passwordRecovery($0) }
dict[-1803769784] = { return Api.messages.BotResults.parse_botResults($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[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) }
dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) } dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) }
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) } dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) } dict[900291769] = { return Api.InputPeer.parse_inputPeerChat($0) }
dict[2072935910] = { return Api.InputPeer.parse_inputPeerUser($0) } dict[-571955892] = { return Api.InputPeer.parse_inputPeerUser($0) }
dict[548253432] = { return Api.InputPeer.parse_inputPeerChannel($0) } dict[666680316] = { return Api.InputPeer.parse_inputPeerChannel($0) }
dict[398123750] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) } dict[-1468331492] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) }
dict[-1667893317] = { return Api.InputPeer.parse_inputPeerChannelFromMessage($0) } dict[-1121318848] = { return Api.InputPeer.parse_inputPeerChannelFromMessage($0) }
dict[568808380] = { return Api.upload.WebFile.parse_webFile($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[-1078332329] = { return Api.help.PassportConfig.parse_passportConfigNotModified($0) }
dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) } dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) }
dict[1648543603] = { return Api.FileHash.parse_fileHash($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[195371015] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowContacts($0) }
dict[-697604407] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowAll($0) } dict[-697604407] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowAll($0) }
dict[-1877932953] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowUsers($0) } dict[-1877932953] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowUsers($0) }
dict[1283572154] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowChatParticipants($0) } dict[-2079962673] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowChatParticipants($0) }
dict[-668769361] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowChatParticipants($0) } dict[-380694650] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowChatParticipants($0) }
dict[-1058912715] = { return Api.messages.DhConfig.parse_dhConfigNotModified($0) } dict[-1058912715] = { return Api.messages.DhConfig.parse_dhConfigNotModified($0) }
dict[740433629] = { return Api.messages.DhConfig.parse_dhConfig($0) } dict[740433629] = { return Api.messages.DhConfig.parse_dhConfig($0) }
dict[-421545947] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeTitle($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[1599903217] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionTogglePreHistoryHidden($0) }
dict[771095562] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionDefaultBannedRights($0) } dict[771095562] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionDefaultBannedRights($0) }
dict[-1895328189] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStopPoll($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[241923758] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLocation($0) }
dict[1401984889] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleSlowMode($0) } dict[1401984889] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleSlowMode($0) }
dict[589338437] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStartGroupCall($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[1048537159] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantVolume($0) }
dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) } dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) }
dict[-26672755] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeTheme($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[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) }
dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) } dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) }
dict[-1269012015] = { return Api.messages.AffectedHistory.parse_affectedHistory($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[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) } dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[-1014526429] = { return Api.help.Country.parse_country($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[-2128640689] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) }
dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) } dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) }
dict[1248893260] = { return Api.EncryptedFile.parse_encryptedFile($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[-2049074735] = { return Api.ReplyMarkup.parse_replyKeyboardMarkup($0) }
dict[1218642516] = { return Api.ReplyMarkup.parse_replyInlineMarkup($0) } dict[1218642516] = { return Api.ReplyMarkup.parse_replyInlineMarkup($0) }
dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($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[-305282981] = { return Api.TopPeer.parse_topPeer($0) }
dict[-1495959709] = { return Api.MessageReplyHeader.parse_messageReplyHeader($0) } dict[-1495959709] = { return Api.MessageReplyHeader.parse_messageReplyHeader($0) }
dict[411017418] = { return Api.SecureValue.parse_secureValue($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[-386039788] = { return Api.PeerBlocked.parse_peerBlocked($0) }
dict[-1182234929] = { return Api.InputUser.parse_inputUserEmpty($0) } dict[-1182234929] = { return Api.InputUser.parse_inputUserEmpty($0) }
dict[-138301121] = { return Api.InputUser.parse_inputUserSelf($0) } dict[-138301121] = { return Api.InputUser.parse_inputUserSelf($0) }
dict[-668391402] = { return Api.InputUser.parse_inputUser($0) } dict[-233744186] = { return Api.InputUser.parse_inputUser($0) }
dict[756118935] = { return Api.InputUser.parse_inputUserFromMessage($0) } dict[497305826] = { return Api.InputUser.parse_inputUserFromMessage($0) }
dict[-1738178803] = { return Api.Page.parse_page($0) } dict[-1738178803] = { return Api.Page.parse_page($0) }
dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) } dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) }
dict[-875679776] = { return Api.StatsPercentValue.parse_statsPercentValue($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[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) } dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) }
dict[-193506890] = { return Api.phone.GroupParticipants.parse_groupParticipants($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[-2066640507] = { return Api.messages.AffectedMessages.parse_affectedMessages($0) }
dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($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[-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[53231223] = { return Api.InputGame.parse_inputGameID($0) }
dict[-1020139510] = { return Api.InputGame.parse_inputGameShortName($0) } dict[-1020139510] = { return Api.InputGame.parse_inputGameShortName($0) }
dict[1107543535] = { return Api.help.CountryCode.parse_countryCode($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[-1387279939] = { return Api.MessageInteractionCounters.parse_messageInteractionCounters($0) }
dict[-1107852396] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) } dict[-1107852396] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) }
dict[-484987010] = { return Api.Updates.parse_updatesTooLong($0) } dict[-484987010] = { return Api.Updates.parse_updatesTooLong($0) }
dict[-84936653] = { return Api.Updates.parse_updateShortMessage($0) } dict[826001400] = { return Api.Updates.parse_updateShortMessage($0) }
dict[290961496] = { return Api.Updates.parse_updateShortChatMessage($0) } dict[1299050149] = { return Api.Updates.parse_updateShortChatMessage($0) }
dict[2027216577] = { return Api.Updates.parse_updateShort($0) } dict[2027216577] = { return Api.Updates.parse_updateShort($0) }
dict[1918567619] = { return Api.Updates.parse_updatesCombined($0) } dict[1918567619] = { return Api.Updates.parse_updatesCombined($0) }
dict[1957577280] = { return Api.Updates.parse_updates($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[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) }
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) } dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($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[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) }
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) } dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($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[935395612] = { return Api.ChatPhoto.parse_chatPhotoEmpty($0) }
dict[476978193] = { return Api.ChatPhoto.parse_chatPhoto($0) } dict[476978193] = { return Api.ChatPhoto.parse_chatPhoto($0) }
dict[1869903447] = { return Api.PageCaption.parse_pageCaption($0) } dict[1869903447] = { return Api.PageCaption.parse_pageCaption($0) }
dict[-1928649707] = { return Api.payments.PaymentForm.parse_paymentForm($0) } dict[378828315] = { return Api.payments.PaymentForm.parse_paymentForm($0) }
dict[280319440] = { return Api.payments.PaymentReceipt.parse_paymentReceipt($0) } dict[1891958275] = { return Api.payments.PaymentReceipt.parse_paymentReceipt($0) }
dict[863093588] = { return Api.messages.PeerDialogs.parse_peerDialogs($0) } dict[863093588] = { return Api.messages.PeerDialogs.parse_peerDialogs($0) }
dict[-1831650802] = { return Api.UrlAuthResult.parse_urlAuthResultRequest($0) } dict[-1831650802] = { return Api.UrlAuthResult.parse_urlAuthResultRequest($0) }
dict[-1886646706] = { return Api.UrlAuthResult.parse_urlAuthResultAccepted($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[42402760] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmoji($0) }
dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) } dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) }
dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($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[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) }
dict[-1519637954] = { return Api.updates.State.parse_state($0) } dict[-1519637954] = { return Api.updates.State.parse_state($0) }
dict[537022650] = { return Api.User.parse_userEmpty($0) } dict[-742634630] = { return Api.User.parse_userEmpty($0) }
dict[-1820043071] = { return Api.User.parse_user($0) } dict[1073147056] = { return Api.User.parse_user($0) }
dict[-1868117372] = { return Api.Message.parse_messageEmpty($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[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[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[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) }
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) } dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
dict[-1160743548] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($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[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) }
dict[541839704] = { return Api.phone.ExportedGroupCallInvite.parse_exportedGroupCallInvite($0) } dict[541839704] = { return Api.phone.ExportedGroupCallInvite.parse_exportedGroupCallInvite($0) }
dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) } dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) }
dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) } dict[-2023500831] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) }
dict[1061556205] = { return Api.ChatParticipants.parse_chatParticipants($0) } dict[1018991608] = { return Api.ChatParticipants.parse_chatParticipants($0) }
dict[1949890536] = { return Api.DialogFilter.parse_dialogFilter($0) } dict[1949890536] = { return Api.DialogFilter.parse_dialogFilter($0) }
dict[-1056001329] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsSaved($0) } dict[-1056001329] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsSaved($0) }
dict[873977640] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentials($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[70813275] = { return Api.InputStickeredMedia.parse_inputStickeredMediaDocument($0) }
dict[1421174295] = { return Api.WebPageAttribute.parse_webPageAttributeTheme($0) } dict[1421174295] = { return Api.WebPageAttribute.parse_webPageAttributeTheme($0) }
dict[-958657434] = { return Api.messages.FeaturedStickers.parse_featuredStickersNotModified($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[-318022605] = { return Api.ChatTheme.parse_chatTheme($0) }
dict[-2048646399] = { return Api.PhoneCallDiscardReason.parse_phoneCallDiscardReasonMissed($0) } dict[-2048646399] = { return Api.PhoneCallDiscardReason.parse_phoneCallDiscardReasonMissed($0) }
dict[-527056480] = { return Api.PhoneCallDiscardReason.parse_phoneCallDiscardReasonDisconnect($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[2010127419] = { return Api.contacts.ImportedContacts.parse_importedContacts($0) }
dict[-1678949555] = { return Api.InputWebDocument.parse_inputWebDocument($0) } dict[-1678949555] = { return Api.InputWebDocument.parse_inputWebDocument($0) }
dict[-326966976] = { return Api.phone.PhoneCall.parse_phoneCall($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[-1132882121] = { return Api.Bool.parse_boolFalse($0) }
dict[-1720552011] = { return Api.Bool.parse_boolTrue($0) } dict[-1720552011] = { return Api.Bool.parse_boolTrue($0) }
dict[-892239370] = { return Api.LangPackString.parse_langPackString($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[894081801] = { return Api.BotInlineMessage.parse_botInlineMessageMediaInvoice($0) }
dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) } dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) }
dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) } dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) }
dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) } dict[750063767] = { return Api.messages.FavedStickers.parse_favedStickers($0) }
dict[1847917725] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) } dict[-1316944408] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) }
dict[-1389486888] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) } dict[-1389486888] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) }
dict[-1392388579] = { return Api.Authorization.parse_authorization($0) } dict[-1392388579] = { return Api.Authorization.parse_authorization($0) }
dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) } dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) }
dict[-395967805] = { return Api.messages.AllStickers.parse_allStickersNotModified($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[-1655957568] = { return Api.PhoneConnection.parse_phoneConnection($0) }
dict[1667228533] = { return Api.PhoneConnection.parse_phoneConnectionWebrtc($0) } dict[1667228533] = { return Api.PhoneConnection.parse_phoneConnectionWebrtc($0) }
dict[-206688531] = { return Api.help.UserInfo.parse_userInfoEmpty($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[1352683077] = { return Api.account.PrivacyRules.parse_privacyRules($0) }
dict[-123988] = { return Api.PrivacyRule.parse_privacyValueAllowContacts($0) } dict[-123988] = { return Api.PrivacyRule.parse_privacyValueAllowContacts($0) }
dict[1698855810] = { return Api.PrivacyRule.parse_privacyValueAllowAll($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[-125240806] = { return Api.PrivacyRule.parse_privacyValueDisallowContacts($0) }
dict[-1955338397] = { return Api.PrivacyRule.parse_privacyValueDisallowAll($0) } dict[-1955338397] = { return Api.PrivacyRule.parse_privacyValueDisallowAll($0) }
dict[209668535] = { return Api.PrivacyRule.parse_privacyValueDisallowUsers($0) } dict[-463335103] = { return Api.PrivacyRule.parse_privacyValueDisallowUsers($0) }
dict[415136107] = { return Api.PrivacyRule.parse_privacyValueAllowChatParticipants($0) } dict[1796427406] = { return Api.PrivacyRule.parse_privacyValueAllowChatParticipants($0) }
dict[-1397881200] = { return Api.PrivacyRule.parse_privacyValueDisallowChatParticipants($0) } dict[1103656293] = { return Api.PrivacyRule.parse_privacyValueDisallowChatParticipants($0) }
dict[-1230047312] = { return Api.MessageAction.parse_messageActionEmpty($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[-1247687078] = { return Api.MessageAction.parse_messageActionChatEditTitle($0) }
dict[2144015272] = { return Api.MessageAction.parse_messageActionChatEditPhoto($0) } dict[2144015272] = { return Api.MessageAction.parse_messageActionChatEditPhoto($0) }
dict[-1780220945] = { return Api.MessageAction.parse_messageActionChatDeletePhoto($0) } dict[-1780220945] = { return Api.MessageAction.parse_messageActionChatDeletePhoto($0) }
dict[1217033015] = { return Api.MessageAction.parse_messageActionChatAddUser($0) } dict[365886720] = { return Api.MessageAction.parse_messageActionChatAddUser($0) }
dict[-1297179892] = { return Api.MessageAction.parse_messageActionChatDeleteUser($0) } dict[-1539362612] = { return Api.MessageAction.parse_messageActionChatDeleteUser($0) }
dict[-123931160] = { return Api.MessageAction.parse_messageActionChatJoinedByLink($0) } dict[51520707] = { return Api.MessageAction.parse_messageActionChatJoinedByLink($0) }
dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) } dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) }
dict[1371385889] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) } dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) }
dict[-1336546578] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) } dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) }
dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) } dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) }
dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) } dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) }
dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($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[-202219658] = { return Api.MessageAction.parse_messageActionContactSignUp($0) }
dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) } dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) }
dict[2047704898] = { return Api.MessageAction.parse_messageActionGroupCall($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[-1441072131] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) } dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) }
dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) } dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) } dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) }
dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) } dict[-987599081] = { return Api.PhoneCall.parse_phoneCallWaiting($0) }
dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) } dict[347139340] = { return Api.PhoneCall.parse_phoneCallRequested($0) }
dict[-1719909046] = { return Api.PhoneCall.parse_phoneCallAccepted($0) } dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) }
dict[-2025673089] = { return Api.PhoneCall.parse_phoneCall($0) } dict[-1770029977] = { return Api.PhoneCall.parse_phoneCall($0) }
dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) } dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) }
dict[-483352705] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdateEmpty($0) } dict[-483352705] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdateEmpty($0) }
dict[686618977] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdate($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[-1917524116] = { return Api.ThemeSettings.parse_themeSettings($0) }
dict[-1353671392] = { return Api.PeerNotifySettings.parse_peerNotifySettings($0) } dict[-1353671392] = { return Api.PeerNotifySettings.parse_peerNotifySettings($0) }
dict[-1995686519] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID($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[-1282352120] = { return Api.PageRelatedArticle.parse_pageRelatedArticle($0) }
dict[313694676] = { return Api.StickerPack.parse_stickerPack($0) } dict[313694676] = { return Api.StickerPack.parse_stickerPack($0) }
dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($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[681706865] = { return Api.MessageEntity.parse_messageEntityCode($0) }
dict[1938967520] = { return Api.MessageEntity.parse_messageEntityPre($0) } dict[1938967520] = { return Api.MessageEntity.parse_messageEntityPre($0) }
dict[1990644519] = { return Api.MessageEntity.parse_messageEntityTextUrl($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[546203849] = { return Api.MessageEntity.parse_inputMessageEntityMentionName($0) }
dict[-1687559349] = { return Api.MessageEntity.parse_messageEntityPhone($0) } dict[-1687559349] = { return Api.MessageEntity.parse_messageEntityPhone($0) }
dict[1280209983] = { return Api.MessageEntity.parse_messageEntityCashtag($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[1577484359] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) }
dict[-1730311882] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) } dict[-1730311882] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) }
dict[-1417756512] = { return Api.EncryptedChat.parse_encryptedChatEmpty($0) } dict[-1417756512] = { return Api.EncryptedChat.parse_encryptedChatEmpty($0) }
dict[1006044124] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) } dict[1722964307] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) }
dict[1651608194] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) } dict[1223809356] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) }
dict[-94974410] = { return Api.EncryptedChat.parse_encryptedChat($0) } dict[1643173063] = { return Api.EncryptedChat.parse_encryptedChat($0) }
dict[505183301] = { return Api.EncryptedChat.parse_encryptedChatDiscarded($0) } dict[505183301] = { return Api.EncryptedChat.parse_encryptedChatDiscarded($0) }
dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) } dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) }
dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) } dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) }
dict[922273905] = { return Api.Document.parse_documentEmpty($0) } dict[922273905] = { return Api.Document.parse_documentEmpty($0) }
dict[512177195] = { return Api.Document.parse_document($0) } dict[512177195] = { return Api.Document.parse_document($0) }
dict[-1707344487] = { return Api.messages.HighScores.parse_highScores($0) } dict[-1707344487] = { return Api.messages.HighScores.parse_highScores($0) }
dict[-892779534] = { return Api.WebAuthorization.parse_webAuthorization($0) } dict[-1493633966] = { return Api.WebAuthorization.parse_webAuthorization($0) }
dict[-805141448] = { return Api.ImportedContact.parse_importedContact($0) } dict[-1052885936] = { return Api.ImportedContact.parse_importedContact($0) }
dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) } dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) }
return dict return dict
}() }()

View File

@ -368,7 +368,7 @@ public struct messages {
} }
public enum Stickers: TypeConstructorDescription { public enum Stickers: TypeConstructorDescription {
case stickersNotModified case stickersNotModified
case stickers(hash: Int32, stickers: [Api.Document]) case stickers(hash: Int64, stickers: [Api.Document])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -380,9 +380,9 @@ public struct messages {
break break
case .stickers(let hash, let stickers): case .stickers(let hash, let stickers):
if boxed { 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(481674261)
buffer.appendInt32(Int32(stickers.count)) buffer.appendInt32(Int32(stickers.count))
for item in stickers { for item in stickers {
@ -405,8 +405,8 @@ public struct messages {
return Api.messages.Stickers.stickersNotModified return Api.messages.Stickers.stickersNotModified
} }
public static func parse_stickers(_ reader: BufferReader) -> Stickers? { public static func parse_stickers(_ reader: BufferReader) -> Stickers? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.Document]? var _2: [Api.Document]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
@ -424,7 +424,7 @@ public struct messages {
} }
public enum FoundStickerSets: TypeConstructorDescription { public enum FoundStickerSets: TypeConstructorDescription {
case foundStickerSetsNotModified case foundStickerSetsNotModified
case foundStickerSets(hash: Int32, sets: [Api.StickerSetCovered]) case foundStickerSets(hash: Int64, sets: [Api.StickerSetCovered])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -436,9 +436,9 @@ public struct messages {
break break
case .foundStickerSets(let hash, let sets): case .foundStickerSets(let hash, let sets):
if boxed { 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(481674261)
buffer.appendInt32(Int32(sets.count)) buffer.appendInt32(Int32(sets.count))
for item in sets { for item in sets {
@ -461,8 +461,8 @@ public struct messages {
return Api.messages.FoundStickerSets.foundStickerSetsNotModified return Api.messages.FoundStickerSets.foundStickerSetsNotModified
} }
public static func parse_foundStickerSets(_ reader: BufferReader) -> FoundStickerSets? { public static func parse_foundStickerSets(_ reader: BufferReader) -> FoundStickerSets? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.StickerSetCovered]? var _2: [Api.StickerSetCovered]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
@ -1286,7 +1286,7 @@ public struct messages {
} }
public enum SavedGifs: TypeConstructorDescription { public enum SavedGifs: TypeConstructorDescription {
case savedGifsNotModified case savedGifsNotModified
case savedGifs(hash: Int32, gifs: [Api.Document]) case savedGifs(hash: Int64, gifs: [Api.Document])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -1298,9 +1298,9 @@ public struct messages {
break break
case .savedGifs(let hash, let gifs): case .savedGifs(let hash, let gifs):
if boxed { 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(481674261)
buffer.appendInt32(Int32(gifs.count)) buffer.appendInt32(Int32(gifs.count))
for item in gifs { for item in gifs {
@ -1323,8 +1323,8 @@ public struct messages {
return Api.messages.SavedGifs.savedGifsNotModified return Api.messages.SavedGifs.savedGifsNotModified
} }
public static func parse_savedGifs(_ reader: BufferReader) -> SavedGifs? { public static func parse_savedGifs(_ reader: BufferReader) -> SavedGifs? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.Document]? var _2: [Api.Document]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
@ -1852,7 +1852,7 @@ public struct messages {
} }
public enum RecentStickers: TypeConstructorDescription { public enum RecentStickers: TypeConstructorDescription {
case recentStickersNotModified 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) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -1864,9 +1864,9 @@ public struct messages {
break break
case .recentStickers(let hash, let packs, let stickers, let dates): case .recentStickers(let hash, let packs, let stickers, let dates):
if boxed { 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(481674261)
buffer.appendInt32(Int32(packs.count)) buffer.appendInt32(Int32(packs.count))
for item in packs { for item in packs {
@ -1899,8 +1899,8 @@ public struct messages {
return Api.messages.RecentStickers.recentStickersNotModified return Api.messages.RecentStickers.recentStickersNotModified
} }
public static func parse_recentStickers(_ reader: BufferReader) -> RecentStickers? { public static func parse_recentStickers(_ reader: BufferReader) -> RecentStickers? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.StickerPack]? var _2: [Api.StickerPack]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self)
@ -1928,7 +1928,7 @@ public struct messages {
} }
public enum FeaturedStickers: TypeConstructorDescription { public enum FeaturedStickers: TypeConstructorDescription {
case featuredStickersNotModified(count: Int32) 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) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -1940,9 +1940,9 @@ public struct messages {
break break
case .featuredStickers(let hash, let count, let sets, let unread): case .featuredStickers(let hash, let count, let sets, let unread):
if boxed { 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) serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(sets.count)) buffer.appendInt32(Int32(sets.count))
@ -1979,8 +1979,8 @@ public struct messages {
} }
} }
public static func parse_featuredStickers(_ reader: BufferReader) -> FeaturedStickers? { public static func parse_featuredStickers(_ reader: BufferReader) -> FeaturedStickers? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: Int32? var _2: Int32?
_2 = reader.readInt32() _2 = reader.readInt32()
var _3: [Api.StickerSetCovered]? var _3: [Api.StickerSetCovered]?
@ -2156,7 +2156,7 @@ public struct messages {
} }
public enum FavedStickers: TypeConstructorDescription { public enum FavedStickers: TypeConstructorDescription {
case favedStickersNotModified 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) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -2168,9 +2168,9 @@ public struct messages {
break break
case .favedStickers(let hash, let packs, let stickers): case .favedStickers(let hash, let packs, let stickers):
if boxed { 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(481674261)
buffer.appendInt32(Int32(packs.count)) buffer.appendInt32(Int32(packs.count))
for item in packs { for item in packs {
@ -2198,8 +2198,8 @@ public struct messages {
return Api.messages.FavedStickers.favedStickersNotModified return Api.messages.FavedStickers.favedStickersNotModified
} }
public static func parse_favedStickers(_ reader: BufferReader) -> FavedStickers? { public static func parse_favedStickers(_ reader: BufferReader) -> FavedStickers? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.StickerPack]? var _2: [Api.StickerPack]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self)
@ -2222,7 +2222,7 @@ public struct messages {
} }
public enum AllStickers: TypeConstructorDescription { public enum AllStickers: TypeConstructorDescription {
case allStickersNotModified case allStickersNotModified
case allStickers(hash: Int32, sets: [Api.StickerSet]) case allStickers(hash: Int64, sets: [Api.StickerSet])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -2234,9 +2234,9 @@ public struct messages {
break break
case .allStickers(let hash, let sets): case .allStickers(let hash, let sets):
if boxed { 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(481674261)
buffer.appendInt32(Int32(sets.count)) buffer.appendInt32(Int32(sets.count))
for item in sets { for item in sets {
@ -2259,8 +2259,8 @@ public struct messages {
return Api.messages.AllStickers.allStickersNotModified return Api.messages.AllStickers.allStickersNotModified
} }
public static func parse_allStickers(_ reader: BufferReader) -> AllStickers? { public static func parse_allStickers(_ reader: BufferReader) -> AllStickers? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.StickerSet]? var _2: [Api.StickerSet]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSet.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSet.self)

File diff suppressed because it is too large Load Diff

View File

@ -301,19 +301,19 @@ public struct payments {
} }
public enum PaymentForm: TypeConstructorDescription { 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) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { 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): 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 { if boxed {
buffer.appendInt32(-1928649707) buffer.appendInt32(378828315)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(formId, 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) invoice.serialize(buffer, true)
serializeInt32(providerId, buffer: buffer, boxed: false) serializeInt64(providerId, buffer: buffer, boxed: false)
serializeString(url, 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 {serializeString(nativeProvider!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {nativeParams!.serialize(buffer, true)} if Int(flags) & Int(1 << 4) != 0 {nativeParams!.serialize(buffer, true)}
@ -340,14 +340,14 @@ public struct payments {
_1 = reader.readInt32() _1 = reader.readInt32()
var _2: Int64? var _2: Int64?
_2 = reader.readInt64() _2 = reader.readInt64()
var _3: Int32? var _3: Int64?
_3 = reader.readInt32() _3 = reader.readInt64()
var _4: Api.Invoice? var _4: Api.Invoice?
if let signature = reader.readInt32() { if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.Invoice _4 = Api.parse(reader, signature: signature) as? Api.Invoice
} }
var _5: Int32? var _5: Int64?
_5 = reader.readInt32() _5 = reader.readInt64()
var _6: String? var _6: String?
_6 = parseString(reader) _6 = parseString(reader)
var _7: String? var _7: String?
@ -389,18 +389,18 @@ public struct payments {
} }
public enum PaymentReceipt: TypeConstructorDescription { 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) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { 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): 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 { if boxed {
buffer.appendInt32(280319440) buffer.appendInt32(1891958275)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false)
serializeInt32(botId, buffer: buffer, boxed: false) serializeInt64(botId, buffer: buffer, boxed: false)
serializeInt32(providerId, buffer: buffer, boxed: false) serializeInt64(providerId, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false)
serializeString(description, buffer: buffer, boxed: false) serializeString(description, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
@ -432,10 +432,10 @@ public struct payments {
_1 = reader.readInt32() _1 = reader.readInt32()
var _2: Int32? var _2: Int32?
_2 = reader.readInt32() _2 = reader.readInt32()
var _3: Int32? var _3: Int64?
_3 = reader.readInt32() _3 = reader.readInt64()
var _4: Int32? var _4: Int64?
_4 = reader.readInt32() _4 = reader.readInt64()
var _5: String? var _5: String?
_5 = parseString(reader) _5 = parseString(reader)
var _6: String? var _6: String?
@ -1081,15 +1081,15 @@ public struct auth {
} }
public enum ExportedAuthorization: TypeConstructorDescription { public enum ExportedAuthorization: TypeConstructorDescription {
case exportedAuthorization(id: Int32, bytes: Buffer) case exportedAuthorization(id: Int64, bytes: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
case .exportedAuthorization(let id, let bytes): case .exportedAuthorization(let id, let bytes):
if boxed { 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) serializeBytes(bytes, buffer: buffer, boxed: false)
break break
} }
@ -1103,8 +1103,8 @@ public struct auth {
} }
public static func parse_exportedAuthorization(_ reader: BufferReader) -> ExportedAuthorization? { public static func parse_exportedAuthorization(_ reader: BufferReader) -> ExportedAuthorization? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: Buffer? var _2: Buffer?
_2 = parseBytes(reader) _2 = parseBytes(reader)
let _c1 = _1 != nil let _c1 = _1 != nil

View File

@ -916,7 +916,7 @@ public struct account {
} }
public enum Themes: TypeConstructorDescription { public enum Themes: TypeConstructorDescription {
case themesNotModified case themesNotModified
case themes(hash: Int32, themes: [Api.Theme]) case themes(hash: Int64, themes: [Api.Theme])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -928,9 +928,9 @@ public struct account {
break break
case .themes(let hash, let themes): case .themes(let hash, let themes):
if boxed { 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(481674261)
buffer.appendInt32(Int32(themes.count)) buffer.appendInt32(Int32(themes.count))
for item in themes { for item in themes {
@ -953,8 +953,8 @@ public struct account {
return Api.account.Themes.themesNotModified return Api.account.Themes.themesNotModified
} }
public static func parse_themes(_ reader: BufferReader) -> Themes? { public static func parse_themes(_ reader: BufferReader) -> Themes? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.Theme]? var _2: [Api.Theme]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Theme.self) _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Theme.self)
@ -972,7 +972,7 @@ public struct account {
} }
public enum WallPapers: TypeConstructorDescription { public enum WallPapers: TypeConstructorDescription {
case wallPapersNotModified case wallPapersNotModified
case wallPapers(hash: Int32, wallpapers: [Api.WallPaper]) case wallPapers(hash: Int64, wallpapers: [Api.WallPaper])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -984,9 +984,9 @@ public struct account {
break break
case .wallPapers(let hash, let wallpapers): case .wallPapers(let hash, let wallpapers):
if boxed { 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(481674261)
buffer.appendInt32(Int32(wallpapers.count)) buffer.appendInt32(Int32(wallpapers.count))
for item in wallpapers { for item in wallpapers {
@ -1009,8 +1009,8 @@ public struct account {
return Api.account.WallPapers.wallPapersNotModified return Api.account.WallPapers.wallPapersNotModified
} }
public static func parse_wallPapers(_ reader: BufferReader) -> WallPapers? { public static func parse_wallPapers(_ reader: BufferReader) -> WallPapers? {
var _1: Int32? var _1: Int64?
_1 = reader.readInt32() _1 = reader.readInt64()
var _2: [Api.WallPaper]? var _2: [Api.WallPaper]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self) _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<Api.messages.Dialogs>) { public static func getDialogs(flags: Int32, folderId: Int32?, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Dialogs>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1594999949) buffer.appendInt32(-1594569905)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)}
serializeInt32(offsetDate, buffer: buffer, boxed: false) serializeInt32(offsetDate, buffer: buffer, boxed: false)
serializeInt32(offsetId, buffer: buffer, boxed: false) serializeInt32(offsetId, buffer: buffer, boxed: false)
offsetPeer.serialize(buffer, true) offsetPeer.serialize(buffer, true)
serializeInt32(limit, 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.getDialogs", parameters: [("flags", flags), ("folderId", folderId), ("offsetDate", offsetDate), ("offsetId", offsetId), ("offsetPeer", offsetPeer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Dialogs? in 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) let reader = BufferReader(buffer)
var result: Api.messages.Dialogs? 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<Api.messages.Messages>) { public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-591691168) buffer.appendInt32(1143203525)
peer.serialize(buffer, true) peer.serialize(buffer, true)
serializeInt32(offsetId, buffer: buffer, boxed: false) serializeInt32(offsetId, buffer: buffer, boxed: false)
serializeInt32(offsetDate, buffer: buffer, boxed: false) serializeInt32(offsetDate, buffer: buffer, boxed: false)
@ -2109,7 +2109,7 @@ public extension Api {
serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, 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 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) let reader = BufferReader(buffer)
var result: Api.messages.Messages? 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<Api.messages.Messages>) { 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<Api.messages.Messages>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(204812012) buffer.appendInt32(-1593989278)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true) peer.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false) serializeString(q, buffer: buffer, boxed: false)
@ -2136,7 +2136,7 @@ public extension Api {
serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, 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 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) let reader = BufferReader(buffer)
var result: Api.messages.Messages? var result: Api.messages.Messages?
@ -2355,13 +2355,13 @@ public extension Api {
}) })
} }
public static func getChats(id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) { public static func getChats(id: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(1013621127) buffer.appendInt32(1240027791)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(id.count)) buffer.appendInt32(Int32(id.count))
for item in id { 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 return (FunctionDescription(name: "messages.getChats", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -2373,10 +2373,10 @@ public extension Api {
}) })
} }
public static func getFullChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatFull>) { public static func getFullChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatFull>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(998448230) buffer.appendInt32(-1364194508)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getFullChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in return (FunctionDescription(name: "messages.getFullChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.ChatFull? var result: Api.messages.ChatFull?
@ -2387,10 +2387,10 @@ public extension Api {
}) })
} }
public static func editChatTitle(chatId: Int32, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) { public static func editChatTitle(chatId: Int64, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-599447467) buffer.appendInt32(1937260541)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
serializeString(title, 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 return (FunctionDescription(name: "messages.editChatTitle", parameters: [("chatId", chatId), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -2402,10 +2402,10 @@ public extension Api {
}) })
} }
public static func editChatPhoto(chatId: Int32, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) { public static func editChatPhoto(chatId: Int64, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-900957736) buffer.appendInt32(903730804)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
photo.serialize(buffer, true) photo.serialize(buffer, true)
return (FunctionDescription(name: "messages.editChatPhoto", parameters: [("chatId", chatId), ("photo", photo)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in return (FunctionDescription(name: "messages.editChatPhoto", parameters: [("chatId", chatId), ("photo", photo)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer) 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<Api.Updates>) { public static func addChatUser(chatId: Int64, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-106911223) buffer.appendInt32(-230206493)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
userId.serialize(buffer, true) userId.serialize(buffer, true)
serializeInt32(fwdLimit, buffer: buffer, boxed: false) 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 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<Api.Updates>) { public static func deleteChatUser(flags: Int32, chatId: Int64, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-986430054) buffer.appendInt32(-1575461717)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
userId.serialize(buffer, true) userId.serialize(buffer, true)
return (FunctionDescription(name: "messages.deleteChatUser", parameters: [("flags", flags), ("chatId", chatId), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in return (FunctionDescription(name: "messages.deleteChatUser", parameters: [("flags", flags), ("chatId", chatId), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -2657,11 +2657,11 @@ public extension Api {
}) })
} }
public static func getStickers(emoticon: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Stickers>) { public static func getStickers(emoticon: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Stickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(71126828) buffer.appendInt32(-710552671)
serializeString(emoticon, buffer: buffer, boxed: false) 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 return (FunctionDescription(name: "messages.getStickers", parameters: [("emoticon", emoticon), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Stickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.Stickers? var result: Api.messages.Stickers?
@ -2672,10 +2672,10 @@ public extension Api {
}) })
} }
public static func getAllStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) { public static func getAllStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(479598769) buffer.appendInt32(-1197432408)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getAllStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in return (FunctionDescription(name: "messages.getAllStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.AllStickers? 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<Api.Bool>) { public static func editChatAdmin(chatId: Int64, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1444503762) buffer.appendInt32(-1470377534)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
userId.serialize(buffer, true) userId.serialize(buffer, true)
isAdmin.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 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<Api.Updates>) { public static func migrateChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(363051235) buffer.appendInt32(-1568189671)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.migrateChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in return (FunctionDescription(name: "messages.migrateChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.Updates? var result: Api.Updates?
@ -2919,10 +2919,10 @@ public extension Api {
}) })
} }
public static func getSavedGifs(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SavedGifs>) { public static func getSavedGifs(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SavedGifs>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-2084618926) buffer.appendInt32(1559270965)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getSavedGifs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SavedGifs? in return (FunctionDescription(name: "messages.getSavedGifs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SavedGifs? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.SavedGifs? var result: Api.messages.SavedGifs?
@ -3163,10 +3163,10 @@ public extension Api {
}) })
} }
public static func getFeaturedStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FeaturedStickers>) { public static func getFeaturedStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FeaturedStickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(766298703) buffer.appendInt32(1685588756)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getFeaturedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in return (FunctionDescription(name: "messages.getFeaturedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.FeaturedStickers? var result: Api.messages.FeaturedStickers?
@ -3195,11 +3195,11 @@ public extension Api {
}) })
} }
public static func getRecentStickers(flags: Int32, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.RecentStickers>) { public static func getRecentStickers(flags: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.RecentStickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(1587647177) buffer.appendInt32(-1649852357)
serializeInt32(flags, buffer: buffer, boxed: false) 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 return (FunctionDescription(name: "messages.getRecentStickers", parameters: [("flags", flags), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.RecentStickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.RecentStickers? var result: Api.messages.RecentStickers?
@ -3256,10 +3256,10 @@ public extension Api {
}) })
} }
public static func getMaskStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) { public static func getMaskStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(1706608543) buffer.appendInt32(1678738104)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getMaskStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in return (FunctionDescription(name: "messages.getMaskStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.AllStickers? 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<Api.messages.Chats>) { public static func getCommonChats(userId: Api.InputUser, maxId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(218777796) buffer.appendInt32(-468934396)
userId.serialize(buffer, true) userId.serialize(buffer, true)
serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt64(maxId, buffer: buffer, boxed: false)
serializeInt32(limit, 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 return (FunctionDescription(name: "messages.getCommonChats", parameters: [("userId", userId), ("maxId", maxId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -3366,13 +3366,13 @@ public extension Api {
}) })
} }
public static func getAllChats(exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) { public static func getAllChats(exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-341307408) buffer.appendInt32(-2023787330)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(exceptIds.count)) buffer.appendInt32(Int32(exceptIds.count))
for item in exceptIds { 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 return (FunctionDescription(name: "messages.getAllChats", parameters: [("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -3516,10 +3516,10 @@ public extension Api {
}) })
} }
public static func getFavedStickers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FavedStickers>) { public static func getFavedStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FavedStickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(567151374) buffer.appendInt32(82946729)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getFavedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FavedStickers? in return (FunctionDescription(name: "messages.getFavedStickers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FavedStickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.FavedStickers? 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<Api.messages.Messages>) { public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1144759543) buffer.appendInt32(1881817312)
peer.serialize(buffer, true) peer.serialize(buffer, true)
serializeInt32(limit, 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.getRecentLocations", parameters: [("peer", peer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in return (FunctionDescription(name: "messages.getRecentLocations", parameters: [("peer", peer), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.Messages? 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<Api.messages.FoundStickerSets>) { public static func searchStickerSets(flags: Int32, q: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FoundStickerSets>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1028140917) buffer.appendInt32(896555914)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(q, 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 return (FunctionDescription(name: "messages.searchStickerSets", parameters: [("flags", flags), ("q", q), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FoundStickerSets? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.FoundStickerSets? var result: Api.messages.FoundStickerSets?
@ -3945,11 +3945,11 @@ public extension Api {
}) })
} }
public static func getScheduledHistory(peer: Api.InputPeer, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) { public static func getScheduledHistory(peer: Api.InputPeer, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-490575781) buffer.appendInt32(-183077365)
peer.serialize(buffer, true) 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 return (FunctionDescription(name: "messages.getScheduledHistory", parameters: [("peer", peer), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.Messages? 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<Api.messages.FeaturedStickers>) { public static func getOldFeaturedStickers(offset: Int32, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.FeaturedStickers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(1608974939) buffer.appendInt32(2127598753)
serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, 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 return (FunctionDescription(name: "messages.getOldFeaturedStickers", parameters: [("offset", offset), ("limit", limit), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.messages.FeaturedStickers? 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<Api.messages.Messages>) { 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<Api.messages.Messages>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(615875002) buffer.appendInt32(584962828)
peer.serialize(buffer, true) peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false) serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt32(offsetId, buffer: buffer, boxed: false) serializeInt32(offsetId, buffer: buffer, boxed: false)
@ -4144,7 +4144,7 @@ public extension Api {
serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, 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 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) let reader = BufferReader(buffer)
var result: Api.messages.Messages? var result: Api.messages.Messages?
@ -4200,10 +4200,10 @@ public extension Api {
}) })
} }
public static func deleteChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) { public static func deleteChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-2094760687) buffer.appendInt32(1540419152)
serializeInt32(chatId, buffer: buffer, boxed: false) serializeInt64(chatId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.deleteChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in return (FunctionDescription(name: "messages.deleteChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.Bool? var result: Api.Bool?
@ -4447,6 +4447,21 @@ public extension Api {
return result 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 struct channels {
public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) { public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
@ -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<Api.channels.ChannelParticipants>) { public static func getParticipants(channel: Api.InputChannel, filter: Api.ChannelParticipantsFilter, offset: Int32, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.channels.ChannelParticipants>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(306054633) buffer.appendInt32(2010044880)
channel.serialize(buffer, true) channel.serialize(buffer, true)
filter.serialize(buffer, true) filter.serialize(buffer, true)
serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, 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 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) let reader = BufferReader(buffer)
var result: Api.channels.ChannelParticipants? var result: Api.channels.ChannelParticipants?
@ -5343,10 +5358,10 @@ public extension Api {
}) })
} }
public static func importAuthorization(id: Int32, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) { public static func importAuthorization(id: Int64, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-470837741) buffer.appendInt32(-1518699091)
serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false)
serializeBytes(bytes, 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 return (FunctionDescription(name: "auth.importAuthorization", parameters: [("id", id), ("bytes", bytes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -5484,15 +5499,15 @@ public extension Api {
}) })
} }
public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.LoginToken>) { public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.LoginToken>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1313598185) buffer.appendInt32(-1210022402)
serializeInt32(apiId, buffer: buffer, boxed: false) serializeInt32(apiId, buffer: buffer, boxed: false)
serializeString(apiHash, buffer: buffer, boxed: false) serializeString(apiHash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(exceptIds.count)) buffer.appendInt32(Int32(exceptIds.count))
for item in exceptIds { 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 return (FunctionDescription(name: "auth.exportLoginToken", parameters: [("apiId", apiId), ("apiHash", apiHash), ("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.LoginToken? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -5680,10 +5695,10 @@ public extension Api {
} }
} }
public struct contacts { 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() let buffer = Buffer()
buffer.appendInt32(749357634) buffer.appendInt32(2061264541)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.getContactIDs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in return (FunctionDescription(name: "contacts.getContactIDs", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: [Int32]? var result: [Int32]?
@ -5708,10 +5723,10 @@ public extension Api {
}) })
} }
public static func getContacts(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.Contacts>) { public static func getContacts(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.Contacts>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1071414113) buffer.appendInt32(1574346258)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "contacts.getContacts", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Contacts? in return (FunctionDescription(name: "contacts.getContacts", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Contacts? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.contacts.Contacts? 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<Api.contacts.TopPeers>) { public static func getTopPeers(flags: Int32, offset: Int32, limit: Int32, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.contacts.TopPeers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-728224331) buffer.appendInt32(-1758168906)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false)
serializeInt32(limit, 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 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) let reader = BufferReader(buffer)
var result: Api.contacts.TopPeers? var result: Api.contacts.TopPeers?
@ -6646,9 +6661,9 @@ public extension Api {
} }
} }
public struct account { public struct account {
public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) { public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(1754754159) buffer.appendInt32(-326762118)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(tokenType, buffer: buffer, boxed: false) serializeInt32(tokenType, buffer: buffer, boxed: false)
serializeString(token, buffer: buffer, boxed: false) serializeString(token, buffer: buffer, boxed: false)
@ -6657,7 +6672,7 @@ public extension Api {
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUids.count)) buffer.appendInt32(Int32(otherUids.count))
for item in otherUids { 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 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) let reader = BufferReader(buffer)
@ -6669,15 +6684,15 @@ public extension Api {
}) })
} }
public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) { public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(813089983) buffer.appendInt32(1779249670)
serializeInt32(tokenType, buffer: buffer, boxed: false) serializeInt32(tokenType, buffer: buffer, boxed: false)
serializeString(token, buffer: buffer, boxed: false) serializeString(token, buffer: buffer, boxed: false)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(otherUids.count)) buffer.appendInt32(Int32(otherUids.count))
for item in otherUids { 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 return (FunctionDescription(name: "account.unregisterDevice", parameters: [("tokenType", tokenType), ("token", token), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
@ -6763,10 +6778,10 @@ public extension Api {
}) })
} }
public static func getWallPapers(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.WallPapers>) { public static func getWallPapers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.WallPapers>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1430579357) buffer.appendInt32(127302966)
serializeInt32(hash, buffer: buffer, boxed: false) serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "account.getWallPapers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.WallPapers? in return (FunctionDescription(name: "account.getWallPapers", parameters: [("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.WallPapers? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.account.WallPapers? 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<Api.account.AuthorizationForm>) { public static func getAuthorizationForm(botId: Int64, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.AuthorizationForm>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-1200903967) buffer.appendInt32(-1456907910)
serializeInt32(botId, buffer: buffer, boxed: false) serializeInt64(botId, buffer: buffer, boxed: false)
serializeString(scope, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false)
serializeString(publicKey, 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 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<Api.Bool>) { public static func acceptAuthorization(botId: Int64, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(-419267436) buffer.appendInt32(-202552205)
serializeInt32(botId, buffer: buffer, boxed: false) serializeInt64(botId, buffer: buffer, boxed: false)
serializeString(scope, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false)
serializeString(publicKey, buffer: buffer, boxed: false) serializeString(publicKey, buffer: buffer, boxed: false)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
@ -7583,11 +7598,11 @@ public extension Api {
}) })
} }
public static func getThemes(format: String, hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Themes>) { public static func getThemes(format: String, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.Themes>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(676939512) buffer.appendInt32(1913054296)
serializeString(format, buffer: buffer, boxed: false) 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 return (FunctionDescription(name: "account.getThemes", parameters: [("format", format), ("hash", hash)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Themes? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.account.Themes? var result: Api.account.Themes?

View File

@ -169,7 +169,7 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate {
func startCall(context: AccountContext, peerId: PeerId, isVideo: Bool, displayTitle: String) { func startCall(context: AccountContext, peerId: PeerId, isVideo: Bool, displayTitle: String) {
let uuid = UUID() let uuid = UUID()
self.currentStartCallAccount = (uuid, context) 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) let startCallAction = CXStartCallAction(call: uuid, handle: handle)
startCallAction.contactIdentifier = displayTitle startCallAction.contactIdentifier = displayTitle

View File

@ -240,7 +240,7 @@ private final class CallRatingAlertContentNode: AlertContentNode {
} }
func rateCallAndSendLogs(engine: TelegramEngine, callId: CallId, starsCount: Int, comment: String, userInitiated: Bool, includeLogs: Bool) -> Signal<Void, NoError> { func rateCallAndSendLogs(engine: TelegramEngine, callId: CallId, starsCount: Int, comment: String, userInitiated: Bool, includeLogs: Bool) -> Signal<Void, NoError> {
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) let rate = engine.calls.rateCall(callId: callId, starsCount: Int32(starsCount), comment: comment, userInitiated: userInitiated)
if includeLogs { if includeLogs {

View File

@ -204,8 +204,8 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
}) })
startCallImpl = { [weak self] context, uuid, handle, isVideo in startCallImpl = { [weak self] context, uuid, handle, isVideo in
if let strongSelf = self, let userId = Int32(handle) { if let strongSelf = self, let userId = Int64(handle) {
return strongSelf.startCall(context: context, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), isVideo: isVideo, internalId: uuid) return strongSelf.startCall(context: context, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), isVideo: isVideo, internalId: uuid)
|> take(1) |> take(1)
|> map { result -> Bool in |> map { result -> Bool in
return result return result

View File

@ -106,7 +106,9 @@ public class UnauthorizedAccount {
network.context.performBatchUpdates({ network.context.performBatchUpdates({
var datacenterIds: [Int] = [1, 2] var datacenterIds: [Int] = [1, 2]
if !testingEnvironment { if testingEnvironment {
datacenterIds = [3]
} else {
datacenterIds.append(contentsOf: [4]) datacenterIds.append(contentsOf: [4])
} }
for id in datacenterIds { for id in datacenterIds {

View File

@ -354,7 +354,7 @@ struct AccountMutableState {
for chat in chats { for chat in chats {
switch chat { switch chat {
case let .channel(_, _, _, _, _, _, _, _, _, _, _, _, participantsCount): case let .channel(_, _, _, _, _, _, _, _, _, _, _, participantsCount):
if let participantsCount = participantsCount { if let participantsCount = participantsCount {
self.addOperation(.UpdateCachedPeerData(chat.peerId, { current in self.addOperation(.UpdateCachedPeerData(chat.peerId, { current in
var previous: CachedChannelData var previous: CachedChannelData
@ -416,7 +416,7 @@ struct AccountMutableState {
switch user { switch user {
case let .user(_, id, _, _, _, _, _, _, status, _, _, _, _): case let .user(_, id, _, _, _, _, _, _, status, _, _, _, _):
if let status = 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 break
case .userEmpty: case .userEmpty:

View File

@ -130,7 +130,7 @@ private var declaredEncodables: Void = {
declareEncodable(CloudChatRemoveMessagesOperation.self, f: { CloudChatRemoveMessagesOperation(decoder: $0) }) declareEncodable(CloudChatRemoveMessagesOperation.self, f: { CloudChatRemoveMessagesOperation(decoder: $0) })
declareEncodable(AutoremoveTimeoutMessageAttribute.self, f: { AutoremoveTimeoutMessageAttribute(decoder: $0) }) declareEncodable(AutoremoveTimeoutMessageAttribute.self, f: { AutoremoveTimeoutMessageAttribute(decoder: $0) })
declareEncodable(AutoclearTimeoutMessageAttribute.self, f: { AutoclearTimeoutMessageAttribute(decoder: $0) }) declareEncodable(AutoclearTimeoutMessageAttribute.self, f: { AutoclearTimeoutMessageAttribute(decoder: $0) })
declareEncodable(GlobalNotificationSettings.self, f: { GlobalNotificationSettings(decoder: $0) }) //declareEncodable(GlobalNotificationSettings.self, f: { GlobalNotificationSettings(decoder: $0) })
declareEncodable(CloudChatRemoveChatOperation.self, f: { CloudChatRemoveChatOperation(decoder: $0) }) declareEncodable(CloudChatRemoveChatOperation.self, f: { CloudChatRemoveChatOperation(decoder: $0) })
declareEncodable(SynchronizePinnedChatsOperation.self, f: { SynchronizePinnedChatsOperation(decoder: $0) }) declareEncodable(SynchronizePinnedChatsOperation.self, f: { SynchronizePinnedChatsOperation(decoder: $0) })
declareEncodable(SynchronizeConsumeMessageContentsOperation.self, f: { SynchronizeConsumeMessageContentsOperation(decoder: $0) }) declareEncodable(SynchronizeConsumeMessageContentsOperation.self, f: { SynchronizeConsumeMessageContentsOperation(decoder: $0) })
@ -223,8 +223,8 @@ private var declaredEncodables: Void = {
declareEncodable(CachedChatContextResult.self, f: { CachedChatContextResult(decoder: $0) }) declareEncodable(CachedChatContextResult.self, f: { CachedChatContextResult(decoder: $0) })
declareEncodable(PeerAccessRestrictionInfo.self, f: { PeerAccessRestrictionInfo(decoder: $0) }) declareEncodable(PeerAccessRestrictionInfo.self, f: { PeerAccessRestrictionInfo(decoder: $0) })
declareEncodable(TelegramMediaImage.VideoRepresentation.self, f: { TelegramMediaImage.VideoRepresentation(decoder: $0) }) declareEncodable(TelegramMediaImage.VideoRepresentation.self, f: { TelegramMediaImage.VideoRepresentation(decoder: $0) })
declareEncodable(Country.self, f: { Country(decoder: $0) }) //declareEncodable(Country.self, f: { Country(decoder: $0) })
declareEncodable(Country.CountryCode.self, f: { Country.CountryCode(decoder: $0) }) //declareEncodable(Country.CountryCode.self, f: { Country.CountryCode(decoder: $0) })
//declareEncodable(CountriesList.self, f: { CountriesList(decoder: $0) }) //declareEncodable(CountriesList.self, f: { CountriesList(decoder: $0) })
declareEncodable(ValidationMessageAttribute.self, f: { ValidationMessageAttribute(decoder: $0) }) declareEncodable(ValidationMessageAttribute.self, f: { ValidationMessageAttribute(decoder: $0) })
declareEncodable(EmojiSearchQueryMessageAttribute.self, f: { EmojiSearchQueryMessageAttribute(decoder: $0) }) declareEncodable(EmojiSearchQueryMessageAttribute.self, f: { EmojiSearchQueryMessageAttribute(decoder: $0) })
@ -235,7 +235,7 @@ private var declaredEncodables: Void = {
//declareEncodable(WallpapersState.self, f: { WallpapersState(decoder: $0) }) //declareEncodable(WallpapersState.self, f: { WallpapersState(decoder: $0) })
declareEncodable(WallpaperDataResource.self, f: { WallpaperDataResource(decoder: $0) }) declareEncodable(WallpaperDataResource.self, f: { WallpaperDataResource(decoder: $0) })
declareEncodable(ForwardOptionsMessageAttribute.self, f: { ForwardOptionsMessageAttribute(decoder: $0) }) declareEncodable(ForwardOptionsMessageAttribute.self, f: { ForwardOptionsMessageAttribute(decoder: $0) })
declareEncodable(ChatTheme.self, f: { ChatTheme(decoder: $0) }) //declareEncodable(ChatTheme.self, f: { ChatTheme(decoder: $0) })
//declareEncodable(ChatThemes.self, f: { ChatThemes(decoder: $0) }) //declareEncodable(ChatThemes.self, f: { ChatThemes(decoder: $0) })
return return

View File

@ -29,7 +29,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
if let migratedTo = migratedTo { if let migratedTo = migratedTo {
switch migratedTo { switch migratedTo {
case let .inputChannel(channelId, accessHash): 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: case .inputChannelEmpty:
break break
case .inputChannelFromMessage: case .inputChannelFromMessage:
@ -52,12 +52,12 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
if (flags & Int32(1 << 24)) != 0 { if (flags & Int32(1 << 24)) != 0 {
groupFlags.insert(.hasActiveVoiceChat) 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): 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): 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) 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, version, restrictionReason, adminRights, bannedRights, defaultBannedRights, _): case let .channel(flags, id, accessHash, title, username, photo, date, restrictionReason, adminRights, bannedRights, defaultBannedRights, _):
let isMin = (flags & (1 << 12)) != 0 let isMin = (flags & (1 << 12)) != 0
let participationStatus: TelegramChannelParticipationStatus 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): case let .channelForbidden(flags, id, accessHash, title, untilDate):
let info: TelegramChannelInfo let info: TelegramChannelInfo
if (flags & Int32(1 << 8)) != 0 { if (flags & Int32(1 << 8)) != 0 {
@ -137,7 +137,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? {
info = .broadcast(TelegramChannelBroadcastInfo(flags: [])) 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 { switch rhs {
case .chat, .chatEmpty, .chatForbidden, .channelForbidden: case .chat, .chatEmpty, .chatForbidden, .channelForbidden:
return parseTelegramGroupOrChannel(chat: rhs) 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 let isMin = (flags & (1 << 12)) != 0
if accessHash != nil && !isMin { if accessHash != nil && !isMin {
return parseTelegramGroupOrChannel(chat: rhs) return parseTelegramGroupOrChannel(chat: rhs)

View File

@ -7,11 +7,11 @@ public extension PeerReference {
var id: PeerId { var id: PeerId {
switch self { switch self {
case let .user(id, _): 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): 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, _): 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? { func forceApiInputPeer(_ peer: Peer) -> Api.InputPeer? {
switch peer { switch peer {
case let user as TelegramUser: 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: 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: case let channel as TelegramChannel:
if let accessHash = channel.accessHash { 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 { } else {
return nil return nil
} }
@ -65,12 +65,12 @@ func forceApiInputPeer(_ peer: Peer) -> Api.InputPeer? {
func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { func apiInputPeer(_ peer: Peer) -> Api.InputPeer? {
switch peer { switch peer {
case let user as TelegramUser where user.accessHash != nil: 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: 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: case let channel as TelegramChannel:
if let accessHash = channel.accessHash { 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 { } else {
return nil return nil
} }
@ -81,7 +81,7 @@ func apiInputPeer(_ peer: Peer) -> Api.InputPeer? {
func apiInputChannel(_ peer: Peer) -> Api.InputChannel? { func apiInputChannel(_ peer: Peer) -> Api.InputChannel? {
if let channel = peer as? TelegramChannel, let accessHash = channel.accessHash { 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 { } else {
return nil return nil
} }
@ -89,7 +89,7 @@ func apiInputChannel(_ peer: Peer) -> Api.InputChannel? {
func apiInputUser(_ peer: Peer) -> Api.InputUser? { func apiInputUser(_ peer: Peer) -> Api.InputUser? {
if let user = peer as? TelegramUser, let accessHash = user.accessHash { 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 { } else {
return nil return nil
} }
@ -97,7 +97,7 @@ func apiInputUser(_ peer: Peer) -> Api.InputUser? {
func apiInputSecretChat(_ peer: Peer) -> Api.InputEncryptedChat? { func apiInputSecretChat(_ peer: Peer) -> Api.InputEncryptedChat? {
if let chat = peer as? TelegramSecretChat { 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 { } else {
return nil return nil
} }

View File

@ -198,17 +198,17 @@ extension ChannelParticipant {
init(apiParticipant: Api.ChannelParticipant) { init(apiParticipant: Api.ChannelParticipant) {
switch apiParticipant { switch apiParticipant {
case let .channelParticipant(userId, date): 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): 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): case let .channelParticipantBanned(flags, userId, restrictedBy, date, bannedRights):
let hasLeft = (flags & (1 << 0)) != 0 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) self = .member(id: userId.peerId, invitedAt: date, adminInfo: nil, banInfo: banInfo, rank: nil)
case let .channelParticipantAdmin(flags, userId, _, promotedBy, date, adminRights, rank: rank): 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): 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): case let .channelParticipantLeft(userId):
self = .member(id: userId.peerId, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil) self = .member(id: userId.peerId, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil)
} }

View File

@ -7,11 +7,11 @@ extension GroupParticipant {
init(apiParticipant: Api.ChatParticipant) { init(apiParticipant: Api.ChatParticipant) {
switch apiParticipant { switch apiParticipant {
case let .chatParticipantCreator(userId): 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): 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): 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)
} }
} }
} }

View File

@ -7,7 +7,7 @@ extension ExportedInvitation {
init(apiExportedInvite: Api.ExportedChatInvite) { init(apiExportedInvite: Api.ExportedChatInvite) {
switch apiExportedInvite { switch apiExportedInvite {
case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage): 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)
} }
} }
} }

View File

@ -5,7 +5,7 @@ import SwiftSignalKit
func currentWebDocumentsHostDatacenterId(postbox: Postbox, isTestingEnvironment: Bool) -> Signal<Int32, NoError> { func currentWebDocumentsHostDatacenterId(postbox: Postbox, isTestingEnvironment: Bool) -> Signal<Int32, NoError> {
return postbox.transaction { transaction -> Int32 in return postbox.transaction { transaction -> Int32 in
if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration) as? RemoteStorageConfiguration { if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration)?.get(RemoteStorageConfiguration.self) {
return entry.webDocumentsHostDatacenterId return entry.webDocumentsHostDatacenterId
} else { } else {
if isTestingEnvironment { if isTestingEnvironment {
@ -18,10 +18,10 @@ func currentWebDocumentsHostDatacenterId(postbox: Postbox, isTestingEnvironment:
} }
func updateRemoteStorageConfiguration(transaction: Transaction, configuration: RemoteStorageConfiguration) { func updateRemoteStorageConfiguration(transaction: Transaction, configuration: RemoteStorageConfiguration) {
let current = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration) as? RemoteStorageConfiguration let current = transaction.getPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration)?.get(RemoteStorageConfiguration.self)
if let current = current, current.isEqual(to: configuration) { if let current = current, current == configuration {
return return
} }
transaction.setPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration, value: configuration) transaction.setPreferencesEntry(key: PreferencesKeys.remoteStorageConfiguration, value: PreferencesEntry(configuration))
} }

View File

@ -156,14 +156,14 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
} }
if let viaBotId = viaBotId { 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 { if let media = media {
switch media { switch media {
case let .messageMediaContact(_, _, _, _, userId): case let .messageMediaContact(_, _, _, _, userId):
if userId != 0 { 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: default:
break break
@ -174,7 +174,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
for entity in entities { for entity in entities {
switch entity { switch entity {
case let .messageEntityMentionName(_, _, userId): 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: default:
break 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: case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme:
break break
case let .messageActionChannelMigrateFrom(_, chatId): 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): case let .messageActionChatAddUser(users):
for id in 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): case let .messageActionChatCreate(_, users):
for id in 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): 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): 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): 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, _): case let .messageActionGeoProximityReached(fromId, toId, _):
result.append(fromId.peerId) result.append(fromId.peerId)
result.append(toId.peerId) result.append(toId.peerId)
case let .messageActionInviteToGroupCall(_, userIds): case let .messageActionInviteToGroupCall(_, userIds):
for id in 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) return (TelegramMediaExpiredContent(data: .image), nil)
} }
case let .messageMediaContact(phoneNumber, firstName, lastName, vcard, userId): 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) let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId, vCardData: vcard.isEmpty ? nil : vcard)
return (mediaContact, nil) return (mediaContact, nil)
case let .messageMediaGeo(geo): case let .messageMediaGeo(geo):
@ -353,7 +353,7 @@ func messageTextEntitiesFromApiEntities(_ entities: [Api.MessageEntity]) -> [Mes
case let .messageEntityTextUrl(offset, length, url): case let .messageEntityTextUrl(offset, length, url):
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextUrl(url: url))) result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextUrl(url: url)))
case let .messageEntityMentionName(offset, length, userId): 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): case let .messageEntityPhone(offset, length):
result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .PhoneNumber)) result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .PhoneNumber))
case let .messageEntityCashtag(offset, length): case let .messageEntityCashtag(offset, length):
@ -384,10 +384,10 @@ extension StoreMessage {
peerId = chatPeerId.peerId peerId = chatPeerId.peerId
authorId = resolvedFromId authorId = resolvedFromId
case let .peerChat(chatId): 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 authorId = resolvedFromId
case let .peerChannel(channelId): 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 authorId = resolvedFromId
} }
@ -501,7 +501,7 @@ extension StoreMessage {
} }
if let viaBotId = viaBotId { 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 { if namespace != Namespaces.Message.ScheduledCloud {
@ -560,7 +560,7 @@ extension StoreMessage {
recentRepliersPeerIds = nil 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)) attributes.append(ReplyThreadMessageAttribute(count: repliesCount, latestUsers: recentRepliersPeerIds ?? [], commentsPeerId: commentsPeerId, maxMessageId: maxId, maxReadMessageId: readMaxId))
} }

View File

@ -8,23 +8,23 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
case let .messageActionChannelCreate(title): case let .messageActionChannelCreate(title):
return TelegramMediaAction(action: .groupCreated(title: title)) return TelegramMediaAction(action: .groupCreated(title: title))
case let .messageActionChannelMigrateFrom(title, chatId): 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): 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, _): case let .messageActionChatCreate(title, _):
return TelegramMediaAction(action: .groupCreated(title: title)) return TelegramMediaAction(action: .groupCreated(title: title))
case .messageActionChatDeletePhoto: case .messageActionChatDeletePhoto:
return TelegramMediaAction(action: .photoUpdated(image: nil)) return TelegramMediaAction(action: .photoUpdated(image: nil))
case let .messageActionChatDeleteUser(userId): 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): case let .messageActionChatEditPhoto(photo):
return TelegramMediaAction(action: .photoUpdated(image: telegramMediaImageFromApiPhoto(photo))) return TelegramMediaAction(action: .photoUpdated(image: telegramMediaImageFromApiPhoto(photo)))
case let .messageActionChatEditTitle(title): case let .messageActionChatEditTitle(title):
return TelegramMediaAction(action: .titleUpdated(title: title)) return TelegramMediaAction(action: .titleUpdated(title: title))
case let .messageActionChatJoinedByLink(inviterId): 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): 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: case .messageActionHistoryClear:
return TelegramMediaAction(action: .historyCleared) return TelegramMediaAction(action: .historyCleared)
case .messageActionPinMessage: case .messageActionPinMessage:
@ -67,7 +67,7 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
switch call { switch call {
case let .inputGroupCall(id, accessHash): case let .inputGroupCall(id, accessHash):
return TelegramMediaAction(action: .inviteToGroupPhoneCall(callId: id, accessHash: accessHash, peerIds: userIds.map { userId in 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): case let .messageActionSetMessagesTTL(period):

View File

@ -35,7 +35,7 @@ extension TelegramMediaPollResults {
} }
self.init(voters: results.flatMap({ $0.map(TelegramMediaPollOptionVoters.init(apiVoters:)) }), totalVoters: totalVoters, recentVoters: recentVoters.flatMap { recentVoters in 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) } ?? [], solution: parsedSolution)
} }
} }

View File

@ -69,9 +69,9 @@ extension TelegramUser {
let restrictionInfo: PeerAccessRestrictionInfo? = restrictionReason.flatMap(PeerAccessRestrictionInfo.init(apiReasons:)) 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): 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: [])
} }
} }

View File

@ -9,7 +9,7 @@ public func returnGroup(account: Account, peerId: PeerId) -> Signal<Void, NoErro
|> take(1) |> take(1)
|> mapToSignal { peer -> Signal<Void, NoError> in |> mapToSignal { peer -> Signal<Void, NoError> in
if let inputUser = apiInputUser(peer) { 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 |> retryRequest
|> mapToSignal { updates -> Signal<Void, NoError> in |> mapToSignal { updates -> Signal<Void, NoError> in
account.stateManager.addUpdates(updates) account.stateManager.addUpdates(updates)
@ -26,7 +26,7 @@ public func leftGroup(account: Account, peerId: PeerId) -> Signal<Void, NoError>
|> take(1) |> take(1)
|> mapToSignal { peer -> Signal<Void, NoError> in |> mapToSignal { peer -> Signal<Void, NoError> in
if let inputUser = apiInputUser(peer) { 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 |> retryRequest
|> mapToSignal { updates -> Signal<Void, NoError> in |> mapToSignal { updates -> Signal<Void, NoError> in
account.stateManager.addUpdates(updates) account.stateManager.addUpdates(updates)

View File

@ -473,16 +473,7 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa
} }
} }
let useTempAuthKeys: Bool let useTempAuthKeys: Bool = true
if let networkSettings = networkSettings {
if let userEnableTempKeys = networkSettings.userEnableTempKeys {
useTempAuthKeys = userEnableTempKeys
} else {
useTempAuthKeys = networkSettings.defaultEnableTempKeys
}
} else {
useTempAuthKeys = true
}
var contextValue: MTContext? var contextValue: MTContext?
sharedContexts.with { store in sharedContexts.with { store in
@ -506,7 +497,8 @@ func initializedNetwork(accountId: AccountRecordId, arguments: NetworkInitializa
if testingEnvironment { if testingEnvironment {
seedAddressList = [ seedAddressList = [
1: ["149.154.175.10"], 1: ["149.154.175.10"],
2: ["149.154.167.40"] 2: ["149.154.167.40"],
3: ["149.154.175.117"]
] ]
} else { } else {
seedAddressList = [ seedAddressList = [

View File

@ -1064,7 +1064,7 @@ extension GroupStatsTopPoster {
init(apiStatsGroupTopPoster: Api.StatsGroupTopPoster) { init(apiStatsGroupTopPoster: Api.StatsGroupTopPoster) {
switch apiStatsGroupTopPoster { switch apiStatsGroupTopPoster {
case let .statsGroupTopPoster(userId, messages, avgChars): 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) { init(apiStatsGroupTopAdmin: Api.StatsGroupTopAdmin) {
switch apiStatsGroupTopAdmin { switch apiStatsGroupTopAdmin {
case let .statsGroupTopAdmin(userId, deleted, kicked, banned): 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) { init(apiStatsGroupTopInviter: Api.StatsGroupTopInviter) {
switch apiStatsGroupTopInviter { switch apiStatsGroupTopInviter {
case let .statsGroupTopInviter(userId, invitations): 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)
} }
} }
} }

View File

@ -86,7 +86,7 @@ public func standaloneUploadedImage(account: Account, peerId: PeerId, text: Stri
case let .inputSecretFile(file, _, key): case let .inputSecretFile(file, _, key):
return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in
if let peer = transaction.getPeer(peerId) as? TelegramSecretChat { 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 return nil
} }
@ -180,7 +180,7 @@ public func standaloneUploadedFile(account: Account, peerId: PeerId, text: Strin
case let .inputSecretFile(file, _, key): case let .inputSecretFile(file, _, key):
return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in
if let peer = transaction.getPeer(peerId) as? TelegramSecretChat { 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 return nil
} }

View File

@ -16,9 +16,9 @@ extension SecretChatIncomingEncryptedOperation {
convenience init(message: Api.EncryptedMessage) { convenience init(message: Api.EncryptedMessage) {
switch message { switch message {
case let .encryptedMessage(randomId, chatId, date, bytes, file): 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): 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)
} }
} }
} }

View File

@ -18,7 +18,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee
assert((currentPeer == nil) == (currentState == nil)) assert((currentPeer == nil) == (currentState == nil))
switch chat { switch chat {
case let .encryptedChat(_, _, _, adminId, _, gAOrB, remoteKeyFingerprint): 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 { if case let .handshake(handshakeState) = currentState.embeddedState, case let .requested(_, p, a) = handshakeState {
let pData = p.makeData() let pData = p.makeData()
let aData = a.makeData() let aData = a.makeData()
@ -87,7 +87,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee
case .encryptedChatEmpty(_): case .encryptedChatEmpty(_):
break break
case let .encryptedChatRequested(_, folderId, _, accessHash, date, adminId, participantId, gA): 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 { if settings.acceptOnThisDevice {
let state = SecretChatState(role: .participant, embeddedState: .handshake(.accepting), keychain: SecretChatKeychain(keys: []), keyFingerprint: nil, messageAutoremoveTimeout: nil) 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) 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) 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 }) updatePeers(transaction: transaction, peers: [peer], update: { _, updated in return updated })
if folderId != nil { if folderId != nil {
transaction.updatePeerChatListInclusion(peer.id, inclusion: .ifHasMessagesOrOneOf(groupId: Namespaces.PeerGroup.archive, pinningIndex: nil, minTimestamp: date)) 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") Logger.shared.log("State", "got encryptedChatRequested, but peer already exists or this account is creator")
} }
case let .encryptedChatWaiting(_, accessHash, date, adminId, participantId): 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 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 }) updatePeers(transaction: transaction, peers: [peer], update: { _, updated in return updated })
transaction.setPeerChatState(peer.id, state: state) transaction.setPeerChatState(peer.id, state: state)
transaction.resetIncomingReadStates([peer.id: [ transaction.resetIncomingReadStates([peer.id: [

View File

@ -8,12 +8,12 @@ public func updateAutodownloadSettingsInteractively(accountManager: AccountManag
return accountManager.transaction { transaction -> Void in return accountManager.transaction { transaction -> Void in
transaction.updateSharedData(SharedDataKeys.autodownloadSettings, { entry in transaction.updateSharedData(SharedDataKeys.autodownloadSettings, { entry in
let currentSettings: AutodownloadSettings let currentSettings: AutodownloadSettings
if let entry = entry as? AutodownloadSettings { if let entry = entry?.get(AutodownloadSettings.self) {
currentSettings = entry currentSettings = entry
} else { } else {
currentSettings = AutodownloadSettings.defaultSettings currentSettings = AutodownloadSettings.defaultSettings
} }
return f(currentSettings) return PreferencesEntry(f(currentSettings))
}) })
} }
} }

View File

@ -7,12 +7,12 @@ public func updateCacheStorageSettingsInteractively(accountManager: AccountManag
return accountManager.transaction { transaction -> Void in return accountManager.transaction { transaction -> Void in
transaction.updateSharedData(SharedDataKeys.cacheStorageSettings, { entry in transaction.updateSharedData(SharedDataKeys.cacheStorageSettings, { entry in
let currentSettings: CacheStorageSettings let currentSettings: CacheStorageSettings
if let entry = entry as? CacheStorageSettings { if let entry = entry?.get(CacheStorageSettings.self) {
currentSettings = entry currentSettings = entry
} else { } else {
currentSettings = CacheStorageSettings.defaultSettings currentSettings = CacheStorageSettings.defaultSettings
} }
return f(currentSettings) return PreferencesEntry(f(currentSettings))
}) })
} }
} }

View File

@ -8,12 +8,12 @@ public func updateContentPrivacySettings(postbox: Postbox, _ f: @escaping (Conte
return postbox.transaction { transaction -> Void in return postbox.transaction { transaction -> Void in
var updated: ContentPrivacySettings? var updated: ContentPrivacySettings?
transaction.updatePreferencesEntry(key: PreferencesKeys.contentPrivacySettings, { current in transaction.updatePreferencesEntry(key: PreferencesKeys.contentPrivacySettings, { current in
if let current = current as? ContentPrivacySettings { if let current = current?.get(ContentPrivacySettings.self) {
updated = f(current) updated = f(current)
return updated return PreferencesEntry(updated)
} else { } else {
updated = f(ContentPrivacySettings.defaultSettings) updated = f(ContentPrivacySettings.defaultSettings)
return updated return PreferencesEntry(updated)
} }
}) })
} }

View File

@ -3,7 +3,7 @@ import Postbox
public func currentLimitsConfiguration(transaction: Transaction) -> LimitsConfiguration { public func currentLimitsConfiguration(transaction: Transaction) -> LimitsConfiguration {
if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.limitsConfiguration) as? LimitsConfiguration { if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.limitsConfiguration)?.get(LimitsConfiguration.self) {
return entry return entry
} else { } else {
return LimitsConfiguration.defaultValue return LimitsConfiguration.defaultValue
@ -11,7 +11,7 @@ public func currentLimitsConfiguration(transaction: Transaction) -> LimitsConfig
} }
func updateLimitsConfiguration(transaction: Transaction, configuration: LimitsConfiguration) { func updateLimitsConfiguration(transaction: Transaction, configuration: LimitsConfiguration) {
if !currentLimitsConfiguration(transaction: transaction).isEqual(to: configuration) { if currentLimitsConfiguration(transaction: transaction) != configuration {
transaction.setPreferencesEntry(key: PreferencesKeys.limitsConfiguration, value: configuration) transaction.setPreferencesEntry(key: PreferencesKeys.limitsConfiguration, value: PreferencesEntry(configuration))
} }
} }

View File

@ -7,12 +7,12 @@ public func updateLoggingSettings(accountManager: AccountManager<TelegramAccount
return accountManager.transaction { transaction -> Void in return accountManager.transaction { transaction -> Void in
var updated: LoggingSettings? var updated: LoggingSettings?
transaction.updateSharedData(SharedDataKeys.loggingSettings, { current in transaction.updateSharedData(SharedDataKeys.loggingSettings, { current in
if let current = current as? LoggingSettings { if let current = current?.get(LoggingSettings.self) {
updated = f(current) updated = f(current)
return updated return PreferencesEntry(updated)
} else { } else {
updated = f(LoggingSettings.defaultSettings) updated = f(LoggingSettings.defaultSettings)
return updated return PreferencesEntry(updated)
} }
}) })

View File

@ -20,7 +20,7 @@ public func updateNetworkSettingsInteractively(transaction: Transaction, network
var updateNetwork = false var updateNetwork = false
var updatedSettings: NetworkSettings? var updatedSettings: NetworkSettings?
transaction.updatePreferencesEntry(key: PreferencesKeys.networkSettings, { current in transaction.updatePreferencesEntry(key: PreferencesKeys.networkSettings, { current in
let previous = (current as? NetworkSettings) ?? NetworkSettings.defaultSettings let previous = current?.get(NetworkSettings.self) ?? NetworkSettings.defaultSettings
let updated = f(previous) let updated = f(previous)
updatedSettings = updated updatedSettings = updated
if updated.reducedBackupDiscoveryTimeout != previous.reducedBackupDiscoveryTimeout { if updated.reducedBackupDiscoveryTimeout != previous.reducedBackupDiscoveryTimeout {
@ -29,7 +29,7 @@ public func updateNetworkSettingsInteractively(transaction: Transaction, network
if updated.backupHostOverride != previous.backupHostOverride { if updated.backupHostOverride != previous.backupHostOverride {
updateNetwork = true updateNetwork = true
} }
return updated return PreferencesEntry(updated)
}) })
if let network = network, updateNetwork, let updatedSettings = updatedSettings { if let network = network, updateNetwork, let updatedSettings = updatedSettings {

View File

@ -161,7 +161,7 @@ extension SelectivePrivacySettings {
current = .enableContacts(enableFor: [:], disableFor: [:]) current = .enableContacts(enableFor: [:], disableFor: [:])
case let .privacyValueAllowUsers(users): case let .privacyValueAllowUsers(users):
for id in 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 enableFor[peer.peer.id] = peer
} }
} }
@ -171,13 +171,13 @@ extension SelectivePrivacySettings {
break break
case let .privacyValueDisallowUsers(users): case let .privacyValueDisallowUsers(users):
for id in 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 disableFor[peer.peer.id] = peer
} }
} }
case let .privacyValueAllowChatParticipants(chats): case let .privacyValueAllowChatParticipants(chats):
for id in 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] { if let peer = peers[possibleId] {
enableFor[peer.peer.id] = peer enableFor[peer.peer.id] = peer
} }
@ -185,7 +185,7 @@ extension SelectivePrivacySettings {
} }
case let .privacyValueDisallowChatParticipants(chats): case let .privacyValueDisallowChatParticipants(chats):
for id in 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] { if let peer = peers[possibleId] {
disableFor[peer.peer.id] = peer disableFor[peer.peer.id] = peer
} }

View File

@ -23,10 +23,10 @@ extension ProxyServerSettings {
public func updateProxySettingsInteractively(transaction: AccountManagerModifier<TelegramAccountManagerTypes>, _ f: @escaping (ProxySettings) -> ProxySettings) -> Bool { public func updateProxySettingsInteractively(transaction: AccountManagerModifier<TelegramAccountManagerTypes>, _ f: @escaping (ProxySettings) -> ProxySettings) -> Bool {
var hasChanges = false var hasChanges = false
transaction.updateSharedData(SharedDataKeys.proxySettings, { current in transaction.updateSharedData(SharedDataKeys.proxySettings, { current in
let previous = (current as? ProxySettings) ?? ProxySettings.defaultSettings let previous = current?.get(ProxySettings.self) ?? ProxySettings.defaultSettings
let updated = f(previous) let updated = f(previous)
hasChanges = previous != updated hasChanges = previous != updated
return updated return PreferencesEntry(updated)
}) })
return hasChanges return hasChanges
} }

View File

@ -1,7 +1,7 @@
import Postbox import Postbox
public func currentVoipConfiguration(transaction: Transaction) -> VoipConfiguration { public func currentVoipConfiguration(transaction: Transaction) -> VoipConfiguration {
if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.voipConfiguration) as? VoipConfiguration { if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.voipConfiguration)?.get(VoipConfiguration.self) {
return entry return entry
} else { } else {
return VoipConfiguration.defaultValue return VoipConfiguration.defaultValue
@ -12,6 +12,6 @@ func updateVoipConfiguration(transaction: Transaction, _ f: (VoipConfiguration)
let current = currentVoipConfiguration(transaction: transaction) let current = currentVoipConfiguration(transaction: transaction)
let updated = f(current) let updated = f(current)
if updated != current { if updated != current {
transaction.setPreferencesEntry(key: PreferencesKeys.voipConfiguration, value: updated) transaction.setPreferencesEntry(key: PreferencesKeys.voipConfiguration, value: PreferencesEntry(updated))
} }
} }

View File

@ -22,7 +22,7 @@ private func peerIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set<PeerId> {
} }
switch group { switch group {
case let .updateChannelPts(channelId, _, _): 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: default:
break break
} }
@ -76,7 +76,7 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update])
} }
switch update { switch update {
case let .updateChannelTooLong(_, channelId, _): 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) peerIds.insert(peerId)
case let .updateFolderPeers(folderPeers, _, _): case let .updateFolderPeers(folderPeers, _, _):
for peer in folderPeers { for peer in folderPeers {
@ -86,7 +86,7 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update])
} }
} }
case let .updateReadChannelInbox(_, _, channelId, _, _, _): 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, _, _, _, _): case let .updateReadHistoryInbox(_, _, peer, _, _, _, _):
peerIds.insert(peer.peerId) peerIds.insert(peer.peerId)
case let .updateDraftMessage(peer, draft): case let .updateDraftMessage(peer, draft):
@ -113,7 +113,7 @@ private func peerIdsRequiringLocalChatStateFromUpdateGroups(_ groups: [UpdateGro
for update in group.updates { for update in group.updates {
switch update { switch update {
case let .updateChannel(channelId): 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: default:
break break
} }
@ -146,7 +146,7 @@ private func locallyGeneratedMessageTimestampsFromUpdateGroups(_ groups: [Update
switch update { switch update {
case let .updateServiceNotification(_, date, _, _, _, _): case let .updateServiceNotification(_, date, _, _, _, _):
if let date = 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 { if messageTimestamps[peerId] == nil {
messageTimestamps[peerId] = [(Namespaces.Message.Local, date)] messageTimestamps[peerId] = [(Namespaces.Message.Local, date)]
} else { } else {
@ -302,7 +302,7 @@ private func peerIdsRequiringLocalChatStateFromDifference(_ difference: Api.upda
} }
switch update { switch update {
case let .updateChannelTooLong(_, channelId, _): 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) peerIds.insert(peerId)
default: default:
break break
@ -324,7 +324,7 @@ private func peerIdsRequiringLocalChatStateFromDifference(_ difference: Api.upda
} }
switch update { switch update {
case let .updateChannelTooLong(_, channelId, _): 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) peerIds.insert(peerId)
default: default:
break break
@ -357,7 +357,7 @@ private func locallyGeneratedMessageTimestampsFromDifference(_ difference: Api.u
switch update { switch update {
case let .updateServiceNotification(_, date, _, _, _, _): case let .updateServiceNotification(_, date, _, _, _, _):
if let date = 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 { if messageTimestamps[peerId] == nil {
messageTimestamps[peerId] = [(Namespaces.Message.Local, date)] messageTimestamps[peerId] = [(Namespaces.Message.Local, date)]
} else { } else {
@ -683,21 +683,21 @@ private func sortedUpdates(_ updates: [Api.Update]) -> [Api.Update] {
for update in updates { for update in updates {
switch update { switch update {
case let .updateChannelTooLong(_, channelId, _): 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 { if updatesByChannel[peerId] == nil {
updatesByChannel[peerId] = [update] updatesByChannel[peerId] = [update]
} else { } else {
updatesByChannel[peerId]!.append(update) updatesByChannel[peerId]!.append(update)
} }
case let .updateDeleteChannelMessages(channelId, _, _, _): 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 { if updatesByChannel[peerId] == nil {
updatesByChannel[peerId] = [update] updatesByChannel[peerId] = [update]
} else { } else {
updatesByChannel[peerId]!.append(update) updatesByChannel[peerId]!.append(update)
} }
case let .updatePinnedChannelMessages(_, channelId, _, _, _): 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 { if updatesByChannel[peerId] == nil {
updatesByChannel[peerId] = [update] updatesByChannel[peerId] = [update]
} else { } else {
@ -724,14 +724,14 @@ private func sortedUpdates(_ updates: [Api.Update]) -> [Api.Update] {
otherUpdates.append(update) otherUpdates.append(update)
} }
case let .updateChannelWebPage(channelId, _, _, _): 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 { if updatesByChannel[peerId] == nil {
updatesByChannel[peerId] = [update] updatesByChannel[peerId] = [update]
} else { } else {
updatesByChannel[peerId]!.append(update) updatesByChannel[peerId]!.append(update)
} }
case let .updateChannelAvailableMessages(channelId, _): 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 { if updatesByChannel[peerId] == nil {
updatesByChannel[peerId] = [update] updatesByChannel[peerId] = [update]
} else { } else {
@ -816,7 +816,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
for update in sortedUpdates(updates) { for update in sortedUpdates(updates) {
switch update { switch update {
case let .updateChannelTooLong(_, channelId, channelPts): 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 !channelsToPoll.contains(peerId) {
if let channelPts = channelPts, let channelState = state.channelStates[peerId], channelState.pts >= channelPts { 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") 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): 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 let previousState = updatedState.channelStates[peerId] {
if previousState.pts >= pts { if previousState.pts >= pts {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old delete update") 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") Logger.shared.log("State", "Invalid updateEditChannelMessage")
} }
case let .updateChannelWebPage(channelId, apiWebpage, pts, ptsCount): 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 let previousState = updatedState.channelStates[peerId] {
if previousState.pts >= pts { if previousState.pts >= pts {
} else if previousState.pts + ptsCount == pts { } else if previousState.pts + ptsCount == pts {
@ -902,7 +902,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
} }
case let .updateChannelAvailableMessages(channelId, minId): 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)) updatedState.updateMinAvailableMessage(MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: minId))
case let .updateDeleteMessages(messages, _, _): case let .updateDeleteMessages(messages, _, _):
updatedState.deleteMessagesWithGlobalIds(messages) updatedState.deleteMessagesWithGlobalIds(messages)
@ -979,7 +979,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
if popup { if popup {
updatedState.addDisplayAlert(text, isDropAuth: type.hasPrefix("AUTH_KEY_DROP_")) updatedState.addDisplayAlert(text, isDropAuth: type.hasPrefix("AUTH_KEY_DROP_"))
} else if let date = date { } 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 { if updatedState.peers[peerId] == nil {
updatedState.updatePeer(peerId, { peer in updatedState.updatePeer(peerId, { peer in
@ -1028,13 +1028,13 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
} }
case let .updateReadChannelInbox(_, folderId, channelId, maxId, stillUnreadCount, pts): 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): 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): 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): 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, _): 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) 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, _, _): case let .updateReadHistoryOutbox(peer, maxId, _, _):
@ -1042,11 +1042,11 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
case let .updateReadChannelDiscussionInbox(_, channelId, topMsgId, readMaxId, mainChannelId, mainChannelPost): case let .updateReadChannelDiscussionInbox(_, channelId, topMsgId, readMaxId, mainChannelId, mainChannelPost):
var mainChannelMessage: MessageId? var mainChannelMessage: MessageId?
if let mainChannelId = mainChannelId, let mainChannelPost = mainChannelPost { 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): 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): case let .updateDialogUnreadMark(flags, peer):
switch peer { switch peer {
case let .dialogPeer(peer): case let .dialogPeer(peer):
@ -1080,9 +1080,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
let groupPeerId: PeerId let groupPeerId: PeerId
switch participants { switch participants {
case let .chatParticipants(chatId, _, _): 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, _): 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 updatedState.updateCachedPeerData(groupPeerId, { current in
let previous: CachedGroupData let previous: CachedGroupData
@ -1094,9 +1094,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
return previous.withUpdatedParticipants(CachedGroupParticipants(apiParticipants: participants)) return previous.withUpdatedParticipants(CachedGroupParticipants(apiParticipants: participants))
}) })
case let .updateChatParticipantAdd(chatId, userId, inviterId, date, _): case let .updateChatParticipantAdd(chatId, userId, inviterId, date, _):
let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))
let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
let inviterPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)) let inviterPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId))
updatedState.updateCachedPeerData(groupPeerId, { current in updatedState.updateCachedPeerData(groupPeerId, { current in
if let current = current as? CachedGroupData, let participants = current.participants { if let current = current as? CachedGroupData, let participants = current.participants {
var updatedParticipants = participants.participants var updatedParticipants = participants.participants
@ -1109,8 +1109,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
}) })
case let .updateChatParticipantDelete(chatId, userId, _): case let .updateChatParticipantDelete(chatId, userId, _):
let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))
let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
updatedState.updateCachedPeerData(groupPeerId, { current in updatedState.updateCachedPeerData(groupPeerId, { current in
if let current = current as? CachedGroupData, let participants = current.participants { if let current = current as? CachedGroupData, let participants = current.participants {
var updatedParticipants = participants.participants var updatedParticipants = participants.participants
@ -1123,8 +1123,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
}) })
case let .updateChatParticipantAdmin(chatId, userId, isAdmin, _): case let .updateChatParticipantAdmin(chatId, userId, isAdmin, _):
let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))
let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
updatedState.updateCachedPeerData(groupPeerId, { current in updatedState.updateCachedPeerData(groupPeerId, { current in
if let current = current as? CachedGroupData, let participants = current.participants { if let current = current as? CachedGroupData, let participants = current.participants {
var updatedParticipants = participants.participants var updatedParticipants = participants.participants
@ -1155,12 +1155,12 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
}) })
case let .updatePinnedChannelMessages(flags, channelId, messages, pts, ptsCount): 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 let previousState = updatedState.channelStates[peerId] {
if previousState.pts >= pts { if previousState.pts >= pts {
Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old pinned messages update") Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old pinned messages update")
} else if previousState.pts + ptsCount == pts { } 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 updatedState.updateMessagesPinned(ids: messages.map { id in
MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id) MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id)
}, pinned: (flags & (1 << 0)) != 0) }, pinned: (flags & (1 << 0)) != 0)
@ -1189,10 +1189,10 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
return previous.withUpdatedIsBlocked(blocked == .boolTrue) return previous.withUpdatedIsBlocked(blocked == .boolTrue)
}) })
case let .updateUserStatus(userId, status): 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): case let .updateUserName(userId, firstName, lastName, username):
//TODO add contact checking for apply first and last name //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 { if let user = peer as? TelegramUser {
return user.withUpdatedUsername(username) return user.withUpdatedUsername(username)
} else { } else {
@ -1200,7 +1200,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
}) })
case let .updateUserPhoto(userId, _, photo, _): 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 { if let user = peer as? TelegramUser {
return user.withUpdatedPhoto(parsedTelegramProfilePhoto(photo)) return user.withUpdatedPhoto(parsedTelegramProfilePhoto(photo))
} else { } else {
@ -1208,7 +1208,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
}) })
case let .updateUserPhone(userId, phone): 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 { if let user = peer as? TelegramUser {
return user.withUpdatedPhone(phone.isEmpty ? nil : phone) return user.withUpdatedPhone(phone.isEmpty ? nil : phone)
} else { } else {
@ -1251,7 +1251,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
case let .updateNewEncryptedMessage(message, _): case let .updateNewEncryptedMessage(message, _):
updatedState.addSecretMessages([message]) updatedState.addSecretMessages([message])
case let .updateEncryptedMessagesRead(chatId, maxDate, date): 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): case let .updateUserTyping(userId, type):
if let date = updatesDate, date + 60 > serverTime { if let date = updatesDate, date + 60 > serverTime {
let activity = PeerInputActivity(apiType: type, timestamp: date) let activity = PeerInputActivity(apiType: type, timestamp: date)
@ -1260,7 +1260,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
category = .voiceChat 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): case let .updateChatUserTyping(chatId, userId, type):
if let date = updatesDate, date + 60 > serverTime { if let date = updatesDate, date + 60 > serverTime {
@ -1270,11 +1270,11 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
category = .voiceChat 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): case let .updateChannelUserTyping(_, channelId, topMsgId, userId, type):
if let date = updatesDate, date + 60 > serverTime { 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 threadId = topMsgId.flatMap { makeMessageThreadId(MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: $0)) }
let activity = PeerInputActivity(apiType: type, timestamp: date) let activity = PeerInputActivity(apiType: type, timestamp: date)
@ -1289,7 +1289,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
case let .updateEncryptedChatTyping(chatId): case let .updateEncryptedChatTyping(chatId):
if let date = updatesDate, date + 60 > serverTime { 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): case let .updateDialogPinned(flags, folderId, peer):
let groupId: PeerGroupId = folderId.flatMap(PeerGroupId.init(rawValue:)) ?? .root let groupId: PeerGroupId = folderId.flatMap(PeerGroupId.init(rawValue:)) ?? .root
@ -1324,9 +1324,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
case let .updateReadMessagesContents(messages, _, _): case let .updateReadMessagesContents(messages, _, _):
updatedState.addReadMessagesContents((nil, messages)) updatedState.addReadMessagesContents((nil, messages))
case let .updateChannelReadMessagesContents(channelId, 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): 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): /*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)*/ updatedState.addUpdateMessageForwardsCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId), namespace: Namespaces.Message.Cloud, id: id), count: forwards)*/
case let .updateNewStickerSet(stickerset): 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) updatedState.updateGroupCallParticipants(id: id, accessHash: accessHash, participants: participants, version: version)
} }
case let .updateGroupCall(channelId, call): 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.CloudChannel, id: PeerId.Id._internalFromInt64Value(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.CloudGroup, id: PeerId.Id._internalFromInt64Value(channelId)), call: call)
case let .updatePeerHistoryTTL(_, peer, ttl): case let .updatePeerHistoryTTL(_, peer, ttl):
updatedState.updateAutoremoveTimeout(peer: peer, value: CachedPeerAutoremoveTimeout.Value(ttl)) updatedState.updateAutoremoveTimeout(peer: peer, value: CachedPeerAutoremoveTimeout.Value(ttl))
case let .updateLangPackTooLong(langCode): case let .updateLangPackTooLong(langCode):
@ -1422,7 +1422,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
case let .updateDialogFilter(_, id, filter): case let .updateDialogFilter(_, id, filter):
updatedState.addUpdateChatListFilter(id: id, filter: filter) updatedState.addUpdateChatListFilter(id: id, filter: filter)
case let .updateBotCommands(peer, botId, apiCommands): 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 let commands: [BotCommand] = apiCommands.map { command in
switch command { switch command {
case let .botCommand(command, description): case let .botCommand(command, description):
@ -1988,7 +1988,7 @@ private func pollChannel(network: Network, peer: Peer, state: AccountMutableStat
Logger.shared.log("State", "Invalid updateEditChannelMessage") Logger.shared.log("State", "Invalid updateEditChannelMessage")
} }
case let .updatePinnedChannelMessages(flags, channelId, messages, _, _): 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 updatedState.updateMessagesPinned(ids: messages.map { id in
MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id) MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id)
}, pinned: (flags & (1 << 0)) != 0) }, pinned: (flags & (1 << 0)) != 0)
@ -2808,35 +2808,35 @@ func replayFinalState(accountManager: AccountManager<TelegramAccountManagerTypes
case .privateChats: case .privateChats:
transaction.updatePreferencesEntry(key: PreferencesKeys.globalNotifications, { current in transaction.updatePreferencesEntry(key: PreferencesKeys.globalNotifications, { current in
var updated: GlobalNotificationSettings var updated: GlobalNotificationSettings
if let current = current as? GlobalNotificationSettings { if let current = current?.get(GlobalNotificationSettings.self) {
updated = current updated = current
} else { } else {
updated = GlobalNotificationSettings.defaultSettings updated = GlobalNotificationSettings.defaultSettings
} }
updated.remote.privateChats = notificationSettings updated.remote.privateChats = notificationSettings
return updated return PreferencesEntry(updated)
}) })
case .groups: case .groups:
transaction.updatePreferencesEntry(key: PreferencesKeys.globalNotifications, { current in transaction.updatePreferencesEntry(key: PreferencesKeys.globalNotifications, { current in
var updated: GlobalNotificationSettings var updated: GlobalNotificationSettings
if let current = current as? GlobalNotificationSettings { if let current = current?.get(GlobalNotificationSettings.self) {
updated = current updated = current
} else { } else {
updated = GlobalNotificationSettings.defaultSettings updated = GlobalNotificationSettings.defaultSettings
} }
updated.remote.groupChats = notificationSettings updated.remote.groupChats = notificationSettings
return updated return PreferencesEntry(updated)
}) })
case .channels: case .channels:
transaction.updatePreferencesEntry(key: PreferencesKeys.globalNotifications, { current in transaction.updatePreferencesEntry(key: PreferencesKeys.globalNotifications, { current in
var updated: GlobalNotificationSettings var updated: GlobalNotificationSettings
if let current = current as? GlobalNotificationSettings { if let current = current?.get(GlobalNotificationSettings.self) {
updated = current updated = current
} else { } else {
updated = GlobalNotificationSettings.defaultSettings updated = GlobalNotificationSettings.defaultSettings
} }
updated.remote.channels = notificationSettings updated.remote.channels = notificationSettings
return updated return PreferencesEntry(updated)
}) })
} }
case let .MergeApiChats(chats): case let .MergeApiChats(chats):
@ -3490,8 +3490,8 @@ func replayFinalState(accountManager: AccountManager<TelegramAccountManagerTypes
transaction.replaceOrderedItemListItems(collectionId: Namespaces.OrderedItemList.CloudThemes, items: updatedEntries) transaction.replaceOrderedItemListItems(collectionId: Namespaces.OrderedItemList.CloudThemes, items: updatedEntries)
let _ = accountManager.transaction { transaction in let _ = accountManager.transaction { transaction in
transaction.updateSharedData(SharedDataKeys.themeSettings, { current in transaction.updateSharedData(SharedDataKeys.themeSettings, { current in
if let current = current as? ThemeSettings, let theme = current.currentTheme, let updatedTheme = updatedThemes[theme.id] { if let current = current?.get(ThemeSettings.self), let theme = current.currentTheme, let updatedTheme = updatedThemes[theme.id] {
return ThemeSettings(currentTheme: updatedTheme) return PreferencesEntry(ThemeSettings(currentTheme: updatedTheme))
} }
return current return current
}) })

View File

@ -728,7 +728,7 @@ public final class AccountViewTracker {
switch replies { switch replies {
case let .messageReplies(_, repliesCountValue, _, recentRepliers, channelId, maxId, readMaxId): case let .messageReplies(_, repliesCountValue, _, recentRepliers, channelId, maxId, readMaxId):
if let channelId = channelId { 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 repliesCount = repliesCountValue
if let recentRepliers = recentRepliers { if let recentRepliers = recentRepliers {

View File

@ -6,6 +6,6 @@ import MtProtoKit
func updateAppChangelogState(transaction: Transaction, _ f: @escaping (AppChangelogState) -> AppChangelogState) { func updateAppChangelogState(transaction: Transaction, _ f: @escaping (AppChangelogState) -> AppChangelogState) {
transaction.updatePreferencesEntry(key: PreferencesKeys.appChangelogState, { current in transaction.updatePreferencesEntry(key: PreferencesKeys.appChangelogState, { current in
return f((current as? AppChangelogState) ?? AppChangelogState.default) return PreferencesEntry(f((current as? AppChangelogState) ?? AppChangelogState.default))
}) })
} }

View File

@ -1,7 +1,7 @@
import Postbox import Postbox
private func currentAppConfiguration(transaction: Transaction) -> AppConfiguration { private func currentAppConfiguration(transaction: Transaction) -> AppConfiguration {
if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.appConfiguration) as? AppConfiguration { if let entry = transaction.getPreferencesEntry(key: PreferencesKeys.appConfiguration)?.get(AppConfiguration.self) {
return entry return entry
} else { } else {
return AppConfiguration.defaultValue return AppConfiguration.defaultValue
@ -12,6 +12,6 @@ func updateAppConfiguration(transaction: Transaction, _ f: (AppConfiguration) ->
let current = currentAppConfiguration(transaction: transaction) let current = currentAppConfiguration(transaction: transaction)
let updated = f(current) let updated = f(current)
if updated != current { if updated != current {
transaction.setPreferencesEntry(key: PreferencesKeys.appConfiguration, value: updated) transaction.setPreferencesEntry(key: PreferencesKeys.appConfiguration, value: PreferencesEntry(updated))
} }
} }

View File

@ -819,7 +819,7 @@ private final class CallSessionManagerContext {
versions = libraryVersions versions = libraryVersions
} }
if self.contextIdByStableId[id] == nil { 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 { if let internalId = internalId {
var resultRingingStateValue: CallSessionRingingState? var resultRingingStateValue: CallSessionRingingState?
for ringingState in self.ringingStatesValue() { for ringingState in self.ringingStatesValue() {

View File

@ -17,11 +17,11 @@ func channelUpdatesByPeerId(updates: [ChannelUpdate]) -> [PeerId: [ChannelUpdate
case let .updateNewChannelMessage(message, _, _): case let .updateNewChannelMessage(message, _, _):
peerId = apiMessagePeerId(message) peerId = apiMessagePeerId(message)
case let .updateDeleteChannelMessages(channelId, _, _, _): 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, _, _): case let .updateEditChannelMessage(message, _, _):
peerId = apiMessagePeerId(message) peerId = apiMessagePeerId(message)
case let .updateChannelWebPage(channelId, _, _, _): 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: default:
break break
} }

Some files were not shown because too many files have changed in this diff Show More