mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Refactor constructor use sites for types 380-399 to struct pattern
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
55c53717af
commit
5e27a39d80
18 changed files with 318 additions and 77 deletions
|
|
@ -525,8 +525,22 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum EmailVerified: TypeConstructorDescription {
|
||||
case emailVerified(email: String)
|
||||
case emailVerifiedLogin(email: String, sentCode: Api.auth.SentCode)
|
||||
public class Cons_emailVerified {
|
||||
public var email: String
|
||||
public init(email: String) {
|
||||
self.email = email
|
||||
}
|
||||
}
|
||||
public class Cons_emailVerifiedLogin {
|
||||
public var email: String
|
||||
public var sentCode: Api.auth.SentCode
|
||||
public init(email: String, sentCode: Api.auth.SentCode) {
|
||||
self.email = email
|
||||
self.sentCode = sentCode
|
||||
}
|
||||
}
|
||||
case emailVerified(Cons_emailVerified)
|
||||
case emailVerifiedLogin(Cons_emailVerifiedLogin)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -562,7 +576,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum EmojiStatuses: TypeConstructorDescription {
|
||||
case emojiStatuses(hash: Int64, statuses: [Api.EmojiStatus])
|
||||
public class Cons_emojiStatuses {
|
||||
public var hash: Int64
|
||||
public var statuses: [Api.EmojiStatus]
|
||||
public init(hash: Int64, statuses: [Api.EmojiStatus]) {
|
||||
self.hash = hash
|
||||
self.statuses = statuses
|
||||
}
|
||||
}
|
||||
case emojiStatuses(Cons_emojiStatuses)
|
||||
case emojiStatusesNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -599,7 +621,13 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum PaidMessagesRevenue: TypeConstructorDescription {
|
||||
case paidMessagesRevenue(starsAmount: Int64)
|
||||
public class Cons_paidMessagesRevenue {
|
||||
public var starsAmount: Int64
|
||||
public init(starsAmount: Int64) {
|
||||
self.starsAmount = starsAmount
|
||||
}
|
||||
}
|
||||
case paidMessagesRevenue(Cons_paidMessagesRevenue)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -628,7 +656,13 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum PasskeyRegistrationOptions: TypeConstructorDescription {
|
||||
case passkeyRegistrationOptions(options: Api.DataJSON)
|
||||
public class Cons_passkeyRegistrationOptions {
|
||||
public var options: Api.DataJSON
|
||||
public init(options: Api.DataJSON) {
|
||||
self.options = options
|
||||
}
|
||||
}
|
||||
case passkeyRegistrationOptions(Cons_passkeyRegistrationOptions)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -657,7 +691,13 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum Passkeys: TypeConstructorDescription {
|
||||
case passkeys(passkeys: [Api.Passkey])
|
||||
public class Cons_passkeys {
|
||||
public var passkeys: [Api.Passkey]
|
||||
public init(passkeys: [Api.Passkey]) {
|
||||
self.passkeys = passkeys
|
||||
}
|
||||
}
|
||||
case passkeys(Cons_passkeys)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -686,7 +726,33 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum Password: TypeConstructorDescription {
|
||||
case password(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer, pendingResetDate: Int32?, loginEmailPattern: String?)
|
||||
public class Cons_password {
|
||||
public var flags: Int32
|
||||
public var currentAlgo: Api.PasswordKdfAlgo?
|
||||
public var srpB: Buffer?
|
||||
public var srpId: Int64?
|
||||
public var hint: String?
|
||||
public var emailUnconfirmedPattern: String?
|
||||
public var newAlgo: Api.PasswordKdfAlgo
|
||||
public var newSecureAlgo: Api.SecurePasswordKdfAlgo
|
||||
public var secureRandom: Buffer
|
||||
public var pendingResetDate: Int32?
|
||||
public var loginEmailPattern: String?
|
||||
public init(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer, pendingResetDate: Int32?, loginEmailPattern: String?) {
|
||||
self.flags = flags
|
||||
self.currentAlgo = currentAlgo
|
||||
self.srpB = srpB
|
||||
self.srpId = srpId
|
||||
self.hint = hint
|
||||
self.emailUnconfirmedPattern = emailUnconfirmedPattern
|
||||
self.newAlgo = newAlgo
|
||||
self.newSecureAlgo = newSecureAlgo
|
||||
self.secureRandom = secureRandom
|
||||
self.pendingResetDate = pendingResetDate
|
||||
self.loginEmailPattern = loginEmailPattern
|
||||
}
|
||||
}
|
||||
case password(Cons_password)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -715,7 +781,23 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum PasswordInputSettings: TypeConstructorDescription {
|
||||
case passwordInputSettings(flags: Int32, newAlgo: Api.PasswordKdfAlgo?, newPasswordHash: Buffer?, hint: String?, email: String?, newSecureSettings: Api.SecureSecretSettings?)
|
||||
public class Cons_passwordInputSettings {
|
||||
public var flags: Int32
|
||||
public var newAlgo: Api.PasswordKdfAlgo?
|
||||
public var newPasswordHash: Buffer?
|
||||
public var hint: String?
|
||||
public var email: String?
|
||||
public var newSecureSettings: Api.SecureSecretSettings?
|
||||
public init(flags: Int32, newAlgo: Api.PasswordKdfAlgo?, newPasswordHash: Buffer?, hint: String?, email: String?, newSecureSettings: Api.SecureSecretSettings?) {
|
||||
self.flags = flags
|
||||
self.newAlgo = newAlgo
|
||||
self.newPasswordHash = newPasswordHash
|
||||
self.hint = hint
|
||||
self.email = email
|
||||
self.newSecureSettings = newSecureSettings
|
||||
}
|
||||
}
|
||||
case passwordInputSettings(Cons_passwordInputSettings)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -744,7 +826,17 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum PasswordSettings: TypeConstructorDescription {
|
||||
case passwordSettings(flags: Int32, email: String?, secureSettings: Api.SecureSecretSettings?)
|
||||
public class Cons_passwordSettings {
|
||||
public var flags: Int32
|
||||
public var email: String?
|
||||
public var secureSettings: Api.SecureSecretSettings?
|
||||
public init(flags: Int32, email: String?, secureSettings: Api.SecureSecretSettings?) {
|
||||
self.flags = flags
|
||||
self.email = email
|
||||
self.secureSettings = secureSettings
|
||||
}
|
||||
}
|
||||
case passwordSettings(Cons_passwordSettings)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -773,7 +865,17 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum PrivacyRules: TypeConstructorDescription {
|
||||
case privacyRules(rules: [Api.PrivacyRule], chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_privacyRules {
|
||||
public var rules: [Api.PrivacyRule]
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(rules: [Api.PrivacyRule], chats: [Api.Chat], users: [Api.User]) {
|
||||
self.rules = rules
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case privacyRules(Cons_privacyRules)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -802,9 +904,21 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum ResetPasswordResult: TypeConstructorDescription {
|
||||
case resetPasswordFailedWait(retryDate: Int32)
|
||||
public class Cons_resetPasswordFailedWait {
|
||||
public var retryDate: Int32
|
||||
public init(retryDate: Int32) {
|
||||
self.retryDate = retryDate
|
||||
}
|
||||
}
|
||||
public class Cons_resetPasswordRequestedWait {
|
||||
public var untilDate: Int32
|
||||
public init(untilDate: Int32) {
|
||||
self.untilDate = untilDate
|
||||
}
|
||||
}
|
||||
case resetPasswordFailedWait(Cons_resetPasswordFailedWait)
|
||||
case resetPasswordOk
|
||||
case resetPasswordRequestedWait(untilDate: Int32)
|
||||
case resetPasswordRequestedWait(Cons_resetPasswordRequestedWait)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -847,7 +961,23 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum ResolvedBusinessChatLinks: TypeConstructorDescription {
|
||||
case resolvedBusinessChatLinks(flags: Int32, peer: Api.Peer, message: String, entities: [Api.MessageEntity]?, chats: [Api.Chat], users: [Api.User])
|
||||
public class Cons_resolvedBusinessChatLinks {
|
||||
public var flags: Int32
|
||||
public var peer: Api.Peer
|
||||
public var message: String
|
||||
public var entities: [Api.MessageEntity]?
|
||||
public var chats: [Api.Chat]
|
||||
public var users: [Api.User]
|
||||
public init(flags: Int32, peer: Api.Peer, message: String, entities: [Api.MessageEntity]?, chats: [Api.Chat], users: [Api.User]) {
|
||||
self.flags = flags
|
||||
self.peer = peer
|
||||
self.message = message
|
||||
self.entities = entities
|
||||
self.chats = chats
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case resolvedBusinessChatLinks(Cons_resolvedBusinessChatLinks)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
public extension Api.account {
|
||||
enum SavedMusicIds: TypeConstructorDescription {
|
||||
case savedMusicIds(ids: [Int64])
|
||||
public class Cons_savedMusicIds {
|
||||
public var ids: [Int64]
|
||||
public init(ids: [Int64]) {
|
||||
self.ids = ids
|
||||
}
|
||||
}
|
||||
case savedMusicIds(Cons_savedMusicIds)
|
||||
case savedMusicIdsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -37,8 +43,14 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum SavedRingtone: TypeConstructorDescription {
|
||||
public class Cons_savedRingtoneConverted {
|
||||
public var document: Api.Document
|
||||
public init(document: Api.Document) {
|
||||
self.document = document
|
||||
}
|
||||
}
|
||||
case savedRingtone
|
||||
case savedRingtoneConverted(document: Api.Document)
|
||||
case savedRingtoneConverted(Cons_savedRingtoneConverted)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -74,7 +86,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum SavedRingtones: TypeConstructorDescription {
|
||||
case savedRingtones(hash: Int64, ringtones: [Api.Document])
|
||||
public class Cons_savedRingtones {
|
||||
public var hash: Int64
|
||||
public var ringtones: [Api.Document]
|
||||
public init(hash: Int64, ringtones: [Api.Document]) {
|
||||
self.hash = hash
|
||||
self.ringtones = ringtones
|
||||
}
|
||||
}
|
||||
case savedRingtones(Cons_savedRingtones)
|
||||
case savedRingtonesNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -111,7 +131,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum SentEmailCode: TypeConstructorDescription {
|
||||
case sentEmailCode(emailPattern: String, length: Int32)
|
||||
public class Cons_sentEmailCode {
|
||||
public var emailPattern: String
|
||||
public var length: Int32
|
||||
public init(emailPattern: String, length: Int32) {
|
||||
self.emailPattern = emailPattern
|
||||
self.length = length
|
||||
}
|
||||
}
|
||||
case sentEmailCode(Cons_sentEmailCode)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -140,7 +168,13 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum Takeout: TypeConstructorDescription {
|
||||
case takeout(id: Int64)
|
||||
public class Cons_takeout {
|
||||
public var id: Int64
|
||||
public init(id: Int64) {
|
||||
self.id = id
|
||||
}
|
||||
}
|
||||
case takeout(Cons_takeout)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -169,7 +203,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum Themes: TypeConstructorDescription {
|
||||
case themes(hash: Int64, themes: [Api.Theme])
|
||||
public class Cons_themes {
|
||||
public var hash: Int64
|
||||
public var themes: [Api.Theme]
|
||||
public init(hash: Int64, themes: [Api.Theme]) {
|
||||
self.hash = hash
|
||||
self.themes = themes
|
||||
}
|
||||
}
|
||||
case themes(Cons_themes)
|
||||
case themesNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -206,7 +248,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum TmpPassword: TypeConstructorDescription {
|
||||
case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
|
||||
public class Cons_tmpPassword {
|
||||
public var tmpPassword: Buffer
|
||||
public var validUntil: Int32
|
||||
public init(tmpPassword: Buffer, validUntil: Int32) {
|
||||
self.tmpPassword = tmpPassword
|
||||
self.validUntil = validUntil
|
||||
}
|
||||
}
|
||||
case tmpPassword(Cons_tmpPassword)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
@ -235,7 +285,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum WallPapers: TypeConstructorDescription {
|
||||
case wallPapers(hash: Int64, wallpapers: [Api.WallPaper])
|
||||
public class Cons_wallPapers {
|
||||
public var hash: Int64
|
||||
public var wallpapers: [Api.WallPaper]
|
||||
public init(hash: Int64, wallpapers: [Api.WallPaper]) {
|
||||
self.hash = hash
|
||||
self.wallpapers = wallpapers
|
||||
}
|
||||
}
|
||||
case wallPapers(Cons_wallPapers)
|
||||
case wallPapersNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
|
|
@ -272,7 +330,15 @@ public extension Api.account {
|
|||
}
|
||||
public extension Api.account {
|
||||
enum WebAuthorizations: TypeConstructorDescription {
|
||||
case webAuthorizations(authorizations: [Api.WebAuthorization], users: [Api.User])
|
||||
public class Cons_webAuthorizations {
|
||||
public var authorizations: [Api.WebAuthorization]
|
||||
public var users: [Api.User]
|
||||
public init(authorizations: [Api.WebAuthorization], users: [Api.User]) {
|
||||
self.authorizations = authorizations
|
||||
self.users = users
|
||||
}
|
||||
}
|
||||
case webAuthorizations(Cons_webAuthorizations)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
#if DEBUG
|
||||
|
|
|
|||
|
|
@ -435,7 +435,8 @@ func _internal_twoStepAuthData(_ network: Network) -> Signal<TwoStepAuthData, MT
|
|||
return network.request(Api.functions.account.getPassword())
|
||||
|> map { config -> TwoStepAuthData in
|
||||
switch config {
|
||||
case let .password(flags, currentAlgo, srpB, srpId, hint, emailUnconfirmedPattern, newAlgo, newSecureAlgo, secureRandom, pendingResetDate, loginEmailPattern):
|
||||
case let .password(passwordData):
|
||||
let (flags, currentAlgo, srpB, srpId, hint, emailUnconfirmedPattern, newAlgo, newSecureAlgo, secureRandom, pendingResetDate, loginEmailPattern) = (passwordData.flags, passwordData.currentAlgo, passwordData.srpB, passwordData.srpId, passwordData.hint, passwordData.emailUnconfirmedPattern, passwordData.newAlgo, passwordData.newSecureAlgo, passwordData.secureRandom, passwordData.pendingResetDate, passwordData.loginEmailPattern)
|
||||
let hasRecovery = (flags & (1 << 0)) != 0
|
||||
let hasSecureValues = (flags & (1 << 1)) != 0
|
||||
|
||||
|
|
@ -518,7 +519,8 @@ func _internal_passkeysData(network: Network) -> Signal<[TelegramPasskey], NoErr
|
|||
return []
|
||||
}
|
||||
switch passkeys {
|
||||
case let .passkeys(passkeys):
|
||||
case let .passkeys(passkeysData):
|
||||
let passkeys = passkeysData.passkeys
|
||||
return passkeys.map { passkey in
|
||||
return TelegramPasskey(apiPasskey: passkey)
|
||||
}
|
||||
|
|
@ -537,7 +539,8 @@ func _internal_requestPasskeyRegistration(network: Network) -> Signal<String?, N
|
|||
return nil
|
||||
}
|
||||
switch options {
|
||||
case let .passkeyRegistrationOptions(options):
|
||||
case let .passkeyRegistrationOptions(passkeyRegistrationOptionsData):
|
||||
let options = passkeyRegistrationOptionsData.options
|
||||
switch options {
|
||||
case let .dataJSON(dataJSONData):
|
||||
let data = dataJSONData.data
|
||||
|
|
|
|||
|
|
@ -213,7 +213,8 @@ public func sendAuthorizationCode(accountManager: AccountManager<TelegramAccount
|
|||
return updatedAccount.network.request(Api.functions.account.getPassword(), automaticFloodWait: false)
|
||||
|> mapToSignal { result -> Signal<(SendCodeResult, UnauthorizedAccount), MTRpcError> in
|
||||
switch result {
|
||||
case let .password(_, _, _, _, hint, _, _, _, _, _, _):
|
||||
case let .password(passwordData):
|
||||
let hint = passwordData.hint
|
||||
return .single((.password(hint: hint), updatedAccount))
|
||||
}
|
||||
}
|
||||
|
|
@ -248,7 +249,8 @@ public func sendAuthorizationCode(accountManager: AccountManager<TelegramAccount
|
|||
}
|
||||
|> mapToSignal { result -> Signal<(SendCodeResult, UnauthorizedAccount), AuthorizationCodeRequestError> in
|
||||
switch result {
|
||||
case let .password(_, _, _, _, hint, _, _, _, _, _, _):
|
||||
case let .password(passwordData):
|
||||
let hint = passwordData.hint
|
||||
return .single((.password(hint: hint), account))
|
||||
}
|
||||
}
|
||||
|
|
@ -776,7 +778,8 @@ public func sendLoginEmailChangeCode(account: Account, email: String) -> Signal<
|
|||
}
|
||||
|> map { result -> ChangeLoginEmailData in
|
||||
switch result {
|
||||
case let .sentEmailCode(_, length):
|
||||
case let .sentEmailCode(sentEmailCodeData):
|
||||
let length = sentEmailCodeData.length
|
||||
return ChangeLoginEmailData(email: email, length: length)
|
||||
}
|
||||
}
|
||||
|
|
@ -805,7 +808,8 @@ public func sendLoginEmailCode(account: UnauthorizedAccount, email: String) -> S
|
|||
|> mapToSignal { result -> Signal<Never, AuthorizationSendEmailCodeError> in
|
||||
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
switch result {
|
||||
case let .sentEmailCode(emailPattern, length):
|
||||
case let .sentEmailCode(sentEmailCodeData):
|
||||
let (emailPattern, length) = (sentEmailCodeData.emailPattern, sentEmailCodeData.length)
|
||||
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .confirmationCodeEntry(number: phoneNumber, type: .email(emailPattern: emailPattern, length: length, resetAvailablePeriod: nil, resetPendingDate: nil, appleSignInAllowed: false, setup: true), hash: phoneCodeHash, timeout: nil, nextType: nil, syncContacts: syncContacts, previousCodeEntry: nil, usePrevious: false)))
|
||||
}
|
||||
return .complete()
|
||||
|
|
@ -896,7 +900,8 @@ public func verifyLoginEmailSetup(account: UnauthorizedAccount, code: Authorizat
|
|||
|> mapToSignal { result -> Signal<Never, AuthorizationEmailVerificationError> in
|
||||
return account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
switch result {
|
||||
case let .emailVerifiedLogin(_, sentCode):
|
||||
case let .emailVerifiedLogin(emailVerifiedLoginData):
|
||||
let sentCode = emailVerifiedLoginData.sentCode
|
||||
switch sentCode {
|
||||
case let .sentCode(_, type, phoneCodeHash, nextType, timeout):
|
||||
var parsedNextType: AuthorizationCodeNextType?
|
||||
|
|
@ -1037,7 +1042,8 @@ public func authorizeWithCode(accountManager: AccountManager<TelegramAccountMana
|
|||
}
|
||||
|> mapToSignal { result -> Signal<AuthorizationCodeResult, AuthorizationCodeVerificationError> in
|
||||
switch result {
|
||||
case let .password(_, _, _, _, hint, _, _, _, _, _, _):
|
||||
case let .password(passwordData):
|
||||
let hint = passwordData.hint
|
||||
return .single(.password(hint: hint ?? ""))
|
||||
}
|
||||
}
|
||||
|
|
@ -1232,7 +1238,8 @@ public func authorizeWithPasskey(accountManager: AccountManager<TelegramAccountM
|
|||
}
|
||||
|> mapToSignal { result -> Signal<AuthorizationCodeResult, AuthorizationCodeVerificationError> in
|
||||
switch result {
|
||||
case let .password(_, _, _, _, hint, _, _, _, _, _, _):
|
||||
case let .password(passwordData):
|
||||
let hint = passwordData.hint
|
||||
return .single(.password(hint: hint ?? ""))
|
||||
}
|
||||
}
|
||||
|
|
@ -1385,7 +1392,7 @@ func _internal_performPasswordRecovery(network: Network, code: String, updatedPa
|
|||
return .fail(.invalidCode)
|
||||
}
|
||||
|
||||
newSettings = Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newAlgo: updatedPasswordDerivation.apiAlgo, newPasswordHash: Buffer(data: updatedPasswordHash), hint: hint, email: email, newSecureSettings: nil)
|
||||
newSettings = Api.account.PasswordInputSettings.passwordInputSettings(.init(flags: flags, newAlgo: updatedPasswordDerivation.apiAlgo, newPasswordHash: Buffer(data: updatedPasswordHash), hint: hint, email: email, newSecureSettings: nil))
|
||||
}
|
||||
|
||||
var flags: Int32 = 0
|
||||
|
|
|
|||
|
|
@ -232,9 +232,10 @@ func managedRecentStatusEmoji(postbox: Postbox, network: Network) -> Signal<Void
|
|||
switch result {
|
||||
case .emojiStatusesNotModified:
|
||||
return .single(nil)
|
||||
case let .emojiStatuses(_, statuses):
|
||||
case let .emojiStatuses(emojiStatusesData):
|
||||
let statuses = emojiStatusesData.statuses
|
||||
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
|
||||
|
||||
|
||||
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.compactMap(\.emojiFileId))
|
||||
|> map { files -> [OrderedItemListEntry] in
|
||||
var items: [OrderedItemListEntry] = []
|
||||
|
|
@ -265,9 +266,10 @@ func managedFeaturedStatusEmoji(postbox: Postbox, network: Network) -> Signal<Vo
|
|||
switch result {
|
||||
case .emojiStatusesNotModified:
|
||||
return .single(nil)
|
||||
case let .emojiStatuses(_, statuses):
|
||||
case let .emojiStatuses(emojiStatusesData):
|
||||
let statuses = emojiStatusesData.statuses
|
||||
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
|
||||
|
||||
|
||||
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.compactMap(\.emojiFileId))
|
||||
|> map { files -> [OrderedItemListEntry] in
|
||||
var items: [OrderedItemListEntry] = []
|
||||
|
|
@ -298,9 +300,10 @@ func managedFeaturedChannelStatusEmoji(postbox: Postbox, network: Network) -> Si
|
|||
switch result {
|
||||
case .emojiStatusesNotModified:
|
||||
return .single(nil)
|
||||
case let .emojiStatuses(_, statuses):
|
||||
case let .emojiStatuses(emojiStatusesData):
|
||||
let statuses = emojiStatusesData.statuses
|
||||
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
|
||||
|
||||
|
||||
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.compactMap(\.emojiFileId))
|
||||
|> map { files -> [OrderedItemListEntry] in
|
||||
var items: [OrderedItemListEntry] = []
|
||||
|
|
@ -331,9 +334,10 @@ func managedUniqueStarGifts(accountPeerId: PeerId, postbox: Postbox, network: Ne
|
|||
switch result {
|
||||
case .emojiStatusesNotModified:
|
||||
return .single(nil)
|
||||
case let .emojiStatuses(_, statuses):
|
||||
case let .emojiStatuses(emojiStatusesData):
|
||||
let statuses = emojiStatusesData.statuses
|
||||
let parsedStatuses = statuses.compactMap(PeerEmojiStatus.init(apiStatus:))
|
||||
|
||||
|
||||
return _internal_resolveInlineStickers(postbox: postbox, network: network, fileIds: parsedStatuses.flatMap(\.associatedFileIds))
|
||||
|> map { files -> [OrderedItemListEntry] in
|
||||
var items: [OrderedItemListEntry] = []
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ func _internal_getPaidMessagesRevenue(account: Account, scopePeerId: PeerId, pee
|
|||
return nil
|
||||
}
|
||||
switch result {
|
||||
case let .paidMessagesRevenue(amount):
|
||||
case let .paidMessagesRevenue(paidMessagesRevenueData):
|
||||
let amount = paidMessagesRevenueData.starsAmount
|
||||
return StarsAmount(value: amount, nanos: 0)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager<TelegramAc
|
|||
}
|
||||
|> mapToSignal { result -> Signal<Api.auth.LoginToken?, ExportAuthTransferTokenError> in
|
||||
switch result {
|
||||
case let .password(_, _, _, _, hint, _, _, _, _, _, _):
|
||||
case let .password(passwordData):
|
||||
let hint = passwordData.hint
|
||||
return account.postbox.transaction { transaction -> Api.auth.LoginToken? in
|
||||
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: account.testingEnvironment, masterDatacenterId: account.masterDatacenterId, contents: .passwordEntry(hint: hint ?? "", number: nil, code: nil, suggestReset: false, syncContacts: syncContacts)))
|
||||
return nil
|
||||
|
|
@ -73,7 +74,8 @@ func _internal_exportAuthTransferToken(accountManager: AccountManager<TelegramAc
|
|||
}
|
||||
|> mapToSignal { result -> Signal<Api.auth.LoginToken?, ExportAuthTransferTokenError> in
|
||||
switch result {
|
||||
case let .password(_, _, _, _, hint, _, _, _, _, _, _):
|
||||
case let .password(passwordData):
|
||||
let hint = passwordData.hint
|
||||
return updatedAccount.postbox.transaction { transaction -> Api.auth.LoginToken? in
|
||||
transaction.setState(UnauthorizedAccountState(isTestingEnvironment: updatedAccount.testingEnvironment, masterDatacenterId: updatedAccount.masterDatacenterId, contents: .passwordEntry(hint: hint ?? "", number: nil, code: nil, suggestReset: false, syncContacts: syncContacts)))
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@ func _internal_twoStepVerificationConfiguration(account: Account) -> Signal<TwoS
|
|||
|> retryRequest
|
||||
|> map { result -> TwoStepVerificationConfiguration in
|
||||
switch result {
|
||||
case let .password(flags, currentAlgo, _, _, hint, emailUnconfirmedPattern, _, _, _, pendingResetDate, _):
|
||||
case let .password(passwordData):
|
||||
let (flags, currentAlgo, hint, emailUnconfirmedPattern, pendingResetDate) = (passwordData.flags, passwordData.currentAlgo, passwordData.hint, passwordData.emailUnconfirmedPattern, passwordData.pendingResetDate)
|
||||
if currentAlgo != nil {
|
||||
return .set(hint: hint ?? "", hasRecoveryEmail: (flags & (1 << 0)) != 0, pendingEmail: emailUnconfirmedPattern.flatMap({ TwoStepVerificationPendingEmail(pattern: $0, codeLength: nil) }), hasSecureValues: (flags & (1 << 1)) != 0, pendingResetTimestamp: pendingResetDate)
|
||||
} else {
|
||||
|
|
@ -68,7 +69,8 @@ func _internal_requestTwoStepVerifiationSettings(network: Network, password: Str
|
|||
}
|
||||
|> mapToSignal { result -> Signal<TwoStepVerificationSettings, AuthorizationPasswordVerificationError> in
|
||||
switch result {
|
||||
case let .passwordSettings(_, email, secureSettings):
|
||||
case let .passwordSettings(passwordSettingsData):
|
||||
let (email, secureSettings) = (passwordSettingsData.email, passwordSettingsData.secureSettings)
|
||||
var parsedSecureSecret: TwoStepVerificationSecureSecret?
|
||||
if let secureSettings = secureSettings {
|
||||
switch secureSettings {
|
||||
|
|
@ -157,7 +159,7 @@ func _internal_updateTwoStepVerificationPassword(network: Network, currentPasswo
|
|||
flags |= (1 << 0)
|
||||
}
|
||||
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: .passwordInputSettings(flags: flags, newAlgo: .passwordKdfAlgoUnknown, newPasswordHash: Buffer(data: Data()), hint: "", email: "", newSecureSettings: nil)), automaticFloodWait: true)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: .passwordInputSettings(.init(flags: flags, newAlgo: .passwordKdfAlgoUnknown, newPasswordHash: Buffer(data: Data()), hint: "", email: "", newSecureSettings: nil))), automaticFloodWait: true)
|
||||
|> mapError { _ -> UpdateTwoStepVerificationPasswordError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -193,7 +195,7 @@ func _internal_updateTwoStepVerificationPassword(network: Network, currentPasswo
|
|||
updatedSecureSettings = .secureSecretSettings(.init(secureAlgo: updatedSecureSecret.derivation.apiAlgo, secureSecret: Buffer(data: updatedSecureSecret.data), secureSecretId: updatedSecureSecret.id))
|
||||
}
|
||||
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newAlgo: updatedPasswordDerivation.apiAlgo, newPasswordHash: Buffer(data: updatedPasswordHash), hint: hint, email: email, newSecureSettings: updatedSecureSettings)), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(.init(flags: flags, newAlgo: updatedPasswordDerivation.apiAlgo, newPasswordHash: Buffer(data: updatedPasswordHash), hint: hint, email: email, newSecureSettings: updatedSecureSettings))), automaticFloodWait: false)
|
||||
|> map { _ -> UpdateTwoStepVerificationPasswordResult in
|
||||
return .password(password: password, pendingEmail: nil)
|
||||
}
|
||||
|
|
@ -253,7 +255,7 @@ func updateTwoStepVerificationSecureSecret(network: Network, password: String, s
|
|||
}
|
||||
|
||||
let flags: Int32 = (1 << 2)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: .passwordInputSettings(flags: flags, newAlgo: nil, newPasswordHash: nil, hint: "", email: "", newSecureSettings: .secureSecretSettings(.init(secureAlgo: secretDerivation.apiAlgo, secureSecret: Buffer(data: encryptedSecret), secureSecretId: secretId)))), automaticFloodWait: true)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: .passwordInputSettings(.init(flags: flags, newAlgo: nil, newPasswordHash: nil, hint: "", email: "", newSecureSettings: .secureSecretSettings(.init(secureAlgo: secretDerivation.apiAlgo, secureSecret: Buffer(data: encryptedSecret), secureSecretId: secretId))))), automaticFloodWait: true)
|
||||
|> mapError { _ -> UpdateTwoStepVerificationSecureSecretError in
|
||||
return .generic
|
||||
}
|
||||
|
|
@ -280,7 +282,7 @@ func _internal_updateTwoStepVerificationEmail(network: Network, currentPassword:
|
|||
}
|
||||
|
||||
let flags: Int32 = 1 << 1
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(flags: flags, newAlgo: nil, newPasswordHash: nil, hint: nil, email: updatedEmail, newSecureSettings: nil)), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: checkPassword, newSettings: Api.account.PasswordInputSettings.passwordInputSettings(.init(flags: flags, newAlgo: nil, newPasswordHash: nil, hint: nil, email: updatedEmail, newSecureSettings: nil))), automaticFloodWait: false)
|
||||
|> map { _ -> UpdateTwoStepVerificationPasswordResult in
|
||||
return .password(password: currentPassword, pendingEmail: nil)
|
||||
}
|
||||
|
|
@ -376,7 +378,8 @@ func _internal_requestTemporaryTwoStepPasswordToken(account: Account, password:
|
|||
return account.network.request(Api.functions.account.getTmpPassword(password: checkPassword, period: period), automaticFloodWait: false)
|
||||
|> map { result -> TemporaryTwoStepPasswordToken in
|
||||
switch result {
|
||||
case let .tmpPassword(tmpPassword, validUntil):
|
||||
case let .tmpPassword(tmpPasswordData):
|
||||
let (tmpPassword, validUntil) = (tmpPasswordData.tmpPassword, tmpPasswordData.validUntil)
|
||||
return TemporaryTwoStepPasswordToken(token: tmpPassword.makeData(), validUntilDate: validUntil, requiresBiometrics: requiresBiometrics)
|
||||
}
|
||||
}
|
||||
|
|
@ -408,11 +411,13 @@ func _internal_requestTwoStepPasswordReset(network: Network) -> Signal<RequestTw
|
|||
return network.request(Api.functions.account.resetPassword(), automaticFloodWait: false)
|
||||
|> map { result -> RequestTwoStepPasswordResetResult in
|
||||
switch result {
|
||||
case let .resetPasswordFailedWait(retryDate):
|
||||
case let .resetPasswordFailedWait(resetPasswordFailedWaitData):
|
||||
let retryDate = resetPasswordFailedWaitData.retryDate
|
||||
return .error(reason: .limitExceeded(retryAtTimestamp: retryDate))
|
||||
case .resetPasswordOk:
|
||||
return .done
|
||||
case let .resetPasswordRequestedWait(untilDate):
|
||||
case let .resetPasswordRequestedWait(resetPasswordRequestedWaitData):
|
||||
let untilDate = resetPasswordRequestedWaitData.untilDate
|
||||
return .waitingForReset(resetAtTimestamp: untilDate)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ func requestNotificationSoundList(network: Network, hash: Int64) -> Signal<Notif
|
|||
}
|
||||
|
||||
switch result {
|
||||
case let .savedRingtones(hash, ringtones):
|
||||
case let .savedRingtones(savedRingtonesData):
|
||||
let (hash, ringtones) = (savedRingtonesData.hash, savedRingtonesData.ringtones)
|
||||
let notificationSoundList = NotificationSoundList(
|
||||
hash: hash,
|
||||
sounds: ringtones.compactMap(NotificationSoundList.NotificationSound.init(apiDocument:))
|
||||
|
|
@ -207,7 +208,8 @@ private func pollNotificationSoundList(postbox: Postbox, network: Network) -> Si
|
|||
return .complete()
|
||||
}
|
||||
switch result {
|
||||
case let .savedRingtones(hash, ringtones):
|
||||
case let .savedRingtones(savedRingtonesData):
|
||||
let (hash, ringtones) = (savedRingtonesData.hash, savedRingtonesData.ringtones)
|
||||
let notificationSoundList = NotificationSoundList(
|
||||
hash: hash,
|
||||
sounds: ringtones.compactMap(NotificationSoundList.NotificationSound.init(apiDocument:))
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ func _internal_keepSavedMusicIdsUpdated(postbox: Postbox, network: Network, acco
|
|||
}
|
||||
return postbox.transaction { transaction in
|
||||
switch result {
|
||||
case let .savedMusicIds(ids):
|
||||
case let .savedMusicIds(savedMusicIdsData):
|
||||
let ids = savedMusicIdsData.ids
|
||||
let savedMusicIdsList = SavedMusicIdsList(items: ids)
|
||||
transaction.setPreferencesEntry(key: PreferencesKeys.savedMusicIds(), value: PreferencesEntry(savedMusicIdsList))
|
||||
case .savedMusicIdsNotModified:
|
||||
|
|
|
|||
|
|
@ -1741,7 +1741,8 @@ public extension TelegramEngine {
|
|||
}
|
||||
return self.account.postbox.transaction { transaction -> TelegramResolvedMessageLink? in
|
||||
switch result {
|
||||
case let .resolvedBusinessChatLinks(_, peer, message, entities, chats, users):
|
||||
case let .resolvedBusinessChatLinks(resolvedBusinessChatLinksData):
|
||||
let (peer, message, entities, chats, users) = (resolvedBusinessChatLinksData.peer, resolvedBusinessChatLinksData.message, resolvedBusinessChatLinksData.entities, resolvedBusinessChatLinksData.chats, resolvedBusinessChatLinksData.users)
|
||||
updatePeers(transaction: transaction, accountPeerId: self.account.peerId, peers: AccumulatedPeers(transaction: transaction, chats: chats, users: users))
|
||||
|
||||
guard let peer = transaction.getPeer(peer.peerId) else {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ func webSessions(network: Network) -> Signal<([WebAuthorization], [PeerId: Peer]
|
|||
var sessions: [WebAuthorization] = []
|
||||
var peers:[PeerId : Peer] = [:]
|
||||
switch result {
|
||||
case let .webAuthorizations(authorizations, users):
|
||||
case let .webAuthorizations(webAuthorizationsData):
|
||||
let (authorizations, users) = (webAuthorizationsData.authorizations, webAuthorizationsData.users)
|
||||
for authorization in authorizations {
|
||||
switch authorization {
|
||||
case let .webAuthorization(webAuthorizationData):
|
||||
|
|
|
|||
|
|
@ -113,49 +113,56 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
|
|||
var apiChats: [Api.Chat] = []
|
||||
|
||||
switch lastSeenPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
lastSeenRules = rules
|
||||
}
|
||||
|
||||
switch groupPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
groupRules = rules
|
||||
}
|
||||
|
||||
switch voiceCallPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
voiceRules = rules
|
||||
}
|
||||
|
||||
switch voiceCallP2P {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
voiceP2PRules = rules
|
||||
}
|
||||
|
||||
switch profilePhotoPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
profilePhotoRules = rules
|
||||
}
|
||||
|
||||
switch forwardPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
forwardRules = rules
|
||||
}
|
||||
|
||||
switch phoneNumberPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
phoneNumberRules = rules
|
||||
|
|
@ -163,7 +170,8 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
|
|||
|
||||
var phoneDiscoveryValue = false
|
||||
switch phoneDiscoveryPrivacy {
|
||||
case let .privacyRules(rules, _, _):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let rules = privacyRulesData.rules
|
||||
for rule in rules {
|
||||
switch rule {
|
||||
case .privacyValueAllowAll:
|
||||
|
|
@ -175,40 +183,46 @@ func _internal_requestAccountPrivacySettings(account: Account) -> Signal<Account
|
|||
}
|
||||
|
||||
switch voiceMessagesPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
voiceMessagesRules = rules
|
||||
}
|
||||
|
||||
switch bioPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
bioRules = rules
|
||||
}
|
||||
|
||||
switch birthdayPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
birthdayRules = rules
|
||||
}
|
||||
|
||||
switch giftsAutoSavePrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
giftsAutoSaveRules = rules
|
||||
}
|
||||
switch noPaidMessagesPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
noPaidMessagesRules = rules
|
||||
}
|
||||
switch savedMusicPrivacy {
|
||||
case let .privacyRules(rules, chats, users):
|
||||
case let .privacyRules(privacyRulesData):
|
||||
let (rules, chats, users) = (privacyRulesData.rules, privacyRulesData.chats, privacyRulesData.users)
|
||||
apiUsers.append(contentsOf: users)
|
||||
apiChats.append(contentsOf: chats)
|
||||
savedMusicRules = rules
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ public func dropSecureId(network: Network, currentPassword: String) -> Signal<Vo
|
|||
case .passwordSettings:
|
||||
var flags: Int32 = 0
|
||||
flags |= (1 << 2)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: .inputCheckPasswordEmpty, newSettings: .passwordInputSettings(flags: flags, newAlgo: nil, newPasswordHash: nil, hint: nil, email: nil, newSecureSettings: nil)), automaticFloodWait: false)
|
||||
return network.request(Api.functions.account.updatePasswordSettings(password: .inputCheckPasswordEmpty, newSettings: .passwordInputSettings(.init(flags: flags, newAlgo: nil, newPasswordHash: nil, hint: nil, email: nil, newSecureSettings: nil))), automaticFloodWait: false)
|
||||
|> map { _ in }
|
||||
|> mapError { _ in
|
||||
return AuthorizationPasswordVerificationError.generic
|
||||
|
|
|
|||
|
|
@ -84,7 +84,8 @@ public func secureIdPrepareEmailVerification(network: Network, value: SecureIdEm
|
|||
}
|
||||
|> map { sentCode -> SecureIdPrepareEmailVerificationPayload in
|
||||
switch sentCode {
|
||||
case .sentEmailCode(_, let length):
|
||||
case let .sentEmailCode(sentEmailCodeData):
|
||||
let length = sentEmailCodeData.length
|
||||
return SecureIdPrepareEmailVerificationPayload(email: value.email, length: length)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,7 +203,8 @@ func _internal_getChatThemes(accountManager: AccountManager<TelegramAccountManag
|
|||
return .complete()
|
||||
}
|
||||
switch result {
|
||||
case let .themes(hash, apiThemes):
|
||||
case let .themes(themesData):
|
||||
let (hash, apiThemes) = (themesData.hash, themesData.themes)
|
||||
let result = apiThemes.compactMap { TelegramTheme(apiTheme: $0) }
|
||||
if result == current {
|
||||
return .complete()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ public func telegramThemes(postbox: Postbox, network: Network, accountManager: A
|
|||
|> retryRequest
|
||||
|> mapToSignal { result -> Signal<([TelegramTheme], Int64), NoError> in
|
||||
switch result {
|
||||
case let .themes(hash, themes):
|
||||
case let .themes(themesData):
|
||||
let (hash, themes) = (themesData.hash, themesData.themes)
|
||||
let result = themes.compactMap { TelegramTheme(apiTheme: $0) }
|
||||
if result == current {
|
||||
return .complete()
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ public func telegramWallpapers(postbox: Postbox, network: Network, forceUpdate:
|
|||
return .single(([], -1))
|
||||
}
|
||||
switch result {
|
||||
case let .wallPapers(hash, wallpapers):
|
||||
case let .wallPapers(wallPapersData):
|
||||
let (hash, wallpapers) = (wallPapersData.hash, wallPapersData.wallpapers)
|
||||
var items: [TelegramWallpaper] = []
|
||||
var addedBuiltin = false
|
||||
for apiWallpaper in wallpapers {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue