Merge pull request #2050 from element-hq/feature/bma/bottomSheetAvatar
Message bottom sheet: always show user avatar
This commit is contained in:
commit
37a0982a67
18 changed files with 35 additions and 110 deletions
1
changelog.d/2032.misc
Normal file
1
changelog.d/2032.misc
Normal file
|
|
@ -0,0 +1 @@
|
|||
Always show user avatar in message action sheet
|
||||
|
|
@ -34,7 +34,6 @@ import androidx.compose.foundation.layout.width
|
|||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.ripple.rememberRipple
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
|
|
@ -44,7 +43,6 @@ import androidx.compose.runtime.remember
|
|||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
|
|
@ -54,6 +52,7 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.features.messages.impl.actionlist.model.TimelineItemAction
|
||||
import io.element.android.features.messages.impl.timeline.model.TimelineItem
|
||||
import io.element.android.features.messages.impl.timeline.model.event.TimelineItemAudioContent
|
||||
|
|
@ -84,10 +83,6 @@ import io.element.android.libraries.designsystem.theme.components.ModalBottomShe
|
|||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.designsystem.theme.components.hide
|
||||
import io.element.android.libraries.designsystem.utils.CommonDrawables
|
||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnail
|
||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailInfo
|
||||
import io.element.android.libraries.matrix.ui.components.AttachmentThumbnailType
|
||||
import io.element.android.compound.theme.ElementTheme
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
|
||||
|
|
@ -220,11 +215,8 @@ private fun SheetContent(
|
|||
@Composable
|
||||
private fun MessageSummary(event: TimelineItem.Event, modifier: Modifier = Modifier) {
|
||||
val content: @Composable () -> Unit
|
||||
var icon: @Composable () -> Unit = { Avatar(avatarData = event.senderAvatar.copy(size = AvatarSize.MessageActionSender)) }
|
||||
val icon: @Composable () -> Unit = { Avatar(avatarData = event.senderAvatar.copy(size = AvatarSize.MessageActionSender)) }
|
||||
val contentStyle = ElementTheme.typography.fontBodyMdRegular.copy(color = MaterialTheme.colorScheme.secondary)
|
||||
val imageModifier = Modifier
|
||||
.size(AvatarSize.MessageActionSender.dp)
|
||||
.clip(RoundedCornerShape(9.dp))
|
||||
|
||||
@Composable
|
||||
fun ContentForBody(body: String) {
|
||||
|
|
@ -242,92 +234,24 @@ private fun MessageSummary(event: TimelineItem.Event, modifier: Modifier = Modif
|
|||
is TimelineItemRedactedContent,
|
||||
is TimelineItemUnknownContent -> content = { ContentForBody(textContent) }
|
||||
is TimelineItemLocationContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
type = AttachmentThumbnailType.Location,
|
||||
textContent = stringResource(CommonStrings.common_shared_location),
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(stringResource(CommonStrings.common_shared_location)) }
|
||||
}
|
||||
is TimelineItemImageContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
thumbnailSource = event.content.thumbnailSource ?: event.content.mediaSource,
|
||||
textContent = textContent,
|
||||
type = AttachmentThumbnailType.Image,
|
||||
blurHash = event.content.blurhash,
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(event.content.body) }
|
||||
}
|
||||
is TimelineItemVideoContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
thumbnailSource = event.content.thumbnailSource,
|
||||
textContent = textContent,
|
||||
type = AttachmentThumbnailType.Video,
|
||||
blurHash = event.content.blurHash,
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(event.content.body) }
|
||||
}
|
||||
is TimelineItemFileContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
thumbnailSource = event.content.thumbnailSource,
|
||||
textContent = textContent,
|
||||
type = AttachmentThumbnailType.File,
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(event.content.body) }
|
||||
}
|
||||
is TimelineItemAudioContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
textContent = textContent,
|
||||
type = AttachmentThumbnailType.Audio,
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(event.content.body) }
|
||||
}
|
||||
is TimelineItemVoiceContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
textContent = textContent,
|
||||
type = AttachmentThumbnailType.Voice,
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(textContent) }
|
||||
}
|
||||
is TimelineItemPollContent -> {
|
||||
icon = {
|
||||
AttachmentThumbnail(
|
||||
modifier = imageModifier,
|
||||
info = AttachmentThumbnailInfo(
|
||||
textContent = textContent,
|
||||
type = AttachmentThumbnailType.Poll,
|
||||
)
|
||||
)
|
||||
}
|
||||
content = { ContentForBody(textContent) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d70d14c24d1d24f89e39d67a0b18949322e5f31a3905df7619b87b0c3de7b554
|
||||
size 27770
|
||||
oid sha256:d76345d2c5c7624b4cb0b84aeef2852ccc389e1061400dc7baa40ec551dcc8ef
|
||||
size 28682
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:03a85dff3c9aeefe837d6ba0a80e0d17ee4ef1e9f07bdb788e8d9acc8bdf80c0
|
||||
size 45513
|
||||
oid sha256:ada50b20e21f66b48130d46b1721aea92d93d906539f0572879e2829b85e6337
|
||||
size 39409
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:1afd85a9f8c5bd68e57d998d49f6d19ef231bfa737d56e948deaf980c8b1811f
|
||||
size 46095
|
||||
oid sha256:1ac680d47ade7e34f736eee63acf5fd88dbbcdae6cc941047bad6c8a3edad274
|
||||
size 39951
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a0f0ddd896d16975cdc25d21222f769d8f67b3895c495c0d51e3aa5c89d141de
|
||||
size 39663
|
||||
oid sha256:3678f3d5c09879979624df3528152911bf1fec3e0b509e3469243626cc904749
|
||||
size 39543
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:16990f9c05f9ccf05a3dbddc8a892a2a99f8f843adca77b155f2a3fa8f4bd35e
|
||||
size 39226
|
||||
oid sha256:c693e0c433c59095d4941a1210faf06ed66dcda9c07663ed34da94f09ce98db5
|
||||
size 40194
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7fe10e96a09a5645799fd4de5966ea058107ac21153e371b8af596a8ee4636dd
|
||||
size 40308
|
||||
oid sha256:38f50ce93b24ccfbcc1e811305233503be33dcd3456990dc8f5d293ee985bae2
|
||||
size 40886
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:00b48223cc826bcb54bbdda17db7a1a7e0255fe444ad2940071dea773e03a891
|
||||
size 41046
|
||||
oid sha256:a7c09e06910187c2a920d4b0a75b50ccb4323935fccb6f284be7be2b5cf938b8
|
||||
size 40751
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9ce1a44e394597385f2ce4efe5f346fd5843ce745b99ead30804563b7a18016a
|
||||
size 28020
|
||||
oid sha256:70733bd9d950690e16dd1666e912be62b0845baa102fe0dec9be2e9ba10aeddf
|
||||
size 27740
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0a9a43664c9557a5c01828a1fd4209c0d12a8c399042bffe705c52c33b160f70
|
||||
size 26304
|
||||
oid sha256:47f4450cd559bb9e8541e2d9bb155eb81de1d0c379d764cf3d6914bbcd978248
|
||||
size 27477
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e4bb0fe5ba2001eb74548c4964f5e485bef8c851765749c128d3919f4766dbfc
|
||||
size 43669
|
||||
oid sha256:a7273ab9663ce248470951833fb83771f2b96de224e7f57af4d0e8cd29b067f2
|
||||
size 37996
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:606da72e590e3ec82d715c2a6f54430f36f7b3e25a8f5822d6e07213f5beaa9b
|
||||
size 44221
|
||||
oid sha256:5c95cad226307c778bae657cecf1d38b8ebf35a2b46a109586ba6d2c08b04eed
|
||||
size 38503
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:87833e7911983d3b8bd93ab9c5ef8955f280dc9d392f53c49f8a38996147a638
|
||||
size 37937
|
||||
oid sha256:5f5ef2b3ffb033d19692b881ce252e838b7bad4c5e0f80318ced7ce981a171a1
|
||||
size 38120
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6714956883951a58f6c0fb72bb4ffd6364448e1e786c20b0505a9ecbea4ced08
|
||||
size 37691
|
||||
oid sha256:386dff22fca85985560c0529d129c7f4ec9b6890ab482e391a42536ad7cb31fc
|
||||
size 38764
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3dc01217e005a255eeceaae10fa245ef81c062041bdf2ce47ef384460108e488
|
||||
size 38558
|
||||
oid sha256:4deb1a814c819b425b4c6905e22eae41652748b6bfd467fba0be2c2e51ddcbed
|
||||
size 39427
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:75709d2553791ea8ad4f5145cc6834bc205f9539ebb58900eeba2e5ddb698b6d
|
||||
size 39305
|
||||
oid sha256:f76baf840ed31cb14e4c6cc64282d0e07def31ef1bd217ef2ac9954778eeba16
|
||||
size 39306
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0ba5d6e1d28d4706c2a763c52898e1941230788d78367a6bbca30a81b739306d
|
||||
size 26299
|
||||
oid sha256:6287636b1370e78cdbbbcbbe46b53815013bb8edd1f5f3fa1fca9537d41f3647
|
||||
size 26401
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue