[WIP] Privacy update

This commit is contained in:
Isaac 2024-01-05 10:55:59 +04:00
parent f27952b7c2
commit fb517e49c9
68 changed files with 4913 additions and 3974 deletions

View File

@ -356,7 +356,7 @@ public enum ChatSearchDomain: Equatable {
case everything
case members
case member(Peer)
case tag(String)
case tag(MessageReaction.Reaction, TelegramMediaFile)
public static func ==(lhs: ChatSearchDomain, rhs: ChatSearchDomain) -> Bool {
switch lhs {
@ -378,8 +378,8 @@ public enum ChatSearchDomain: Equatable {
} else {
return false
}
case let .tag(tag):
if case .tag(tag) = rhs {
case let .tag(tag, file):
if case .tag(tag, file) = rhs {
return true
} else {
return false

View File

@ -1572,9 +1572,9 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
let searchLocations: [SearchMessagesLocation]
if let options = options {
if case let .forum(peerId) = location {
searchLocations = [.peer(peerId: peerId, fromId: nil, tags: tagMask, threadId: nil, minDate: options.date?.0, maxDate: options.date?.1), .general(tags: tagMask, minDate: options.date?.0, maxDate: options.date?.1)]
searchLocations = [.peer(peerId: peerId, fromId: nil, tags: tagMask, reactions: nil, threadId: nil, minDate: options.date?.0, maxDate: options.date?.1), .general(tags: tagMask, minDate: options.date?.0, maxDate: options.date?.1)]
} else if let (peerId, _, _) = options.peer {
searchLocations = [.peer(peerId: peerId, fromId: nil, tags: tagMask, threadId: nil, minDate: options.date?.0, maxDate: options.date?.1)]
searchLocations = [.peer(peerId: peerId, fromId: nil, tags: tagMask, reactions: nil, threadId: nil, minDate: options.date?.0, maxDate: options.date?.1)]
} else {
if case let .chatList(groupId) = location, case .archive = groupId {
searchLocations = [.group(groupId: groupId._asGroup(), tags: tagMask, minDate: options.date?.0, maxDate: options.date?.1)]
@ -1584,7 +1584,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
}
} else {
if case let .forum(peerId) = location {
searchLocations = [.peer(peerId: peerId, fromId: nil, tags: tagMask, threadId: nil, minDate: nil, maxDate: nil), .general(tags: tagMask, minDate: nil, maxDate: nil)]
searchLocations = [.peer(peerId: peerId, fromId: nil, tags: tagMask, reactions: nil, threadId: nil, minDate: nil, maxDate: nil), .general(tags: tagMask, minDate: nil, maxDate: nil)]
} else if case let .chatList(groupId) = location, case .archive = groupId {
searchLocations = [.group(groupId: groupId._asGroup(), tags: tagMask, minDate: nil, maxDate: nil)]
} else {

View File

@ -28,7 +28,7 @@ private func suggestedUserPresenceStringRefreshTimeout(_ presence: EnginePeer.Pr
} else {
return Double.infinity
}
case .longTimeAgo, .lastWeek, .lastMonth:
case .longTimeAgo, .lastWeek, .lastMonth, .hidden:
return Double.infinity
}
}

View File

@ -20,6 +20,7 @@ swift_library(
"//submodules/ComponentFlow:ComponentFlow",
"//submodules/AvatarNode:AvatarNode",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramUI/Components/EmojiStatusComponent",
],
visibility = [
"//visibility:public",

View File

@ -9,6 +9,8 @@ import ActivityIndicator
import AppBundle
import AvatarNode
import AccountContext
import ComponentFlow
import EmojiStatusComponent
private func generateLoupeIcon(color: UIColor) -> UIImage? {
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: color)
@ -43,20 +45,24 @@ public struct SearchBarToken {
}
public let id: AnyHashable
public let context: AccountContext?
public let icon: UIImage?
public let iconOffset: CGFloat?
public let peer: (EnginePeer, AccountContext, PresentationTheme)?
public let isTag: Bool
public let emojiFile: TelegramMediaFile?
public let title: String
public let style: Style?
public let permanent: Bool
public init(id: AnyHashable, icon: UIImage?, iconOffset: CGFloat? = 0.0, peer: (EnginePeer, AccountContext, PresentationTheme)? = nil, isTag: Bool = false, title: String, style: Style? = nil, permanent: Bool) {
public init(id: AnyHashable, context: AccountContext? = nil, icon: UIImage?, iconOffset: CGFloat? = 0.0, peer: (EnginePeer, AccountContext, PresentationTheme)? = nil, isTag: Bool = false, emojiFile: TelegramMediaFile? = nil, title: String, style: Style? = nil, permanent: Bool) {
self.id = id
self.context = context
self.icon = icon
self.iconOffset = iconOffset
self.peer = peer
self.isTag = isTag
self.emojiFile = emojiFile
self.title = title
self.style = style
self.permanent = permanent
@ -71,6 +77,7 @@ private final class TokenNode: ASDisplayNode {
let titleNode: ASTextNode
let backgroundNode: ASImageNode
let avatarNode: AvatarNode?
var emojiView: ComponentView<Empty>?
var isSelected: Bool = false
var isCollapsed: Bool = false
@ -204,6 +211,7 @@ private final class TokenNode: ASDisplayNode {
height += 2.0
}
var emojiFileSize: CGSize?
var leftInset: CGFloat = 3.0
if let icon = self.iconNode.image {
leftInset += 1.0
@ -214,9 +222,49 @@ private final class TokenNode: ASDisplayNode {
transition.updateFrame(node: self.iconNode, frame: iconFrame)
leftInset += icon.size.width + 3.0
}
if let emojiFile = self.token.emojiFile, let context = self.token.context {
let emojiView: ComponentView<Empty>
if let current = self.emojiView {
emojiView = current
} else {
emojiView = ComponentView()
self.emojiView = emojiView
}
let emojiViewSize = emojiView.update(
transition: .immediate,
component: AnyComponent(EmojiStatusComponent(
context: context,
animationCache: context.animationCache,
animationRenderer: context.animationRenderer,
content: .animation(
content: .file(file: emojiFile),
size: CGSize(width: 32.0, height: 32.0),
placeholderColor: self.theme.primaryText.withMultipliedAlpha(0.2),
themeColor: self.theme.primaryText,
loopMode: .forever
),
isVisibleForAnimations: false,
useSharedAnimation: true,
action: nil,
emojiFileUpdated: nil
)),
environment: {},
containerSize: CGSize(width: 14.0, height: 14.0)
)
if let emojiComponentView = emojiView.view {
if emojiComponentView.superview == nil {
self.containerNode.view.addSubview(emojiComponentView)
}
emojiComponentView.frame = CGRect(origin: CGPoint(x: leftInset + 2.0, y: floor((height - emojiViewSize.height) * 0.5)), size: emojiViewSize)
}
emojiFileSize = emojiViewSize
}
if self.token.isTag {
leftInset += 2.0
}
if let emojiFileSize {
leftInset += emojiFileSize.width + 7.0
}
let iconSize = self.token.icon?.size ?? CGSize()
let titleSize = self.titleNode.measure(CGSize(width: constrainedSize.width - 6.0, height: constrainedSize.height))

View File

@ -597,6 +597,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[577659656] = { return Api.NotifyPeer.parse_notifyForumTopic($0) }
dict[-1613493288] = { return Api.NotifyPeer.parse_notifyPeer($0) }
dict[-1261946036] = { return Api.NotifyPeer.parse_notifyUsers($0) }
dict[1001931436] = { return Api.OutboxReadDate.parse_outboxReadDate($0) }
dict[-1738178803] = { return Api.Page.parse_page($0) }
dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) }
dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($0) }
@ -752,6 +753,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1009288385] = { return Api.RichText.parse_textUrl($0) }
dict[289586518] = { return Api.SavedContact.parse_savedPhoneContact($0) }
dict[-1115174036] = { return Api.SavedDialog.parse_savedDialog($0) }
dict[-881854424] = { return Api.SavedReactionTag.parse_savedReactionTag($0) }
dict[-911191137] = { return Api.SearchResultsCalendarPeriod.parse_searchResultsCalendarPeriod($0) }
dict[2137295719] = { return Api.SearchResultsPosition.parse_searchResultPosition($0) }
dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) }
@ -962,6 +964,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1706939360] = { return Api.Update.parse_updateRecentStickers($0) }
dict[-1364222348] = { return Api.Update.parse_updateSavedDialogPinned($0) }
dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($0) }
dict[969307186] = { return Api.Update.parse_updateSavedReactionTags($0) }
dict[1960361625] = { return Api.Update.parse_updateSavedRingtones($0) }
dict[2103604867] = { return Api.Update.parse_updateSentStoryReaction($0) }
dict[-337352679] = { return Api.Update.parse_updateServiceNotification($0) }
@ -996,6 +999,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-2100168954] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) }
dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) }
dict[164646985] = { return Api.UserStatus.parse_userStatusEmpty($0) }
dict[-813865807] = { return Api.UserStatus.parse_userStatusHidden($0) }
dict[2011940674] = { return Api.UserStatus.parse_userStatusLastMonth($0) }
dict[129960444] = { return Api.UserStatus.parse_userStatusLastWeek($0) }
dict[9203775] = { return Api.UserStatus.parse_userStatusOffline($0) }
@ -1180,6 +1184,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1153080793] = { return Api.messages.SavedDialogs.parse_savedDialogsSlice($0) }
dict[-2069878259] = { return Api.messages.SavedGifs.parse_savedGifs($0) }
dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($0) }
dict[844731658] = { return Api.messages.SavedReactionTags.parse_savedReactionTags($0) }
dict[-2003084817] = { return Api.messages.SavedReactionTags.parse_savedReactionTagsNotModified($0) }
dict[-398136321] = { return Api.messages.SearchCounter.parse_searchCounter($0) }
dict[343859772] = { return Api.messages.SearchResultsCalendar.parse_searchResultsCalendar($0) }
dict[1404185519] = { return Api.messages.SearchResultsPositions.parse_searchResultsPositions($0) }
@ -1657,6 +1663,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.NotifyPeer:
_1.serialize(buffer, boxed)
case let _1 as Api.OutboxReadDate:
_1.serialize(buffer, boxed)
case let _1 as Api.Page:
_1.serialize(buffer, boxed)
case let _1 as Api.PageBlock:
@ -1761,6 +1769,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.SavedDialog:
_1.serialize(buffer, boxed)
case let _1 as Api.SavedReactionTag:
_1.serialize(buffer, boxed)
case let _1 as Api.SearchResultsCalendarPeriod:
_1.serialize(buffer, boxed)
case let _1 as Api.SearchResultsPosition:
@ -2083,6 +2093,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SavedGifs:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SavedReactionTags:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SearchCounter:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SearchResultsCalendar:

View File

