Fix passport plaintext controller presentation

This commit is contained in:
Ali 2019-11-06 23:54:57 +04:00
parent 6302373ab2
commit 3beebbf3ce
2 changed files with 8 additions and 6 deletions

View File

@ -700,7 +700,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
guard let strongSelf = self else { guard let strongSelf = self else {
return return
} }
strongSelf.interaction.present(SecureIdPlaintextFormController(context: strongSelf.context, secureIdContext: secureIdContext, type: type, immediatelyAvailableValue: immediatelyAvailableValue, updatedValue: { valueWithContext in strongSelf.interaction.push(SecureIdPlaintextFormController(context: strongSelf.context, secureIdContext: secureIdContext, type: type, immediatelyAvailableValue: immediatelyAvailableValue, updatedValue: { valueWithContext in
if let strongSelf = self { if let strongSelf = self {
strongSelf.interaction.updateState { state in strongSelf.interaction.updateState { state in
if case let .form(form) = state, let formData = form.formData { if case let .form(form) = state, let formData = form.formData {
@ -723,7 +723,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
return state return state
} }
} }
}), nil) }))
} }
if let currentValue = currentValue { if let currentValue = currentValue {
@ -941,9 +941,9 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
if let peer = list.accountPeer as? TelegramUser, let phone = peer.phone, !phone.isEmpty { if let peer = list.accountPeer as? TelegramUser, let phone = peer.phone, !phone.isEmpty {
immediatelyAvailableValue = .phone(SecureIdPhoneValue(phone: phone)) immediatelyAvailableValue = .phone(SecureIdPhoneValue(phone: phone))
} }
self.interaction.present(SecureIdPlaintextFormController(context: self.context, secureIdContext: secureIdContext, type: .phone, immediatelyAvailableValue: immediatelyAvailableValue, updatedValue: { value in self.interaction.push(SecureIdPlaintextFormController(context: self.context, secureIdContext: secureIdContext, type: .phone, immediatelyAvailableValue: immediatelyAvailableValue, updatedValue: { value in
updatedValues(.phone)(value.flatMap({ [$0] }) ?? []) updatedValues(.phone)(value.flatMap({ [$0] }) ?? [])
}), nil) }))
} }
case .email: case .email:
if findValue(values, key: .email) != nil { if findValue(values, key: .email) != nil {
@ -953,9 +953,9 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode {
if let email = list.twoStepEmail { if let email = list.twoStepEmail {
immediatelyAvailableValue = .email(SecureIdEmailValue(email: email)) immediatelyAvailableValue = .email(SecureIdEmailValue(email: email))
} }
self.interaction.present(SecureIdPlaintextFormController(context: self.context, secureIdContext: secureIdContext, type: .email, immediatelyAvailableValue: immediatelyAvailableValue, updatedValue: { value in self.interaction.push(SecureIdPlaintextFormController(context: self.context, secureIdContext: secureIdContext, type: .email, immediatelyAvailableValue: immediatelyAvailableValue, updatedValue: { value in
updatedValues(.email)(value.flatMap({ [$0] }) ?? []) updatedValues(.email)(value.flatMap({ [$0] }) ?? [])
}), nil) }))
} }
} }
} }

View File

@ -37,6 +37,8 @@ public final class SecureIdPlaintextFormController: FormController<SecureIdPlain
super.init(initParams: SecureIdPlaintextFormControllerNodeInitParams(context: context, secureIdContext: secureIdContext), presentationData: self.presentationData) super.init(initParams: SecureIdPlaintextFormControllerNodeInitParams(context: context, secureIdContext: secureIdContext), presentationData: self.presentationData)
self.navigationPresentation = .modal
switch type { switch type {
case .phone: case .phone:
self.title = self.presentationData.strings.Passport_Phone_Title self.title = self.presentationData.strings.Passport_Phone_Title