-
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
Open
anandwana001
wants to merge
6
commits into
master
Choose a base branch
from
anandwana001/2815/use-active-survey-flow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+7
−1
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cf67dce
using activeSurveyFlow
anandwana001 222adf4
Merge branch 'master' into anandwana001/2815/use-active-survey-flow
gino-m 8bac153
Merge branch 'master' into anandwana001/2815/use-active-survey-flow
anandwana001 480564d
Merge branch 'master' into anandwana001/2815/use-active-survey-flow
anandwana001 392861a
Merge branch 'master' into anandwana001/2815/use-active-survey-flow
anandwana001 c351daa
suggested fix
anandwana001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
What will happen if the coroutine is never completed? Will the app freeze until ANR error occurs?
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.
During the standup today, @anandwana001 suggested adding a timeout here. @gino-m I suggested that we allow the timeout exception to propagate and crash the app, since not being able to load the survey from the local db would be an unrecoverable error.
Ideally, we would ensure the survey was active before rendering the
DataCollectionFragment
. We could then useSurveyRepository.activeSurvey
directly rather than the Flow to get the current survey. @shobhitagarwal1612 Is this possible, based on how the fragment gets activated?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 don't think so, the fragment gets restored when the activity is started and the injected dependencies are initialized after the fragment is created.
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.
On configuration change, yes, but on app restart we explicitly redirect to this fragment if there's an unsaved draft, no? On configuration change the VM should still exist, so this wouldn't be an issue. In
HomeScreenFragment.onViewCreated
, however, we navigate to the data collection screen if there's an unsaved draft.That said, I agree it would be more robust for the fragment which needs the survey to handle the edge cases, rather than the navigation source.
@anandwana001 Let's keep the fix in this PR plus timeout as a workaround, we can add other handle delayed load and other edge cases if it turns out to be an issue.