Merge remote-tracking branch 'origin/develop' into fix/jme/1077-textbuttons-in-dark-theme

This commit is contained in:
Jorge Martín
2023-08-18 15:30:25 +02:00
104 changed files with 240 additions and 239 deletions

View File

@@ -55,22 +55,6 @@ jobs:
path: |
**/kover/merged/verification/errors.txt
- name: 📸 Upload Screenshot test report
uses: actions/upload-artifact@v3
if: always()
with:
name: reports
path: tests/uitests/build/reports/tests/testDebugUnitTest/
retention-days: 5
- name: 🚫 Upload Screenshot failure differences on error
uses: actions/upload-artifact@v3
if: failure()
with:
name: failures
path: tests/uitests/out/failures/
retention-days: 5
- name: ✅ Upload kover report (disabled)
if: always()
run: echo "This is now done only once a day, see nightlyReports.yml"
@@ -81,7 +65,7 @@ jobs:
with:
name: tests-and-screenshot-tests-results
path: |
**/out/failures/
**/build/paparazzi/failures/
**/build/reports/tests/*UnitTest/
# https://github.com/codecov/codecov-action

1
changelog.d/1090.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix rendering of inline elements in list items.

View File

@@ -58,7 +58,7 @@ Paparazzi will generate images in `:tests:uitests/src/test/snapshots`, which wil
./gradlew verifyPaparazziDebug
```
In the case of failure, Paparazzi will generate images in `:tests:uitests/out/failure`. The images will show the expected and actual screenshots along with a delta of the two images.
In the case of failure, Paparazzi will generate images in `:tests:uitests/build/paparazzi/failures`. The images will show the expected and actual screenshots along with a delta of the two images.
## Contributing

View File

@@ -50,5 +50,7 @@ open class DocumentProvider : PreviewParameterProvider<Document> {
// "<pre>pre</pre>",
"<mx-reply><blockquote><a href=\\\"https://matrix.to/#/!roomId/\$eventId?via=matrix.org\\\">In reply to</a> " +
"<a href=\\\"https://matrix.to/#/@alice:matrix.org\\\">@alice:matrix.org</a><br>original message</blockquote></mx-reply>reply",
"<ol><li>Testing <a href='#'>link</a> item.</li><li>And <a href='#'>another</a> item.</li></ol>",
"<ul><li>Testing <a href='#'>link</a> item.</li><li>And <a href='#'>another</a> item.</li></ul>",
).map { Jsoup.parse(it) }
}

View File

@@ -400,22 +400,14 @@ private fun HtmlOrderedList(
onTextClicked: () -> Unit = {},
onTextLongClicked: () -> Unit = {},
) {
var number = 1
val delimiter = "."
HtmlListItems(
list = orderedList,
marker = { index -> "$index$delimiter"},
modifier = modifier,
onTextClicked = onTextClicked, onTextLongClicked = onTextLongClicked,
interactionSource = interactionSource
) {
val text = buildAnnotatedString {
append("${number++}$delimiter ${it.text()}")
}
HtmlText(
text = text, onClick = onTextClicked,
onLongClick = onTextLongClicked, interactionSource = interactionSource
)
}
)
}
@Composable
@@ -429,42 +421,52 @@ private fun HtmlUnorderedList(
val marker = ""
HtmlListItems(
list = unorderedList,
marker = { marker },
modifier = modifier,
onTextClicked = onTextClicked, onTextLongClicked = onTextLongClicked,
interactionSource = interactionSource
) {
val text = buildAnnotatedString {
append("$marker ${it.text()}")
}
HtmlText(
text = text, onClick = onTextClicked,
onLongClick = onTextLongClicked, interactionSource = interactionSource
)
}
)
}
@Composable
private fun HtmlListItems(
list: Element,
marker: (Int) -> String,
interactionSource: MutableInteractionSource,
modifier: Modifier = Modifier,
onTextClicked: () -> Unit = {},
onTextLongClicked: () -> Unit = {},
content: @Composable (node: TextNode) -> Unit = {}
) {
Column(modifier = modifier) {
for (node in list.children()) {
for (innerNode in node.childNodes()) {
when (innerNode) {
is TextNode -> {
if (!innerNode.isBlank) content(innerNode)
for ((index, node) in list.children().withIndex()) {
val areAllChildrenInline = node.childNodes().all { it is TextNode || it is Element && it.isInline() }
if (areAllChildrenInline) {
val text = buildAnnotatedString {
append("${marker(index + 1)} ")
appendInlineChildrenElements(node.childNodes(), MaterialTheme.colorScheme)
}
HtmlText(text = text, interactionSource = remember { MutableInteractionSource() })
} else {
for (innerNode in node.childNodes()) {
when (innerNode) {
is TextNode -> {
if (!innerNode.isBlank) {
val text = buildAnnotatedString {
append("${marker(index + 1)} ")
}
HtmlText(
text = text, onClick = onTextClicked,
onLongClick = onTextLongClicked, interactionSource = interactionSource
)
}
}
is Element -> HtmlBlock(
element = innerNode,
modifier = Modifier.padding(start = 4.dp),
onTextClicked = onTextClicked, onTextLongClicked = onTextLongClicked,
interactionSource = interactionSource
)
}
is Element -> HtmlBlock(
element = innerNode,
modifier = Modifier.padding(start = 4.dp),
onTextClicked = onTextClicked, onTextLongClicked = onTextLongClicked,
interactionSource = interactionSource
)
}
}
}

View File

@@ -22,7 +22,7 @@ media3 = "1.1.1"
browser = "1.6.0"
# Compose
compose_bom = "2023.06.01"
compose_bom = "2023.08.00"
composecompiler = "1.5.1"
# Coroutines
@@ -201,7 +201,7 @@ ktlint = "org.jlleitschuh.gradle.ktlint:11.5.1"
dependencygraph = { id = "com.savvasdalkitsis.module-dependency-graph", version.ref = "dependencygraph" }
dependencycheck = { id = "org.owasp.dependencycheck", version.ref = "dependencycheck" }
dependencyanalysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "dependencyanalysis" }
paparazzi = "app.cash.paparazzi:1.2.0"
paparazzi = "app.cash.paparazzi:1.3.1"
sonarqube = "org.sonarqube:4.2.1.3168"
kover = "org.jetbrains.kotlinx.kover:0.6.1"
sqldelight = { id = "com.squareup.sqldelight", version.ref = "sqldelight" }

Some files were not shown because too many files have changed in this diff Show More