mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Refactor constructor use sites for types 360-379 to struct pattern
Migrated 20 types including userProfilePhoto, userStatus*, username, videoSize*, wallPaper*, webDocument*, webPage*, webViewResultUrl, authorizations, authorizationForm, autoDownloadSettings, businessChatLinks, chatThemes, connectedBots, and contentSettings. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
9b71eb0f8f
commit
55c53717af
23 changed files with 549 additions and 95 deletions
|
|
@ -456,7 +456,19 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum UserProfilePhoto: TypeConstructorDescription {
|
||||
case userProfilePhoto(flags: Int32, photoId: Int64, strippedThumb: Buffer?, dcId: Int32)
|
||||
public class Cons_userProfilePhoto {
|
||||
public var flags: Int32
|
||||
public var photoId: Int64
|
||||
public var strippedThumb: Buffer?
|
||||
public var dcId: Int32
|
||||
public init(flags: Int32, photoId: Int64, strippedThumb: Buffer?, dcId: Int32) {
|
||||
self.flags = flags
|
||||
self.photoId = photoId
|
||||
self.strippedThumb = strippedThumb
|
||||
self.dcId = dcId
|
||||
}
|
||||
}
|
||||
case userProfilePhoto(Cons_userProfilePhoto)
|
||||
case userProfilePhotoEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -493,12 +505,42 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum UserStatus: TypeConstructorDescription {
|
||||
public class Cons_userStatusLastMonth {
|
||||
public var flags: Int32
|
||||
public init(flags: Int32) {
|
||||
self.flags = flags
|
||||
}
|
||||
}
|
||||
public class Cons_userStatusLastWeek {
|
||||
public var flags: Int32
|
||||
public init(flags: Int32) {
|
||||
self.flags = flags
|
||||
}
|
||||
}
|
||||
public class Cons_userStatusOffline {
|
||||
public var wasOnline: Int32
|
||||
public init(wasOnline: Int32) {
|
||||
self.wasOnline = wasOnline
|
||||
}
|
||||
}
|
||||
public class Cons_userStatusOnline {
|
||||
public var expires: Int32
|
||||
public init(expires: Int32) {
|
||||
self.expires = expires
|
||||
}
|
||||
}
|
||||
public class Cons_userStatusRecently {
|
||||
public var flags: Int32
|
||||
public init(flags: Int32) {
|
||||
self.flags = flags
|
||||
}
|
||||
}
|
||||
case userStatusEmpty
|
||||
case userStatusLastMonth(flags: Int32)
|
||||
case userStatusLastWeek(flags: Int32)
|
||||
case userStatusOffline(wasOnline: Int32)
|
||||
case userStatusOnline(expires: Int32)
|
||||
case userStatusRecently(flags: Int32)
|
||||
case userStatusLastMonth(Cons_userStatusLastMonth)
|
||||
case userStatusLastWeek(Cons_userStatusLastWeek)
|
||||
case userStatusOffline(Cons_userStatusOffline)
|
||||
case userStatusOnline(Cons_userStatusOnline)
|
||||
case userStatusRecently(Cons_userStatusRecently)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -562,7 +604,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum Username: TypeConstructorDescription {
|
||||
case username(flags: Int32, username: String)
|
||||
public class Cons_username {
|
||||
public var flags: Int32
|
||||
public var username: String
|
||||
public init(flags: Int32, username: String) {
|
||||
self.flags = flags
|
||||
self.username = username
|
||||
}
|
||||
}
|
||||
case username(Cons_username)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -591,9 +641,43 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum VideoSize: TypeConstructorDescription {
|
||||
case videoSize(flags: Int32, type: String, w: Int32, h: Int32, size: Int32, videoStartTs: Double?)
|
||||
case videoSizeEmojiMarkup(emojiId: Int64, backgroundColors: [Int32])
|
||||
case videoSizeStickerMarkup(stickerset: Api.InputStickerSet, stickerId: Int64, backgroundColors: [Int32])
|
||||
public class Cons_videoSize {
|
||||
public var flags: Int32
|
||||
public var type: String
|
||||
public var w: Int32
|
||||
public var h: Int32
|
||||
public var size: Int32
|
||||
public var videoStartTs: Double?
|
||||
public init(flags: Int32, type: String, w: Int32, h: Int32, size: Int32, videoStartTs: Double?) {
|
||||
self.flags = flags
|
||||
self.type = type
|
||||
self.w = w
|
||||
self.h = h
|
||||
self.size = size
|
||||
self.videoStartTs = videoStartTs
|
||||
}
|
||||
}
|
||||
public class Cons_videoSizeEmojiMarkup {
|
||||
public var emojiId: Int64
|
||||
public var backgroundColors: [Int32]
|
||||
public init(emojiId: Int64, backgroundColors: [Int32]) {
|
||||
self.emojiId = emojiId
|
||||
self.backgroundColors = backgroundColors
|
||||
}
|
||||
}
|
||||
public class Cons_videoSizeStickerMarkup {
|
||||
public var stickerset: Api.InputStickerSet
|
||||
public var stickerId: Int64
|
||||
public var backgroundColors: [Int32]
|
||||
public init(stickerset: Api.InputStickerSet, stickerId: Int64, backgroundColors: [Int32]) {
|
||||
self.stickerset = stickerset
|
||||
self.stickerId = stickerId
|
||||
self.backgroundColors = backgroundColors
|
||||
}
|
||||
}
|
||||
case videoSize(Cons_videoSize)
|
||||
case videoSizeEmojiMarkup(Cons_videoSizeEmojiMarkup)
|
||||
case videoSizeStickerMarkup(Cons_videoSizeStickerMarkup)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -636,8 +720,34 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum WallPaper: TypeConstructorDescription {
|
||||
case wallPaper(id: Int64, flags: Int32, accessHash: Int64, slug: String, document: Api.Document, settings: Api.WallPaperSettings?)
|
||||
case wallPaperNoFile(id: Int64, flags: Int32, settings: Api.WallPaperSettings?)
|
||||
public class Cons_wallPaper {
|
||||
public var id: Int64
|
||||
public var flags: Int32
|
||||
public var accessHash: Int64
|
||||
public var slug: String
|
||||
public var document: Api.Document
|
||||
public var settings: Api.WallPaperSettings?
|
||||
public init(id: Int64, flags: Int32, accessHash: Int64, slug: String, document: Api.Document, settings: Api.WallPaperSettings?) {
|
||||
self.id = id
|
||||
self.flags = flags
|
||||
self.accessHash = accessHash
|
||||
self.slug = slug
|
||||
self.document = document
|
||||
self.settings = settings
|
||||
}
|
||||
}
|
||||
public class Cons_wallPaperNoFile {
|
||||
public var id: Int64
|
||||
public var flags: Int32
|
||||
public var settings: Api.WallPaperSettings?
|
||||
public init(id: Int64, flags: Int32, settings: Api.WallPaperSettings?) {
|
||||
self.id = id
|
||||
self.flags = flags
|
||||
self.settings = settings
|
||||
}
|
||||
}
|
||||
case wallPaper(Cons_wallPaper)
|
||||
case wallPaperNoFile(Cons_wallPaperNoFile)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -673,7 +783,27 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum WallPaperSettings: TypeConstructorDescription {
|
||||
case wallPaperSettings(flags: Int32, backgroundColor: Int32?, secondBackgroundColor: Int32?, thirdBackgroundColor: Int32?, fourthBackgroundColor: Int32?, intensity: Int32?, rotation: Int32?, emoticon: String?)
|
||||
public class Cons_wallPaperSettings {
|
||||
public var flags: Int32
|
||||
public var backgroundColor: Int32?
|
||||
public var secondBackgroundColor: Int32?
|
||||
public var thirdBackgroundColor: Int32?
|
||||
public var fourthBackgroundColor: Int32?
|
||||
public var intensity: Int32?
|
||||
public var rotation: Int32?
|
||||
public var emoticon: String?
|
||||
public init(flags: Int32, backgroundColor: Int32?, secondBackgroundColor: Int32?, thirdBackgroundColor: Int32?, fourthBackgroundColor: Int32?, intensity: Int32?, rotation: Int32?, emoticon: String?) {
|
||||
self.flags = flags
|
||||
self.backgroundColor = backgroundColor
|
||||
self.secondBackgroundColor = secondBackgroundColor
|
||||
self.thirdBackgroundColor = thirdBackgroundColor
|
||||
self.fourthBackgroundColor = fourthBackgroundColor
|
||||
self.intensity = intensity
|
||||
self.rotation = rotation
|
||||
self.emoticon = emoticon
|
||||
}
|
||||
}
|
||||
case wallPaperSettings(Cons_wallPaperSettings)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -702,7 +832,29 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum WebAuthorization: TypeConstructorDescription {
|
||||
case webAuthorization(hash: Int64, botId: Int64, domain: String, browser: String, platform: String, dateCreated: Int32, dateActive: Int32, ip: String, region: String)
|
||||
public class Cons_webAuthorization {
|
||||
public var hash: Int64
|
||||
public var botId: Int64
|
||||
public var domain: String
|
||||
public var browser: String
|
||||
public var platform: String
|
||||
public var dateCreated: Int32
|
||||
public var dateActive: Int32
|
||||
public var ip: String
|
||||
public var region: String
|
||||
public init(hash: Int64, botId: Int64, domain: String, browser: String, platform: String, dateCreated: Int32, dateActive: Int32, ip: String, region: String) {
|
||||
self.hash = hash
|
||||
self.botId = botId
|
||||
self.domain = domain
|
||||
self.browser = browser
|
||||
self.platform = platform
|
||||
self.dateCreated = dateCreated
|
||||
self.dateActive = dateActive
|
||||
self.ip = ip
|
||||
self.region = region
|
||||
}
|
||||
}
|
||||
case webAuthorization(Cons_webAuthorization)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -731,8 +883,34 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum WebDocument: TypeConstructorDescription {
|
||||
case webDocument(url: String, accessHash: Int64, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
|
||||
case webDocumentNoProxy(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
|
||||
public class Cons_webDocument {
|
||||
public var url: String
|
||||
public var accessHash: Int64
|
||||
public var size: Int32
|
||||
public var mimeType: String
|
||||
public var attributes: [Api.DocumentAttribute]
|
||||
public init(url: String, accessHash: Int64, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute]) {
|
||||
self.url = url
|
||||
self.accessHash = accessHash
|
||||
self.size = size
|
||||
self.mimeType = mimeType
|
||||
self.attributes = attributes
|
||||
}
|
||||
}
|
||||
public class Cons_webDocumentNoProxy {
|
||||
public var url: String
|
||||
public var size: Int32
|
||||
public var mimeType: String
|
||||
public var attributes: [Api.DocumentAttribute]
|
||||
public init(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute]) {
|
||||
self.url = url
|
||||
self.size = size
|
||||
self.mimeType = mimeType
|
||||
self.attributes = attributes
|
||||
}
|
||||
}
|
||||
case webDocument(Cons_webDocument)
|
||||
case webDocumentNoProxy(Cons_webDocumentNoProxy)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -768,10 +946,82 @@ 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 class Cons_webPage {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var url: String
|
||||
public var displayUrl: String
|
||||
public var hash: Int32
|
||||
public var type: String?
|
||||
public var siteName: String?
|
||||
public var title: String?
|
||||
public var description: String?
|
||||
public var photo: Api.Photo?
|
||||
public var embedUrl: String?
|
||||
public var embedType: String?
|
||||
public var embedWidth: Int32?
|
||||
public var embedHeight: Int32?
|
||||
public var duration: Int32?
|
||||
public var author: String?
|
||||
public var document: Api.Document?
|
||||
public var cachedPage: Api.Page?
|
||||
public var attributes: [Api.WebPageAttribute]?
|
||||
public init(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]?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.url = url
|
||||
self.displayUrl = displayUrl
|
||||
self.hash = hash
|
||||
self.type = type
|
||||
self.siteName = siteName
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.photo = photo
|
||||
self.embedUrl = embedUrl
|
||||
self.embedType = embedType
|
||||
self.embedWidth = embedWidth
|
||||
self.embedHeight = embedHeight
|
||||
self.duration = duration
|
||||
self.author = author
|
||||
self.document = document
|
||||
self.cachedPage = cachedPage
|
||||
self.attributes = attributes
|
||||
}
|
||||
}
|
||||
public class Cons_webPageEmpty {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var url: String?
|
||||
public init(flags: Int32, id: Int64, url: String?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
public class Cons_webPageNotModified {
|
||||
public var flags: Int32
|
||||
public var cachedPageViews: Int32?
|
||||
public init(flags: Int32, cachedPageViews: Int32?) {
|
||||
self.flags = flags
|
||||
self.cachedPageViews = cachedPageViews
|
||||
}
|
||||
}
|
||||
public class Cons_webPagePending {
|
||||
public var flags: Int32
|
||||
public var id: Int64
|
||||
public var url: String?
|
||||
public var date: Int32
|
||||
public init(flags: Int32, id: Int64, url: String?, date: Int32) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.url = url
|
||||
self.date = date
|
||||
}
|
||||
}
|
||||
case webPage(Cons_webPage)
|
||||
case webPageEmpty(Cons_webPageEmpty)
|
||||
case webPageNotModified(Cons_webPageNotModified)
|
||||
case webPagePending(Cons_webPagePending)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -1,11 +1,61 @@
|
|||
public extension Api {
|
||||
indirect enum WebPageAttribute: TypeConstructorDescription {
|
||||
case webPageAttributeStarGiftAuction(gift: Api.StarGift, endDate: Int32)
|
||||
case webPageAttributeStarGiftCollection(icons: [Api.Document])
|
||||
case webPageAttributeStickerSet(flags: Int32, stickers: [Api.Document])
|
||||
case webPageAttributeStory(flags: Int32, peer: Api.Peer, id: Int32, story: Api.StoryItem?)
|
||||
case webPageAttributeTheme(flags: Int32, documents: [Api.Document]?, settings: Api.ThemeSettings?)
|
||||
case webPageAttributeUniqueStarGift(gift: Api.StarGift)
|
||||
public class Cons_webPageAttributeStarGiftAuction {
|
||||
public var gift: Api.StarGift
|
||||
public var endDate: Int32
|
||||
public init(gift: Api.StarGift, endDate: Int32) {
|
||||
self.gift = gift
|
||||
self.endDate = endDate
|
||||
}
|
||||
}
|
||||
public class Cons_webPageAttributeStarGiftCollection {
|
||||
public var icons: [Api.Document]
|
||||
public init(icons: [Api.Document]) {
|
||||
self.icons = icons
|
||||
}
|
||||
}
|
||||
public class Cons_webPageAttributeStickerSet {
|
||||
public var flags: Int32
|
||||
public var stickers: [Api.Document]
|
||||
public init(flags: Int32, stickers: [Api.Document]) {
|
||||
self.flags = flags
|
||||
self.stickers = stickers
|
||||
}
|
||||
}
|
||||
public class Cons_webPageAttributeStory {
|
||||
public var flags: Int32
|
||||
public var peer: Api.Peer
|
||||
public var id: Int32
|
||||
public var story: Api.StoryItem?
|
||||
public init(flags: Int32, peer: Api.Peer, id: Int32, story: Api.StoryItem?) {
|
||||
self.flags = flags
|
||||
self.peer = peer
|
||||
self.id = id
|
||||
self.story = story
|
||||
}
|
||||
}
|
||||
public class Cons_webPageAttributeTheme {
|
||||
public var flags: Int32
|
||||
public var documents: [Api.Document]?
|
||||
public var settings: Api.ThemeSettings?
|
||||
public init(flags: Int32, documents: [Api.Document]?, settings: Api.ThemeSettings?) {
|
||||
self.flags = flags
|
||||
self.documents = documents
|
||||
self.settings = settings
|
||||
}
|
||||
}
|
||||
public class Cons_webPageAttributeUniqueStarGift {
|
||||
public var gift: Api.StarGift
|
||||
public init(gift: Api.StarGift) {
|
||||
self.gift = gift
|
||||
}
|
||||
}
|
||||
case webPageAttributeStarGiftAuction(Cons_webPageAttributeStarGiftAuction)
|
||||
case webPageAttributeStarGiftCollection(Cons_webPageAttributeStarGiftCollection)
|
||||
case webPageAttributeStickerSet(Cons_webPageAttributeStickerSet)
|
||||
case webPageAttributeStory(Cons_webPageAttributeStory)
|
||||
case webPageAttributeTheme(Cons_webPageAttributeTheme)
|
||||
case webPageAttributeUniqueStarGift(Cons_webPageAttributeUniqueStarGift)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -69,7 +119,15 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum WebViewMessageSent: TypeConstructorDescription {
|
||||
case webViewMessageSent(flags: Int32, msgId: Api.InputBotInlineMessageID?)
|
||||
public class Cons_webViewMessageSent {
|
||||
public var flags: Int32
|
||||
public var msgId: Api.InputBotInlineMessageID?
|
||||
public init(flags: Int32, msgId: Api.InputBotInlineMessageID?) {
|
||||
self.flags = flags
|
||||
self.msgId = msgId
|
||||
}
|
||||
}
|
||||
case webViewMessageSent(Cons_webViewMessageSent)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -98,7 +156,17 @@ public extension Api {
|
|||
}
|
||||
public extension Api {
|
||||
enum WebViewResult: TypeConstructorDescription {
|
||||
case webViewResultUrl(flags: Int32, queryId: Int64?, url: String)
|
||||
public class Cons_webViewResultUrl {
|
||||
public var flags: Int32
|
||||
public var queryId: Int64?
|
||||
public var url: String
|
||||
public init(flags: Int32, queryId: Int64?, url: String) {
|
||||
self.flags = flags
|
||||
self.queryId = queryId
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
case webViewResultUrl(Cons_webViewResultUrl)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -127,7 +195,23 @@ public extension Api {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum AuthorizationForm: TypeConstructorDescription {
|
||||
case authorizationForm(flags: Int32, requiredTypes: [Api.SecureRequiredType], values: [Api.SecureValue], errors: [Api.SecureValueError], users: [Api.User], privacyPolicyUrl: String?)
|
||||
public class Cons_authorizationForm {
|
||||
public var flags: Int32
|
||||
public var requiredTypes: [Api.SecureRequiredType]
|
||||
public var values: [Api.SecureValue]
|
||||
public var errors: [Api.SecureValueError]
|
||||
public var users: [Api.User]
|
||||
public var privacyPolicyUrl: String?
|
||||
public init(flags: Int32, requiredTypes: [Api.SecureRequiredType], values: [Api.SecureValue], errors: [Api.SecureValueError], users: [Api.User], privacyPolicyUrl: String?) {
|
||||
self.flags = flags
|
||||
self.requiredTypes = requiredTypes
|
||||
self.values = values
|
||||
self.errors = errors
|
||||
self.users = users
|
||||
self.privacyPolicyUrl = privacyPolicyUrl
|
||||
}
|
||||
}
|
||||
case authorizationForm(Cons_authorizationForm)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -156,7 +240,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum Authorizations: TypeConstructorDescription {
|
||||
case authorizations(authorizationTtlDays: Int32, authorizations: [Api.Authorization])
|
||||
public class Cons_authorizations {
|
||||
public var authorizationTtlDays: Int32
|
||||
public var authorizations: [Api.Authorization]
|
||||
public init(authorizationTtlDays: Int32, authorizations: [Api.Authorization]) {
|
||||
self.authorizationTtlDays = authorizationTtlDays
|
||||
self.authorizations = authorizations
|
||||
}
|
||||
}
|
||||
case authorizations(Cons_authorizations)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -185,7 +277,17 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum AutoDownloadSettings: TypeConstructorDescription {
|
||||
case autoDownloadSettings(low: Api.AutoDownloadSettings, medium: Api.AutoDownloadSettings, high: Api.AutoDownloadSettings)
|
||||
public class Cons_autoDownloadSettings {
|
||||
public var low: Api.AutoDownloadSettings
|
||||
public var medium: Api.AutoDownloadSettings
|
||||
public var high: Api.AutoDownloadSettings
|
||||
public init(low: Api.AutoDownloadSettings, medium: Api.AutoDownloadSettings, high: Api.AutoDownloadSettings) {
|
||||
self.low = low
|
||||
self.medium = medium
|
||||
self.high = high
|
||||
}
|
||||
}
|
||||
case autoDownloadSettings(Cons_autoDownloadSettings)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -214,7 +316,23 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum AutoSaveSettings: TypeConstructorDescription {
|
||||
case autoSaveSettings(usersSettings: Api.AutoSaveSettings, chatsSettings: Api.AutoSaveSettings, broadcastsSettings: Api.AutoSaveSettings, exceptions: [Api.AutoSaveException], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_autoSaveSettings {
|
||||
public var usersSettings: Api.AutoSaveSettings
|
||||
public var chatsSettings: Api.AutoSaveSettings
|
||||
public var broadcastsSettings: Api.AutoSaveSettings
|
||||
public var exceptions: [Api.AutoSaveException]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(usersSettings: Api.AutoSaveSettings, chatsSettings: Api.AutoSaveSettings, broadcastsSettings: Api.AutoSaveSettings, exceptions: [Api.AutoSaveException], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.usersSettings = usersSettings
|
||||
self.chatsSettings = chatsSettings
|
||||
self.broadcastsSettings = broadcastsSettings
|
||||
self.exceptions = exceptions
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case autoSaveSettings(Cons_autoSaveSettings)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -243,7 +361,17 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum BusinessChatLinks: TypeConstructorDescription {
|
||||
case businessChatLinks(links: [Api.BusinessChatLink], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_businessChatLinks {
|
||||
public var links: [Api.BusinessChatLink]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(links: [Api.BusinessChatLink], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.links = links
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case businessChatLinks(Cons_businessChatLinks)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -272,7 +400,23 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum ChatThemes: TypeConstructorDescription {
|
||||
case chatThemes(flags: Int32, hash: Int64, themes: [Api.ChatTheme], chats: [Api.Chat], users: [Api.User], nextOffset: String?)
|
||||
public class Cons_chatThemes {
|
||||
public var flags: Int32
|
||||
public var hash: Int64
|
||||
public var themes: [Api.ChatTheme]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public var nextOffset: String?
|
||||
public init(flags: Int32, hash: Int64, themes: [Api.ChatTheme], chats: [Api.Chat], users: [Api.User], nextOffset: String?) {
|
||||
self.flags = flags
|
||||
self.hash = hash
|
||||
self.themes = themes
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
self.nextOffset = nextOffset
|
||||
}
|
||||
}
|
||||
case chatThemes(Cons_chatThemes)
|
||||
case chatThemesNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -309,7 +453,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum ConnectedBots: TypeConstructorDescription {
|
||||
case connectedBots(connectedBots: [Api.ConnectedBot], users: [Api.User])
|
||||
public class Cons_connectedBots {
|
||||
public var connectedBots: [Api.ConnectedBot]
|
||||
public var users: [Api.User]
|
||||
public init(connectedBots: [Api.ConnectedBot], users: [Api.User]) {
|
||||
self.connectedBots = connectedBots
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case connectedBots(Cons_connectedBots)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -338,7 +490,13 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum ContentSettings: TypeConstructorDescription {
|
||||
case contentSettings(flags: Int32)
|
||||
public class Cons_contentSettings {
|
||||
public var flags: Int32
|
||||
public init(flags: Int32) {
|
||||
self.flags = flags
|
||||
}
|
||||
}
|
||||
case contentSettings(Cons_contentSettings)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -219,7 +219,8 @@ func telegramMediaFileFromApiDocument(_ document: Api.Document, altDocuments: [A
|
|||
if let videoThumbs = videoThumbs {
|
||||
for thumb in videoThumbs {
|
||||
switch thumb {
|
||||
case let .videoSize(_, type, w, h, _, _):
|
||||
case let .videoSize(videoSizeData):
|
||||
let (_, type, w, h, _, _) = (videoSizeData.flags, videoSizeData.type, videoSizeData.w, videoSizeData.h, videoSizeData.size, videoSizeData.videoStartTs)
|
||||
let resource: TelegramMediaResource
|
||||
resource = CloudDocumentSizeMediaResource(datacenterId: dcId, documentId: id, accessHash: accessHash, sizeSpec: type, fileReference: fileReference.makeData())
|
||||
|
||||
|
|
|
|||
|
|
@ -50,14 +50,17 @@ func telegramMediaImageFromApiPhoto(_ photo: Api.Photo) -> TelegramMediaImage? {
|
|||
if let videoSizes = videoSizes {
|
||||
for size in videoSizes {
|
||||
switch size {
|
||||
case let .videoSize(_, type, w, h, size, videoStartTs):
|
||||
case let .videoSize(videoSizeData):
|
||||
let (_, type, w, h, size, videoStartTs) = (videoSizeData.flags, videoSizeData.type, videoSizeData.w, videoSizeData.h, videoSizeData.size, videoSizeData.videoStartTs)
|
||||
let resource: TelegramMediaResource
|
||||
resource = CloudPhotoSizeMediaResource(datacenterId: dcId, photoId: id, accessHash: accessHash, sizeSpec: type, size: Int64(size), fileReference: fileReference.makeData())
|
||||
|
||||
|
||||
videoRepresentations.append(TelegramMediaImage.VideoRepresentation(dimensions: PixelDimensions(width: w, height: h), resource: resource, startTimestamp: videoStartTs))
|
||||
case let .videoSizeEmojiMarkup(fileId, backgroundColors):
|
||||
case let .videoSizeEmojiMarkup(videoSizeEmojiMarkupData):
|
||||
let (fileId, backgroundColors) = (videoSizeEmojiMarkupData.emojiId, videoSizeEmojiMarkupData.backgroundColors)
|
||||
emojiMarkup = TelegramMediaImage.EmojiMarkup(content: .emoji(fileId: fileId), backgroundColors: backgroundColors)
|
||||
case let .videoSizeStickerMarkup(stickerSet, fileId, backgroundColors):
|
||||
case let .videoSizeStickerMarkup(videoSizeStickerMarkupData):
|
||||
let (stickerSet, fileId, backgroundColors) = (videoSizeStickerMarkupData.stickerset, videoSizeStickerMarkupData.stickerId, videoSizeStickerMarkupData.backgroundColors)
|
||||
if let packReference = StickerPackReference(apiInputSet: stickerSet) {
|
||||
emojiMarkup = TelegramMediaImage.EmojiMarkup(content: .sticker(packReference: packReference, fileId: fileId), backgroundColors: backgroundColors)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,11 @@ import TelegramApi
|
|||
extension TelegramMediaWebFile {
|
||||
convenience init(_ document: Api.WebDocument) {
|
||||
switch document {
|
||||
case let .webDocument(url, accessHash, size, mimeType, attributes):
|
||||
case let .webDocument(webDocumentData):
|
||||
let (url, accessHash, size, mimeType, attributes) = (webDocumentData.url, webDocumentData.accessHash, webDocumentData.size, webDocumentData.mimeType, webDocumentData.attributes)
|
||||
self.init(resource: WebFileReferenceMediaResource(url: url, size: Int64(size), accessHash: accessHash), mimeType: mimeType, size: size, attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
||||
case let .webDocumentNoProxy(url, size, mimeType, attributes):
|
||||
case let .webDocumentNoProxy(webDocumentNoProxyData):
|
||||
let (url, size, mimeType, attributes) = (webDocumentNoProxyData.url, webDocumentNoProxyData.size, webDocumentNoProxyData.mimeType, webDocumentNoProxyData.attributes)
|
||||
self.init(resource: HttpReferenceMediaResource(url: url, size: Int64(size)), mimeType: mimeType, size: size, attributes: telegramMediaFileAttributesFromApiAttributes(attributes))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,15 @@ import TelegramApi
|
|||
|
||||
func telegramMediaWebpageAttributeFromApiWebpageAttribute(_ attribute: Api.WebPageAttribute) -> TelegramMediaWebpageAttribute? {
|
||||
switch attribute {
|
||||
case let .webPageAttributeTheme(_, documents, settings):
|
||||
case let .webPageAttributeTheme(webPageAttributeThemeData):
|
||||
let (_, documents, settings) = (webPageAttributeThemeData.flags, webPageAttributeThemeData.documents, webPageAttributeThemeData.settings)
|
||||
var files: [TelegramMediaFile] = []
|
||||
if let documents = documents {
|
||||
files = documents.compactMap { telegramMediaFileFromApiDocument($0, altDocuments: []) }
|
||||
}
|
||||
return .theme(TelegraMediaWebpageThemeAttribute(files: files, settings: settings.flatMap { TelegramThemeSettings(apiThemeSettings: $0) }))
|
||||
case let .webPageAttributeStickerSet(apiFlags, stickers):
|
||||
case let .webPageAttributeStickerSet(webPageAttributeStickerSetData):
|
||||
let (apiFlags, stickers) = (webPageAttributeStickerSetData.flags, webPageAttributeStickerSetData.stickers)
|
||||
var flags = TelegramMediaWebpageStickerPackAttribute.Flags()
|
||||
if (apiFlags & (1 << 0)) != 0 {
|
||||
flags.insert(.isEmoji)
|
||||
|
|
@ -23,16 +25,19 @@ func telegramMediaWebpageAttributeFromApiWebpageAttribute(_ attribute: Api.WebPa
|
|||
var files: [TelegramMediaFile] = []
|
||||
files = stickers.compactMap { telegramMediaFileFromApiDocument($0, altDocuments: []) }
|
||||
return .stickerPack(TelegramMediaWebpageStickerPackAttribute(flags: flags, files: files))
|
||||
case let .webPageAttributeUniqueStarGift(gift):
|
||||
case let .webPageAttributeUniqueStarGift(webPageAttributeUniqueStarGiftData):
|
||||
let gift = webPageAttributeUniqueStarGiftData.gift
|
||||
if let starGift = StarGift(apiStarGift: gift) {
|
||||
return .starGift(TelegramMediaWebpageStarGiftAttribute(gift: starGift))
|
||||
}
|
||||
return nil
|
||||
case let .webPageAttributeStarGiftCollection(icons):
|
||||
case let .webPageAttributeStarGiftCollection(webPageAttributeStarGiftCollectionData):
|
||||
let icons = webPageAttributeStarGiftCollectionData.icons
|
||||
var files: [TelegramMediaFile] = []
|
||||
files = icons.compactMap { telegramMediaFileFromApiDocument($0, altDocuments: []) }
|
||||
return .giftCollection(TelegramMediaWebpageGiftCollectionAttribute(files: files))
|
||||
case let .webPageAttributeStarGiftAuction(apiGift, endDate):
|
||||
case let .webPageAttributeStarGiftAuction(webPageAttributeStarGiftAuctionData):
|
||||
let (apiGift, endDate) = (webPageAttributeStarGiftAuctionData.gift, webPageAttributeStarGiftAuctionData.endDate)
|
||||
guard let gift = StarGift(apiStarGift: apiGift) else {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -46,10 +51,12 @@ func telegramMediaWebpageFromApiWebpage(_ webpage: Api.WebPage) -> TelegramMedia
|
|||
switch webpage {
|
||||
case .webPageNotModified:
|
||||
return nil
|
||||
case let .webPagePending(flags, id, url, date):
|
||||
case let .webPagePending(webPagePendingData):
|
||||
let (flags, id, url, date) = (webPagePendingData.flags, webPagePendingData.id, webPagePendingData.url, webPagePendingData.date)
|
||||
let _ = flags
|
||||
return TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.CloudWebpage, id: id), content: .Pending(date, url))
|
||||
case let .webPage(flags, id, url, displayUrl, hash, type, siteName, title, description, photo, embedUrl, embedType, embedWidth, embedHeight, duration, author, document, cachedPage, attributes):
|
||||
case let .webPage(webPageData):
|
||||
let (flags, id, url, displayUrl, hash, type, siteName, title, description, photo, embedUrl, embedType, embedWidth, embedHeight, duration, author, document, cachedPage, attributes) = (webPageData.flags, webPageData.id, webPageData.url, webPageData.displayUrl, webPageData.hash, webPageData.type, webPageData.siteName, webPageData.title, webPageData.description, webPageData.photo, webPageData.embedUrl, webPageData.embedType, webPageData.embedWidth, webPageData.embedHeight, webPageData.duration, webPageData.author, webPageData.document, webPageData.cachedPage, webPageData.attributes)
|
||||
var embedSize: PixelDimensions?
|
||||
if let embedWidth = embedWidth, let embedHeight = embedHeight {
|
||||
embedSize = PixelDimensions(width: embedWidth, height: embedHeight)
|
||||
|
|
@ -71,20 +78,21 @@ func telegramMediaWebpageFromApiWebpage(_ webpage: Api.WebPage) -> TelegramMedia
|
|||
if let attributes = attributes {
|
||||
webpageAttributes = attributes.compactMap(telegramMediaWebpageAttributeFromApiWebpageAttribute)
|
||||
for attribute in attributes {
|
||||
if case let .webPageAttributeStory(_, peerId, id, _) = attribute {
|
||||
if case let .webPageAttributeStory(webPageAttributeStoryData) = attribute {
|
||||
let (_, peerId, id, _) = (webPageAttributeStoryData.flags, webPageAttributeStoryData.peer, webPageAttributeStoryData.id, webPageAttributeStoryData.story)
|
||||
story = TelegramMediaStory(storyId: StoryId(peerId: peerId.peerId, id: id), isMention: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var instantPage: InstantPage?
|
||||
if let cachedPage = cachedPage {
|
||||
instantPage = InstantPage(apiPage: cachedPage)
|
||||
}
|
||||
|
||||
|
||||
let isMediaLargeByDefault = (flags & (1 << 13)) != 0
|
||||
let imageIsVideoCover = (flags & (1 << 14)) != 0
|
||||
|
||||
|
||||
return TelegramMediaWebpage(webpageId: MediaId(namespace: Namespaces.Media.CloudWebpage, id: id), content: .Loaded(TelegramMediaWebpageLoadedContent(url: url, displayUrl: displayUrl, hash: hash, type: type, websiteName: siteName, title: title, text: description, embedUrl: embedUrl, embedType: embedType, embedSize: embedSize, duration: webpageDuration, author: author, isMediaLargeByDefault: isMediaLargeByDefault, imageIsVideoCover: imageIsVideoCover, image: image, file: file, story: story, attributes: webpageAttributes, instantPage: instantPage)))
|
||||
case .webPageEmpty:
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ import TelegramApi
|
|||
func parsedTelegramProfilePhoto(_ photo: Api.UserProfilePhoto) -> [TelegramMediaImageRepresentation] {
|
||||
var representations: [TelegramMediaImageRepresentation] = []
|
||||
switch photo {
|
||||
case let .userProfilePhoto(flags, id, strippedThumb, dcId):
|
||||
case let .userProfilePhoto(userProfilePhotoData):
|
||||
let (flags, id, strippedThumb, dcId) = (userProfilePhotoData.flags, userProfilePhotoData.photoId, userProfilePhotoData.strippedThumb, userProfilePhotoData.dcId)
|
||||
let hasVideo = (flags & (1 << 0)) != 0
|
||||
let isPersonal = (flags & (1 << 2)) != 0
|
||||
|
||||
|
|
@ -26,7 +27,8 @@ func parsedTelegramProfilePhoto(_ photo: Api.UserProfilePhoto) -> [TelegramMedia
|
|||
extension TelegramPeerUsername {
|
||||
init(apiUsername: Api.Username) {
|
||||
switch apiUsername {
|
||||
case let .username(flags, username):
|
||||
case let .username(usernameData):
|
||||
let (flags, username) = (usernameData.flags, usernameData.username)
|
||||
self.init(flags: Flags(rawValue: flags), username: username)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,22 @@ extension TelegramUserPresence {
|
|||
switch apiStatus {
|
||||
case .userStatusEmpty:
|
||||
self.init(status: .none, lastActivity: 0)
|
||||
case let .userStatusOnline(expires):
|
||||
case let .userStatusOnline(userStatusOnlineData):
|
||||
let (expires) = (userStatusOnlineData.expires)
|
||||
self.init(status: .present(until: expires), lastActivity: 0)
|
||||
case let .userStatusOffline(wasOnline):
|
||||
case let .userStatusOffline(userStatusOfflineData):
|
||||
let (wasOnline) = (userStatusOfflineData.wasOnline)
|
||||
self.init(status: .present(until: wasOnline), lastActivity: 0)
|
||||
case let .userStatusRecently(flags):
|
||||
case let .userStatusRecently(userStatusRecentlyData):
|
||||
let (flags) = (userStatusRecentlyData.flags)
|
||||
let isHidden = (flags & (1 << 0)) != 0
|
||||
self.init(status: .recently(isHidden: isHidden), lastActivity: 0)
|
||||
case let .userStatusLastWeek(flags):
|
||||
case let .userStatusLastWeek(userStatusLastWeekData):
|
||||
let (flags) = (userStatusLastWeekData.flags)
|
||||
let isHidden = (flags & (1 << 0)) != 0
|
||||
self.init(status: .lastWeek(isHidden: isHidden), lastActivity: 0)
|
||||
case let .userStatusLastMonth(flags):
|
||||
case let .userStatusLastMonth(userStatusLastMonthData):
|
||||
let (flags) = (userStatusLastMonthData.flags)
|
||||
let isHidden = (flags & (1 << 0)) != 0
|
||||
self.init(status: .lastMonth(isHidden: isHidden), lastActivity: 0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import TelegramApi
|
|||
extension WallpaperSettings {
|
||||
init(apiWallpaperSettings: Api.WallPaperSettings) {
|
||||
switch apiWallpaperSettings {
|
||||
case let .wallPaperSettings(flags, backgroundColor, secondBackgroundColor, thirdBackgroundColor, fourthBackgroundColor, intensity, rotation, emoticon):
|
||||
case let .wallPaperSettings(wallPaperSettingsData):
|
||||
let (flags, backgroundColor, secondBackgroundColor, thirdBackgroundColor, fourthBackgroundColor, intensity, rotation, emoticon) = (wallPaperSettingsData.flags, wallPaperSettingsData.backgroundColor, wallPaperSettingsData.secondBackgroundColor, wallPaperSettingsData.thirdBackgroundColor, wallPaperSettingsData.fourthBackgroundColor, wallPaperSettingsData.intensity, wallPaperSettingsData.rotation, wallPaperSettingsData.emoticon)
|
||||
var colors: [UInt32] = []
|
||||
if let backgroundColor = backgroundColor {
|
||||
colors.append(UInt32(bitPattern: backgroundColor))
|
||||
|
|
@ -60,13 +61,14 @@ func apiWallpaperSettings(_ wallpaperSettings: WallpaperSettings) -> Api.WallPap
|
|||
flags |= (1 << 6)
|
||||
fourthBackgroundColor = Int32(bitPattern: wallpaperSettings.colors[3])
|
||||
}
|
||||
return .wallPaperSettings(flags: flags, backgroundColor: backgroundColor, secondBackgroundColor: secondBackgroundColor, thirdBackgroundColor: thirdBackgroundColor, fourthBackgroundColor: fourthBackgroundColor, intensity: wallpaperSettings.intensity, rotation: wallpaperSettings.rotation ?? 0, emoticon: wallpaperSettings.emoticon)
|
||||
return .wallPaperSettings(.init(flags: flags, backgroundColor: backgroundColor, secondBackgroundColor: secondBackgroundColor, thirdBackgroundColor: thirdBackgroundColor, fourthBackgroundColor: fourthBackgroundColor, intensity: wallpaperSettings.intensity, rotation: wallpaperSettings.rotation ?? 0, emoticon: wallpaperSettings.emoticon))
|
||||
}
|
||||
|
||||
extension TelegramWallpaper {
|
||||
init(apiWallpaper: Api.WallPaper) {
|
||||
switch apiWallpaper {
|
||||
case let .wallPaper(id, flags, accessHash, slug, document, settings):
|
||||
case let .wallPaper(wallPaperData):
|
||||
let (id, flags, accessHash, slug, document, settings) = (wallPaperData.id, wallPaperData.flags, wallPaperData.accessHash, wallPaperData.slug, wallPaperData.document, wallPaperData.settings)
|
||||
if let file = telegramMediaFileFromApiDocument(document, altDocuments: []) {
|
||||
let wallpaperSettings: WallpaperSettings
|
||||
if let settings = settings {
|
||||
|
|
@ -79,8 +81,10 @@ extension TelegramWallpaper {
|
|||
//assertionFailure()
|
||||
self = .color(0xffffff)
|
||||
}
|
||||
case let .wallPaperNoFile(id, _, settings):
|
||||
if let settings = settings, case let .wallPaperSettings(_, backgroundColor, secondBackgroundColor, thirdBackgroundColor, fourthBackgroundColor, _, rotation, emoticon) = settings {
|
||||
case let .wallPaperNoFile(wallPaperNoFileData):
|
||||
let (id, _, settings) = (wallPaperNoFileData.id, wallPaperNoFileData.flags, wallPaperNoFileData.settings)
|
||||
if let settings = settings, case let .wallPaperSettings(wallPaperSettingsData) = settings {
|
||||
let (_, backgroundColor, secondBackgroundColor, thirdBackgroundColor, fourthBackgroundColor, _, rotation, emoticon) = (wallPaperSettingsData.flags, wallPaperSettingsData.backgroundColor, wallPaperSettingsData.secondBackgroundColor, wallPaperSettingsData.thirdBackgroundColor, wallPaperSettingsData.fourthBackgroundColor, wallPaperSettingsData.intensity, wallPaperSettingsData.rotation, wallPaperSettingsData.emoticon)
|
||||
if id == 0, let emoticon = emoticon {
|
||||
self = .emoticon(emoticon)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ extension AutodownloadPresetSettings {
|
|||
extension AutodownloadSettings {
|
||||
init(apiAutodownloadSettings: Api.account.AutoDownloadSettings) {
|
||||
switch apiAutodownloadSettings {
|
||||
case let .autoDownloadSettings(low, medium, high):
|
||||
case let .autoDownloadSettings(autoDownloadSettingsData):
|
||||
let (low, medium, high) = (autoDownloadSettingsData.low, autoDownloadSettingsData.medium, autoDownloadSettingsData.high)
|
||||
self.init(lowPreset: AutodownloadPresetSettings(apiAutodownloadSettings: low), mediumPreset: AutodownloadPresetSettings(apiAutodownloadSettings: medium), highPreset: AutodownloadPresetSettings(apiAutodownloadSettings: high))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ public func contentSettingsConfiguration(network: Network) -> Signal<ContentSett
|
|||
return network.request(Api.functions.account.getContentSettings())
|
||||
|> map { result -> ContentSettingsConfiguration in
|
||||
switch result {
|
||||
case let .contentSettings(flags):
|
||||
case let .contentSettings(contentSettingsData):
|
||||
let flags = contentSettingsData.flags
|
||||
return ContentSettingsConfiguration(sensitiveContentEnabled: (flags & (1 << 0)) != 0, canAdjustSensitiveContent: (flags & (1 << 1)) != 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -999,7 +999,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
|
|||
if previousState.pts >= pts {
|
||||
} else if previousState.pts + ptsCount == pts {
|
||||
switch apiWebpage {
|
||||
case let .webPageEmpty(flags, id, url):
|
||||
case let .webPageEmpty(webPageEmptyData):
|
||||
let (flags, id, url) = (webPageEmptyData.flags, webPageEmptyData.id, webPageEmptyData.url)
|
||||
let _ = flags
|
||||
let _ = url
|
||||
updatedState.updateMedia(MediaId(namespace: Namespaces.Media.CloudWebpage, id: id), media: nil)
|
||||
|
|
@ -1256,7 +1257,8 @@ private func finalStateWithUpdatesAndServerTime(accountPeerId: PeerId, postbox:
|
|||
}
|
||||
case let .updateWebPage(updateWebPageData):
|
||||
switch updateWebPageData.webpage {
|
||||
case let .webPageEmpty(flags, id, url):
|
||||
case let .webPageEmpty(webPageEmptyData):
|
||||
let (flags, id, url) = (webPageEmptyData.flags, webPageEmptyData.id, webPageEmptyData.url)
|
||||
let _ = flags
|
||||
let _ = url
|
||||
updatedState.updateMedia(MediaId(namespace: Namespaces.Media.CloudWebpage, id: id), media: nil)
|
||||
|
|
@ -3487,7 +3489,8 @@ private func pollChannel(accountPeerId: PeerId, postbox: Postbox, network: Netwo
|
|||
case let .updateChannelWebPage(updateChannelWebPageData):
|
||||
let apiWebpage = updateChannelWebPageData.webpage
|
||||
switch apiWebpage {
|
||||
case let .webPageEmpty(flags, id, url):
|
||||
case let .webPageEmpty(webPageEmptyData):
|
||||
let (flags, id, url) = (webPageEmptyData.flags, webPageEmptyData.id, webPageEmptyData.url)
|
||||
let _ = flags
|
||||
let _ = url
|
||||
updatedState.updateMedia(MediaId(namespace: Namespaces.Media.CloudWebpage, id: id), media: nil)
|
||||
|
|
@ -4803,9 +4806,11 @@ func replayFinalState(
|
|||
if peerId == accountPeerId {
|
||||
if explicit {
|
||||
switch status {
|
||||
case let .userStatusOnline(timestamp):
|
||||
case let .userStatusOnline(userStatusOnlineData):
|
||||
let timestamp = userStatusOnlineData.expires
|
||||
delayNotificatonsUntil = timestamp + 30
|
||||
case let .userStatusOffline(timestamp):
|
||||
case let .userStatusOffline(userStatusOfflineData):
|
||||
let timestamp = userStatusOfflineData.wasOnline
|
||||
delayNotificatonsUntil = timestamp
|
||||
default:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ extension Api.MessageMedia {
|
|||
let webpage = messageMediaWebPageData.webpage
|
||||
var result: [(MediaResource, Data)]?
|
||||
switch webpage {
|
||||
case let .webPage(_, _, _, _, _, _, _, _, _, photo, _, _, _, _, _, _, document, _, _):
|
||||
case let .webPage(webPageData):
|
||||
let (photo, document) = (webPageData.photo, webPageData.document)
|
||||
if let photo = photo {
|
||||
if let photoResult = collectPreCachedResources(for: photo) {
|
||||
if result == nil {
|
||||
|
|
|
|||
|
|
@ -948,7 +948,8 @@ extension TelegramBusinessChatLinks.Link {
|
|||
extension TelegramBusinessChatLinks {
|
||||
static func fromApiLinks(apiLinks: Api.account.BusinessChatLinks) -> (result: TelegramBusinessChatLinks, users: [Api.User], chats: [Api.Chat]) {
|
||||
switch apiLinks {
|
||||
case let .businessChatLinks(links, chats, users):
|
||||
case let .businessChatLinks(businessChatLinksData):
|
||||
let (links, chats, users) = (businessChatLinksData.links, businessChatLinksData.chats, businessChatLinksData.users)
|
||||
return (
|
||||
TelegramBusinessChatLinks(links: links.map(Link.init(apiLink:))),
|
||||
users,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ func _internal_requestSimpleWebView(postbox: Postbox, network: Network, botId: P
|
|||
}
|
||||
|> mapToSignal { result -> Signal<RequestWebViewResult, RequestWebViewError> in
|
||||
switch result {
|
||||
case let .webViewResultUrl(flags, queryId, url):
|
||||
case let .webViewResultUrl(webViewResultUrlData):
|
||||
let (flags, queryId, url) = (webViewResultUrlData.flags, webViewResultUrlData.queryId, webViewResultUrlData.url)
|
||||
var resultFlags: RequestWebViewResult.Flags = []
|
||||
if (flags & (1 << 1)) != 0 {
|
||||
resultFlags.insert(.fullSize)
|
||||
|
|
@ -101,7 +102,8 @@ func _internal_requestMainWebView(postbox: Postbox, network: Network, peerId: Pe
|
|||
}
|
||||
|> mapToSignal { result -> Signal<RequestWebViewResult, RequestWebViewError> in
|
||||
switch result {
|
||||
case let .webViewResultUrl(flags, queryId, url):
|
||||
case let .webViewResultUrl(webViewResultUrlData):
|
||||
let (flags, queryId, url) = (webViewResultUrlData.flags, webViewResultUrlData.queryId, webViewResultUrlData.url)
|
||||
var resultFlags: RequestWebViewResult.Flags = []
|
||||
if (flags & (1 << 1)) != 0 {
|
||||
resultFlags.insert(.fullSize)
|
||||
|
|
@ -259,7 +261,8 @@ func _internal_requestWebView(postbox: Postbox, network: Network, stateManager:
|
|||
}
|
||||
|> mapToSignal { result -> Signal<RequestWebViewResult, RequestWebViewError> in
|
||||
switch result {
|
||||
case let .webViewResultUrl(webViewFlags, queryId, url):
|
||||
case let .webViewResultUrl(webViewResultUrlData):
|
||||
let (webViewFlags, queryId, url) = (webViewResultUrlData.flags, webViewResultUrlData.queryId, webViewResultUrlData.url)
|
||||
var resultFlags: RequestWebViewResult.Flags = []
|
||||
if (webViewFlags & (1 << 1)) != 0 {
|
||||
resultFlags.insert(.fullSize)
|
||||
|
|
@ -273,7 +276,7 @@ func _internal_requestWebView(postbox: Postbox, network: Network, stateManager:
|
|||
} else {
|
||||
keepAlive = nil
|
||||
}
|
||||
|
||||
|
||||
return .single(RequestWebViewResult(flags: resultFlags, queryId: queryId, url: url, keepAliveSignal: keepAlive))
|
||||
}
|
||||
}
|
||||
|
|
@ -351,7 +354,8 @@ func _internal_requestAppWebView(postbox: Postbox, network: Network, stateManage
|
|||
}
|
||||
|> mapToSignal { result -> Signal<RequestWebViewResult, RequestWebViewError> in
|
||||
switch result {
|
||||
case let .webViewResultUrl(flags, queryId, url):
|
||||
case let .webViewResultUrl(webViewResultUrlData):
|
||||
let (flags, queryId, url) = (webViewResultUrlData.flags, webViewResultUrlData.queryId, webViewResultUrlData.url)
|
||||
var resultFlags: RequestWebViewResult.Flags = []
|
||||
if (flags & (1 << 1)) != 0 {
|
||||
resultFlags.insert(.fullSize)
|
||||
|
|
|
|||
|
|
@ -437,10 +437,11 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
case let .channelAdminLogEventActionChangeWallpaper(channelAdminLogEventActionChangeWallpaperData):
|
||||
let (prevValue, newValue) = (channelAdminLogEventActionChangeWallpaperData.prevValue, channelAdminLogEventActionChangeWallpaperData.newValue)
|
||||
let prev: TelegramWallpaper?
|
||||
if case let .wallPaperNoFile(_, _, settings) = prevValue {
|
||||
if case let .wallPaperNoFile(wallPaperNoFileData) = prevValue {
|
||||
let (_, _, settings) = (wallPaperNoFileData.id, wallPaperNoFileData.flags, wallPaperNoFileData.settings)
|
||||
if settings == nil {
|
||||
prev = nil
|
||||
} else if case let .wallPaperSettings(flags, _, _, _, _, _, _, _) = settings, flags == 0 {
|
||||
} else if case let .wallPaperSettings(wallPaperSettingsData) = settings, wallPaperSettingsData.flags == 0 {
|
||||
prev = nil
|
||||
} else {
|
||||
prev = TelegramWallpaper(apiWallpaper: prevValue)
|
||||
|
|
@ -449,10 +450,11 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net
|
|||
prev = TelegramWallpaper(apiWallpaper: prevValue)
|
||||
}
|
||||
let new: TelegramWallpaper?
|
||||
if case let .wallPaperNoFile(_, _, settings) = newValue {
|
||||
if case let .wallPaperNoFile(wallPaperNoFileData) = newValue {
|
||||
let (_, _, settings) = (wallPaperNoFileData.id, wallPaperNoFileData.flags, wallPaperNoFileData.settings)
|
||||
if settings == nil {
|
||||
new = nil
|
||||
} else if case let .wallPaperSettings(flags, _, _, _, _, _, _, _) = settings, flags == 0 {
|
||||
} else if case let .wallPaperSettings(wallPaperSettingsData) = settings, wallPaperSettingsData.flags == 0 {
|
||||
new = nil
|
||||
} else {
|
||||
new = TelegramWallpaper(apiWallpaper: newValue)
|
||||
|
|
|
|||
|
|
@ -109,9 +109,9 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
|||
if let markup = markup {
|
||||
switch markup {
|
||||
case let .emoji(fileId, backgroundColors):
|
||||
videoEmojiMarkup = .videoSizeEmojiMarkup(emojiId: fileId, backgroundColors: backgroundColors)
|
||||
videoEmojiMarkup = .videoSizeEmojiMarkup(.init(emojiId: fileId, backgroundColors: backgroundColors))
|
||||
case let .sticker(packReference, fileId, backgroundColors):
|
||||
videoEmojiMarkup = .videoSizeStickerMarkup(stickerset: packReference.apiInputStickerSet, stickerId: fileId, backgroundColors: backgroundColors)
|
||||
videoEmojiMarkup = .videoSizeStickerMarkup(.init(stickerset: packReference.apiInputStickerSet, stickerId: fileId, backgroundColors: backgroundColors))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,10 +262,11 @@ func _internal_updatePeerPhotoInternal(postbox: Postbox, network: Network, state
|
|||
if let videoSizes = videoSizes {
|
||||
for size in videoSizes {
|
||||
switch size {
|
||||
case let .videoSize(_, type, w, h, size, videoStartTs):
|
||||
case let .videoSize(videoSizeData):
|
||||
let (_, type, w, h, size, videoStartTs) = (videoSizeData.flags, videoSizeData.type, videoSizeData.w, videoSizeData.h, videoSizeData.size, videoSizeData.videoStartTs)
|
||||
let resource: TelegramMediaResource
|
||||
resource = CloudPhotoSizeMediaResource(datacenterId: dcId, photoId: id, accessHash: accessHash, sizeSpec: type, size: Int64(size), fileReference: fileReference.makeData())
|
||||
|
||||
|
||||
videoRepresentations.append(TelegramMediaImage.VideoRepresentation(dimensions: PixelDimensions(width: w, height: h), resource: resource, startTimestamp: videoStartTs))
|
||||
case .videoSizeEmojiMarkup, .videoSizeStickerMarkup:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||
|
||||
if let additionalConnectedBots {
|
||||
switch additionalConnectedBots {
|
||||
case let .connectedBots(connectedBots, users):
|
||||
case let .connectedBots(connectedBotsData):
|
||||
let (connectedBots, users) = (connectedBotsData.connectedBots, connectedBotsData.users)
|
||||
parsedPeers = parsedPeers.union(with: AccumulatedPeers(transaction: transaction, chats: [], users: users))
|
||||
|
||||
if let apiBot = connectedBots.first {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ func requestRecentAccountSessions(account: Account) -> Signal<([RecentAccountSes
|
|||
var sessions: [RecentAccountSession] = []
|
||||
var ttlDays: Int32 = 1
|
||||
switch result {
|
||||
case let .authorizations(authorizationTtlDays, authorizations):
|
||||
case let .authorizations(authorizationsData):
|
||||
let (authorizationTtlDays, authorizations) = (authorizationsData.authorizationTtlDays, authorizationsData.authorizations)
|
||||
for authorization in authorizations {
|
||||
sessions.append(RecentAccountSession(apiAuthorization: authorization))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,10 @@ func webSessions(network: Network) -> Signal<([WebAuthorization], [PeerId: Peer]
|
|||
case let .webAuthorizations(authorizations, users):
|
||||
for authorization in authorizations {
|
||||
switch authorization {
|
||||
case let .webAuthorization(hash, botId, domain, browser, platform, dateCreated, dateActive, ip, region):
|
||||
case let .webAuthorization(webAuthorizationData):
|
||||
let (hash, botId, domain, browser, platform, dateCreated, dateActive, ip, region) = (webAuthorizationData.hash, webAuthorizationData.botId, webAuthorizationData.domain, webAuthorizationData.browser, webAuthorizationData.platform, webAuthorizationData.dateCreated, webAuthorizationData.dateActive, webAuthorizationData.ip, webAuthorizationData.region)
|
||||
sessions.append(WebAuthorization(hash: hash, botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), domain: domain, browser: browser, platform: platform, dateCreated: dateCreated, dateActive: dateActive, ip: ip, region: region))
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
for user in users {
|
||||
|
|
|
|||
|
|
@ -266,7 +266,8 @@ public func requestSecureIdForm(accountPeerId: PeerId, postbox: Postbox, network
|
|||
|> mapToSignal { result -> Signal<EncryptedSecureIdForm, RequestSecureIdFormError> in
|
||||
return postbox.transaction { transaction -> EncryptedSecureIdForm in
|
||||
switch result {
|
||||
case let .authorizationForm(_, requiredTypes, values, errors, users, termsUrl):
|
||||
case let .authorizationForm(authorizationFormData):
|
||||
let (_, requiredTypes, values, errors, users, termsUrl) = (authorizationFormData.flags, authorizationFormData.requiredTypes, authorizationFormData.values, authorizationFormData.errors, authorizationFormData.users, authorizationFormData.privacyPolicyUrl)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(users: users))
|
||||
|
||||
return EncryptedSecureIdForm(peerId: peerId, requestedFields: requiredTypes.map { requiredType in
|
||||
|
|
|
|||
|
|
@ -565,7 +565,8 @@ public final class UniqueGiftChatThemesContext {
|
|||
}
|
||||
return postbox.transaction { transaction -> ([ChatTheme], String?) in
|
||||
switch result {
|
||||
case let .chatThemes(_, _, themes, chats, users, nextOffset):
|
||||
case let .chatThemes(chatThemesData):
|
||||
let (themes, chats, users, nextOffset) = (chatThemesData.themes, chatThemesData.chats, chatThemesData.users, chatThemesData.nextOffset)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
return (themes.compactMap { ChatTheme(apiChatTheme: $0) }, nextOffset)
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ public func actualizedWebpage(account: Account, webpage: TelegramMediaWebpage) -
|
|||
|
||||
if let updatedWebpage = telegramMediaWebpageFromApiWebpage(apiWebpage), case .Loaded = updatedWebpage.content, updatedWebpage.webpageId == webpage.webpageId {
|
||||
return .single(updatedWebpage)
|
||||
} else if case let .webPageNotModified(_, viewsValue) = apiWebpage, let views = viewsValue, case let .Loaded(content) = webpage.content {
|
||||
} else if case let .webPageNotModified(webPageNotModifiedData) = apiWebpage, let views = webPageNotModifiedData.cachedPageViews, case let .Loaded(content) = webpage.content {
|
||||
let updatedContent: TelegramMediaWebpageContent = .Loaded(TelegramMediaWebpageLoadedContent(
|
||||
url: content.url,
|
||||
displayUrl: content.displayUrl,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue