Move live state into if statement for AvatarImage.

This commit is contained in:
Alex Hart
2025-04-09 15:40:09 -03:00
committed by Michelle Tang
parent 6006c047d8
commit 143b2b5bd5

View File

@@ -29,7 +29,6 @@ fun AvatarImage(
useProfile: Boolean = true useProfile: Boolean = true
) { ) {
val context = LocalContext.current val context = LocalContext.current
val state = recipient.live().liveData.map { AvatarImageState(NameUtil.getAbbreviation(it.getDisplayName(context)), it, AvatarHelper.getAvatarFileDetails(context, it.id)) }.observeAsState().value ?: return
if (LocalInspectionMode.current) { if (LocalInspectionMode.current) {
Spacer( Spacer(
@@ -37,6 +36,8 @@ fun AvatarImage(
.background(color = Color.Red, shape = CircleShape) .background(color = Color.Red, shape = CircleShape)
) )
} else { } else {
val state = recipient.live().liveData.map { AvatarImageState(NameUtil.getAbbreviation(it.getDisplayName(context)), it, AvatarHelper.getAvatarFileDetails(context, it.id)) }.observeAsState().value ?: return
AndroidView( AndroidView(
factory = ::AvatarImageView, factory = ::AvatarImageView,
modifier = modifier.background(color = Color.Transparent, shape = CircleShape) modifier = modifier.background(color = Color.Transparent, shape = CircleShape)