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

View File

@ -1572,9 +1572,9 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
let searchLocations: [SearchMessagesLocation] let searchLocations: [SearchMessagesLocation]
if let options = options { if let options = options {
if case let .forum(peerId) = location { 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 { } 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 { } else {
if case let .chatList(groupId) = location, case .archive = groupId { if case let .chatList(groupId) = location, case .archive = groupId {
searchLocations = [.group(groupId: groupId._asGroup(), tags: tagMask, minDate: options.date?.0, maxDate: options.date?.1)] 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 { } else {
if case let .forum(peerId) = location { 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 { } else if case let .chatList(groupId) = location, case .archive = groupId {
searchLocations = [.group(groupId: groupId._asGroup(), tags: tagMask, minDate: nil, maxDate: nil)] searchLocations = [.group(groupId: groupId._asGroup(), tags: tagMask, minDate: nil, maxDate: nil)]
} else { } else {

View File

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

View File

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

View File

@ -9,6 +9,8 @@ import ActivityIndicator
import AppBundle import AppBundle
import AvatarNode import AvatarNode
import AccountContext import AccountContext
import ComponentFlow
import EmojiStatusComponent
private func generateLoupeIcon(color: UIColor) -> UIImage? { private func generateLoupeIcon(color: UIColor) -> UIImage? {
return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: color) return generateTintedImage(image: UIImage(bundleImageName: "Components/Search Bar/Loupe"), color: color)
@ -43,20 +45,24 @@ public struct SearchBarToken {
} }
public let id: AnyHashable public let id: AnyHashable
public let context: AccountContext?
public let icon: UIImage? public let icon: UIImage?
public let iconOffset: CGFloat? public let iconOffset: CGFloat?
public let peer: (EnginePeer, AccountContext, PresentationTheme)? public let peer: (EnginePeer, AccountContext, PresentationTheme)?
public let isTag: Bool public let isTag: Bool
public let emojiFile: TelegramMediaFile?
public let title: String public let title: String
public let style: Style? public let style: Style?
public let permanent: Bool 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.id = id
self.context = context
self.icon = icon self.icon = icon
self.iconOffset = iconOffset self.iconOffset = iconOffset
self.peer = peer self.peer = peer
self.isTag = isTag self.isTag = isTag
self.emojiFile = emojiFile
self.title = title self.title = title
self.style = style self.style = style
self.permanent = permanent self.permanent = permanent
@ -71,6 +77,7 @@ private final class TokenNode: ASDisplayNode {
let titleNode: ASTextNode let titleNode: ASTextNode
let backgroundNode: ASImageNode let backgroundNode: ASImageNode
let avatarNode: AvatarNode? let avatarNode: AvatarNode?
var emojiView: ComponentView<Empty>?
var isSelected: Bool = false var isSelected: Bool = false
var isCollapsed: Bool = false var isCollapsed: Bool = false
@ -204,6 +211,7 @@ private final class TokenNode: ASDisplayNode {
height += 2.0 height += 2.0
} }
var emojiFileSize: CGSize?
var leftInset: CGFloat = 3.0 var leftInset: CGFloat = 3.0
if let icon = self.iconNode.image { if let icon = self.iconNode.image {
leftInset += 1.0 leftInset += 1.0
@ -214,9 +222,49 @@ private final class TokenNode: ASDisplayNode {
transition.updateFrame(node: self.iconNode, frame: iconFrame) transition.updateFrame(node: self.iconNode, frame: iconFrame)
leftInset += icon.size.width + 3.0 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 { if self.token.isTag {
leftInset += 2.0 leftInset += 2.0
} }
if let emojiFileSize {
leftInset += emojiFileSize.width + 7.0
}
let iconSize = self.token.icon?.size ?? CGSize() let iconSize = self.token.icon?.size ?? CGSize()
let titleSize = self.titleNode.measure(CGSize(width: constrainedSize.width - 6.0, height: constrainedSize.height)) 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[577659656] = { return Api.NotifyPeer.parse_notifyForumTopic($0) }
dict[-1613493288] = { return Api.NotifyPeer.parse_notifyPeer($0) } dict[-1613493288] = { return Api.NotifyPeer.parse_notifyPeer($0) }
dict[-1261946036] = { return Api.NotifyPeer.parse_notifyUsers($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[-1738178803] = { return Api.Page.parse_page($0) }
dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) } dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) }
dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($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[1009288385] = { return Api.RichText.parse_textUrl($0) }
dict[289586518] = { return Api.SavedContact.parse_savedPhoneContact($0) } dict[289586518] = { return Api.SavedContact.parse_savedPhoneContact($0) }
dict[-1115174036] = { return Api.SavedDialog.parse_savedDialog($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[-911191137] = { return Api.SearchResultsCalendarPeriod.parse_searchResultsCalendarPeriod($0) }
dict[2137295719] = { return Api.SearchResultsPosition.parse_searchResultPosition($0) } dict[2137295719] = { return Api.SearchResultsPosition.parse_searchResultPosition($0) }
dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($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[-1706939360] = { return Api.Update.parse_updateRecentStickers($0) }
dict[-1364222348] = { return Api.Update.parse_updateSavedDialogPinned($0) } dict[-1364222348] = { return Api.Update.parse_updateSavedDialogPinned($0) }
dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($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[1960361625] = { return Api.Update.parse_updateSavedRingtones($0) }
dict[2103604867] = { return Api.Update.parse_updateSentStoryReaction($0) } dict[2103604867] = { return Api.Update.parse_updateSentStoryReaction($0) }
dict[-337352679] = { return Api.Update.parse_updateServiceNotification($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[-2100168954] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) }
dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) } dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) }
dict[164646985] = { return Api.UserStatus.parse_userStatusEmpty($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[2011940674] = { return Api.UserStatus.parse_userStatusLastMonth($0) }
dict[129960444] = { return Api.UserStatus.parse_userStatusLastWeek($0) } dict[129960444] = { return Api.UserStatus.parse_userStatusLastWeek($0) }
dict[9203775] = { return Api.UserStatus.parse_userStatusOffline($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[1153080793] = { return Api.messages.SavedDialogs.parse_savedDialogsSlice($0) }
dict[-2069878259] = { return Api.messages.SavedGifs.parse_savedGifs($0) } dict[-2069878259] = { return Api.messages.SavedGifs.parse_savedGifs($0) }
dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($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[-398136321] = { return Api.messages.SearchCounter.parse_searchCounter($0) }
dict[343859772] = { return Api.messages.SearchResultsCalendar.parse_searchResultsCalendar($0) } dict[343859772] = { return Api.messages.SearchResultsCalendar.parse_searchResultsCalendar($0) }
dict[1404185519] = { return Api.messages.SearchResultsPositions.parse_searchResultsPositions($0) } dict[1404185519] = { return Api.messages.SearchResultsPositions.parse_searchResultsPositions($0) }
@ -1657,6 +1663,8 @@ public extension Api {
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.NotifyPeer: case let _1 as Api.NotifyPeer:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.OutboxReadDate:
_1.serialize(buffer, boxed)
case let _1 as Api.Page: case let _1 as Api.Page:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.PageBlock: case let _1 as Api.PageBlock:
@ -1761,6 +1769,8 @@ public extension Api {
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.SavedDialog: case let _1 as Api.SavedDialog:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.SavedReactionTag:
_1.serialize(buffer, boxed)
case let _1 as Api.SearchResultsCalendarPeriod: case let _1 as Api.SearchResultsCalendarPeriod:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.SearchResultsPosition: case let _1 as Api.SearchResultsPosition:
@ -2083,6 +2093,8 @@ public extension Api {
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.messages.SavedGifs: case let _1 as Api.messages.SavedGifs:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.messages.SavedReactionTags:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SearchCounter: case let _1 as Api.messages.SearchCounter:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.messages.SearchResultsCalendar: 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 { public extension Api {
enum Page: TypeConstructorDescription { enum Page: TypeConstructorDescription {
case page(flags: Int32, url: String, blocks: [Api.PageBlock], photos: [Api.Photo], documents: [Api.Document], views: Int32?) 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 { public extension Api {
enum SearchResultsCalendarPeriod: TypeConstructorDescription { enum SearchResultsCalendarPeriod: TypeConstructorDescription {
case searchResultsCalendarPeriod(date: Int32, minMsgId: Int32, maxMsgId: Int32, count: Int32) 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 { public extension Api {
enum SecureRequiredType: TypeConstructorDescription { enum SecureRequiredType: TypeConstructorDescription {
case secureRequiredType(flags: Int32, type: Api.SecureValueType) case secureRequiredType(flags: Int32, type: Api.SecureValueType)

View File

@ -569,6 +569,7 @@ public extension Api {
case updateRecentStickers case updateRecentStickers
case updateSavedDialogPinned(flags: Int32, peer: Api.DialogPeer) case updateSavedDialogPinned(flags: Int32, peer: Api.DialogPeer)
case updateSavedGifs case updateSavedGifs
case updateSavedReactionTags
case updateSavedRingtones case updateSavedRingtones
case updateSentStoryReaction(peer: Api.Peer, storyId: Int32, reaction: Api.Reaction) 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]) 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) buffer.appendInt32(-1821035490)
} }
break
case .updateSavedReactionTags:
if boxed {
buffer.appendInt32(969307186)
}
break break
case .updateSavedRingtones: case .updateSavedRingtones:
if boxed { if boxed {
@ -1897,6 +1904,8 @@ public extension Api {
return ("updateSavedDialogPinned", [("flags", flags as Any), ("peer", peer as Any)]) return ("updateSavedDialogPinned", [("flags", flags as Any), ("peer", peer as Any)])
case .updateSavedGifs: case .updateSavedGifs:
return ("updateSavedGifs", []) return ("updateSavedGifs", [])
case .updateSavedReactionTags:
return ("updateSavedReactionTags", [])
case .updateSavedRingtones: case .updateSavedRingtones:
return ("updateSavedRingtones", []) return ("updateSavedRingtones", [])
case .updateSentStoryReaction(let peer, let storyId, let reaction): case .updateSentStoryReaction(let peer, let storyId, let reaction):
@ -3848,6 +3857,9 @@ public extension Api {
public static func parse_updateSavedGifs(_ reader: BufferReader) -> Update? { public static func parse_updateSavedGifs(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedGifs return Api.Update.updateSavedGifs
} }
public static func parse_updateSavedReactionTags(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedReactionTags
}
public static func parse_updateSavedRingtones(_ reader: BufferReader) -> Update? { public static func parse_updateSavedRingtones(_ reader: BufferReader) -> Update? {
return Api.Update.updateSavedRingtones return Api.Update.updateSavedRingtones
} }

View File

@ -801,6 +801,7 @@ public extension Api {
public extension Api { public extension Api {
enum UserStatus: TypeConstructorDescription { enum UserStatus: TypeConstructorDescription {
case userStatusEmpty case userStatusEmpty
case userStatusHidden
case userStatusLastMonth case userStatusLastMonth
case userStatusLastWeek case userStatusLastWeek
case userStatusOffline(wasOnline: Int32) case userStatusOffline(wasOnline: Int32)
@ -814,6 +815,12 @@ public extension Api {
buffer.appendInt32(164646985) buffer.appendInt32(164646985)
} }
break
case .userStatusHidden:
if boxed {
buffer.appendInt32(-813865807)
}
break break
case .userStatusLastMonth: case .userStatusLastMonth:
if boxed { if boxed {
@ -852,6 +859,8 @@ public extension Api {
switch self { switch self {
case .userStatusEmpty: case .userStatusEmpty:
return ("userStatusEmpty", []) return ("userStatusEmpty", [])
case .userStatusHidden:
return ("userStatusHidden", [])
case .userStatusLastMonth: case .userStatusLastMonth:
return ("userStatusLastMonth", []) return ("userStatusLastMonth", [])
case .userStatusLastWeek: case .userStatusLastWeek:
@ -868,6 +877,9 @@ public extension Api {
public static func parse_userStatusEmpty(_ reader: BufferReader) -> UserStatus? { public static func parse_userStatusEmpty(_ reader: BufferReader) -> UserStatus? {
return Api.UserStatus.userStatusEmpty return Api.UserStatus.userStatusEmpty
} }
public static func parse_userStatusHidden(_ reader: BufferReader) -> UserStatus? {
return Api.UserStatus.userStatusHidden
}
public static func parse_userStatusLastMonth(_ reader: BufferReader) -> UserStatus? { public static func parse_userStatusLastMonth(_ reader: BufferReader) -> UserStatus? {
return Api.UserStatus.userStatusLastMonth 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 { public extension Api {
indirect enum WebPageAttribute: TypeConstructorDescription { indirect enum WebPageAttribute: TypeConstructorDescription {
case webPageAttributeStory(flags: Int32, peer: Api.Peer, id: Int32, story: Api.StoryItem?) 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 { public extension Api.auth {
enum Authorization: TypeConstructorDescription { enum Authorization: TypeConstructorDescription {
case authorization(flags: Int32, otherwiseReloginDays: Int32?, tmpSessions: Int32?, futureAuthToken: Buffer?, user: Api.User) 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 { public extension Api.chatlists {
enum ChatlistUpdates: TypeConstructorDescription { enum ChatlistUpdates: TypeConstructorDescription {
case chatlistUpdates(missingPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) 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 { public extension Api.help {
enum PremiumPromo: TypeConstructorDescription { enum PremiumPromo: TypeConstructorDescription {
case premiumPromo(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document], periodOptions: [Api.PremiumSubscriptionOption], users: [Api.User]) 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 { public extension Api.messages {
enum DiscussionMessage: TypeConstructorDescription { enum DiscussionMessage: TypeConstructorDescription {
case discussionMessage(flags: Int32, messages: [Api.Message], maxId: Int32?, readInboxMaxId: Int32?, readOutboxMaxId: Int32?, unreadCount: Int32, chats: [Api.Chat], users: [Api.User]) 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 { public extension Api.messages {
enum SavedGifs: TypeConstructorDescription { enum SavedGifs: TypeConstructorDescription {
case savedGifs(hash: Int64, gifs: [Api.Document]) 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 { public extension Api.messages {
enum SearchCounter: TypeConstructorDescription { enum SearchCounter: TypeConstructorDescription {
case searchCounter(flags: Int32, filter: Api.MessagesFilter, count: Int32) 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 { public extension Api.phone {
enum GroupCallStreamChannels: TypeConstructorDescription { enum GroupCallStreamChannels: TypeConstructorDescription {
case groupCallStreamChannels(channels: [Api.GroupCallStreamChannel]) 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 { public extension Api.stories {
enum StoryViews: TypeConstructorDescription { enum StoryViews: TypeConstructorDescription {
case storyViews(views: [Api.StoryViews], users: [Api.User]) 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 { public extension Api.functions.messages {
static func getDhConfig(version: Int32, randomLength: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.DhConfig>) { static func getDhConfig(version: Int32, randomLength: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.DhConfig>) {
let buffer = Buffer() 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 { public extension Api.functions.messages {
static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.PeerDialogs>) { static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.PeerDialogs>) {
let buffer = Buffer() 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 { public extension Api.functions.messages {
static func getScheduledHistory(peer: Api.InputPeer, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) { static func getScheduledHistory(peer: Api.InputPeer, hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Messages>) {
let buffer = Buffer() let buffer = Buffer()
@ -6785,14 +6831,19 @@ public extension Api.functions.messages {
} }
} }
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() let buffer = Buffer()
buffer.appendInt32(-1481316055) buffer.appendInt32(703497338)
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true) peer.serialize(buffer, true)
serializeString(q, buffer: buffer, boxed: false) serializeString(q, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {fromId!.serialize(buffer, true)} 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 << 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)} if Int(flags) & Int(1 << 1) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
filter.serialize(buffer, true) filter.serialize(buffer, true)
serializeInt32(minDate, buffer: buffer, boxed: false) serializeInt32(minDate, buffer: buffer, boxed: false)
@ -6803,7 +6854,7 @@ public extension Api.functions.messages {
serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false)
serializeInt32(minId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false)
serializeInt64(hash, 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) let reader = BufferReader(buffer)
var result: Api.messages.Messages? var result: Api.messages.Messages?
if let signature = reader.readInt32() { 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 { public extension Api.functions.messages {
static func uploadEncryptedFile(peer: Api.InputEncryptedChat, file: Api.InputEncryptedFile) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EncryptedFile>) { static func uploadEncryptedFile(peer: Api.InputEncryptedChat, file: Api.InputEncryptedFile) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EncryptedFile>) {
let buffer = Buffer() let buffer = Buffer()

View File

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

View File

@ -8,6 +8,8 @@ extension TelegramUserPresence {
switch apiStatus { switch apiStatus {
case .userStatusEmpty: case .userStatusEmpty:
self.init(status: .none, lastActivity: 0) self.init(status: .none, lastActivity: 0)
case .userStatusHidden:
self.init(status: .hidden, lastActivity: 0)
case let .userStatusOnline(expires): case let .userStatusOnline(expires):
self.init(status: .present(until: expires), lastActivity: 0) self.init(status: .present(until: expires), lastActivity: 0)
case let .userStatusOffline(wasOnline): case let .userStatusOffline(wasOnline):

View File

@ -89,6 +89,7 @@ final class AccountTaskManager {
tasks.add(managedSynchronizeEmojiKeywordsOperations(postbox: self.stateManager.postbox, network: self.stateManager.network).start()) 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(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(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: .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: .status).start())
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .avatar).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(managedGroupPhotoEmoji(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
tasks.add(managedBackgroundIconEmoji(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(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: .iconStatusEmoji, forceActualized: true).start())
tasks.add(_internal_loadedStickerPack(postbox: self.stateManager.postbox, network: self.stateManager.network, reference: .iconChannelStatusEmoji, 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()) 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 { } 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)) 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) { } 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 { } else {
assertionFailure() assertionFailure()
requestSignal = .complete() requestSignal = .complete()
@ -582,7 +582,7 @@ private func validateReplyThreadMessagesBatch(postbox: Postbox, network: Network
var flags: Int32 = 0 var flags: Int32 = 0
flags |= (1 << 1) 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 { } else {
return .complete() 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 { } else {
assertionFailure() assertionFailure()
minMaxRange = 1 ... 1 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) offset = single((holeIndex.timestamp, min(holeIndex.id.id, Int32.max - 1) + 1, Api.InputPeer.inputPeerEmpty), NoError.self)
return offset return offset
|> mapToSignal { (timestamp, id, peer) -> Signal<Void, NoError> in |> 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 |> retryRequest
|> mapToSignal { result -> Signal<Void, NoError> in |> mapToSignal { result -> Signal<Void, NoError> in
let messages: [Api.Message] 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 _ = peer as? TelegramUser {
if let presence = transaction.getPeerPresence(peerId: peerId) as? TelegramUserPresence { if let presence = transaction.getPeerPresence(peerId: peerId) as? TelegramUserPresence {
switch presence.status { switch presence.status {
case .none, .lastWeek, .lastMonth: case .none, .lastWeek, .lastMonth, .hidden:
return .complete() return .complete()
case .recently: case .recently:
break 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 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 class Serialization: NSObject, MTSerialization {
public func currentLayer() -> UInt { public func currentLayer() -> UInt {
return 170 return 171
} }
public func parseMessage(_ data: Data!) -> Any! { public func parseMessage(_ data: Data!) -> Any! {

View File

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

View File

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

View File

@ -1,52 +1,49 @@
import Postbox import Postbox
public enum UserPresenceStatus: Comparable, PostboxCoding { 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 none
case hidden
case present(until: Int32) case present(until: Int32)
case recently case recently
case lastWeek case lastWeek
case lastMonth case lastMonth
public static func <(lhs: UserPresenceStatus, rhs: UserPresenceStatus) -> Bool { private var sortKey: SortKey {
switch lhs { switch self {
case .none:
switch rhs {
case .none:
return false
case .lastMonth, .lastWeek, .recently, .present:
return true
}
case let .present(until): case let .present(until):
switch rhs { return SortKey(major: 1, minor: until)
case .none: case .hidden:
return false return SortKey(major: 2, minor: 0)
case let .present(rhsUntil):
return until < rhsUntil
case .lastWeek, .lastMonth, .recently:
return false
}
case .recently: case .recently:
switch rhs { return SortKey(major: 3, minor: 0)
case .none, .lastWeek, .lastMonth, .recently:
return false
case .present:
return true
}
case .lastWeek: case .lastWeek:
switch rhs { return SortKey(major: 4, minor: 0)
case .none, .lastMonth, .lastWeek:
return false
case .present, .recently:
return true
}
case .lastMonth: case .lastMonth:
switch rhs { return SortKey(major: 5, minor: 0)
case .none, .lastMonth: case .none:
return false return SortKey(major: 6, minor: 0)
case .present, .recently, lastWeek:
return true
} }
} }
public static func <(lhs: UserPresenceStatus, rhs: UserPresenceStatus) -> Bool {
return lhs.sortKey < rhs.sortKey
} }
public init(decoder: PostboxDecoder) { public init(decoder: PostboxDecoder) {
@ -61,6 +58,8 @@ public enum UserPresenceStatus: Comparable, PostboxCoding {
self = .lastWeek self = .lastWeek
case 4: case 4:
self = .lastMonth self = .lastMonth
case 5:
self = .hidden
default: default:
self = .none self = .none
} }
@ -79,6 +78,8 @@ public enum UserPresenceStatus: Comparable, PostboxCoding {
encoder.encodeInt32(3, forKey: "v") encoder.encodeInt32(3, forKey: "v")
case .lastMonth: case .lastMonth:
encoder.encodeInt32(4, forKey: "v") encoder.encodeInt32(4, forKey: "v")
case .hidden:
encoder.encodeInt32(5, forKey: "v")
} }
} }
} }

View File

@ -8,7 +8,7 @@ import MtProtoKit
public enum SearchMessagesLocation: Equatable { public enum SearchMessagesLocation: Equatable {
case general(tags: MessageTags?, minDate: Int32?, maxDate: Int32?) case general(tags: MessageTags?, minDate: Int32?, maxDate: Int32?)
case group(groupId: PeerGroupId, 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?) 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> { 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> let remoteSearchResult: Signal<(Api.messages.Messages?, Api.messages.Messages?), NoError>
switch location { 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 { if peerId.namespace == Namespaces.Peer.SecretChat {
return account.postbox.transaction { transaction -> (SearchMessagesResult, SearchMessagesState) in return account.postbox.transaction { transaction -> (SearchMessagesResult, SearchMessagesState) in
var readStates: [PeerId: CombinedPeerReadState] = [:] var readStates: [PeerId: CombinedPeerReadState] = [:]
@ -297,6 +297,7 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
flags |= (1 << 1) flags |= (1 << 1)
topMsgId = Int32(clamping: threadId) topMsgId = Int32(clamping: threadId)
} }
let peerMessages: Signal<Api.messages.Messages?, NoError> let peerMessages: Signal<Api.messages.Messages?, NoError>
if let completed = state?.main.completed, completed { if let completed = state?.main.completed, completed {
peerMessages = .single(nil) 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 { 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)) 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 { } 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 peerMessages = signal
|> map(Optional.init) |> map(Optional.init)
@ -322,7 +334,19 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
additionalPeerMessages = .single(nil) additionalPeerMessages = .single(nil)
} else if mainCompleted || !hasAdditional { } else if mainCompleted || !hasAdditional {
let lowerBound = state?.additional?.messages.last.flatMap({ $0.index }) 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) |> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in |> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
return .single(nil) 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 |> map { result -> (count: Int32?, topId: Int32?) in
switch result { switch result {
case let .messagesSlice(_, count, _, _, messages, _, _): case let .messagesSlice(_, count, _, _, messages, _, _):

View File

@ -6,52 +6,49 @@ public enum EnginePeer: Equatable {
public struct Presence: Equatable { public struct Presence: Equatable {
public enum Status: Comparable { 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 present(until: Int32)
case hidden
case recently case recently
case lastWeek case lastWeek
case lastMonth case lastMonth
case longTimeAgo case longTimeAgo
public static func <(lhs: Status, rhs: Status) -> Bool { private var sortKey: SortKey {
switch lhs { switch self {
case .longTimeAgo:
switch rhs {
case .longTimeAgo:
return false
case .lastMonth, .lastWeek, .recently, .present:
return true
}
case let .present(until): case let .present(until):
switch rhs { return SortKey(major: 1, minor: until)
case .longTimeAgo: case .hidden:
return false return SortKey(major: 2, minor: 0)
case let .present(rhsUntil):
return until < rhsUntil
case .lastWeek, .lastMonth, .recently:
return false
}
case .recently: case .recently:
switch rhs { return SortKey(major: 3, minor: 0)
case .longTimeAgo, .lastWeek, .lastMonth, .recently:
return false
case .present:
return true
}
case .lastWeek: case .lastWeek:
switch rhs { return SortKey(major: 4, minor: 0)
case .longTimeAgo, .lastMonth, .lastWeek:
return false
case .present, .recently:
return true
}
case .lastMonth: case .lastMonth:
switch rhs { return SortKey(major: 5, minor: 0)
case .longTimeAgo, .lastMonth: case .longTimeAgo:
return false return SortKey(major: 6, minor: 0)
case .present, .recently, lastWeek:
return true
} }
} }
public static func <(lhs: Status, rhs: Status) -> Bool {
return lhs.sortKey < rhs.sortKey
} }
} }
@ -368,6 +365,8 @@ public extension EnginePeer.Presence {
switch presence.status { switch presence.status {
case .none: case .none:
mappedStatus = .longTimeAgo mappedStatus = .longTimeAgo
case .hidden:
mappedStatus = .hidden
case let .present(until): case let .present(until):
mappedStatus = .present(until: until) mappedStatus = .present(until: until)
case .recently: case .recently:
@ -387,6 +386,8 @@ public extension EnginePeer.Presence {
func _asPresence() -> TelegramUserPresence { func _asPresence() -> TelegramUserPresence {
let mappedStatus: UserPresenceStatus let mappedStatus: UserPresenceStatus
switch self.status { switch self.status {
case .hidden:
mappedStatus = .hidden
case .longTimeAgo: case .longTimeAgo:
mappedStatus = .none mappedStatus = .none
case let .present(until): 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) { } 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) |> map(Optional.init)
|> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in |> `catch` { _ -> Signal<Api.messages.Messages?, NoError> in
return .single(nil) return .single(nil)

View File

@ -109,6 +109,24 @@ public extension TelegramEngine {
return _internal_cachedAvailableReactions(postbox: self.account.postbox) 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> { public func emojiSearchCategories(kind: EmojiSearchCategories.Kind) -> Signal<EmojiSearchCategories?, NoError> {
return _internal_cachedEmojiSearchCategories(postbox: self.account.postbox, kind: kind) return _internal_cachedEmojiSearchCategories(postbox: self.account.postbox, kind: kind)
} }

View File

@ -417,6 +417,17 @@ public extension Message {
} }
return nil 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]? { var effectiveReactions: [MessageReaction]? {
if !self.hasReactions { if !self.hasReactions {
return nil 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? { public func _internal_parseMediaAttachment(data: Data) -> Media? {
guard let object = Api.parse(Buffer(buffer: MemoryBuffer(data: data))) else { guard let object = Api.parse(Buffer(buffer: MemoryBuffer(data: data))) else {
return nil return nil

View File

@ -216,6 +216,7 @@ public enum RelativeUserPresenceStatus {
case offline case offline
case online(at: Int32) case online(at: Int32)
case lastSeen(at: Int32) case lastSeen(at: Int32)
case hidden
case recently case recently
case lastWeek case lastWeek
case lastMonth case lastMonth
@ -242,6 +243,8 @@ public func relativeUserPresenceStatus(_ presence: EnginePeer.Presence, relative
return .lastWeek return .lastWeek
case .lastMonth: case .lastMonth:
return .lastMonth return .lastMonth
case .hidden:
return .hidden
} }
} }
@ -537,6 +540,9 @@ public func stringAndActivityForUserPresence(strings: PresentationStrings, dateT
return (strings.LastSeen_WithinAMonth, false) return (strings.LastSeen_WithinAMonth, false)
case .longTimeAgo: case .longTimeAgo:
return (strings.LastSeen_ALongTimeAgo, false) 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 { } else {
return Double.infinity return Double.infinity
} }
case .none, .lastWeek, .lastMonth: case .none, .lastWeek, .lastMonth, .hidden:
return Double.infinity return Double.infinity
} }
} }

View File

@ -196,7 +196,7 @@ public final class ChatHistorySearchContainerNode: SearchDisplayControllerConten
if let strongSelf = self { if let strongSelf = self {
let signal: Signal<([ChatHistorySearchEntry], [MessageId: Message])?, NoError> let signal: Signal<([ChatHistorySearchEntry], [MessageId: Message])?, NoError>
if let query = query, !query.isEmpty { 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 } |> map { $0.0.messages }
|> delay(0.2, queue: Queue.concurrentDefaultQueue()) |> delay(0.2, queue: Queue.concurrentDefaultQueue())

View File

@ -1045,7 +1045,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,
@ -1241,9 +1241,9 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
let reactions: ReactionsMessageAttribute let reactions: ReactionsMessageAttribute
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) { 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 { } 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))? var reactionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode))?
if !reactions.reactions.isEmpty { if !reactions.reactions.isEmpty {

View File

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

View File

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

View File

@ -238,7 +238,7 @@ public class ChatMessageContactBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

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

View File

@ -519,7 +519,7 @@ public class ChatMessageGiveawayBubbleContentNode: ChatMessageBubbleContentNode,
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

@ -595,9 +595,9 @@ public class ChatMessageInstantVideoItemNode: ChatMessageItemView, UIGestureReco
let reactions: ReactionsMessageAttribute let reactions: ReactionsMessageAttribute
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) { 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 { } 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))? var reactionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode))?

View File

@ -937,7 +937,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: arguments.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: arguments.isPinned && !arguments.associatedData.isInPinnedListMode, isPinned: arguments.isPinned && !arguments.associatedData.isInPinnedListMode,
hasAutoremove: arguments.message.isSelfExpiring, hasAutoremove: arguments.message.isSelfExpiring,

View File

@ -570,7 +570,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

@ -872,7 +872,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
reactions: dateAndStatus.dateReactions, reactions: dateAndStatus.dateReactions,
reactionPeers: dateAndStatus.dateReactionPeers, reactionPeers: dateAndStatus.dateReactionPeers,
displayAllReactionPeers: message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateAndStatus.dateReplies,
isPinned: dateAndStatus.isPinned, isPinned: dateAndStatus.isPinned,
hasAutoremove: message.isSelfExpiring, hasAutoremove: message.isSelfExpiring,

View File

@ -276,7 +276,7 @@ public class ChatMessageMapBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

@ -1024,7 +1024,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

@ -178,7 +178,7 @@ public final class MessageReactionButtonsNode: ASDisplayNode {
) )
}, },
colors: reactionColors, colors: reactionColors,
isTag: message.id.peerId == context.account.peerId, isTag: message.areReactionsTags(accountPeerId: context.account.peerId),
constrainedWidth: constrainedWidth constrainedWidth: constrainedWidth
) )
@ -498,7 +498,7 @@ public final class ChatMessageReactionsFooterContentNode: ChatMessageBubbleConte
} }
return (contentProperties, nil, CGFloat.greatestFiniteMagnitude, { constrainedSize, position in 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( let buttonsUpdate = buttonsNode.prepareUpdate(
context: item.context, context: item.context,
presentationData: item.presentationData, presentationData: item.presentationData,

View File

@ -132,7 +132,7 @@ public class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNod
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

@ -628,7 +628,7 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread, isPinned: item.message.tags.contains(.pinned) && !item.associatedData.isInPinnedListMode && !isReplyThread,
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,
@ -823,9 +823,9 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
let reactions: ReactionsMessageAttribute let reactions: ReactionsMessageAttribute
if shouldDisplayInlineDateReactions(message: item.message, isPremium: item.associatedData.isPremium, forceInline: item.associatedData.forceInlineReactions) { 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 { } 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))? var reactionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageReactionButtonsNode))?

View File

@ -573,7 +573,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
reactions: dateReactionsAndPeers.reactions, reactions: dateReactionsAndPeers.reactions,
reactionPeers: dateReactionsAndPeers.peers, reactionPeers: dateReactionsAndPeers.peers,
displayAllReactionPeers: item.message.id.peerId.namespace == Namespaces.Peer.CloudUser, 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, replyCount: dateReplies,
isPinned: item.message.tags.contains(.pinned) && (!item.associatedData.isInPinnedListMode || isReplyThread), isPinned: item.message.tags.contains(.pinned) && (!item.associatedData.isInPinnedListMode || isReplyThread),
hasAutoremove: item.message.isSelfExpiring, hasAutoremove: item.message.isSelfExpiring,

View File

@ -74,6 +74,34 @@ float particleEaseInValueAt(float fraction, float t) {
return localT; 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( kernel void dustEffectUpdateParticle(
device Particle *particles [[ buffer(0) ]], device Particle *particles [[ buffer(0) ]],
const device uint2 &size [[ buffer(1) ]], const device uint2 &size [[ buffer(1) ]],
@ -139,5 +167,6 @@ fragment half4 dustEffectFragment(
constexpr sampler sampler(coord::normalized, address::clamp_to_edge, filter::linear); 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)); half4 color = inTexture.sample(sampler, float2(in.uv.x, 1.0 - in.uv.y));
return color * in.alpha; return color * in.alpha;
} }

View File

@ -59,6 +59,7 @@ public final class EmojiStatusComponent: Component {
public let animationCache: AnimationCache public let animationCache: AnimationCache
public let animationRenderer: MultiAnimationRenderer public let animationRenderer: MultiAnimationRenderer
public let content: Content public let content: Content
public let size: CGSize?
public let isVisibleForAnimations: Bool public let isVisibleForAnimations: Bool
public let useSharedAnimation: Bool public let useSharedAnimation: Bool
public let action: (() -> Void)? public let action: (() -> Void)?
@ -69,6 +70,7 @@ public final class EmojiStatusComponent: Component {
animationCache: AnimationCache, animationCache: AnimationCache,
animationRenderer: MultiAnimationRenderer, animationRenderer: MultiAnimationRenderer,
content: Content, content: Content,
size: CGSize? = nil,
isVisibleForAnimations: Bool, isVisibleForAnimations: Bool,
useSharedAnimation: Bool = false, useSharedAnimation: Bool = false,
action: (() -> Void)?, action: (() -> Void)?,
@ -83,6 +85,7 @@ public final class EmojiStatusComponent: Component {
animationCache: animationCache, animationCache: animationCache,
animationRenderer: animationRenderer, animationRenderer: animationRenderer,
content: content, content: content,
size: size,
isVisibleForAnimations: isVisibleForAnimations, isVisibleForAnimations: isVisibleForAnimations,
useSharedAnimation: useSharedAnimation, useSharedAnimation: useSharedAnimation,
action: action, action: action,
@ -97,6 +100,7 @@ public final class EmojiStatusComponent: Component {
animationCache: AnimationCache, animationCache: AnimationCache,
animationRenderer: MultiAnimationRenderer, animationRenderer: MultiAnimationRenderer,
content: Content, content: Content,
size: CGSize? = nil,
isVisibleForAnimations: Bool, isVisibleForAnimations: Bool,
useSharedAnimation: Bool = false, useSharedAnimation: Bool = false,
action: (() -> Void)?, action: (() -> Void)?,
@ -108,6 +112,7 @@ public final class EmojiStatusComponent: Component {
self.animationCache = animationCache self.animationCache = animationCache
self.animationRenderer = animationRenderer self.animationRenderer = animationRenderer
self.content = content self.content = content
self.size = size
self.isVisibleForAnimations = isVisibleForAnimations self.isVisibleForAnimations = isVisibleForAnimations
self.useSharedAnimation = useSharedAnimation self.useSharedAnimation = useSharedAnimation
self.action = action self.action = action
@ -122,6 +127,7 @@ public final class EmojiStatusComponent: Component {
animationCache: self.animationCache, animationCache: self.animationCache,
animationRenderer: self.animationRenderer, animationRenderer: self.animationRenderer,
content: self.content, content: self.content,
size: self.size,
isVisibleForAnimations: isVisibleForAnimations, isVisibleForAnimations: isVisibleForAnimations,
useSharedAnimation: self.useSharedAnimation, useSharedAnimation: self.useSharedAnimation,
action: self.action, action: self.action,
@ -145,6 +151,9 @@ public final class EmojiStatusComponent: Component {
if lhs.content != rhs.content { if lhs.content != rhs.content {
return false return false
} }
if lhs.size != rhs.size {
return false
}
if lhs.isVisibleForAnimations != rhs.isVisibleForAnimations { if lhs.isVisibleForAnimations != rhs.isVisibleForAnimations {
return false 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 { func update(component: EmojiStatusComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize {
let availableSize = component.size ?? availableSize
self.state = state self.state = state
var iconImage: UIImage? 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)) recentPeers.append(ReactionsMessageAttribute.RecentPeer(value: reaction, isLarge: false, isUnseen: false, isMy: true, peerId: accountPeer.id, timestamp: nil))
peers[accountPeer.id] = accountPeer 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) 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 { if canAddMessageReactions(message: topMessage), let allowedReactions = allowedReactions, !topReactions.isEmpty {
actions.reactionItems = topReactions.map(ReactionContextItem.reaction) 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 //TODO:localize
actions.reactionsTitle = "Tag the message with an emoji for quick access later" 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 { switch search.domain {
case .everything: 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: case .members:
derivedSearchState = nil derivedSearchState = nil
case let .member(peer): 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)) 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): 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: 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 { if previousSearchState?.query != searchState.query || previousSearchState?.location != searchState.location {
var queryIsEmpty = false var queryIsEmpty = false
if searchState.query.isEmpty { if searchState.query.isEmpty {
if case let .peer(_, fromId, _, _, _, _) = searchState.location { if case let .peer(_, fromId, _, reactions, _, _, _) = searchState.location {
if fromId == nil { if fromId == nil {
queryIsEmpty = true queryIsEmpty = true
} }
if let reactions, !reactions.isEmpty {
queryIsEmpty = false
}
} else { } else {
queryIsEmpty = true queryIsEmpty = true
} }
@ -19179,6 +19182,10 @@ enum AllowedReactions {
} }
func peerMessageAllowedReactions(context: AccountContext, message: Message) -> Signal<AllowedReactions?, NoError> { func peerMessageAllowedReactions(context: AccountContext, message: Message) -> Signal<AllowedReactions?, NoError> {
if message.id.peerId == context.account.peerId {
return .single(.all)
}
if message.containsSecretMedia { if message.containsSecretMedia {
return .single(AllowedReactions.set(Set())) 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) self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
case let .tag(tag): case let .tag(tag, file):
//TODO:localize //TODO:localize
let placeholderText = "Search" let placeholderText = "Search"
self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputPlaceholderTextColor) self.searchBar.placeholderString = NSAttributedString(string: placeholderText, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputPlaceholderTextColor)
//TODO:localize //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: case .members:
self.searchBar.tokens = [] self.searchBar.tokens = []
self.searchBar.prefixString = NSAttributedString(string: strings.Conversation_SearchByName_Prefix, font: searchBarFont, textColor: theme.rootController.navigationSearchBar.inputTextColor) 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.searchResult = searchResult
self.searchState = searchState 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 self.mappedLocation = .savedMessagesChats
} else { } else {
self.mappedLocation = .chatList(groupId: .root) self.mappedLocation = .chatList(groupId: .root)

View File

@ -9,24 +9,61 @@ import ComponentFlow
import MultilineTextComponent import MultilineTextComponent
import PlainButtonComponent import PlainButtonComponent
import UIKitRuntimeUtils import UIKitRuntimeUtils
import TelegramCore
import EmojiStatusComponent
import SwiftSignalKit
final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UIScrollViewDelegate { final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UIScrollViewDelegate {
private final class Item { private struct Params: Equatable {
let tag: String var width: CGFloat
var leftInset: CGFloat
var rightInset: CGFloat
var interfaceState: ChatPresentationInterfaceState
init(tag: String) { init(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, interfaceState: ChatPresentationInterfaceState) {
self.tag = tag 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 final class ItemView: UIView {
private let context: AccountContext private let context: AccountContext
private let item: Item private let item: Item
private let action: (String) -> Void private let action: () -> Void
private let view = ComponentView<Empty>() 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.context = context
self.item = item self.item = item
self.action = action self.action = action
@ -42,23 +79,41 @@ final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UISc
let viewSize = self.view.update( let viewSize = self.view.update(
transition: transition, transition: transition,
component: AnyComponent(PlainButtonComponent( component: AnyComponent(PlainButtonComponent(
content: AnyComponent(MultilineTextComponent( content: AnyComponent(HStack([
text: .plain(NSAttributedString(string: self.item.tag, font: Font.regular(15.0), textColor: theme.rootController.navigationBar.primaryTextColor)), AnyComponentWithIdentity(id: 0, component: AnyComponent(EmojiStatusComponent(
insets: UIEdgeInsets(top: 2.0, left: 2.0, bottom: 2.0, right: 2.0) 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, effectAlignment: .center,
minSize: CGSize(width: 0.0, height: height), 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 action: { [weak self] in
guard let self else { guard let self else {
return return
} }
self.action(self.item.tag) self.action()
}, },
isEnabled: true isEnabled: true
)), )),
environment: {}, environment: {},
containerSize: CGSize(width: 100.0, height: 100.0) containerSize: CGSize(width: 100.0, height: 32.0)
) )
if let componentView = self.view.view { if let componentView = self.view.view {
if componentView.superview == nil { if componentView.superview == nil {
@ -81,30 +136,21 @@ final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UISc
} }
private let context: AccountContext private let context: AccountContext
private var theme: PresentationTheme?
private var strings: PresentationStrings?
private let scrollView: ScrollView 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) { init(context: AccountContext) {
self.context = context self.context = context
self.scrollView = ScrollView(frame: CGRect()) 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() super.init()
self.scrollView.delaysContentTouches = false self.scrollView.delaysContentTouches = false
@ -125,58 +171,105 @@ final class ChatSearchTitleAccessoryPanelNode: ChatTitleAccessoryPanelNode, UISc
self.scrollView.disablesInteractiveTransitionGestureRecognizer = true self.scrollView.disablesInteractiveTransitionGestureRecognizer = true
for itemView in self.itemViews { self.itemsDisposable = (context.engine.stickers.savedMessageTags()
self.scrollView.addSubview(itemView) |> deliverOnMainQueue).start(next: { [weak self] tags, files in
} guard let self else {
itemAction = { [weak self] tag in
guard let self, let interfaceInteraction = self.interfaceInteraction else {
return 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 { override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) -> LayoutResult {
if interfaceState.strings !== self.strings { let params = Params(width: width, leftInset: leftInset, rightInset: rightInset, interfaceState: interfaceState)
self.strings = interfaceState.strings if self.params != params {
} self.params = params
self.update(params: params, transition: transition)
if interfaceState.theme !== self.theme {
self.theme = interfaceState.theme
} }
let panelHeight: CGFloat = 33.0 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 let itemSpacing: CGFloat = 2.0
var contentSize = CGSize(width: 0.0, height: panelHeight) var contentSize = CGSize(width: 0.0, height: panelHeight)
contentSize.width += containerInsets.left contentSize.width += containerInsets.left
var validIds: [MessageReaction.Reaction] = []
var isFirst = true var isFirst = true
for itemView in self.itemViews { for item in self.items {
if isFirst { if isFirst {
isFirst = false isFirst = false
} else { } else {
contentSize.width += itemSpacing 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) itemView.frame = CGRect(origin: CGPoint(x: contentSize.width, y: 0.0), size: itemSize)
contentSize.width += itemSize.width 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 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 { if self.scrollView.bounds.size != scrollSize {
self.scrollView.frame = CGRect(origin: CGPoint(x: 0.0, y: -5.0), size: scrollSize) self.scrollView.frame = CGRect(origin: CGPoint(x: 0.0, y: -5.0), size: scrollSize)
} }
if self.scrollView.contentSize != contentSize { if self.scrollView.contentSize != contentSize {
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 import ReactionSelectionNode
func topMessageReactions(context: AccountContext, message: Message) -> Signal<[ReactionItem], NoError> { 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 viewKey: PostboxViewKey = .orderedItemList(id: Namespaces.OrderedItemList.CloudTopReactions)
let topReactions = context.account.postbox.combinedView(keys: [viewKey]) let topReactions = context.account.postbox.combinedView(keys: [viewKey])
|> map { views -> [RecentReactionItem] in |> map { views -> [RecentReactionItem] in
@ -51,7 +136,6 @@ func topMessageReactions(context: AccountContext, message: Message) -> Signal<[R
} }
var result: [ReactionItem] = [] var result: [ReactionItem] = []
var existingIds = Set<MessageReaction.Reaction>() var existingIds = Set<MessageReaction.Reaction>()
for topReaction in topReactions { for topReaction in topReactions {

View File

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