MS-1502 Refactor Life feedback fragment to have a single UI state#1737
MS-1502 Refactor Life feedback fragment to have a single UI state#1737luhmirin-s wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the face live-feedback capture screen to use a single, immutable UI state (LiveFeedbackState) exposed from the ViewModel via StateFlow, with the fragment rendering deterministically from that state. It also removes the legacy BAD_QUALITY face-detection status from capture logic/tests and deprecates the corresponding face-capture event result.
Changes:
- Replaced multiple
LiveDatastreams in the live-feedback ViewModel/fragment with a singleStateFlow<LiveFeedbackState>and state-driven rendering. - Removed
FaceDetection.Status.BAD_QUALITYand stopped emittingFaceCapturePayload.Result.BAD_QUALITY(now deprecated in event model). - Consolidated/rewrote live-feedback ViewModel tests into a single behavior-pinning test file and updated related capture tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| infra/events/src/main/java/com/simprints/infra/events/event/domain/models/FaceCaptureEvent.kt | Deprecates the legacy BAD_QUALITY event result value. |
| face/capture/src/main/java/com/simprints/face/capture/models/FaceDetection.kt | Removes BAD_QUALITY from detection statuses. |
| face/capture/src/main/java/com/simprints/face/capture/usecases/SimpleCaptureEventReporter.kt | Stops mapping capture status to BAD_QUALITY payload results. |
| face/capture/src/main/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackViewModel.kt | Refactors to single-source-of-truth StateFlow state, removes runBlocking, and drives UI via emitted state snapshots. |
| face/capture/src/main/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackState.kt | Introduces immutable UI state + progress model + status→feedback mapping. |
| face/capture/src/main/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackFragment.kt | Renders from LiveFeedbackState and collects state with repeatOnLifecycle. |
| face/capture/src/test/java/com/simprints/face/capture/usecases/SimpleCaptureEventReporterTest.kt | Updates expectations to match removal of BAD_QUALITY reporting. |
| face/capture/src/test/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackViewModelTest.kt | New consolidated tests for the refactored single-state ViewModel. |
| face/capture/src/test/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackFragmentViewModelTest.kt | Removes legacy tests for the old ViewModel shape. |
| face/capture/src/test/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackAutoCaptureFragmentViewModelTest.kt | Removes legacy auto-capture tests for the old ViewModel shape. |
| face/capture/src/test/java/com/simprints/face/capture/screens/FaceCaptureViewModelTest.kt | Initializes the Face BioSDK in tests to align with updated ViewModel behavior. |
Comments suppressed due to low confidence (1)
face/capture/src/main/java/com/simprints/face/capture/screens/livefeedback/LiveFeedbackViewModel.kt:105
emit()'s parameters are non-nullable, so the Elvis operators (phase ?: ...,feedback ?: ...,result ?: ...) are dead code and will always pick the left-hand side. This adds noise and can mask intent (e.g., if the goal was to allow passingnullto keep existing state).
4d3d11d to
3583931
Compare
|
|
||
| private var cameraControl: CameraControl? = null | ||
|
|
||
| private var isPermissionDenied = false |
There was a problem hiding this comment.
Let's use PermissionStatus enum here for clearer handling
package com.simprints.core.domain.permission
enum class PermissionStatus {
Granted,
Denied,
DeniedNeverAskAgain,
}
There was a problem hiding this comment.
I can save the status, but it isn't necessary since we only really care about boolean granted/denied state in most cases. Note that within renderNoPermission both of the denied states are handled slightly differently.
3583931 to
99af6ca
Compare
|



JIRA ticket
Will be released in: 2026.3.0
Notable changes
Testing guidance
Additional work checklist