Fix for mute list not showing
This commit is contained in:
@@ -238,18 +238,18 @@ fun NoteCompose(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CheckHiddenNoteCompose(
|
CheckHiddenNoteCompose(
|
||||||
baseNote,
|
note = baseNote,
|
||||||
routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
modifier,
|
modifier = modifier,
|
||||||
isBoostedNote,
|
isBoostedNote = isBoostedNote,
|
||||||
isQuotedNote,
|
isQuotedNote = isQuotedNote,
|
||||||
unPackReply,
|
unPackReply = unPackReply,
|
||||||
makeItShort,
|
makeItShort = makeItShort,
|
||||||
addMarginTop,
|
addMarginTop = addMarginTop,
|
||||||
showHidden,
|
showHidden = showHidden,
|
||||||
parentBackgroundColor,
|
parentBackgroundColor = parentBackgroundColor,
|
||||||
accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav
|
nav = nav
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,7 +272,7 @@ fun CheckHiddenNoteCompose(
|
|||||||
) {
|
) {
|
||||||
if (showHidden) {
|
if (showHidden) {
|
||||||
// Ignores reports as well
|
// Ignores reports as well
|
||||||
var state by remember {
|
val state by remember {
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
NoteComposeReportState(
|
NoteComposeReportState(
|
||||||
isAcceptable = true,
|
isAcceptable = true,
|
||||||
@@ -283,18 +283,18 @@ fun CheckHiddenNoteCompose(
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderReportState(
|
RenderReportState(
|
||||||
state,
|
state = state,
|
||||||
note,
|
note = note,
|
||||||
routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
modifier,
|
modifier = modifier,
|
||||||
isBoostedNote,
|
isBoostedNote = isBoostedNote,
|
||||||
isQuotedNote,
|
isQuotedNote = isQuotedNote,
|
||||||
unPackReply,
|
unPackReply = unPackReply,
|
||||||
makeItShort,
|
makeItShort = makeItShort,
|
||||||
addMarginTop,
|
addMarginTop = addMarginTop,
|
||||||
parentBackgroundColor,
|
parentBackgroundColor = parentBackgroundColor,
|
||||||
accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav
|
nav = nav
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
val isHidden by accountViewModel.account.liveHiddenUsers.map {
|
val isHidden by accountViewModel.account.liveHiddenUsers.map {
|
||||||
@@ -304,17 +304,17 @@ fun CheckHiddenNoteCompose(
|
|||||||
Crossfade(targetState = isHidden) {
|
Crossfade(targetState = isHidden) {
|
||||||
if (!it) {
|
if (!it) {
|
||||||
LoadedNoteCompose(
|
LoadedNoteCompose(
|
||||||
note,
|
note = note,
|
||||||
routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
modifier,
|
modifier = modifier,
|
||||||
isBoostedNote,
|
isBoostedNote = isBoostedNote,
|
||||||
isQuotedNote,
|
isQuotedNote = isQuotedNote,
|
||||||
unPackReply,
|
unPackReply = unPackReply,
|
||||||
makeItShort,
|
makeItShort = makeItShort,
|
||||||
addMarginTop,
|
addMarginTop = addMarginTop,
|
||||||
parentBackgroundColor,
|
parentBackgroundColor = parentBackgroundColor,
|
||||||
accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav
|
nav = nav
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ sealed class CardFeedState {
|
|||||||
object Loading : CardFeedState()
|
object Loading : CardFeedState()
|
||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class Loaded(val feed: MutableState<ImmutableList<Card>>) : CardFeedState()
|
class Loaded(val feed: MutableState<ImmutableList<Card>>, val showHidden: MutableState<Boolean>) : CardFeedState()
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
object Empty : CardFeedState()
|
object Empty : CardFeedState()
|
||||||
|
|||||||
@@ -142,7 +142,6 @@ fun RenderCardFeed(
|
|||||||
state = state,
|
state = state,
|
||||||
listState = listState,
|
listState = listState,
|
||||||
routeForLastRead = routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
showHidden = viewModel.showHidden(),
|
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav
|
nav = nav
|
||||||
)
|
)
|
||||||
@@ -159,7 +158,6 @@ fun RenderCardFeed(
|
|||||||
private fun FeedLoaded(
|
private fun FeedLoaded(
|
||||||
state: CardFeedState.Loaded,
|
state: CardFeedState.Loaded,
|
||||||
listState: LazyListState,
|
listState: LazyListState,
|
||||||
showHidden: Boolean,
|
|
||||||
routeForLastRead: String,
|
routeForLastRead: String,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
@@ -181,7 +179,7 @@ private fun FeedLoaded(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Row(defaultModifier) {
|
Row(defaultModifier) {
|
||||||
RenderCardItem(item, routeForLastRead, showHidden, accountViewModel, nav)
|
RenderCardItem(item, routeForLastRead, showHidden = state.showHidden.value, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,10 +71,6 @@ open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
|||||||
scrolltoTopPending = false
|
scrolltoTopPending = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showHidden(): Boolean {
|
|
||||||
return localFilter.showHiddenKey()
|
|
||||||
}
|
|
||||||
|
|
||||||
private var lastAccount: Account? = null
|
private var lastAccount: Account? = null
|
||||||
private var lastNotes: Set<Note>? = null
|
private var lastNotes: Set<Note>? = null
|
||||||
|
|
||||||
@@ -227,9 +223,10 @@ open class CardFeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel() {
|
|||||||
if (notes.isEmpty()) {
|
if (notes.isEmpty()) {
|
||||||
_feedContent.update { CardFeedState.Empty }
|
_feedContent.update { CardFeedState.Empty }
|
||||||
} else if (currentState is CardFeedState.Loaded) {
|
} else if (currentState is CardFeedState.Loaded) {
|
||||||
|
currentState.showHidden.value = localFilter.showHiddenKey()
|
||||||
currentState.feed.value = notes
|
currentState.feed.value = notes
|
||||||
} else {
|
} else {
|
||||||
_feedContent.update { CardFeedState.Loaded(mutableStateOf(notes)) }
|
_feedContent.update { CardFeedState.Loaded(mutableStateOf(notes), mutableStateOf(localFilter.showHiddenKey())) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import kotlinx.collections.immutable.ImmutableList
|
|||||||
|
|
||||||
sealed class FeedState {
|
sealed class FeedState {
|
||||||
object Loading : FeedState()
|
object Loading : FeedState()
|
||||||
class Loaded(val feed: MutableState<ImmutableList<Note>>) : FeedState()
|
class Loaded(val feed: MutableState<ImmutableList<Note>>, val showHidden: MutableState<Boolean>) : FeedState()
|
||||||
object Empty : FeedState()
|
object Empty : FeedState()
|
||||||
class FeedError(val errorMessage: String) : FeedState()
|
class FeedError(val errorMessage: String) : FeedState()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,12 +148,11 @@ private fun RenderFeed(
|
|||||||
|
|
||||||
is FeedState.Loaded -> {
|
is FeedState.Loaded -> {
|
||||||
FeedLoaded(
|
FeedLoaded(
|
||||||
state,
|
state = state,
|
||||||
listState,
|
listState = listState,
|
||||||
routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
viewModel.showHidden(),
|
accountViewModel = accountViewModel,
|
||||||
accountViewModel,
|
nav = nav
|
||||||
nav
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +184,6 @@ private fun FeedLoaded(
|
|||||||
state: FeedState.Loaded,
|
state: FeedState.Loaded,
|
||||||
listState: LazyListState,
|
listState: LazyListState,
|
||||||
routeForLastRead: String?,
|
routeForLastRead: String?,
|
||||||
showHidden: Boolean = false,
|
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -212,7 +210,7 @@ private fun FeedLoaded(
|
|||||||
routeForLastRead = routeForLastRead,
|
routeForLastRead = routeForLastRead,
|
||||||
modifier = baseModifier,
|
modifier = baseModifier,
|
||||||
isBoostedNote = false,
|
isBoostedNote = false,
|
||||||
showHidden = showHidden,
|
showHidden = state.showHidden.value,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
nav = nav
|
nav = nav
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -217,10 +217,6 @@ abstract class FeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel(), I
|
|||||||
scrolltoTopPending = false
|
scrolltoTopPending = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showHidden(): Boolean {
|
|
||||||
return localFilter.showHiddenKey()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun refresh() {
|
private fun refresh() {
|
||||||
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@@ -252,9 +248,10 @@ abstract class FeedViewModel(val localFilter: FeedFilter<Note>) : ViewModel(), I
|
|||||||
_feedContent.update { FeedState.Empty }
|
_feedContent.update { FeedState.Empty }
|
||||||
} else if (currentState is FeedState.Loaded) {
|
} else if (currentState is FeedState.Loaded) {
|
||||||
// updates the current list
|
// updates the current list
|
||||||
|
currentState.showHidden.value = localFilter.showHiddenKey()
|
||||||
currentState.feed.value = notes
|
currentState.feed.value = notes
|
||||||
} else {
|
} else {
|
||||||
_feedContent.update { FeedState.Loaded(mutableStateOf(notes)) }
|
_feedContent.update { FeedState.Loaded(mutableStateOf(notes), mutableStateOf(localFilter.showHiddenKey())) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,10 +70,6 @@ open class UserFeedViewModel(val dataSource: FeedFilter<User>) : ViewModel(), In
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showHidden(): Boolean {
|
|
||||||
return dataSource.showHiddenKey()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun refreshSuspended() {
|
private fun refreshSuspended() {
|
||||||
checkNotInMainThread()
|
checkNotInMainThread()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user