Add click handling to choose backup type learn more.

This commit is contained in:
Alex Hart
2025-06-26 14:14:28 -03:00
parent 0947d5b7b5
commit c75cafd5f5
2 changed files with 16 additions and 13 deletions

View File

@@ -171,7 +171,12 @@ class MessageBackupsFlowFragment : ComposeFragment(), InAppPaymentCheckoutDelega
isNextEnabled = state.isCheckoutButtonEnabled(),
onMessageBackupsTierSelected = viewModel::onMessageBackupTierUpdated,
onNavigationClick = viewModel::goToPreviousStage,
onReadMoreClicked = {},
onReadMoreClicked = {
CommunicationActions.openBrowserLink(
requireContext(),
getString(R.string.backup_support_url)
)
},
onNextClicked = viewModel::goToNextStage
)
}

View File

@@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.ClickableText
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -39,10 +38,11 @@ import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.ExperimentalTextApi
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withAnnotation
import androidx.compose.ui.text.withLink
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import kotlinx.collections.immutable.persistentListOf
@@ -119,28 +119,26 @@ fun MessageBackupsTypeSelectionScreen(
val primaryColor = MaterialTheme.colorScheme.primary
val readMoreString = buildAnnotatedString {
append(stringResource(id = R.string.MessageBackupsTypeSelectionScreen__all_backups_are_end_to_end_encrypted))
val readMore = stringResource(id = R.string.MessageBackupsTypeSelectionScreen__learn_more)
append(" ")
withAnnotation(tag = "URL", annotation = "learn-more") {
withLink(
LinkAnnotation.Clickable(tag = "learn-more") {
onReadMoreClicked()
}
) {
withStyle(
style = SpanStyle(
color = primaryColor
)
) {
append(readMore)
append(stringResource(id = R.string.MessageBackupsTypeSelectionScreen__learn_more))
}
}
}
ClickableText(
Text(
text = readMoreString,
style = MaterialTheme.typography.bodyLarge.copy(textAlign = TextAlign.Center, color = MaterialTheme.colorScheme.onSurfaceVariant),
onClick = { offset ->
readMoreString
.getStringAnnotations(tag = "URL", start = offset, end = offset)
.firstOrNull()?.let { onReadMoreClicked() }
},
modifier = Modifier.padding(top = 8.dp)
)
}