@ -98,6 +98,42 @@ public extension Api {
}
}
public extension Api {
enum OutboxReadDate: TypeConstructorDescription {
case outboxReadDate(date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .outboxReadDate(let date):
if boxed {
buffer.appendInt32(1001931436)
}
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .outboxReadDate(let date):
return ("outboxReadDate", [("date", date as Any)])
}
}
public static func parse_outboxReadDate(_ reader: BufferReader) -> OutboxReadDate? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.OutboxReadDate.outboxReadDate(date: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
enum Page: TypeConstructorDescription {
case page(flags: Int32, url: String, blocks: [Api.PageBlock], photos: [Api.Photo], documents: [Api.Document], views: Int32?)

View File

@ -652,6 +652,56 @@ public extension Api {
}
}
public extension Api {
enum SavedReactionTag: TypeConstructorDescription {
case savedReactionTag(flags: Int32, reaction: Api.Reaction, title: String?, count: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedReactionTag(let flags, let reaction, let title, let count):
if boxed {
buffer.appendInt32(-881854424)
}
serializeInt32(flags, buffer: buffer, boxed: false)
reaction.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
serializeInt32(count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedReactionTag(let flags, let reaction, let title, let count):
return ("savedReactionTag", [("flags", flags as Any), ("reaction", reaction as Any), ("title", title as Any), ("count", count as Any)])
}
}
public static func parse_savedReactionTag(_ reader: BufferReader) -> SavedReactionTag? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Reaction?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Reaction
}
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.SavedReactionTag.savedReactionTag(flags: _1!, reaction: _2!, title: _3, count: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
enum SearchResultsCalendarPeriod: TypeConstructorDescription {
case searchResultsCalendarPeriod(date: Int32, minMsgId: Int32, maxMsgId: Int32, count: Int32)
@ -972,59 +1022,3 @@ public extension Api {
}
}
public extension Api {
enum SecurePlainData: TypeConstructorDescription {
case securePlainEmail(email: String)
case securePlainPhone(phone: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .securePlainEmail(let email):
if boxed {
buffer.appendInt32(569137759)
}
serializeString(email, buffer: buffer, boxed: false)
break
case .securePlainPhone(let phone):
if boxed {
buffer.appendInt32(2103482845)
}
serializeString(phone, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .securePlainEmail(let email):
return ("securePlainEmail", [("email", email as Any)])
case .securePlainPhone(let phone):
return ("securePlainPhone", [("phone", phone as Any)])
}
}
public static func parse_securePlainEmail(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.SecurePlainData.securePlainEmail(email: _1!)
}
else {
return nil
}
}
public static func parse_securePlainPhone(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.SecurePlainData.securePlainPhone(phone: _1!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,59 @@
public extension Api {
enum SecurePlainData: TypeConstructorDescription {
case securePlainEmail(email: String)
case securePlainPhone(phone: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .securePlainEmail(let email):
if boxed {
buffer.appendInt32(569137759)
}
serializeString(email, buffer: buffer, boxed: false)
break
case .securePlainPhone(let phone):
if boxed {
buffer.appendInt32(2103482845)
}
serializeString(phone, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .securePlainEmail(let email):
return ("securePlainEmail", [("email", email as Any)])
case .securePlainPhone(let phone):
return ("securePlainPhone", [("phone", phone as Any)])
}
}
public static func parse_securePlainEmail(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.SecurePlainData.securePlainEmail(email: _1!)
}
else {
return nil
}
}
public static func parse_securePlainPhone(_ reader: BufferReader) -> SecurePlainData? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.SecurePlainData.securePlainPhone(phone: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
enum SecureRequiredType: TypeConstructorDescription {
case secureRequiredType(flags: Int32, type: Api.SecureValueType)

View File

@ -569,6 +569,7 @@ public extension Api {
case updateRecentStickers
case updateSavedDialogPinned(flags: Int32, peer: Api.DialogPeer)
case updateSavedGifs
case updateSavedReactionTags
case updateSavedRingtones
case updateSentStoryReaction(peer: Api.Peer, storyId: Int32, reaction: Api.Reaction)
case updateServiceNotification(flags: Int32, inboxDate: Int32?, type: String, message: String, media: Api.MessageMedia, entities: [Api.MessageEntity])
@ -1534,6 +1535,12 @@ public extension Api {
buffer.appendInt32(-1821035490)
}
break
case .updateSavedReactionTags:
if boxed {
buffer.appendInt32(969307186)
}
break
case .updateSavedRingtones:
if boxed {
@ -1897,6 +1904,8 @@ public extension Api {
return ("updateSavedDialogPinned", [("flags", flags as Any), ("peer", peer as Any)])
case .updateSavedGifs:
return ("updateSavedGifs", [])
case .updateSavedReactionTags:
return ("updateSavedReactionTags", [])
case .updateSavedRingtones:
return ("updateSavedRingtones", [])
case .updateSentStoryReaction(let peer, let storyId, let reaction):
@ -3848,6 +3857,9 @@ public extension Api {
public static func parse_updateSavedGifs(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedGifs
}
public static func parse_updateSavedReactionTags(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedReactionTags
}
public static func parse_updateSavedRingtones(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedRingtones
}

View File

@ -801,6 +801,7 @@ public extension Api {
public extension Api {
enum UserStatus: TypeConstructorDescription {
case userStatusEmpty
case userStatusHidden
case userStatusLastMonth
case userStatusLastWeek
case userStatusOffline(wasOnline: Int32)
@ -814,6 +815,12 @@ public extension Api {
buffer.appendInt32(164646985)
}
break
case .userStatusHidden:
if boxed {
buffer.appendInt32(-813865807)
}
break
case .userStatusLastMonth:
if boxed {
@ -852,6 +859,8 @@ public extension Api {
switch self {
case .userStatusEmpty:
return ("userStatusEmpty", [])
case .userStatusHidden:
return ("userStatusHidden", [])
case .userStatusLastMonth:
return ("userStatusLastMonth", [])
case .userStatusLastWeek:
@ -868,6 +877,9 @@ public extension Api {
public static func parse_userStatusEmpty(_ reader: BufferReader) -> UserStatus? {
return Api.UserStatus.userStatusEmpty
}
public static func parse_userStatusHidden(_ reader: BufferReader) -> UserStatus? {
return Api.UserStatus.userStatusHidden
}
public static func parse_userStatusLastMonth(_ reader: BufferReader) -> UserStatus? {
return Api.UserStatus.userStatusLastMonth
}
@ -1382,207 +1394,3 @@ public extension Api {
}
}
public extension Api {
enum WebPage: TypeConstructorDescription {
case webPage(flags: Int32, id: Int64, url: String, displayUrl: String, hash: Int32, type: String?, siteName: String?, title: String?, description: String?, photo: Api.Photo?, embedUrl: String?, embedType: String?, embedWidth: Int32?, embedHeight: Int32?, duration: Int32?, author: String?, document: Api.Document?, cachedPage: Api.Page?, attributes: [Api.WebPageAttribute]?)
case webPageEmpty(flags: Int32, id: Int64, url: String?)
case webPageNotModified(flags: Int32, cachedPageViews: Int32?)
case webPagePending(flags: Int32, id: Int64, url: String?, date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
if boxed {
buffer.appendInt32(-392411726)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
serializeString(url, buffer: buffer, boxed: false)
serializeString(displayUrl, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(type!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(siteName!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {serializeString(description!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {photo!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedUrl!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedType!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedWidth!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedHeight!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(duration!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 8) != 0 {serializeString(author!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 9) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 10) != 0 {cachedPage!.serialize(buffer, true)}
if Int(flags) & Int(1 << 12) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(attributes!.count))
for item in attributes! {
item.serialize(buffer, true)
}}
break
case .webPageEmpty(let flags, let id, let url):
if boxed {
buffer.appendInt32(555358088)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
break
case .webPageNotModified(let flags, let cachedPageViews):
if boxed {
buffer.appendInt32(1930545681)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(cachedPageViews!, buffer: buffer, boxed: false)}
break
case .webPagePending(let flags, let id, let url, let date):
if boxed {
buffer.appendInt32(-1328464313)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
return ("webPage", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("displayUrl", displayUrl as Any), ("hash", hash as Any), ("type", type as Any), ("siteName", siteName as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("embedUrl", embedUrl as Any), ("embedType", embedType as Any), ("embedWidth", embedWidth as Any), ("embedHeight", embedHeight as Any), ("duration", duration as Any), ("author", author as Any), ("document", document as Any), ("cachedPage", cachedPage as Any), ("attributes", attributes as Any)])
case .webPageEmpty(let flags, let id, let url):
return ("webPageEmpty", [("flags", flags as Any), ("id", id as Any), ("url", url as Any)])
case .webPageNotModified(let flags, let cachedPageViews):
return ("webPageNotModified", [("flags", flags as Any), ("cachedPageViews", cachedPageViews as Any)])
case .webPagePending(let flags, let id, let url, let date):
return ("webPagePending", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("date", date as Any)])
}
}
public static func parse_webPage(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Int32?
_5 = reader.readInt32()
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
var _7: String?
if Int(_1!) & Int(1 << 1) != 0 {_7 = parseString(reader) }
var _8: String?
if Int(_1!) & Int(1 << 2) != 0 {_8 = parseString(reader) }
var _9: String?
if Int(_1!) & Int(1 << 3) != 0 {_9 = parseString(reader) }
var _10: Api.Photo?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_10 = Api.parse(reader, signature: signature) as? Api.Photo
} }
var _11: String?
if Int(_1!) & Int(1 << 5) != 0 {_11 = parseString(reader) }
var _12: String?
if Int(_1!) & Int(1 << 5) != 0 {_12 = parseString(reader) }
var _13: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_13 = reader.readInt32() }
var _14: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_14 = reader.readInt32() }
var _15: Int32?
if Int(_1!) & Int(1 << 7) != 0 {_15 = reader.readInt32() }
var _16: String?
if Int(_1!) & Int(1 << 8) != 0 {_16 = parseString(reader) }
var _17: Api.Document?
if Int(_1!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() {
_17 = Api.parse(reader, signature: signature) as? Api.Document
} }
var _18: Api.Page?
if Int(_1!) & Int(1 << 10) != 0 {if let signature = reader.readInt32() {
_18 = Api.parse(reader, signature: signature) as? Api.Page
} }
var _19: [Api.WebPageAttribute]?
if Int(_1!) & Int(1 << 12) != 0 {if let _ = reader.readInt32() {
_19 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebPageAttribute.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 3) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 4) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 5) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 6) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 6) == 0) || _14 != nil
let _c15 = (Int(_1!) & Int(1 << 7) == 0) || _15 != nil
let _c16 = (Int(_1!) & Int(1 << 8) == 0) || _16 != nil
let _c17 = (Int(_1!) & Int(1 << 9) == 0) || _17 != nil
let _c18 = (Int(_1!) & Int(1 << 10) == 0) || _18 != nil
let _c19 = (Int(_1!) & Int(1 << 12) == 0) || _19 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
return Api.WebPage.webPage(flags: _1!, id: _2!, url: _3!, displayUrl: _4!, hash: _5!, type: _6, siteName: _7, title: _8, description: _9, photo: _10, embedUrl: _11, embedType: _12, embedWidth: _13, embedHeight: _14, duration: _15, author: _16, document: _17, cachedPage: _18, attributes: _19)
}
else {
return nil
}
}
public static func parse_webPageEmpty(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.WebPage.webPageEmpty(flags: _1!, id: _2!, url: _3)
}
else {
return nil
}
}
public static func parse_webPageNotModified(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
if _c1 && _c2 {
return Api.WebPage.webPageNotModified(flags: _1!, cachedPageViews: _2)
}
else {
return nil
}
}
public static func parse_webPagePending(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.WebPage.webPagePending(flags: _1!, id: _2!, url: _3, date: _4!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,207 @@
public extension Api {
enum WebPage: TypeConstructorDescription {
case webPage(flags: Int32, id: Int64, url: String, displayUrl: String, hash: Int32, type: String?, siteName: String?, title: String?, description: String?, photo: Api.Photo?, embedUrl: String?, embedType: String?, embedWidth: Int32?, embedHeight: Int32?, duration: Int32?, author: String?, document: Api.Document?, cachedPage: Api.Page?, attributes: [Api.WebPageAttribute]?)
case webPageEmpty(flags: Int32, id: Int64, url: String?)
case webPageNotModified(flags: Int32, cachedPageViews: Int32?)
case webPagePending(flags: Int32, id: Int64, url: String?, date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
if boxed {
buffer.appendInt32(-392411726)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
serializeString(url, buffer: buffer, boxed: false)
serializeString(displayUrl, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(type!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(siteName!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {serializeString(description!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {photo!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedUrl!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedType!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedWidth!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedHeight!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(duration!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 8) != 0 {serializeString(author!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 9) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 10) != 0 {cachedPage!.serialize(buffer, true)}
if Int(flags) & Int(1 << 12) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(attributes!.count))
for item in attributes! {
item.serialize(buffer, true)
}}
break
case .webPageEmpty(let flags, let id, let url):
if boxed {
buffer.appendInt32(555358088)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
break
case .webPageNotModified(let flags, let cachedPageViews):
if boxed {
buffer.appendInt32(1930545681)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(cachedPageViews!, buffer: buffer, boxed: false)}
break
case .webPagePending(let flags, let id, let url, let date):
if boxed {
buffer.appendInt32(-1328464313)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
return ("webPage", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("displayUrl", displayUrl as Any), ("hash", hash as Any), ("type", type as Any), ("siteName", siteName as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("embedUrl", embedUrl as Any), ("embedType", embedType as Any), ("embedWidth", embedWidth as Any), ("embedHeight", embedHeight as Any), ("duration", duration as Any), ("author", author as Any), ("document", document as Any), ("cachedPage", cachedPage as Any), ("attributes", attributes as Any)])
case .webPageEmpty(let flags, let id, let url):
return ("webPageEmpty", [("flags", flags as Any), ("id", id as Any), ("url", url as Any)])
case .webPageNotModified(let flags, let cachedPageViews):
return ("webPageNotModified", [("flags", flags as Any), ("cachedPageViews", cachedPageViews as Any)])
case .webPagePending(let flags, let id, let url, let date):
return ("webPagePending", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("date", date as Any)])
}
}
public static func parse_webPage(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Int32?
_5 = reader.readInt32()
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
var _7: String?
if Int(_1!) & Int(1 << 1) != 0 {_7 = parseString(reader) }
var _8: String?
if Int(_1!) & Int(1 << 2) != 0 {_8 = parseString(reader) }
var _9: String?
if Int(_1!) & Int(1 << 3) != 0 {_9 = parseString(reader) }
var _10: Api.Photo?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_10 = Api.parse(reader, signature: signature) as? Api.Photo
} }
var _11: String?
if Int(_1!) & Int(1 << 5) != 0 {_11 = parseString(reader) }
var _12: String?
if Int(_1!) & Int(1 << 5) != 0 {_12 = parseString(reader) }
var _13: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_13 = reader.readInt32() }
var _14: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_14 = reader.readInt32() }
var _15: Int32?
if Int(_1!) & Int(1 << 7) != 0 {_15 = reader.readInt32() }
var _16: String?
if Int(_1!) & Int(1 << 8) != 0 {_16 = parseString(reader) }
var _17: Api.Document?
if Int(_1!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() {
_17 = Api.parse(reader, signature: signature) as? Api.Document
} }
var _18: Api.Page?
if Int(_1!) & Int(1 << 10) != 0 {if let signature = reader.readInt32() {
_18 = Api.parse(reader, signature: signature) as? Api.Page
} }
var _19: [Api.WebPageAttribute]?
if Int(_1!) & Int(1 << 12) != 0 {if let _ = reader.readInt32() {
_19 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebPageAttribute.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 3) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 4) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 5) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 6) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 6) == 0) || _14 != nil
let _c15 = (Int(_1!) & Int(1 << 7) == 0) || _15 != nil
let _c16 = (Int(_1!) & Int(1 << 8) == 0) || _16 != nil
let _c17 = (Int(_1!) & Int(1 << 9) == 0) || _17 != nil
let _c18 = (Int(_1!) & Int(1 << 10) == 0) || _18 != nil
let _c19 = (Int(_1!) & Int(1 << 12) == 0) || _19 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
return Api.WebPage.webPage(flags: _1!, id: _2!, url: _3!, displayUrl: _4!, hash: _5!, type: _6, siteName: _7, title: _8, description: _9, photo: _10, embedUrl: _11, embedType: _12, embedWidth: _13, embedHeight: _14, duration: _15, author: _16, document: _17, cachedPage: _18, attributes: _19)
}
else {
return nil
}
}
public static func parse_webPageEmpty(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.WebPage.webPageEmpty(flags: _1!, id: _2!, url: _3)
}
else {
return nil
}
}
public static func parse_webPageNotModified(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
if _c1 && _c2 {
return Api.WebPage.webPageNotModified(flags: _1!, cachedPageViews: _2)
}
else {
return nil
}
}
public static func parse_webPagePending(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.WebPage.webPagePending(flags: _1!, id: _2!, url: _3, date: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum WebPageAttribute: TypeConstructorDescription {
case webPageAttributeStory(flags: Int32, peer: Api.Peer, id: Int32, story: Api.StoryItem?)
@ -1140,153 +1344,3 @@ public extension Api.account {
}
}
public extension Api.account {
enum TmpPassword: TypeConstructorDescription {
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .tmpPassword(let tmpPassword, let validUntil):
if boxed {
buffer.appendInt32(-614138572)
}
serializeBytes(tmpPassword, buffer: buffer, boxed: false)
serializeInt32(validUntil, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .tmpPassword(let tmpPassword, let validUntil):
return ("tmpPassword", [("tmpPassword", tmpPassword as Any), ("validUntil", validUntil as Any)])
}
}
public static func parse_tmpPassword(_ reader: BufferReader) -> TmpPassword? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.TmpPassword.tmpPassword(tmpPassword: _1!, validUntil: _2!)
}
else {
return nil
}
}
}
}
public extension Api.account {
enum WallPapers: TypeConstructorDescription {
case wallPapers(hash: Int64, wallpapers: [Api.WallPaper])
case wallPapersNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .wallPapers(let hash, let wallpapers):
if boxed {
buffer.appendInt32(-842824308)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(wallpapers.count))
for item in wallpapers {
item.serialize(buffer, true)
}
break
case .wallPapersNotModified:
if boxed {
buffer.appendInt32(471437699)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .wallPapers(let hash, let wallpapers):
return ("wallPapers", [("hash", hash as Any), ("wallpapers", wallpapers as Any)])
case .wallPapersNotModified:
return ("wallPapersNotModified", [])
}
}
public static func parse_wallPapers(_ reader: BufferReader) -> WallPapers? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.WallPaper]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.WallPapers.wallPapers(hash: _1!, wallpapers: _2!)
}
else {
return nil
}
}
public static func parse_wallPapersNotModified(_ reader: BufferReader) -> WallPapers? {
return Api.account.WallPapers.wallPapersNotModified
}
}
}
public extension Api.account {
enum WebAuthorizations: TypeConstructorDescription {
case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webAuthorizations(let authorizations, let users):
if boxed {
buffer.appendInt32(-313079300)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(authorizations.count))
for item in authorizations {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webAuthorizations(let authorizations, let users):
return ("webAuthorizations", [("authorizations", authorizations as Any), ("users", users as Any)])
}
}
public static func parse_webAuthorizations(_ reader: BufferReader) -> WebAuthorizations? {
var _1: [Api.WebAuthorization]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebAuthorization.self)
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.WebAuthorizations.webAuthorizations(authorizations: _1!, users: _2!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,153 @@
public extension Api.account {
enum TmpPassword: TypeConstructorDescription {
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .tmpPassword(let tmpPassword, let validUntil):
if boxed {
buffer.appendInt32(-614138572)
}
serializeBytes(tmpPassword, buffer: buffer, boxed: false)
serializeInt32(validUntil, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .tmpPassword(let tmpPassword, let validUntil):
return ("tmpPassword", [("tmpPassword", tmpPassword as Any), ("validUntil", validUntil as Any)])
}
}
public static func parse_tmpPassword(_ reader: BufferReader) -> TmpPassword? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.TmpPassword.tmpPassword(tmpPassword: _1!, validUntil: _2!)
}
else {
return nil
}
}
}
}
public extension Api.account {
enum WallPapers: TypeConstructorDescription {
case wallPapers(hash: Int64, wallpapers: [Api.WallPaper])
case wallPapersNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .wallPapers(let hash, let wallpapers):
if boxed {
buffer.appendInt32(-842824308)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(wallpapers.count))
for item in wallpapers {
item.serialize(buffer, true)
}
break
case .wallPapersNotModified:
if boxed {
buffer.appendInt32(471437699)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .wallPapers(let hash, let wallpapers):
return ("wallPapers", [("hash", hash as Any), ("wallpapers", wallpapers as Any)])
case .wallPapersNotModified:
return ("wallPapersNotModified", [])
}
}
public static func parse_wallPapers(_ reader: BufferReader) -> WallPapers? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.WallPaper]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WallPaper.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.WallPapers.wallPapers(hash: _1!, wallpapers: _2!)
}
else {
return nil
}
}
public static func parse_wallPapersNotModified(_ reader: BufferReader) -> WallPapers? {
return Api.account.WallPapers.wallPapersNotModified
}
}
}
public extension Api.account {
enum WebAuthorizations: TypeConstructorDescription {
case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webAuthorizations(let authorizations, let users):
if boxed {
buffer.appendInt32(-313079300)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(authorizations.count))
for item in authorizations {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webAuthorizations(let authorizations, let users):
return ("webAuthorizations", [("authorizations", authorizations as Any), ("users", users as Any)])
}
}
public static func parse_webAuthorizations(_ reader: BufferReader) -> WebAuthorizations? {
var _1: [Api.WebAuthorization]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebAuthorization.self)
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.WebAuthorizations.webAuthorizations(authorizations: _1!, users: _2!)
}
else {
return nil
}
}
}
}
public extension Api.auth {
enum Authorization: TypeConstructorDescription {
case authorization(flags: Int32, otherwiseReloginDays: Int32?, tmpSessions: Int32?, futureAuthToken: Buffer?, user: Api.User)
@ -912,199 +1062,3 @@ public extension Api.channels {
}
}
public extension Api.channels {
enum SendAsPeers: TypeConstructorDescription {
case sendAsPeers(peers: [Api.SendAsPeer], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sendAsPeers(let peers, let chats, let users):
if boxed {
buffer.appendInt32(-191450938)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peers.count))
for item in peers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sendAsPeers(let peers, let chats, let users):
return ("sendAsPeers", [("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_sendAsPeers(_ reader: BufferReader) -> SendAsPeers? {
var _1: [Api.SendAsPeer]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SendAsPeer.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.channels.SendAsPeers.sendAsPeers(peers: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.chatlists {
enum ChatlistInvite: TypeConstructorDescription {
case chatlistInvite(flags: Int32, title: String, emoticon: String?, peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
case chatlistInviteAlready(filterId: Int32, missingPeers: [Api.Peer], alreadyPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .chatlistInvite(let flags, let title, let emoticon, let peers, let chats, let users):
if boxed {
buffer.appendInt32(500007837)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(emoticon!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peers.count))
for item in peers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .chatlistInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
if boxed {
buffer.appendInt32(-91752871)
}
serializeInt32(filterId, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(missingPeers.count))
for item in missingPeers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(alreadyPeers.count))
for item in alreadyPeers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .chatlistInvite(let flags, let title, let emoticon, let peers, let chats, let users):
return ("chatlistInvite", [("flags", flags as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
case .chatlistInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
return ("chatlistInviteAlready", [("filterId", filterId as Any), ("missingPeers", missingPeers as Any), ("alreadyPeers", alreadyPeers as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_chatlistInvite(_ reader: BufferReader) -> ChatlistInvite? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: [Api.Peer]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.chatlists.ChatlistInvite.chatlistInvite(flags: _1!, title: _2!, emoticon: _3, peers: _4!, chats: _5!, users: _6!)
}
else {
return nil
}
}
public static func parse_chatlistInviteAlready(_ reader: BufferReader) -> ChatlistInvite? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Peer]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _3: [Api.Peer]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.chatlists.ChatlistInvite.chatlistInviteAlready(filterId: _1!, missingPeers: _2!, alreadyPeers: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,199 @@
public extension Api.channels {
enum SendAsPeers: TypeConstructorDescription {
case sendAsPeers(peers: [Api.SendAsPeer], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sendAsPeers(let peers, let chats, let users):
if boxed {
buffer.appendInt32(-191450938)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peers.count))
for item in peers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sendAsPeers(let peers, let chats, let users):
return ("sendAsPeers", [("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_sendAsPeers(_ reader: BufferReader) -> SendAsPeers? {
var _1: [Api.SendAsPeer]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SendAsPeer.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.channels.SendAsPeers.sendAsPeers(peers: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.chatlists {
enum ChatlistInvite: TypeConstructorDescription {
case chatlistInvite(flags: Int32, title: String, emoticon: String?, peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
case chatlistInviteAlready(filterId: Int32, missingPeers: [Api.Peer], alreadyPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .chatlistInvite(let flags, let title, let emoticon, let peers, let chats, let users):
if boxed {
buffer.appendInt32(500007837)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(emoticon!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peers.count))
for item in peers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .chatlistInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
if boxed {
buffer.appendInt32(-91752871)
}
serializeInt32(filterId, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(missingPeers.count))
for item in missingPeers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(alreadyPeers.count))
for item in alreadyPeers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .chatlistInvite(let flags, let title, let emoticon, let peers, let chats, let users):
return ("chatlistInvite", [("flags", flags as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
case .chatlistInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
return ("chatlistInviteAlready", [("filterId", filterId as Any), ("missingPeers", missingPeers as Any), ("alreadyPeers", alreadyPeers as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_chatlistInvite(_ reader: BufferReader) -> ChatlistInvite? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: [Api.Peer]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.chatlists.ChatlistInvite.chatlistInvite(flags: _1!, title: _2!, emoticon: _3, peers: _4!, chats: _5!, users: _6!)
}
else {
return nil
}
}
public static func parse_chatlistInviteAlready(_ reader: BufferReader) -> ChatlistInvite? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Peer]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _3: [Api.Peer]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.chatlists.ChatlistInvite.chatlistInviteAlready(filterId: _1!, missingPeers: _2!, alreadyPeers: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.chatlists {
enum ChatlistUpdates: TypeConstructorDescription {
case chatlistUpdates(missingPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
@ -1254,149 +1450,3 @@ public extension Api.help {
}
}
public extension Api.help {
enum PeerColorSet: TypeConstructorDescription {
case peerColorProfileSet(paletteColors: [Int32], bgColors: [Int32], storyColors: [Int32])
case peerColorSet(colors: [Int32])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .peerColorProfileSet(let paletteColors, let bgColors, let storyColors):
if boxed {
buffer.appendInt32(1987928555)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(paletteColors.count))
for item in paletteColors {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(bgColors.count))
for item in bgColors {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(storyColors.count))
for item in storyColors {
serializeInt32(item, buffer: buffer, boxed: false)
}
break
case .peerColorSet(let colors):
if boxed {
buffer.appendInt32(639736408)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(colors.count))
for item in colors {
serializeInt32(item, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .peerColorProfileSet(let paletteColors, let bgColors, let storyColors):
return ("peerColorProfileSet", [("paletteColors", paletteColors as Any), ("bgColors", bgColors as Any), ("storyColors", storyColors as Any)])
case .peerColorSet(let colors):
return ("peerColorSet", [("colors", colors as Any)])
}
}
public static func parse_peerColorProfileSet(_ reader: BufferReader) -> PeerColorSet? {
var _1: [Int32]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
var _2: [Int32]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
var _3: [Int32]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.help.PeerColorSet.peerColorProfileSet(paletteColors: _1!, bgColors: _2!, storyColors: _3!)
}
else {
return nil
}
}
public static func parse_peerColorSet(_ reader: BufferReader) -> PeerColorSet? {
var _1: [Int32]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.help.PeerColorSet.peerColorSet(colors: _1!)
}
else {
return nil
}
}
}
}
public extension Api.help {
enum PeerColors: TypeConstructorDescription {
case peerColors(hash: Int32, colors: [Api.help.PeerColorOption])
case peerColorsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .peerColors(let hash, let colors):
if boxed {
buffer.appendInt32(16313608)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(colors.count))
for item in colors {
item.serialize(buffer, true)
}
break
case .peerColorsNotModified:
if boxed {
buffer.appendInt32(732034510)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .peerColors(let hash, let colors):
return ("peerColors", [("hash", hash as Any), ("colors", colors as Any)])
case .peerColorsNotModified:
return ("peerColorsNotModified", [])
}
}
public static func parse_peerColors(_ reader: BufferReader) -> PeerColors? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.help.PeerColorOption]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.help.PeerColorOption.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.help.PeerColors.peerColors(hash: _1!, colors: _2!)
}
else {
return nil
}
}
public static func parse_peerColorsNotModified(_ reader: BufferReader) -> PeerColors? {
return Api.help.PeerColors.peerColorsNotModified
}
}
}

View File

@ -1,3 +1,149 @@
public extension Api.help {
enum PeerColorSet: TypeConstructorDescription {
case peerColorProfileSet(paletteColors: [Int32], bgColors: [Int32], storyColors: [Int32])
case peerColorSet(colors: [Int32])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .peerColorProfileSet(let paletteColors, let bgColors, let storyColors):
if boxed {
buffer.appendInt32(1987928555)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(paletteColors.count))
for item in paletteColors {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(bgColors.count))
for item in bgColors {
serializeInt32(item, buffer: buffer, boxed: false)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(storyColors.count))
for item in storyColors {
serializeInt32(item, buffer: buffer, boxed: false)
}
break
case .peerColorSet(let colors):
if boxed {
buffer.appendInt32(639736408)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(colors.count))
for item in colors {
serializeInt32(item, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .peerColorProfileSet(let paletteColors, let bgColors, let storyColors):
return ("peerColorProfileSet", [("paletteColors", paletteColors as Any), ("bgColors", bgColors as Any), ("storyColors", storyColors as Any)])
case .peerColorSet(let colors):
return ("peerColorSet", [("colors", colors as Any)])
}
}
public static func parse_peerColorProfileSet(_ reader: BufferReader) -> PeerColorSet? {
var _1: [Int32]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
var _2: [Int32]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
var _3: [Int32]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.help.PeerColorSet.peerColorProfileSet(paletteColors: _1!, bgColors: _2!, storyColors: _3!)
}
else {
return nil
}
}
public static func parse_peerColorSet(_ reader: BufferReader) -> PeerColorSet? {
var _1: [Int32]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.help.PeerColorSet.peerColorSet(colors: _1!)
}
else {
return nil
}
}
}
}
public extension Api.help {
enum PeerColors: TypeConstructorDescription {
case peerColors(hash: Int32, colors: [Api.help.PeerColorOption])
case peerColorsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .peerColors(let hash, let colors):
if boxed {
buffer.appendInt32(16313608)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(colors.count))
for item in colors {
item.serialize(buffer, true)
}
break
case .peerColorsNotModified:
if boxed {
buffer.appendInt32(732034510)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .peerColors(let hash, let colors):
return ("peerColors", [("hash", hash as Any), ("colors", colors as Any)])
case .peerColorsNotModified:
return ("peerColorsNotModified", [])
}
}
public static func parse_peerColors(_ reader: BufferReader) -> PeerColors? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.help.PeerColorOption]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.help.PeerColorOption.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.help.PeerColors.peerColors(hash: _1!, colors: _2!)
}
else {
return nil
}
}
public static func parse_peerColorsNotModified(_ reader: BufferReader) -> PeerColors? {
return Api.help.PeerColors.peerColorsNotModified
}
}
}
public extension Api.help {
enum PremiumPromo: TypeConstructorDescription {
case premiumPromo(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document], periodOptions: [Api.PremiumSubscriptionOption], users: [Api.User])
@ -1250,223 +1396,3 @@ public extension Api.messages {
}
}
public extension Api.messages {
enum DhConfig: TypeConstructorDescription {
case dhConfig(g: Int32, p: Buffer, version: Int32, random: Buffer)
case dhConfigNotModified(random: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .dhConfig(let g, let p, let version, let random):
if boxed {
buffer.appendInt32(740433629)
}
serializeInt32(g, buffer: buffer, boxed: false)
serializeBytes(p, buffer: buffer, boxed: false)
serializeInt32(version, buffer: buffer, boxed: false)
serializeBytes(random, buffer: buffer, boxed: false)
break
case .dhConfigNotModified(let random):
if boxed {
buffer.appendInt32(-1058912715)
}
serializeBytes(random, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .dhConfig(let g, let p, let version, let random):
return ("dhConfig", [("g", g as Any), ("p", p as Any), ("version", version as Any), ("random", random as Any)])
case .dhConfigNotModified(let random):
return ("dhConfigNotModified", [("random", random as Any)])
}
}
public static func parse_dhConfig(_ reader: BufferReader) -> DhConfig? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Int32?
_3 = reader.readInt32()
var _4: Buffer?
_4 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.DhConfig.dhConfig(g: _1!, p: _2!, version: _3!, random: _4!)
}
else {
return nil
}
}
public static func parse_dhConfigNotModified(_ reader: BufferReader) -> DhConfig? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.messages.DhConfig.dhConfigNotModified(random: _1!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum Dialogs: TypeConstructorDescription {
case dialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
case dialogsNotModified(count: Int32)
case dialogsSlice(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .dialogs(let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(364538944)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .dialogsNotModified(let count):
if boxed {
buffer.appendInt32(-253500010)
}
serializeInt32(count, buffer: buffer, boxed: false)
break
case .dialogsSlice(let count, let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(1910543603)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .dialogs(let dialogs, let messages, let chats, let users):
return ("dialogs", [("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
case .dialogsNotModified(let count):
return ("dialogsNotModified", [("count", count as Any)])
case .dialogsSlice(let count, let dialogs, let messages, let chats, let users):
return ("dialogsSlice", [("count", count as Any), ("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_dialogs(_ reader: BufferReader) -> Dialogs? {
var _1: [Api.Dialog]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self)
}
var _2: [Api.Message]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.Dialogs.dialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
}
else {
return nil
}
}
public static func parse_dialogsNotModified(_ reader: BufferReader) -> Dialogs? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.Dialogs.dialogsNotModified(count: _1!)
}
else {
return nil
}
}
public static func parse_dialogsSlice(_ reader: BufferReader) -> Dialogs? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Dialog]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self)
}
var _3: [Api.Message]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.Dialogs.dialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,223 @@
public extension Api.messages {
enum DhConfig: TypeConstructorDescription {
case dhConfig(g: Int32, p: Buffer, version: Int32, random: Buffer)
case dhConfigNotModified(random: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .dhConfig(let g, let p, let version, let random):
if boxed {
buffer.appendInt32(740433629)
}
serializeInt32(g, buffer: buffer, boxed: false)
serializeBytes(p, buffer: buffer, boxed: false)
serializeInt32(version, buffer: buffer, boxed: false)
serializeBytes(random, buffer: buffer, boxed: false)
break
case .dhConfigNotModified(let random):
if boxed {
buffer.appendInt32(-1058912715)
}
serializeBytes(random, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .dhConfig(let g, let p, let version, let random):
return ("dhConfig", [("g", g as Any), ("p", p as Any), ("version", version as Any), ("random", random as Any)])
case .dhConfigNotModified(let random):
return ("dhConfigNotModified", [("random", random as Any)])
}
}
public static func parse_dhConfig(_ reader: BufferReader) -> DhConfig? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Int32?
_3 = reader.readInt32()
var _4: Buffer?
_4 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.DhConfig.dhConfig(g: _1!, p: _2!, version: _3!, random: _4!)
}
else {
return nil
}
}
public static func parse_dhConfigNotModified(_ reader: BufferReader) -> DhConfig? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.messages.DhConfig.dhConfigNotModified(random: _1!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum Dialogs: TypeConstructorDescription {
case dialogs(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
case dialogsNotModified(count: Int32)
case dialogsSlice(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .dialogs(let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(364538944)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .dialogsNotModified(let count):
if boxed {
buffer.appendInt32(-253500010)
}
serializeInt32(count, buffer: buffer, boxed: false)
break
case .dialogsSlice(let count, let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(1910543603)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .dialogs(let dialogs, let messages, let chats, let users):
return ("dialogs", [("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
case .dialogsNotModified(let count):
return ("dialogsNotModified", [("count", count as Any)])
case .dialogsSlice(let count, let dialogs, let messages, let chats, let users):
return ("dialogsSlice", [("count", count as Any), ("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_dialogs(_ reader: BufferReader) -> Dialogs? {
var _1: [Api.Dialog]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self)
}
var _2: [Api.Message]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.Dialogs.dialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
}
else {
return nil
}
}
public static func parse_dialogsNotModified(_ reader: BufferReader) -> Dialogs? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.Dialogs.dialogsNotModified(count: _1!)
}
else {
return nil
}
}
public static func parse_dialogsSlice(_ reader: BufferReader) -> Dialogs? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.Dialog]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self)
}
var _3: [Api.Message]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.Dialogs.dialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum DiscussionMessage: TypeConstructorDescription {
case discussionMessage(flags: Int32, messages: [Api.Message], maxId: Int32?, readInboxMaxId: Int32?, readOutboxMaxId: Int32?, unreadCount: Int32, chats: [Api.Chat], users: [Api.User])
@ -1346,233 +1566,3 @@ public extension Api.messages {
}
}
public extension Api.messages {
enum RecentStickers: TypeConstructorDescription {
case recentStickers(hash: Int64, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32])
case recentStickersNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .recentStickers(let hash, let packs, let stickers, let dates):
if boxed {
buffer.appendInt32(-1999405994)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(packs.count))
for item in packs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(stickers.count))
for item in stickers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dates.count))
for item in dates {
serializeInt32(item, buffer: buffer, boxed: false)
}
break
case .recentStickersNotModified:
if boxed {
buffer.appendInt32(186120336)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .recentStickers(let hash, let packs, let stickers, let dates):
return ("recentStickers", [("hash", hash as Any), ("packs", packs as Any), ("stickers", stickers as Any), ("dates", dates as Any)])
case .recentStickersNotModified:
return ("recentStickersNotModified", [])
}
}
public static func parse_recentStickers(_ reader: BufferReader) -> RecentStickers? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.StickerPack]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self)
}
var _3: [Api.Document]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
var _4: [Int32]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.RecentStickers.recentStickers(hash: _1!, packs: _2!, stickers: _3!, dates: _4!)
}
else {
return nil
}
}
public static func parse_recentStickersNotModified(_ reader: BufferReader) -> RecentStickers? {
return Api.messages.RecentStickers.recentStickersNotModified
}
}
}
public extension Api.messages {
enum SavedDialogs: TypeConstructorDescription {
case savedDialogs(dialogs: [Api.SavedDialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
case savedDialogsNotModified(count: Int32)
case savedDialogsSlice(count: Int32, dialogs: [Api.SavedDialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedDialogs(let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(-130358751)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .savedDialogsNotModified(let count):
if boxed {
buffer.appendInt32(-1071681560)
}
serializeInt32(count, buffer: buffer, boxed: false)
break
case .savedDialogsSlice(let count, let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(1153080793)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedDialogs(let dialogs, let messages, let chats, let users):
return ("savedDialogs", [("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
case .savedDialogsNotModified(let count):
return ("savedDialogsNotModified", [("count", count as Any)])
case .savedDialogsSlice(let count, let dialogs, let messages, let chats, let users):
return ("savedDialogsSlice", [("count", count as Any), ("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_savedDialogs(_ reader: BufferReader) -> SavedDialogs? {
var _1: [Api.SavedDialog]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedDialog.self)
}
var _2: [Api.Message]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.SavedDialogs.savedDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
}
else {
return nil
}
}
public static func parse_savedDialogsNotModified(_ reader: BufferReader) -> SavedDialogs? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.SavedDialogs.savedDialogsNotModified(count: _1!)
}
else {
return nil
}
}
public static func parse_savedDialogsSlice(_ reader: BufferReader) -> SavedDialogs? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.SavedDialog]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedDialog.self)
}
var _3: [Api.Message]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.SavedDialogs.savedDialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,233 @@
public extension Api.messages {
enum RecentStickers: TypeConstructorDescription {
case recentStickers(hash: Int64, packs: [Api.StickerPack], stickers: [Api.Document], dates: [Int32])
case recentStickersNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .recentStickers(let hash, let packs, let stickers, let dates):
if boxed {
buffer.appendInt32(-1999405994)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(packs.count))
for item in packs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(stickers.count))
for item in stickers {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dates.count))
for item in dates {
serializeInt32(item, buffer: buffer, boxed: false)
}
break
case .recentStickersNotModified:
if boxed {
buffer.appendInt32(186120336)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .recentStickers(let hash, let packs, let stickers, let dates):
return ("recentStickers", [("hash", hash as Any), ("packs", packs as Any), ("stickers", stickers as Any), ("dates", dates as Any)])
case .recentStickersNotModified:
return ("recentStickersNotModified", [])
}
}
public static func parse_recentStickers(_ reader: BufferReader) -> RecentStickers? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.StickerPack]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerPack.self)
}
var _3: [Api.Document]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
var _4: [Int32]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.RecentStickers.recentStickers(hash: _1!, packs: _2!, stickers: _3!, dates: _4!)
}
else {
return nil
}
}
public static func parse_recentStickersNotModified(_ reader: BufferReader) -> RecentStickers? {
return Api.messages.RecentStickers.recentStickersNotModified
}
}
}
public extension Api.messages {
enum SavedDialogs: TypeConstructorDescription {
case savedDialogs(dialogs: [Api.SavedDialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
case savedDialogsNotModified(count: Int32)
case savedDialogsSlice(count: Int32, dialogs: [Api.SavedDialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedDialogs(let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(-130358751)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .savedDialogsNotModified(let count):
if boxed {
buffer.appendInt32(-1071681560)
}
serializeInt32(count, buffer: buffer, boxed: false)
break
case .savedDialogsSlice(let count, let dialogs, let messages, let chats, let users):
if boxed {
buffer.appendInt32(1153080793)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(dialogs.count))
for item in dialogs {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedDialogs(let dialogs, let messages, let chats, let users):
return ("savedDialogs", [("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
case .savedDialogsNotModified(let count):
return ("savedDialogsNotModified", [("count", count as Any)])
case .savedDialogsSlice(let count, let dialogs, let messages, let chats, let users):
return ("savedDialogsSlice", [("count", count as Any), ("dialogs", dialogs as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_savedDialogs(_ reader: BufferReader) -> SavedDialogs? {
var _1: [Api.SavedDialog]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedDialog.self)
}
var _2: [Api.Message]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.messages.SavedDialogs.savedDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)
}
else {
return nil
}
}
public static func parse_savedDialogsNotModified(_ reader: BufferReader) -> SavedDialogs? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.messages.SavedDialogs.savedDialogsNotModified(count: _1!)
}
else {
return nil
}
}
public static func parse_savedDialogsSlice(_ reader: BufferReader) -> SavedDialogs? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.SavedDialog]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedDialog.self)
}
var _3: [Api.Message]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.messages.SavedDialogs.savedDialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum SavedGifs: TypeConstructorDescription {
case savedGifs(hash: Int64, gifs: [Api.Document])
@ -56,6 +286,64 @@ public extension Api.messages {
}
}
public extension Api.messages {
enum SavedReactionTags: TypeConstructorDescription {
case savedReactionTags(tags: [Api.SavedReactionTag], hash: Int64)
case savedReactionTagsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedReactionTags(let tags, let hash):
if boxed {
buffer.appendInt32(844731658)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(tags.count))
for item in tags {
item.serialize(buffer, true)
}
serializeInt64(hash, buffer: buffer, boxed: false)
break
case .savedReactionTagsNotModified:
if boxed {
buffer.appendInt32(-2003084817)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedReactionTags(let tags, let hash):
return ("savedReactionTags", [("tags", tags as Any), ("hash", hash as Any)])
case .savedReactionTagsNotModified:
return ("savedReactionTagsNotModified", [])
}
}
public static func parse_savedReactionTags(_ reader: BufferReader) -> SavedReactionTags? {
var _1: [Api.SavedReactionTag]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SavedReactionTag.self)
}
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.SavedReactionTags.savedReactionTags(tags: _1!, hash: _2!)
}
else {
return nil
}
}
public static func parse_savedReactionTagsNotModified(_ reader: BufferReader) -> SavedReactionTags? {
return Api.messages.SavedReactionTags.savedReactionTagsNotModified
}
}
}
public extension Api.messages {
enum SearchCounter: TypeConstructorDescription {
case searchCounter(flags: Int32, filter: Api.MessagesFilter, count: Int32)
@ -1176,367 +1464,3 @@ public extension Api.payments {
}
}
public extension Api.payments {
enum PaymentReceipt: TypeConstructorDescription {
case paymentReceipt(flags: Int32, date: Int32, botId: Int64, providerId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users):
if boxed {
buffer.appendInt32(1891958275)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt64(botId, buffer: buffer, boxed: false)
serializeInt64(providerId, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
serializeString(description, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
invoice.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {info!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {shipping!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {serializeInt64(tipAmount!, buffer: buffer, boxed: false)}
serializeString(currency, buffer: buffer, boxed: false)
serializeInt64(totalAmount, buffer: buffer, boxed: false)
serializeString(credentialsTitle, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
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):
return ("paymentReceipt", [("flags", flags as Any), ("date", date as Any), ("botId", botId as Any), ("providerId", providerId as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("info", info as Any), ("shipping", shipping as Any), ("tipAmount", tipAmount as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("credentialsTitle", credentialsTitle as Any), ("users", users as Any)])
}
}
public static func parse_paymentReceipt(_ reader: BufferReader) -> PaymentReceipt? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int64?
_4 = reader.readInt64()
var _5: String?
_5 = parseString(reader)
var _6: String?
_6 = parseString(reader)
var _7: Api.WebDocument?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.WebDocument
} }
var _8: Api.Invoice?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.Invoice
}
var _9: Api.PaymentRequestedInfo?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.PaymentRequestedInfo
} }
var _10: Api.ShippingOption?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_10 = Api.parse(reader, signature: signature) as? Api.ShippingOption
} }
var _11: Int64?
if Int(_1!) & Int(1 << 3) != 0 {_11 = reader.readInt64() }
var _12: String?
_12 = parseString(reader)
var _13: Int64?
_13 = reader.readInt64()
var _14: String?
_14 = parseString(reader)
var _15: [Api.User]?
if let _ = reader.readInt32() {
_15 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 0) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 1) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 3) == 0) || _11 != nil
let _c12 = _12 != nil
let _c13 = _13 != nil
let _c14 = _14 != nil
let _c15 = _15 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 {
return Api.payments.PaymentReceipt.paymentReceipt(flags: _1!, date: _2!, botId: _3!, providerId: _4!, title: _5!, description: _6!, photo: _7, invoice: _8!, info: _9, shipping: _10, tipAmount: _11, currency: _12!, totalAmount: _13!, credentialsTitle: _14!, users: _15!)
}
else {
return nil
}
}
}
}
public extension Api.payments {
indirect enum PaymentResult: TypeConstructorDescription {
case paymentResult(updates: Api.Updates)
case paymentVerificationNeeded(url: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .paymentResult(let updates):
if boxed {
buffer.appendInt32(1314881805)
}
updates.serialize(buffer, true)
break
case .paymentVerificationNeeded(let url):
if boxed {
buffer.appendInt32(-666824391)
}
serializeString(url, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .paymentResult(let updates):
return ("paymentResult", [("updates", updates as Any)])
case .paymentVerificationNeeded(let url):
return ("paymentVerificationNeeded", [("url", url as Any)])
}
}
public static func parse_paymentResult(_ reader: BufferReader) -> PaymentResult? {
var _1: Api.Updates?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Updates
}
let _c1 = _1 != nil
if _c1 {
return Api.payments.PaymentResult.paymentResult(updates: _1!)
}
else {
return nil
}
}
public static func parse_paymentVerificationNeeded(_ reader: BufferReader) -> PaymentResult? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.payments.PaymentResult.paymentVerificationNeeded(url: _1!)
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum SavedInfo: TypeConstructorDescription {
case savedInfo(flags: Int32, savedInfo: Api.PaymentRequestedInfo?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedInfo(let flags, let savedInfo):
if boxed {
buffer.appendInt32(-74456004)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {savedInfo!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedInfo(let flags, let savedInfo):
return ("savedInfo", [("flags", flags as Any), ("savedInfo", savedInfo as Any)])
}
}
public static func parse_savedInfo(_ reader: BufferReader) -> SavedInfo? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.PaymentRequestedInfo?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PaymentRequestedInfo
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
if _c1 && _c2 {
return Api.payments.SavedInfo.savedInfo(flags: _1!, savedInfo: _2)
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum ValidatedRequestedInfo: TypeConstructorDescription {
case validatedRequestedInfo(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
if boxed {
buffer.appendInt32(-784000893)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(id!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(shippingOptions!.count))
for item in shippingOptions! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
return ("validatedRequestedInfo", [("flags", flags as Any), ("id", id as Any), ("shippingOptions", shippingOptions as Any)])
}
}
public static func parse_validatedRequestedInfo(_ reader: BufferReader) -> ValidatedRequestedInfo? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
var _3: [Api.ShippingOption]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ShippingOption.self)
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.payments.ValidatedRequestedInfo.validatedRequestedInfo(flags: _1!, id: _2, shippingOptions: _3)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum ExportedGroupCallInvite: TypeConstructorDescription {
case exportedGroupCallInvite(link: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .exportedGroupCallInvite(let link):
if boxed {
buffer.appendInt32(541839704)
}
serializeString(link, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .exportedGroupCallInvite(let link):
return ("exportedGroupCallInvite", [("link", link as Any)])
}
}
public static func parse_exportedGroupCallInvite(_ reader: BufferReader) -> ExportedGroupCallInvite? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum GroupCall: TypeConstructorDescription {
case groupCall(call: Api.GroupCall, participants: [Api.GroupCallParticipant], participantsNextOffset: String, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
if boxed {
buffer.appendInt32(-1636664659)
}
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(participants.count))
for item in participants {
item.serialize(buffer, true)
}
serializeString(participantsNextOffset, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
return ("groupCall", [("call", call as Any), ("participants", participants as Any), ("participantsNextOffset", participantsNextOffset as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? {
var _1: Api.GroupCall?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCall
}
var _2: [Api.GroupCallParticipant]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
}
var _3: String?
_3 = parseString(reader)
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,367 @@
public extension Api.payments {
enum PaymentReceipt: TypeConstructorDescription {
case paymentReceipt(flags: Int32, date: Int32, botId: Int64, providerId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users):
if boxed {
buffer.appendInt32(1891958275)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt64(botId, buffer: buffer, boxed: false)
serializeInt64(providerId, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
serializeString(description, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
invoice.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {info!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {shipping!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {serializeInt64(tipAmount!, buffer: buffer, boxed: false)}
serializeString(currency, buffer: buffer, boxed: false)
serializeInt64(totalAmount, buffer: buffer, boxed: false)
serializeString(credentialsTitle, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
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):
return ("paymentReceipt", [("flags", flags as Any), ("date", date as Any), ("botId", botId as Any), ("providerId", providerId as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("info", info as Any), ("shipping", shipping as Any), ("tipAmount", tipAmount as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("credentialsTitle", credentialsTitle as Any), ("users", users as Any)])
}
}
public static func parse_paymentReceipt(_ reader: BufferReader) -> PaymentReceipt? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
var _4: Int64?
_4 = reader.readInt64()
var _5: String?
_5 = parseString(reader)
var _6: String?
_6 = parseString(reader)
var _7: Api.WebDocument?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.WebDocument
} }
var _8: Api.Invoice?
if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.Invoice
}
var _9: Api.PaymentRequestedInfo?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.PaymentRequestedInfo
} }
var _10: Api.ShippingOption?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_10 = Api.parse(reader, signature: signature) as? Api.ShippingOption
} }
var _11: Int64?
if Int(_1!) & Int(1 << 3) != 0 {_11 = reader.readInt64() }
var _12: String?
_12 = parseString(reader)
var _13: Int64?
_13 = reader.readInt64()
var _14: String?
_14 = parseString(reader)
var _15: [Api.User]?
if let _ = reader.readInt32() {
_15 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 0) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 1) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 3) == 0) || _11 != nil
let _c12 = _12 != nil
let _c13 = _13 != nil
let _c14 = _14 != nil
let _c15 = _15 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 {
return Api.payments.PaymentReceipt.paymentReceipt(flags: _1!, date: _2!, botId: _3!, providerId: _4!, title: _5!, description: _6!, photo: _7, invoice: _8!, info: _9, shipping: _10, tipAmount: _11, currency: _12!, totalAmount: _13!, credentialsTitle: _14!, users: _15!)
}
else {
return nil
}
}
}
}
public extension Api.payments {
indirect enum PaymentResult: TypeConstructorDescription {
case paymentResult(updates: Api.Updates)
case paymentVerificationNeeded(url: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .paymentResult(let updates):
if boxed {
buffer.appendInt32(1314881805)
}
updates.serialize(buffer, true)
break
case .paymentVerificationNeeded(let url):
if boxed {
buffer.appendInt32(-666824391)
}
serializeString(url, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .paymentResult(let updates):
return ("paymentResult", [("updates", updates as Any)])
case .paymentVerificationNeeded(let url):
return ("paymentVerificationNeeded", [("url", url as Any)])
}
}
public static func parse_paymentResult(_ reader: BufferReader) -> PaymentResult? {
var _1: Api.Updates?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Updates
}
let _c1 = _1 != nil
if _c1 {
return Api.payments.PaymentResult.paymentResult(updates: _1!)
}
else {
return nil
}
}
public static func parse_paymentVerificationNeeded(_ reader: BufferReader) -> PaymentResult? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.payments.PaymentResult.paymentVerificationNeeded(url: _1!)
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum SavedInfo: TypeConstructorDescription {
case savedInfo(flags: Int32, savedInfo: Api.PaymentRequestedInfo?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .savedInfo(let flags, let savedInfo):
if boxed {
buffer.appendInt32(-74456004)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {savedInfo!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .savedInfo(let flags, let savedInfo):
return ("savedInfo", [("flags", flags as Any), ("savedInfo", savedInfo as Any)])
}
}
public static func parse_savedInfo(_ reader: BufferReader) -> SavedInfo? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.PaymentRequestedInfo?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PaymentRequestedInfo
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
if _c1 && _c2 {
return Api.payments.SavedInfo.savedInfo(flags: _1!, savedInfo: _2)
}
else {
return nil
}
}
}
}
public extension Api.payments {
enum ValidatedRequestedInfo: TypeConstructorDescription {
case validatedRequestedInfo(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
if boxed {
buffer.appendInt32(-784000893)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(id!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(shippingOptions!.count))
for item in shippingOptions! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
return ("validatedRequestedInfo", [("flags", flags as Any), ("id", id as Any), ("shippingOptions", shippingOptions as Any)])
}
}
public static func parse_validatedRequestedInfo(_ reader: BufferReader) -> ValidatedRequestedInfo? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
var _3: [Api.ShippingOption]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ShippingOption.self)
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.payments.ValidatedRequestedInfo.validatedRequestedInfo(flags: _1!, id: _2, shippingOptions: _3)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum ExportedGroupCallInvite: TypeConstructorDescription {
case exportedGroupCallInvite(link: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .exportedGroupCallInvite(let link):
if boxed {
buffer.appendInt32(541839704)
}
serializeString(link, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .exportedGroupCallInvite(let link):
return ("exportedGroupCallInvite", [("link", link as Any)])
}
}
public static func parse_exportedGroupCallInvite(_ reader: BufferReader) -> ExportedGroupCallInvite? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum GroupCall: TypeConstructorDescription {
case groupCall(call: Api.GroupCall, participants: [Api.GroupCallParticipant], participantsNextOffset: String, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
if boxed {
buffer.appendInt32(-1636664659)
}
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(participants.count))
for item in participants {
item.serialize(buffer, true)
}
serializeString(participantsNextOffset, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
return ("groupCall", [("call", call as Any), ("participants", participants as Any), ("participantsNextOffset", participantsNextOffset as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? {
var _1: Api.GroupCall?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCall
}
var _2: [Api.GroupCallParticipant]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
}
var _3: String?
_3 = parseString(reader)
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum GroupCallStreamChannels: TypeConstructorDescription {
case groupCallStreamChannels(channels: [Api.GroupCallStreamChannel])
@ -1268,311 +1632,3 @@ public extension Api.storage {
}
}
public extension Api.stories {
enum AllStories: TypeConstructorDescription {
case allStories(flags: Int32, count: Int32, state: String, peerStories: [Api.PeerStories], chats: [Api.Chat], users: [Api.User], stealthMode: Api.StoriesStealthMode)
case allStoriesNotModified(flags: Int32, state: String, stealthMode: Api.StoriesStealthMode)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .allStories(let flags, let count, let state, let peerStories, let chats, let users, let stealthMode):
if boxed {
buffer.appendInt32(1862033025)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
serializeString(state, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peerStories.count))
for item in peerStories {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
stealthMode.serialize(buffer, true)
break
case .allStoriesNotModified(let flags, let state, let stealthMode):
if boxed {
buffer.appendInt32(291044926)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(state, buffer: buffer, boxed: false)
stealthMode.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .allStories(let flags, let count, let state, let peerStories, let chats, let users, let stealthMode):
return ("allStories", [("flags", flags as Any), ("count", count as Any), ("state", state as Any), ("peerStories", peerStories as Any), ("chats", chats as Any), ("users", users as Any), ("stealthMode", stealthMode as Any)])
case .allStoriesNotModified(let flags, let state, let stealthMode):
return ("allStoriesNotModified", [("flags", flags as Any), ("state", state as Any), ("stealthMode", stealthMode as Any)])
}
}
public static func parse_allStories(_ reader: BufferReader) -> AllStories? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: [Api.PeerStories]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerStories.self)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _7: Api.StoriesStealthMode?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.StoriesStealthMode
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.stories.AllStories.allStories(flags: _1!, count: _2!, state: _3!, peerStories: _4!, chats: _5!, users: _6!, stealthMode: _7!)
}
else {
return nil
}
}
public static func parse_allStoriesNotModified(_ reader: BufferReader) -> AllStories? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.StoriesStealthMode?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.StoriesStealthMode
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.stories.AllStories.allStoriesNotModified(flags: _1!, state: _2!, stealthMode: _3!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum PeerStories: TypeConstructorDescription {
case peerStories(stories: Api.PeerStories, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .peerStories(let stories, let chats, let users):
if boxed {
buffer.appendInt32(-890861720)
}
stories.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .peerStories(let stories, let chats, let users):
return ("peerStories", [("stories", stories as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_peerStories(_ reader: BufferReader) -> PeerStories? {
var _1: Api.PeerStories?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.PeerStories
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.stories.PeerStories.peerStories(stories: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum Stories: TypeConstructorDescription {
case stories(count: Int32, stories: [Api.StoryItem], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .stories(let count, let stories, let chats, let users):
if boxed {
buffer.appendInt32(1574486984)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(stories.count))
for item in stories {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .stories(let count, let stories, let chats, let users):
return ("stories", [("count", count as Any), ("stories", stories as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_stories(_ reader: BufferReader) -> Stories? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.StoryItem]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryItem.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.stories.Stories.stories(count: _1!, stories: _2!, chats: _3!, users: _4!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum StoryReactionsList: TypeConstructorDescription {
case storyReactionsList(flags: Int32, count: Int32, reactions: [Api.StoryReaction], chats: [Api.Chat], users: [Api.User], nextOffset: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .storyReactionsList(let flags, let count, let reactions, let chats, let users, let nextOffset):
if boxed {
buffer.appendInt32(-1436583780)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(reactions.count))
for item in reactions {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .storyReactionsList(let flags, let count, let reactions, let chats, let users, let nextOffset):
return ("storyReactionsList", [("flags", flags as Any), ("count", count as Any), ("reactions", reactions as Any), ("chats", chats as Any), ("users", users as Any), ("nextOffset", nextOffset as Any)])
}
}
public static func parse_storyReactionsList(_ reader: BufferReader) -> StoryReactionsList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.StoryReaction]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryReaction.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.stories.StoryReactionsList.storyReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,311 @@
public extension Api.stories {
enum AllStories: TypeConstructorDescription {
case allStories(flags: Int32, count: Int32, state: String, peerStories: [Api.PeerStories], chats: [Api.Chat], users: [Api.User], stealthMode: Api.StoriesStealthMode)
case allStoriesNotModified(flags: Int32, state: String, stealthMode: Api.StoriesStealthMode)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .allStories(let flags, let count, let state, let peerStories, let chats, let users, let stealthMode):
if boxed {
buffer.appendInt32(1862033025)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
serializeString(state, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(peerStories.count))
for item in peerStories {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
stealthMode.serialize(buffer, true)
break
case .allStoriesNotModified(let flags, let state, let stealthMode):
if boxed {
buffer.appendInt32(291044926)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(state, buffer: buffer, boxed: false)
stealthMode.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .allStories(let flags, let count, let state, let peerStories, let chats, let users, let stealthMode):
return ("allStories", [("flags", flags as Any), ("count", count as Any), ("state", state as Any), ("peerStories", peerStories as Any), ("chats", chats as Any), ("users", users as Any), ("stealthMode", stealthMode as Any)])
case .allStoriesNotModified(let flags, let state, let stealthMode):
return ("allStoriesNotModified", [("flags", flags as Any), ("state", state as Any), ("stealthMode", stealthMode as Any)])
}
}
public static func parse_allStories(_ reader: BufferReader) -> AllStories? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: [Api.PeerStories]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PeerStories.self)
}
var _5: [Api.Chat]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _6: [Api.User]?
if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _7: Api.StoriesStealthMode?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.StoriesStealthMode
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.stories.AllStories.allStories(flags: _1!, count: _2!, state: _3!, peerStories: _4!, chats: _5!, users: _6!, stealthMode: _7!)
}
else {
return nil
}
}
public static func parse_allStoriesNotModified(_ reader: BufferReader) -> AllStories? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.StoriesStealthMode?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.StoriesStealthMode
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.stories.AllStories.allStoriesNotModified(flags: _1!, state: _2!, stealthMode: _3!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum PeerStories: TypeConstructorDescription {
case peerStories(stories: Api.PeerStories, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .peerStories(let stories, let chats, let users):
if boxed {
buffer.appendInt32(-890861720)
}
stories.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .peerStories(let stories, let chats, let users):
return ("peerStories", [("stories", stories as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_peerStories(_ reader: BufferReader) -> PeerStories? {
var _1: Api.PeerStories?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.PeerStories
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.stories.PeerStories.peerStories(stories: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum Stories: TypeConstructorDescription {
case stories(count: Int32, stories: [Api.StoryItem], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .stories(let count, let stories, let chats, let users):
if boxed {
buffer.appendInt32(1574486984)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(stories.count))
for item in stories {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .stories(let count, let stories, let chats, let users):
return ("stories", [("count", count as Any), ("stories", stories as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_stories(_ reader: BufferReader) -> Stories? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.StoryItem]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryItem.self)
}
var _3: [Api.Chat]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _4: [Api.User]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.stories.Stories.stories(count: _1!, stories: _2!, chats: _3!, users: _4!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum StoryReactionsList: TypeConstructorDescription {
case storyReactionsList(flags: Int32, count: Int32, reactions: [Api.StoryReaction], chats: [Api.Chat], users: [Api.User], nextOffset: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .storyReactionsList(let flags, let count, let reactions, let chats, let users, let nextOffset):
if boxed {
buffer.appendInt32(-1436583780)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(reactions.count))
for item in reactions {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .storyReactionsList(let flags, let count, let reactions, let chats, let users, let nextOffset):
return ("storyReactionsList", [("flags", flags as Any), ("count", count as Any), ("reactions", reactions as Any), ("chats", chats as Any), ("users", users as Any), ("nextOffset", nextOffset as Any)])
}
}
public static func parse_storyReactionsList(_ reader: BufferReader) -> StoryReactionsList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.StoryReaction]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StoryReaction.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.stories.StoryReactionsList.storyReactionsList(flags: _1!, count: _2!, reactions: _3!, chats: _4!, users: _5!, nextOffset: _6)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum StoryViews: TypeConstructorDescription {
case storyViews(views: [Api.StoryViews], users: [Api.User])

View File

@ -5103,6 +5103,21 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func getDefaultTagReactions(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Reactions>) {
let buffer = Buffer()
buffer.appendInt32(-1107741656)
serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getDefaultTagReactions", parameters: [("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Reactions? in
let reader = BufferReader(buffer)
var result: Api.messages.Reactions?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.Reactions
}
return result
})
}
}
public extension Api.functions.messages {
static func getDhConfig(version: Int32, randomLength: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.DhConfig>) {
let buffer = Buffer()
@ -5678,6 +5693,22 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func getOutboxReadDate(peer: Api.InputPeer, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.OutboxReadDate>) {
let buffer = Buffer()
buffer.appendInt32(-1941176739)
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getOutboxReadDate", parameters: [("peer", String(describing: peer)), ("msgId", String(describing: msgId))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.OutboxReadDate? in
let reader = BufferReader(buffer)
var result: Api.OutboxReadDate?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.OutboxReadDate
}
return result
})
}
}
public extension Api.functions.messages {
static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.PeerDialogs>) {
let buffer = Buffer()
@ -5907,6 +5938,21 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func getSavedReactionTags(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.SavedReactionTags>) {
let buffer = Buffer()
buffer.appendInt32(1981668047)
serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.getSavedReactionTags", parameters: [("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SavedReactionTags? in
let reader = BufferReader(buffer)
var result: Api.messages.SavedReactionTags?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.messages.SavedReactionTags
}
return result
})
}
}
public extension Api.functions.messages {
static func getScheduledHistory(peer: Api.InputPeer, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer()
@ -6785,14 +6831,19 @@ public extension Api.functions.messages {
}
}
public extension Api.functions.messages {
static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputPeer?, savedPeerId: 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>) {
static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputPeer?, savedPeerId: Api.InputPeer?, savedReaction: [Api.Reaction]?, 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()
buffer.appendInt32(-1481316055)
buffer.appendInt32(703497338)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {savedPeerId!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(savedReaction!.count))
for item in savedReaction! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
filter.serialize(buffer, true)
serializeInt32(minDate, buffer: buffer, boxed: false)
@ -6803,7 +6854,7 @@ public extension Api.functions.messages {
serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, buffer: buffer, boxed: false)
serializeInt64(hash, buffer: buffer, boxed: false)
return (FunctionDescription(name: "messages.search", parameters: [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("q", String(describing: q)), ("fromId", String(describing: fromId)), ("savedPeerId", String(describing: savedPeerId)), ("topMsgId", String(describing: topMsgId)), ("filter", String(describing: filter)), ("minDate", String(describing: minDate)), ("maxDate", String(describing: maxDate)), ("offsetId", String(describing: offsetId)), ("addOffset", String(describing: addOffset)), ("limit", String(describing: limit)), ("maxId", String(describing: maxId)), ("minId", String(describing: minId)), ("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
return (FunctionDescription(name: "messages.search", parameters: [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("q", String(describing: q)), ("fromId", String(describing: fromId)), ("savedPeerId", String(describing: savedPeerId)), ("savedReaction", String(describing: savedReaction)), ("topMsgId", String(describing: topMsgId)), ("filter", String(describing: filter)), ("minDate", String(describing: minDate)), ("maxDate", String(describing: maxDate)), ("offsetId", String(describing: offsetId)), ("addOffset", String(describing: addOffset)), ("limit", String(describing: limit)), ("maxId", String(describing: maxId)), ("minId", String(describing: minId)), ("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in
let reader = BufferReader(buffer)
var result: Api.messages.Messages?
if let signature = reader.readInt32() {
@ -7709,6 +7760,23 @@ public extension Api.functions.messages {
})
}
}
public extension Api.functions.messages {
static func updateSavedReactionTag(flags: Int32, reaction: Api.Reaction, title: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1613331948)
serializeInt32(flags, buffer: buffer, boxed: false)
reaction.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
return (FunctionDescription(name: "messages.updateSavedReactionTag", parameters: [("flags", String(describing: flags)), ("reaction", String(describing: reaction)), ("title", String(describing: title))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public extension Api.functions.messages {
static func uploadEncryptedFile(peer: Api.InputEncryptedChat, file: Api.InputEncryptedFile) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EncryptedFile>) {
let buffer = Buffer()

View File

@ -8,6 +8,7 @@ extension ReactionsMessageAttribute {
case let .messageReactions(flags, results, recentReactions):
let min = (flags & (1 << 0)) != 0
let canViewList = (flags & (1 << 2)) != 0
let isTags = (flags & (1 << 3)) != 0
var reactions = results.compactMap { result -> MessageReaction? in
switch result {
case let .reactionCount(_, chosenOrder, reaction, count):
@ -53,7 +54,7 @@ extension ReactionsMessageAttribute {
}
}
}
return ReactionsMessageAttribute(canViewList: canViewList, reactions: reactions, recentPeers: parsedRecentReactions)
return ReactionsMessageAttribute(canViewList: canViewList, isTags: isTags, reactions: reactions, recentPeers: parsedRecentReactions)
}
}
}
@ -169,7 +170,7 @@ public func mergedMessageReactions(attributes: [MessageAttribute]) -> ReactionsM
recentPeers = updatedRecentPeers
if !reactions.isEmpty {
return ReactionsMessageAttribute(canViewList: current?.canViewList ?? false, reactions: reactions, recentPeers: recentPeers)
return ReactionsMessageAttribute(canViewList: current?.canViewList ?? false, isTags: current?.isTags ?? false, reactions: reactions, recentPeers: recentPeers)
} else {
return nil
}
@ -185,6 +186,7 @@ extension ReactionsMessageAttribute {
switch apiReactions {
case let .messageReactions(flags, results, recentReactions):
let canViewList = (flags & (1 << 2)) != 0
let isTags = (flags & (1 << 3)) != 0
let parsedRecentReactions: [ReactionsMessageAttribute.RecentPeer]
if let recentReactions = recentReactions {
parsedRecentReactions = recentReactions.compactMap { recentReaction -> ReactionsMessageAttribute.RecentPeer? in
@ -206,6 +208,7 @@ extension ReactionsMessageAttribute {
self.init(
canViewList: canViewList,
isTags: isTags,
reactions: results.compactMap { result -> MessageReaction? in
switch result {
case let .reactionCount(_, chosenOrder, reaction, count):

View File

@ -6,18 +6,20 @@ import TelegramApi
extension TelegramUserPresence {
convenience init(apiStatus: Api.UserStatus) {
switch apiStatus {
case .userStatusEmpty:
self.init(status: .none, lastActivity: 0)
case let .userStatusOnline(expires):
self.init(status: .present(until: expires), lastActivity: 0)
case let .userStatusOffline(wasOnline):
self.init(status: .present(until: wasOnline), lastActivity: 0)
case .userStatusRecently:
self.init(status: .recently, lastActivity: 0)
case .userStatusLastWeek:
self.init(status: .lastWeek, lastActivity: 0)
case .userStatusLastMonth:
self.init(status: .lastMonth, lastActivity: 0)
case .userStatusEmpty:
self.init(status: .none, lastActivity: 0)
case .userStatusHidden:
self.init(status: .hidden, lastActivity: 0)
case let .userStatusOnline(expires):
self.init(status: .present(until: expires), lastActivity: 0)
case let .userStatusOffline(wasOnline):
self.init(status: .present(until: wasOnline), lastActivity: 0)
case .userStatusRecently:
self.init(status: .recently, lastActivity: 0)
case .userStatusLastWeek:
self.init(status: .lastWeek, lastActivity: 0)
case .userStatusLastMonth:
self.init(status: .lastMonth, lastActivity: 0)
}
}

View File

@ -89,6 +89,7 @@ final class AccountTaskManager {
tasks.add(managedSynchronizeEmojiKeywordsOperations(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedApplyPendingScheduledMessagesActions(postbox: self.stateManager.postbox, network: self.stateManager.network, stateManager: self.stateManager).start())
tasks.add(managedSynchronizeAvailableReactions(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedSynchronizeSavedMessageTags(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .emoji).start())
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .status).start())
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .avatar).start())
@ -108,6 +109,7 @@ final class AccountTaskManager {
tasks.add(managedGroupPhotoEmoji(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedBackgroundIconEmoji(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedRecentReactions(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedDefaultTagReactions(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(_internal_loadedStickerPack(postbox: self.stateManager.postbox, network: self.stateManager.network, reference: .iconStatusEmoji, forceActualized: true).start())
tasks.add(_internal_loadedStickerPack(postbox: self.stateManager.postbox, network: self.stateManager.network, reference: .iconChannelStatusEmoji, forceActualized: true).start())
tasks.add(managedDisabledChannelStatusIconEmoji(postbox: self.stateManager.postbox, network: self.stateManager.network).start())

View File

@ -512,7 +512,7 @@ private func validateChannelMessagesBatch(postbox: Postbox, network: Network, ac
} else if tag == MessageTags.unseenReaction {
requestSignal = network.request(Api.functions.messages.getUnreadReactions(flags: 0, peer: inputPeer, topMsgId: nil, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1))
} else if let filter = messageFilterForTagMask(tag) {
requestSignal = network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, savedPeerId: nil, topMsgId: nil, filter: filter, minDate: 0, maxDate: 0, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1, hash: hash))
requestSignal = network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, savedPeerId: nil, savedReaction: nil, topMsgId: nil, filter: filter, minDate: 0, maxDate: 0, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1, hash: hash))
} else {
assertionFailure()
requestSignal = .complete()
@ -582,7 +582,7 @@ private func validateReplyThreadMessagesBatch(postbox: Postbox, network: Network
var flags: Int32 = 0
flags |= (1 << 1)
requestSignal = network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: "", fromId: nil, savedPeerId: nil, topMsgId: threadMessageId, filter: filter, minDate: 0, maxDate: 0, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1, hash: hash))
requestSignal = network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: "", fromId: nil, savedPeerId: nil, savedReaction: nil, topMsgId: threadMessageId, filter: filter, minDate: 0, maxDate: 0, offsetId: messageIds[messageIds.count - 1].id + 1, addOffset: 0, limit: Int32(messageIds.count), maxId: messageIds[messageIds.count - 1].id + 1, minId: messageIds[0].id - 1, hash: hash))
} else {
return .complete()
}

View File

@ -739,7 +739,7 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH
}
}
request = source.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: "", fromId: nil, savedPeerId: savedPeerId, topMsgId: topMsgId, filter: filter, minDate: 0, maxDate: 0, offsetId: offsetId, addOffset: addOffset, limit: Int32(selectedLimit), maxId: maxId, minId: minId, hash: 0))
request = source.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: "", fromId: nil, savedPeerId: savedPeerId, savedReaction: nil, topMsgId: topMsgId, filter: filter, minDate: 0, maxDate: 0, offsetId: offsetId, addOffset: addOffset, limit: Int32(selectedLimit), maxId: maxId, minId: minId, hash: 0))
} else {
assertionFailure()
minMaxRange = 1 ... 1
@ -1043,7 +1043,7 @@ func fetchCallListHole(network: Network, postbox: Postbox, accountPeerId: PeerId
offset = single((holeIndex.timestamp, min(holeIndex.id.id, Int32.max - 1) + 1, Api.InputPeer.inputPeerEmpty), NoError.self)
return offset
|> mapToSignal { (timestamp, id, peer) -> Signal<Void, NoError> in
let searchResult = network.request(Api.functions.messages.search(flags: 0, peer: .inputPeerEmpty, q: "", fromId: nil, savedPeerId: nil, topMsgId: nil, filter: .inputMessagesFilterPhoneCalls(flags: 0), minDate: 0, maxDate: holeIndex.timestamp, offsetId: 0, addOffset: 0, limit: limit, maxId: holeIndex.id.id, minId: 0, hash: 0))
let searchResult = network.request(Api.functions.messages.search(flags: 0, peer: .inputPeerEmpty, q: "", fromId: nil, savedPeerId: nil, savedReaction: nil, topMsgId: nil, filter: .inputMessagesFilterPhoneCalls(flags: 0), minDate: 0, maxDate: holeIndex.timestamp, offsetId: 0, addOffset: 0, limit: limit, maxId: holeIndex.id.id, minId: 0, hash: 0))
|> retryRequest
|> mapToSignal { result -> Signal<Void, NoError> in
let messages: [Api.Message]

View File

@ -160,7 +160,7 @@ private func requestActivity(postbox: Postbox, network: Network, accountPeerId:
if let _ = peer as? TelegramUser {
if let presence = transaction.getPeerPresence(peerId: peerId) as? TelegramUserPresence {
switch presence.status {
case .none, .lastWeek, .lastMonth:
case .none, .lastWeek, .lastMonth, .hidden:
return .complete()
case .recently:
break

View File

@ -505,3 +505,54 @@ func managedTopReactions(postbox: Postbox, network: Network) -> Signal<Void, NoE
})
return (poll |> then(.complete() |> suspendAwareDelay(3.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue()))) |> restart
}
func managedDefaultTagReactions(postbox: Postbox, network: Network) -> Signal<Void, NoError> {
let poll = managedRecentMedia(postbox: postbox, network: network, collectionId: Namespaces.OrderedItemList.CloudDefaultTagReactions, extractItemId: { rawId in
switch RecentReactionItemId(rawId).id {
case .builtin:
return 0
case let .custom(fileId):
return fileId.id
}
}, reverseHashOrder: false, forceFetch: false, fetch: { hash in
return network.request(Api.functions.messages.getDefaultTagReactions(hash: hash))
|> retryRequest
|> mapToSignal { result -> Signal<[OrderedItemListEntry]?, NoError> in
switch result {
case .reactionsNotModified:
return .single(nil)
case let .reactions(_, reactions):
let parsedReactions = reactions.compactMap(MessageReaction.Reaction.init(apiReaction:))
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedReactions.compactMap { reaction -> Int64? in
switch reaction {
case .builtin:
return nil
case let .custom(fileId):
return fileId
}
})
|> map { files -> [OrderedItemListEntry] in
var items: [OrderedItemListEntry] = []
for reaction in parsedReactions {
let item: RecentReactionItem
switch reaction {
case let .builtin(value):
item = RecentReactionItem(.builtin(value))
case let .custom(fileId):
guard let file = files[fileId] else {
continue
}
item = RecentReactionItem(.custom(file))
}
if let entry = CodableEntry(item) {
items.append(OrderedItemListEntry(id: item.id.rawValue, contents: entry))
}
}
return items
}
}
}
})
return (poll |> then(.complete() |> suspendAwareDelay(3.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue()))) |> restart
}

View File

@ -0,0 +1,196 @@
import Foundation
import TelegramApi
import Postbox
import SwiftSignalKit
public final class SavedMessageTags: Equatable, Codable {
public final class Tag: Equatable, Codable {
private enum CodingKeys: String, CodingKey {
case reaction
case title
case count
}
public let reaction: MessageReaction.Reaction
public let title: String?
public let count: Int
public init(
reaction: MessageReaction.Reaction,
title: String?,
count: Int
) {
self.reaction = reaction
self.title = title
self.count = count
}
public static func ==(lhs: Tag, rhs: Tag) -> Bool {
if lhs.reaction != rhs.reaction {
return false
}
if lhs.title != rhs.title {
return false
}
if lhs.count != rhs.count {
return false
}
return true
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.reaction = try container.decode(MessageReaction.Reaction.self, forKey: .reaction)
self.title = try container.decodeIfPresent(String.self, forKey: .title)
self.count = Int(try container.decode(Int32.self, forKey: .count))
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.reaction, forKey: .reaction)
try container.encodeIfPresent(self.title, forKey: .title)
try container.encode(Int32(self.count), forKey: .count)
}
}
private enum CodingKeys: String, CodingKey {
case newHash
case tags
}
public let hash: Int64
public let tags: [Tag]
public init(
hash: Int64,
tags: [Tag]
) {
self.hash = hash
self.tags = tags
}
public static func ==(lhs: SavedMessageTags, rhs: SavedMessageTags) -> Bool {
if lhs.hash != rhs.hash {
return false
}
if lhs.tags != rhs.tags {
return false
}
return true
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.hash = try container.decodeIfPresent(Int64.self, forKey: .newHash) ?? 0
self.tags = try container.decode([Tag].self, forKey: .tags)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.hash, forKey: .newHash)
try container.encode(self.tags, forKey: .tags)
}
}
func _internal_savedMessageTags(postbox: Postbox) -> Signal<SavedMessageTags?, NoError> {
return postbox.transaction { transaction -> SavedMessageTags? in
return _internal_savedMessageTags(transaction: transaction)
}
}
func _internal_savedMessageTags(transaction: Transaction) -> SavedMessageTags? {
let key = ValueBoxKey(length: 8)
key.setInt64(0, value: 0)
let cached = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.savedMessageTags, key: key))?.get(SavedMessageTags.self)
if let cached = cached {
return cached
} else {
return nil
}
}
func _internal_setSavedMessageTags(transaction: Transaction, savedMessageTags: SavedMessageTags) {
let key = ValueBoxKey(length: 8)
key.setInt64(0, value: 0)
if let entry = CodableEntry(savedMessageTags) {
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.savedMessageTags, key: key), entry: entry)
}
}
func managedSynchronizeSavedMessageTags(postbox: Postbox, network: Network) -> Signal<Never, NoError> {
let poll = Signal<Never, NoError> { subscriber in
let signal: Signal<Never, NoError> = _internal_savedMessageTags(postbox: postbox)
|> mapToSignal { current in
return (network.request(Api.functions.messages.getSavedReactionTags(hash: current?.hash ?? 0))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.SavedReactionTags?, NoError> in
return .single(nil)
}
|> mapToSignal { result -> Signal<Never, NoError> in
guard let result = result else {
return .complete()
}
switch result {
case .savedReactionTagsNotModified:
return .complete()
case let .savedReactionTags(tags, hash):
var customFileIds: [Int64] = []
var parsedTags: [SavedMessageTags.Tag] = []
for tag in tags {
switch tag {
case let .savedReactionTag(_, reaction, title, count):
guard let reaction = MessageReaction.Reaction(apiReaction: reaction) else {
continue
}
parsedTags.append(SavedMessageTags.Tag(
reaction: reaction,
title: title,
count: Int(count)
))
if case let .custom(fileId) = reaction {
customFileIds.append(fileId)
}
}
}
let savedMessageTags = SavedMessageTags(
hash: hash,
tags: parsedTags
)
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: customFileIds)
|> mapToSignal { _ -> Signal<Never, NoError> in
return postbox.transaction { transaction in
_internal_setSavedMessageTags(transaction: transaction, savedMessageTags: savedMessageTags)
}
|> ignoreValues
}
}
})
}
return signal.start(completed: {
subscriber.putCompletion()
})
}
return (
poll
|> then(
.complete()
|> suspendAwareDelay(1.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue())
)
)
|> restart
}

View File

@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
public class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt {
return 170
return 171
}
public func parseMessage(_ data: Data!) -> Any! {

View File

@ -84,6 +84,7 @@ public struct Namespaces {
public static let CloudFeaturedBackgroundIconEmoji: Int32 = 26
public static let CloudFeaturedChannelStatusEmoji: Int32 = 27
public static let CloudDisabledChannelStatusEmoji: Int32 = 28
public static let CloudDefaultTagReactions: Int32 = 29
}
public struct CachedItemCollection {
@ -118,6 +119,7 @@ public struct Namespaces {
public static let displayedMessageNotifications: Int8 = 32
public static let recommendedChannels: Int8 = 33
public static let peerColorOptions: Int8 = 34
public static let savedMessageTags: Int8 = 35
}
public struct UnorderedItemList {

View File

@ -195,6 +195,7 @@ public final class ReactionsMessageAttribute: Equatable, MessageAttribute {
}
public let canViewList: Bool
public let isTags: Bool
public let reactions: [MessageReaction]
public let recentPeers: [RecentPeer]
@ -220,20 +221,23 @@ public final class ReactionsMessageAttribute: Equatable, MessageAttribute {
return result
}
public init(canViewList: Bool, reactions: [MessageReaction], recentPeers: [RecentPeer]) {
public init(canViewList: Bool, isTags: Bool, reactions: [MessageReaction], recentPeers: [RecentPeer]) {
self.canViewList = canViewList
self.isTags = isTags
self.reactions = reactions
self.recentPeers = recentPeers
}
required public init(decoder: PostboxDecoder) {
self.canViewList = decoder.decodeBoolForKey("vl", orElse: true)
self.isTags = decoder.decodeBoolForKey("tg", orElse: false)
self.reactions = decoder.decodeObjectArrayWithDecoderForKey("r")
self.recentPeers = decoder.decodeObjectArrayWithDecoderForKey("rp")
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeBool(self.canViewList, forKey: "vl")
encoder.encodeBool(self.isTags, forKey: "tg")
encoder.encodeObjectArray(self.reactions, forKey: "r")
encoder.encodeObjectArray(self.recentPeers, forKey: "rp")
}
@ -242,6 +246,9 @@ public final class ReactionsMessageAttribute: Equatable, MessageAttribute {
if lhs.canViewList != rhs.canViewList {
return false
}
if lhs.isTags != rhs.isTags {
return false
}
if lhs.reactions != rhs.reactions {
return false
}
@ -263,6 +270,7 @@ public final class ReactionsMessageAttribute: Equatable, MessageAttribute {
public func withAllSeen() -> ReactionsMessageAttribute {
return ReactionsMessageAttribute(
canViewList: self.canViewList,
isTags: self.isTags,
reactions: self.reactions,
recentPeers: self.recentPeers.map { recentPeer in
var recentPeer = recentPeer

View File

@ -1,84 +1,85 @@
import Postbox
public enum UserPresenceStatus: Comparable, PostboxCoding {
private struct SortKey: Comparable {
var major: Int
var minor: Int32
init(major: Int, minor: Int32) {
self.major = major
self.minor = minor
}
static func <(lhs: SortKey, rhs: SortKey) -> Bool {
if lhs.major != rhs.major {
return lhs.major < rhs.major
}
return lhs.minor < rhs.minor
}
}
case none
case hidden
case present(until: Int32)
case recently
case lastWeek
case lastMonth
public static func <(lhs: UserPresenceStatus, rhs: UserPresenceStatus) -> Bool {
switch lhs {
case .none:
switch rhs {
case .none:
return false
case .lastMonth, .lastWeek, .recently, .present:
return true
}
case let .present(until):
switch rhs {
case .none:
return false
case let .present(rhsUntil):
return until < rhsUntil
case .lastWeek, .lastMonth, .recently:
return false
}
case .recently:
switch rhs {
case .none, .lastWeek, .lastMonth, .recently:
return false
case .present:
return true
}
case .lastWeek:
switch rhs {
case .none, .lastMonth, .lastWeek:
return false
case .present, .recently:
return true
}
case .lastMonth:
switch rhs {
case .none, .lastMonth:
return false
case .present, .recently, lastWeek:
return true
}
private var sortKey: SortKey {
switch self {
case let .present(until):
return SortKey(major: 1, minor: until)
case .hidden:
return SortKey(major: 2, minor: 0)
case .recently:
return SortKey(major: 3, minor: 0)
case .lastWeek:
return SortKey(major: 4, minor: 0)
case .lastMonth:
return SortKey(major: 5, minor: 0)
case .none:
return SortKey(major: 6, minor: 0)
}
}
public static func <(lhs: UserPresenceStatus, rhs: UserPresenceStatus) -> Bool {
return lhs.sortKey < rhs.sortKey
}
public init(decoder: PostboxDecoder) {
switch decoder.decodeInt32ForKey("v", orElse: 0) {
case 0:
self = .none
case 1:
self = .present(until: decoder.decodeInt32ForKey("t", orElse: 0))
case 2:
self = .recently
case 3:
self = .lastWeek
case 4:
self = .lastMonth
default:
self = .none
case 0:
self = .none
case 1:
self = .present(until: decoder.decodeInt32ForKey("t", orElse: 0))
case 2:
self = .recently
case 3:
self = .lastWeek
case 4:
self = .lastMonth
case 5:
self = .hidden
default:
self = .none
}
}
public func encode(_ encoder: PostboxEncoder) {
switch self {
case .none:
encoder.encodeInt32(0, forKey: "v")
case let .present(timestamp):
encoder.encodeInt32(1, forKey: "v")
encoder.encodeInt32(timestamp, forKey: "t")
case .recently:
encoder.encodeInt32(2, forKey: "v")
case .lastWeek:
encoder.encodeInt32(3, forKey: "v")
case .lastMonth:
encoder.encodeInt32(4, forKey: "v")
case .none:
encoder.encodeInt32(0, forKey: "v")
case let .present(timestamp):
encoder.encodeInt32(1, forKey: "v")
encoder.encodeInt32(timestamp, forKey: "t")
case .recently:
encoder.encodeInt32(2, forKey: "v")
case .lastWeek:
encoder.encodeInt32(3, forKey: "v")
case .lastMonth:
encoder.encodeInt32(4, forKey: "v")
case .hidden:
encoder.encodeInt32(5, forKey: "v")
}
}
}

View File

@ -8,7 +8,7 @@ import MtProtoKit
public enum SearchMessagesLocation: Equatable {
case general(tags: MessageTags?, minDate: Int32?, maxDate: Int32?)
case group(groupId: PeerGroupId, tags: MessageTags?, minDate: Int32?, maxDate: Int32?)
case peer(peerId: PeerId, fromId: PeerId?, tags: MessageTags?, threadId: Int64?, minDate: Int32?, maxDate: Int32?)
case peer(peerId: PeerId, fromId: PeerId?, tags: MessageTags?, reactions: [MessageReaction.Reaction]?, threadId: Int64?, minDate: Int32?, maxDate: Int32?)
case sentMedia(tags: MessageTags?)
}
@ -224,7 +224,7 @@ private func mergedResult(_ state: SearchMessagesState) -> SearchMessagesResult
func _internal_searchMessages(account: Account, location: SearchMessagesLocation, query: String, state: SearchMessagesState?, limit: Int32 = 100) -> Signal<(SearchMessagesResult, SearchMessagesState), NoError> {
let remoteSearchResult: Signal<(Api.messages.Messages?, Api.messages.Messages?), NoError>
switch location {
case let .peer(peerId, fromId, tags, threadId, minDate, maxDate):
case let .peer(peerId, fromId, tags, reactions, threadId, minDate, maxDate):
if peerId.namespace == Namespaces.Peer.SecretChat {
return account.postbox.transaction { transaction -> (SearchMessagesResult, SearchMessagesState) in
var readStates: [PeerId: CombinedPeerReadState] = [:]
@ -297,6 +297,7 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
flags |= (1 << 1)
topMsgId = Int32(clamping: threadId)
}
let peerMessages: Signal<Api.messages.Messages?, NoError>
if let completed = state?.main.completed, completed {
peerMessages = .single(nil)
@ -306,7 +307,18 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
if peer.id.namespace == Namespaces.Peer.CloudChannel && query.isEmpty && fromId == nil && tags == nil && minDate == nil && maxDate == nil {
signal = account.network.request(Api.functions.messages.getHistory(peer: inputPeer, offsetId: lowerBound?.id.id ?? 0, offsetDate: 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
} else {
signal = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputPeer, savedPeerId: inputSavedPeer, topMsgId: topMsgId, filter: filter, minDate: minDate ?? 0, maxDate: maxDate ?? (Int32.max - 1), offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
var savedReactions: [Api.Reaction]?
if let reactions = reactions {
savedReactions = reactions.map {
$0.apiReaction
}
}
if savedReactions != nil {
flags |= 1 << 3
}
signal = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputPeer, savedPeerId: inputSavedPeer, savedReaction: savedReactions, topMsgId: topMsgId, filter: filter, minDate: minDate ?? 0, maxDate: maxDate ?? (Int32.max - 1), offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
}
peerMessages = signal
|> map(Optional.init)
@ -322,7 +334,19 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
additionalPeerMessages = .single(nil)
} else if mainCompleted || !hasAdditional {
let lowerBound = state?.additional?.messages.last.flatMap({ $0.index })
additionalPeerMessages = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputPeer, savedPeerId: inputSavedPeer, topMsgId: topMsgId, filter: filter, minDate: minDate ?? 0, maxDate: maxDate ?? (Int32.max - 1), offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
var savedReactions: [Api.Reaction]?
if let reactions = reactions {
savedReactions = reactions.map {
$0.apiReaction
}
}
if savedReactions != nil {
flags |= 1 << 3
}
additionalPeerMessages = account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: query, fromId: fromInputPeer, savedPeerId: inputSavedPeer, savedReaction: savedReactions, topMsgId: topMsgId, filter: filter, minDate: minDate ?? 0, maxDate: maxDate ?? (Int32.max - 1), offsetId: lowerBound?.id.id ?? 0, addOffset: 0, limit: limit, maxId: Int32.max - 1, minId: 0, hash: 0))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
return .single(nil)

View File

@ -448,7 +448,7 @@ public extension TelegramEngine {
}
}
signals.append(self.account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: "", fromId: nil, savedPeerId: inputSavedPeer, topMsgId: topMsgId, filter: filter, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1, maxId: 0, minId: 0, hash: 0))
signals.append(self.account.network.request(Api.functions.messages.search(flags: flags, peer: inputPeer, q: "", fromId: nil, savedPeerId: inputSavedPeer, savedReaction: nil, topMsgId: topMsgId, filter: filter, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1, maxId: 0, minId: 0, hash: 0))
|> map { result -> (count: Int32?, topId: Int32?) in
switch result {
case let .messagesSlice(_, count, _, _, messages, _, _):

View File

@ -6,52 +6,49 @@ public enum EnginePeer: Equatable {
public struct Presence: Equatable {
public enum Status: Comparable {
private struct SortKey: Comparable {
var major: Int
var minor: Int32
init(major: Int, minor: Int32) {
self.major = major
self.minor = minor
}
static func <(lhs: SortKey, rhs: SortKey) -> Bool {
if lhs.major != rhs.major {
return lhs.major < rhs.major
}
return lhs.minor < rhs.minor
}
}
case present(until: Int32)
case hidden
case recently
case lastWeek
case lastMonth
case longTimeAgo
private var sortKey: SortKey {
switch self {
case let .present(until):
return SortKey(major: 1, minor: until)
case .hidden:
return SortKey(major: 2, minor: 0)
case .recently:
return SortKey(major: 3, minor: 0)
case .lastWeek:
return SortKey(major: 4, minor: 0)
case .lastMonth:
return SortKey(major: 5, minor: 0)
case .longTimeAgo:
return SortKey(major: 6, minor: 0)
}
}
public static func <(lhs: Status, rhs: Status) -> Bool {
switch lhs {
case .longTimeAgo:
switch rhs {
case .longTimeAgo:
return false
case .lastMonth, .lastWeek, .recently, .present:
return true
}
case let .present(until):
switch rhs {
case .longTimeAgo:
return false
case let .present(rhsUntil):
return until < rhsUntil
case .lastWeek, .lastMonth, .recently:
return false
}
case .recently:
switch rhs {
case .longTimeAgo, .lastWeek, .lastMonth, .recently:
return false
case .present:
return true
}
case .lastWeek:
switch rhs {
case .longTimeAgo, .lastMonth, .lastWeek:
return false
case .present, .recently:
return true
}
case .lastMonth:
switch rhs {
case .longTimeAgo, .lastMonth:
return false
case .present, .recently, lastWeek:
return true
}
}
return lhs.sortKey < rhs.sortKey
}
}
@ -368,6 +365,8 @@ public extension EnginePeer.Presence {
switch presence.status {
case .none:
mappedStatus = .longTimeAgo
case .hidden:
mappedStatus = .hidden
case let .present(until):
mappedStatus = .present(until: until)
case .recently:
@ -387,6 +386,8 @@ public extension EnginePeer.Presence {
func _asPresence() -> TelegramUserPresence {
let mappedStatus: UserPresenceStatus
switch self.status {
case .hidden:
mappedStatus = .hidden
case .longTimeAgo:
mappedStatus = .none
case let .present(until):

View File

@ -68,7 +68,7 @@ func _internal_requestPeerPhotos(accountPeerId: PeerId, postbox: Postbox, networ
}
}
} else if let peer = peer, let inputPeer = apiInputPeer(peer) {
return network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, savedPeerId: nil, topMsgId: nil, filter: .inputMessagesFilterChatPhotos, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1000, maxId: 0, minId: 0, hash: 0))
return network.request(Api.functions.messages.search(flags: 0, peer: inputPeer, q: "", fromId: nil, savedPeerId: nil, savedReaction: nil, topMsgId: nil, filter: .inputMessagesFilterChatPhotos, minDate: 0, maxDate: 0, offsetId: 0, addOffset: 0, limit: 1000, maxId: 0, minId: 0, hash: 0))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
return .single(nil)

View File

@ -109,6 +109,24 @@ public extension TelegramEngine {
return _internal_cachedAvailableReactions(postbox: self.account.postbox)
}
public func savedMessageTags() -> Signal<([SavedMessageTags.Tag], [Int64: TelegramMediaFile]), NoError> {
return self.account.postbox.transaction { transaction -> ([SavedMessageTags.Tag], [Int64: TelegramMediaFile]) in
guard let savedMessageTags = _internal_savedMessageTags(transaction: transaction) else {
return ([], [:])
}
var files: [Int64: TelegramMediaFile] = [:]
for tag in savedMessageTags.tags {
if case let .custom(fileId) = tag.reaction {
let mediaId = MediaId(namespace: Namespaces.Media.CloudFile, id: fileId)
if let file = transaction.getMedia(mediaId) as? TelegramMediaFile {
files[fileId] = file
}
}
}
return (savedMessageTags.tags, files)
}
}
public func emojiSearchCategories(kind: EmojiSearchCategories.Kind) -> Signal<EmojiSearchCategories?, NoError> {
return _internal_cachedEmojiSearchCategories(postbox: self.account.postbox, kind: kind)
}

View File

@ -417,6 +417,17 @@ public extension Message {
}
return nil
}
var effectiveReactionsAttribute: ReactionsMessageAttribute? {
if !self.hasReactions {
return nil
}
if let result = mergedMessageReactions(attributes: self.attributes) {
return result
} else {
return nil
}
}
var effectiveReactions: [MessageReaction]? {
if !self.hasReactions {
return nil
@ -476,6 +487,19 @@ public extension Message {
}
}
public extension Message {
func areReactionsTags(accountPeerId: PeerId) -> Bool {
if self.id.peerId == accountPeerId {
if let reactionsAttribute = self.reactionsAttribute, !reactionsAttribute.reactions.isEmpty {
return reactionsAttribute.isTags
} else {
return true
}
}
return false
}
}
public func _internal_parseMediaAttachment(data: Data) -> Media? {
guard let object = Api.parse(Buffer(buffer: MemoryBuffer(data: data))) else {
return nil

View File

@ -216,6 +216,7 @@ public enum RelativeUserPresenceStatus {
case offline
case online(at: Int32)
case lastSeen(at: Int32)
case hidden
case recently
case lastWeek
case lastMonth
@ -242,6 +243,8 @@ public func relativeUserPresenceStatus(_ presence: EnginePeer.Presence, relative
return .lastWeek
case .lastMonth:
return .lastMonth
case .hidden:
return .hidden
}
}
@ -537,6 +540,9 @@ public func stringAndActivityForUserPresence(strings: PresentationStrings, dateT
return (strings.LastSeen_WithinAMonth, false)
case .longTimeAgo:
return (strings.LastSeen_ALongTimeAgo, false)
case .hidden:
//TODO:localize
return ("last seen hidden", false)
}
}
@ -586,7 +592,7 @@ public func userPresenceStringRefreshTimeout(_ presence: TelegramUserPresence, r
} else {
return Double.infinity
}
case .none, .lastWeek, .lastMonth:
case .none, .lastWeek, .lastMonth, .hidden:
return Double.infinity
}
}

View File

@ -196,7 +196,7 @@ public final class ChatHistorySearchContainerNode: SearchDisplayControllerConten
if let strongSelf = self {
let signal: Signal<([ChatHistorySearchEntry], [MessageId: Message])?, NoError>
if let query = query, !query.isEmpty {
let foundRemoteMessages: Signal<[Message], NoError> = context.engine.messages.searchMessages(location: .peer(peerId: peerId, fromId: nil, tags: tagMask, threadId: threadId, minDate: nil, maxDate: nil), query: query, state: nil)
let foundRemoteMessages: Signal<[Message], NoError> = context.engine.messages.searchMessages(location: .peer(peerId: peerId, fromId: nil, tags: tagMask, reactions: nil, threadId: threadId, minDate: nil, maxDate: nil), query: query, state: nil)
|> map { $0.0.messages }
|> delay(0.2, queue: Queue.concurrentDefaultQueue())

View File

@ -1045,7 +1045,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring,
@ -1241,9 +1241,9 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
let reactions: ReactionsMessageAttribute
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) {
reactions = ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
reactions = ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
} else {
reactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
reactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
}
var reactionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode))?
if !reactions.reactions.isEmpty {

View File

@ -657,7 +657,7 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: chatLocation == .peer(id: context.account.peerId),
areReactionsTags: message.areReactionsTags(accountPeerId: context.account.peerId),
replyCount: dateReplies,
isPinned: message.tags.contains(.pinned) && !associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: message.isSelfExpiring,

View File

@ -1894,9 +1894,9 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
let bubbleReactions: ReactionsMessageAttribute
if needReactions {
bubbleReactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
bubbleReactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
} else {
bubbleReactions = ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
bubbleReactions = ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
}
if !bubbleReactions.reactions.isEmpty && !item.presentationData.isPreview {
bottomNodeMergeStatus = .Both
@ -2113,7 +2113,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: message.isSelfExpiring,

View File

@ -238,7 +238,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
hasAutoremove: item.message.isSelfExpiring,

View File

@ -228,7 +228,7 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
var reactions: [MessageReaction]
var reactionPeers: [(MessageReaction.Reaction, EnginePeer)]
var displayAllReactionPeers: Bool
var isSavedMessages: Bool
var areReactionsTags: Bool
var replyCount: Int
var isPinned: Bool
var hasAutoremove: Bool
@ -249,7 +249,7 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
reactions: [MessageReaction],
reactionPeers: [(MessageReaction.Reaction, EnginePeer)],
displayAllReactionPeers: Bool,
isSavedMessages: Bool,
areReactionsTags: Bool,
replyCount: Int,
isPinned: Bool,
hasAutoremove: Bool,
@ -269,7 +269,7 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
self.reactions = reactions
self.reactionPeers = reactionPeers
self.displayAllReactionPeers = displayAllReactionPeers
self.isSavedMessages = isSavedMessages
self.areReactionsTags = areReactionsTags
self.replyCount = replyCount
self.isPinned = isPinned
self.hasAutoremove = hasAutoremove
@ -747,7 +747,7 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
},
reactions: [],
colors: reactionColors,
isTag: arguments.isSavedMessages,
isTag: arguments.areReactionsTags,
constrainedWidth: arguments.constrainedSize.width
)
case let .trailingContent(contentWidth, reactionSettings):
@ -809,7 +809,7 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
)
},
colors: reactionColors,
isTag: arguments.isSavedMessages,
isTag: arguments.areReactionsTags,
constrainedWidth: arguments.constrainedSize.width
)
} else {
@ -823,7 +823,7 @@ public class ChatMessageDateAndStatusNode: ASDisplayNode {
},
reactions: [],
colors: reactionColors,
isTag: arguments.isSavedMessages,
isTag: arguments.areReactionsTags,
constrainedWidth: arguments.constrainedSize.width
)
}

View File

@ -519,7 +519,7 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode,
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
hasAutoremove: item.message.isSelfExpiring,

View File

@ -595,9 +595,9 @@ public class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureReco
let reactions: ReactionsMessageAttribute
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) {
reactions = ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
reactions = ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
} else {
reactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
reactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
}
var reactionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode))?

View File

@ -937,7 +937,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: arguments.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: arguments.chatLocation == .peer(id: arguments.context.account.peerId),
areReactionsTags: arguments.message.areReactionsTags(accountPeerId: arguments.context.account.peerId),
replyCount: dateReplies,
isPinned: arguments.isPinned && !arguments.associatedData.isInPinnedListMode,
hasAutoremove: arguments.message.isSelfExpiring,

View File

@ -570,7 +570,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring,

View File

@ -872,7 +872,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
reactions: dateAndStatus.dateReactions,
reactionPeers: dateAndStatus.dateReactionPeers,
displayAllReactionPeers: message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: message.id.peerId == context.account.peerId,
areReactionsTags: message.areReactionsTags(accountPeerId: context.account.peerId),
replyCount: dateAndStatus.dateReplies,
isPinned: dateAndStatus.isPinned,
hasAutoremove: message.isSelfExpiring,

View File

@ -276,7 +276,7 @@ public class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring,

View File

@ -1024,7 +1024,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring,

View File

@ -178,7 +178,7 @@ public final class MessageReactionButtonsNode: ASDisplayNode {
)
},
colors: reactionColors,
isTag: message.id.peerId == context.account.peerId,
isTag: message.areReactionsTags(accountPeerId: context.account.peerId),
constrainedWidth: constrainedWidth
)
@ -498,7 +498,7 @@ public final class ChatMessageReactionsFooterContentNode: ChatMessageBubbleConte
}
return (contentProperties, nil, CGFloat.greatestFiniteMagnitude, { constrainedSize, position in
let reactionsAttribute = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
let reactionsAttribute = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
let buttonsUpdate = buttonsNode.prepareUpdate(
context: item.context,
presentationData: item.presentationData,

View File

@ -132,7 +132,7 @@ public class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNod
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
hasAutoremove: item.message.isSelfExpiring,

View File

@ -628,7 +628,7 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring,
@ -823,9 +823,9 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
let reactions: ReactionsMessageAttribute
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) {
reactions = ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
reactions = ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
} else {
reactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, reactions: [], recentPeers: [])
reactions = mergedMessageReactions(attributes: item.message.attributes) ?? ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [], recentPeers: [])
}
var reactionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode))?

View File

@ -573,7 +573,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser,
isSavedMessages: item.chatLocation.peerId == item.context.account.peerId,
areReactionsTags: item.message.areReactionsTags(accountPeerId: item.context.account.peerId),
replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && (!item.associatedData.isInPinnedListMode || isReplyThread),
hasAutoremove: item.message.isSelfExpiring,

View File

@ -74,6 +74,34 @@ float particleEaseInValueAt(float fraction, float t) {
return localT;
}
float2 grad(float2 z ) {
// 2D to 1D (feel free to replace by some other)
int n = z.x + z.y * 11111.0;
// Hugo Elias hash (feel free to replace by another one)
n = (n << 13) ^ n;
n = (n * (n * n * 15731 + 789221) + 1376312589) >> 16;
// Perlin style vectors
n &= 7;
float2 gr = float2(n & 1, n >> 1) * 2.0 - 1.0;
return ( n>=6 ) ? float2(0.0, gr.x) :
( n>=4 ) ? float2(gr.x, 0.0) :
gr;
}
float noise(float2 p ) {
float2 i = float2(floor(p));
float2 f = fract(p);
float2 u = f*f*(3.0-2.0*f); // feel free to replace by a quintic smoothstep instead
return mix( mix( dot( grad( i+float2(0,0) ), f-float2(0.0,0.0) ),
dot( grad( i+float2(1,0) ), f-float2(1.0,0.0) ), u.x),
mix( dot( grad( i+float2(0,1) ), f-float2(0.0,1.0) ),
dot( grad( i+float2(1,1) ), f-float2(1.0,1.0) ), u.x), u.y);
}
kernel void dustEffectUpdateParticle(
device Particle *particles [[ buffer(0) ]],
const device uint2 &size [[ buffer(1) ]],
@ -139,5 +167,6 @@ fragment half4 dustEffectFragment(
constexpr sampler sampler(coord::normalized, address::clamp_to_edge, filter::linear);
half4 color = inTexture.sample(sampler, float2(in.uv.x, 1.0 - in.uv.y));
return color * in.alpha;
}

View File

@ -59,6 +59,7 @@ public final class EmojiStatusComponent: Component {
public let animationCache: AnimationCache
public let animationRenderer: MultiAnimationRenderer
public let content: Content
public let size: CGSize?
public let isVisibleForAnimations: Bool
public let useSharedAnimation: Bool
public let action: (() -> Void)?
@ -69,6 +70,7 @@ public final class EmojiStatusComponent: Component {
animationCache: AnimationCache,
animationRenderer: MultiAnimationRenderer,
content: Content,
size: CGSize? = nil,
isVisibleForAnimations: Bool,
useSharedAnimation: Bool = false,
action: (() -> Void)?,
@ -83,6 +85,7 @@ public final class EmojiStatusComponent: Component {
animationCache: animationCache,
animationRenderer: animationRenderer,
content: content,
size: size,
isVisibleForAnimations: isVisibleForAnimations,
useSharedAnimation: useSharedAnimation,
action: action,
@ -97,6 +100,7 @@ public final class EmojiStatusComponent: Component {
animationCache: AnimationCache,
animationRenderer: MultiAnimationRenderer,
content: Content,
size: CGSize? = nil,
isVisibleForAnimations: Bool,
useSharedAnimation: Bool = false,
action: (() -> Void)?,
@ -108,6 +112,7 @@ public final class EmojiStatusComponent: Component {
self.animationCache = animationCache
self.animationRenderer = animationRenderer
self.content = content
self.size = size
self.isVisibleForAnimations = isVisibleForAnimations
self.useSharedAnimation = useSharedAnimation
self.action = action
@ -122,6 +127,7 @@ public final class EmojiStatusComponent: Component {
animationCache: self.animationCache,
animationRenderer: self.animationRenderer,
content: self.content,
size: self.size,
isVisibleForAnimations: isVisibleForAnimations,
useSharedAnimation: self.useSharedAnimation,
action: self.action,
@ -145,6 +151,9 @@ public final class EmojiStatusComponent: Component {
if lhs.content != rhs.content {
return false
}
if lhs.size != rhs.size {
return false
}
if lhs.isVisibleForAnimations != rhs.isVisibleForAnimations {
return false
}
@ -231,6 +240,8 @@ public final class EmojiStatusComponent: Component {
}
func update(component: EmojiStatusComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize {
let availableSize = component.size ?? availableSize
self.state = state
var iconImage: UIImage?

View File

@ -289,7 +289,7 @@ class ReactionChatPreviewItemNode: ListViewItemNode {
recentPeers.append(ReactionsMessageAttribute.RecentPeer(value: reaction, isLarge: false, isUnseen: false, isMy: true, peerId: accountPeer.id, timestamp: nil))
peers[accountPeer.id] = accountPeer
}
attributes.append(ReactionsMessageAttribute(canViewList: false, reactions: [MessageReaction(value: reaction, count: 1, chosenOrder: 0)], recentPeers: recentPeers))
attributes.append(ReactionsMessageAttribute(canViewList: false, isTags: false, reactions: [MessageReaction(value: reaction, count: 1, chosenOrder: 0)], recentPeers: recentPeers))
}
let messageItem = item.context.sharedContext.makeChatMessagePreviewItem(context: item.context, messages: [Message(stableId: 1, stableVersion: 0, id: MessageId(peerId: chatPeerId, namespace: 0, id: 1), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 66000, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peers[userPeerId], text: messageText, attributes: attributes, media: [], peers: peers, associatedMessages: messages, associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:])], theme: item.theme, strings: item.strings, wallpaper: item.wallpaper, fontSize: item.fontSize, chatBubbleCorners: item.chatBubbleCorners, dateTimeFormat: item.dateTimeFormat, nameOrder: item.nameDisplayOrder, forcedResourceStatus: nil, tapMessage: nil, clickThroughMessage: nil, backgroundNode: currentBackgroundNode, availableReactions: item.availableReactions, accountPeer: item.accountPeer, isCentered: true, isPreview: true)

View File

@ -110,7 +110,7 @@ extension ChatControllerImpl {
if canAddMessageReactions(message: topMessage), let allowedReactions = allowedReactions, !topReactions.isEmpty {
actions.reactionItems = topReactions.map(ReactionContextItem.reaction)
if case .peer(self.context.account.peerId) = self.presentationInterfaceState.chatLocation {
if message.areReactionsTags(accountPeerId: self.context.account.peerId) {
//TODO:localize
actions.reactionsTitle = "Tag the message with an emoji for quick access later"
}

View File

@ -15796,13 +15796,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
switch search.domain {
case .everything:
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: nil, tags: nil, threadId: threadId, minDate: nil, maxDate: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: nil, tags: nil, reactions: nil, threadId: threadId, minDate: nil, maxDate: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
case .members:
derivedSearchState = nil
case let .member(peer):
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: peer.id, tags: nil, threadId: threadId, minDate: nil, maxDate: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
case let .tag(tag):
derivedSearchState = ChatSearchState(query: "@#\(tag) " + search.query, location: .peer(peerId: peerId, fromId: nil, tags: nil, threadId: threadId, minDate: nil, maxDate: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: peer.id, tags: nil, reactions: nil, threadId: threadId, minDate: nil, maxDate: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
case let .tag(tag, _):
derivedSearchState = ChatSearchState(query: search.query, location: .peer(peerId: peerId, fromId: nil, tags: nil, reactions: [tag], threadId: threadId, minDate: nil, maxDate: nil), loadMoreState: loadMoreStateFromResultsState(search.resultsState))
}
}
@ -15813,10 +15813,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if previousSearchState?.query != searchState.query || previousSearchState?.location != searchState.location {
var queryIsEmpty = false
if searchState.query.isEmpty {
if case let .peer(_, fromId, _, _, _, _) = searchState.location {
if case let .peer(_, fromId, _, reactions, _, _, _) = searchState.location {
if fromId == nil {
queryIsEmpty = true
}
if let reactions, !reactions.isEmpty {
queryIsEmpty = false
}
} else {
queryIsEmpty = true
}
@ -19179,6 +19182,10 @@ enum AllowedReactions {
}
func peerMessageAllowedReactions(context: AccountContext, message: Message) -> Signal<AllowedReactions?, NoError> {
if message.id.peerId == context.account.peerId {
return .single(.all)
}
if message.containsSecretMedia {
return .single(AllowedReactions.set(Set()))
}

View File

@ -120,12 +120,12 @@ final class ChatSearchNavigationContentNode: NavigationBarContentNode {
}
}
self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
case let .tag(tag):
case let .tag(tag, file):
//TODO:localize
let placeholderText = "Search"
self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
//TODO:localize
self.searchBar.tokens = [SearchBarToken(id: AnyHashable(tag), icon: nil, isTag: true, title: "\(tag) Tag", permanent: false)]
self.searchBar.tokens = [SearchBarToken(id: AnyHashable(tag), context: self.context, icon: nil, isTag: true, emojiFile: file, title: "Tag", permanent: false)]
case .members:
self.searchBar.tokens = []
self.searchBar.prefixString = NSAttributedString(string: strings.Conversation_SearchByName_Prefix, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputTextColor)

View File

@ -175,7 +175,7 @@ class ChatSearchResultsControllerNode: ViewControllerTracingNode, UIScrollViewDe
self.searchResult = searchResult
self.searchState = searchState
if case let .peer(peerId, _, _, _, _, _) = location, peerId == context.account.peerId {
if case let .peer(peerId, _, _, _, _, _, _) = location, peerId == context.account.peerId {
self.mappedLocation = .savedMessagesChats
} else {
self.mappedLocation = .chatList(groupId: .root)

View File

@ -9,24 +9,61 @@ import ComponentFlow
import MultilineTextComponent
import PlainButtonComponent
import UIKitRuntimeUtils
import TelegramCore
import EmojiStatusComponent
import SwiftSignalKit
final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UIScrollViewDelegate {
private final class Item {
let tag: String
private struct Params: Equatable {
var width: CGFloat
var leftInset: CGFloat
var rightInset: CGFloat
var interfaceState: ChatPresentationInterfaceState
init(tag: String) {
self.tag = tag
init(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, interfaceState: ChatPresentationInterfaceState) {
self.width = width
self.leftInset = leftInset
self.rightInset = rightInset
self.interfaceState = interfaceState
}
static func ==(lhs: Params, rhs: Params) -> Bool {
if lhs.width != rhs.width {
return false
}
if lhs.leftInset != rhs.leftInset {
return false
}
if lhs.rightInset != rhs.rightInset {
return false
}
if lhs.interfaceState != rhs.interfaceState {
return false
}
return true
}
}
private final class Item {
let reaction: MessageReaction.Reaction
let count: Int
let file: TelegramMediaFile
init(reaction: MessageReaction.Reaction, count: Int, file: TelegramMediaFile) {
self.reaction = reaction
self.count = count
self.file = file
}
}
private final class ItemView: UIView {
private let context: AccountContext
private let item: Item
private let action: (String) -> Void
private let action: () -> Void
private let view = ComponentView<Empty>()
init(context: AccountContext, item: Item, action: @escaping ((String) -> Void)) {
init(context: AccountContext, item: Item, action: @escaping (() -> Void)) {
self.context = context
self.item = item
self.action = action
@ -42,23 +79,41 @@ final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UISc
let viewSize = self.view.update(
transition: transition,
component: AnyComponent(PlainButtonComponent(
content: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: self.item.tag, font: Font.regular(15.0), textColor: theme.rootController.navigationBar.primaryTextColor)),
insets: UIEdgeInsets(top: 2.0, left: 2.0, bottom: 2.0, right: 2.0)
)),
content: AnyComponent(HStack([
AnyComponentWithIdentity(id: 0, component: AnyComponent(EmojiStatusComponent(
context: self.context,
animationCache: self.context.animationCache,
animationRenderer: self.context.animationRenderer,
content: .animation(
content: .file(file: self.item.file),
size: CGSize(width: 32.0, height: 32.0),
placeholderColor: theme.list.mediaPlaceholderColor,
themeColor: theme.list.itemPrimaryTextColor,
loopMode: .forever
),
size: CGSize(width: 16.0, height: 16.0),
isVisibleForAnimations: false,
useSharedAnimation: true,
action: nil,
emojiFileUpdated: nil
))),
AnyComponentWithIdentity(id: 1, component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: "\(self.item.count)", font: Font.regular(15.0), textColor: theme.rootController.navigationBar.secondaryTextColor))
)))
], spacing: 4.0)),
effectAlignment: .center,
minSize: CGSize(width: 0.0, height: height),
contentInsets: UIEdgeInsets(top: 0.0, left: 8.0, bottom: 0.0, right: 8.0),
contentInsets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0),
action: { [weak self] in
guard let self else {
return
}
self.action(self.item.tag)
self.action()
},
isEnabled: true
)),
environment: {},
containerSize: CGSize(width: 100.0, height: 100.0)
containerSize: CGSize(width: 100.0, height: 32.0)
)
if let componentView = self.view.view {
if componentView.superview == nil {
@ -81,30 +136,21 @@ final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UISc
}
private let context: AccountContext
private var theme: PresentationTheme?
private var strings: PresentationStrings?
private let scrollView: ScrollView
private let itemViews: [ItemView]
private var params: Params?
private var items: [Item] = []
private var itemViews: [MessageReaction.Reaction: ItemView] = [:]
private var itemsDisposable: Disposable?
init(context: AccountContext) {
self.context = context
self.scrollView = ScrollView(frame: CGRect())
let tags: [String] = [
"⭐️", "❤️", "", "", "💭", "❗️", "👍", "👎", "🤩", "⚡️", "🤡", "👌", "👏"
]
let items = tags.map {
Item(tag: $0)
}
var itemAction: ((String) -> Void)?
self.itemViews = items.map { item in
return ItemView(context: context, item: item, action: { tag in
itemAction?(tag)
})
}
super.init()
self.scrollView.delaysContentTouches = false
@ -125,58 +171,105 @@ final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UISc
self.scrollView.disablesInteractiveTransitionGestureRecognizer = true
for itemView in self.itemViews {
self.scrollView.addSubview(itemView)
}
itemAction = { [weak self] tag in
guard let self, let interfaceInteraction = self.interfaceInteraction else {
self.itemsDisposable = (context.engine.stickers.savedMessageTags()
|> deliverOnMainQueue).start(next: { [weak self] tags, files in
guard let self else {
return
}
interfaceInteraction.beginMessageSearch(.tag(tag), "")
self.items = tags.compactMap { tag -> Item? in
switch tag.reaction {
case .builtin:
return nil
case let .custom(fileId):
guard let file = files[fileId] else {
return nil
}
return Item(reaction: tag.reaction, count: tag.count, file: file)
}
}
self.update(transition: .immediate)
})
}
deinit {
self.itemsDisposable?.dispose()
}
private func update(transition: ContainedViewLayoutTransition) {
if let params = self.params {
self.update(params: params, transition: transition)
}
}
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) -> LayoutResult {
if interfaceState.strings !== self.strings {
self.strings = interfaceState.strings
}
if interfaceState.theme !== self.theme {
self.theme = interfaceState.theme
let params = Params(width: width, leftInset: leftInset, rightInset: rightInset, interfaceState: interfaceState)
if self.params != params {
self.params = params
self.update(params: params, transition: transition)
}
let panelHeight: CGFloat = 33.0
let containerInsets = UIEdgeInsets(top: 0.0, left: leftInset + 2.0, bottom: 0.0, right: rightInset + 2.0)
return LayoutResult(backgroundHeight: panelHeight, insetHeight: panelHeight, hitTestSlop: 0.0)
}
private func update(params: Params, transition: ContainedViewLayoutTransition) {
let panelHeight: CGFloat = 33.0
let containerInsets = UIEdgeInsets(top: 0.0, left: params.leftInset + 2.0, bottom: 0.0, right: params.rightInset + 2.0)
let itemSpacing: CGFloat = 2.0
var contentSize = CGSize(width: 0.0, height: panelHeight)
contentSize.width += containerInsets.left
var validIds: [MessageReaction.Reaction] = []
var isFirst = true
for itemView in self.itemViews {
for item in self.items {
if isFirst {
isFirst = false
} else {
contentSize.width += itemSpacing
}
let itemId = item.reaction
validIds.append(itemId)
let itemSize = itemView.update(theme: interfaceState.theme, height: panelHeight, transition: .immediate)
let itemView: ItemView
if let current = self.itemViews[itemId] {
itemView = current
} else {
itemView = ItemView(context: self.context, item: item, action: { [weak self] in
guard let self else {
return
}
self.interfaceInteraction?.beginMessageSearch(.tag(item.reaction, item.file), "")
})
self.itemViews[itemId] = itemView
self.scrollView.addSubview(itemView)
}
let itemSize = itemView.update(theme: params.interfaceState.theme, height: panelHeight, transition: .immediate)
itemView.frame = CGRect(origin: CGPoint(x: contentSize.width, y: 0.0), size: itemSize)
contentSize.width += itemSize.width
}
var removedIds: [MessageReaction.Reaction] = []
for (id, itemView) in self.itemViews {
if !validIds.contains(id) {
removedIds.append(id)
itemView.removeFromSuperview()
}
}
for id in removedIds {
self.itemViews.removeValue(forKey: id)
}
contentSize.width += containerInsets.right
let scrollSize = CGSize(width: width, height: contentSize.height)
let scrollSize = CGSize(width: params.width, height: contentSize.height)
if self.scrollView.bounds.size != scrollSize {
self.scrollView.frame = CGRect(origin: CGPoint(x: 0.0, y: -5.0), size: scrollSize)
}
if self.scrollView.contentSize != contentSize {
self.scrollView.contentSize = contentSize
}
return LayoutResult(backgroundHeight: panelHeight, insetHeight: panelHeight, hitTestSlop: 0.0)
}
}

View File

@ -6,6 +6,91 @@ import AccountContext
import ReactionSelectionNode
func topMessageReactions(context: AccountContext, message: Message) -> Signal<[ReactionItem], NoError> {
if message.id.peerId == context.account.peerId {
var loadTags = true
if let effectiveReactionsAttribute = message.effectiveReactionsAttribute {
if !effectiveReactionsAttribute.reactions.isEmpty {
if !effectiveReactionsAttribute.isTags {
loadTags = false
}
}
}
if loadTags {
return combineLatest(
context.engine.stickers.availableReactions(),
context.account.postbox.itemCollectionsView(orderedItemListCollectionIds: [Namespaces.OrderedItemList.CloudDefaultTagReactions], namespaces: [ItemCollectionId.Namespace.max - 1], aroundIndex: nil, count: 10000000)
)
|> take(1)
|> map { availableReactions, view -> [ReactionItem] in
var defaultTagReactions: OrderedItemListView?
for orderedView in view.orderedItemListsViews {
if orderedView.collectionId == Namespaces.OrderedItemList.CloudDefaultTagReactions {
defaultTagReactions = orderedView
}
}
var result: [ReactionItem] = []
var existingIds = Set<MessageReaction.Reaction>()
if let defaultTagReactions {
for item in defaultTagReactions.items {
guard let topReaction = item.contents.get(RecentReactionItem.self) else {
continue
}
switch topReaction.content {
case let .builtin(value):
if let reaction = availableReactions?.reactions.first(where: { $0.value == .builtin(value) }) {
guard let centerAnimation = reaction.centerAnimation else {
continue
}
guard let aroundAnimation = reaction.aroundAnimation else {
continue
}
if existingIds.contains(reaction.value) {
continue
}
existingIds.insert(reaction.value)
result.append(ReactionItem(
reaction: ReactionItem.Reaction(rawValue: reaction.value),
appearAnimation: reaction.appearAnimation,
stillAnimation: reaction.selectAnimation,
listAnimation: centerAnimation,
largeListAnimation: reaction.activateAnimation,
applicationAnimation: aroundAnimation,
largeApplicationAnimation: reaction.effectAnimation,
isCustom: false
))
} else {
continue
}
case let .custom(file):
if existingIds.contains(.custom(file.fileId.id)) {
continue
}
existingIds.insert(.custom(file.fileId.id))
result.append(ReactionItem(
reaction: ReactionItem.Reaction(rawValue: .custom(file.fileId.id)),
appearAnimation: file,
stillAnimation: file,
listAnimation: file,
largeListAnimation: file,
applicationAnimation: nil,
largeApplicationAnimation: nil,
isCustom: true
))
}
}
}
return result
}
}
}
let viewKey: PostboxViewKey = .orderedItemList(id: Namespaces.OrderedItemList.CloudTopReactions)
let topReactions = context.account.postbox.combinedView(keys: [viewKey])
|> map { views -> [RecentReactionItem] in
@ -51,7 +136,6 @@ func topMessageReactions(context: AccountContext, message: Message) -> Signal<[R
}
var result: [ReactionItem] = []
var existingIds = Set<MessageReaction.Reaction>()
for topReaction in topReactions {

View File

@ -437,7 +437,7 @@ func makeBridgeUser(_ peer: Peer?, presence: PeerPresence? = nil, cachedData: Ca
bridgeUser.lastSeen = -3
case .lastMonth:
bridgeUser.lastSeen = -4
case .none:
case .none, .hidden:
bridgeUser.lastSeen = -5
case let .present(statusTimestamp):
if statusTimestamp > timestamp {