Give the id to AvatarData to be able to compute initial properly.
This commit is contained in:
parent
d82e0e5d9e
commit
f04f2dad9e
19 changed files with 76 additions and 61 deletions
|
|
@ -67,7 +67,8 @@ class MessagesPresenter @Inject constructor(
|
|||
LaunchedEffect(syncUpdateFlow) {
|
||||
roomAvatar.value =
|
||||
AvatarData(
|
||||
name = room.bestName,
|
||||
id = room.roomId.value,
|
||||
name = room.name,
|
||||
url = room.avatarUrl,
|
||||
size = AvatarSize.SMALL
|
||||
)
|
||||
|
|
|
|||
|
|
@ -21,18 +21,7 @@
|
|||
|
||||
package io.element.android.features.messages
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.statusBars
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.wrapContentHeight
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.ModalBottomSheetValue
|
||||
import androidx.compose.material.icons.Icons
|
||||
|
|
@ -68,11 +57,7 @@ import io.element.android.libraries.designsystem.components.avatar.Avatar
|
|||
import io.element.android.libraries.designsystem.components.avatar.AvatarData
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewDark
|
||||
import io.element.android.libraries.designsystem.preview.ElementPreviewLight
|
||||
import io.element.android.libraries.designsystem.theme.components.Icon
|
||||
import io.element.android.libraries.designsystem.theme.components.IconButton
|
||||
import io.element.android.libraries.designsystem.theme.components.Scaffold
|
||||
import io.element.android.libraries.designsystem.theme.components.Text
|
||||
import io.element.android.libraries.designsystem.theme.components.TopAppBar
|
||||
import io.element.android.libraries.designsystem.theme.components.*
|
||||
import io.element.android.libraries.designsystem.utils.LogCompositions
|
||||
import io.element.android.libraries.matrix.core.RoomId
|
||||
import io.element.android.libraries.textcomposer.MessageComposerMode
|
||||
|
|
@ -223,9 +208,9 @@ fun MessagesViewDarkPreview() = ElementPreviewDark { ContentToPreview() }
|
|||
private fun ContentToPreview() {
|
||||
MessagesView(
|
||||
MessagesState(
|
||||
roomId = RoomId(""),
|
||||
roomId = RoomId("!id"),
|
||||
roomName = "Room name",
|
||||
roomAvatar = AvatarData("Room name"),
|
||||
roomAvatar = AvatarData("!id", "Room name"),
|
||||
composerState = aMessageComposerState().copy(
|
||||
text = StableCharSequence("Hello"),
|
||||
isFullScreen = false,
|
||||
|
|
|
|||
|
|
@ -156,7 +156,8 @@ class TimelineItemsFactory @Inject constructor(
|
|||
val senderDisplayName = room.userDisplayName(currentSender).getOrNull()
|
||||
val senderAvatarUrl = room.userAvatarUrl(currentSender).getOrNull()
|
||||
val senderAvatarData = AvatarData(
|
||||
name = senderDisplayName ?: currentSender,
|
||||
id = currentSender,
|
||||
name = senderDisplayName,
|
||||
url = senderAvatarUrl,
|
||||
size = AvatarSize.SMALL
|
||||
)
|
||||
|
|
|
|||
|
|
@ -418,8 +418,8 @@ internal fun createMessageEvent(
|
|||
): TimelineItem.MessageEvent {
|
||||
return TimelineItem.MessageEvent(
|
||||
id = EventId(Math.random().toString()),
|
||||
senderId = "senderId",
|
||||
senderAvatar = AvatarData("sender"),
|
||||
senderId = "@senderId",
|
||||
senderAvatar = AvatarData("@senderId", "sender"),
|
||||
content = content,
|
||||
reactionsState = TimelineItemReactions(
|
||||
persistentListOf(
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ private fun aMessageEvent(
|
|||
id = AN_EVENT_ID,
|
||||
senderId = A_USER_ID.value,
|
||||
senderDisplayName = A_USER_NAME,
|
||||
senderAvatar = AvatarData(),
|
||||
senderAvatar = AvatarData(A_USER_ID.value, A_USER_NAME),
|
||||
content = content,
|
||||
sentTime = "",
|
||||
isMine = isMine,
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ private fun aMessageEvent(
|
|||
id = AN_EVENT_ID,
|
||||
senderId = A_USER_ID.value,
|
||||
senderDisplayName = A_USER_NAME,
|
||||
senderAvatar = AvatarData(),
|
||||
senderAvatar = AvatarData(A_USER_ID.value, A_USER_NAME),
|
||||
content = content,
|
||||
sentTime = "",
|
||||
isMine = isMine,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue