From 0434ef6ec6cd08a14e24689a7afc1f24e9e08774 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Wed, 23 Aug 2023 17:31:11 -0400 Subject: [PATCH] Fixing quotes and boosts for NIP94 and NIP95 content --- .../amethyst/ui/note/NoteCompose.kt | 118 ++++++++++++------ 1 file changed, 83 insertions(+), 35 deletions(-) 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 dc8c0f8e5..4138bca19 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 @@ -124,7 +124,6 @@ import com.vitorpamplona.amethyst.ui.theme.DoubleVertSpacer import com.vitorpamplona.amethyst.ui.theme.Font14SP import com.vitorpamplona.amethyst.ui.theme.HalfPadding import com.vitorpamplona.amethyst.ui.theme.HalfStartPadding -import com.vitorpamplona.amethyst.ui.theme.HalfVertSpacer import com.vitorpamplona.amethyst.ui.theme.HeaderPictureModifier import com.vitorpamplona.amethyst.ui.theme.QuoteBorder import com.vitorpamplona.amethyst.ui.theme.Size10dp @@ -465,45 +464,86 @@ fun NormalNote( accountViewModel: AccountViewModel, nav: (String) -> Unit ) { - when (baseNote.event) { - is ChannelCreateEvent, is ChannelMetadataEvent -> ChannelHeader( - channelNote = baseNote, - showVideo = !makeItShort, - showBottomDiviser = true, - sendToChannel = true, - accountViewModel = accountViewModel, - nav = nav - ) - is CommunityDefinitionEvent -> (baseNote as? AddressableNote)?.let { - CommunityHeader( - baseNote = it, + if (isQuotedNote || isBoostedNote) { + when (baseNote.event) { + is ChannelCreateEvent, is ChannelMetadataEvent -> ChannelHeader( + channelNote = baseNote, + showVideo = !makeItShort, showBottomDiviser = true, - sendToCommunity = true, + sendToChannel = true, accountViewModel = accountViewModel, nav = nav ) - } - is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote) - is FileHeaderEvent -> FileHeaderDisplay(baseNote, isQuotedNote || isBoostedNote, accountViewModel) - is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, isQuotedNote || isBoostedNote, accountViewModel) - else -> - LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup -> - CheckNewAndRenderNote( - baseNote, - routeForLastRead, - modifier, - isBoostedNote, - isQuotedNote, - unPackReply, - makeItShort, - addMarginTop, - canPreview, - parentBackgroundColor, - accountViewModel, - showPopup, - nav + is CommunityDefinitionEvent -> (baseNote as? AddressableNote)?.let { + CommunityHeader( + baseNote = it, + showBottomDiviser = true, + sendToCommunity = true, + accountViewModel = accountViewModel, + nav = nav ) } + is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote) + else -> + LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup -> + CheckNewAndRenderNote( + baseNote, + routeForLastRead, + modifier, + isBoostedNote, + isQuotedNote, + unPackReply, + makeItShort, + addMarginTop, + canPreview, + parentBackgroundColor, + accountViewModel, + showPopup, + nav + ) + } + } + } else { + when (baseNote.event) { + is ChannelCreateEvent, is ChannelMetadataEvent -> ChannelHeader( + channelNote = baseNote, + showVideo = !makeItShort, + showBottomDiviser = true, + sendToChannel = true, + accountViewModel = accountViewModel, + nav = nav + ) + is CommunityDefinitionEvent -> (baseNote as? AddressableNote)?.let { + CommunityHeader( + baseNote = it, + showBottomDiviser = true, + sendToCommunity = true, + accountViewModel = accountViewModel, + nav = nav + ) + } + is BadgeDefinitionEvent -> BadgeDisplay(baseNote = baseNote) + is FileHeaderEvent -> FileHeaderDisplay(baseNote, false, accountViewModel) + is FileStorageHeaderEvent -> FileStorageHeaderDisplay(baseNote, false, accountViewModel) + else -> + LongPressToQuickAction(baseNote = baseNote, accountViewModel = accountViewModel) { showPopup -> + CheckNewAndRenderNote( + baseNote, + routeForLastRead, + modifier, + isBoostedNote, + isQuotedNote, + unPackReply, + makeItShort, + addMarginTop, + canPreview, + parentBackgroundColor, + accountViewModel, + showPopup, + nav + ) + } + } } } @@ -1014,7 +1054,7 @@ private fun NoteBody( ) } - Spacer(modifier = HalfVertSpacer) + Spacer(modifier = StdVertSpacer) if (!makeItShort) { ReplyRow( @@ -1144,6 +1184,14 @@ private fun RenderNoteRow( ) } + is FileHeaderEvent -> { + FileHeaderDisplay(baseNote, true, accountViewModel) + } + + is FileStorageHeaderEvent -> { + FileStorageHeaderDisplay(baseNote, true, accountViewModel) + } + is CommunityPostApprovalEvent -> { RenderPostApproval( baseNote,