Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ internal class FaceCaptureViewModel @Inject constructor(
if (faceConfiguration?.imageSavingStrategy?.shouldSaveImage() == true) {
saveFaceDetections()
}

if (faceDetections.isEmpty()) {
Simber.i("No face captured", tag = FACE_CAPTURE)
recapture()
return@launch
}
val items = faceDetections.map { detection ->
BiometricTemplateCapture(
captureEventId = detection.id,
Expand All @@ -187,7 +191,6 @@ internal class FaceCaptureViewModel @Inject constructor(
}
val referenceId = UUID.randomUUID().toString()
eventReporter.addBiometricReferenceCreationEvents(referenceId, items.map { it.captureEventId })

val format = faceDetections
.firstOrNull()
?.face
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ internal class ConfirmationFragment : Fragment(R.layout.fragment_confirmation) {
) {
super.onViewCreated(view, savedInstanceState)
applySystemBarInsets(view)

val detection = mainVm.getSampleDetection()
// Check if state was lost (Process Death)
if (detection == null) {
// it is safer to force a recapture in this case
Simber.i("Face detection state lost during confirmation, forcing recapture", tag = ORCHESTRATION)
mainVm.recapture()
return
}
Simber.i("ConfirmationFragment started", tag = ORCHESTRATION)
startTime = faceTimeHelper.now()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ class FaceCaptureViewModelTest {
}
}

@Test
fun `restart capture when flow finishes and no face detected`() {
viewModel.initFaceBioSdk(mockk(), ModalitySdkType.SIM_FACE)
viewModel.flowFinished()
assertThat(viewModel.recaptureEvent.getOrAwaitValue()).isNotNull()
}

@Test
fun `Recapture requests clears capture list`() {
viewModel.captureFinished(faceDetections)
Expand Down