Various improvements

This commit is contained in:
Ilya Laktyushin
2024-04-22 18:47:25 +04:00
parent e6881a78dc
commit 7b0b47e894
27 changed files with 1194 additions and 975 deletions

View File

@@ -27,7 +27,7 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
var resetEmail: (() -> Void)?
var retryResetEmail: (() -> Void)?
var data: (String, String?, SentAuthorizationCodeType, AuthorizationCodeNextType?, Int32?, Bool, Bool)?
var data: (String, String?, SentAuthorizationCodeType, AuthorizationCodeNextType?, Int32?, SentAuthorizationCodeType?)?
var termsOfService: (UnauthorizedAccountTermsOfService, Bool)?
private let hapticFeedback = HapticFeedback()
@@ -74,7 +74,7 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
let proceed: String
let stop: String
if let (_, _, type, _, _, _, _) = self?.data, case .email = type {
if let (_, _, type, _, _, _) = self?.data, case .email = type {
text = presentationData.strings.Login_CancelEmailVerification
proceed = presentationData.strings.Login_CancelEmailVerificationContinue
stop = presentationData.strings.Login_CancelEmailVerificationStop
@@ -141,12 +141,12 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
self?.present(c, in: .window(.root), with: a)
}
if let (number, email, codeType, nextType, timeout, hasPreviousCode, previousIsPhrase) = self.data {
if let (number, email, codeType, nextType, timeout, previousCodeType) = self.data {
var appleSignInAllowed = false
if case let .email(_, _, _, _, appleSignInAllowedValue, _) = codeType {
appleSignInAllowed = appleSignInAllowedValue
}
self.controllerNode.updateData(number: number, email: email, codeType: codeType, nextType: nextType, timeout: timeout, appleSignInAllowed: appleSignInAllowed, hasPreviousCode: hasPreviousCode, previousIsPhrase: previousIsPhrase)
self.controllerNode.updateData(number: number, email: email, codeType: codeType, nextType: nextType, timeout: timeout, appleSignInAllowed: appleSignInAllowed, previousCodeType: previousCodeType)
}
}
@@ -194,10 +194,10 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
}
}
public func updateData(number: String, email: String?, codeType: SentAuthorizationCodeType, nextType: AuthorizationCodeNextType?, timeout: Int32?, termsOfService: (UnauthorizedAccountTermsOfService, Bool)?, hasPreviousCode: Bool, previousIsPhrase: Bool) {
public func updateData(number: String, email: String?, codeType: SentAuthorizationCodeType, nextType: AuthorizationCodeNextType?, timeout: Int32?, termsOfService: (UnauthorizedAccountTermsOfService, Bool)?, previousCodeType: SentAuthorizationCodeType?) {
self.termsOfService = termsOfService
if self.data?.0 != number || self.data?.1 != email || self.data?.2 != codeType || self.data?.3 != nextType || self.data?.4 != timeout || self.data?.5 != hasPreviousCode || self.data?.6 != previousIsPhrase {
self.data = (number, email, codeType, nextType, timeout, hasPreviousCode, previousIsPhrase)
if self.data?.0 != number || self.data?.1 != email || self.data?.2 != codeType || self.data?.3 != nextType || self.data?.4 != timeout || self.data?.5 != previousCodeType {
self.data = (number, email, codeType, nextType, timeout, previousCodeType)
var appleSignInAllowed = false
if case let .email(_, _, _, _, appleSignInAllowedValue, _) = codeType {
@@ -205,7 +205,7 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
}
if self.isNodeLoaded {
self.controllerNode.updateData(number: number, email: email, codeType: codeType, nextType: nextType, timeout: timeout, appleSignInAllowed: appleSignInAllowed, hasPreviousCode: hasPreviousCode, previousIsPhrase: previousIsPhrase)
self.controllerNode.updateData(number: number, email: email, codeType: codeType, nextType: nextType, timeout: timeout, appleSignInAllowed: appleSignInAllowed, previousCodeType: previousCodeType)
self.requestLayout(transition: .immediate)
}
}
@@ -229,7 +229,7 @@ public final class AuthorizationSequenceCodeEntryController: ViewController {
}
@objc private func nextPressed() {
guard let (_, _, type, _, _, _, _) = self.data else {
guard let (_, _, type, _, _, _) = self.data else {
return
}