Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
25dc99e
initial commit of new fragment for symptom screen
Oliver-Zimmerman Sep 4, 2020
d4aea33
Added relevant strings for symptom screen. Started editing xml of ini…
Oliver-Zimmerman Sep 4, 2020
e5ad0d1
Addded 3 selection options within symptom screen
Oliver-Zimmerman Sep 7, 2020
eec2835
button id name change to something more relevant
Oliver-Zimmerman Sep 7, 2020
ad0186f
ID changes to be something more relevant to symptom scenerio.
Oliver-Zimmerman Sep 7, 2020
838200f
Implemented symptom initial screen logic. Temporary nav for testing.
Oliver-Zimmerman Sep 7, 2020
7ebeda4
CircleCI formatting
Oliver-Zimmerman Sep 7, 2020
0af97bf
Adapted interoperability test provided by apopov
Oliver-Zimmerman Sep 7, 2020
8671944
Added accessibilty announcement on resume, fixed navigation for main …
Oliver-Zimmerman Sep 7, 2020
fa19067
circleCI indentation fix
Oliver-Zimmerman Sep 7, 2020
954743f
removed ar & ru and updated default strings
harambasicluka Sep 8, 2020
01e352d
Adaption to ViewModel logic. Not yet complete
Oliver-Zimmerman Sep 9, 2020
38d6174
More ViewModel transformation additions
Oliver-Zimmerman Sep 10, 2020
da34834
revert nav from test. Circle CI formatting changes
Oliver-Zimmerman Sep 10, 2020
2d20aa8
Update SubmissionSymptomIntroductionFragment.kt
Oliver-Zimmerman Sep 10, 2020
3f149c1
Removed old fragment based test
Oliver-Zimmerman Sep 10, 2020
cbd4ee4
Will implement navigation during marry session.
Oliver-Zimmerman Sep 10, 2020
4af9ba4
Update SubmissionViewModel.kt
Oliver-Zimmerman Sep 10, 2020
b0d94bc
Calendar button selection screen + required strings
Oliver-Zimmerman Sep 10, 2020
c943091
Merge branch 'dev' into feature/implement-initial-symptom-screen
chris-cwa Sep 11, 2020
3314ea7
Custom calendar view
AlexanderAlferov Sep 11, 2020
3f8dc4d
Accessibility improved
AlexanderAlferov Sep 13, 2020
2d01e80
introduced data types for symptoms
chris-cwa Sep 13, 2020
6ff60a2
represent date by long in millis
chris-cwa Sep 13, 2020
c234b3f
new TransmissionRiskVector
chris-cwa Sep 13, 2020
ca4cdb8
Constants and formatting
AlexanderAlferov Sep 14, 2020
6a2938a
Naming changes requested
Oliver-Zimmerman Sep 14, 2020
b9e38d2
Better event naming
Oliver-Zimmerman Sep 14, 2020
7755d3d
Update fragment_submission_symptom_intro.xml
Oliver-Zimmerman Sep 14, 2020
b5e4802
Merge branch 'feature/implement-initial-symptom-screen' into feature/…
Oliver-Zimmerman Sep 14, 2020
9430e25
Finishing calendar implementation - still need to implement calendar …
Oliver-Zimmerman Sep 14, 2020
25e8738
Merged introduction and calendar screen.
Oliver-Zimmerman Sep 14, 2020
4612e38
+ todo
chris-cwa Sep 14, 2020
8652b35
CircleCI code style changes
Oliver-Zimmerman Sep 14, 2020
87a561d
Merge remote-tracking branch 'origin/feature/2511-calendar-widget' in…
Oliver-Zimmerman Sep 14, 2020
3655be8
EXPERT STUFF
chris-cwa Sep 14, 2020
c1a3e07
Merge branch 'feature/symptom-calendar-surrounding-parts' into featur…
chris-cwa Sep 15, 2020
9252c66
Latest push for marry session
Oliver-Zimmerman Sep 15, 2020
1cd602b
replaced transaction risk vector
chris-cwa Sep 15, 2020
379b1fc
update textcolor on symptom indication change
chris-cwa Sep 15, 2020
ec080b6
update buttons by code
chris-cwa Sep 15, 2020
e6ecf19
code formatting
chris-cwa Sep 15, 2020
94194b9
Merge branch 'feature/symptom-calendar-surrounding-parts' into featur…
chris-cwa Sep 15, 2020
fd886b1
Added logic for Negative and No Information buttons and adjusted xml …
Oliver-Zimmerman Sep 15, 2020
50193f4
disable next button when state is null.
Oliver-Zimmerman Sep 15, 2020
c35a8f8
+ readability
chris-cwa Sep 15, 2020
4d3315c
Merge remote-tracking branch 'origin/feature/symptom-calendar-surroun…
chris-cwa Sep 15, 2020
9ad51a4
Calendar screen logic adapted for button selection
Oliver-Zimmerman Sep 15, 2020
f4d41fa
extracted domain logic from prototype and from transaction
chris-cwa Sep 15, 2020
e66b024
- not used events
chris-cwa Sep 15, 2020
f495fc2
joint improvements
chris-cwa Sep 15, 2020
c040ca7
Merge remote-tracking branch 'origin/feature/symptom-calendar-surroun…
chris-cwa Sep 15, 2020
04fe098
removed unused events
Oliver-Zimmerman Sep 15, 2020
6373830
Calendar unsetSelection added
AlexanderAlferov Sep 15, 2020
706a747
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
AlexanderAlferov Sep 15, 2020
ddfa8c2
detekt rules changed and formatting
AlexanderAlferov Sep 15, 2020
036bb98
Merge branch 'dev' into feature/EXPOSUREAPP_2489
Oliver-Zimmerman Sep 15, 2020
2d4e754
Merge remote-tracking branch 'origin/dev' into feature/EXPOSUREAPP_2489
chris-cwa Sep 15, 2020
a919614
- calendar view refactor: CalendarCalculator singleton introduced for…
AlexanderAlferov Sep 15, 2020
ae862a5
Merge remote-tracking branch 'origin/feature/EXPOSUREAPP_2489' into f…
AlexanderAlferov Sep 15, 2020
7434db4
detekt issues
chris-cwa Sep 15, 2020
4f874d0
Colors and styles cleared
AlexanderAlferov Sep 15, 2020
7229584
Merge remote-tracking branch 'origin/feature/EXPOSUREAPP_2489' into f…
AlexanderAlferov Sep 15, 2020
29db32c
fixed strings
harambasicluka Sep 15, 2020
07b997c
maintained unit tests
chris-cwa Sep 15, 2020
24beb19
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
chris-cwa Sep 15, 2020
f963e8e
adopted changes from main nav graph to device for testers nav graph
chris-cwa Sep 15, 2020
2e05847
reverted comment
chris-cwa Sep 15, 2020
00ef2da
Merge branch 'dev' into feature/EXPOSUREAPP_2489
harambasicluka Sep 15, 2020
6891c00
made start of symptoms nullable
chris-cwa Sep 16, 2020
724527e
tests
chris-cwa Sep 16, 2020
d35d3cc
Adjusted navigation, fixed dark theme
Oliver-Zimmerman Sep 16, 2020
1b6ca0a
Update Project.xml
Oliver-Zimmerman Sep 16, 2020
ae9a419
use of postValue() in SubmissionViewModel.kt
Oliver-Zimmerman Sep 16, 2020
105ef9e
Merge remote-tracking branch 'origin/feature/EXPOSUREAPP_2489' into f…
Oliver-Zimmerman Sep 16, 2020
b3ac929
Added direction in tester nav graph
Oliver-Zimmerman Sep 16, 2020
ca3f728
improvements required by review
chris-cwa Sep 17, 2020
87d2b67
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
chris-cwa Sep 17, 2020
c86af68
moving companion
chris-cwa Sep 17, 2020
9f880ad
moving companion
chris-cwa Sep 17, 2020
e33ec4f
moving companion
chris-cwa Sep 17, 2020
3e1b753
fixed issues from partner review
chris-cwa Sep 17, 2020
a466912
fixed issues from partner review
chris-cwa Sep 17, 2020
a0b177b
fixed issues from partner review
chris-cwa Sep 17, 2020
6a81ef3
fixed issues from partner review
chris-cwa Sep 17, 2020
047e8fb
fixed issues from partner review
chris-cwa Sep 17, 2020
feef408
using utc
chris-cwa Sep 17, 2020
99a52e4
edge case tests
chris-cwa Sep 17, 2020
51f7be6
Merge branch 'release/1.4.x' into feature/EXPOSUREAPP_2489
d4rken Sep 17, 2020
efc70d0
made inner class
chris-cwa Sep 17, 2020
59f7e27
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
chris-cwa Sep 17, 2020
f6caed3
Refactored Symptoms Class Name (+data class)
d4rken Sep 17, 2020
03feb77
Change SubmissionViewModel scope to ensure that the same viewmodel is…
d4rken Sep 17, 2020
958e13c
extracted null check + log
chris-cwa Sep 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Corona-Warn-App/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ dependencies {
implementation 'android.arch.lifecycle:extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation "androidx.recyclerview:recyclerview:1.1.0"
implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc02"

// DAGGER
implementation 'com.google.dagger:dagger:2.28.1'
Expand Down
2 changes: 1 addition & 1 deletion Corona-Warn-App/config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ complexity:
ignoreStringsRegex: '$^'
TooManyFunctions:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/*.Test.kt', '**/*.Spec.kt', '**/*.Spek.kt', '**/LocalData.kt', '**/formatter/*Helper.kt']
excludes: ['**/test/**', '**/androidTest/**', '**/*.Test.kt', '**/*.Spec.kt', '**/*.Spek.kt', '**/LocalData.kt', '**/formatter/*Helper.kt', '**/*ViewModel.kt']
thresholdInFiles: 20
thresholdInClasses: 20
thresholdInInterfaces: 20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class MainFragment : Fragment() {
private fun toSubmissionIntro() {
findNavController().doNavigate(
MainFragmentDirections.actionMainFragmentToSubmissionIntroFragment()
)
)
}

private fun showPopup(view: View) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,7 @@ import de.rki.coronawarnapp.transaction.RiskLevelTransaction
import de.rki.coronawarnapp.ui.viewLifecycle
import de.rki.coronawarnapp.ui.viewmodel.TracingViewModel
import de.rki.coronawarnapp.util.KeyFileHelper
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_enter_other_keys
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_get_check_exposure
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_get_exposure_keys
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_scan_qr_code
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_share_my_keys
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_submit_keys
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_api_test_start
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_calculate_risk_level
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_clear_db
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_insert_exposure_summary
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_retrieve_exposure_summary
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_tracing_duration_in_retention_period
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.button_tracing_intervals
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_attenuation
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_daysSinceLastExposure
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_matchedKeyCount
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_maximumRiskScore
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_exposure_summary_summationRiskScore
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_googlePlayServices_version
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_latest_key_date
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.label_my_keys
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.qr_code_viewpager
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.test_api_switch_last_three_hours_from_server
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.test_api_switch_background_notifications
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.text_my_keys
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.text_scanned_key
import kotlinx.android.synthetic.deviceForTesters.fragment_test_for_a_p_i.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
android:layout_margin="@dimen/spacing_normal"
android:orientation="vertical">

<de.rki.coronawarnapp.ui.calendar.CalendarView
android:id="@+id/calendar_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<TextView
android:id="@+id/label_googlePlayServices_version"
android:layout_width="match_parent"
Expand Down
29 changes: 27 additions & 2 deletions Corona-Warn-App/src/deviceForTesters/res/navigation/nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@
app:popUpTo="@id/mainFragment"
app:popUpToInclusive="true" />
<action
android:id="@+id/action_submissionResultFragment_to_submissionResultPositiveOtherWarningFragment"
app:destination="@id/submissionResultPositiveOtherWarningFragment" />
android:id="@+id/action_submissionResultFragment_to_submissionSymptomIntroductionFragment"
app:destination="@id/submissionSymptomIntroductionFragment" />
</fragment>

<fragment
Expand Down Expand Up @@ -318,4 +318,29 @@
android:name="de.rki.coronawarnapp.test.TestRiskLevelCalculationFragment"
android:label="fragment_test_risk_level_calculation"
tools:layout="@layout/fragment_test_risk_level_calculation" />
<fragment
android:id="@+id/submissionSymptomIntroductionFragment"
android:name="de.rki.coronawarnapp.ui.submission.SubmissionSymptomIntroductionFragment"
android:label="SubmissionSymptomIntroductionFragment" >
<action
android:id="@+id/action_submissionSymptomIntroductionFragment_to_submissionSymptomCalendarFragment"
app:destination="@id/submissionSymptomCalendarFragment" />
<action
android:id="@+id/action_submissionSymptomIntroductionFragment_to_submissionResultFragment"
app:destination="@id/submissionResultFragment" />
<action
android:id="@+id/action_submissionSymptomIntroductionFragment_to_submissionResultPositiveOtherWarningFragment"
app:destination="@id/submissionResultPositiveOtherWarningFragment" />
</fragment>
<fragment
android:id="@+id/submissionSymptomCalendarFragment"
android:name="de.rki.coronawarnapp.ui.submission.SubmissionSymptomCalendarFragment"
android:label="SubmissionSymptomCalendarFragment" >
<action
android:id="@+id/action_submissionCalendarFragment_to_submissionSymptomIntroductionFragment"
app:destination="@id/submissionSymptomIntroductionFragment" />
<action
android:id="@+id/action_submissionSymptomCalendarFragment_to_submissionResultPositiveOtherWarningFragment"
app:destination="@id/submissionResultPositiveOtherWarningFragment" />
</fragment>
</navigation>
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import de.rki.coronawarnapp.http.playbook.BackgroundNoise
import de.rki.coronawarnapp.http.playbook.PlaybookImpl
import de.rki.coronawarnapp.storage.LocalData
import de.rki.coronawarnapp.storage.SubmissionRepository
import de.rki.coronawarnapp.submission.Symptoms
import de.rki.coronawarnapp.transaction.SubmitDiagnosisKeysTransaction
import de.rki.coronawarnapp.util.formatter.TestResult
import de.rki.coronawarnapp.worker.BackgroundWorkScheduler
Expand Down Expand Up @@ -51,10 +52,10 @@ object SubmissionService {
SubmissionRepository.updateTestResult(testResult)
}

suspend fun asyncSubmitExposureKeys(keys: List<TemporaryExposureKey>) {
suspend fun asyncSubmitExposureKeys(keys: List<TemporaryExposureKey>, symptoms: Symptoms) {
val registrationToken =
LocalData.registrationToken() ?: throw NoRegistrationTokenSetException()
SubmitDiagnosisKeysTransaction.start(registrationToken, keys)
SubmitDiagnosisKeysTransaction.start(registrationToken, keys, symptoms)
}

suspend fun asyncRequestTestResult(): TestResult {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.rki.coronawarnapp.submission

import KeyExportFormat
import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey
import com.google.protobuf.ByteString

class DefaultKeyConverter : KeyConverter {

override fun toExternalFormat(key: TemporaryExposureKey, riskValue: Int) =
KeyExportFormat.TemporaryExposureKey.newBuilder()
.setKeyData(ByteString.readFrom(key.keyData.inputStream()))
.setRollingStartIntervalNumber(key.rollingStartIntervalNumber)
.setRollingPeriod(ROLLING_PERIOD)
.setTransmissionRiskLevel(riskValue)
.build()

companion object {

private const val ROLLING_PERIOD = 144
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package de.rki.coronawarnapp.submission

import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey

class ExposureKeyHistoryCalculations(
private val transmissionRiskVectorDeterminator: TransmissionRiskVectorDeterminator,
private val keyConverter: KeyConverter
) {

fun transformToKeyHistoryInExternalFormat(
keys: List<TemporaryExposureKey>,
symptoms: Symptoms
) =
toExternalFormat(
toSortedHistory(limitKeyCount(keys)),
transmissionRiskVectorDeterminator.determine(symptoms)
)

fun <T> limitKeyCount(keys: List<T>): List<T> =
keys.take(MAXIMUM_KEYS)

fun toExternalFormat(
keys: List<TemporaryExposureKey>,
transmissionRiskVector: TransmissionRiskVector
) =
keys.mapIndexed { index, key ->
// The latest key we receive is from yesterday (i.e. 1 day ago),
// thus we need use index+1
keyConverter.toExternalFormat(key, transmissionRiskVector.getRiskValue(index + 1))
}

fun toSortedHistory(keys: List<TemporaryExposureKey>) =
keys.sortedWith(compareByDescending { it.rollingStartIntervalNumber })

companion object {

private const val MAXIMUM_KEYS = 14
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package de.rki.coronawarnapp.submission

import KeyExportFormat
import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey

interface KeyConverter {

fun toExternalFormat(
key: TemporaryExposureKey,
riskValue: Int
): KeyExportFormat.TemporaryExposureKey
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package de.rki.coronawarnapp.submission

data class Symptoms(
val startOfSymptoms: StartOf?,
val symptomIndication: Indication
) {
sealed class StartOf {

data class Date(val millis: Long) : StartOf()
object LastSevenDays : StartOf()
object OneToTwoWeeksAgo : StartOf()
object MoreThanTwoWeeks : StartOf()
object NoInformation : StartOf()
}

enum class Indication {
POSITIVE,
NEGATIVE,
NO_INFORMATION
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package de.rki.coronawarnapp.submission

class TransmissionRiskVector(private val values: IntArray) {

val raw: IntArray
get() = values

fun getRiskValue(index: Int) =
if (index < values.size) values[index] else DEFAULT_TRANSMISSION_RISK_LEVEL

companion object {

private const val DEFAULT_TRANSMISSION_RISK_LEVEL = 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package de.rki.coronawarnapp.submission

import org.joda.time.Duration
import org.joda.time.Instant

class TransmissionRiskVectorDeterminator {

@Suppress("MagicNumber")
fun determine(symptoms: Symptoms): TransmissionRiskVector = TransmissionRiskVector(
when (symptoms.symptomIndication) {
Symptoms.Indication.POSITIVE -> when (symptoms.startOfSymptoms) {
is Symptoms.StartOf.Date -> when (
numberOfDays(symptoms.startOfSymptoms.millis)) {
0 -> intArrayOf(8, 8, 7, 6, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1)
1 -> intArrayOf(8, 8, 8, 7, 6, 4, 2, 1, 1, 1, 1, 1, 1, 1, 1)
2 -> intArrayOf(6, 8, 8, 8, 7, 6, 4, 2, 1, 1, 1, 1, 1, 1, 1)
3 -> intArrayOf(5, 6, 8, 8, 8, 7, 6, 4, 2, 1, 1, 1, 1, 1, 1)
4 -> intArrayOf(3, 5, 6, 8, 8, 8, 7, 6, 4, 2, 1, 1, 1, 1, 1)
5 -> intArrayOf(2, 3, 5, 6, 8, 8, 8, 7, 6, 4, 2, 1, 1, 1, 1)
6 -> intArrayOf(2, 2, 3, 5, 6, 8, 8, 8, 7, 6, 4, 2, 1, 1, 1)
7 -> intArrayOf(1, 2, 2, 3, 5, 6, 8, 8, 8, 7, 6, 4, 2, 1, 1)
8 -> intArrayOf(1, 1, 2, 2, 3, 5, 6, 8, 8, 8, 7, 6, 4, 2, 1)
9 -> intArrayOf(1, 1, 1, 2, 2, 3, 5, 6, 8, 8, 8, 7, 6, 4, 2)
10 -> intArrayOf(1, 1, 1, 1, 2, 2, 3, 5, 6, 8, 8, 8, 7, 6, 4)
11 -> intArrayOf(1, 1, 1, 1, 1, 2, 2, 3, 5, 6, 8, 8, 8, 7, 6)
12 -> intArrayOf(1, 1, 1, 1, 1, 1, 2, 2, 3, 5, 6, 8, 8, 8, 7)
13 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 5, 6, 8, 8, 8)
14 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 5, 6, 8, 8)
15 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 5, 6, 8)
16 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 5, 6)
17 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 5)
18 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3)
19 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2)
20 -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2)
else -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
}
is Symptoms.StartOf.LastSevenDays -> intArrayOf(4, 5, 6, 7, 7, 7, 6, 5, 4, 3, 2, 1, 1, 1, 1)
is Symptoms.StartOf.MoreThanTwoWeeks -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5)
is Symptoms.StartOf.NoInformation -> intArrayOf(5, 6, 8, 8, 8, 7, 5, 3, 2, 1, 1, 1, 1, 1, 1)
is Symptoms.StartOf.OneToTwoWeeksAgo -> intArrayOf(1, 1, 1, 1, 2, 3, 4, 5, 6, 6, 7, 7, 6, 6, 4)
else -> intArrayOf(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
}
Symptoms.Indication.NEGATIVE -> intArrayOf(4, 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
Symptoms.Indication.NO_INFORMATION -> intArrayOf(5, 6, 7, 7, 7, 6, 4, 3, 2, 1, 1, 1, 1, 1, 1)
}
)

companion object {
fun numberOfDays(t0: Long, t1: Long = System.currentTimeMillis()) =
Duration(Instant.ofEpochMilli(t0), Instant.ofEpochMilli(t1)).standardDays.toInt()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import com.google.android.gms.nearby.exposurenotification.TemporaryExposureKey
import de.rki.coronawarnapp.http.WebRequestBuilder
import de.rki.coronawarnapp.http.playbook.PlaybookImpl
import de.rki.coronawarnapp.service.submission.SubmissionService
import de.rki.coronawarnapp.submission.ExposureKeyHistoryCalculations
import de.rki.coronawarnapp.submission.DefaultKeyConverter
import de.rki.coronawarnapp.submission.Symptoms
import de.rki.coronawarnapp.submission.TransmissionRiskVectorDeterminator
import de.rki.coronawarnapp.transaction.SubmitDiagnosisKeysTransaction.SubmitDiagnosisKeysTransactionState.CLOSE
import de.rki.coronawarnapp.transaction.SubmitDiagnosisKeysTransaction.SubmitDiagnosisKeysTransactionState.RETRIEVE_TAN_AND_SUBMIT_KEYS
import de.rki.coronawarnapp.transaction.SubmitDiagnosisKeysTransaction.SubmitDiagnosisKeysTransactionState.RETRIEVE_TEMPORARY_EXPOSURE_KEY_HISTORY
import de.rki.coronawarnapp.transaction.SubmitDiagnosisKeysTransaction.SubmitDiagnosisKeysTransactionState.STORE_SUCCESS
import de.rki.coronawarnapp.util.ProtoFormatConverterExtensions.limitKeyCount
import de.rki.coronawarnapp.util.ProtoFormatConverterExtensions.transformKeyHistoryToExternalFormat
import de.rki.coronawarnapp.util.di.AppInjector

/**
Expand Down Expand Up @@ -55,14 +57,17 @@ object SubmitDiagnosisKeysTransaction : Transaction() {
/** initiates the transaction. This suspend function guarantees a successful transaction once completed. */
suspend fun start(
registrationToken: String,
keys: List<TemporaryExposureKey>
keys: List<TemporaryExposureKey>,
symptoms: Symptoms
) = lockAndExecute(unique = true, scope = transactionScope) {
/****************************************************
* RETRIEVE TEMPORARY EXPOSURE KEY HISTORY
****************************************************/
val temporaryExposureKeyList = executeState(RETRIEVE_TEMPORARY_EXPOSURE_KEY_HISTORY) {
keys.limitKeyCount()
.transformKeyHistoryToExternalFormat()
ExposureKeyHistoryCalculations(
TransmissionRiskVectorDeterminator(),
DefaultKeyConverter()
).transformToKeyHistoryInExternalFormat(keys, symptoms)
}
/****************************************************
* RETRIEVE TAN & SUBMIT KEYS
Expand Down
Loading