This repository was archived by the owner on Jun 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 487
Provide onset of symptoms before upload (EXPOSUREAPP-1605) #1170
Merged
Merged
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 d4aea33
Added relevant strings for symptom screen. Started editing xml of ini…
Oliver-Zimmerman e5ad0d1
Addded 3 selection options within symptom screen
Oliver-Zimmerman eec2835
button id name change to something more relevant
Oliver-Zimmerman ad0186f
ID changes to be something more relevant to symptom scenerio.
Oliver-Zimmerman 838200f
Implemented symptom initial screen logic. Temporary nav for testing.
Oliver-Zimmerman 7ebeda4
CircleCI formatting
Oliver-Zimmerman 0af97bf
Adapted interoperability test provided by apopov
Oliver-Zimmerman 8671944
Added accessibilty announcement on resume, fixed navigation for main …
Oliver-Zimmerman fa19067
circleCI indentation fix
Oliver-Zimmerman 954743f
removed ar & ru and updated default strings
harambasicluka 01e352d
Adaption to ViewModel logic. Not yet complete
Oliver-Zimmerman 38d6174
More ViewModel transformation additions
Oliver-Zimmerman da34834
revert nav from test. Circle CI formatting changes
Oliver-Zimmerman 2d20aa8
Update SubmissionSymptomIntroductionFragment.kt
Oliver-Zimmerman 3f149c1
Removed old fragment based test
Oliver-Zimmerman cbd4ee4
Will implement navigation during marry session.
Oliver-Zimmerman 4af9ba4
Update SubmissionViewModel.kt
Oliver-Zimmerman b0d94bc
Calendar button selection screen + required strings
Oliver-Zimmerman c943091
Merge branch 'dev' into feature/implement-initial-symptom-screen
chris-cwa 3314ea7
Custom calendar view
AlexanderAlferov 3f8dc4d
Accessibility improved
AlexanderAlferov 2d01e80
introduced data types for symptoms
chris-cwa 6ff60a2
represent date by long in millis
chris-cwa c234b3f
new TransmissionRiskVector
chris-cwa ca4cdb8
Constants and formatting
AlexanderAlferov 6a2938a
Naming changes requested
Oliver-Zimmerman b9e38d2
Better event naming
Oliver-Zimmerman 7755d3d
Update fragment_submission_symptom_intro.xml
Oliver-Zimmerman b5e4802
Merge branch 'feature/implement-initial-symptom-screen' into feature/…
Oliver-Zimmerman 9430e25
Finishing calendar implementation - still need to implement calendar …
Oliver-Zimmerman 25e8738
Merged introduction and calendar screen.
Oliver-Zimmerman 4612e38
+ todo
chris-cwa 8652b35
CircleCI code style changes
Oliver-Zimmerman 87a561d
Merge remote-tracking branch 'origin/feature/2511-calendar-widget' in…
Oliver-Zimmerman 3655be8
EXPERT STUFF
chris-cwa c1a3e07
Merge branch 'feature/symptom-calendar-surrounding-parts' into featur…
chris-cwa 9252c66
Latest push for marry session
Oliver-Zimmerman 1cd602b
replaced transaction risk vector
chris-cwa 379b1fc
update textcolor on symptom indication change
chris-cwa ec080b6
update buttons by code
chris-cwa e6ecf19
code formatting
chris-cwa 94194b9
Merge branch 'feature/symptom-calendar-surrounding-parts' into featur…
chris-cwa fd886b1
Added logic for Negative and No Information buttons and adjusted xml …
Oliver-Zimmerman 50193f4
disable next button when state is null.
Oliver-Zimmerman c35a8f8
+ readability
chris-cwa 4d3315c
Merge remote-tracking branch 'origin/feature/symptom-calendar-surroun…
chris-cwa 9ad51a4
Calendar screen logic adapted for button selection
Oliver-Zimmerman f4d41fa
extracted domain logic from prototype and from transaction
chris-cwa e66b024
- not used events
chris-cwa f495fc2
joint improvements
chris-cwa c040ca7
Merge remote-tracking branch 'origin/feature/symptom-calendar-surroun…
chris-cwa 04fe098
removed unused events
Oliver-Zimmerman 6373830
Calendar unsetSelection added
AlexanderAlferov 706a747
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
AlexanderAlferov ddfa8c2
detekt rules changed and formatting
AlexanderAlferov 036bb98
Merge branch 'dev' into feature/EXPOSUREAPP_2489
Oliver-Zimmerman 2d4e754
Merge remote-tracking branch 'origin/dev' into feature/EXPOSUREAPP_2489
chris-cwa a919614
- calendar view refactor: CalendarCalculator singleton introduced for…
AlexanderAlferov ae862a5
Merge remote-tracking branch 'origin/feature/EXPOSUREAPP_2489' into f…
AlexanderAlferov 7434db4
detekt issues
chris-cwa 4f874d0
Colors and styles cleared
AlexanderAlferov 7229584
Merge remote-tracking branch 'origin/feature/EXPOSUREAPP_2489' into f…
AlexanderAlferov 29db32c
fixed strings
harambasicluka 07b997c
maintained unit tests
chris-cwa 24beb19
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
chris-cwa f963e8e
adopted changes from main nav graph to device for testers nav graph
chris-cwa 2e05847
reverted comment
chris-cwa 00ef2da
Merge branch 'dev' into feature/EXPOSUREAPP_2489
harambasicluka 6891c00
made start of symptoms nullable
chris-cwa 724527e
tests
chris-cwa d35d3cc
Adjusted navigation, fixed dark theme
Oliver-Zimmerman 1b6ca0a
Update Project.xml
Oliver-Zimmerman ae9a419
use of postValue() in SubmissionViewModel.kt
Oliver-Zimmerman 105ef9e
Merge remote-tracking branch 'origin/feature/EXPOSUREAPP_2489' into f…
Oliver-Zimmerman b3ac929
Added direction in tester nav graph
Oliver-Zimmerman ca3f728
improvements required by review
chris-cwa 87d2b67
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
chris-cwa c86af68
moving companion
chris-cwa 9f880ad
moving companion
chris-cwa e33ec4f
moving companion
chris-cwa 3e1b753
fixed issues from partner review
chris-cwa a466912
fixed issues from partner review
chris-cwa a0b177b
fixed issues from partner review
chris-cwa 6a81ef3
fixed issues from partner review
chris-cwa 047e8fb
fixed issues from partner review
chris-cwa feef408
using utc
chris-cwa 99a52e4
edge case tests
chris-cwa 51f7be6
Merge branch 'release/1.4.x' into feature/EXPOSUREAPP_2489
d4rken efc70d0
made inner class
chris-cwa 59f7e27
Merge branch 'feature/EXPOSUREAPP_2489' of https://github.com/corona-…
chris-cwa f6caed3
Refactored Symptoms Class Name (+data class)
d4rken 03feb77
Change SubmissionViewModel scope to ensure that the same viewmodel is…
d4rken 958e13c
extracted null check + log
chris-cwa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/DefaultKeyConverter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
...-Warn-App/src/main/java/de/rki/coronawarnapp/submission/ExposureKeyHistoryCalculations.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } |
12 changes: 12 additions & 0 deletions
12
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/KeyConverter.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
21 changes: 21 additions & 0 deletions
21
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/Symptoms.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/TransmissionRiskVector.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
| } | ||
52 changes: 52 additions & 0 deletions
52
...n-App/src/main/java/de/rki/coronawarnapp/submission/TransmissionRiskVectorDeterminator.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.