diff --git a/feature/client-api/src/main/java/com/simprints/feature/clientapi/ClientApiViewModel.kt b/feature/client-api/src/main/java/com/simprints/feature/clientapi/ClientApiViewModel.kt index c256754b69..a9359767de 100644 --- a/feature/client-api/src/main/java/com/simprints/feature/clientapi/ClientApiViewModel.kt +++ b/feature/client-api/src/main/java/com/simprints/feature/clientapi/ClientApiViewModel.kt @@ -203,7 +203,6 @@ class ClientApiViewModel @Inject internal constructor( val flowCompleted = isFlowCompletedWithError(errorResponse) simpleEventReporter.addCompletionCheckEvent(flowCompleted = flowCompleted) simpleEventReporter.closeCurrentSessionNormally() - deleteSessionEventsIfNeeded(currentSessionId) _returnResponse.send( diff --git a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt index bf02fd574e..3a827ad6c8 100644 --- a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt +++ b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt @@ -95,8 +95,7 @@ internal class OrchestratorFragment : Fragment(R.layout.fragment_orchestrator) { observeOrchestratorVm() handleResult(AlertContract.DESTINATION) { alertResult -> - clientApiVm.handleErrorResponse( - args.requestAction, + orchestratorVm.handleErrorResponse( AppErrorResponse(alertResult.appErrorReason ?: AppErrorReason.UNEXPECTED_ERROR) ) } @@ -151,8 +150,7 @@ internal class OrchestratorFragment : Fragment(R.layout.fragment_orchestrator) { }) loginCheckVm.returnLoginNotComplete.observe(viewLifecycleOwner, LiveDataEventObserver { - clientApiVm.handleErrorResponse( - args.requestAction, + orchestratorVm.handleErrorResponse( AppErrorResponse(AppErrorReason.LOGIN_NOT_COMPLETE) ) }) 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 52026c8be1..8a49ea7c77 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 @@ -80,7 +80,7 @@ internal class OrchestratorViewModel @Inject constructor( try { steps = stepsBuilder.build(action, projectConfiguration) } catch (e: SubjectAgeNotSupportedException) { - sendErrorResponse(AppErrorResponse(AppErrorReason.AGE_GROUP_NOT_SUPPORTED)) + handleErrorResponse(AppErrorResponse(AppErrorReason.AGE_GROUP_NOT_SUPPORTED)) return@launch } @@ -94,7 +94,7 @@ internal class OrchestratorViewModel @Inject constructor( val errorResponse = mapRefusalOrErrorResult(result, projectConfiguration) if (errorResponse != null) { // Shortcut the flow execution if any refusal or error result is found - sendErrorResponse(errorResponse) + handleErrorResponse(errorResponse) return@launch } @@ -121,7 +121,7 @@ internal class OrchestratorViewModel @Inject constructor( doNextStep() } - private fun sendErrorResponse(errorResponse: AppResponse) { + fun handleErrorResponse(errorResponse: AppResponse) { addCallbackEvent(errorResponse) _appResponse.send(OrchestratorResult(actionRequest, errorResponse)) }