From 35cab28543fd5d139be30c7bc38bd6de0c4e6e7e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 21:35:04 +0000 Subject: [PATCH] feat(badges): add accept controls to notification card The notification card BadgeCompose rendered the awarded badge via BadgeDisplay (definition-only) and stopped there, so a recipient viewing a fresh badge in their inbox had no way to add it to their profile without navigating to the award's thread first. Expose AcceptBadgeControls (was private inside Badge.kt) and call it from BadgeCompose under the BadgeDisplay row when the underlying note is a BadgeAwardEvent. Other surfaces are unchanged: - RenderBadgeAward (Badge feed / threads) keeps its own call to the same composable; behaviour is identical because the controls were already package-private. - BadgeCompose has only one caller (CardFeedView, the notifications feed), so the new row only appears there. --- .../java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt | 6 ++++++ .../java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt index 338eb71b6..01a3c83e6 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/BadgeCompose.kt @@ -46,11 +46,13 @@ import com.vitorpamplona.amethyst.service.relayClient.reqCommand.event.observeNo import com.vitorpamplona.amethyst.ui.navigation.navs.INav import com.vitorpamplona.amethyst.ui.navigation.routes.routeFor import com.vitorpamplona.amethyst.ui.note.elements.MoreOptionsButton +import com.vitorpamplona.amethyst.ui.note.types.AcceptBadgeControls import com.vitorpamplona.amethyst.ui.note.types.BadgeDisplay import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.BadgeCard import com.vitorpamplona.amethyst.ui.stringRes import com.vitorpamplona.amethyst.ui.theme.placeholderText +import com.vitorpamplona.quartz.nip58Badges.award.BadgeAwardEvent @OptIn(ExperimentalFoundationApi::class) @Composable @@ -128,6 +130,10 @@ fun BadgeCompose( note.replyTo?.firstOrNull()?.let { BadgeDisplay(baseNote = it, accountViewModel) } + + (note.event as? BadgeAwardEvent)?.let { award -> + AcceptBadgeControls(award, accountViewModel) + } } } } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt index 4d3af6878..509c82511 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/types/Badge.kt @@ -297,7 +297,7 @@ private fun BadgeAwardeesRow( } @Composable -private fun AcceptBadgeControls( +fun AcceptBadgeControls( award: BadgeAwardEvent, accountViewModel: AccountViewModel, ) {