Skip to content

Commit

Permalink
fix: nav cancelled actions
Browse files Browse the repository at this point in the history
  • Loading branch information
JNdhlovu committed Oct 18, 2024
1 parent 457c92e commit 456a12b
Showing 1 changed file with 26 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import com.smileidentity.compose.SmartSelfieAuthentication
import com.smileidentity.compose.SmartSelfieEnrollment
import com.smileidentity.models.IdInfo
import com.smileidentity.models.JobType
import com.smileidentity.results.SmileIDResult
import com.smileidentity.sample.BottomNavigationScreen
import com.smileidentity.sample.ProductScreen
import com.smileidentity.sample.R
Expand Down Expand Up @@ -287,7 +288,11 @@ fun MainScreen(
jobId = jobId,
) { result ->
viewModel.onBiometricKycResult(userId, jobId, result)
navController.popBackStack()
if (result is SmileIDResult.Success) {
navController.popBackStack()
} else {
idInfo = null
}
}
}
}
Expand Down Expand Up @@ -317,10 +322,14 @@ fun MainScreen(
allowGalleryUpload = true,
) { result ->
viewModel.onDocumentVerificationResult(userId, jobId, result)
navController.popBackStack(
route = BottomNavigationScreen.Home.route,
inclusive = false,
)
if (result is SmileIDResult.Success) {
navController.popBackStack(
route = BottomNavigationScreen.Home.route,
inclusive = false,
)
} else {
navController.popBackStack()
}
}
}
composable(ProductScreen.EnhancedDocumentVerification.route) {
Expand All @@ -345,10 +354,18 @@ fun MainScreen(
allowGalleryUpload = true,
) { result ->
viewModel.onEnhancedDocumentVerificationResult(userId, jobId, result)
navController.popBackStack(
route = BottomNavigationScreen.Home.route,
inclusive = false,
)
if (result is SmileIDResult.Success) {
navController.popBackStack(
route = BottomNavigationScreen.Home.route,
inclusive = false,
)
} else {
idInfo = null
navController.popBackStack()
navController.navigate(
route = ProductScreen.EnhancedDocumentVerification.route,
)
}
}
}
}
Expand Down

0 comments on commit 456a12b

Please sign in to comment.