Migrate PhotoTaskFragment to use TaskScreen Component#3654
Migrate PhotoTaskFragment to use TaskScreen Component#3654shobhitagarwal1612 merged 20 commits intomasterfrom
Conversation
- Introduce `PhotoTaskScreen` to manage the UI state and layout for photo tasks, integrating the new `TaskScreen` component. - Move `PhotoTaskContent` and `CaptureButton` into `PhotoTaskScreen.kt`. - Add `PhotoTaskScreenTest` to verify UI components, action button states, and permission dialog visibility.
…o file handling in PhotoTaskViewModel
…to saving logic in PhotoTaskViewModel
…ling and state management - Replace `MutableSharedFlow` with `Channel` for photo task events to ensure reliable event delivery. - Convert the `uri` property from a `Flow` to a `StateFlow` using `stateIn`. - Update `PhotoTaskScreen` to collect events using `flowWithLifecycle` for better lifecycle awareness. - Replace `File` object storage with `tempPhotoFilePath` string in `PhotoTaskViewModel` to handle process death and persistence more effectively. - Ensure `isAwaitingPhotoCapture` is correctly reset to `false` when photo capture permissions are denied. - Use `rememberUpdatedState` for the `onAwaitingPhotoCapture` callback in `PhotoTaskScreen`. - Update unit tests to reflect the change to `Channel` for events and ensure proper file path handling.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3654 +/- ##
============================================
+ Coverage 66.70% 66.80% +0.10%
+ Complexity 1628 1608 -20
============================================
Files 362 363 +1
Lines 8944 8980 +36
Branches 1154 1159 +5
============================================
+ Hits 5966 5999 +33
- Misses 2326 2332 +6
+ Partials 652 649 -3
🚀 New features to boost your workflow:
|
|
@andreia-ferreira Can you PTAL? |
andreia-ferreira
left a comment
There was a problem hiding this comment.
Screen_recording_20260407_105318.webm
cancelling the camera intent (by clicking back for example) should not be treated as an error I believe. Also both the error state and taking a picture seem to cause the progress bar to have a wrong position bellow the footer buttons.
Tested on a pixel 9 pro fold, API 36.1
app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskScreen.kt
Show resolved
Hide resolved
...src/main/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskViewModel.kt
Outdated
Show resolved
Hide resolved
...src/main/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/org/groundplatform/android/ui/datacollection/tasks/photo/PhotoTaskScreen.kt
Outdated
Show resolved
Hide resolved
|
Not sure why the test is failing on CI? |
|
the tests passed locally for me, so probably the failure was because of a corrupted Gradle cache in the CI. The cache wasn't reused in this latest run (possibly due to invalidation), and the tests are now passing. But if it happens again we can try to delete that cache under actions -> caches |
Towards #3630
PhotoTaskScreenComposable to handle the UI.PhotoTaskFragmentto usecreateComposeViewand render the newPhotoTaskScreen.PhotoTaskScreenPhotoTaskFragmentTestwithPhotoTaskScreenTestand add more coverageScreen_recording_20260403_161428.webm
@andreia-ferreira PTAL?