diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BoostSetCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BoostSetCompose.kt index 99e39c5278..98c3640385 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BoostSetCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/BoostSetCompose.kt @@ -36,6 +36,9 @@ fun BoostSetCompose(likeSetCard: BoostSetCard, isInnerNote: Boolean = false, rou val noteState by likeSetCard.note.live.observeAsState() val note = noteState?.note + val accountState by accountViewModel.accountLiveData.observeAsState() + val account = accountState?.account ?: return + val context = LocalContext.current.applicationContext if (note?.event == null) { @@ -79,20 +82,7 @@ fun BoostSetCompose(likeSetCard: BoostSetCard, isInnerNote: Boolean = false, rou if (cardNote?.author != null) { val userState by cardNote.author!!.live.observeAsState() - AsyncImage( - model = userState?.user?.profilePicture(), - placeholder = rememberAsyncImagePainter("https://robohash.org/${userState?.user?.pubkeyHex}.png"), - contentDescription = "Profile Image", - modifier = Modifier - .width(35.dp) - .height(35.dp) - .clip(shape = CircleShape) - .clickable(onClick = { - userState?.let { - navController.navigate("User/${it.user.pubkeyHex}") - } - }) - ) + UserPicture(user = userState?.user, userAccount = account.userProfile(), size = 35.dp) } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/LikeSetCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/LikeSetCompose.kt index 85bc9c962d..a45be81431 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/LikeSetCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/LikeSetCompose.kt @@ -36,6 +36,9 @@ fun LikeSetCompose(likeSetCard: LikeSetCard, modifier: Modifier = Modifier, isIn val noteState by likeSetCard.note.live.observeAsState() val note = noteState?.note + val accountState by accountViewModel.accountLiveData.observeAsState() + val account = accountState?.account ?: return + val context = LocalContext.current.applicationContext if (note == null) { @@ -79,20 +82,7 @@ fun LikeSetCompose(likeSetCard: LikeSetCard, modifier: Modifier = Modifier, isIn if (cardNote?.author != null) { val userState by cardNote.author!!.live.observeAsState() - AsyncImage( - model = userState?.user?.profilePicture(), - placeholder = rememberAsyncImagePainter("https://robohash.org/${userState?.user?.pubkeyHex}.png"), - contentDescription = "Profile Image", - modifier = Modifier - .width(35.dp).height(35.dp) - .height(35.dp) - .clip(shape = CircleShape) - .clickable(onClick = { - userState?.let { - navController.navigate("User/${it.user.pubkeyHex}") - } - }) - ) + UserPicture(user = userState?.user, userAccount = account.userProfile(), size = 35.dp) } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt index 2b35fcc34a..c0e47c3e25 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/ThreadFeedView.kt @@ -41,6 +41,7 @@ import com.vitorpamplona.amethyst.ui.components.RichTextViewer import com.vitorpamplona.amethyst.ui.note.BlankNote import com.vitorpamplona.amethyst.ui.note.NoteCompose import com.vitorpamplona.amethyst.ui.note.ReactionsRow +import com.vitorpamplona.amethyst.ui.note.UserPicture import com.vitorpamplona.amethyst.ui.note.UsernameDisplay import com.vitorpamplona.amethyst.ui.note.timeAgoLong import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel @@ -156,6 +157,9 @@ fun NoteMaster(baseNote: Note, accountViewModel: AccountViewModel, navController val noteState by baseNote.live.observeAsState() val note = noteState?.note + val accountState by accountViewModel.accountLiveData.observeAsState() + val account = accountState?.account ?: return + if (note?.event == null) { BlankNote() } else { @@ -174,15 +178,7 @@ fun NoteMaster(baseNote: Note, accountViewModel: AccountViewModel, navController } }) ) { - // Draws the boosted picture outside the boosted card. - AsyncImage( - model = author?.profilePicture(), - placeholder = rememberAsyncImagePainter("https://robohash.org/${author?.pubkeyHex}.png"), - contentDescription = "Profile Image", - modifier = Modifier - .width(55.dp).height(55.dp) - .clip(shape = CircleShape) - ) + UserPicture(user = author, userAccount = account.userProfile(), size = 55.dp) Column(modifier = Modifier.padding(start = 10.dp)) { Row(verticalAlignment = Alignment.CenterVertically) {