diff --git a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt index c7ff580cec..53cdbf2488 100644 --- a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt +++ b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt @@ -82,7 +82,9 @@ internal class OrchestratorViewModel @Inject constructor( actionRequest = action try { - steps = stepsBuilder.build(action, projectConfiguration) + // We must preserve all of the steps across multiple callouts in to correctly + // resolve missing modality capture in enrol last followup call. + steps = cache.steps + stepsBuilder.build(action, projectConfiguration) } catch (e: SubjectAgeNotSupportedException) { sendErrorResponse(AppErrorResponse(AppErrorReason.AGE_GROUP_NOT_SUPPORTED)) return@launch diff --git a/feature/orchestrator/src/test/java/com/simprints/feature/orchestrator/OrchestratorViewModelTest.kt b/feature/orchestrator/src/test/java/com/simprints/feature/orchestrator/OrchestratorViewModelTest.kt index 5f24c1e5df..d98a6f2b7a 100644 --- a/feature/orchestrator/src/test/java/com/simprints/feature/orchestrator/OrchestratorViewModelTest.kt +++ b/feature/orchestrator/src/test/java/com/simprints/feature/orchestrator/OrchestratorViewModelTest.kt @@ -348,29 +348,10 @@ internal class OrchestratorViewModelTest { every { cache.steps } returns savedSteps viewModel.handleAction(mockk()) - viewModel.restoreStepsIfNeeded() verify { cache.steps } } - @Test - fun `Does not restore steps if not empty`() = runTest { - val originalSteps = listOf( - createMockStep(StepId.FINGERPRINT_CAPTURE), - ) - every { stepsBuilder.build(any(), any()) } returns originalSteps - val savedSteps = listOf( - createMockStep(StepId.SETUP), - createMockStep(StepId.CONSENT), - ) - every { cache.steps } returns savedSteps - - viewModel.handleAction(mockk()) - viewModel.restoreStepsIfNeeded() - - verify(exactly = 0) { cache.steps } - } - @Test fun `Restores modalities if empty`() = runTest { val projectModalities = listOf(