Skip to content

Feature/bma/sender name bubble #1093

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

Merged
merged 3 commits into from
Aug 18, 2023
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
1 change: 1 addition & 0 deletions changelog.d/1033.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Timeline: sender names are now displayed in one single line.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ internal fun aTimelineItemEvent(
eventId: EventId = EventId("\$" + Random.nextInt().toString()),
transactionId: TransactionId? = null,
isMine: Boolean = false,
senderDisplayName: String = "Sender",
content: TimelineItemEventContent = aTimelineItemTextContent(),
groupPosition: TimelineItemGroupPosition = TimelineItemGroupPosition.None,
sendState: LocalEventSendState = LocalEventSendState.Sent(eventId),
Expand All @@ -123,7 +124,7 @@ internal fun aTimelineItemEvent(
reactionsState = timelineItemReactions,
sentTime = "12:34",
isMine = isMine,
senderDisplayName = "Sender",
senderDisplayName = senderDisplayName,
groupPosition = groupPosition,
localSendState = sendState,
inReplyTo = inReplyTo,
Expand All @@ -141,11 +142,13 @@ fun aTimelineItemReactions(
reactions = buildList {
repeat(count) { index ->
val key = emojis[index % emojis.size]
add(anAggregatedReaction(
key = key,
count = index + 1,
isHighlighted = isHighlighted
))
add(
anAggregatedReaction(
key = key,
count = index + 1,
isHighlighted = isHighlighted
)
)
}
}.toPersistentList()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ private fun MessageSenderInformation(
Spacer(modifier = Modifier.width(4.dp))
Text(
text = sender,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
style = ElementTheme.typography.fontBodyMdMedium,
)
Expand Down Expand Up @@ -786,3 +788,25 @@ private fun ContentWithManyReactionsToPreview() {
}
}
}

// Note: no need for light/dark variant for this preview
@Preview
@Composable
internal fun TimelineItemEventRowLongSenderNamePreview() = ElementPreviewLight {
TimelineItemEventRow(
event = aTimelineItemEvent(
senderDisplayName = "a long sender display name to test single line and ellipsis at the end of the line",
),
isHighlighted = false,
canReply = true,
onClick = {},
onLongClick = {},
onUserDataClick = {},
inReplyToClick = {},
onReactionClick = { _, _ -> },
onReactionLongClick = { _, _ -> },
onMoreReactionsClick = {},
onSwipeToReply = {},
onTimestampClicked = {},
)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.