- Adds picture of the User to the Stream header.
- BugFix for the Click on UserPicture event
This commit is contained in:
@@ -2935,10 +2935,10 @@ private fun DisplayBlankAuthor(size: Dp, modifier: Modifier) {
|
||||
@Composable
|
||||
fun UserPicture(
|
||||
user: User,
|
||||
nav: (String) -> Unit,
|
||||
accountViewModel: AccountViewModel,
|
||||
size: Dp,
|
||||
pictureModifier: Modifier = Modifier
|
||||
pictureModifier: Modifier = remember { Modifier },
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit
|
||||
) {
|
||||
val route by remember {
|
||||
derivedStateOf {
|
||||
@@ -2946,9 +2946,19 @@ fun UserPicture(
|
||||
}
|
||||
}
|
||||
|
||||
ClickableUserPicture(user, size, accountViewModel, pictureModifier) {
|
||||
nav(route)
|
||||
}
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
ClickableUserPicture(
|
||||
baseUser = user,
|
||||
size = size,
|
||||
accountViewModel = accountViewModel,
|
||||
modifier = pictureModifier,
|
||||
onClick = {
|
||||
scope.launch {
|
||||
nav(route)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@@ -2991,7 +3001,7 @@ fun ClickableUserPicture(
|
||||
}
|
||||
|
||||
Box(modifier = myModifier, contentAlignment = TopEnd) {
|
||||
UserPicture(baseUser, size, accountViewModel, modifier)
|
||||
BaseUserPicture(baseUser, size, accountViewModel, modifier)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3007,12 +3017,12 @@ fun NonClickableUserPicture(
|
||||
}
|
||||
|
||||
Box(myBoxModifier, contentAlignment = TopEnd) {
|
||||
UserPicture(baseUser, size, accountViewModel, modifier)
|
||||
BaseUserPicture(baseUser, size, accountViewModel, modifier)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun UserPicture(
|
||||
fun BaseUserPicture(
|
||||
baseUser: User,
|
||||
size: Dp,
|
||||
accountViewModel: AccountViewModel,
|
||||
|
||||
@@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Divider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -39,7 +38,7 @@ fun UserCompose(
|
||||
modifier = overallModifier,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
UserPicture(baseUser, nav, accountViewModel, 55.dp)
|
||||
UserPicture(baseUser, 55.dp, accountViewModel = accountViewModel, nav = nav)
|
||||
|
||||
Column(modifier = Modifier.padding(start = 10.dp).weight(1f)) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
|
||||
@@ -106,7 +106,7 @@ private fun RenderZapNote(
|
||||
},
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
UserPicture(baseAuthor, nav, accountViewModel, 55.dp)
|
||||
UserPicture(baseAuthor, 55.dp, accountViewModel = accountViewModel, nav = nav)
|
||||
|
||||
Column(
|
||||
modifier = remember {
|
||||
|
||||
@@ -94,6 +94,7 @@ import com.vitorpamplona.amethyst.ui.components.VideoView
|
||||
import com.vitorpamplona.amethyst.ui.navigation.Route
|
||||
import com.vitorpamplona.amethyst.ui.note.ChatroomMessageCompose
|
||||
import com.vitorpamplona.amethyst.ui.note.LikeReaction
|
||||
import com.vitorpamplona.amethyst.ui.note.UserPicture
|
||||
import com.vitorpamplona.amethyst.ui.note.ZapReaction
|
||||
import com.vitorpamplona.amethyst.ui.screen.NostrChannelFeedViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.RefreshingChatroomFeedView
|
||||
@@ -518,7 +519,7 @@ fun ChannelHeader(
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: (String) -> Unit
|
||||
) {
|
||||
var baseChannel by remember { mutableStateOf<Channel?>(LocalCache.channels[channelHex]) }
|
||||
var baseChannel by remember { mutableStateOf(LocalCache.channels[channelHex]) }
|
||||
|
||||
if (baseChannel == null) {
|
||||
LaunchedEffect(key1 = channelHex) {
|
||||
@@ -550,9 +551,11 @@ fun ChannelHeader(
|
||||
nav: (String) -> Unit
|
||||
) {
|
||||
Column(
|
||||
Modifier.fillMaxWidth().clickable {
|
||||
nav("Channel/${baseChannel.idHex}")
|
||||
}
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable {
|
||||
nav("Channel/${baseChannel.idHex}")
|
||||
}
|
||||
) {
|
||||
val channelState by baseChannel.live.observeAsState()
|
||||
val channel = remember(channelState) { channelState?.channel } ?: return
|
||||
@@ -574,6 +577,15 @@ fun ChannelHeader(
|
||||
|
||||
Column(modifier = modifier) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
channel.creator?.let {
|
||||
UserPicture(
|
||||
user = it,
|
||||
size = Size35dp,
|
||||
accountViewModel = accountViewModel,
|
||||
nav = nav
|
||||
)
|
||||
}
|
||||
|
||||
RobohashAsyncImageProxy(
|
||||
robot = channel.idHex,
|
||||
model = channel.profilePicture(),
|
||||
@@ -581,6 +593,7 @@ fun ChannelHeader(
|
||||
modifier = Modifier
|
||||
.width(Size35dp)
|
||||
.height(Size35dp)
|
||||
.padding(start = 10.dp)
|
||||
.clip(shape = CircleShape)
|
||||
)
|
||||
|
||||
@@ -592,7 +605,7 @@ fun ChannelHeader(
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Text(
|
||||
channel.toBestDisplayName(),
|
||||
channel.toBestDisplayName() + channel.idHex.split(":")[2],
|
||||
fontWeight = FontWeight.Bold,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
|
||||
@@ -104,7 +104,6 @@ import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||
import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.math.BigDecimal
|
||||
|
||||
@Composable
|
||||
@@ -116,7 +115,7 @@ fun ProfileScreen(userId: String?, accountViewModel: AccountViewModel, nav: (Str
|
||||
if (userBase == null) {
|
||||
LaunchedEffect(userId) {
|
||||
// waits to resolve.
|
||||
withContext(Dispatchers.IO) {
|
||||
launch(Dispatchers.IO) {
|
||||
val newUserBase = LocalCache.checkGetOrCreateUser(userId)
|
||||
if (newUserBase != userBase) {
|
||||
userBase = newUserBase
|
||||
|
||||
Reference in New Issue
Block a user