Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
No ToS
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyGiorgio committed Aug 12, 2023
1 parent 2fb26a4 commit f899a9e
Showing 1 changed file with 1 addition and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fun LoginPage(
) {
val key = remember { mutableStateOf(TextFieldValue("")) }
var errorMessage by remember { mutableStateOf("") }
val acceptedTerms = remember { mutableStateOf(!isFirstLogin) }
val acceptedTerms = remember { mutableStateOf(true) }
var termsAcceptanceIsRequired by remember { mutableStateOf("") }
val uri = LocalUriHandler.current
val context = LocalContext.current
Expand Down Expand Up @@ -183,52 +183,6 @@ fun LoginPage(

Spacer(modifier = Modifier.height(20.dp))

if (isFirstLogin) {
Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(
checked = acceptedTerms.value,
onCheckedChange = { acceptedTerms.value = it }
)

val regularText =
SpanStyle(color = MaterialTheme.colors.onBackground)

val clickableTextStyle =
SpanStyle(color = MaterialTheme.colors.primary)

val annotatedTermsString = buildAnnotatedString {
withStyle(regularText) {
append(stringResource(R.string.i_accept_the))
}

withStyle(clickableTextStyle) {
pushStringAnnotation("openTerms", "")
append(stringResource(R.string.terms_of_use))
}
}

ClickableText(
text = annotatedTermsString
) { spanOffset ->
annotatedTermsString.getStringAnnotations(spanOffset, spanOffset)
.firstOrNull()
?.also { span ->
if (span.tag == "openTerms") {
runCatching { uri.openUri("https://github.com/vitorpamplona/amethyst/blob/main/PRIVACY.md") }
}
}
}
}

if (termsAcceptanceIsRequired.isNotBlank()) {
Text(
text = termsAcceptanceIsRequired,
color = MaterialTheme.colors.error,
style = MaterialTheme.typography.caption
)
}
}

if (isPackageInstalled(context, "org.torproject.android")) {
Row(verticalAlignment = Alignment.CenterVertically) {
Checkbox(
Expand Down

0 comments on commit f899a9e

Please sign in to comment.