From f949d5624e367cdbe30469bd29eb0ae8de2b13df Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Fri, 15 Mar 2024 13:35:54 -0300 Subject: [PATCH] add draft support for public chat screen --- .../amethyst/ui/note/ChatroomMessageCompose.kt | 3 +++ .../vitorpamplona/amethyst/ui/note/NoteCompose.kt | 14 ++++++++++++++ .../amethyst/ui/screen/loggedIn/ChannelScreen.kt | 1 + .../com/vitorpamplona/amethyst/ui/theme/Shape.kt | 1 + 4 files changed, 19 insertions(+) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt index 07d60234a..974f40fd3 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ChatroomMessageCompose.kt @@ -455,6 +455,9 @@ private fun MessageBubbleLines( bubbleSize = bubbleSize, availableBubbleSize = availableBubbleSize, firstColumn = { + if (baseNote.isDraft()) { + DisplayDraftChat() + } IncognitoBadge(baseNote) ChatTimeAgo(baseNote) RelayBadgesHorizontal(baseNote, accountViewModel, nav = nav) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 9da8f3202..c14fb61bf 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -115,7 +115,9 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.ChannelHeader import com.vitorpamplona.amethyst.ui.theme.DividerThickness import com.vitorpamplona.amethyst.ui.theme.DoubleHorzSpacer import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer +import com.vitorpamplona.amethyst.ui.theme.Font12SP import com.vitorpamplona.amethyst.ui.theme.HalfDoubleVertSpacer +import com.vitorpamplona.amethyst.ui.theme.HalfEndPadding import com.vitorpamplona.amethyst.ui.theme.HalfPadding import com.vitorpamplona.amethyst.ui.theme.HalfStartPadding import com.vitorpamplona.amethyst.ui.theme.Size25dp @@ -1128,6 +1130,18 @@ fun DisplayDraft() { ) } +@Composable +fun DisplayDraftChat() { + Text( + "Draft", + color = MaterialTheme.colorScheme.placeholderText, + modifier = HalfEndPadding, + fontWeight = FontWeight.Bold, + fontSize = Font12SP, + maxLines = 1, + ) +} + @Composable fun FirstUserInfoRow( baseNote: Note, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt index d7313e466..8609846f6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt @@ -208,6 +208,7 @@ fun PrepareChannelViewModels( val channelScreenModel: NewPostViewModel = viewModel() channelScreenModel.accountViewModel = accountViewModel channelScreenModel.account = accountViewModel.account + channelScreenModel.originalNote = LocalCache.getNoteIfExists(baseChannel.idHex) ChannelScreen( channel = baseChannel, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt index 96424ca0a..c66c5fde6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt @@ -92,6 +92,7 @@ val Size40dp = 40.dp val Size55dp = 55.dp val Size75dp = 75.dp +val HalfEndPadding = Modifier.padding(end = 5.dp) val HalfStartPadding = Modifier.padding(start = 5.dp) val StdStartPadding = Modifier.padding(start = 10.dp) val StdTopPadding = Modifier.padding(top = 10.dp)