Skip to content

Commit

Permalink
feat: remove entry to italy scan mode
Browse files Browse the repository at this point in the history
* feat: remove entry to italy scan mode

* fix: remove dokka classpath

* feat: remove italy entry scan mode

change sdk version

Co-authored-by: Light2288 <davide.aliti@gmail.com>
  • Loading branch information
nicola-95 and Light2288 authored Jun 13, 2022
1 parent 32fdf90 commit b438e9f
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 39 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ buildscript {
classpath Deps.androidx_navigation
classpath Deps.hilt_plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0"
classpath "io.realm:realm-gradle-plugin:10.8.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
6 changes: 3 additions & 3 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'jacoco'
id 'org.jetbrains.dokka'
id 'org.jetbrains.dokka' version '1.6.21'
id 'realm-android'
}

Expand Down Expand Up @@ -103,15 +103,15 @@ android {
buildConfigField "String", "SERVER_HOST", "\"testaka4.sogei.it\""
buildConfigField "String", "LEAF_CERTIFICATE", "\"sha256/R0d+cI8vTcJ3sCbpfQCH0OmdBbulPH3deYhngzOqJVA=\""
buildConfigField "String", "BACKUP_CERTIFICATE", "\"sha256/KpZtVwF9rcXdbBMB/Poep8h3VSYXA/ZSFMkkWlQ0ZNk=\""
buildConfigField "String", "SDK_VERSION", "\"1.1.9\""
buildConfigField "String", "SDK_VERSION", "\"1.1.10\""
}

release {
buildConfigField "String", "BASE_URL", "\"https://get.dgc.gov.it/v1/dgc/\""
buildConfigField "String", "SERVER_HOST", "\"get.dgc.gov.it\""
buildConfigField "String", "LEAF_CERTIFICATE", "\"sha256/7cZJIDPacG8FS3pq6Mvxg+7yBDM/VYc2alOcbVe/e74=\""
buildConfigField "String", "BACKUP_CERTIFICATE", "\"sha256/095kxU9rqrJ3f+YM1pG+Y2YCgAUvR1f5blSuZYXvEy8=\""
buildConfigField "String", "SDK_VERSION", "\"1.1.9\""
buildConfigField "String", "SDK_VERSION", "\"1.1.10\""

minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class ExemptionValidationStrategy : ValidationStrategy {
}
}
return when (scanMode) {
ScanMode.ENTRY_ITALY -> return CertificateStatus.NOT_VALID
ScanMode.BOOSTER -> return CertificateStatus.TEST_NEEDED
else -> CertificateStatus.VALID
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class RecoveryValidationStrategy : ValidationStrategy {
val scanMode = certificateModel.scanMode
val certificate = certificateModel.certificate

val countryCode = if (scanMode == ScanMode.ENTRY_ITALY) recovery.country else Country.IT.value
val countryCode = Country.IT.value

val recoveryBis = recovery.isRecoveryBis(certificate)
val startDaysToAdd = if (recoveryBis) ruleSet.getRecoveryCertPVStartDay() else ruleSet.getRecoveryCertStartDayUnified(countryCode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ class VaccineValidationStrategy : ValidationStrategy {
ScanMode.STANDARD -> vaccineStandardStrategy(certificateModel, ruleSet)
ScanMode.STRENGTHENED -> vaccineStrengthenedStrategy(certificateModel, ruleSet)
ScanMode.BOOSTER -> vaccineBoosterStrategy(certificateModel, ruleSet)
ScanMode.ENTRY_ITALY -> vaccineEntryItalyStrategy(certificateModel, ruleSet)
else -> {
CertificateStatus.NOT_EU_DCC
}
Expand Down Expand Up @@ -212,36 +211,4 @@ class VaccineValidationStrategy : ValidationStrategy {
}
}

private fun vaccineEntryItalyStrategy(certificateModel: CertificateModel, ruleSet: RuleSet): CertificateStatus {
val vaccination = certificateModel.vaccinations?.last()!!
val dateOfVaccination = vaccination.dateOfVaccination.toLocalDate()
val birthDate = (certificateModel.dateOfBirth?.toValidDateOfBirth())?.plusDays(ruleSet.getVaccineCompleteUnder18Offset())
val isUserUnderage = birthDate?.getAge()!! < Const.VACCINE_UNDERAGE_AGE

val startDaysToAdd =
when {
vaccination.isBooster() -> ruleSet.getVaccineStartDayBoosterUnified(Country.NOT_IT.value)
vaccination.isNotComplete() -> ruleSet.getVaccineStartDayNotComplete(vaccination.medicinalProduct)
else -> ruleSet.getVaccineStartDayCompleteUnified(Country.NOT_IT.value, vaccination.medicinalProduct)
}

val endDaysToAdd =
when {
vaccination.isComplete() && isUserUnderage -> ruleSet.getVaccineEndDayCompleteUnder18()
vaccination.isBooster() -> ruleSet.getVaccineEndDayBoosterUnified(Country.NOT_IT.value)
vaccination.isNotComplete() -> ruleSet.getVaccineEndDayNotComplete(vaccination.medicinalProduct)
else -> ruleSet.getVaccineEndDayCompleteUnified(Country.NOT_IT.value)
}

startDate = dateOfVaccination.plusDays(startDaysToAdd)
endDate = dateOfVaccination.plusDays(endDaysToAdd)

return when {
LocalDate.now().isBefore(startDate) -> CertificateStatus.NOT_VALID_YET
LocalDate.now().isAfter(endDate) -> CertificateStatus.EXPIRED
!ruleSet.isEMA(vaccination.medicinalProduct, vaccination.countryOfVaccination) -> CertificateStatus.NOT_VALID
vaccination.isNotComplete() -> CertificateStatus.NOT_VALID
else -> CertificateStatus.VALID
}
}
}

0 comments on commit b438e9f

Please sign in to comment.