From 8ad5244c1e281aaf28c2026202efe49dad12d041 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 22 Jun 2026 19:23:40 +0000 Subject: [PATCH] feat: show blocked/muted state instead of empty feed on profile When viewing the Notes or Replies tab of a muted/blocked user, display a "UserBlockedFeed" screen with an Unblock button rather than loading the LazyColumn feed (which would show only dividers after filtering removes all hidden posts). Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01ChNCLiDX58paTKhReYCYq6 --- .../amethyst/ui/feeds/UserBlockedFeed.kt | 47 +++++++++++++++++++ .../screen/loggedIn/profile/ProfileScreen.kt | 17 ++++++- amethyst/src/main/res/values/strings.xml | 1 + 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/UserBlockedFeed.kt diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/UserBlockedFeed.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/UserBlockedFeed.kt new file mode 100644 index 0000000000..2d597ce4f9 --- /dev/null +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/feeds/UserBlockedFeed.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2025 Vitor Pamplona + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.vitorpamplona.amethyst.ui.feeds + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.OutlinedButton +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.ui.stringRes +import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer + +@Composable +fun UserBlockedFeed(onUnblock: () -> Unit) { + Column( + Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.Center, + ) { + Text(stringRes(R.string.user_is_blocked_hidden)) + Spacer(modifier = StdVertSpacer) + OutlinedButton(onClick = onUnblock) { Text(text = stringRes(R.string.unblock_user)) } + } +} diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt index f94f9f6992..fda2e22b49 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/profile/ProfileScreen.kt @@ -67,6 +67,7 @@ import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.model.User import com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.observeAccountIsHiddenUser +import com.vitorpamplona.amethyst.ui.feeds.UserBlockedFeed import com.vitorpamplona.amethyst.ui.feeds.WatchLifecycleAndUpdateModel import com.vitorpamplona.amethyst.ui.navigation.bottombars.AppBottomBar import com.vitorpamplona.amethyst.ui.navigation.navs.INav @@ -588,9 +589,21 @@ private fun CreateAndRenderPages( accountViewModel, ) + val isHidden by observeAccountIsHiddenUser(accountViewModel.account, baseUser) + when (tab) { - ProfileTab.Notes -> TabNotesNewThreads(threadsViewModel, pinnedNotesFeedViewModel, accountViewModel, nav) - ProfileTab.Replies -> TabNotesConversations(repliesViewModel, accountViewModel, nav) + ProfileTab.Notes -> + if (isHidden) { + UserBlockedFeed { accountViewModel.show(baseUser) } + } else { + TabNotesNewThreads(threadsViewModel, pinnedNotesFeedViewModel, accountViewModel, nav) + } + ProfileTab.Replies -> + if (isHidden) { + UserBlockedFeed { accountViewModel.show(baseUser) } + } else { + TabNotesConversations(repliesViewModel, accountViewModel, nav) + } ProfileTab.Mutual -> TabMutualConversations(mutualViewModel, accountViewModel, nav) ProfileTab.Gallery -> TabGallery(galleryFeedViewModel, accountViewModel, nav) ProfileTab.Follows -> TabFollows(followsFeedViewModel, accountViewModel, nav) diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index fea22e515b..ef3a616874 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -281,6 +281,7 @@ Unblock Copy User ID Unblock User + This user is blocked/muted. Their posts are hidden. "npub, username, text" Clear App Logo