do not display default group if it is empty (#756)

This commit is contained in:
aualbert 2024-06-19 09:12:45 +00:00 committed by GitHub
parent 9324511c9f
commit 384684e77c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,6 +66,7 @@ import me.ash.reader.ui.ext.collectAsStateValue
import me.ash.reader.ui.ext.currentAccountId
import me.ash.reader.ui.ext.findActivity
import me.ash.reader.ui.ext.getCurrentVersion
import me.ash.reader.ui.ext.getDefaultGroupId
import me.ash.reader.ui.page.common.RouteName
import me.ash.reader.ui.page.home.FilterState
import me.ash.reader.ui.page.home.HomeViewModel
@ -232,6 +233,7 @@ fun FeedsPage(
)
}
}
item {
Spacer(modifier = Modifier.height(24.dp))
Subtitle(
@ -240,12 +242,17 @@ fun FeedsPage(
)
Spacer(modifier = Modifier.height(8.dp))
}
val defaultGroupId = context.currentAccountId.getDefaultGroupId()
itemsIndexed(groupWithFeedList) { index, groupWithFeed ->
when (groupWithFeed) {
is GroupFeedsView.Group -> {
if (index != 0) {
Spacer(modifier = Modifier.height(16.dp))
}
if (groupWithFeed.group.id != defaultGroupId || groupWithFeed.group.feeds > 0) {
GroupItem(
isExpanded = {
groupsVisible.getOrPut(
@ -258,7 +265,8 @@ fun FeedsPage(
indicatorAlpha = groupIndicatorAlpha,
roundedBottomCorner = { index == groupWithFeedList.lastIndex || groupWithFeed.group.feeds == 0 },
onExpanded = {
groupsVisible[groupWithFeed.group.id] = groupsVisible.getOrPut(
groupsVisible[groupWithFeed.group.id] =
groupsVisible.getOrPut(
groupWithFeed.group.id,
groupListExpand::value
).not()
@ -274,6 +282,7 @@ fun FeedsPage(
)
}
}
}
is GroupFeedsView.Feed -> {
FeedItem(