From 459c99e45feb875f13128dbc60669c153e6ba902 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 16 Jul 2024 15:47:21 +0200 Subject: [PATCH 1/3] Fix typo. --- .../features/lockscreen/impl/unlock/keypad/PinKeypad.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt index 4033a1b6f7..dfd6b367b7 100644 --- a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt +++ b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt @@ -129,7 +129,7 @@ private fun PinKeypadRow( ) } is PinKeypadModel.Number -> { - PinKeyBadDigitButton( + PinKeypadDigitButton( size = pinKeySize, modifier = commonModifier, digit = model.number.toString(), @@ -158,7 +158,7 @@ private fun PinKeypadButton( } @Composable -private fun PinKeyBadDigitButton( +private fun PinKeypadDigitButton( digit: String, size: Dp, onClick: (String) -> Unit, From 0db221e953874c2c8d7c81bec7c692086be4f2a5 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 16 Jul 2024 16:01:45 +0200 Subject: [PATCH 2/3] Ensure that pinKeyMaxWidth and pinKeyMaxHeight are never negative. Fix crash `Exception: java.lang.IllegalStateException: lineHeight can't be negative` Can be due to the rendering when the Activity is animated maybe? --- .../features/lockscreen/impl/unlock/keypad/PinKeypad.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt index dfd6b367b7..c54fdb67f3 100644 --- a/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt +++ b/features/lockscreen/impl/src/main/kotlin/io/element/android/features/lockscreen/impl/unlock/keypad/PinKeypad.kt @@ -37,7 +37,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.coerceAtMost +import androidx.compose.ui.unit.coerceIn import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.times @@ -50,6 +50,7 @@ import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.persistentListOf private val spaceBetweenPinKey = 16.dp +private val minSizePinKey = 16.dp private val maxSizePinKey = 80.dp @Composable @@ -61,8 +62,8 @@ fun PinKeypad( verticalAlignment: Alignment.Vertical = Alignment.Top, horizontalAlignment: Alignment.Horizontal = Alignment.Start, ) { - val pinKeyMaxWidth = ((maxWidth - 2 * spaceBetweenPinKey) / 3).coerceAtMost(maxSizePinKey) - val pinKeyMaxHeight = ((maxHeight - 3 * spaceBetweenPinKey) / 4).coerceAtMost(maxSizePinKey) + val pinKeyMaxWidth = ((maxWidth - 2 * spaceBetweenPinKey) / 3).coerceIn(minSizePinKey, maxSizePinKey) + val pinKeyMaxHeight = ((maxHeight - 3 * spaceBetweenPinKey) / 4).coerceIn(minSizePinKey, maxSizePinKey) val pinKeySize = if (pinKeyMaxWidth < pinKeyMaxHeight) pinKeyMaxWidth else pinKeyMaxHeight val horizontalArrangement = spacedBy(spaceBetweenPinKey, Alignment.CenterHorizontally) From 83a366af2ae00d6dbe4167727fd0f040979218d8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 16 Jul 2024 16:29:33 +0200 Subject: [PATCH 3/3] Fix quality (Konsist failure) --- .../android/features/roomlist/impl/RoomListPresenterTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTest.kt b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTest.kt index 9528def3e1..b48a603a85 100644 --- a/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTest.kt +++ b/features/roomlist/impl/src/test/kotlin/io/element/android/features/roomlist/impl/RoomListPresenterTest.kt @@ -545,7 +545,7 @@ class RoomListPresenterTest { clearMessagesForRoomLambda.assertions().isCalledOnce() .with(value(A_SESSION_ID), value(A_ROOM_ID)) initialState.eventSink.invoke(RoomListEvents.MarkAsUnread(A_ROOM_ID_2)) - assertThat(room2.markAsReadCalls).isEqualTo(emptyList()) + assertThat(room2.markAsReadCalls).isEmpty() assertThat(room2.setUnreadFlagCalls).isEqualTo(listOf(true)) // Test again with private read receipts sessionPreferencesStore.setSendPublicReadReceipts(false)