Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions app/src/main/java/life/andre/message487/AppInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withLink

@OptIn(ExperimentalLayoutApi::class)
@Composable
internal fun AppInfo() {
val context = LocalContext.current
Expand All @@ -27,14 +32,20 @@ internal fun AppInfo() {
}
}
Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
FlowRow(horizontalArrangement = Arrangement.Center) {
Text(stringResource(R.string.app_version, BuildConfig.VERSION_NAME, BuildConfig.GIT_COMMIT_HASH),
modifier = Modifier.align(Alignment.CenterVertically),
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
TextButton(onClick = { openLink("https://github.com/andre487/AndroidMessage487") }) {
Text(stringResource(R.string.github), style = MaterialTheme.typography.bodySmall)
}
}
Text(
text = buildAnnotatedString {
append(stringResource(R.string.app_version, BuildConfig.VERSION_NAME, BuildConfig.GIT_COMMIT_HASH))
append(" · ")
val url = "https://github.com/andre487/AndroidMessage487"
withLink(LinkAnnotation.Url(url,
styles = TextLinkStyles(style = SpanStyle(color = MaterialTheme.colorScheme.primary)),
linkInteractionListener = { openLink(url) })) {
append(stringResource(R.string.github))
}
},
modifier = Modifier.fillMaxWidth(), textAlign = TextAlign.Center,
style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant,
)
TextButton(onClick = { openLink("https://github.com/andre487/AndroidMessage487/blob/main/PRIVACY.md") },
modifier = Modifier.fillMaxWidth()) {
Text(stringResource(R.string.privacy_policy))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ class ScreenInteractionTest {
for (connection in listOf(false, true)) {
if (connection) compose.onNode(hasText(application.getString(R.string.connection_nav)) and hasClickAction()).performClick()
compose.onNode(hasScrollToIndexAction()).performScrollToNode(hasText(application.getString(R.string.privacy_policy)))
compose.onNodeWithText(application.getString(R.string.app_version, BuildConfig.VERSION_NAME, BuildConfig.GIT_COMMIT_HASH)).assertIsDisplayed()
node(R.string.github).performClick()
val github = application.getString(R.string.github)
val footerText = application.getString(R.string.app_version, BuildConfig.VERSION_NAME, BuildConfig.GIT_COMMIT_HASH) + " · " + github
val footer = compose.onNodeWithText(footerText).assertIsDisplayed()
footer.onChildren().filter(hasClickAction()).assertCountEquals(1).onFirst()
.performSemanticsAction(androidx.compose.ui.semantics.SemanticsActions.OnClick) { it() }
compose.runOnIdle {
val intent = org.robolectric.Shadows.shadowOf(compose.activity).nextStartedActivity
assertNotNull(intent)
Expand Down
Loading