mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Refactor constructor use sites for types 440-459 to struct pattern
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
81e17da3fb
commit
1f4b520b1b
24 changed files with 305 additions and 56 deletions
|
|
@ -411,7 +411,15 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum PeerColors: TypeConstructorDescription {
|
||||
case peerColors(hash: Int32, colors: [Api.help.PeerColorOption])
|
||||
public class Cons_peerColors {
|
||||
public var hash: Int32
|
||||
public var colors: [Api.help.PeerColorOption]
|
||||
public init(hash: Int32, colors: [Api.help.PeerColorOption]) {
|
||||
self.hash = hash
|
||||
self.colors = colors
|
||||
}
|
||||
}
|
||||
case peerColors(Cons_peerColors)
|
||||
case peerColorsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -448,7 +456,23 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum PremiumPromo: TypeConstructorDescription {
|
||||
case premiumPromo(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document], periodOptions: [Api.PremiumSubscriptionOption], users: [Api.User])
|
||||
public class Cons_premiumPromo {
|
||||
public var statusText: String
|
||||
public var statusEntities: [Api.MessageEntity]
|
||||
public var videoSections: [String]
|
||||
public var videos: [Api.Document]
|
||||
public var periodOptions: [Api.PremiumSubscriptionOption]
|
||||
public var users: [Api.User]
|
||||
public init(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document], periodOptions: [Api.PremiumSubscriptionOption], users: [Api.User]) {
|
||||
self.statusText = statusText
|
||||
self.statusEntities = statusEntities
|
||||
self.videoSections = videoSections
|
||||
self.videos = videos
|
||||
self.periodOptions = periodOptions
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case premiumPromo(Cons_premiumPromo)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -477,8 +501,38 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum PromoData: TypeConstructorDescription {
|
||||
case promoData(flags: Int32, expires: Int32, peer: Api.Peer?, psaType: String?, psaMessage: String?, pendingSuggestions: [String], dismissedSuggestions: [String], customPendingSuggestion: Api.PendingSuggestion?, chats: [Api.Chat], users: [Api.User])
|
||||
case promoDataEmpty(expires: Int32)
|
||||
public class Cons_promoData {
|
||||
public var flags: Int32
|
||||
public var expires: Int32
|
||||
public var peer: Api.Peer?
|
||||
public var psaType: String?
|
||||
public var psaMessage: String?
|
||||
public var pendingSuggestions: [String]
|
||||
public var dismissedSuggestions: [String]
|
||||
public var customPendingSuggestion: Api.PendingSuggestion?
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(flags: Int32, expires: Int32, peer: Api.Peer?, psaType: String?, psaMessage: String?, pendingSuggestions: [String], dismissedSuggestions: [String], customPendingSuggestion: Api.PendingSuggestion?, chats: [Api.Chat], users: [Api.User]) {
|
||||
self.flags = flags
|
||||
self.expires = expires
|
||||
self.peer = peer
|
||||
self.psaType = psaType
|
||||
self.psaMessage = psaMessage
|
||||
self.pendingSuggestions = pendingSuggestions
|
||||
self.dismissedSuggestions = dismissedSuggestions
|
||||
self.customPendingSuggestion = customPendingSuggestion
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
public class Cons_promoDataEmpty {
|
||||
public var expires: Int32
|
||||
public init(expires: Int32) {
|
||||
self.expires = expires
|
||||
}
|
||||
}
|
||||
case promoData(Cons_promoData)
|
||||
case promoDataEmpty(Cons_promoDataEmpty)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -514,7 +568,17 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum RecentMeUrls: TypeConstructorDescription {
|
||||
case recentMeUrls(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_recentMeUrls {
|
||||
public var urls: [Api.RecentMeUrl]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.urls = urls
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case recentMeUrls(Cons_recentMeUrls)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -543,7 +607,15 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum Support: TypeConstructorDescription {
|
||||
case support(phoneNumber: String, user: Api.User)
|
||||
public class Cons_support {
|
||||
public var phoneNumber: String
|
||||
public var user: Api.User
|
||||
public init(phoneNumber: String, user: Api.User) {
|
||||
self.phoneNumber = phoneNumber
|
||||
self.user = user
|
||||
}
|
||||
}
|
||||
case support(Cons_support)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -572,7 +644,13 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum SupportName: TypeConstructorDescription {
|
||||
case supportName(name: String)
|
||||
public class Cons_supportName {
|
||||
public var name: String
|
||||
public init(name: String) {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
case supportName(Cons_supportName)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -601,7 +679,21 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum TermsOfService: TypeConstructorDescription {
|
||||
case termsOfService(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?)
|
||||
public class Cons_termsOfService {
|
||||
public var flags: Int32
|
||||
public var id: Api.DataJSON
|
||||
public var text: String
|
||||
public var entities: [Api.MessageEntity]
|
||||
public var minAgeConfirm: Int32?
|
||||
public init(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?) {
|
||||
self.flags = flags
|
||||
self.id = id
|
||||
self.text = text
|
||||
self.entities = entities
|
||||
self.minAgeConfirm = minAgeConfirm
|
||||
}
|
||||
}
|
||||
case termsOfService(Cons_termsOfService)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -630,8 +722,22 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum TermsOfServiceUpdate: TypeConstructorDescription {
|
||||
case termsOfServiceUpdate(expires: Int32, termsOfService: Api.help.TermsOfService)
|
||||
case termsOfServiceUpdateEmpty(expires: Int32)
|
||||
public class Cons_termsOfServiceUpdate {
|
||||
public var expires: Int32
|
||||
public var termsOfService: Api.help.TermsOfService
|
||||
public init(expires: Int32, termsOfService: Api.help.TermsOfService) {
|
||||
self.expires = expires
|
||||
self.termsOfService = termsOfService
|
||||
}
|
||||
}
|
||||
public class Cons_termsOfServiceUpdateEmpty {
|
||||
public var expires: Int32
|
||||
public init(expires: Int32) {
|
||||
self.expires = expires
|
||||
}
|
||||
}
|
||||
case termsOfServiceUpdate(Cons_termsOfServiceUpdate)
|
||||
case termsOfServiceUpdateEmpty(Cons_termsOfServiceUpdateEmpty)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -667,7 +773,15 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum TimezonesList: TypeConstructorDescription {
|
||||
case timezonesList(timezones: [Api.Timezone], hash: Int32)
|
||||
public class Cons_timezonesList {
|
||||
public var timezones: [Api.Timezone]
|
||||
public var hash: Int32
|
||||
public init(timezones: [Api.Timezone], hash: Int32) {
|
||||
self.timezones = timezones
|
||||
self.hash = hash
|
||||
}
|
||||
}
|
||||
case timezonesList(Cons_timezonesList)
|
||||
case timezonesListNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -704,7 +818,19 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.help {
|
||||
enum UserInfo: TypeConstructorDescription {
|
||||
case userInfo(message: String, entities: [Api.MessageEntity], author: String, date: Int32)
|
||||
public class Cons_userInfo {
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]
|
||||
public var author: String
|
||||
public var date: Int32
|
||||
public init(message: String, entities: [Api.MessageEntity], author: String, date: Int32) {
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
self.author = author
|
||||
self.date = date
|
||||
}
|
||||
}
|
||||
case userInfo(Cons_userInfo)
|
||||
case userInfoEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -741,7 +867,19 @@ public extension Api.help {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum AffectedFoundMessages: TypeConstructorDescription {
|
||||
case affectedFoundMessages(pts: Int32, ptsCount: Int32, offset: Int32, messages: [Int32])
|
||||
public class Cons_affectedFoundMessages {
|
||||
public var pts: Int32
|
||||
public var ptsCount: Int32
|
||||
public var offset: Int32
|
||||
public var messages: [Int32]
|
||||
public init(pts: Int32, ptsCount: Int32, offset: Int32, messages: [Int32]) {
|
||||
self.pts = pts
|
||||
self.ptsCount = ptsCount
|
||||
self.offset = offset
|
||||
self.messages = messages
|
||||
}
|
||||
}
|
||||
case affectedFoundMessages(Cons_affectedFoundMessages)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -770,7 +908,17 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum AffectedHistory: TypeConstructorDescription {
|
||||
case affectedHistory(pts: Int32, ptsCount: Int32, offset: Int32)
|
||||
public class Cons_affectedHistory {
|
||||
public var pts: Int32
|
||||
public var ptsCount: Int32
|
||||
public var offset: Int32
|
||||
public init(pts: Int32, ptsCount: Int32, offset: Int32) {
|
||||
self.pts = pts
|
||||
self.ptsCount = ptsCount
|
||||
self.offset = offset
|
||||
}
|
||||
}
|
||||
case affectedHistory(Cons_affectedHistory)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -799,7 +947,15 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum AffectedMessages: TypeConstructorDescription {
|
||||
case affectedMessages(pts: Int32, ptsCount: Int32)
|
||||
public class Cons_affectedMessages {
|
||||
public var pts: Int32
|
||||
public var ptsCount: Int32
|
||||
public init(pts: Int32, ptsCount: Int32) {
|
||||
self.pts = pts
|
||||
self.ptsCount = ptsCount
|
||||
}
|
||||
}
|
||||
case affectedMessages(Cons_affectedMessages)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
public extension Api.messages {
|
||||
enum AllStickers: TypeConstructorDescription {
|
||||
case allStickers(hash: Int64, sets: [Api.StickerSet])
|
||||
public class Cons_allStickers {
|
||||
public var hash: Int64
|
||||
public var sets: [Api.StickerSet]
|
||||
public init(hash: Int64, sets: [Api.StickerSet]) {
|
||||
self.hash = hash
|
||||
self.sets = sets
|
||||
}
|
||||
}
|
||||
case allStickers(Cons_allStickers)
|
||||
case allStickersNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -37,7 +45,15 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum ArchivedStickers: TypeConstructorDescription {
|
||||
case archivedStickers(count: Int32, sets: [Api.StickerSetCovered])
|
||||
public class Cons_archivedStickers {
|
||||
public var count: Int32
|
||||
public var sets: [Api.StickerSetCovered]
|
||||
public init(count: Int32, sets: [Api.StickerSetCovered]) {
|
||||
self.count = count
|
||||
self.sets = sets
|
||||
}
|
||||
}
|
||||
case archivedStickers(Cons_archivedStickers)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -66,7 +82,17 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum AvailableEffects: TypeConstructorDescription {
|
||||
case availableEffects(hash: Int32, effects: [Api.AvailableEffect], documents: [Api.Document])
|
||||
public class Cons_availableEffects {
|
||||
public var hash: Int32
|
||||
public var effects: [Api.AvailableEffect]
|
||||
public var documents: [Api.Document]
|
||||
public init(hash: Int32, effects: [Api.AvailableEffect], documents: [Api.Document]) {
|
||||
self.hash = hash
|
||||
self.effects = effects
|
||||
self.documents = documents
|
||||
}
|
||||
}
|
||||
case availableEffects(Cons_availableEffects)
|
||||
case availableEffectsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -103,7 +129,15 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum AvailableReactions: TypeConstructorDescription {
|
||||
case availableReactions(hash: Int32, reactions: [Api.AvailableReaction])
|
||||
public class Cons_availableReactions {
|
||||
public var hash: Int32
|
||||
public var reactions: [Api.AvailableReaction]
|
||||
public init(hash: Int32, reactions: [Api.AvailableReaction]) {
|
||||
self.hash = hash
|
||||
self.reactions = reactions
|
||||
}
|
||||
}
|
||||
case availableReactions(Cons_availableReactions)
|
||||
case availableReactionsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -140,7 +174,15 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum BotApp: TypeConstructorDescription {
|
||||
case botApp(flags: Int32, app: Api.BotApp)
|
||||
public class Cons_botApp {
|
||||
public var flags: Int32
|
||||
public var app: Api.BotApp
|
||||
public init(flags: Int32, app: Api.BotApp) {
|
||||
self.flags = flags
|
||||
self.app = app
|
||||
}
|
||||
}
|
||||
case botApp(Cons_botApp)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -169,7 +211,19 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum BotCallbackAnswer: TypeConstructorDescription {
|
||||
case botCallbackAnswer(flags: Int32, message: String?, url: String?, cacheTime: Int32)
|
||||
public class Cons_botCallbackAnswer {
|
||||
public var flags: Int32
|
||||
public var message: String?
|
||||
public var url: String?
|
||||
public var cacheTime: Int32
|
||||
public init(flags: Int32, message: String?, url: String?, cacheTime: Int32) {
|
||||
self.flags = flags
|
||||
self.message = message
|
||||
self.url = url
|
||||
self.cacheTime = cacheTime
|
||||
}
|
||||
}
|
||||
case botCallbackAnswer(Cons_botCallbackAnswer)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -198,7 +252,15 @@ public extension Api.messages {
|
|||
}
|
||||
public extension Api.messages {
|
||||
enum BotPreparedInlineMessage: TypeConstructorDescription {
|
||||
case botPreparedInlineMessage(id: String, expireDate: Int32)
|
||||
public class Cons_botPreparedInlineMessage {
|
||||
public var id: String
|
||||
public var expireDate: Int32
|
||||
public init(id: String, expireDate: Int32) {
|
||||
self.id = id
|
||||
self.expireDate = expireDate
|
||||
}
|
||||
}
|
||||
case botPreparedInlineMessage(Cons_botPreparedInlineMessage)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ import TelegramApi
|
|||
extension UnauthorizedAccountTermsOfService {
|
||||
init?(apiTermsOfService: Api.help.TermsOfService) {
|
||||
switch apiTermsOfService {
|
||||
case let .termsOfService(_, id, text, entities, minAgeConfirm):
|
||||
case let .termsOfService(termsOfServiceData):
|
||||
let (_, id, text, entities, minAgeConfirm) = (termsOfServiceData.flags, termsOfServiceData.id, termsOfServiceData.text, termsOfServiceData.entities, termsOfServiceData.minAgeConfirm)
|
||||
let idData: String
|
||||
switch id {
|
||||
case let .dataJSON(dataJSONData):
|
||||
|
|
|
|||
|
|
@ -240,7 +240,8 @@ func managedSynchronizeAvailableMessageEffects(postbox: Postbox, network: Networ
|
|||
return .complete()
|
||||
}
|
||||
switch result {
|
||||
case let .availableEffects(hash, effects, documents):
|
||||
case let .availableEffects(availableEffectsData):
|
||||
let (hash, effects, documents) = (availableEffectsData.hash, availableEffectsData.effects, availableEffectsData.documents)
|
||||
var files: [Int64: TelegramMediaFile] = [:]
|
||||
for document in documents {
|
||||
if let file = telegramMediaFileFromApiDocument(document, altDocuments: []) {
|
||||
|
|
|
|||
|
|
@ -420,7 +420,8 @@ func managedSynchronizeAvailableReactions(postbox: Postbox, network: Network) ->
|
|||
}
|
||||
|
||||
switch result {
|
||||
case let .availableReactions(hash, reactions):
|
||||
case let .availableReactions(availableReactionsData):
|
||||
let (hash, reactions) = (availableReactionsData.hash, availableReactionsData.reactions)
|
||||
let availableReactions = AvailableReactions(
|
||||
hash: hash,
|
||||
reactions: reactions.compactMap(AvailableReactions.Reaction.init(apiReaction:))
|
||||
|
|
|
|||
|
|
@ -205,7 +205,8 @@ private func removeMessages(postbox: Postbox, network: Network, stateManager: Ac
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updateChannelPts(channelId: peer.id.id._internalGetInt64Value(), pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
|
|
@ -240,13 +241,14 @@ private func removeMessages(postbox: Postbox, network: Network, stateManager: Ac
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
return .complete()
|
||||
}
|
||||
|
||||
|
||||
signal = signal
|
||||
|> then(partSignal)
|
||||
}
|
||||
|
|
@ -396,7 +398,8 @@ private func requestClearHistory(postbox: Postbox, network: Network, stateManage
|
|||
|> mapToSignal { result -> Signal<Void, Bool> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedHistory(pts, ptsCount, offset):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let (pts, ptsCount, offset) = (affectedHistoryData.pts, affectedHistoryData.ptsCount, affectedHistoryData.offset)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
if offset == 0 {
|
||||
return .fail(true)
|
||||
|
|
@ -463,7 +466,8 @@ private func _internal_clearHistory(transaction: Transaction, postbox: Postbox,
|
|||
|> mapToSignal { result -> Signal<Void, Bool> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedHistory(pts, ptsCount, offset):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let (pts, ptsCount, offset) = (affectedHistoryData.pts, affectedHistoryData.ptsCount, affectedHistoryData.offset)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
if offset == 0 {
|
||||
return .fail(true)
|
||||
|
|
@ -491,7 +495,8 @@ private func _internal_clearHistory(transaction: Transaction, postbox: Postbox,
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedHistory(pts, ptsCount, _):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let (pts, ptsCount) = (affectedHistoryData.pts, affectedHistoryData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
return .complete()
|
||||
}
|
||||
|
|
@ -539,7 +544,8 @@ private func _internal_clearHistory(transaction: Transaction, postbox: Postbox,
|
|||
|> mapToSignal { result -> Signal<Void, Bool> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedHistory(pts, ptsCount, offset):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let (pts, ptsCount, offset) = (affectedHistoryData.pts, affectedHistoryData.ptsCount, affectedHistoryData.offset)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
if offset == 0 {
|
||||
return .fail(true)
|
||||
|
|
|
|||
|
|
@ -256,7 +256,8 @@ private func synchronizeConsumeMessageContents(transaction: Transaction, postbox
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
|
|
@ -324,7 +325,8 @@ private func synchronizeReadMessageReactions(transaction: Transaction, postbox:
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,7 +351,8 @@ private func _internal_fetchPeerColors(postbox: Postbox, network: Network, scope
|
|||
switch result {
|
||||
case .peerColorsNotModified:
|
||||
return .complete()
|
||||
case let .peerColors(hash, colors):
|
||||
case let .peerColors(peerColorsData):
|
||||
let (hash, colors) = (peerColorsData.hash, peerColorsData.colors)
|
||||
return postbox.transaction { transaction -> Void in
|
||||
let value = EngineAvailableColorOptions(hash: hash, apiColors: colors)
|
||||
_internal_setCachedAvailableColorOptions(transaction: transaction, scope: scope, value: value)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@ func updatePremiumPromoConfigurationOnce(accountPeerId: PeerId, postbox: Postbox
|
|||
return .complete()
|
||||
}
|
||||
return postbox.transaction { transaction -> Void in
|
||||
if case let .premiumPromo(_, _, _, _, _, apiUsers) = result {
|
||||
if case let .premiumPromo(premiumPromoData) = result {
|
||||
let apiUsers = premiumPromoData.users
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: [], users: apiUsers)
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
}
|
||||
|
|
@ -59,7 +60,8 @@ private func updatePremiumPromoConfiguration(transaction: Transaction, _ f: (Pre
|
|||
private extension PremiumPromoConfiguration {
|
||||
init(apiPremiumPromo: Api.help.PremiumPromo) {
|
||||
switch apiPremiumPromo {
|
||||
case let .premiumPromo(statusText, statusEntities, videoSections, videoFiles, options, _):
|
||||
case let .premiumPromo(premiumPromoData):
|
||||
let (statusText, statusEntities, videoSections, videoFiles, options) = (premiumPromoData.statusText, premiumPromoData.statusEntities, premiumPromoData.videoSections, premiumPromoData.videos, premiumPromoData.periodOptions)
|
||||
self.status = statusText
|
||||
self.statusEntities = messageTextEntitiesFromApiEntities(statusEntities)
|
||||
|
||||
|
|
|
|||
|
|
@ -191,12 +191,12 @@ extension ServerSuggestionInfo.Item {
|
|||
func _internal_fetchPromoInfo(accountPeerId: EnginePeer.Id, postbox: Postbox, network: Network) -> Signal<Void, NoError> {
|
||||
return network.request(Api.functions.help.getPromoData())
|
||||
|> `catch` { _ -> Signal<Api.help.PromoData, NoError> in
|
||||
return .single(.promoDataEmpty(expires: 10 * 60))
|
||||
return .single(.promoDataEmpty(.init(expires: 10 * 60)))
|
||||
}
|
||||
|> mapToSignal { data -> Signal<Void, NoError> in
|
||||
return postbox.transaction { transaction -> Void in
|
||||
switch data {
|
||||
case .promoDataEmpty:
|
||||
case .promoDataEmpty(_):
|
||||
transaction.replaceAdditionalChatListItems([])
|
||||
|
||||
let suggestionInfo = ServerSuggestionInfo(
|
||||
|
|
@ -208,7 +208,8 @@ func _internal_fetchPromoInfo(accountPeerId: EnginePeer.Id, postbox: Postbox, ne
|
|||
transaction.updatePreferencesEntry(key: PreferencesKeys.serverSuggestionInfo(), { _ in
|
||||
return PreferencesEntry(suggestionInfo)
|
||||
})
|
||||
case let .promoData(flags, expires, peer, psaType, psaMessage, pendingSuggestions, dismissedSuggestions, customPendingSuggestion, chats, users):
|
||||
case let .promoData(promoDataData):
|
||||
let (flags, expires, peer, psaType, psaMessage, pendingSuggestions, dismissedSuggestions, customPendingSuggestion, chats, users) = (promoDataData.flags, promoDataData.expires, promoDataData.peer, promoDataData.psaType, promoDataData.psaMessage, promoDataData.pendingSuggestions, promoDataData.dismissedSuggestions, promoDataData.customPendingSuggestion, promoDataData.chats, promoDataData.users)
|
||||
let _ = expires
|
||||
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users)
|
||||
|
|
|
|||
|
|
@ -119,7 +119,8 @@ private func synchronizeConsumeMessageContents(transaction: Transaction, network
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -507,7 +507,8 @@ private func continueSynchronizeInstalledStickerPacks(transaction: Transaction,
|
|||
|
||||
var remoteCollectionInfos: [StickerPackCollectionInfo] = []
|
||||
switch result {
|
||||
case let .allStickers(_, sets):
|
||||
case let .allStickers(allStickersData):
|
||||
let sets = allStickersData.sets
|
||||
for apiSet in sets {
|
||||
let info = StickerPackCollectionInfo(apiSet: apiSet, namespace: collectionNamespace)
|
||||
remoteCollectionInfos.append(info)
|
||||
|
|
|
|||
|
|
@ -157,7 +157,8 @@ private func synchronizeMarkAllUnseen(transaction: Transaction, postbox: Postbox
|
|||
return network.request(Api.functions.messages.readMessageContents(id: filteredIds.map { $0.id }))
|
||||
|> map { result -> Int32? in
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
if ids.count < limit {
|
||||
|
|
@ -310,7 +311,8 @@ private func synchronizeMarkAllUnseenReactions(transaction: Transaction, postbox
|
|||
|> mapToSignal { result -> Signal<Void, Bool> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedHistory(pts, ptsCount, offset):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let (pts, ptsCount, offset) = (affectedHistoryData.pts, affectedHistoryData.ptsCount, affectedHistoryData.offset)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
if offset == 0 {
|
||||
return .fail(true)
|
||||
|
|
|
|||
|
|
@ -282,7 +282,8 @@ private func pushPeerReadState(network: Network, postbox: Postbox, stateManager:
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ public struct TermsOfServiceUpdate: Equatable {
|
|||
extension TermsOfServiceUpdate {
|
||||
init?(apiTermsOfService: Api.help.TermsOfService) {
|
||||
switch apiTermsOfService {
|
||||
case let .termsOfService(_, id, text, entities, minAgeConfirm):
|
||||
case let .termsOfService(termsOfServiceData):
|
||||
let (_, id, text, entities, minAgeConfirm) = (termsOfServiceData.flags, termsOfServiceData.id, termsOfServiceData.text, termsOfServiceData.entities, termsOfServiceData.minAgeConfirm)
|
||||
let idData: String
|
||||
switch id {
|
||||
case let .dataJSON(dataJSONData):
|
||||
|
|
@ -51,7 +52,8 @@ func managedTermsOfServiceUpdates(postbox: Postbox, network: Network, stateManag
|
|||
|> mapToSignal { [weak stateManager] result -> Signal<Void, NoError> in
|
||||
var updated: TermsOfServiceUpdate?
|
||||
switch result {
|
||||
case let .termsOfServiceUpdate(_, termsOfService):
|
||||
case let .termsOfServiceUpdate(termsOfServiceUpdateData):
|
||||
let (_, termsOfService) = (termsOfServiceUpdateData.expires, termsOfServiceUpdateData.termsOfService)
|
||||
updated = TermsOfServiceUpdate(apiTermsOfService: termsOfService)
|
||||
case .termsOfServiceUpdateEmpty:
|
||||
break
|
||||
|
|
|
|||
|
|
@ -747,7 +747,8 @@ func _internal_getBotApp(account: Account, reference: BotAppReference) -> Signal
|
|||
}
|
||||
|> mapToSignal { result -> Signal<BotApp, GetBotAppError> in
|
||||
switch result {
|
||||
case let .botApp(botAppFlags, app):
|
||||
case let .botApp(botAppData):
|
||||
let (botAppFlags, app) = (botAppData.flags, botAppData.app)
|
||||
switch app {
|
||||
case let .botApp(botAppData):
|
||||
let (flags, id, accessHash, shortName, title, description, photo, document, hash) = (botAppData.flags, botAppData.id, botAppData.accessHash, botAppData.shortName, botAppData.title, botAppData.description, botAppData.photo, botAppData.document, botAppData.hash)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ func _internal_clearCallHistory(account: Account, forEveryone: Bool) -> Signal<N
|
|||
|> mapToSignal { result -> Signal<Void, Bool> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedFoundMessages(pts, ptsCount, offset, _):
|
||||
case let .affectedFoundMessages(affectedFoundMessagesData):
|
||||
let (pts, ptsCount, offset) = (affectedFoundMessagesData.pts, affectedFoundMessagesData.ptsCount, affectedFoundMessagesData.offset)
|
||||
account.stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
if offset == 0 {
|
||||
return .fail(true)
|
||||
|
|
|
|||
|
|
@ -219,7 +219,8 @@ func _internal_clearAuthorHistory(account: Account, peerId: PeerId, memberId: Pe
|
|||
|> mapToSignal { result -> Signal<Void, Bool> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedHistory(pts, ptsCount, offset):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let (pts, ptsCount, offset) = (affectedHistoryData.pts, affectedHistoryData.ptsCount, affectedHistoryData.offset)
|
||||
account.stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
if offset == 0 {
|
||||
return .fail(true)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ func _internal_markAllChatsAsRead(postbox: Postbox, network: Network, stateManag
|
|||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
if let result = result {
|
||||
switch result {
|
||||
case let .affectedMessages(pts, ptsCount):
|
||||
case let .affectedMessages(affectedMessagesData):
|
||||
let (pts, ptsCount) = (affectedMessagesData.pts, affectedMessagesData.ptsCount)
|
||||
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,7 +146,8 @@ func _internal_requestMessageActionCallback(account: Account, messageId: Message
|
|||
return .none
|
||||
}
|
||||
switch result {
|
||||
case let .botCallbackAnswer(flags, message, url, _):
|
||||
case let .botCallbackAnswer(botCallbackAnswerData):
|
||||
let (flags, message, url) = (botCallbackAnswerData.flags, botCallbackAnswerData.message, botCallbackAnswerData.url)
|
||||
if let message = message {
|
||||
if (flags & (1 << 1)) != 0 {
|
||||
return .alert(message)
|
||||
|
|
|
|||
|
|
@ -85,7 +85,8 @@ func _internal_keepCachedTimeZoneListUpdated(account: Account) -> Signal<Never,
|
|||
|
||||
return account.postbox.transaction { transaction in
|
||||
switch result {
|
||||
case let .timezonesList(timezones, hash):
|
||||
case let .timezonesList(timezonesListData):
|
||||
let (timezones, hash) = (timezonesListData.timezones, timezonesListData.hash)
|
||||
var items: [TimeZoneList.Item] = []
|
||||
for item in timezones {
|
||||
switch item {
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ func _internal_requestUnpinAllMessages(account: Account, peerId: PeerId, threadI
|
|||
}
|
||||
|> mapToSignal { result -> Signal<Bool, InternalError> in
|
||||
switch result {
|
||||
case let .affectedHistory(_, _, count):
|
||||
case let .affectedHistory(affectedHistoryData):
|
||||
let count = affectedHistoryData.offset
|
||||
if count != 0 {
|
||||
return .fail(.restart)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ func _internal_supportPeerId(account: Account) -> Signal<PeerId?, NoError> {
|
|||
|> mapToSignal { support -> Signal<PeerId?, NoError> in
|
||||
if let support = support {
|
||||
switch support {
|
||||
case let .support(_, user):
|
||||
case let .support(supportData):
|
||||
let user = supportData.user
|
||||
return account.postbox.transaction { transaction -> PeerId in
|
||||
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: [], users: [user])
|
||||
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,8 @@ func _internal_archivedStickerPacks(account: Account, namespace: ArchivedSticker
|
|||
|> map { result -> [ArchivedStickerPackItem] in
|
||||
var archivedItems: [ArchivedStickerPackItem] = []
|
||||
switch result {
|
||||
case let .archivedStickers(_, sets):
|
||||
case let .archivedStickers(archivedStickersData):
|
||||
let sets = archivedStickersData.sets
|
||||
for set in sets {
|
||||
let (info, items) = parsePreviewStickerSet(set, namespace: namespace.itemCollectionNamespace)
|
||||
archivedItems.append(ArchivedStickerPackItem(info: info, topItems: items))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue