From 19846e7ff3bd9b2572d53cbc38e040d644a19ca0 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 13 Nov 2025 10:49:29 -0500 Subject: [PATCH] Improves the composition of NIP-05 lines --- .../ui/note/NIP05VerificationDisplay.kt | 42 ++++++++----------- .../amethyst/ui/note/NoteCompose.kt | 10 +++-- .../loggedIn/threadview/ThreadFeedView.kt | 13 +++--- .../ui/screen/loggedIn/video/VideoScreen.kt | 5 +-- 4 files changed, 33 insertions(+), 37 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt index 238f52c3b..48ad80fbf 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NIP05VerificationDisplay.kt @@ -20,7 +20,6 @@ */ package com.vitorpamplona.amethyst.ui.components -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.padding @@ -122,19 +121,17 @@ fun nip05VerificationAsAState( @Composable fun ObserveDisplayNip05Status( baseNote: Note, - columnModifier: Modifier = Modifier, accountViewModel: AccountViewModel, nav: INav, ) { WatchAuthor(baseNote = baseNote, accountViewModel) { - ObserveDisplayNip05Status(it, columnModifier, accountViewModel, nav) + ObserveDisplayNip05Status(it, accountViewModel, nav) } } @Composable fun ObserveDisplayNip05Status( baseUser: User, - columnModifier: Modifier = Modifier, accountViewModel: AccountViewModel, nav: INav, ) { @@ -143,14 +140,12 @@ fun ObserveDisplayNip05Status( CrossfadeIfEnabled( targetState = nip05, - modifier = columnModifier, accountViewModel = accountViewModel, ) { VerifyAndDisplayNIP05OrStatusLine( it, statuses, baseUser, - columnModifier, accountViewModel, nav, ) @@ -162,29 +157,26 @@ private fun VerifyAndDisplayNIP05OrStatusLine( nip05: String?, statuses: ImmutableList, baseUser: User, - columnModifier: Modifier = Modifier, accountViewModel: AccountViewModel, nav: INav, ) { - Column(modifier = columnModifier) { - Row(verticalAlignment = Alignment.CenterVertically) { - if (nip05 != null) { - val nip05Verified = - nip05VerificationAsAState(baseUser.info!!, baseUser.pubkeyHex, accountViewModel) + Row(verticalAlignment = Alignment.CenterVertically) { + if (nip05 != null) { + val nip05Verified = + nip05VerificationAsAState(baseUser.info!!, baseUser.pubkeyHex, accountViewModel) - if (nip05Verified.value != true) { - DisplayNIP05(nip05, nip05Verified, accountViewModel) - } else if (!statuses.isEmpty()) { - ObserveRotateStatuses(statuses, accountViewModel, nav) - } else { - DisplayNIP05(nip05, nip05Verified, accountViewModel) - } + if (nip05Verified.value != true) { + DisplayNIP05(nip05, nip05Verified, accountViewModel) + } else if (!statuses.isEmpty()) { + ObserveRotateStatuses(statuses, accountViewModel, nav) } else { - if (!statuses.isEmpty()) { - RotateStatuses(statuses, accountViewModel, nav) - } else { - DisplayUsersNpub(baseUser.pubkeyDisplayHex()) - } + DisplayNIP05(nip05, nip05Verified, accountViewModel) + } + } else { + if (!statuses.isEmpty()) { + RotateStatuses(statuses, accountViewModel, nav) + } else { + DisplayUsersNpub(baseUser.pubkeyDisplayHex()) } } } @@ -253,7 +245,7 @@ fun DisplayStatus( nav: INav, ) { val noteState by observeNote(addressableNote, accountViewModel) - val noteEvent = noteState?.note?.event as? StatusEvent ?: return + val noteEvent = noteState.note.event as? StatusEvent ?: return DisplayStatus(noteEvent, accountViewModel, nav) } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt index 8442ffeed..85d2b2a6d 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteCompose.kt @@ -1062,10 +1062,12 @@ fun SecondUserInfoRow( verticalAlignment = CenterVertically, modifier = UserNameMaxRowHeight, ) { - if (noteEvent is BaseThreadedEvent && noteEvent.isAFork()) { - ShowForkInformation(noteEvent, remember(noteEvent) { Modifier.weight(1f) }, accountViewModel, nav) - } else { - ObserveDisplayNip05Status(noteAuthor, remember(noteEvent) { Modifier.weight(1f) }, accountViewModel, nav) + Column(modifier = remember(noteEvent) { Modifier.weight(1f) }) { + if (noteEvent is BaseThreadedEvent && noteEvent.isAFork()) { + ShowForkInformation(noteEvent, remember(noteEvent) { Modifier.weight(1f) }, accountViewModel, nav) + } else { + ObserveDisplayNip05Status(noteAuthor, accountViewModel, nav) + } } val geo = remember(noteEvent) { noteEvent.geoHashOrScope() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt index 9882f0106..e3f5068b9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/threadview/ThreadFeedView.kt @@ -505,12 +505,15 @@ private fun FullBleedNoteCompose( } Row(verticalAlignment = Alignment.CenterVertically) { - ObserveDisplayNip05Status( - baseNote, + Column( remember { Modifier.weight(1f) }, - accountViewModel, - nav, - ) + ) { + ObserveDisplayNip05Status( + baseNote, + accountViewModel, + nav, + ) + } val geo = remember { noteEvent.geoHashOrScope() } if (geo != null) { diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt index 7053278c5..16a001a81 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/video/VideoScreen.kt @@ -311,7 +311,7 @@ private fun RenderAuthorInformation( nav: INav, accountViewModel: AccountViewModel, ) { - Row(modifier = Modifier.padding(start = 10.dp, end = 10.dp, bottom = 10.dp), verticalAlignment = Alignment.CenterVertically) { + Row(modifier = Modifier.fillMaxWidth().padding(start = 10.dp, end = 10.dp, bottom = 10.dp), verticalAlignment = Alignment.CenterVertically) { NoteAuthorPicture(note, Size55dp, accountViewModel = accountViewModel, nav = nav) Spacer(modifier = DoubleHorzSpacer) @@ -327,10 +327,9 @@ private fun RenderAuthorInformation( VideoUserOptionAction(note, accountViewModel, nav) } if (accountViewModel.settings.isCompleteUIMode()) { - Row(verticalAlignment = Alignment.CenterVertically) { + Row(modifier = Modifier.fillMaxWidth()) { ObserveDisplayNip05Status( note.author!!, - Modifier.weight(1f), accountViewModel, nav = nav, )