Scan: Fetch scan state with polling#13740
Conversation
… scan state in the VM + update tests
… for reuse in Scan
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
Generated by 🚫 dangerJS |
|
You can test the changes on this Pull Request by downloading the APK here. |
| fetchScanState(site = site, polling = true).collect { | ||
| emit(it) | ||
| delay(delayInMs) | ||
| } |
There was a problem hiding this comment.
This is a tricky part with a recursive call to the fetchScanState function during polling. We might want to replace it with a while loop.
malinajirka
left a comment
There was a problem hiding this comment.
Thanks @ashiagr! I reviewed the changes and it looks great to me. However, I didn't time to finish testing the behavior. I'll wrap it up and merge the PR first thing in the morning.
| private fun fetchScanState() { | ||
| launch { | ||
| fetchScanStateUseCase.fetchScanState(site = site) | ||
| .flowOn(bgDispatcher) |
There was a problem hiding this comment.
🔍 Nitpick: We might want to consider setting the dispatcher in the usecase so no-one can invoke the usecase on the ui thread. Wdyt?
malinajirka
left a comment
There was a problem hiding this comment.
I've tested the app and it all works as described, good job! ⭐
malinajirka
left a comment
There was a problem hiding this comment.
Thanks @ashiagr! LGTM - feel free to merge it when you replace the fluxc hash.
# Conflicts: # build.gradle
Parent: #13326
This PR
ScanStatusServiceto newly added UseCase in the scan VMStart Scan Child PR: #13741
To test
Prerequisite:
(Tests included in
FetchScanStateUseCaseTestandScanViewModelTest)Notes
GetScanStateUseCaseor from inside theFetchScanStateUseCase.Merge Instructions
PR submission checklist:
RELEASE-NOTES.txtif necessary.