no message

This commit is contained in:
Ilya Laktyushin 2018-09-18 17:54:21 +01:00
parent 78dca463ea
commit 11c9b86287
7 changed files with 51 additions and 16 deletions

View File

@ -103,7 +103,11 @@ final class FormControllerDetailActionItemNode: FormBlockItemNode<FormController
})
}
override func selected() {
func activate() {
self.item?.activated()
}
override func selected() {
activate()
}
}

View File

@ -151,7 +151,11 @@ class ItemListRevealOptionsItemNode: ListViewItemNode, UIGestureRecognizerDelega
}
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
if let recognizer = self.recognizer, otherGestureRecognizer == recognizer {
return true
} else {
return false
}
}
@objc func revealTapGesture(_ recognizer: UITapGestureRecognizer) {

View File

@ -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) })

View File

@ -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:

View File

@ -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(", ")
}

View File

@ -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<SecureIdDocum
strongSelf.enumerateItemsAndEntries({ itemEntry, itemNode in
if itemEntry.isEqual(to: entry) {
useNext = true
} else if useNext, let inputNode = itemNode as? FormControllerTextInputItemNode {
} else if useNext {
if case .deleteDocument = itemEntry {
return false
}
else if let inputNode = itemNode as? FormControllerTextInputItemNode {
inputNode.activate()
return false
} else if let actionNode = itemNode as? FormControllerDetailActionItemNode {
actionNode.activate()
return false
}
}
return true
})
@ -2569,10 +2580,25 @@ final class SecureIdDocumentFormControllerNode: FormControllerNode<SecureIdDocum
let dismissAction: () -> 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

View File

@ -916,6 +916,8 @@ final class SecureIdPlaintextFormControllerNode: FormControllerNode<SecureIdPlai
switch error {
case .generic:
errorText = strongSelf.strings.Login_UnknownError
case .invalidEmail:
errorText = strongSelf.strings.TwoStepAuth_EmailInvalid
case .flood:
errorText = strongSelf.strings.Login_CodeFloodError
}