Could you please help me? I navigate from the Details screen to Chrome custom tabs but when I click on the back button I need to press the back button twice to go back to the Details screen. When I click on it only once I see some blank page. There is no such destination/screen in my project. Could you please have a look?
Navhost:
composable(
route = "webview?url={url}",
arguments = listOf(
navArgument("url") {
type = NavType.StringType
}
)
) { backStackEntry ->
val url = backStackEntry.arguments?.getString(Utils.URL)
ChromeCustomTab(url = url)
}
ChromeCustomTab:
@Composable
fun ChromeCustomTab(url: String?) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxSize()
) {
Column {
val context = LocalContext.current
val customTabsIntent = CustomTabsIntent.Builder().build()
val droppedUrl = url?.drop(6)
val uri: Uri = Uri.parse(droppedUrl)
try {
customTabsIntent.launchUrl(context, uri)
} catch (e: Exception) {
context.startActivity(Intent(Intent.ACTION_VIEW, uri))
}
}
}
}


