Skip to content
Snippets Groups Projects
Unverified Commit 9ed01592 authored by Philipp Woessner's avatar Philipp Woessner Committed by GitHub
Browse files

changed local config that a high match can be generated via QR code,...

changed local config that a high match can be generated via QR code, integrated it with the UI (#125)
parent 7573920f
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,7 @@ import de.rki.coronawarnapp.server.protocols.AppleLegacyKeyExchange
import de.rki.coronawarnapp.sharing.ExposureSharingService
import de.rki.coronawarnapp.storage.AppDatabase
import de.rki.coronawarnapp.storage.ExposureSummaryRepository
import de.rki.coronawarnapp.storage.LocalData
import de.rki.coronawarnapp.storage.tracing.TracingIntervalRepository
import de.rki.coronawarnapp.transaction.RiskLevelTransaction
import de.rki.coronawarnapp.transaction.SubmitDiagnosisKeysTransaction
......@@ -76,6 +77,8 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
companion object {
val TAG: String? = TestForAPIFragment::class.simpleName
const val CONFIG_SCORE = 8
fun keysToJson(keys: List<TemporaryExposureKey>): String {
return Gson().toJson(keys).toString()
}
......@@ -308,6 +311,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
showToast("No other keys provided. Please fill the EditText with the JSON containing keys")
} else {
token = UUID.randomUUID().toString()
LocalData.googleApiToken(token)
val appleKeyList = mutableListOf<AppleLegacyKeyExchange.Key>()
......@@ -344,7 +348,7 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
// only testing implementation: this is used to wait for the broadcastreceiver of the OS / EN API
InternalExposureNotificationClient.asyncProvideDiagnosisKeys(
googleFileList,
ExposureConfiguration.ExposureConfigurationBuilder().build(),
getCustomConfig(),
token!!
)
showToast("Provided ${appleKeyList.size} keys to Google API with token $token")
......@@ -442,4 +446,48 @@ class TestForAPIFragment : Fragment(), InternalExposureNotificationPermissionHel
keysToJson(keys)
updateKeysDisplay()
}
private fun getCustomConfig(): ExposureConfiguration = ExposureConfiguration
.ExposureConfigurationBuilder()
.setAttenuationScores(
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE
)
.setDaysSinceLastExposureScores(
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE
)
.setDurationScores(
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE
)
.setTransmissionRiskScores(
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE,
CONFIG_SCORE
)
.build()
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment