diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/BlackListValidator.swift b/DGCAVerifier/BusinessRules/Internal/Validators/BlackListValidator.swift index f65bd69..8dab476 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/BlackListValidator.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/BlackListValidator.swift @@ -35,6 +35,18 @@ struct BlackListValidator: DGCValidator { return blacklist.split(separator: ";").contains("\(hcert.getUVCI())") ? .notValid : .valid } + func validate(_ current: Date, from validityStart: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + return .notValid + } + private func getBlacklist() -> String? { return getValue(for: blacklist) } diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/ChainValidator.swift b/DGCAVerifier/BusinessRules/Internal/Validators/ChainValidator.swift index b357501..6908a3c 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/ChainValidator.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/ChainValidator.swift @@ -36,4 +36,15 @@ struct ChainValidator: DGCValidator { return failedValidations.isEmpty ? .valid : failedValidations.first! } + func validate(_ current: Date, from validityStart: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + return .notValid + } } diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/DGCValidator.swift b/DGCAVerifier/BusinessRules/Internal/Validators/DGCValidator.swift index 0845789..a4f4d12 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/DGCValidator.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/DGCValidator.swift @@ -41,46 +41,21 @@ protocol DGCValidator { func validate(hcert: HCert) -> Status } -extension DGCValidator { +class AlwaysNotValid: DGCValidator { - func validate(_ current: Date, from validityStart: Date) -> Status { - switch current { - case .. Status { + return .notValid } - func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { - switch current { - case .. Status { + return .notValid } - func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { - switch current { - case .. Status { + return .notValid } - -} -class AlwaysNotValid: DGCValidator { - - func validate(hcert: HCert) -> Status { + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { return .notValid } } diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/HCertValidator.swift b/DGCAVerifier/BusinessRules/Internal/Validators/HCertValidator.swift index 743d4bc..2499288 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/HCertValidator.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/HCertValidator.swift @@ -37,4 +37,16 @@ struct HCertValidator: DGCValidator { return .valid } + func validate(_ current: Date, from validityStart: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + return .notValid + } + } diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/RecoveryValidators.swift b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/RecoveryValidators.swift index c77ba17..3d12656 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/RecoveryValidators.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/RecoveryValidators.swift @@ -53,24 +53,55 @@ struct RecoveryInfo { } -class RecoveryBaseValidator: DGCValidator { - - typealias Validator = RecoveryBaseValidator +class RecoveryConcreteValidator: DGCValidator { fileprivate var recoveryInfo: RecoveryInfo! + func validate(_ current: Date, from validityStart: Date) -> Status { + switch current { + case .. Status { + switch current { + case .. Status { + switch current { + case .. Status { self.recoveryInfo = RecoveryInfo.from(hcert: hcert) guard let validityFrom = hcert.recoveryDateFrom?.toRecoveryDate else { return .notValid } guard let validityUntil = hcert.recoveryDateUntil?.toRecoveryDate else { return .notValid } - + guard let recoveryStartDays = getStartDays(from: hcert) else { return .notValid } guard let recoveryEndDays = getEndDays(from: hcert) else { return .notValid } guard let validityStart = validityFrom.add(recoveryStartDays, ofType: .day) else { return .notValid } guard let validityEnd = validityEnd(hcert, dateFrom: validityFrom, dateUntil: validityUntil, additionalDays: recoveryEndDays) else { return .notValid } - + guard let currentDate = Date.startOfDay else { return .notValid } return self.validate(currentDate, from: validityStart, to: validityEnd) @@ -114,9 +145,10 @@ class RecoveryBaseValidator: DGCValidator { public func getValue(for name: String) -> String? { return LocalData.getSetting(from: name) } - } +class RecoveryBaseValidator: RecoveryConcreteValidator {} + class RecoveryReinforcedValidator: RecoveryBaseValidator { override func getStartDays(from hcert: HCert) -> Int? { @@ -145,24 +177,7 @@ class RecoveryReinforcedValidator: RecoveryBaseValidator { class RecoveryBoosterValidator: RecoveryReinforcedValidator { - override func validate(hcert: HCert) -> Status { - self.recoveryInfo = RecoveryInfo.from(hcert: hcert) - - guard let validityFrom = hcert.recoveryDateFrom?.toRecoveryDate else { return .notValid } - guard let validityUntil = hcert.recoveryDateUntil?.toRecoveryDate else { return .notValid } - - guard let recoveryStartDays = getStartDays(from: hcert) else { return .notValid } - guard let recoveryEndDays = getEndDays(from: hcert) else { return .notValid } - - guard let validityStart = validityFrom.add(recoveryStartDays, ofType: .day) else { return .notValid } - guard let validityEnd = validityEnd(hcert, dateFrom: validityFrom, dateUntil: validityUntil, additionalDays: recoveryEndDays) else { return .notValid } - - guard let currentDate = Date.startOfDay else { return .notValid } - - return validate(currentDate, from: validityStart, to: validityEnd) - } - - func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + override func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { switch current { case .. Int? { - return super.getStartDays(from: hcert) - } - - override func getEndDays(from hcert: HCert) -> Int? { - return super.getEndDays(from: hcert) - } - -} +class RecoveryWorkValidator: RecoveryBaseValidator {} -class RecoveryItalyEntryValidator: RecoveryBaseValidator { +class RecoveryItalyEntryValidator: RecoveryConcreteValidator { override func getStartDays(from hcert: HCert) -> Int? { let startDaysConfig: String if isSpecialRecovery(hcert: hcert) { diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/TestValidators.swift b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/TestValidators.swift index 1532967..cb6dac7 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/TestValidators.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/TestValidators.swift @@ -26,7 +26,40 @@ import Foundation import SwiftDGC -class TestBaseValidator: DGCValidator { +class TestConcreteValidator: DGCValidator { + + func validate(_ current: Date, from validityStart: Date) -> Status { + switch current { + case .. Status { + switch current { + case .. Status { + switch current { + case .. Status { guard hcert.isKnownTestType else { return .notValid } @@ -77,9 +110,10 @@ class TestBaseValidator: DGCValidator { let testValidityResults = [isTestNegative(hcert), isTestDateValid(hcert)] return testValidityResults.first(where: {$0 != .valid}) ?? .valid } - } +class TestBaseValidator: TestConcreteValidator {} + class TestReinforcedValidator: TestBaseValidator { override func validate(hcert: HCert) -> Status { @@ -117,4 +151,4 @@ class TestWorkValidator: TestBaseValidator { } -class TestItalyEntryValidator: TestBaseValidator {} +class TestItalyEntryValidator: TestConcreteValidator {} diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineExemptionValidators.swift b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineExemptionValidators.swift index e708daf..445b6b1 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineExemptionValidators.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineExemptionValidators.swift @@ -26,7 +26,39 @@ import Foundation import SwiftDGC -class VaccineExemptionBaseValidator: DGCValidator { +class VaccineExemptionConcreteValidator: DGCValidator { + func validate(_ current: Date, from validityStart: Date) -> Status { + switch current { + case .. Status { + switch current { + case .. Status { + switch current { + case .. Status { guard let exemption = hcert.vaccineExemptionStatements.last else { return .notValid } @@ -37,9 +69,10 @@ class VaccineExemptionBaseValidator: DGCValidator { } return self.validate(currentDate, from: dateFrom, to: dateUntil) } - } +class VaccineExemptionBaseValidator: VaccineExemptionConcreteValidator {} + class VaccineExemptionReinforcedValidator: VaccineExemptionBaseValidator {} class VaccineExemptionBoosterValidator: VaccineExemptionBaseValidator { @@ -56,7 +89,7 @@ class VaccineExemptionSchoolValidator: VaccineExemptionBaseValidator {} class VaccineExemptionWorkValidator: VaccineExemptionBaseValidator {} -class VaccineExemptionItalyEntryValidator: VaccineExemptionBaseValidator { +class VaccineExemptionItalyEntryValidator: VaccineExemptionConcreteValidator { override func validate(hcert: HCert) -> Status { let result = super.validate(hcert: hcert) diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineValidators.swift b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineValidators.swift index 59c4214..e72225f 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineValidators.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/Medical/VaccineValidators.swift @@ -65,17 +65,48 @@ struct VaccinationInfo { } - -class VaccineBaseValidator: DGCValidator { - - typealias Validator = VaccineBaseValidator - +class VaccineConcreteValidator: DGCValidator { + var vaccinationInfo: VaccinationInfo! private var allowedVaccinationInCountry: [String: [String]] { [Constants.SputnikVacineCode: [Constants.sanMarinoCode]] } + func validate(_ current: Date, from validityStart: Date) -> Status { + switch current { + case .. Status { + switch current { + case .. Status { + switch current { + case .. Status { guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid } self.vaccinationInfo = vaccinationInfo @@ -103,17 +134,15 @@ class VaccineBaseValidator: DGCValidator { } func checkVaccinationInterval(_ vaccinationInfo: VaccinationInfo) -> Status { - + guard let start = getStartDays(vaccinationInfo: vaccinationInfo) else { return .notValid } guard let end = getEndDays(vaccinationInfo: vaccinationInfo) else { return .notValid } guard let ext = getExtensionDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - guard let validityStart = vaccinationInfo.vaccineDate.add(start, ofType: .day) else { return .notValid } guard let validityEnd = vaccinationInfo.vaccineDate.add(end, ofType: .day)?.startOfDay else { return .notValid } guard let validityExt = vaccinationInfo.vaccineDate.add(ext, ofType: .day)?.startOfDay else { return .notValid } - guard let currentDate = Date.startOfDay else { return .notValid } // J&J booster is immediately valid @@ -128,7 +157,7 @@ class VaccineBaseValidator: DGCValidator { } return true } - + public func startDaysForBoosterDose(_ vaccinationInfo: VaccinationInfo) -> Int? { let setting = Constants.vaccineBoosterStartDays_IT return self.getValue(for: setting)?.intValue @@ -227,16 +256,13 @@ class VaccineBaseValidator: DGCValidator { public func getValue(for name: String) -> String? { return LocalData.getSetting(from: name) } - } -class VaccineReinforcedValidator: VaccineBaseValidator { - override func validate(hcert: HCert) -> Status { - super.validate(hcert: hcert) - } -} +class VaccineBaseValidator: VaccineConcreteValidator {} + +class VaccineReinforcedValidator: VaccineBaseValidator {} -class VaccineBoosterValidator: VaccineBaseValidator { +class VaccineBoosterValidator: VaccineConcreteValidator { override func validate(hcert: HCert) -> Status { guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid } @@ -259,7 +285,7 @@ class VaccineBoosterValidator: VaccineBaseValidator { } -class VaccineSchoolValidator: VaccineBaseValidator { +class VaccineSchoolValidator: VaccineConcreteValidator { override func validate(hcert: HCert) -> Status { guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid } @@ -300,7 +326,7 @@ class VaccineWorkValidator: VaccineReinforcedValidator { } -class VaccineItalyEntryValidator: VaccineBaseValidator { +class VaccineItalyEntryValidator: VaccineConcreteValidator { override func validate(hcert: HCert) -> Status { guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid } @@ -345,11 +371,7 @@ class VaccineItalyEntryValidator: VaccineBaseValidator { class VaccineReinforcedValidatorNotItaly: VaccineReinforcedValidator { - public override func extDaysForCompleteDose(_ vaccinationInfo: VaccinationInfo) -> Int? { - return getValue(for: Constants.vaccineCompleteExtendedDays_EMA)?.intValue - } - - public override func validate(hcert: HCert) -> Status { + override func validate(hcert: HCert) -> Status { guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid } self.vaccinationInfo = vaccinationInfo @@ -365,25 +387,7 @@ class VaccineReinforcedValidatorNotItaly: VaccineReinforcedValidator { return result } - override func checkVaccinationInterval(_ vaccinationInfo: VaccinationInfo) -> Status { - - guard let start = getStartDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - guard let end = getEndDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - guard let ext = getExtensionDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - - guard let validityStart = vaccinationInfo.vaccineDate.add(start, ofType: .day) else { return .notValid } - guard let validityEnd = vaccinationInfo.vaccineDate.add(end, ofType: .day)?.startOfDay else { return .notValid } - guard let validityExt = vaccinationInfo.vaccineDate.add(ext, ofType: .day)?.startOfDay else { return .notValid } - - guard let currentDate = Date.startOfDay else { return .notValid } - - // J&J booster is immediately valid - let fromDate = vaccinationInfo.isJJBooster ? vaccinationInfo.vaccineDate : validityStart - - return self.validate(currentDate, from: fromDate, to: validityEnd, extendedTo: validityExt) - } - - func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + override func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { switch current { case .. Int? { + return getValue(for: Constants.vaccineCompleteExtendedDays_EMA)?.intValue + } + } class VaccineBoosterValidatorNotItaly: VaccineBoosterValidator { - override func checkVaccinationInterval(_ vaccinationInfo: VaccinationInfo) -> Status { - - guard let start = getStartDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - guard let end = getEndDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - guard let ext = getExtensionDays(vaccinationInfo: vaccinationInfo) else { return .notValid } - - guard let validityStart = vaccinationInfo.vaccineDate.add(start, ofType: .day) else { return .notValid } - guard let validityEnd = vaccinationInfo.vaccineDate.add(end, ofType: .day)?.startOfDay else { return .notValid } - guard let validityExt = vaccinationInfo.vaccineDate.add(ext, ofType: .day)?.startOfDay else { return .notValid } - - guard let currentDate = Date.startOfDay else { return .notValid } - - // J&J booster is immediately valid - let fromDate = vaccinationInfo.isJJBooster ? vaccinationInfo.vaccineDate : validityStart - - return self.validate(currentDate, from: fromDate, to: validityEnd, extendedTo: validityExt) - } - override func validate(hcert: HCert) -> Status { guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid } self.vaccinationInfo = vaccinationInfo @@ -438,7 +428,7 @@ class VaccineBoosterValidatorNotItaly: VaccineBoosterValidator { return vaccinationInfo.isCurrentDoseComplete ? .verificationIsNeeded : .notValid } - func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + override func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { let result: Status = { switch current { case .. Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + return .notValid + } + } diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/TestOnlyValidator.swift b/DGCAVerifier/BusinessRules/Internal/Validators/TestOnlyValidator.swift index 70ef3b9..aa9e2d7 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/TestOnlyValidator.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/TestOnlyValidator.swift @@ -32,4 +32,16 @@ struct TestOnlyValidator: DGCValidator { return TestBaseValidator().validate(hcert: hcert) } + func validate(_ current: Date, from validityStart: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + return .notValid + } + } diff --git a/DGCAVerifier/BusinessRules/Internal/Validators/UnknownValidators.swift b/DGCAVerifier/BusinessRules/Internal/Validators/UnknownValidators.swift index 07185c5..7050acf 100644 --- a/DGCAVerifier/BusinessRules/Internal/Validators/UnknownValidators.swift +++ b/DGCAVerifier/BusinessRules/Internal/Validators/UnknownValidators.swift @@ -31,4 +31,16 @@ class UnknownValidator: DGCValidator { func validate(hcert: HCert) -> Status { return .notValid } + + func validate(_ current: Date, from validityStart: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date) -> Status { + return .notValid + } + + func validate(_ current: Date, from validityStart: Date, to validityEnd: Date, extendedTo validityEndExtension: Date) -> Status { + return .notValid + } } diff --git a/DGCAVerifier/Pages/Result/VerificationViewController.swift b/DGCAVerifier/Pages/Result/VerificationViewController.swift index 0e780a5..f7f41c5 100644 --- a/DGCAVerifier/Pages/Result/VerificationViewController.swift +++ b/DGCAVerifier/Pages/Result/VerificationViewController.swift @@ -176,7 +176,7 @@ class VerificationViewController: UIViewController { private func setFaq(for status: Status) { faqStackView.removeAllArrangedSubViews() - faqStackView.addArrangedSubview(getFaq()) + faqStackView.addArrangedSubview(getFaq(for: status)) } private func setPersonalData(for status: Status) { @@ -207,11 +207,11 @@ class VerificationViewController: UIViewController { return view } - private func getFaq() -> FaqView { + private func getFaq(for status: Status) -> FaqView { let view = FaqView() let tap = UrlTapGesture(target: self, action: #selector(faqDidTap)) - tap.url = self.viewModel.status.faqSettingsLink - let title = self.viewModel.status.faqSettingsTitle + tap.url = status.faqSettingsLink + let title = status.faqSettingsTitle view.fillView(with: .init(text: title, onTap: tap)) return view @@ -288,7 +288,7 @@ class VerificationViewController: UIViewController { private func setLastFetch() { let text = "result.last.fetch".localized + " " - let date = Date().toDateTimeReadableString + let date = Date().toTimeDateReadableString lastFetchLabel.text = text + date } diff --git a/DGCAVerifier/SupportingFiles/en.lproj/Localizable.strings b/DGCAVerifier/SupportingFiles/en.lproj/Localizable.strings index 42c950b..4c47645 100644 --- a/DGCAVerifier/SupportingFiles/en.lproj/Localizable.strings +++ b/DGCAVerifier/SupportingFiles/en.lproj/Localizable.strings @@ -74,7 +74,7 @@ "result.description.not.valid" = "La certificazione presenta i seguenti dati anagrafici:"; "result.description.revoked" = "La certificazione risulta essere revocata"; "result.scan.mode" = "La modalità di scansione impostata è:" ; -"result.description.need.verification" = "Per completare la verifica è necessario confrontare i seguenti dati anagrafici con quelli di un documento di identità valido:"; +"result.description.need.verification" = "La certificazione presenta i seguenti dati anagrafici:"; "result.scan.button.second" = "Scansiona il tampone"; "result.scan.button.no.test" = "Nessun tampone disponibile"; diff --git a/DGCAVerifier/SupportingFiles/it.lproj/Localizable.strings b/DGCAVerifier/SupportingFiles/it.lproj/Localizable.strings index 08014da..3fa7854 100644 --- a/DGCAVerifier/SupportingFiles/it.lproj/Localizable.strings +++ b/DGCAVerifier/SupportingFiles/it.lproj/Localizable.strings @@ -74,7 +74,7 @@ "result.description.not.valid" = "La certificazione presenta i seguenti dati anagrafici:"; "result.description.revoked" = "La certificazione risulta essere revocata"; "result.scan.mode" = "La modalità di scansione impostata è:" ; -"result.description.need.verification" = "Per completare la verifica è necessario confrontare i seguenti dati anagrafici con quelli di un documento di identità valido:"; +"result.description.need.verification" = "La certificazione presenta i seguenti dati anagrafici:"; "result.scan.button.second" = "Scansiona il tampone"; "result.scan.button.no.test" = "Nessun tampone disponibile"; diff --git a/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.swift b/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.swift index 0dbfebf..0fc80f3 100644 --- a/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.swift +++ b/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.swift @@ -22,6 +22,7 @@ class CustomPickerController: UIViewController { @IBOutlet weak var shadowViewContainer: AppShadowView! @IBOutlet weak var headerView: UIView! + @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var closeButton: UIButton! @IBOutlet weak var confirmButton: AppButton! @IBOutlet weak var titleLabel: AppLabel! @@ -59,6 +60,16 @@ class CustomPickerController: UIViewController { self.optionViews.forEach{ $0.reset() } self.setupInitiallySelectedOption() } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + guard let scanMode = ScanMode.fetchFromLocalSettings() else { return } + if (scanMode == .school) { + let yOffset = self.scrollView.contentLayoutGuide.layoutFrame.height - self.scrollView.frameLayoutGuide.layoutFrame.size.height + self.scrollView.setContentOffset(CGPoint(x: 0, y: yOffset), animated: true) + } + } private func setupPickerOptionContents() -> Void { ScanMode.allCases.forEach{ diff --git a/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.xib b/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.xib index 35b8a20..9d42861 100644 --- a/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.xib +++ b/DGCAVerifier/UIComponents/CustomControllers/CustomPicker/CustomPickerController.xib @@ -15,6 +15,7 @@ + diff --git a/DGCAVerifier/Utils/Date/Date+String.swift b/DGCAVerifier/Utils/Date/Date+String.swift index fc8cb02..48cc7d7 100644 --- a/DGCAVerifier/Utils/Date/Date+String.swift +++ b/DGCAVerifier/Utils/Date/Date+String.swift @@ -50,6 +50,13 @@ extension Date { df.dateFormat = "dd/MM/yyyy HH:mm" return df.string(from: self) } + + /// Returns the date in the following format: HH:mm, dd/MM/yyyy. + var toTimeDateReadableString: String { + let df = DateFormatter.getDefault(utc: false) + df.dateFormat = "HH:mm, dd/MM/yyyy" + return df.string(from: self) + } var toTimeReadableString: String { let df = DateFormatter.getDefault(utc: false) diff --git a/DGCAVerifier/Utils/ModelExtensions/Status+Configuration.swift b/DGCAVerifier/Utils/ModelExtensions/Status+Configuration.swift index f8bcd9b..be85c55 100644 --- a/DGCAVerifier/Utils/ModelExtensions/Status+Configuration.swift +++ b/DGCAVerifier/Utils/ModelExtensions/Status+Configuration.swift @@ -104,10 +104,10 @@ extension Status { case .valid: return true case .notValidYet: return true case .notValid: return true - case .expired: return true + case .expired: return true case .revokedGreenPass: return true case .verificationIsNeeded: return true - default: return false + default: return true } } diff --git a/DGCAVerifierTests/CasiDiTest.csv b/DGCAVerifierTests/CasiDiTest.csv index dbc40f0..ccb9d96 100644 --- a/DGCAVerifierTests/CasiDiTest.csv +++ b/DGCAVerifierTests/CasiDiTest.csv @@ -1,527 +1,492 @@ DESCRIZIONE_TEST;ID_TEST;PAYLOAD;ESITO_BASE;ESITO_INGRESSO_IT;ESITO_RAFFORZATA;ESITO_VISITATORI_RSA;ESITO_STUDENTI;ESITO_LAVORO;PAYLOAD_JSON; -BASE DOSE_PRIMA_DOSE_1_2 IT Vaxzevria MINORE_50_ANNI valid;VAC.1;HC1:6BFOXN%TS3DH:M8C2V-FBDU6B%5 *M0II4F4C9BYJAWAU*CM/Y4/VR-36FGFX6BMF6.UCOMIN6R%E5UX4U96:/6N9R%EPXCR800$R1EQ5YUI%F1PN1/T1J$HTR9/O14SI.J9WVHWVH+ZEW*H.T1$NICZU.Y0ZW4:.AY731MFS53$97WC7323PJJII7UBJ6FNGI7QLN4J7*97FB34NJ3H3PJJCA5C-4A+2XEN QT QTJC31M3+E3J%4N%2 NVV5TN%2LXKW/SS KN8TXP4SN0X6T:1JT 456L X4CZKHKB-43.E3KD3OAJ/9TL4T1C9 UPZIPNOE+NE9YM2RU5+10T9GYPE 1TW5FKP051I/5R3Q+%9PL94F7-IFH RTXG*PN%*4HBTYXVI$2I4T6JV//C 1DV7J$%25I3KC31835AL5:4A93OHBZQT/9GCZG/-L6/TVL5V%7U7EKG6+5OWVKQ*EN15RR5-N3F57Z4IL6QK3OW+3N$K$.3TIC4 M$IM$-NH QDMS$%AA%B HV GR9PL3O7JR4BV5Y6D440XLF74;valid; ; ; ; ; ;{"ver":"1.3.0","v":[{"dt":"2021-12-08","sd":2,"mp":"EU/1/21/1529","tg":"840539006","ma":"ORG-100001699","ci":"01IT0FB2C4027EC448D5B6EEAFC22E593F7F#9","dn":1,"vp":"1119305005","is":"Ministero della Salute","co":"IT"}],"dob":"1981-01-01","nam":{"gn":"Mario Luigi","fn":"Verdi Rossi","gnt":"MARIO