Remove unused field BubbleState.isHighlighted

This commit is contained in:
Benoit Marty 2025-06-11 18:15:39 +02:00 committed by Benoit Marty
parent 72978b22f9
commit c0dd5f2184
8 changed files with 10 additions and 47 deletions

View file

@ -21,7 +21,6 @@ internal fun ATimelineItemEventRow(
timelineRoomInfo: TimelineRoomInfo = aTimelineRoomInfo(), timelineRoomInfo: TimelineRoomInfo = aTimelineRoomInfo(),
renderReadReceipts: Boolean = false, renderReadReceipts: Boolean = false,
isLastOutgoingMessage: Boolean = false, isLastOutgoingMessage: Boolean = false,
isHighlighted: Boolean = false,
timelineProtectionState: TimelineProtectionState = aTimelineProtectionState(), timelineProtectionState: TimelineProtectionState = aTimelineProtectionState(),
) = TimelineItemEventRow( ) = TimelineItemEventRow(
event = event, event = event,
@ -29,7 +28,6 @@ internal fun ATimelineItemEventRow(
renderReadReceipts = renderReadReceipts, renderReadReceipts = renderReadReceipts,
timelineProtectionState = timelineProtectionState, timelineProtectionState = timelineProtectionState,
isLastOutgoingMessage = isLastOutgoingMessage, isLastOutgoingMessage = isLastOutgoingMessage,
isHighlighted = isHighlighted,
onEventClick = {}, onEventClick = {},
onLongClick = {}, onLongClick = {},
onLinkClick = {}, onLinkClick = {},

View file

@ -182,7 +182,7 @@ internal fun MessageEventBubblePreview(@PreviewParameter(BubbleStateProvider::cl
contentAlignment = Alignment.Center, contentAlignment = Alignment.Center,
) { ) {
Text( Text(
text = "${state.groupPosition.javaClass.simpleName} m:${state.isMine.to01()} h:${state.isHighlighted.to01()}", text = "${state.groupPosition.javaClass.simpleName} isMine:${state.isMine.to01()}",
style = ElementTheme.typography.fontBodyXsRegular, style = ElementTheme.typography.fontBodyXsRegular,
) )
} }

View file

@ -9,9 +9,6 @@ package io.element.android.features.messages.impl.timeline.components
import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.widthIn
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ripple import androidx.compose.material3.ripple
@ -29,14 +26,12 @@ private val CORNER_RADIUS = 8.dp
@Composable @Composable
fun MessageStateEventContainer( fun MessageStateEventContainer(
@Suppress("UNUSED_PARAMETER") isHighlighted: Boolean,
interactionSource: MutableInteractionSource, interactionSource: MutableInteractionSource,
onClick: () -> Unit, onClick: () -> Unit,
onLongClick: () -> Unit, onLongClick: () -> Unit,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
content: @Composable () -> Unit = {}, content: @Composable () -> Unit = {},
) { ) {
// Ignore isHighlighted for now, we need a design decision on it.
val backgroundColor = Color.Transparent val backgroundColor = Color.Transparent
val shape = RoundedCornerShape(CORNER_RADIUS) val shape = RoundedCornerShape(CORNER_RADIUS)
Surface( Surface(
@ -58,22 +53,9 @@ fun MessageStateEventContainer(
@PreviewsDayNight @PreviewsDayNight
@Composable @Composable
internal fun MessageStateEventContainerPreview() = ElementPreview { internal fun MessageStateEventContainerPreview() = ElementPreview {
Column { MessageStateEventContainer(
MessageStateEventContainer( interactionSource = remember { MutableInteractionSource() },
isHighlighted = false, onClick = {},
interactionSource = remember { MutableInteractionSource() }, onLongClick = {},
onClick = {}, )
onLongClick = {},
) {
Spacer(modifier = Modifier.size(width = 120.dp, height = 32.dp))
}
MessageStateEventContainer(
isHighlighted = true,
interactionSource = remember { MutableInteractionSource() },
onClick = {},
onLongClick = {},
) {
Spacer(modifier = Modifier.size(width = 120.dp, height = 32.dp))
}
}
} }

View file

@ -119,7 +119,6 @@ fun TimelineItemEventRow(
timelineProtectionState: TimelineProtectionState, timelineProtectionState: TimelineProtectionState,
renderReadReceipts: Boolean, renderReadReceipts: Boolean,
isLastOutgoingMessage: Boolean, isLastOutgoingMessage: Boolean,
isHighlighted: Boolean,
onEventClick: () -> Unit, onEventClick: () -> Unit,
onLongClick: () -> Unit, onLongClick: () -> Unit,
onLinkClick: (Link) -> Unit, onLinkClick: (Link) -> Unit,
@ -195,7 +194,6 @@ fun TimelineItemEventRow(
TimelineItemEventRowContent( TimelineItemEventRowContent(
event = event, event = event,
timelineProtectionState = timelineProtectionState, timelineProtectionState = timelineProtectionState,
isHighlighted = isHighlighted,
timelineRoomInfo = timelineRoomInfo, timelineRoomInfo = timelineRoomInfo,
interactionSource = interactionSource, interactionSource = interactionSource,
onContentClick = onContentClick, onContentClick = onContentClick,
@ -229,7 +227,6 @@ fun TimelineItemEventRow(
TimelineItemEventRowContent( TimelineItemEventRowContent(
event = event, event = event,
timelineProtectionState = timelineProtectionState, timelineProtectionState = timelineProtectionState,
isHighlighted = isHighlighted,
timelineRoomInfo = timelineRoomInfo, timelineRoomInfo = timelineRoomInfo,
interactionSource = interactionSource, interactionSource = interactionSource,
onContentClick = onContentClick, onContentClick = onContentClick,
@ -284,7 +281,6 @@ private fun SwipeSensitivity(
private fun TimelineItemEventRowContent( private fun TimelineItemEventRowContent(
event: TimelineItem.Event, event: TimelineItem.Event,
timelineProtectionState: TimelineProtectionState, timelineProtectionState: TimelineProtectionState,
isHighlighted: Boolean,
timelineRoomInfo: TimelineRoomInfo, timelineRoomInfo: TimelineRoomInfo,
interactionSource: MutableInteractionSource, interactionSource: MutableInteractionSource,
onContentClick: () -> Unit, onContentClick: () -> Unit,
@ -338,7 +334,6 @@ private fun TimelineItemEventRowContent(
val bubbleState = BubbleState( val bubbleState = BubbleState(
groupPosition = event.groupPosition, groupPosition = event.groupPosition,
isMine = event.isMine, isMine = event.isMine,
isHighlighted = isHighlighted,
timelineRoomInfo = timelineRoomInfo, timelineRoomInfo = timelineRoomInfo,
) )
MessageEventBubble( MessageEventBubble(

View file

@ -111,7 +111,6 @@ internal fun TimelineItemRow(
event = timelineItem, event = timelineItem,
renderReadReceipts = renderReadReceipts, renderReadReceipts = renderReadReceipts,
isLastOutgoingMessage = isLastOutgoingMessage, isLastOutgoingMessage = isLastOutgoingMessage,
isHighlighted = timelineItem.isEvent(focusedEventId),
onClick = { onContentClick(timelineItem) }, onClick = { onContentClick(timelineItem) },
onReadReceiptsClick = onReadReceiptClick, onReadReceiptsClick = onReadReceiptClick,
onLongClick = { onLongClick(timelineItem) }, onLongClick = { onLongClick(timelineItem) },
@ -155,7 +154,6 @@ internal fun TimelineItemRow(
renderReadReceipts = renderReadReceipts, renderReadReceipts = renderReadReceipts,
timelineProtectionState = timelineProtectionState, timelineProtectionState = timelineProtectionState,
isLastOutgoingMessage = isLastOutgoingMessage, isLastOutgoingMessage = isLastOutgoingMessage,
isHighlighted = timelineItem.isEvent(focusedEventId),
onEventClick = { onContentClick(timelineItem) }, onEventClick = { onContentClick(timelineItem) },
onLongClick = { onLongClick(timelineItem) }, onLongClick = { onLongClick(timelineItem) },
onLinkClick = onLinkClick, onLinkClick = onLinkClick,

View file

@ -40,7 +40,6 @@ fun TimelineItemStateEventRow(
event: TimelineItem.Event, event: TimelineItem.Event,
renderReadReceipts: Boolean, renderReadReceipts: Boolean,
isLastOutgoingMessage: Boolean, isLastOutgoingMessage: Boolean,
isHighlighted: Boolean,
onClick: () -> Unit, onClick: () -> Unit,
onLongClick: () -> Unit, onLongClick: () -> Unit,
onReadReceiptsClick: (event: TimelineItem.Event) -> Unit, onReadReceiptsClick: (event: TimelineItem.Event) -> Unit,
@ -60,7 +59,6 @@ fun TimelineItemStateEventRow(
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
) { ) {
MessageStateEventContainer( MessageStateEventContainer(
isHighlighted = isHighlighted,
interactionSource = interactionSource, interactionSource = interactionSource,
onClick = onClick, onClick = onClick,
onLongClick = onLongClick, onLongClick = onLongClick,
@ -107,7 +105,6 @@ internal fun TimelineItemStateEventRowPreview() = ElementPreview {
), ),
renderReadReceipts = true, renderReadReceipts = true,
isLastOutgoingMessage = false, isLastOutgoingMessage = false,
isHighlighted = false,
onClick = {}, onClick = {},
onLongClick = {}, onLongClick = {},
onReadReceiptsClick = {}, onReadReceiptsClick = {},

View file

@ -13,7 +13,6 @@ import io.element.android.features.messages.impl.timeline.model.TimelineItemGrou
data class BubbleState( data class BubbleState(
val groupPosition: TimelineItemGroupPosition, val groupPosition: TimelineItemGroupPosition,
val isMine: Boolean, val isMine: Boolean,
val isHighlighted: Boolean,
val timelineRoomInfo: TimelineRoomInfo, val timelineRoomInfo: TimelineRoomInfo,
) { ) {
/** True to cut out the top start corner of the bubble, to give margin for the sender avatar. */ /** True to cut out the top start corner of the bubble, to give margin for the sender avatar. */

View file

@ -21,15 +21,11 @@ open class BubbleStateProvider : PreviewParameterProvider<BubbleState> {
TimelineItemGroupPosition.None, TimelineItemGroupPosition.None,
).map { groupPosition -> ).map { groupPosition ->
sequenceOf(false, true).map { isMine -> sequenceOf(false, true).map { isMine ->
sequenceOf(false, true).map { isHighlighted -> aBubbleState(
aBubbleState( groupPosition = groupPosition,
groupPosition = groupPosition, isMine = isMine,
isMine = isMine, )
isHighlighted = isHighlighted,
)
}
} }
.flatten()
} }
.flatten() .flatten()
} }
@ -37,11 +33,9 @@ open class BubbleStateProvider : PreviewParameterProvider<BubbleState> {
internal fun aBubbleState( internal fun aBubbleState(
groupPosition: TimelineItemGroupPosition = TimelineItemGroupPosition.First, groupPosition: TimelineItemGroupPosition = TimelineItemGroupPosition.First,
isMine: Boolean = false, isMine: Boolean = false,
isHighlighted: Boolean = false,
timelineRoomInfo: TimelineRoomInfo = aTimelineRoomInfo(), timelineRoomInfo: TimelineRoomInfo = aTimelineRoomInfo(),
) = BubbleState( ) = BubbleState(
groupPosition = groupPosition, groupPosition = groupPosition,
isMine = isMine, isMine = isMine,
isHighlighted = isHighlighted,
timelineRoomInfo = timelineRoomInfo, timelineRoomInfo = timelineRoomInfo,
) )