-
Notifications
You must be signed in to change notification settings - Fork 487
Fix the submission with zero keys (EXPOSUREAPP-1742) #990
Conversation
1. sets the LocalData values to emulate jey submission.
kolyaopahle
left a comment
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.
Just one small nitpick :)
| if (keys.isNotEmpty()) { | ||
| submissionViewModel.submitDiagnosisKeys(keys) | ||
| } else { | ||
| SubmissionService.submissionSuccessful() |
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.
Nitpick: From a separation of concerns perspective i would prefer it if the SubmissionService was not directly included in the Fragment but called from the ViewModel instead.
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.
Hi Kolya, since we do not send any network request, the current way seemed like the most efficient and straight forward.
@Fabian-K what do you think of this?
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.
My main concern here is not with networking but with DI, if we later add support for DI this fragment would turn into an additional injection point for the SubmissionService, which could be avoided if we only use the SubmissionService inside of the SubmissionViewModel.
To be clear, i do not want you to create any kind of async handling for this call, i just want to move the invocation to a function inside of the SubmissionViewModel
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.
@kolyaopahle changes have been made, please take a look.
Thank you
Corona-Warn-App/src/main/java/de/rki/coronawarnapp/service/submission/SubmissionService.kt
Show resolved
Hide resolved
kolyaopahle
left a comment
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 👍
| BackgroundWorkScheduler.stopWorkScheduler() | ||
| LocalData.numberOfSuccessfulSubmissions(1) |
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.
The SubmissionViewModel already has the SubmissionService as a dependency. Instead of duplicating the code here, we can call SubmissionService.submissionSuccessful()
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.
Had a word with Kolya yesterday, due to future changes such as DI, it was suggested that the method should be in ViewModel. I am aware of the fact that it's repeating, @kolyaopahle what do you think? I can just call the SubmissionService.submissionSuccessful() function in Viewmodel but may not be a good idea to have inter-dependencies in ViewModel and submissionService.
let me know what you think
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 think the original comment referred to not adding an additional dependency to the Fragment. The ViewModel already has a dependency to SubmissionService, therefore I see no issue with this.
|
Kudos, SonarCloud Quality Gate passed!
|
Checklist
Description
if there are no keys to submit, this is handled silently and submission done screen is loaded