diff --git a/submodules/TelegramApi/Sources/Api31.swift b/submodules/TelegramApi/Sources/Api31.swift index a816a593f5..2e31c6b5fe 100644 --- a/submodules/TelegramApi/Sources/Api31.swift +++ b/submodules/TelegramApi/Sources/Api31.swift @@ -367,8 +367,30 @@ public extension Api.account { } public extension Api.auth { enum Authorization: TypeConstructorDescription { - case authorization(flags: Int32, otherwiseReloginDays: Int32?, tmpSessions: Int32?, futureAuthToken: Buffer?, user: Api.User) - case authorizationSignUpRequired(flags: Int32, termsOfService: Api.help.TermsOfService?) + public class Cons_authorization { + public var flags: Int32 + public var otherwiseReloginDays: Int32? + public var tmpSessions: Int32? + public var futureAuthToken: Buffer? + public var user: Api.User + public init(flags: Int32, otherwiseReloginDays: Int32?, tmpSessions: Int32?, futureAuthToken: Buffer?, user: Api.User) { + self.flags = flags + self.otherwiseReloginDays = otherwiseReloginDays + self.tmpSessions = tmpSessions + self.futureAuthToken = futureAuthToken + self.user = user + } + } + public class Cons_authorizationSignUpRequired { + public var flags: Int32 + public var termsOfService: Api.help.TermsOfService? + public init(flags: Int32, termsOfService: Api.help.TermsOfService?) { + self.flags = flags + self.termsOfService = termsOfService + } + } + case authorization(Cons_authorization) + case authorizationSignUpRequired(Cons_authorizationSignUpRequired) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -465,7 +487,15 @@ public extension Api.auth { } public extension Api.auth { enum ExportedAuthorization: TypeConstructorDescription { - case exportedAuthorization(id: Int64, bytes: Buffer) + public class Cons_exportedAuthorization { + public var id: Int64 + public var bytes: Buffer + public init(id: Int64, bytes: Buffer) { + self.id = id + self.bytes = bytes + } + } + case exportedAuthorization(Cons_exportedAuthorization) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -494,7 +524,15 @@ public extension Api.auth { } public extension Api.auth { enum LoggedOut: TypeConstructorDescription { - case loggedOut(flags: Int32, futureAuthToken: Buffer?) + public class Cons_loggedOut { + public var flags: Int32 + public var futureAuthToken: Buffer? + public init(flags: Int32, futureAuthToken: Buffer?) { + self.flags = flags + self.futureAuthToken = futureAuthToken + } + } + case loggedOut(Cons_loggedOut) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -523,9 +561,31 @@ public extension Api.auth { } public extension Api.auth { enum LoginToken: TypeConstructorDescription { - case loginToken(expires: Int32, token: Buffer) - case loginTokenMigrateTo(dcId: Int32, token: Buffer) - case loginTokenSuccess(authorization: Api.auth.Authorization) + public class Cons_loginToken { + public var expires: Int32 + public var token: Buffer + public init(expires: Int32, token: Buffer) { + self.expires = expires + self.token = token + } + } + public class Cons_loginTokenMigrateTo { + public var dcId: Int32 + public var token: Buffer + public init(dcId: Int32, token: Buffer) { + self.dcId = dcId + self.token = token + } + } + public class Cons_loginTokenSuccess { + public var authorization: Api.auth.Authorization + public init(authorization: Api.auth.Authorization) { + self.authorization = authorization + } + } + case loginToken(Cons_loginToken) + case loginTokenMigrateTo(Cons_loginTokenMigrateTo) + case loginTokenSuccess(Cons_loginTokenSuccess) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -568,7 +628,13 @@ public extension Api.auth { } public extension Api.auth { enum PasskeyLoginOptions: TypeConstructorDescription { - case passkeyLoginOptions(options: Api.DataJSON) + public class Cons_passkeyLoginOptions { + public var options: Api.DataJSON + public init(options: Api.DataJSON) { + self.options = options + } + } + case passkeyLoginOptions(Cons_passkeyLoginOptions) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -597,7 +663,13 @@ public extension Api.auth { } public extension Api.auth { enum PasswordRecovery: TypeConstructorDescription { - case passwordRecovery(emailPattern: String) + public class Cons_passwordRecovery { + public var emailPattern: String + public init(emailPattern: String) { + self.emailPattern = emailPattern + } + } + case passwordRecovery(Cons_passwordRecovery) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -626,9 +698,45 @@ public extension Api.auth { } public extension Api.auth { enum SentCode: TypeConstructorDescription { - case sentCode(flags: Int32, type: Api.auth.SentCodeType, phoneCodeHash: String, nextType: Api.auth.CodeType?, timeout: Int32?) - case sentCodePaymentRequired(storeProduct: String, phoneCodeHash: String, supportEmailAddress: String, supportEmailSubject: String, currency: String, amount: Int64) - case sentCodeSuccess(authorization: Api.auth.Authorization) + public class Cons_sentCode { + public var flags: Int32 + public var type: Api.auth.SentCodeType + public var phoneCodeHash: String + public var nextType: Api.auth.CodeType? + public var timeout: Int32? + public init(flags: Int32, type: Api.auth.SentCodeType, phoneCodeHash: String, nextType: Api.auth.CodeType?, timeout: Int32?) { + self.flags = flags + self.type = type + self.phoneCodeHash = phoneCodeHash + self.nextType = nextType + self.timeout = timeout + } + } + public class Cons_sentCodePaymentRequired { + public var storeProduct: String + public var phoneCodeHash: String + public var supportEmailAddress: String + public var supportEmailSubject: String + public var currency: String + public var amount: Int64 + public init(storeProduct: String, phoneCodeHash: String, supportEmailAddress: String, supportEmailSubject: String, currency: String, amount: Int64) { + self.storeProduct = storeProduct + self.phoneCodeHash = phoneCodeHash + self.supportEmailAddress = supportEmailAddress + self.supportEmailSubject = supportEmailSubject + self.currency = currency + self.amount = amount + } + } + public class Cons_sentCodeSuccess { + public var authorization: Api.auth.Authorization + public init(authorization: Api.auth.Authorization) { + self.authorization = authorization + } + } + case sentCode(Cons_sentCode) + case sentCodePaymentRequired(Cons_sentCodePaymentRequired) + case sentCodeSuccess(Cons_sentCodeSuccess) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -671,17 +779,111 @@ public extension Api.auth { } public extension Api.auth { enum SentCodeType: TypeConstructorDescription { - case sentCodeTypeApp(length: Int32) - case sentCodeTypeCall(length: Int32) - case sentCodeTypeEmailCode(flags: Int32, emailPattern: String, length: Int32, resetAvailablePeriod: Int32?, resetPendingDate: Int32?) - case sentCodeTypeFirebaseSms(flags: Int32, nonce: Buffer?, playIntegrityProjectId: Int64?, playIntegrityNonce: Buffer?, receipt: String?, pushTimeout: Int32?, length: Int32) - case sentCodeTypeFlashCall(pattern: String) - case sentCodeTypeFragmentSms(url: String, length: Int32) - case sentCodeTypeMissedCall(prefix: String, length: Int32) - case sentCodeTypeSetUpEmailRequired(flags: Int32) - case sentCodeTypeSms(length: Int32) - case sentCodeTypeSmsPhrase(flags: Int32, beginning: String?) - case sentCodeTypeSmsWord(flags: Int32, beginning: String?) + public class Cons_sentCodeTypeApp { + public var length: Int32 + public init(length: Int32) { + self.length = length + } + } + public class Cons_sentCodeTypeCall { + public var length: Int32 + public init(length: Int32) { + self.length = length + } + } + public class Cons_sentCodeTypeEmailCode { + public var flags: Int32 + public var emailPattern: String + public var length: Int32 + public var resetAvailablePeriod: Int32? + public var resetPendingDate: Int32? + public init(flags: Int32, emailPattern: String, length: Int32, resetAvailablePeriod: Int32?, resetPendingDate: Int32?) { + self.flags = flags + self.emailPattern = emailPattern + self.length = length + self.resetAvailablePeriod = resetAvailablePeriod + self.resetPendingDate = resetPendingDate + } + } + public class Cons_sentCodeTypeFirebaseSms { + public var flags: Int32 + public var nonce: Buffer? + public var playIntegrityProjectId: Int64? + public var playIntegrityNonce: Buffer? + public var receipt: String? + public var pushTimeout: Int32? + public var length: Int32 + public init(flags: Int32, nonce: Buffer?, playIntegrityProjectId: Int64?, playIntegrityNonce: Buffer?, receipt: String?, pushTimeout: Int32?, length: Int32) { + self.flags = flags + self.nonce = nonce + self.playIntegrityProjectId = playIntegrityProjectId + self.playIntegrityNonce = playIntegrityNonce + self.receipt = receipt + self.pushTimeout = pushTimeout + self.length = length + } + } + public class Cons_sentCodeTypeFlashCall { + public var pattern: String + public init(pattern: String) { + self.pattern = pattern + } + } + public class Cons_sentCodeTypeFragmentSms { + public var url: String + public var length: Int32 + public init(url: String, length: Int32) { + self.url = url + self.length = length + } + } + public class Cons_sentCodeTypeMissedCall { + public var prefix: String + public var length: Int32 + public init(prefix: String, length: Int32) { + self.prefix = prefix + self.length = length + } + } + public class Cons_sentCodeTypeSetUpEmailRequired { + public var flags: Int32 + public init(flags: Int32) { + self.flags = flags + } + } + public class Cons_sentCodeTypeSms { + public var length: Int32 + public init(length: Int32) { + self.length = length + } + } + public class Cons_sentCodeTypeSmsPhrase { + public var flags: Int32 + public var beginning: String? + public init(flags: Int32, beginning: String?) { + self.flags = flags + self.beginning = beginning + } + } + public class Cons_sentCodeTypeSmsWord { + public var flags: Int32 + public var beginning: String? + public init(flags: Int32, beginning: String?) { + self.flags = flags + self.beginning = beginning + } + } + case sentCodeTypeApp(Cons_sentCodeTypeApp) + case sentCodeTypeCall(Cons_sentCodeTypeCall) + case sentCodeTypeEmailCode(Cons_sentCodeTypeEmailCode) + case sentCodeTypeFirebaseSms(Cons_sentCodeTypeFirebaseSms) + case sentCodeTypeFlashCall(Cons_sentCodeTypeFlashCall) + case sentCodeTypeFragmentSms(Cons_sentCodeTypeFragmentSms) + case sentCodeTypeMissedCall(Cons_sentCodeTypeMissedCall) + case sentCodeTypeSetUpEmailRequired(Cons_sentCodeTypeSetUpEmailRequired) + case sentCodeTypeSms(Cons_sentCodeTypeSms) + case sentCodeTypeSmsPhrase(Cons_sentCodeTypeSmsPhrase) + case sentCodeTypeSmsWord(Cons_sentCodeTypeSmsWord) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG diff --git a/submodules/TelegramApi/Sources/Api32.swift b/submodules/TelegramApi/Sources/Api32.swift index 2fba453060..2868232242 100644 --- a/submodules/TelegramApi/Sources/Api32.swift +++ b/submodules/TelegramApi/Sources/Api32.swift @@ -1,6 +1,16 @@ public extension Api.bots { enum BotInfo: TypeConstructorDescription { - case botInfo(name: String, about: String, description: String) + public class Cons_botInfo { + public var name: String + public var about: String + public var description: String + public init(name: String, about: String, description: String) { + self.name = name + self.about = about + self.description = description + } + } + case botInfo(Cons_botInfo) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -29,7 +39,17 @@ public extension Api.bots { } public extension Api.bots { enum PopularAppBots: TypeConstructorDescription { - case popularAppBots(flags: Int32, nextOffset: String?, users: [Api.User]) + public class Cons_popularAppBots { + public var flags: Int32 + public var nextOffset: String? + public var users: [Api.User] + public init(flags: Int32, nextOffset: String?, users: [Api.User]) { + self.flags = flags + self.nextOffset = nextOffset + self.users = users + } + } + case popularAppBots(Cons_popularAppBots) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -58,7 +78,15 @@ public extension Api.bots { } public extension Api.bots { enum PreviewInfo: TypeConstructorDescription { - case previewInfo(media: [Api.BotPreviewMedia], langCodes: [String]) + public class Cons_previewInfo { + public var media: [Api.BotPreviewMedia] + public var langCodes: [String] + public init(media: [Api.BotPreviewMedia], langCodes: [String]) { + self.media = media + self.langCodes = langCodes + } + } + case previewInfo(Cons_previewInfo) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -87,7 +115,17 @@ public extension Api.bots { } public extension Api.channels { enum AdminLogResults: TypeConstructorDescription { - case adminLogResults(events: [Api.ChannelAdminLogEvent], chats: [Api.Chat], users: [Api.User]) + public class Cons_adminLogResults { + public var events: [Api.ChannelAdminLogEvent] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(events: [Api.ChannelAdminLogEvent], chats: [Api.Chat], users: [Api.User]) { + self.events = events + self.chats = chats + self.users = users + } + } + case adminLogResults(Cons_adminLogResults) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -116,7 +154,17 @@ public extension Api.channels { } public extension Api.channels { enum ChannelParticipant: TypeConstructorDescription { - case channelParticipant(participant: Api.ChannelParticipant, chats: [Api.Chat], users: [Api.User]) + public class Cons_channelParticipant { + public var participant: Api.ChannelParticipant + public var chats: [Api.Chat] + public var users: [Api.User] + public init(participant: Api.ChannelParticipant, chats: [Api.Chat], users: [Api.User]) { + self.participant = participant + self.chats = chats + self.users = users + } + } + case channelParticipant(Cons_channelParticipant) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -145,7 +193,19 @@ public extension Api.channels { } public extension Api.channels { enum ChannelParticipants: TypeConstructorDescription { - case channelParticipants(count: Int32, participants: [Api.ChannelParticipant], chats: [Api.Chat], users: [Api.User]) + public class Cons_channelParticipants { + public var count: Int32 + public var participants: [Api.ChannelParticipant] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(count: Int32, participants: [Api.ChannelParticipant], chats: [Api.Chat], users: [Api.User]) { + self.count = count + self.participants = participants + self.chats = chats + self.users = users + } + } + case channelParticipants(Cons_channelParticipants) case channelParticipantsNotModified public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -182,7 +242,17 @@ public extension Api.channels { } public extension Api.channels { enum SendAsPeers: TypeConstructorDescription { - case sendAsPeers(peers: [Api.SendAsPeer], chats: [Api.Chat], users: [Api.User]) + public class Cons_sendAsPeers { + public var peers: [Api.SendAsPeer] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(peers: [Api.SendAsPeer], chats: [Api.Chat], users: [Api.User]) { + self.peers = peers + self.chats = chats + self.users = users + } + } + case sendAsPeers(Cons_sendAsPeers) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -211,8 +281,16 @@ public extension Api.channels { } public extension Api.channels { enum SponsoredMessageReportResult: TypeConstructorDescription { + public class Cons_sponsoredMessageReportResultChooseOption { + public var title: String + public var options: [Api.SponsoredMessageReportOption] + public init(title: String, options: [Api.SponsoredMessageReportOption]) { + self.title = title + self.options = options + } + } case sponsoredMessageReportResultAdsHidden - case sponsoredMessageReportResultChooseOption(title: String, options: [Api.SponsoredMessageReportOption]) + case sponsoredMessageReportResultChooseOption(Cons_sponsoredMessageReportResultChooseOption) case sponsoredMessageReportResultReported public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -256,8 +334,38 @@ public extension Api.channels { } public extension Api.chatlists { enum ChatlistInvite: TypeConstructorDescription { - case chatlistInvite(flags: Int32, title: Api.TextWithEntities, emoticon: String?, peers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) - case chatlistInviteAlready(filterId: Int32, missingPeers: [Api.Peer], alreadyPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) + public class Cons_chatlistInvite { + public var flags: Int32 + public var title: Api.TextWithEntities + public var emoticon: String? + public var peers: [Api.Peer] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(flags: Int32, title: Api.TextWithEntities, emoticon: String?, peers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) { + self.flags = flags + self.title = title + self.emoticon = emoticon + self.peers = peers + self.chats = chats + self.users = users + } + } + public class Cons_chatlistInviteAlready { + public var filterId: Int32 + public var missingPeers: [Api.Peer] + public var alreadyPeers: [Api.Peer] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(filterId: Int32, missingPeers: [Api.Peer], alreadyPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) { + self.filterId = filterId + self.missingPeers = missingPeers + self.alreadyPeers = alreadyPeers + self.chats = chats + self.users = users + } + } + case chatlistInvite(Cons_chatlistInvite) + case chatlistInviteAlready(Cons_chatlistInviteAlready) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -293,7 +401,17 @@ public extension Api.chatlists { } public extension Api.chatlists { enum ChatlistUpdates: TypeConstructorDescription { - case chatlistUpdates(missingPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) + public class Cons_chatlistUpdates { + public var missingPeers: [Api.Peer] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(missingPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User]) { + self.missingPeers = missingPeers + self.chats = chats + self.users = users + } + } + case chatlistUpdates(Cons_chatlistUpdates) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG @@ -322,7 +440,15 @@ public extension Api.chatlists { } public extension Api.chatlists { enum ExportedChatlistInvite: TypeConstructorDescription { - case exportedChatlistInvite(filter: Api.DialogFilter, invite: Api.ExportedChatlistInvite) + public class Cons_exportedChatlistInvite { + public var filter: Api.DialogFilter + public var invite: Api.ExportedChatlistInvite + public init(filter: Api.DialogFilter, invite: Api.ExportedChatlistInvite) { + self.filter = filter + self.invite = invite + } + } + case exportedChatlistInvite(Cons_exportedChatlistInvite) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { #if DEBUG diff --git a/submodules/TelegramCore/Sources/Account/Account.swift b/submodules/TelegramCore/Sources/Account/Account.swift index b7fb147048..3719c1f735 100644 --- a/submodules/TelegramCore/Sources/Account/Account.swift +++ b/submodules/TelegramCore/Sources/Account/Account.swift @@ -121,7 +121,8 @@ public class UnauthorizedAccount { switch sentCode { case .sentCodePaymentRequired: break - case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) let _ = postbox.transaction({ transaction in var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { @@ -131,20 +132,22 @@ public class UnauthorizedAccount { transaction.setState(UnauthorizedAccountState(isTestingEnvironment: testingEnvironment, masterDatacenterId: masterDatacenterId, contents: .confirmationCodeEntry(number: phoneNumber, type: SentAuthorizationCodeType(apiType: type), hash: phoneCodeHash, timeout: codeTimeout, nextType: parsedNextType, syncContacts: syncContacts, previousCodeEntry: nil, usePrevious: false))) } }).start() - case let .sentCodeSuccess(authorization): + case let .sentCodeSuccess(sentCodeSuccessData): + let authorization = sentCodeSuccessData.authorization switch authorization { - case let .authorization(_, _, _, futureAuthToken, user): + case let .authorization(authorizationData): + let (futureAuthToken, apiUser) = (authorizationData.futureAuthToken, authorizationData.user) let _ = postbox.transaction({ [weak self] transaction in var syncContacts = true if let state = transaction.getState() as? UnauthorizedAccountState, case let .payment(_, _, _, _, _, syncContactsValue) = state.contents { syncContacts = syncContactsValue } - + if let futureAuthToken = futureAuthToken { storeFutureLoginToken(accountManager: accountManager, token: futureAuthToken.makeData()) } - - let user = TelegramUser(user: user) + + let user = TelegramUser(user: apiUser) var isSupportUser = false if let phone = user.phone, phone.hasPrefix("42"), phone.count <= 5 { isSupportUser = true @@ -159,7 +162,8 @@ public class UnauthorizedAccount { return .loggedIn } }).start() - case let .authorizationSignUpRequired(_, termsOfService): + case let .authorizationSignUpRequired(authorizationSignUpRequiredData): + let termsOfService = authorizationSignUpRequiredData.termsOfService let _ = postbox.transaction({ [weak self] transaction in if let self { if let state = transaction.getState() as? UnauthorizedAccountState, case let .payment(number, codeHash, _, _, _, syncContacts) = state.contents { @@ -583,7 +587,8 @@ func _internal_requestPasskeyLoginData(network: Network, apiId: Int32, apiHash: return nil } switch result { - case let .passkeyLoginOptions(options): + case let .passkeyLoginOptions(passkeyLoginOptionsData): + let options = passkeyLoginOptionsData.options switch options { case let .dataJSON(dataJSONData): let data = dataJSONData.data diff --git a/submodules/TelegramCore/Sources/Account/AccountManager.swift b/submodules/TelegramCore/Sources/Account/AccountManager.swift index 9897b02c2c..6a875e9f71 100644 --- a/submodules/TelegramCore/Sources/Account/AccountManager.swift +++ b/submodules/TelegramCore/Sources/Account/AccountManager.swift @@ -502,7 +502,8 @@ private func cleanupAccount(networkArguments: NetworkInitializationArguments, ac } |> mapToSignal { result -> Signal in switch result { - case let .loggedOut(_, futureAuthToken): + case let .loggedOut(loggedOutData): + let futureAuthToken = loggedOutData.futureAuthToken if let futureAuthToken = futureAuthToken { storeFutureLoginToken(accountManager: accountManager, token: futureAuthToken.makeData()) } diff --git a/submodules/TelegramCore/Sources/Authorization.swift b/submodules/TelegramCore/Sources/Authorization.swift index 5e0b2a60a4..b3703ada16 100644 --- a/submodules/TelegramCore/Sources/Authorization.swift +++ b/submodules/TelegramCore/Sources/Authorization.swift @@ -269,14 +269,16 @@ public func sendAuthorizationCode(accountManager: AccountManager map { mapping -> String? in guard let receipt = receipt else { @@ -360,14 +362,16 @@ public func sendAuthorizationCode(accountManager: AccountManager mapToSignal { sentCode -> Signal in return account.postbox.transaction { transaction -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) let parsedType = SentAuthorizationCodeType(apiType: type) var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { parsedNextType = AuthorizationCodeNextType(apiType: nextType) } - - if case let .sentCodeTypeFirebaseSms(_, _, _, _, receipt, pushTimeout, _) = type { + + if case let .sentCodeTypeFirebaseSms(sentCodeTypeFirebaseSmsData) = type { + let (receipt, pushTimeout) = (sentCodeTypeFirebaseSmsData.receipt, sentCodeTypeFirebaseSmsData.pushTimeout) return firebaseSecretStream |> map { mapping -> String? in guard let receipt = receipt else { @@ -520,7 +526,8 @@ private func internalResendAuthorizationCode(accountManager: AccountManager mapToSignal { sentCode -> Signal in return account.postbox.transaction { transaction -> Signal in switch sentCode { - case let .sentCode(_, newType, phoneCodeHash, nextType, codeTimeout): + case let .sentCode(sentCodeData): + let (newType, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) let parsedType = SentAuthorizationCodeType(apiType: newType) var previousCodeEntry: UnauthorizedAccountStateContents? if let previousCodeEntryValue { @@ -581,7 +589,8 @@ public func resendAuthorizationCode(accountManager: AccountManager map { mapping -> String? in guard let receipt = receipt else { @@ -628,7 +637,8 @@ public func resendAuthorizationCode(accountManager: AccountManager mapToSignal { sentCode -> Signal in return account.postbox.transaction { transaction -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { parsedNextType = AuthorizationCodeNextType(apiType: nextType) } - + transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .confirmationCodeEntry(number: phoneNumber, type: SentAuthorizationCodeType(apiType: type), hash: phoneCodeHash, timeout: codeTimeout, nextType: parsedNextType, syncContacts: syncContacts, previousCodeEntry: nil, usePrevious: false))) - + return .complete() - case let .sentCodePaymentRequired(storeProduct, codeHash, supportEmailAddress, supportEmailSubject, _, _): + case let .sentCodePaymentRequired(sentCodePaymentRequiredData): + let (storeProduct, codeHash, supportEmailAddress, supportEmailSubject) = (sentCodePaymentRequiredData.storeProduct, sentCodePaymentRequiredData.phoneCodeHash, sentCodePaymentRequiredData.supportEmailAddress, sentCodePaymentRequiredData.supportEmailSubject) transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .payment(number: phoneNumber, codeHash: codeHash, storeProduct: storeProduct, supportEmailAddress: supportEmailAddress, supportEmailSubject: supportEmailSubject, syncContacts: syncContacts))) return .complete() case .sentCodeSuccess: @@ -1073,14 +1087,15 @@ public func authorizeWithCode(accountManager: AccountManager mapToSignal { result -> Signal in return account.postbox.transaction { transaction -> Signal in switch result { - case let .authorization(_, _, _, futureAuthToken, user): + case let .authorization(authorizationData): + let (futureAuthToken, apiUser) = (authorizationData.futureAuthToken, authorizationData.user) if let futureAuthToken = futureAuthToken { storeFutureLoginToken(accountManager: accountManager, token: futureAuthToken.makeData()) } - - let user = TelegramUser(user: user) + + let user = TelegramUser(user: apiUser) let state = AuthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, peerId: user.id, state: nil, invalidatedChannels: []) /*transaction.updatePeersInternal([user], update: { current, peer -> Peer? in return peer @@ -1269,14 +1286,15 @@ public func authorizeWithPasskey(accountManager: AccountManager, account: UnauthorizedAccount, recoveredAccountData: RecoveredAccountData, syncContacts: Bool) -> Signal { return account.postbox.transaction { transaction -> Signal in switch recoveredAccountData.authorization { - case let .authorization(_, _, _, futureAuthToken, user): + case let .authorization(authorizationData): + let (futureAuthToken, apiUser) = (authorizationData.futureAuthToken, authorizationData.user) if let futureAuthToken = futureAuthToken { storeFutureLoginToken(accountManager: accountManager, token: futureAuthToken.makeData()) } - - let user = TelegramUser(user: user) + + let user = TelegramUser(user: apiUser) var isSupportUser = false if let phone = user.phone, phone.hasPrefix("42") { isSupportUser = true @@ -1503,12 +1522,13 @@ public func signUpWithName(accountManager: AccountManager mapToSignal { result -> Signal in switch result { - case let .authorization(_, otherwiseReloginDays, _, futureAuthToken, user): + case let .authorization(authorizationData): + let (otherwiseReloginDays, futureAuthToken, apiUser) = (authorizationData.otherwiseReloginDays, authorizationData.futureAuthToken, authorizationData.user) if let futureAuthToken = futureAuthToken { storeFutureLoginToken(accountManager: accountManager, token: futureAuthToken.makeData()) } - - let user = TelegramUser(user: user) + + let user = TelegramUser(user: apiUser) var isSupportUser = false if let phone = user.phone, phone.hasPrefix("42") { isSupportUser = true @@ -1525,7 +1545,7 @@ public func signUpWithName(accountManager: AccountManager castError(SignUpError.self) - + let switchedAccounts = accountManager.transaction { transaction -> Void in switchToAuthorizedAccount(transaction: transaction, account: account, isSupportUser: isSupportUser) } diff --git a/submodules/TelegramCore/Sources/State/AccountState.swift b/submodules/TelegramCore/Sources/State/AccountState.swift index 0ccf4e829f..d69f095c08 100644 --- a/submodules/TelegramCore/Sources/State/AccountState.swift +++ b/submodules/TelegramCore/Sources/State/AccountState.swift @@ -21,27 +21,38 @@ extension UnauthorizedAccountTermsOfService { extension SentAuthorizationCodeType { init(apiType: Api.auth.SentCodeType) { switch apiType { - case let .sentCodeTypeApp(length): + case let .sentCodeTypeApp(sentCodeTypeAppData): + let length = sentCodeTypeAppData.length self = .otherSession(length: length) - case let .sentCodeTypeSms(length): + case let .sentCodeTypeSms(sentCodeTypeSmsData): + let length = sentCodeTypeSmsData.length self = .sms(length: length) - case let .sentCodeTypeCall(length): + case let .sentCodeTypeCall(sentCodeTypeCallData): + let length = sentCodeTypeCallData.length self = .call(length: length) - case let .sentCodeTypeFlashCall(pattern): + case let .sentCodeTypeFlashCall(sentCodeTypeFlashCallData): + let pattern = sentCodeTypeFlashCallData.pattern self = .flashCall(pattern: pattern) - case let .sentCodeTypeMissedCall(prefix, length): + case let .sentCodeTypeMissedCall(sentCodeTypeMissedCallData): + let (prefix, length) = (sentCodeTypeMissedCallData.prefix, sentCodeTypeMissedCallData.length) self = .missedCall(numberPrefix: prefix, length: length) - case let .sentCodeTypeEmailCode(flags, emailPattern, length, resetAvailablePeriod, resetPendingDate): + case let .sentCodeTypeEmailCode(sentCodeTypeEmailCodeData): + let (flags, emailPattern, length, resetAvailablePeriod, resetPendingDate) = (sentCodeTypeEmailCodeData.flags, sentCodeTypeEmailCodeData.emailPattern, sentCodeTypeEmailCodeData.length, sentCodeTypeEmailCodeData.resetAvailablePeriod, sentCodeTypeEmailCodeData.resetPendingDate) self = .email(emailPattern: emailPattern, length: length, resetAvailablePeriod: resetAvailablePeriod, resetPendingDate: resetPendingDate, appleSignInAllowed: (flags & (1 << 0)) != 0, setup: false) - case let .sentCodeTypeSetUpEmailRequired(flags): + case let .sentCodeTypeSetUpEmailRequired(sentCodeTypeSetUpEmailRequiredData): + let flags = sentCodeTypeSetUpEmailRequiredData.flags self = .emailSetupRequired(appleSignInAllowed: (flags & (1 << 0)) != 0) - case let .sentCodeTypeFragmentSms(url, length): + case let .sentCodeTypeFragmentSms(sentCodeTypeFragmentSmsData): + let (url, length) = (sentCodeTypeFragmentSmsData.url, sentCodeTypeFragmentSmsData.length) self = .fragment(url: url, length: length) - case let .sentCodeTypeFirebaseSms(_, _, _, _, _, pushTimeout, length): + case let .sentCodeTypeFirebaseSms(sentCodeTypeFirebaseSmsData): + let (pushTimeout, length) = (sentCodeTypeFirebaseSmsData.pushTimeout, sentCodeTypeFirebaseSmsData.length) self = .firebase(pushTimeout: pushTimeout, length: length) - case let .sentCodeTypeSmsWord(_, beginning): + case let .sentCodeTypeSmsWord(sentCodeTypeSmsWordData): + let beginning = sentCodeTypeSmsWordData.beginning self = .word(startsWith: beginning) - case let .sentCodeTypeSmsPhrase(_, beginning): + case let .sentCodeTypeSmsPhrase(sentCodeTypeSmsPhraseData): + let beginning = sentCodeTypeSmsPhraseData.beginning self = .phrase(startsWith: beginning) } } diff --git a/submodules/TelegramCore/Sources/State/Serialization.swift b/submodules/TelegramCore/Sources/State/Serialization.swift index 33d02566a5..e1003fb62f 100644 --- a/submodules/TelegramCore/Sources/State/Serialization.swift +++ b/submodules/TelegramCore/Sources/State/Serialization.swift @@ -227,7 +227,8 @@ public class Serialization: NSObject, MTSerialization { return { data -> MTExportedAuthorizationData? in if let exported = functionContext.2.parse(Buffer(data: data)) { switch exported { - case let .exportedAuthorization(id, bytes): + case let .exportedAuthorization(exportedAuthorizationData): + let (id, bytes) = (exportedAuthorizationData.id, exportedAuthorizationData.bytes) return MTExportedAuthorizationData(authorizationBytes: bytes.makeData(), authorizationId: id) } } else { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift b/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift index 408ec3907d..cf2d9622fb 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/AccountData/ChangeAccountPhoneNumber.swift @@ -66,13 +66,15 @@ func _internal_requestChangeAccountPhoneNumberVerification(account: Account, api } |> mapToSignal { sentCode -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { parsedNextType = AuthorizationCodeNextType(apiType: nextType) } - - if case let .sentCodeTypeFirebaseSms(_, _, _, _, receipt, pushTimeout, _) = type { + + if case let .sentCodeTypeFirebaseSms(sentCodeTypeFirebaseSmsData) = type { + let (receipt, pushTimeout) = (sentCodeTypeFirebaseSmsData.receipt, sentCodeTypeFirebaseSmsData.pushTimeout) return firebaseSecretStream |> map { mapping -> String? in guard let receipt = receipt else { @@ -141,13 +143,15 @@ private func internalResendChangeAccountPhoneNumberVerification(account: Account } |> mapToSignal { sentCode -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, codeTimeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, codeTimeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { parsedNextType = AuthorizationCodeNextType(apiType: nextType) } - - if case let .sentCodeTypeFirebaseSms(_, _, _, _, receipt, pushTimeout, _) = type { + + if case let .sentCodeTypeFirebaseSms(sentCodeTypeFirebaseSmsData) = type { + let (receipt, pushTimeout) = (sentCodeTypeFirebaseSmsData.receipt, sentCodeTypeFirebaseSmsData.pushTimeout) return firebaseSecretStream |> map { mapping -> String? in guard let receipt = receipt else { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift index d58a34258c..21f14a3cfc 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift @@ -53,9 +53,11 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager castError(ExportAuthTransferTokenError.self) @@ -92,15 +94,17 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager Signal in - let user = TelegramUser(user: user) + let user = TelegramUser(user: apiUser) let state = AuthorizedAccountState(isTestingEnvironment: updatedAccount.testingEnvironment, masterDatacenterId: updatedAccount.masterDatacenterId, peerId: user.id, state: nil, invalidatedChannels: []) initializedAppSettingsAfterLogin(transaction: transaction, appVersion: updatedAccount.networkArguments.appVersion, syncContacts: syncContacts) transaction.setState(state) @@ -120,15 +124,17 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager Signal in - let user = TelegramUser(user: user) + let user = TelegramUser(user: apiUser) let state = AuthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, peerId: user.id, state: nil, invalidatedChannels: []) initializedAppSettingsAfterLogin(transaction: transaction, appVersion: account.networkArguments.appVersion, syncContacts: syncContacts) transaction.setState(state) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift index e94124a5d4..b4fbc32915 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/CancelAccountReset.swift @@ -28,7 +28,8 @@ func _internal_requestCancelAccountResetData(network: Network, hash: String) -> } |> mapToSignal { sentCode -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, timeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, timeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { parsedNextType = AuthorizationCodeNextType(apiType: nextType) @@ -51,7 +52,8 @@ func _internal_requestNextCancelAccountResetOption(network: Network, phoneNumber } |> mapToSignal { sentCode -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, timeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, timeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) var parsedNextType: AuthorizationCodeNextType? if let nextType = nextType { parsedNextType = AuthorizationCodeNextType(apiType: nextType) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift index 30d31b5600..d0e005a8ae 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/TwoStepVerification.swift @@ -330,7 +330,8 @@ func _internal_requestTwoStepVerificationPasswordRecoveryCode(network: Network) } |> map { result -> String in switch result { - case let .passwordRecovery(emailPattern): + case let .passwordRecovery(passwordRecoveryData): + let (emailPattern) = (passwordRecoveryData.emailPattern) return emailPattern } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/ReportAds.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/ReportAds.swift index a87fbf6c37..2bfc245931 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/ReportAds.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/ReportAds.swift @@ -29,7 +29,8 @@ func _internal_reportAdMessage(account: Account, opaqueId: Data, option: Data?) } |> map { result -> ReportAdMessageResult in switch result { - case let .sponsoredMessageReportResultChooseOption(title, options): + case let .sponsoredMessageReportResultChooseOption(sponsoredMessageReportResultChooseOptionData): + let (title, options) = (sponsoredMessageReportResultChooseOptionData.title, sponsoredMessageReportResultChooseOptionData.options) return .options(title: title, options: options.map { switch $0 { case let .sponsoredMessageReportOption(sponsoredMessageReportOptionData): diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/SendAsPeers.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/SendAsPeers.swift index d2329efa37..67aa4096db 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/SendAsPeers.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/SendAsPeers.swift @@ -130,7 +130,8 @@ func _internal_peerSendAsAvailablePeers(accountPeerId: PeerId, network: Network, return .single([]) } switch result { - case let .sendAsPeers(sendAsPeers, chats, _): + case let .sendAsPeers(sendAsPeersData): + let (sendAsPeers, chats) = (sendAsPeersData.peers, sendAsPeersData.chats) return postbox.transaction { transaction -> [SendAsPeer] in var subscribers: [PeerId: Int32] = [:] let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: []) @@ -289,7 +290,8 @@ func _internal_liveStorySendAsAvailablePeers(account: Account, peerId: PeerId) - return .single([]) } switch result { - case let .sendAsPeers(sendAsPeers, chats, _): + case let .sendAsPeers(sendAsPeersData): + let (sendAsPeers, chats) = (sendAsPeersData.peers, sendAsPeersData.chats) return account.postbox.transaction { transaction -> [SendAsPeer] in var subscribers: [PeerId: Int32] = [:] let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: []) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift index dba7528382..60f0512b42 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelAdminEventLogs.swift @@ -168,7 +168,8 @@ func channelAdminLogEvents(accountPeerId: PeerId, postbox: Postbox, network: Net return network.request(Api.functions.channels.getAdminLog(flags: flags, channel: inputChannel, q: query ?? "", eventsFilter: eventsFilter, admins: inputAdmins, maxId: maxId, minId: minId, limit: limit)) |> mapToSignal { result in switch result { - case let .adminLogResults(apiEvents, apiChats, apiUsers): + case let .adminLogResults(adminLogResultsData): + let (apiEvents, apiChats, apiUsers) = (adminLogResultsData.events, adminLogResultsData.chats, adminLogResultsData.users) return postbox.transaction { transaction -> AdminLogEventsResult in var peers: [PeerId: Peer] = [:] for apiChat in apiChats { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift index 0b9f98b653..c90272d402 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelMembers.swift @@ -95,7 +95,8 @@ func _internal_channelMembers(postbox: Postbox, network: Network, accountPeerId: return postbox.transaction { transaction -> [RenderedChannelParticipant]? in var items: [RenderedChannelParticipant] = [] switch result { - case let .channelParticipants(_, participants, chats, users): + case let .channelParticipants(channelParticipantsData): + let (participants, chats, users) = (channelParticipantsData.participants, channelParticipantsData.chats, channelParticipantsData.users) let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users) updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers) var peers: [PeerId: Peer] = [:] diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelRecommendation.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelRecommendation.swift index 1904932c4c..8f3269fb4c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelRecommendation.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ChannelRecommendation.swift @@ -167,7 +167,8 @@ func _internal_requestRecommendedApps(account: Account, forceUpdate: Bool) -> Si let users: [Api.User] let parsedPeers: AccumulatedPeers switch result { - case let .popularAppBots(_, nextOffset, apiUsers): + case let .popularAppBots(popularAppBotsData): + let (nextOffset, apiUsers) = (popularAppBotsData.nextOffset, popularAppBotsData.users) let _ = nextOffset users = apiUsers } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift index 2b9b1f485e..7f7677416d 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/Communities.swift @@ -121,7 +121,8 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String |> mapToSignal { result -> Signal in return account.postbox.transaction { transaction -> Signal in switch result { - case let .exportedChatlistInvite(filter, invite): + case let .exportedChatlistInvite(exportedChatlistInviteData): + let (filter, invite) = (exportedChatlistInviteData.filter, exportedChatlistInviteData.invite) let parsedFilter = ChatListFilter(apiFilter: filter) let _ = updateChatListFiltersState(transaction: transaction, { state in @@ -276,7 +277,8 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal mapToSignal { result -> Signal in return account.postbox.transaction { transaction -> ChatFolderLinkContents in switch result { - case let .chatlistInvite(flags, title, emoticon, peers, chats, users): + case let .chatlistInvite(chatlistInviteData): + let (flags, title, emoticon, peers, chats, users) = (chatlistInviteData.flags, chatlistInviteData.title, chatlistInviteData.emoticon, chatlistInviteData.peers, chatlistInviteData.chats, chatlistInviteData.users) let _ = emoticon let disableTitleAnimation = (flags & (1 << 1)) != 0 @@ -317,7 +319,8 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal S |> ignoreValues } switch result { - case let .chatlistUpdates(missingPeers, chats, users): + case let .chatlistUpdates(chatlistUpdatesData): + let (missingPeers, chats, users) = (chatlistUpdatesData.missingPeers, chatlistUpdatesData.chats, chatlistUpdatesData.users) return account.postbox.transaction { transaction -> Void in let parsedPeers = AccumulatedPeers(transaction: transaction, chats: chats, users: users) var memberCounts: [ChatListFiltersState.ChatListFilterUpdates.MemberCount] = [] diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift index 94dacbdc8c..5bf4891b4f 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift @@ -67,7 +67,8 @@ func _internal_joinChannel(account: Account, peerId: PeerId, hash: String?) -> S } let updatedParticipant: ChannelParticipant switch result { - case let .channelParticipant(participant, _, _): + case let .channelParticipant(channelParticipantData): + let participant = channelParticipantData.participant updatedParticipant = ChannelParticipant(apiParticipant: participant) } if case let .member(_, _, maybeAdminInfo, _, _, _) = updatedParticipant { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift index 80c2585b7b..1adef9f72e 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/PeerAdmins.swift @@ -133,7 +133,8 @@ func _internal_fetchChannelParticipant(account: Account, peerId: PeerId, partici return account.network.request(Api.functions.channels.getParticipant(channel: inputChannel, participant: inputPeer)) |> map { result -> ChannelParticipant? in switch result { - case let .channelParticipant(participant, _, _): + case let .channelParticipant(channelParticipantData): + let participant = channelParticipantData.participant return ChannelParticipant(apiParticipant: participant) } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift index 7a190f0b39..339a585720 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/UpdateCachedPeerData.swift @@ -193,7 +193,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee |> mapToSignal { result -> Signal in if let result = result { switch result { - case let .botInfo(name, about, description): + case let .botInfo(botInfoData): + let (name, about, description) = (botInfoData.name, botInfoData.about, botInfoData.description) return .single(EditableBotInfo(name: name, about: about, description: description)) } } else { @@ -753,7 +754,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee if let participantResult = participantResult { switch participantResult { - case let .channelParticipant(_, chats, users): + case let .channelParticipant(channelParticipantData): + let (chats, users) = (channelParticipantData.chats, channelParticipantData.users) parsedPeers = parsedPeers.union(with: AccumulatedPeers(transaction: transaction, chats: chats, users: users)) } } @@ -786,7 +788,8 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee var invitedOn: Int32? if let participantResult = participantResult { switch participantResult { - case let .channelParticipant(participant, _, _): + case let .channelParticipant(channelParticipantData): + let participant = channelParticipantData.participant switch participant { case let .channelParticipantSelf(channelParticipantSelfData): let (flags, inviterId, invitedDate) = (channelParticipantSelfData.flags, channelParticipantSelfData.inviterId, channelParticipantSelfData.date) @@ -962,7 +965,8 @@ func _internal_requestBotAdminPreview(network: Network, peerId: PeerId, inputUse return nil } switch result { - case let .previewInfo(media, langCodes): + case let .previewInfo(previewInfoData): + let (media, langCodes) = (previewInfoData.media, previewInfoData.langCodes) return CachedUserData.BotPreview( items: media.compactMap { item -> CachedUserData.BotPreview.Item? in switch item { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift index 9d75d853f4..75a8d7c619 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/VerifySecureIdValue.swift @@ -28,7 +28,8 @@ public func secureIdPreparePhoneVerification(network: Network, value: SecureIdPh } |> mapToSignal { sentCode -> Signal in switch sentCode { - case let .sentCode(_, type, phoneCodeHash, nextType, timeout): + case let .sentCode(sentCodeData): + let (type, phoneCodeHash, nextType, timeout) = (sentCodeData.type, sentCodeData.phoneCodeHash, sentCodeData.nextType, sentCodeData.timeout) return .single(SecureIdPreparePhoneVerificationPayload(type: SentAuthorizationCodeType(apiType: type), nextType: nextType.flatMap(AuthorizationCodeNextType.init), timeout: timeout, phone: value.phone, phoneCodeHash: phoneCodeHash)) case .sentCodeSuccess, .sentCodePaymentRequired: return .never()