Replace ViewPager2 with Compose-based TaskScreenContainer for Data Collection#3735
Replace ViewPager2 with Compose-based TaskScreenContainer for Data Collection#3735shobhitagarwal1612 wants to merge 16 commits into
Conversation
…creen and TaskScreenContainer
…onViewModel UI effects
andreia-ferreira
left a comment
There was a problem hiding this comment.
The only issue I found was when restoring a draft where the current task was conditional. Clicking on any of the previous/next buttons makes the app crash. Tested this behavior on master to confirm it's not an existing issue and couldn't reproduce
Screen_recording_20260513_175154.webm
tested on API 24 and 36 and happens on both
|
@andreia-ferreira Thanks for catching the bug! I think it was happening because of using |
|
thanks for looking into it, I tested it again but it seems to still happen unfortunately. You can try to join this survey link which I used in the recording below, to see if you can reproduce it too Screen_recording_20260514_105749.webm |
|
There is an issue with creating new conditional surveys with the web client. Could you please make the above linked survey public or add me as a collaborator? |
|
@shobhitagarwal1612 added you to the survey's data collectors. The 'Conditionals test' survey should show up on your device now |
|
Upon deeper investigation, I found that the issue is happening due to the complete migration from fragment to compose based views. Earlier during draft resume flow, all task fragments were auto-loaded by the view pager. This used to instantiate their view model and add their values to With the new architecture, only the current active task and it's view model are loaded. Therefore, unvisited previous task responses are missing from the collected The proposed solution is to pre-populate |
…dding bulk update support to TaskDataHandler
Fixes #3709
This PR overhauls the data collection flow by migrating it to a Compose-based architecture. It removes the legacy
ViewPager2and fragment-based approach (DataCollectionTaskFragment,DataCollectionViewPagerAdapter) in favor of a newTaskScreenContainer. It also refactors event handling to be more deeply integrated with ViewModels.Key Changes:
ViewPager2and task fragments with Compose-basedTaskScreenContainer.TaskMapFragmentContainerwith the official ComposeAndroidFragment.DataCollectionViewModelby removingMutableSharedFlowand using UI effects.onButtonClickedparameter from task screens and handle clicks via individual ViewModels.OpenSettingsandSetAwaitingPhotoCaptureto useDataCollectionViewModelUI effects.Steps to verify:
@andreia-ferreira PTAL?