-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using activeSurveyFlow to make flow async #2890
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2890 +/- ##
============================================
+ Coverage 62.52% 62.55% +0.02%
Complexity 1203 1203
============================================
Files 267 267
Lines 6357 6358 +1
Branches 881 880 -1
============================================
+ Hits 3975 3977 +2
Misses 1831 1831
+ Partials 551 550 -1
|
Won't this change now start failing to get the |
Should we make the job as a flow too? |
The question remains the same, will that pass on the error to the next item or will it stabilize the screen when survey is null? |
as the data collection screen is completely dependent on the activeSurvey, so in the worst case should we navigateUp or should we show some loading retry to fix the state flows and get the updated data? |
We shouldn't navigate up unless it's the last resort. Given that we know the survey id, we should try to make our sync code async and wait until it is ready. |
ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt
Outdated
Show resolved
Hide resolved
ground/src/main/java/com/google/android/ground/ui/datacollection/DataCollectionViewModel.kt
Outdated
Show resolved
Hide resolved
private val activeSurvey: Survey = runBlocking { | ||
surveyRepository.activeSurveyFlow.filterNotNull().first() | ||
} |
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.
What will happen if the coroutine is never completed? Will the app freeze until ANR error occurs?
Fixes #2815
@shobhitagarwal1612 PTAL?