I have a biometric login that I would like to link to a Google Docs, both exist and work, but I'm looking for help to connect the two.
I have the Google Docs shared with a link and the source for the biometric login, which works perfectly.
I'd love some help connecting them, so that when clicking on the success text, it opens my link.
Here is the code of the app that returns the success of the login, and the message on screen:
@Composable
fun TextAuthenticationResult(visibilityState: Boolean) {
AnimatedVisibility(visible = visibilityState) {
Text(
text = "Authentication success",
textAlign = TextAlign.Center,
modifier = Modifier
.padding(5.dp),
style = MaterialTheme.typography.bodyLarge,
color = Color("#9ccc65".toColorInt())
)
Spacer(modifier = Modifier.padding(bottom = 10.dp))
}
}
Can I have some help, please, adapting this so that on touch, it opens a specific link?
Many thanks, all
Add Modifier.clickable
to your Text
composable and handle the click event like this:
@Composable
fun TextAuthenticationResult(visibilityState: Boolean) {
val context = LocalContext.current // Get current context
AnimatedVisibility(visible = visibilityState) {
Text(
text = "Your Google Docs link",
textAlign = TextAlign.Center,
modifier = Modifier
.padding(5.dp)
.clickable {
// Intent for opening the link in a browser
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(your_google_docs_link_here))
context.startActivity(intent)
},
style = MaterialTheme.typography.bodyLarge,
color = Color("#9ccc65".toColorInt())
)
Spacer(modifier = Modifier.padding(bottom = 10.dp))
}
}