Refactor constructor use sites for types 420-439 to struct pattern
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b5dc0b2fd9
commit
81e17da3fb
19 changed files with 313 additions and 49 deletions
|
|
@ -477,7 +477,17 @@ public extension Api.chatlists {
|
|||
}
|
||||
public extension Api.chatlists {
|
||||
enum ExportedInvites: TypeConstructorDescription {
|
||||
case exportedInvites(invites: [Api.ExportedChatlistInvite], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_exportedInvites {
|
||||
public var invites: [Api.ExportedChatlistInvite]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(invites: [Api.ExportedChatlistInvite], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.invites = invites
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case exportedInvites(Cons_exportedInvites)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -506,8 +516,30 @@ public extension Api.chatlists {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum Blocked: TypeConstructorDescription {
|
||||
case blocked(blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User])
|
||||
case blockedSlice(count: Int32, blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_blocked {
|
||||
public var blocked: [Api.PeerBlocked]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.blocked = blocked
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
public class Cons_blockedSlice {
|
||||
public var count: Int32
|
||||
public var blocked: [Api.PeerBlocked]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(count: Int32, blocked: [Api.PeerBlocked], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.count = count
|
||||
self.blocked = blocked
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case blocked(Cons_blocked)
|
||||
case blockedSlice(Cons_blockedSlice)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -543,7 +575,15 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum ContactBirthdays: TypeConstructorDescription {
|
||||
case contactBirthdays(contacts: [Api.ContactBirthday], users: [Api.User])
|
||||
public class Cons_contactBirthdays {
|
||||
public var contacts: [Api.ContactBirthday]
|
||||
public var users: [Api.User]
|
||||
public init(contacts: [Api.ContactBirthday], users: [Api.User]) {
|
||||
self.contacts = contacts
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case contactBirthdays(Cons_contactBirthdays)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -572,7 +612,17 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum Contacts: TypeConstructorDescription {
|
||||
case contacts(contacts: [Api.Contact], savedCount: Int32, users: [Api.User])
|
||||
public class Cons_contacts {
|
||||
public var contacts: [Api.Contact]
|
||||
public var savedCount: Int32
|
||||
public var users: [Api.User]
|
||||
public init(contacts: [Api.Contact], savedCount: Int32, users: [Api.User]) {
|
||||
self.contacts = contacts
|
||||
self.savedCount = savedCount
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case contacts(Cons_contacts)
|
||||
case contactsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -609,7 +659,19 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum Found: TypeConstructorDescription {
|
||||
case found(myResults: [Api.Peer], results: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_found {
|
||||
public var myResults: [Api.Peer]
|
||||
public var results: [Api.Peer]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(myResults: [Api.Peer], results: [Api.Peer], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.myResults = myResults
|
||||
self.results = results
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case found(Cons_found)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -638,7 +700,19 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum ImportedContacts: TypeConstructorDescription {
|
||||
case importedContacts(imported: [Api.ImportedContact], popularInvites: [Api.PopularContact], retryContacts: [Int64], users: [Api.User])
|
||||
public class Cons_importedContacts {
|
||||
public var imported: [Api.ImportedContact]
|
||||
public var popularInvites: [Api.PopularContact]
|
||||
public var retryContacts: [Int64]
|
||||
public var users: [Api.User]
|
||||
public init(imported: [Api.ImportedContact], popularInvites: [Api.PopularContact], retryContacts: [Int64], users: [Api.User]) {
|
||||
self.imported = imported
|
||||
self.popularInvites = popularInvites
|
||||
self.retryContacts = retryContacts
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case importedContacts(Cons_importedContacts)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -667,7 +741,17 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum ResolvedPeer: TypeConstructorDescription {
|
||||
case resolvedPeer(peer: Api.Peer, chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_resolvedPeer {
|
||||
public var peer: Api.Peer
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(peer: Api.Peer, chats: [Api.Chat], users: [Api.User]) {
|
||||
self.peer = peer
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case resolvedPeer(Cons_resolvedPeer)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -696,7 +780,17 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum SponsoredPeers: TypeConstructorDescription {
|
||||
case sponsoredPeers(peers: [Api.SponsoredPeer], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_sponsoredPeers {
|
||||
public var peers: [Api.SponsoredPeer]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(peers: [Api.SponsoredPeer], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.peers = peers
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case sponsoredPeers(Cons_sponsoredPeers)
|
||||
case sponsoredPeersEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -733,7 +827,17 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.contacts {
|
||||
enum TopPeers: TypeConstructorDescription {
|
||||
case topPeers(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_topPeers {
|
||||
public var categories: [Api.TopPeerCategoryPeers]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.categories = categories
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case topPeers(Cons_topPeers)
|
||||
case topPeersDisabled
|
||||
case topPeersNotModified
|
||||
|
||||
|
|
@ -778,7 +882,23 @@ public extension Api.contacts {
|
|||
}
|
||||
public extension Api.fragment {
|
||||
enum CollectibleInfo: TypeConstructorDescription {
|
||||
case collectibleInfo(purchaseDate: Int32, currency: String, amount: Int64, cryptoCurrency: String, cryptoAmount: Int64, url: String)
|
||||
public class Cons_collectibleInfo {
|
||||
public var purchaseDate: Int32
|
||||
public var currency: String
|
||||
public var amount: Int64
|
||||
public var cryptoCurrency: String
|
||||
public var cryptoAmount: Int64
|
||||
public var url: String
|
||||
public init(purchaseDate: Int32, currency: String, amount: Int64, cryptoCurrency: String, cryptoAmount: Int64, url: String) {
|
||||
self.purchaseDate = purchaseDate
|
||||
self.currency = currency
|
||||
self.amount = amount
|
||||
self.cryptoCurrency = cryptoCurrency
|
||||
self.cryptoAmount = cryptoAmount
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
case collectibleInfo(Cons_collectibleInfo)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -807,7 +927,15 @@ public extension Api.fragment {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum AppConfig: TypeConstructorDescription {
|
||||
case appConfig(hash: Int32, config: Api.JSONValue)
|
||||
public class Cons_appConfig {
|
||||
public var hash: Int32
|
||||
public var config: Api.JSONValue
|
||||
public init(hash: Int32, config: Api.JSONValue) {
|
||||
self.hash = hash
|
||||
self.config = config
|
||||
}
|
||||
}
|
||||
case appConfig(Cons_appConfig)
|
||||
case appConfigNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,26 @@
|
|||
public extension Api.help {
|
||||
enum AppUpdate: TypeConstructorDescription {
|
||||
case appUpdate(flags: Int32, id: Int32, version: String, text: String, entities: [Api.MessageEntity], document: Api.Document?, url: String?, sticker: Api.Document?)
|
||||
public class Cons_appUpdate {
|
||||
public var flags: Int32
|
||||
public var id: Int32
|
||||
public var version: String
|
||||
public var text: String
|
||||
public var entities: [Api.MessageEntity]
|
||||
public var document: Api.Document?
|
||||
public var url: String?
|
||||
public var sticker: Api.Document?
|
||||
public init(flags: Int32, id: Int32, version: String, text: String, entities: [Api.MessageEntity], document: Api.Document?, url: String?, sticker: Api.Document?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.version = version
|
||||
self.text = text
|
||||
self.entities = entities
|
||||
self.document = document
|
||||
self.url = url
|
||||
self.sticker = sticker
|
||||
}
|
||||
}
|
||||
case appUpdate(Cons_appUpdate)
|
||||
case noAppUpdate
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -37,7 +57,15 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum CountriesList: TypeConstructorDescription {
|
||||
case countriesList(countries: [Api.help.Country], hash: Int32)
|
||||
public class Cons_countriesList {
|
||||
public var countries: [Api.help.Country]
|
||||
public var hash: Int32
|
||||
public init(countries: [Api.help.Country], hash: Int32) {
|
||||
self.countries = countries
|
||||
self.hash = hash
|
||||
}
|
||||
}
|
||||
case countriesList(Cons_countriesList)
|
||||
case countriesListNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -74,7 +102,21 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum Country: TypeConstructorDescription {
|
||||
case country(flags: Int32, iso2: String, defaultName: String, name: String?, countryCodes: [Api.help.CountryCode])
|
||||
public class Cons_country {
|
||||
public var flags: Int32
|
||||
public var iso2: String
|
||||
public var defaultName: String
|
||||
public var name: String?
|
||||
public var countryCodes: [Api.help.CountryCode]
|
||||
public init(flags: Int32, iso2: String, defaultName: String, name: String?, countryCodes: [Api.help.CountryCode]) {
|
||||
self.flags = flags
|
||||
self.iso2 = iso2
|
||||
self.defaultName = defaultName
|
||||
self.name = name
|
||||
self.countryCodes = countryCodes
|
||||
}
|
||||
}
|
||||
case country(Cons_country)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -103,7 +145,19 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum CountryCode: TypeConstructorDescription {
|
||||
case countryCode(flags: Int32, countryCode: String, prefixes: [String]?, patterns: [String]?)
|
||||
public class Cons_countryCode {
|
||||
public var flags: Int32
|
||||
public var countryCode: String
|
||||
public var prefixes: [String]?
|
||||
public var patterns: [String]?
|
||||
public init(flags: Int32, countryCode: String, prefixes: [String]?, patterns: [String]?) {
|
||||
self.flags = flags
|
||||
self.countryCode = countryCode
|
||||
self.prefixes = prefixes
|
||||
self.patterns = patterns
|
||||
}
|
||||
}
|
||||
case countryCode(Cons_countryCode)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -132,7 +186,17 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum DeepLinkInfo: TypeConstructorDescription {
|
||||
case deepLinkInfo(flags: Int32, message: String, entities: [Api.MessageEntity]?)
|
||||
public class Cons_deepLinkInfo {
|
||||
public var flags: Int32
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]?
|
||||
public init(flags: Int32, message: String, entities: [Api.MessageEntity]?) {
|
||||
self.flags = flags
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
}
|
||||
}
|
||||
case deepLinkInfo(Cons_deepLinkInfo)
|
||||
case deepLinkInfoEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -169,7 +233,13 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum InviteText: TypeConstructorDescription {
|
||||
case inviteText(message: String)
|
||||
public class Cons_inviteText {
|
||||
public var message: String
|
||||
public init(message: String) {
|
||||
self.message = message
|
||||
}
|
||||
}
|
||||
case inviteText(Cons_inviteText)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -198,7 +268,15 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum PassportConfig: TypeConstructorDescription {
|
||||
case passportConfig(hash: Int32, countriesLangs: Api.DataJSON)
|
||||
public class Cons_passportConfig {
|
||||
public var hash: Int32
|
||||
public var countriesLangs: Api.DataJSON
|
||||
public init(hash: Int32, countriesLangs: Api.DataJSON) {
|
||||
self.hash = hash
|
||||
self.countriesLangs = countriesLangs
|
||||
}
|
||||
}
|
||||
case passportConfig(Cons_passportConfig)
|
||||
case passportConfigNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -235,7 +313,23 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum PeerColorOption: TypeConstructorDescription {
|
||||
case peerColorOption(flags: Int32, colorId: Int32, colors: Api.help.PeerColorSet?, darkColors: Api.help.PeerColorSet?, channelMinLevel: Int32?, groupMinLevel: Int32?)
|
||||
public class Cons_peerColorOption {
|
||||
public var flags: Int32
|
||||
public var colorId: Int32
|
||||
public var colors: Api.help.PeerColorSet?
|
||||
public var darkColors: Api.help.PeerColorSet?
|
||||
public var channelMinLevel: Int32?
|
||||
public var groupMinLevel: Int32?
|
||||
public init(flags: Int32, colorId: Int32, colors: Api.help.PeerColorSet?, darkColors: Api.help.PeerColorSet?, channelMinLevel: Int32?, groupMinLevel: Int32?) {
|
||||
self.flags = flags
|
||||
self.colorId = colorId
|
||||
self.colors = colors
|
||||
self.darkColors = darkColors
|
||||
self.channelMinLevel = channelMinLevel
|
||||
self.groupMinLevel = groupMinLevel
|
||||
}
|
||||
}
|
||||
case peerColorOption(Cons_peerColorOption)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -264,8 +358,24 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum PeerColorSet: TypeConstructorDescription {
|
||||
case peerColorProfileSet(paletteColors: [Int32], bgColors: [Int32], storyColors: [Int32])
|
||||
case peerColorSet(colors: [Int32])
|
||||
public class Cons_peerColorProfileSet {
|
||||
public var paletteColors: [Int32]
|
||||
public var bgColors: [Int32]
|
||||
public var storyColors: [Int32]
|
||||
public init(paletteColors: [Int32], bgColors: [Int32], storyColors: [Int32]) {
|
||||
self.paletteColors = paletteColors
|
||||
self.bgColors = bgColors
|
||||
self.storyColors = storyColors
|
||||
}
|
||||
}
|
||||
public class Cons_peerColorSet {
|
||||
public var colors: [Int32]
|
||||
public init(colors: [Int32]) {
|
||||
self.colors = colors
|
||||
}
|
||||
}
|
||||
case peerColorProfileSet(Cons_peerColorProfileSet)
|
||||
case peerColorSet(Cons_peerColorSet)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ public struct AppUpdateInfo: Equatable {
|
|||
extension AppUpdateInfo {
|
||||
init?(apiAppUpdate: Api.help.AppUpdate) {
|
||||
switch apiAppUpdate {
|
||||
case let .appUpdate(flags, _, version, text, entities, _, _, _):
|
||||
case let .appUpdate(appUpdateData):
|
||||
let (flags, version, text, entities) = (appUpdateData.flags, appUpdateData.version, appUpdateData.text, appUpdateData.entities)
|
||||
self.blocking = (flags & (1 << 0)) != 0
|
||||
self.version = version
|
||||
self.text = text
|
||||
|
|
|
|||
|
|
@ -341,8 +341,9 @@ private func pushDeviceContactData(accountPeerId: PeerId, postbox: Postbox, netw
|
|||
var importedCounts: [Int: Int32] = [:]
|
||||
var peerIdByClientId: [Int64: PeerId] = [:]
|
||||
switch result {
|
||||
case let .importedContacts(imported, popularInvites, retryContacts, users):
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(users: users))
|
||||
case let .importedContacts(importedContactsData):
|
||||
let (imported, popularInvites, retryContacts, users) = (importedContactsData.imported, importedContactsData.popularInvites, importedContactsData.retryContacts, importedContactsData.users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(users: users))
|
||||
|
||||
for item in imported {
|
||||
switch item {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ func updateAppConfigurationOnce(postbox: Postbox, network: Network) -> Signal<Vo
|
|||
return network.request(Api.functions.help.getAppConfig(hash: hash))
|
||||
|> map { result -> (data: Api.JSONValue, hash: Int32)? in
|
||||
switch result {
|
||||
case let .appConfig(updatedHash, config):
|
||||
case let .appConfig(appConfigData):
|
||||
let (updatedHash, config) = (appConfigData.hash, appConfigData.config)
|
||||
return (config, updatedHash)
|
||||
case .appConfigNotModified:
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -244,14 +244,16 @@ private extension EngineAvailableColorOptions.ColorOption {
|
|||
let stories: EngineAvailableColorOptions.MultiColorPack?
|
||||
|
||||
switch apiColors {
|
||||
case let .peerColorSet(colors):
|
||||
case let .peerColorSet(peerColorSetData):
|
||||
let colors = peerColorSetData.colors
|
||||
if colors.isEmpty {
|
||||
return nil
|
||||
}
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: colors.map(UInt32.init(bitPattern:)))
|
||||
background = palette
|
||||
stories = nil
|
||||
case let .peerColorProfileSet(palleteColors, bgColors, storyColors):
|
||||
case let .peerColorProfileSet(peerColorProfileSetData):
|
||||
let (palleteColors, bgColors, storyColors) = (peerColorProfileSetData.paletteColors, peerColorProfileSetData.bgColors, peerColorProfileSetData.storyColors)
|
||||
if palleteColors.isEmpty {
|
||||
return nil
|
||||
}
|
||||
|
|
@ -278,7 +280,8 @@ private extension EngineAvailableColorOptions {
|
|||
var mappedOptions: [Option] = []
|
||||
for apiColor in apiColors {
|
||||
switch apiColor {
|
||||
case let .peerColorOption(flags, colorId, colors, darkColors, requiredChannelMinBoostLevel, requiredGroupMinBoostLevel):
|
||||
case let .peerColorOption(peerColorOptionData):
|
||||
let (flags, colorId, colors, darkColors, requiredChannelMinBoostLevel, requiredGroupMinBoostLevel) = (peerColorOptionData.flags, peerColorOptionData.colorId, peerColorOptionData.colors, peerColorOptionData.darkColors, peerColorOptionData.channelMinLevel, peerColorOptionData.groupMinLevel)
|
||||
let isHidden = (flags & (1 << 0)) != 0
|
||||
|
||||
let mappedColors = colors.flatMap(EngineAvailableColorOptions.ColorOption.init(apiColors:))
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ private func updatedRemoteContactPeers(network: Network, hash: Int64) -> Signal<
|
|||
switch result {
|
||||
case .contactsNotModified:
|
||||
return nil
|
||||
case let .contacts(_, savedCount, users):
|
||||
case let .contacts(contactsData):
|
||||
let (savedCount, users) = (contactsData.savedCount, contactsData.users)
|
||||
return (AccumulatedPeers(users: users), savedCount)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ func _internal_importContact(account: Account, firstName: String, lastName: Stri
|
|||
return account.postbox.transaction { transaction -> PeerId? in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .importedContacts(_, _, _, users):
|
||||
case let .importedContacts(importedContactsData):
|
||||
let users = importedContactsData.users
|
||||
if let first = users.first {
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(users: users))
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ func _internal_getCountriesList(accountManager: AccountManager<TelegramAccountMa
|
|||
|> retryRequest
|
||||
|> mapToSignal { result -> Signal<[Country], NoError> in
|
||||
switch result {
|
||||
case let .countriesList(apiCountries, hash):
|
||||
case let .countriesList(countriesListData):
|
||||
let (apiCountries, hash) = (countriesListData.countries, countriesListData.hash)
|
||||
let result = apiCountries.compactMap { Country(apiCountry: $0) }
|
||||
if result == current {
|
||||
return .complete()
|
||||
|
|
@ -145,7 +146,8 @@ func _internal_getCountriesList(accountManager: AccountManager<TelegramAccountMa
|
|||
extension Country.CountryCode {
|
||||
init(apiCountryCode: Api.help.CountryCode) {
|
||||
switch apiCountryCode {
|
||||
case let .countryCode(_, countryCode, apiPrefixes, apiPatterns):
|
||||
case let .countryCode(countryCodeData):
|
||||
let (countryCode, apiPrefixes, apiPatterns) = (countryCodeData.countryCode, countryCodeData.prefixes, countryCodeData.patterns)
|
||||
let prefixes: [String] = apiPrefixes.flatMap { $0 } ?? []
|
||||
let patterns: [String] = apiPatterns.flatMap { $0 } ?? []
|
||||
self.init(code: countryCode, prefixes: prefixes, patterns: patterns)
|
||||
|
|
@ -156,7 +158,8 @@ extension Country.CountryCode {
|
|||
extension Country {
|
||||
init(apiCountry: Api.help.Country) {
|
||||
switch apiCountry {
|
||||
case let .country(flags, iso2, defaultName, name, countryCodes):
|
||||
case let .country(countryData):
|
||||
let (flags, iso2, defaultName, name, countryCodes) = (countryData.flags, countryData.iso2, countryData.defaultName, countryData.name, countryData.countryCodes)
|
||||
self.init(id: iso2, name: defaultName, localizedName: name, countryCodes: countryCodes.map { Country.CountryCode(apiCountryCode: $0) }, hidden: (flags & 1 << 0) != 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ func _internal_searchAdPeers(account: Account, query: String) -> Signal<[AdPeer]
|
|||
}
|
||||
return account.postbox.transaction { transaction -> [AdPeer] in
|
||||
switch result {
|
||||
case let .sponsoredPeers(peers, chats, users):
|
||||
case let .sponsoredPeers(sponsoredPeersData):
|
||||
let (peers, chats, users) = (sponsoredPeersData.peers, sponsoredPeersData.chats, sponsoredPeersData.users)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: account.peerId, peers: parsedPeers)
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,8 @@ func managedContactBirthdays(stateManager: AccountStateManager) -> Signal<Never,
|
|||
return .complete()
|
||||
}
|
||||
return stateManager.postbox.transaction { transaction -> Void in
|
||||
if case let .contactBirthdays(contactBirthdays, users) = result {
|
||||
if case let .contactBirthdays(contactBirthdaysData) = result {
|
||||
let (contactBirthdays, users) = (contactBirthdaysData.contacts, contactBirthdaysData.users)
|
||||
updatePeers(transaction: transaction, accountPeerId: stateManager.accountPeerId, peers: AccumulatedPeers(users: users))
|
||||
|
||||
var birthdays: [EnginePeer.Id: TelegramBirthday] = [:]
|
||||
|
|
|
|||
|
|
@ -167,7 +167,8 @@ func _internal_getExportedChatFolderLinks(account: Account, id: Int32) -> Signal
|
|||
}
|
||||
return account.postbox.transaction { transaction -> [ExportedChatFolderLink]? in
|
||||
switch result {
|
||||
case let .exportedInvites(invites, chats, users):
|
||||
case let .exportedInvites(exportedInvitesData):
|
||||
let (invites, chats, users) = (exportedInvitesData.invites, exportedInvitesData.chats, exportedInvitesData.users)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ public func _internal_managedUpdatedRecentPeers(accountPeerId: PeerId, postbox:
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
return postbox.transaction { transaction -> Void in
|
||||
switch result {
|
||||
case let .topPeers(_, _, users):
|
||||
case let .topPeers(topPeersData):
|
||||
let users = topPeersData.users
|
||||
let parsedPeers = AccumulatedPeers(users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
|
@ -156,7 +157,8 @@ func _internal_managedRecentlyUsedInlineBots(postbox: Postbox, network: Network,
|
|||
switch result {
|
||||
case .topPeersDisabled:
|
||||
break
|
||||
case let .topPeers(categories, _, users):
|
||||
case let .topPeers(topPeersData):
|
||||
let (categories, users) = (topPeersData.categories, topPeersData.users)
|
||||
let parsedPeers = AccumulatedPeers(users: users)
|
||||
|
||||
var peersWithRating: [(PeerId, Double)] = []
|
||||
|
|
@ -289,7 +291,8 @@ public func _internal_managedUpdatedRecentApps(accountPeerId: PeerId, postbox: P
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
return postbox.transaction { transaction -> Void in
|
||||
switch result {
|
||||
case let .topPeers(_, _, users):
|
||||
case let .topPeers(topPeersData):
|
||||
let users = topPeersData.users
|
||||
let parsedPeers = AccumulatedPeers(users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ func _internal_resolvePeerByName(postbox: Postbox, network: Network, accountPeer
|
|||
var peerId: PeerId? = nil
|
||||
|
||||
switch result {
|
||||
case let .resolvedPeer(apiPeer, chats, users):
|
||||
case let .resolvedPeer(resolvedPeerData):
|
||||
let (apiPeer, chats, users) = (resolvedPeerData.peer, resolvedPeerData.chats, resolvedPeerData.users)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
|
||||
if let peer = parsedPeers.get(apiPeer.peerId) {
|
||||
|
|
@ -105,7 +106,8 @@ func _internal_resolvePeerByPhone(account: Account, phone: String, ageLimit: Int
|
|||
var peerId: PeerId? = nil
|
||||
|
||||
switch result {
|
||||
case let .resolvedPeer(apiPeer, chats, users):
|
||||
case let .resolvedPeer(resolvedPeerData):
|
||||
let (apiPeer, chats, users) = (resolvedPeerData.peer, resolvedPeerData.chats, resolvedPeerData.users)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
|
||||
if let peer = parsedPeers.get(apiPeer.peerId) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ public func _internal_searchPeers(accountPeerId: PeerId, postbox: Postbox, netwo
|
|||
|> mapToSignal { result -> Signal<([FoundPeer], [FoundPeer]), NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .found(myResults, results, chats, users):
|
||||
case let .found(foundData):
|
||||
let (myResults, results, chats, users) = (foundData.myResults, foundData.results, foundData.chats, foundData.users)
|
||||
return postbox.transaction { transaction -> ([FoundPeer], [FoundPeer]) in
|
||||
var subscribers: [PeerId: Int32] = [:]
|
||||
|
||||
|
|
|
|||
|
|
@ -1658,7 +1658,8 @@ public extension TelegramEngine {
|
|||
return nil
|
||||
}
|
||||
switch result {
|
||||
case let .collectibleInfo(purchaseDate, currency, amount, cryptoCurrency, cryptoAmount, url):
|
||||
case let .collectibleInfo(collectibleInfoData):
|
||||
let (purchaseDate, currency, amount, cryptoCurrency, cryptoAmount, url) = (collectibleInfoData.purchaseDate, collectibleInfoData.currency, collectibleInfoData.amount, collectibleInfoData.cryptoCurrency, collectibleInfoData.cryptoAmount, collectibleInfoData.url)
|
||||
return TelegramCollectibleItemInfo(
|
||||
subject: .username(username),
|
||||
purchaseDate: purchaseDate,
|
||||
|
|
@ -1683,7 +1684,8 @@ public extension TelegramEngine {
|
|||
return nil
|
||||
}
|
||||
switch result {
|
||||
case let .collectibleInfo(purchaseDate, currency, amount, cryptoCurrency, cryptoAmount, url):
|
||||
case let .collectibleInfo(collectibleInfoData):
|
||||
let (purchaseDate, currency, amount, cryptoCurrency, cryptoAmount, url) = (collectibleInfoData.purchaseDate, collectibleInfoData.currency, collectibleInfoData.amount, collectibleInfoData.cryptoCurrency, collectibleInfoData.cryptoAmount, collectibleInfoData.url)
|
||||
return TelegramCollectibleItemInfo(
|
||||
subject: .phoneNumber(phoneNumber),
|
||||
purchaseDate: purchaseDate,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ public final class BlockedPeersContext {
|
|||
}
|
||||
return postbox.transaction { transaction -> (peers: [RenderedPeer], canLoadMore: Bool, totalCount: Int?) in
|
||||
switch result {
|
||||
case let .blocked(blocked, chats, users):
|
||||
case let .blocked(blockedData):
|
||||
let (blocked, chats, users) = (blockedData.blocked, blockedData.chats, blockedData.users)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
|
@ -101,7 +102,8 @@ public final class BlockedPeersContext {
|
|||
}
|
||||
|
||||
return (renderedPeers, false, nil)
|
||||
case let .blockedSlice(count, blocked, chats, users):
|
||||
case let .blockedSlice(blockedSliceData):
|
||||
let (count, blocked, chats, users) = (blockedSliceData.count, blockedSliceData.blocked, blockedSliceData.chats, blockedSliceData.users)
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ func _internal_getDeepLinkInfo(network: Network, path: String) -> Signal<DeepLin
|
|||
switch value {
|
||||
case .deepLinkInfoEmpty:
|
||||
return nil
|
||||
case let .deepLinkInfo(flags, message, entities):
|
||||
case let .deepLinkInfo(deepLinkInfoData):
|
||||
let (flags, message, entities) = (deepLinkInfoData.flags, deepLinkInfoData.message, deepLinkInfoData.entities)
|
||||
return DeepLinkInfo(message: message, entities: entities != nil ? messageTextEntitiesFromApiEntities(entities!) : [], updateApp: (flags & (1 << 0)) != 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ public func secureIdConfiguration(postbox: Postbox, network: Network) -> Signal<
|
|||
assertionFailure()
|
||||
return .complete()
|
||||
}
|
||||
case let .passportConfig(hash, countriesLangs):
|
||||
case let .passportConfig(passportConfigData):
|
||||
let (hash, countriesLangs) = (passportConfigData.hash, passportConfigData.countriesLangs)
|
||||
switch countriesLangs {
|
||||
case let .dataJSON(dataJSONData):
|
||||
let data = dataJSONData.data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue