From db7c28bee3263f03f75cd95858c21fbeb6868593 Mon Sep 17 00:00:00 2001 From: Sergejs Luhmirins Date: Wed, 1 Oct 2025 17:19:51 +0300 Subject: [PATCH] MS-1181 Add exit form handling to matcher screen --- feature/matcher/build.gradle.kts | 1 + .../simprints/matcher/screen/MatchFragment.kt | 24 +++++++++++++++++++ .../src/main/res/navigation/graph_matcher.xml | 5 ++++ 3 files changed, 30 insertions(+) diff --git a/feature/matcher/build.gradle.kts b/feature/matcher/build.gradle.kts index e6a34a307d..64fd4d0d20 100644 --- a/feature/matcher/build.gradle.kts +++ b/feature/matcher/build.gradle.kts @@ -9,6 +9,7 @@ android { } dependencies { + implementation(project(":feature:exit-form")) implementation(project(":infra:orchestrator-data")) implementation(project(":infra:enrolment-records:repository")) diff --git a/feature/matcher/src/main/java/com/simprints/matcher/screen/MatchFragment.kt b/feature/matcher/src/main/java/com/simprints/matcher/screen/MatchFragment.kt index cb16d60914..94d61c6425 100644 --- a/feature/matcher/src/main/java/com/simprints/matcher/screen/MatchFragment.kt +++ b/feature/matcher/src/main/java/com/simprints/matcher/screen/MatchFragment.kt @@ -3,6 +3,7 @@ package com.simprints.matcher.screen import android.animation.ObjectAnimator import android.os.Bundle import android.view.View +import androidx.activity.addCallback import androidx.activity.result.contract.ActivityResultContracts import androidx.core.view.isGone import androidx.core.view.isVisible @@ -14,15 +15,21 @@ import com.simprints.core.livedata.LiveDataEventWithContentObserver import com.simprints.core.tools.extentions.applicationSettingsIntent import com.simprints.core.tools.extentions.hasPermission import com.simprints.core.tools.extentions.permissionFromResult +import com.simprints.feature.exitform.ExitFormContract +import com.simprints.feature.exitform.ExitFormResult import com.simprints.infra.logging.LoggingConstants.CrashReportTag.ORCHESTRATION import com.simprints.infra.logging.Simber import com.simprints.infra.uibase.navigation.finishWithResult +import com.simprints.infra.uibase.navigation.handleResult +import com.simprints.infra.uibase.navigation.navigateSafely import com.simprints.infra.uibase.navigation.navigationParams import com.simprints.infra.uibase.view.applySystemBarInsets import com.simprints.infra.uibase.viewbinding.viewBinding import com.simprints.matcher.MatchParams import com.simprints.matcher.R import com.simprints.matcher.databinding.FragmentMatcherBinding +import com.simprints.matcher.screen.MatchFragment.Companion.LOADING_PROGRESS +import com.simprints.matcher.screen.MatchFragment.Companion.MATCHING_PROGRESS import com.simprints.matcher.screen.MatchViewModel.MatchState import dagger.hilt.android.AndroidEntryPoint import com.simprints.infra.resources.R as IDR @@ -56,7 +63,24 @@ internal class MatchFragment : Fragment(R.layout.fragment_matcher) { applySystemBarInsets(view) Simber.i("MatchFragment started (isFace=${params.isFaceMatch()})", tag = ORCHESTRATION) + findNavController().handleResult( + this, + R.id.matcherFragment, + ExitFormContract.DESTINATION, + ) { + val option = it.submittedOption() + if (option != null) { + findNavController().finishWithResult(this, it) + } + } + observeViewModel() + requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner) { + findNavController().navigateSafely( + this@MatchFragment, + MatchFragmentDirections.actionGlobalRefusalFragment(), + ) + } } override fun onResume() { diff --git a/feature/matcher/src/main/res/navigation/graph_matcher.xml b/feature/matcher/src/main/res/navigation/graph_matcher.xml index f19a76f90b..ff9ba5561f 100644 --- a/feature/matcher/src/main/res/navigation/graph_matcher.xml +++ b/feature/matcher/src/main/res/navigation/graph_matcher.xml @@ -12,4 +12,9 @@ android:name="params" app:argType="com.simprints.core.domain.step.StepParams" /> + + +