Hide add more reaction button if user do not have permission to send reaction #2093
Also: - move `userHasPermissionToSendMessage` to `TimelineRoomInfo` - remove `canReply` parameter which can be computed from other params.
This commit is contained in:
parent
52c2e8ea08
commit
7414dfaa4d
10 changed files with 48 additions and 33 deletions
|
|
@ -98,6 +98,7 @@ class TimelinePresenter @AssistedInject constructor(
|
||||||
val paginationState by timeline.paginationState.collectAsState()
|
val paginationState by timeline.paginationState.collectAsState()
|
||||||
val syncUpdateFlow = room.syncUpdateFlow.collectAsState()
|
val syncUpdateFlow = room.syncUpdateFlow.collectAsState()
|
||||||
val userHasPermissionToSendMessage by room.canSendMessageAsState(type = MessageEventType.ROOM_MESSAGE, updateKey = syncUpdateFlow.value)
|
val userHasPermissionToSendMessage by room.canSendMessageAsState(type = MessageEventType.ROOM_MESSAGE, updateKey = syncUpdateFlow.value)
|
||||||
|
val userHasPermissionToSendReaction by room.canSendMessageAsState(type = MessageEventType.REACTION_SENT, updateKey = syncUpdateFlow.value)
|
||||||
|
|
||||||
val prevMostRecentItemId = rememberSaveable { mutableStateOf<String?>(null) }
|
val prevMostRecentItemId = rememberSaveable { mutableStateOf<String?>(null) }
|
||||||
val newItemState = remember { mutableStateOf(NewEventState.None) }
|
val newItemState = remember { mutableStateOf(NewEventState.None) }
|
||||||
|
|
@ -175,12 +176,18 @@ class TimelinePresenter @AssistedInject constructor(
|
||||||
.launchIn(this)
|
.launchIn(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val timelineRoomInfo by remember {
|
||||||
|
derivedStateOf {
|
||||||
|
TimelineRoomInfo(
|
||||||
|
isDirect = room.isDirect,
|
||||||
|
userHasPermissionToSendMessage = userHasPermissionToSendMessage,
|
||||||
|
userHasPermissionToSendReaction = userHasPermissionToSendReaction,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
return TimelineState(
|
return TimelineState(
|
||||||
timelineRoomInfo = TimelineRoomInfo(
|
timelineRoomInfo = timelineRoomInfo,
|
||||||
isDirect = room.isDirect
|
|
||||||
),
|
|
||||||
highlightedEventId = highlightedEventId.value,
|
highlightedEventId = highlightedEventId.value,
|
||||||
userHasPermissionToSendMessage = userHasPermissionToSendMessage,
|
|
||||||
paginationState = paginationState,
|
paginationState = paginationState,
|
||||||
timelineItems = timelineItems,
|
timelineItems = timelineItems,
|
||||||
showReadReceipts = readReceiptsEnabled,
|
showReadReceipts = readReceiptsEnabled,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ data class TimelineState(
|
||||||
val timelineRoomInfo: TimelineRoomInfo,
|
val timelineRoomInfo: TimelineRoomInfo,
|
||||||
val showReadReceipts: Boolean,
|
val showReadReceipts: Boolean,
|
||||||
val highlightedEventId: EventId?,
|
val highlightedEventId: EventId?,
|
||||||
val userHasPermissionToSendMessage: Boolean,
|
|
||||||
val paginationState: MatrixTimeline.PaginationState,
|
val paginationState: MatrixTimeline.PaginationState,
|
||||||
val newEventState: NewEventState,
|
val newEventState: NewEventState,
|
||||||
val sessionState: SessionState,
|
val sessionState: SessionState,
|
||||||
|
|
@ -40,4 +39,6 @@ data class TimelineState(
|
||||||
@Immutable
|
@Immutable
|
||||||
data class TimelineRoomInfo(
|
data class TimelineRoomInfo(
|
||||||
val isDirect: Boolean,
|
val isDirect: Boolean,
|
||||||
|
val userHasPermissionToSendMessage: Boolean,
|
||||||
|
val userHasPermissionToSendReaction: Boolean,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,6 @@ fun aTimelineState(timelineItems: ImmutableList<TimelineItem> = persistentListOf
|
||||||
beginningOfRoomReached = false,
|
beginningOfRoomReached = false,
|
||||||
),
|
),
|
||||||
highlightedEventId = null,
|
highlightedEventId = null,
|
||||||
userHasPermissionToSendMessage = true,
|
|
||||||
newEventState = NewEventState.None,
|
newEventState = NewEventState.None,
|
||||||
sessionState = aSessionState(
|
sessionState = aSessionState(
|
||||||
isSessionVerified = true,
|
isSessionVerified = true,
|
||||||
|
|
@ -218,4 +217,6 @@ internal fun aTimelineRoomInfo(
|
||||||
isDirect: Boolean = false,
|
isDirect: Boolean = false,
|
||||||
) = TimelineRoomInfo(
|
) = TimelineRoomInfo(
|
||||||
isDirect = isDirect,
|
isDirect = isDirect,
|
||||||
|
userHasPermissionToSendMessage = true,
|
||||||
|
userHasPermissionToSendReaction = true,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,6 @@ fun TimelineView(
|
||||||
isLastOutgoingMessage = (timelineItem as? TimelineItem.Event)?.isMine == true
|
isLastOutgoingMessage = (timelineItem as? TimelineItem.Event)?.isMine == true
|
||||||
&& state.timelineItems.first().identifier() == timelineItem.identifier(),
|
&& state.timelineItems.first().identifier() == timelineItem.identifier(),
|
||||||
highlightedItem = state.highlightedEventId?.value,
|
highlightedItem = state.highlightedEventId?.value,
|
||||||
userHasPermissionToSendMessage = state.userHasPermissionToSendMessage,
|
|
||||||
onClick = onMessageClicked,
|
onClick = onMessageClicked,
|
||||||
onLongClick = onMessageLongClicked,
|
onLongClick = onMessageLongClicked,
|
||||||
onUserDataClick = onUserDataClicked,
|
onUserDataClick = onUserDataClicked,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ internal fun ATimelineItemEventRow(
|
||||||
showReadReceipts = showReadReceipts,
|
showReadReceipts = showReadReceipts,
|
||||||
isLastOutgoingMessage = isLastOutgoingMessage,
|
isLastOutgoingMessage = isLastOutgoingMessage,
|
||||||
isHighlighted = isHighlighted,
|
isHighlighted = isHighlighted,
|
||||||
canReply = true,
|
|
||||||
onClick = {},
|
onClick = {},
|
||||||
onLongClick = {},
|
onLongClick = {},
|
||||||
onUserDataClick = {},
|
onUserDataClick = {},
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ import io.element.android.features.messages.impl.timeline.model.event.TimelineIt
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemVideoContent
|
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemVideoContent
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemImageContent
|
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemImageContent
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemTextContent
|
import io.element.android.features.messages.impl.timeline.model.event.aTimelineItemTextContent
|
||||||
|
import io.element.android.features.messages.impl.timeline.model.event.canBeRepliedTo
|
||||||
import io.element.android.features.messages.impl.timeline.model.metadata
|
import io.element.android.features.messages.impl.timeline.model.metadata
|
||||||
import io.element.android.libraries.androidutils.system.openUrlInExternalApp
|
import io.element.android.libraries.androidutils.system.openUrlInExternalApp
|
||||||
import io.element.android.libraries.designsystem.colors.AvatarColorsProvider
|
import io.element.android.libraries.designsystem.colors.AvatarColorsProvider
|
||||||
|
|
@ -112,7 +113,6 @@ fun TimelineItemEventRow(
|
||||||
showReadReceipts: Boolean,
|
showReadReceipts: Boolean,
|
||||||
isLastOutgoingMessage: Boolean,
|
isLastOutgoingMessage: Boolean,
|
||||||
isHighlighted: Boolean,
|
isHighlighted: Boolean,
|
||||||
canReply: Boolean,
|
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
onLongClick: () -> Unit,
|
onLongClick: () -> Unit,
|
||||||
onUserDataClick: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
|
|
@ -151,6 +151,7 @@ fun TimelineItemEventRow(
|
||||||
} else {
|
} else {
|
||||||
Spacer(modifier = Modifier.height(2.dp))
|
Spacer(modifier = Modifier.height(2.dp))
|
||||||
}
|
}
|
||||||
|
val canReply = timelineRoomInfo.userHasPermissionToSendMessage && event.content.canBeRepliedTo()
|
||||||
if (canReply) {
|
if (canReply) {
|
||||||
val state: SwipeableActionsState = rememberSwipeableActionsState()
|
val state: SwipeableActionsState = rememberSwipeableActionsState()
|
||||||
val offset = state.offset.floatValue
|
val offset = state.offset.floatValue
|
||||||
|
|
@ -335,6 +336,7 @@ private fun TimelineItemEventRowContent(
|
||||||
if (event.reactionsState.reactions.isNotEmpty()) {
|
if (event.reactionsState.reactions.isNotEmpty()) {
|
||||||
TimelineItemReactionsView(
|
TimelineItemReactionsView(
|
||||||
reactionsState = event.reactionsState,
|
reactionsState = event.reactionsState,
|
||||||
|
userCanSendReaction = timelineRoomInfo.userHasPermissionToSendReaction,
|
||||||
isOutgoing = event.isMine,
|
isOutgoing = event.isMine,
|
||||||
onReactionClicked = onReactionClicked,
|
onReactionClicked = onReactionClicked,
|
||||||
onReactionLongClicked = onReactionLongClicked,
|
onReactionLongClicked = onReactionLongClicked,
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,6 @@ private fun TimelineItemGroupedEventsRowContent(
|
||||||
isLastOutgoingMessage = isLastOutgoingMessage,
|
isLastOutgoingMessage = isLastOutgoingMessage,
|
||||||
highlightedItem = highlightedItem,
|
highlightedItem = highlightedItem,
|
||||||
sessionState = sessionState,
|
sessionState = sessionState,
|
||||||
userHasPermissionToSendMessage = false,
|
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
inReplyToClick = inReplyToClick,
|
inReplyToClick = inReplyToClick,
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.IntOffset
|
import androidx.compose.ui.unit.IntOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import io.element.android.features.messages.impl.R
|
import io.element.android.features.messages.impl.R
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.utils.CommonDrawables
|
import io.element.android.libraries.designsystem.utils.CommonDrawables
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,7 +46,7 @@ import io.element.android.libraries.designsystem.utils.CommonDrawables
|
||||||
@Composable
|
@Composable
|
||||||
fun TimelineItemReactionsLayout(
|
fun TimelineItemReactionsLayout(
|
||||||
expandButton: @Composable () -> Unit,
|
expandButton: @Composable () -> Unit,
|
||||||
addMoreButton: @Composable () -> Unit,
|
addMoreButton: (@Composable () -> Unit)?,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
itemSpacing: Dp = 0.dp,
|
itemSpacing: Dp = 0.dp,
|
||||||
rowSpacing: Dp = 0.dp,
|
rowSpacing: Dp = 0.dp,
|
||||||
|
|
@ -82,21 +82,21 @@ fun TimelineItemReactionsLayout(
|
||||||
|
|
||||||
// Used to render the collapsed state, this takes the rows inputted and adds the extra button to the last row,
|
// Used to render the collapsed state, this takes the rows inputted and adds the extra button to the last row,
|
||||||
// removing only as many trailing reactions as needed to make space for it.
|
// removing only as many trailing reactions as needed to make space for it.
|
||||||
fun replaceTrailingItemsWithButtons(rowsIn: List<List<Placeable>>, expandButton: Placeable, addMoreButton: Placeable): List<List<Placeable>> {
|
fun replaceTrailingItemsWithButtons(rowsIn: List<List<Placeable>>, expandButton: Placeable, addMoreButton: Placeable?): List<List<Placeable>> {
|
||||||
val rows = rowsIn.toMutableList()
|
val rows = rowsIn.toMutableList()
|
||||||
val lastRow = rows.last()
|
val lastRow = rows.last()
|
||||||
val buttonsWidth = expandButton.width + itemSpacing.toPx().toInt() + addMoreButton.width
|
val buttonsWidth = expandButton.width + itemSpacing.toPx().toInt() + (addMoreButton?.width ?: 0)
|
||||||
var rowX = 0
|
var rowX = 0
|
||||||
lastRow.forEachIndexed { i, placeable ->
|
lastRow.forEachIndexed { i, placeable ->
|
||||||
val horizontalSpacing = if (i == 0) 0 else itemSpacing.toPx().toInt()
|
val horizontalSpacing = if (i == 0) 0 else itemSpacing.toPx().toInt()
|
||||||
rowX += placeable.width + horizontalSpacing
|
rowX += placeable.width + horizontalSpacing
|
||||||
if (rowX > constraints.maxWidth - (buttonsWidth + horizontalSpacing)) {
|
if (rowX > constraints.maxWidth - (buttonsWidth + horizontalSpacing)) {
|
||||||
val lastRowWithButton = lastRow.take(i) + listOf(expandButton, addMoreButton)
|
val lastRowWithButton = lastRow.take(i) + listOfNotNull(expandButton, addMoreButton)
|
||||||
rows[rows.size - 1] = lastRowWithButton
|
rows[rows.size - 1] = lastRowWithButton
|
||||||
return rows
|
return rows
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val lastRowWithButton = lastRow + listOf(expandButton, addMoreButton)
|
val lastRowWithButton = lastRow + listOfNotNull(expandButton, addMoreButton)
|
||||||
rows[rows.size - 1] = lastRowWithButton
|
rows[rows.size - 1] = lastRowWithButton
|
||||||
return rows
|
return rows
|
||||||
}
|
}
|
||||||
|
|
@ -155,16 +155,15 @@ fun TimelineItemReactionsLayout(
|
||||||
val newConstrains = constraints.copy(minHeight = maxHeight)
|
val newConstrains = constraints.copy(minHeight = maxHeight)
|
||||||
reactionsPlaceables = subcompose(2, reactions).map { it.measure(newConstrains) }
|
reactionsPlaceables = subcompose(2, reactions).map { it.measure(newConstrains) }
|
||||||
expandPlaceable = subcompose(3, expandButton).first().measure(newConstrains)
|
expandPlaceable = subcompose(3, expandButton).first().measure(newConstrains)
|
||||||
val addMorePlaceable = subcompose(4, addMoreButton).first().measure(newConstrains)
|
val addMorePlaceable = addMoreButton?.let { subcompose(4, addMoreButton).first().measure(newConstrains) }
|
||||||
|
|
||||||
|
|
||||||
// Calculate the layout of the rows with the reactions button and add more button
|
// Calculate the layout of the rows with the reactions button and add more button
|
||||||
val reactionsAndAddMore = calculateRows(reactionsPlaceables + listOf(addMorePlaceable))
|
val reactionsAndAddMore = calculateRows(reactionsPlaceables + listOfNotNull(addMorePlaceable))
|
||||||
// If we have extended beyond the defined number of rows we are showing the expand/collapse ui
|
// If we have extended beyond the defined number of rows we are showing the expand/collapse ui
|
||||||
if (rowsBeforeCollapsible?.let { reactionsAndAddMore.size > it } == true) {
|
if (rowsBeforeCollapsible?.let { reactionsAndAddMore.size > it } == true) {
|
||||||
if (expanded) {
|
if (expanded) {
|
||||||
// Show all subviews with the add more button at the end
|
// Show all subviews with the add more button at the end
|
||||||
var reactionsAndButtons = calculateRows(reactionsPlaceables + listOf(expandPlaceable, addMorePlaceable))
|
var reactionsAndButtons = calculateRows(reactionsPlaceables + listOfNotNull(expandPlaceable, addMorePlaceable))
|
||||||
reactionsAndButtons = ensureCollapseAndAddMoreButtonsAreOnTheSameRow(reactionsAndButtons)
|
reactionsAndButtons = ensureCollapseAndAddMoreButtonsAreOnTheSameRow(reactionsAndButtons)
|
||||||
layoutRows(reactionsAndButtons)
|
layoutRows(reactionsAndButtons)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ import io.element.android.features.messages.impl.R
|
||||||
import io.element.android.features.messages.impl.timeline.aTimelineItemReactions
|
import io.element.android.features.messages.impl.timeline.aTimelineItemReactions
|
||||||
import io.element.android.features.messages.impl.timeline.model.AggregatedReaction
|
import io.element.android.features.messages.impl.timeline.model.AggregatedReaction
|
||||||
import io.element.android.features.messages.impl.timeline.model.TimelineItemReactions
|
import io.element.android.features.messages.impl.timeline.model.TimelineItemReactions
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.utils.CommonDrawables
|
import io.element.android.libraries.designsystem.utils.CommonDrawables
|
||||||
import kotlinx.collections.immutable.ImmutableList
|
import kotlinx.collections.immutable.ImmutableList
|
||||||
|
|
||||||
|
|
@ -40,6 +40,7 @@ import kotlinx.collections.immutable.ImmutableList
|
||||||
fun TimelineItemReactionsView(
|
fun TimelineItemReactionsView(
|
||||||
reactionsState: TimelineItemReactions,
|
reactionsState: TimelineItemReactions,
|
||||||
isOutgoing: Boolean,
|
isOutgoing: Boolean,
|
||||||
|
userCanSendReaction: Boolean,
|
||||||
onReactionClicked: (emoji: String) -> Unit,
|
onReactionClicked: (emoji: String) -> Unit,
|
||||||
onReactionLongClicked: (emoji: String) -> Unit,
|
onReactionLongClicked: (emoji: String) -> Unit,
|
||||||
onMoreReactionsClicked: () -> Unit,
|
onMoreReactionsClicked: () -> Unit,
|
||||||
|
|
@ -49,6 +50,7 @@ fun TimelineItemReactionsView(
|
||||||
TimelineItemReactionsView(
|
TimelineItemReactionsView(
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
reactions = reactionsState.reactions,
|
reactions = reactionsState.reactions,
|
||||||
|
userCanSendReaction = userCanSendReaction,
|
||||||
expanded = expanded,
|
expanded = expanded,
|
||||||
isOutgoing = isOutgoing,
|
isOutgoing = isOutgoing,
|
||||||
onReactionClick = onReactionClicked,
|
onReactionClick = onReactionClicked,
|
||||||
|
|
@ -61,6 +63,7 @@ fun TimelineItemReactionsView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun TimelineItemReactionsView(
|
private fun TimelineItemReactionsView(
|
||||||
reactions: ImmutableList<AggregatedReaction>,
|
reactions: ImmutableList<AggregatedReaction>,
|
||||||
|
userCanSendReaction: Boolean,
|
||||||
isOutgoing: Boolean,
|
isOutgoing: Boolean,
|
||||||
expanded: Boolean,
|
expanded: Boolean,
|
||||||
onReactionClick: (emoji: String) -> Unit,
|
onReactionClick: (emoji: String) -> Unit,
|
||||||
|
|
@ -93,19 +96,26 @@ private fun TimelineItemReactionsView(
|
||||||
onLongClick = {}
|
onLongClick = {}
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
addMoreButton = {
|
addMoreButton = if (userCanSendReaction) {
|
||||||
MessagesReactionButton(
|
{
|
||||||
content = MessagesReactionsButtonContent.Icon(CommonDrawables.ic_add_reaction),
|
MessagesReactionButton(
|
||||||
onClick = onMoreReactionsClick,
|
content = MessagesReactionsButtonContent.Icon(CommonDrawables.ic_add_reaction),
|
||||||
onLongClick = {}
|
onClick = onMoreReactionsClick,
|
||||||
)
|
onLongClick = {}
|
||||||
},
|
)
|
||||||
|
}
|
||||||
|
} else null,
|
||||||
reactions = {
|
reactions = {
|
||||||
reactions.forEach { reaction ->
|
reactions.forEach { reaction ->
|
||||||
CompositionLocalProvider(LocalLayoutDirection provides currentLayout) {
|
CompositionLocalProvider(LocalLayoutDirection provides currentLayout) {
|
||||||
MessagesReactionButton(
|
MessagesReactionButton(
|
||||||
content = MessagesReactionsButtonContent.Reaction(reaction = reaction),
|
content = MessagesReactionsButtonContent.Reaction(reaction = reaction),
|
||||||
onClick = { onReactionClick(reaction.key) },
|
onClick = {
|
||||||
|
// Always allow user to redact their own reactions
|
||||||
|
if (reaction.isHighlighted || userCanSendReaction) {
|
||||||
|
onReactionClick(reaction.key)
|
||||||
|
}
|
||||||
|
},
|
||||||
onLongClick = { onReactionLongClick(reaction.key) }
|
onLongClick = { onReactionLongClick(reaction.key) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -157,6 +167,7 @@ private fun ContentToPreview(
|
||||||
reactionsState = TimelineItemReactions(
|
reactionsState = TimelineItemReactions(
|
||||||
reactions
|
reactions
|
||||||
),
|
),
|
||||||
|
userCanSendReaction = true,
|
||||||
isOutgoing = isOutgoing,
|
isOutgoing = isOutgoing,
|
||||||
onReactionClicked = {},
|
onReactionClicked = {},
|
||||||
onReactionLongClicked = {},
|
onReactionLongClicked = {},
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,10 @@ package io.element.android.features.messages.impl.timeline.components
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import io.element.android.features.messages.impl.timeline.TimelineRoomInfo
|
|
||||||
import io.element.android.features.messages.impl.timeline.TimelineEvents
|
import io.element.android.features.messages.impl.timeline.TimelineEvents
|
||||||
|
import io.element.android.features.messages.impl.timeline.TimelineRoomInfo
|
||||||
import io.element.android.features.messages.impl.timeline.model.TimelineItem
|
import io.element.android.features.messages.impl.timeline.model.TimelineItem
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemStateContent
|
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemStateContent
|
||||||
import io.element.android.features.messages.impl.timeline.model.event.canBeRepliedTo
|
|
||||||
import io.element.android.features.messages.impl.timeline.session.SessionState
|
import io.element.android.features.messages.impl.timeline.session.SessionState
|
||||||
import io.element.android.libraries.matrix.api.core.EventId
|
import io.element.android.libraries.matrix.api.core.EventId
|
||||||
import io.element.android.libraries.matrix.api.core.UserId
|
import io.element.android.libraries.matrix.api.core.UserId
|
||||||
|
|
@ -34,7 +33,6 @@ internal fun TimelineItemRow(
|
||||||
showReadReceipts: Boolean,
|
showReadReceipts: Boolean,
|
||||||
isLastOutgoingMessage: Boolean,
|
isLastOutgoingMessage: Boolean,
|
||||||
highlightedItem: String?,
|
highlightedItem: String?,
|
||||||
userHasPermissionToSendMessage: Boolean,
|
|
||||||
sessionState: SessionState,
|
sessionState: SessionState,
|
||||||
onUserDataClick: (UserId) -> Unit,
|
onUserDataClick: (UserId) -> Unit,
|
||||||
onClick: (TimelineItem.Event) -> Unit,
|
onClick: (TimelineItem.Event) -> Unit,
|
||||||
|
|
@ -77,7 +75,6 @@ internal fun TimelineItemRow(
|
||||||
showReadReceipts = showReadReceipts,
|
showReadReceipts = showReadReceipts,
|
||||||
isLastOutgoingMessage = isLastOutgoingMessage,
|
isLastOutgoingMessage = isLastOutgoingMessage,
|
||||||
isHighlighted = highlightedItem == timelineItem.identifier(),
|
isHighlighted = highlightedItem == timelineItem.identifier(),
|
||||||
canReply = userHasPermissionToSendMessage && timelineItem.content.canBeRepliedTo(),
|
|
||||||
onClick = { onClick(timelineItem) },
|
onClick = { onClick(timelineItem) },
|
||||||
onLongClick = { onLongClick(timelineItem) },
|
onLongClick = { onLongClick(timelineItem) },
|
||||||
onUserDataClick = onUserDataClick,
|
onUserDataClick = onUserDataClick,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue