Skip to content

Commit

Permalink
feat: remove entry to italy scan mode
Browse files Browse the repository at this point in the history
Co-authored-by: Emilio Apuzzo <[email protected]>
Co-authored-by: Light2288 <[email protected]>
  • Loading branch information
3 people authored Jun 13, 2022
1 parent d6a0ae1 commit e9cdea4
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 136 deletions.
21 changes: 0 additions & 21 deletions DGCAVerifier/BusinessRules/Internal/Validators/DGCValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ struct ValidatorProducer {
return ReinforcedValidatorFactory()
case .booster:
return BoosterValidatorFactory()
case .italyEntry:
return ItalyEntryValidatorFactory()
}
}

Expand Down Expand Up @@ -138,22 +136,3 @@ struct BoosterValidatorFactory: DCGValidatorFactory {
}

}

struct ItalyEntryValidatorFactory: DCGValidatorFactory {

func getValidator(hcert: HCert) -> DGCValidator? {
switch hcert.extendedType {
case .unknown:
return UnknownValidator()
case .vaccine:
return VaccineItalyEntryValidator()
case .recovery:
return RecoveryItalyEntryValidator()
case .test:
return TestItalyEntryValidator()
case .vaccineExemption:
return VaccineExemptionItalyEntryValidator()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -185,26 +185,3 @@ class RecoveryBoosterValidator: RecoveryReinforcedValidator {

}

class RecoveryItalyEntryValidator: RecoveryConcreteValidator {
override func getStartDays(from hcert: HCert) -> Int? {
let startDaysConfig: String
if isSpecialRecovery(hcert: hcert) {
startDaysConfig = Constants.recoverySpecialStartDays
}
else {
startDaysConfig = Constants.recoveryStartDays_NOT_IT
}
return getValue(for: startDaysConfig)?.intValue
}

override func getEndDays(from hcert: HCert) -> Int? {
let endDaysConfig: String
if isSpecialRecovery(hcert: hcert) {
endDaysConfig = Constants.recoverySpecialEndDays
}
else {
endDaysConfig = Constants.recoveryEndDays_NOT_IT
}
return getValue(for: endDaysConfig)?.intValue
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,5 +131,3 @@ class TestReinforcedValidator: TestBaseValidator {
}

class TestBoosterValidator: TestReinforcedValidator {}

class TestItalyEntryValidator: TestConcreteValidator {}
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,3 @@ class VaccineExemptionBoosterValidator: VaccineExemptionBaseValidator {
}

}

class VaccineExemptionItalyEntryValidator: VaccineExemptionConcreteValidator {

override func validate(hcert: HCert) -> Status {
let result = super.validate(hcert: hcert)
switch result {
case .expired:
return .expired
case .notValidYet:
return .notValidYet
default:
return .notValid
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,54 +286,6 @@ class VaccineBoosterValidator: VaccineConcreteValidator {

}

class VaccineItalyEntryValidator: VaccineConcreteValidator {

override func validate(hcert: HCert) -> Status {
guard let vaccinationInfo = getVaccinationData(hcert) else { return .notValid }

if !vaccinationInfo.isEMAProduct && vaccinationInfo.isCurrentDoseIncomplete {
return .notValid
}

self.vaccinationInfo = vaccinationInfo
let result = super.checkVaccinationInterval(vaccinationInfo)

guard result == .valid else { return result }

if !vaccinationInfo.isEMAProduct || vaccinationInfo.isCurrentDoseIncomplete {
return .notValid
}

return result
}

public override func startDaysForCompleteDose(_ vaccinationInfo: VaccinationInfo) -> Int? {
let setting = Constants.vaccineCompleteStartDays_NOT_IT
return self.getValue(for: setting)?.intValue
}

public override func endDaysForCompleteDose(_ vaccinationInfo: VaccinationInfo) -> Int? {
var setting = Constants.vaccineCompleteEndDays_NOT_IT
let vaccineUnder18Offset: Int = self.getValue(for: Constants.vaccineCompleteEndDays_under_18_offset)?.intValue ?? 0
if vaccinationInfo.isPatientUnder18(vaccineUnder18Offset: vaccineUnder18Offset) {
setting = Constants.vaccineCompleteEndDays_under_18
}

return self.getValue(for: setting)?.intValue
}

public override func startDaysForBoosterDose(_ vaccinationInfo: VaccinationInfo) -> Int? {
let setting = Constants.vaccineBoosterStartDays_NOT_IT
return self.getValue(for: setting)?.intValue
}

public override func endDaysForBoosterDose(_ vaccinationInfo: VaccinationInfo) -> Int? {
let setting = Constants.vaccineBoosterEndDays_NOT_IT
return self.getValue(for: setting)?.intValue
}

}

class VaccineReinforcedValidatorNotItaly: VaccineReinforcedValidator {

override func validate(hcert: HCert) -> Status {
Expand Down
2 changes: 0 additions & 2 deletions DGCAVerifier/Models/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ struct Constants {
static let scanMode2G = "scanMode2G"
static let scanMode3G = "scanMode3G"
static let scanModeBooster = "scanModeBooster"
static let scanModeItalyEntry = "scanModeItalyEntry"

// MARK: Settings
static let drlMaxRetries = "MAX_RETRY"
Expand All @@ -87,7 +86,6 @@ struct Constants {
static let scanModeDescription3G = "3G_scan_mode_description"
static let scanModeDescription2G = "2G_scan_mode_description"
static let scanModeDescriptionBooster = "booster_scan_mode_description"
static let scanModeDescriptionItalyEntry = "italy_entry_scan_mode_description"

// MARK: Settings Scan Mode Popup
static let infoScanModePopup = "info_scan_mode_popup"
Expand Down
1 change: 0 additions & 1 deletion DGCAVerifier/Models/Internal/ScanMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ enum ScanMode: String, CaseIterable {
case base = "scanMode3G"
case reinforced = "scanMode2G"
case booster = "scanModeBooster"
case italyEntry = "scanModeItalyEntry"
}

7 changes: 7 additions & 0 deletions DGCAVerifier/Pages/Home/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ class HomeViewController: UIViewController {
}

private func initialize() {

if ScanMode.init(rawValue: Store.get(key: .scanMode) ?? "") == nil {
Store.remove(key: .scanMode)
Store.set(false, for: .isScanModeSet)
updateScanButtonStatus()
}

bindScanEnabled()
setUpSettingsAction()
setHomeTitle()
Expand Down
2 changes: 0 additions & 2 deletions DGCAVerifier/Pages/Result/VerificationViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ class VerificationViewController: UIViewController {
switch scanMode{
case Constants.scanMode2G:
mode = "result.scan.mode.2G".localized
case Constants.scanModeItalyEntry:
mode = "result.scan.mode.italy.entry".localized
case Constants.scanMode3G:
mode = "result.scan.mode.3G".localized
case Constants.scanModeBooster:
Expand Down
1 change: 0 additions & 1 deletion DGCAVerifier/SupportingFiles/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"top.bar.scan.mode.2G" = "R - RAFFORZATA";
"top.bar.scan.mode.3G" = "B - BASE";
"top.bar.scan.mode.Boster" = "V - VISITATORI RSA";
"top.bar.scan.mode.itEntry" = "I - INGRESSO IT";

"server.error.error.with.status" = "Ricevuto errore con status ";
"server.error.generic.error" = "Errore generico nell'utilizzo del servizio";
Expand Down
1 change: 0 additions & 1 deletion DGCAVerifier/SupportingFiles/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"top.bar.scan.mode.2G" = "R - RAFFORZATA";
"top.bar.scan.mode.3G" = "B - BASE";
"top.bar.scan.mode.Boster" = "V - VISITATORI RSA";
"top.bar.scan.mode.itEntry" = "I - INGRESSO IT";

"server.error.error.with.status" = "Ricevuto errore con status ";
"server.error.generic.error" = "Errore generico nell'utilizzo del servizio";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class HeaderBar: AppView {
mode = "top.bar.scan.mode.3G".localized
case Constants.scanModeBooster:
mode = "top.bar.scan.mode.Boster".localized
case Constants.scanModeItalyEntry:
mode = "top.bar.scan.mode.itEntry".localized
default:
break
}
Expand Down
8 changes: 0 additions & 8 deletions DGCAVerifier/Utils/ScanMode+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ extension ScanMode {
switch self {
case .base:
return "home.scan.picker.mode.3G".localized
case .italyEntry:
return "home.scan.picker.mode.italy.entry".localized
case .reinforced:
return "home.scan.picker.mode.2G".localized
case .booster:
Expand All @@ -44,8 +42,6 @@ extension ScanMode {
switch self {
case .base:
return SettingDataStorage.sharedInstance.getFirstSetting(withName: Constants.scanModeDescription3G)
case .italyEntry:
return SettingDataStorage.sharedInstance.getFirstSetting(withName: Constants.scanModeDescriptionItalyEntry)
case .reinforced:
return SettingDataStorage.sharedInstance.getFirstSetting(withName: Constants.scanModeDescription2G)
case .booster:
Expand All @@ -57,8 +53,6 @@ extension ScanMode {
switch self {
case .base:
return "home.scan.button.bold.3G".localized
case .italyEntry:
return "home.scan.button.bold.italy.entry".localized
case .reinforced:
return "home.scan.button.bold.2G".localized
case .booster:
Expand All @@ -70,8 +64,6 @@ extension ScanMode {
switch self {
case .base:
return "home.scan.button.mode.3G".localized
case .italyEntry:
return "home.scan.button.mode.italy.entry".localized
case .reinforced:
return "home.scan.button.mode.2G".localized
case .booster:
Expand Down
2 changes: 0 additions & 2 deletions DGCAVerifierTests/AutomatedTests/TestModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ struct TestResult: Codable, Equatable, CustomStringConvertible {
return .reinforced
case "Visitatori RSA":
return .booster
case "Ingresso in italia":
return .italyEntry
default:
return nil
}
Expand Down
16 changes: 8 additions & 8 deletions Verifier.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -2182,7 +2182,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2269,7 +2269,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -2294,7 +2294,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2425,7 +2425,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -2450,7 +2450,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2644,7 +2644,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -2669,7 +2669,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.3.1;
MARKETING_VERSION = 1.3.2;
PRODUCT_BUNDLE_IDENTIFIER = it.ministerodellasalute.VerificaC19;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down

0 comments on commit e9cdea4

Please sign in to comment.