Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Cwa App Android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felix Foertsch
Cwa App Android
Commits
3b47b6f0
Unverified
Commit
3b47b6f0
authored
4 years ago
by
Kolya Opahle
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handling a NoRegistrationTokenSetException by returning UNPAIRED state (#161)
parent
a1a3c673
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/SubmissionRepository.kt
+23
-18
23 additions, 18 deletions
...java/de/rki/coronawarnapp/storage/SubmissionRepository.kt
with
23 additions
and
18 deletions
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/storage/SubmissionRepository.kt
+
23
−
18
View file @
3b47b6f0
package
de.rki.coronawarnapp.storage
package
de.rki.coronawarnapp.storage
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.MutableLiveData
import
de.rki.coronawarnapp.exception.NoRegistrationTokenSetException
import
de.rki.coronawarnapp.service.submission.SubmissionService
import
de.rki.coronawarnapp.service.submission.SubmissionService
import
de.rki.coronawarnapp.util.DeviceUIState
import
de.rki.coronawarnapp.util.DeviceUIState
import
de.rki.coronawarnapp.util.formatter.TestResult
import
de.rki.coronawarnapp.util.formatter.TestResult
...
@@ -18,7 +19,7 @@ object SubmissionRepository {
...
@@ -18,7 +19,7 @@ object SubmissionRepository {
if
(
LocalData
.
numberOfSuccessfulSubmissions
()
==
1
)
{
if
(
LocalData
.
numberOfSuccessfulSubmissions
()
==
1
)
{
uiState
=
DeviceUIState
.
SUBMITTED_FINAL
uiState
=
DeviceUIState
.
SUBMITTED_FINAL
}
else
{
}
else
{
if
(
LocalData
.
registrationToken
()
!=
""
)
{
if
(
LocalData
.
registrationToken
()
!=
null
)
{
uiState
=
when
{
uiState
=
when
{
LocalData
.
isAllowedToSubmitDiagnosisKeys
()
==
true
->
{
LocalData
.
isAllowedToSubmitDiagnosisKeys
()
==
true
->
{
DeviceUIState
.
PAIRED_POSITIVE
DeviceUIState
.
PAIRED_POSITIVE
...
@@ -31,27 +32,31 @@ object SubmissionRepository {
...
@@ -31,27 +32,31 @@ object SubmissionRepository {
}
}
private
suspend
fun
fetchTestResult
():
DeviceUIState
{
private
suspend
fun
fetchTestResult
():
DeviceUIState
{
val
testResult
=
SubmissionService
.
asyncRequestTestResult
()
try
{
val
testResult
=
SubmissionService
.
asyncRequestTestResult
()
if
(
testResult
==
TestResult
.
POSITIVE
)
{
if
(
testResult
==
TestResult
.
POSITIVE
)
{
LocalData
.
isAllowedToSubmitDiagnosisKeys
(
true
)
LocalData
.
isAllowedToSubmitDiagnosisKeys
(
true
)
}
}
val
initialTestResultReceivedTimestamp
=
LocalData
.
inititalTestResultReceivedTimestamp
()
val
initialTestResultReceivedTimestamp
=
LocalData
.
inititalTestResultReceivedTimestamp
()
if
(
initialTestResultReceivedTimestamp
==
null
)
{
if
(
initialTestResultReceivedTimestamp
==
null
)
{
val
currentTime
=
System
.
currentTimeMillis
()
val
currentTime
=
System
.
currentTimeMillis
()
LocalData
.
inititalTestResultReceivedTimestamp
(
currentTime
)
LocalData
.
inititalTestResultReceivedTimestamp
(
currentTime
)
testResultReceivedDate
.
value
=
Date
(
currentTime
)
testResultReceivedDate
.
value
=
Date
(
currentTime
)
}
else
{
}
else
{
testResultReceivedDate
.
value
=
Date
(
initialTestResultReceivedTimestamp
)
testResultReceivedDate
.
value
=
Date
(
initialTestResultReceivedTimestamp
)
}
}
return
when
(
testResult
)
{
return
when
(
testResult
)
{
TestResult
.
NEGATIVE
->
DeviceUIState
.
PAIRED_NEGATIVE
TestResult
.
NEGATIVE
->
DeviceUIState
.
PAIRED_NEGATIVE
TestResult
.
POSITIVE
->
DeviceUIState
.
PAIRED_POSITIVE
TestResult
.
POSITIVE
->
DeviceUIState
.
PAIRED_POSITIVE
TestResult
.
PENDING
->
DeviceUIState
.
PAIRED_NO_RESULT
TestResult
.
PENDING
->
DeviceUIState
.
PAIRED_NO_RESULT
TestResult
.
INVALID
->
DeviceUIState
.
PAIRED_ERROR
TestResult
.
INVALID
->
DeviceUIState
.
PAIRED_ERROR
}
}
catch
(
err
:
NoRegistrationTokenSetException
)
{
return
DeviceUIState
.
UNPAIRED
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment