-
Notifications
You must be signed in to change notification settings - Fork 496
ENFClient v2 - ExposureDetectionTracker without identifier (EXPOSUREAPP-3540) #1605
ENFClient v2 - ExposureDetectionTracker without identifier (EXPOSUREAPP-3540) #1605
Conversation
exposureDetectionTracker.trackNewExposureDetection(token) | ||
diagnosisKeyProvider.provideDiagnosisKeys(keyFiles, configuration, token) | ||
} | ||
// NO-OP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe throw UnsupportedOperationException()
until this is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throwing UnsupportedOperationException() now
@@ -93,34 +94,16 @@ class DefaultExposureDetectionTracker @Inject constructor( | |||
} | |||
} | |||
|
|||
override fun finishExposureDetection(identifier: String, result: Result) { | |||
Timber.i("finishExposureDetection(token=%s, result=%s)", identifier, result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please re-add a log statement directly at function start, the following methods using updateSafely
are async, if there is any issue there we'd still like to know that the function was called, but failed somewhere later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added.
@@ -134,6 +117,54 @@ class DefaultExposureDetectionTracker @Inject constructor( | |||
} | |||
} | |||
|
|||
private fun finishExposureDetectionWithoutIdentifier( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would an extension function improve readability here?
Something like fun Map<String, TrackedExposureDetection>.findOrCreateByIdentifier(identifier: String?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to:
private fun Map<String, TrackedExposureDetection>.findUnfinishedOrCreateIdentifier(): String {
.map { it.value } | ||
.filter { it.finishedAt == null } | ||
.maxByOrNull { it.startedAt.millis } | ||
?.identifier ?: kotlin.run { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit difficult to read. How could we make this easier on the 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point.
?.identifier ?: kotlin.run is out.
readability improved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 all handleable changes seem solved, lets get this merged to get the main branch ready, tests can be fixed later before we merge into release
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
This PR implements one additional part of the new ExposureWindowMode (#1584 ).
We don't have a token anymore and can't provide one to the ExposureDetectionTracker.
This PR implements the opportunity to use ExposureDetectionTracker with & without identifier.
Note: ExposureDetectionTracker was CalculationTracker some days ago (just to prevent confusion).