mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-30 00:40:49 +00:00
Fixes the lack of refresh when adding hidden words in the Security filters
This commit is contained in:
parent
cdb65640ba
commit
6600a49564
@ -74,7 +74,6 @@ import com.vitorpamplona.amethyst.ui.screen.NostrSpammerAccountsFeedViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.RefresheableBox
|
import com.vitorpamplona.amethyst.ui.screen.RefresheableBox
|
||||||
import com.vitorpamplona.amethyst.ui.screen.RefreshingFeedUserFeedView
|
import com.vitorpamplona.amethyst.ui.screen.RefreshingFeedUserFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.StringFeedView
|
import com.vitorpamplona.amethyst.ui.screen.StringFeedView
|
||||||
import com.vitorpamplona.amethyst.ui.screen.UserFeedViewModel
|
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
import com.vitorpamplona.amethyst.ui.theme.ButtonBorder
|
||||||
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
import com.vitorpamplona.amethyst.ui.theme.ButtonPadding
|
||||||
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
import com.vitorpamplona.amethyst.ui.theme.DividerThickness
|
||||||
@ -104,6 +103,12 @@ fun HiddenUsersScreen(
|
|||||||
factory = NostrSpammerAccountsFeedViewModel.Factory(accountViewModel.account),
|
factory = NostrSpammerAccountsFeedViewModel.Factory(accountViewModel.account),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
WatchAccountAndBlockList(accountViewModel = accountViewModel) {
|
||||||
|
hiddenFeedViewModel.invalidateData()
|
||||||
|
spammerFeedViewModel.invalidateData()
|
||||||
|
hiddenWordsFeedViewModel.invalidateData()
|
||||||
|
}
|
||||||
|
|
||||||
HiddenUsersScreen(
|
HiddenUsersScreen(
|
||||||
hiddenFeedViewModel,
|
hiddenFeedViewModel,
|
||||||
hiddenWordsFeedViewModel,
|
hiddenWordsFeedViewModel,
|
||||||
@ -197,14 +202,8 @@ fun HiddenUsersScreen(
|
|||||||
}
|
}
|
||||||
HorizontalPager(state = pagerState) { page ->
|
HorizontalPager(state = pagerState) { page ->
|
||||||
when (page) {
|
when (page) {
|
||||||
0 ->
|
0 -> RefreshingFeedUserFeedView(hiddenFeedViewModel, accountViewModel, nav)
|
||||||
RefreshingUserFeedView(hiddenFeedViewModel, accountViewModel) {
|
1 -> RefreshingFeedUserFeedView(spammerFeedViewModel, accountViewModel, nav)
|
||||||
RefreshingFeedUserFeedView(hiddenFeedViewModel, accountViewModel, nav)
|
|
||||||
}
|
|
||||||
1 ->
|
|
||||||
RefreshingUserFeedView(spammerFeedViewModel, accountViewModel) {
|
|
||||||
RefreshingFeedUserFeedView(spammerFeedViewModel, accountViewModel, nav)
|
|
||||||
}
|
|
||||||
2 -> HiddenWordsFeed(hiddenWordsViewModel, accountViewModel)
|
2 -> HiddenWordsFeed(hiddenWordsViewModel, accountViewModel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -268,25 +267,17 @@ private fun AddMuteWordTextField(accountViewModel: AccountViewModel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun RefreshingUserFeedView(
|
|
||||||
feedViewModel: UserFeedViewModel,
|
|
||||||
accountViewModel: AccountViewModel,
|
|
||||||
inner: @Composable () -> Unit,
|
|
||||||
) {
|
|
||||||
WatchAccountAndBlockList(feedViewModel, accountViewModel)
|
|
||||||
inner()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun WatchAccountAndBlockList(
|
fun WatchAccountAndBlockList(
|
||||||
feedViewModel: UserFeedViewModel,
|
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
invalidate: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val accountState by accountViewModel.accountLiveData.observeAsState()
|
val accountState by accountViewModel.accountLiveData.observeAsState()
|
||||||
val blockListState by accountViewModel.account.flowHiddenUsers.collectAsStateWithLifecycle()
|
val blockListState by accountViewModel.account.flowHiddenUsers.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
LaunchedEffect(accountViewModel, accountState, blockListState) { feedViewModel.invalidateData() }
|
LaunchedEffect(accountViewModel, accountState, blockListState) {
|
||||||
|
invalidate()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
Loading…
Reference in New Issue
Block a user