Fix quality checks

This commit is contained in:
Benoit Marty 2025-01-02 08:13:05 +01:00
parent 1d34ce8e71
commit 52648d2abf
3 changed files with 35 additions and 32 deletions

View file

@ -29,9 +29,11 @@ import io.element.android.libraries.designsystem.components.avatar.AvatarSize
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.text.toPx
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
/**
* Draw a row of avatars (they must all have the same size), from start to end
* Draw a row of avatars (they must all have the same size), from start to end.
* @param avatarDataList the avatars to render. Note: they will all be rendered, the caller may
* want to limit the list size
* @param modifier Jetpack Compose modifier
@ -40,7 +42,7 @@ import io.element.android.libraries.designsystem.text.toPx
*/
@Composable
fun AvatarRow(
avatarDataList: List<AvatarData>,
avatarDataList: ImmutableList<AvatarData>,
modifier: Modifier = Modifier,
overlapRatio: Float = 0.5f,
) {
@ -113,15 +115,13 @@ internal fun AvatarRowRtlPreview(@PreviewParameter(OverlapRatioProvider::class)
@Composable
private fun ContentToPreview(overlapRatio: Float) {
AvatarRow(
avatarDataList = listOf(
"A", "B", "C"
).map {
avatarDataList = listOf("A", "B", "C").map {
AvatarData(
id = it,
name = it,
size = AvatarSize.RoomListItem,
)
},
}.toImmutableList(),
overlapRatio = overlapRatio,
)
}

View file

@ -49,6 +49,7 @@ import io.element.android.libraries.designsystem.theme.components.Surface
import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.ui.strings.CommonStrings
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
private const val MAX_AVATAR_COUNT = 3
@ -210,6 +211,7 @@ private fun KnockRequestAvatarListView(
.map { knockRequest ->
knockRequest.getAvatarData(AvatarSize.KnockRequestBanner)
}
.toImmutableList()
AvatarRow(
avatarDataList = avatars,
modifier = modifier,

View file

@ -50,6 +50,7 @@ class KonsistClassNameTest {
.withAllParentsOf(PreviewParameterProvider::class)
.withoutName(
"AspectRatioProvider",
"OverlapRatioProvider",
)
.also {
// Check that classes are actually found