Skip to content
Snippets Groups Projects
Unverified Commit c29dc124 authored by Matthias Urhahn's avatar Matthias Urhahn Committed by GitHub
Browse files

Merge pull request #1867 from corona-warn-app/fix/merge-18x-into-19x-v2

Merge 1.8.x into 1.9.x
parents 6697cfb0 2fb344bb
No related branches found
No related tags found
No related merge requests found
......@@ -59,6 +59,7 @@ class DefaultDiagnosisKeyProvider @Inject constructor(
provideDiagnosisKeysTask
.addOnSuccessListener { cont.resume(true) }
.addOnFailureListener {
Timber.w("Key submission failed because ${it.message}")
val wrappedException =
when (it is ApiException &&
it.statusCode == ReportingConstants.STATUS_CODE_REACHED_REQUEST_LIMIT) {
......
......@@ -26,7 +26,6 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch
import org.joda.time.Duration
import timber.log.Timber
import java.util.NoSuchElementException
import javax.inject.Inject
import javax.inject.Singleton
......@@ -153,11 +152,10 @@ class TracingRepository @Inject constructor(
val taskLastFinishedAt = try {
taskController.tasks.first()
.filter { it.taskState.type == DownloadDiagnosisKeysTask::class }
.mapNotNull { it.taskState.finishedAt }
.sortedDescending()
.first()
} catch (e: NoSuchElementException) {
Timber.tag(TAG).v("download did not run recently - no task with a finishedAt date found")
.mapNotNull { it.taskState.finishedAt ?: it.taskState.startedAt }
.maxOrNull()!!
} catch (e: NullPointerException) {
Timber.tag(TAG).v("download did not run recently - no task with a date found")
return true
}
......
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