mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-26 22:16:31 +02:00
Shows replies in chat
This commit is contained in:
@@ -38,6 +38,8 @@ import com.vitorpamplona.amethyst.model.Note
|
|||||||
import com.vitorpamplona.amethyst.service.model.ChannelCreateEvent
|
import com.vitorpamplona.amethyst.service.model.ChannelCreateEvent
|
||||||
import com.vitorpamplona.amethyst.service.model.ChannelMessageEvent
|
import com.vitorpamplona.amethyst.service.model.ChannelMessageEvent
|
||||||
import com.vitorpamplona.amethyst.service.model.ChannelMetadataEvent
|
import com.vitorpamplona.amethyst.service.model.ChannelMetadataEvent
|
||||||
|
import com.vitorpamplona.amethyst.service.model.ReactionEvent
|
||||||
|
import com.vitorpamplona.amethyst.service.model.RepostEvent
|
||||||
import com.vitorpamplona.amethyst.ui.components.RichTextViewer
|
import com.vitorpamplona.amethyst.ui.components.RichTextViewer
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ val ChatBubbleShapeThem = RoundedCornerShape(3.dp, 15.dp, 15.dp, 15.dp)
|
|||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun ChatroomMessageCompose(baseNote: Note, accountViewModel: AccountViewModel, navController: NavController) {
|
fun ChatroomMessageCompose(baseNote: Note, innerQuote: Boolean = false, accountViewModel: AccountViewModel, navController: NavController) {
|
||||||
val noteState by baseNote.live.observeAsState()
|
val noteState by baseNote.live.observeAsState()
|
||||||
val note = noteState?.note
|
val note = noteState?.note
|
||||||
|
|
||||||
@@ -90,7 +92,7 @@ fun ChatroomMessageCompose(baseNote: Note, accountViewModel: AccountViewModel, n
|
|||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = alignment,
|
horizontalArrangement = alignment,
|
||||||
modifier = Modifier.fillMaxWidth(0.85f)
|
modifier = Modifier.fillMaxWidth(if (innerQuote) 1f else 0.85f)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
@@ -106,7 +108,7 @@ fun ChatroomMessageCompose(baseNote: Note, accountViewModel: AccountViewModel, n
|
|||||||
modifier = Modifier.padding(start = 10.dp, end = 10.dp, bottom = 5.dp),
|
modifier = Modifier.padding(start = 10.dp, end = 10.dp, bottom = 5.dp),
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (author != accountUser && note.event is ChannelMessageEvent) {
|
if (innerQuote || author != accountUser && note.event is ChannelMessageEvent) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = alignment,
|
horizontalArrangement = alignment,
|
||||||
@@ -138,6 +140,20 @@ fun ChatroomMessageCompose(baseNote: Note, accountViewModel: AccountViewModel, n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val replyTo = note.replyTo
|
||||||
|
if (replyTo != null && replyTo.isNotEmpty()) {
|
||||||
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
|
replyTo.mapIndexed { index, note ->
|
||||||
|
ChatroomMessageCompose(
|
||||||
|
note,
|
||||||
|
innerQuote = true,
|
||||||
|
accountViewModel = accountViewModel,
|
||||||
|
navController = navController
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
val event = note.event
|
val event = note.event
|
||||||
if (event is ChannelCreateEvent) {
|
if (event is ChannelCreateEvent) {
|
||||||
@@ -173,7 +189,6 @@ fun ChatroomMessageCompose(baseNote: Note, accountViewModel: AccountViewModel, n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.End,
|
horizontalArrangement = Arrangement.End,
|
||||||
|
Reference in New Issue
Block a user