Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when Pin code screen is displayed #3205

Merged
merged 3 commits into from
Jul 16, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -129,7 +130,7 @@ private fun PinKeypadRow(
)
}
is PinKeypadModel.Number -> {
PinKeyBadDigitButton(
PinKeypadDigitButton(
size = pinKeySize,
modifier = commonModifier,
digit = model.number.toString(),
Expand Down Expand Up @@ -158,7 +159,7 @@ private fun PinKeypadButton(
}

@Composable
private fun PinKeyBadDigitButton(
private fun PinKeypadDigitButton(
digit: String,
size: Dp,
onClick: (String) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReceiptType>())
assertThat(room2.markAsReadCalls).isEmpty()
assertThat(room2.setUnreadFlagCalls).isEqualTo(listOf(true))
// Test again with private read receipts
sessionPreferencesStore.setSendPublicReadReceipts(false)
Expand Down
Loading