From 11c9b862873ca29da275ac3819a74d84ec2b14c1 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Tue, 18 Sep 2018 17:54:21 +0100 Subject: [PATCH] no message --- .../FormControllerDetailActionItem.swift | 6 +++- TelegramUI/ItemListEditableItem.swift | 6 +++- TelegramUI/SecureIdAuthController.swift | 4 +-- TelegramUI/SecureIdAuthControllerNode.swift | 2 +- TelegramUI/SecureIdAuthFormFieldNode.swift | 3 +- .../SecureIdDocumentFormControllerNode.swift | 36 ++++++++++++++++--- .../SecureIdPlaintextFormControllerNode.swift | 10 +++--- 7 files changed, 51 insertions(+), 16 deletions(-) diff --git a/TelegramUI/FormControllerDetailActionItem.swift b/TelegramUI/FormControllerDetailActionItem.swift index 9e67ed798f..246fa6c7ac 100644 --- a/TelegramUI/FormControllerDetailActionItem.swift +++ b/TelegramUI/FormControllerDetailActionItem.swift @@ -103,7 +103,11 @@ final class FormControllerDetailActionItemNode: FormBlockItemNode Bool { - return true + if let recognizer = self.recognizer, otherGestureRecognizer == recognizer { + return true + } else { + return false + } } @objc func revealTapGesture(_ recognizer: UITapGestureRecognizer) { diff --git a/TelegramUI/SecureIdAuthController.swift b/TelegramUI/SecureIdAuthController.swift index eedc747629..f985a14e47 100644 --- a/TelegramUI/SecureIdAuthController.swift +++ b/TelegramUI/SecureIdAuthController.swift @@ -114,7 +114,7 @@ final class SecureIdAuthController: ViewController { strongSelf.updateState(animated: true, { state in var state = state state.verificationState = .verified(context.context) - state.twoStepEmail = context.settings.email + state.twoStepEmail = !context.settings.email.isEmpty ? context.settings.email : nil switch state { case var .form(form): form.formData = form.encryptedFormData.flatMap({ decryptedSecureIdForm(context: context.context, form: $0.form) }) @@ -418,7 +418,7 @@ final class SecureIdAuthController: ViewController { strongSelf.updateState(animated: !inBackground, { state in var state = state state.verificationState = .verified(context.context) - state.twoStepEmail = context.settings.email + state.twoStepEmail = !context.settings.email.isEmpty ? context.settings.email : nil switch state { case var .form(form): form.formData = form.encryptedFormData.flatMap({ decryptedSecureIdForm(context: context.context, form: $0.form) }) diff --git a/TelegramUI/SecureIdAuthControllerNode.swift b/TelegramUI/SecureIdAuthControllerNode.swift index 3f34918c30..d07c2c5157 100644 --- a/TelegramUI/SecureIdAuthControllerNode.swift +++ b/TelegramUI/SecureIdAuthControllerNode.swift @@ -738,7 +738,7 @@ final class SecureIdAuthControllerNode: ViewControllerTracingNode { case .temporaryRegistration: strongSelf.interaction.present(SecureIdDocumentFormController(account: strongSelf.account, context: context, requestedData: .address(details: false, document: .temporaryRegistration, translations: true), primaryLanguageByCountry: primaryLanguageByCountry, values: values, updatedValues: updatedValues(field)), nil) case .address: - strongSelf.interaction.present(SecureIdDocumentFormController(account: strongSelf.account, context: context, requestedData: .address(details: true, document: nil, translations: true), primaryLanguageByCountry: primaryLanguageByCountry, values: values, updatedValues: updatedValues(field)), nil) + strongSelf.interaction.present(SecureIdDocumentFormController(account: strongSelf.account, context: context, requestedData: .address(details: true, document: nil, translations: false), primaryLanguageByCountry: primaryLanguageByCountry, values: values, updatedValues: updatedValues(field)), nil) case .utilityBill: strongSelf.interaction.present(SecureIdDocumentFormController(account: strongSelf.account, context: context, requestedData: .address(details: false, document: .utilityBill, translations: true), primaryLanguageByCountry: primaryLanguageByCountry, values: values, updatedValues: updatedValues(field)), nil) case .bankStatement: diff --git a/TelegramUI/SecureIdAuthFormFieldNode.swift b/TelegramUI/SecureIdAuthFormFieldNode.swift index 6c098dc411..f3f869bc15 100644 --- a/TelegramUI/SecureIdAuthFormFieldNode.swift +++ b/TelegramUI/SecureIdAuthFormFieldNode.swift @@ -647,8 +647,7 @@ private func fieldTitleAndText(field: SecureIdParsedRequestedFormField, strings: } text.append(fieldsText(addressValue.street1, addressValue.street2, addressValue.city, addressValue.state, addressValue.postcode, countryName(code: addressValue.countryCode, strings: strings))) } - } - if let filledDocument = filledDocument, let string = stringForDocumentValue(filledDocument.1, strings: strings) { + } else if let filledDocument = filledDocument, let string = stringForDocumentValue(filledDocument.1, strings: strings) { if !text.isEmpty { text.append(", ") } diff --git a/TelegramUI/SecureIdDocumentFormControllerNode.swift b/TelegramUI/SecureIdDocumentFormControllerNode.swift index bcb790826f..40ee012025 100644 --- a/TelegramUI/SecureIdDocumentFormControllerNode.swift +++ b/TelegramUI/SecureIdDocumentFormControllerNode.swift @@ -1257,6 +1257,9 @@ extension SecureIdDocumentFormState { values[.address] = .address(SecureIdAddressValue(street1: details.street1, street2: details.street2, city: details.city, state: details.state, countryCode: details.countryCode, postcode: details.postcode)) } if let document = address.document { + guard !verificationDocuments.isEmpty else { + return nil + } switch document { case .passportRegistration: values[.passportRegistration] = .passportRegistration(SecureIdPassportRegistrationValue(verificationDocuments: verificationDocuments, translations: translationDocuments)) @@ -2100,9 +2103,17 @@ final class SecureIdDocumentFormControllerNode: FormControllerNode Void = { [weak controller] in controller?.dismissAnimated() } + + let text: String + let title: String + switch innerState.documentState { + case let .identity(state) where state.details != nil: + text = self.strings.Passport_DeletePersonalDetailsConfirmation + title = self.strings.Passport_DeletePersonalDetails + case let .address(state) where state.details != nil: + text = self.strings.Passport_DeleteAddressConfirmation + title = self.strings.Passport_DeleteAddress + default: + text = self.strings.Passport_DeleteDocumentConfirmation + title = self.strings.Passport_DeleteDocument + } + controller.setItemGroups([ ActionSheetItemGroup(items: [ - ActionSheetTextItem(title: self.strings.Passport_DeleteDocumentConfirmation), - ActionSheetButtonItem(title: strings.Passport_DeleteDocument, color: .destructive, action: { [weak self] in + ActionSheetTextItem(title: text), + ActionSheetButtonItem(title: title, color: .destructive, action: { [weak self] in dismissAction() guard let strongSelf = self else { return diff --git a/TelegramUI/SecureIdPlaintextFormControllerNode.swift b/TelegramUI/SecureIdPlaintextFormControllerNode.swift index 8fadb6a633..99cb4f1d0b 100644 --- a/TelegramUI/SecureIdPlaintextFormControllerNode.swift +++ b/TelegramUI/SecureIdPlaintextFormControllerNode.swift @@ -914,10 +914,12 @@ final class SecureIdPlaintextFormControllerNode: FormControllerNode