Add a filter group for locations and moves global and around me to their correct sections

This commit is contained in:
Vitor Pamplona
2026-04-05 12:50:52 -04:00
parent 78010cfd69
commit 67184fb72e
3 changed files with 30 additions and 6 deletions
@@ -327,6 +327,7 @@ private enum class FeedGroup(
FEEDS(R.string.feed_group_feeds),
HASHTAGS(R.string.feed_group_hashtags),
COMMUNITIES(R.string.feed_group_communities),
LOCATIONS(R.string.feed_group_locations),
LISTS(R.string.feed_group_lists),
RELAYS(R.string.feed_group_relays),
}
@@ -335,11 +336,33 @@ private fun groupFeedDefinitions(options: ImmutableList<FeedDefinition>): Map<Fe
val indexed = options.mapIndexed { index, item -> IndexedFeedDefinition(index, item) }
return indexed.groupBy { entry ->
when (entry.item.name) {
is HashtagName -> FeedGroup.HASHTAGS
is CommunityName -> FeedGroup.COMMUNITIES
is PeopleListName -> FeedGroup.LISTS
is RelayName -> FeedGroup.RELAYS
else -> FeedGroup.FEEDS
is HashtagName -> {
FeedGroup.HASHTAGS
}
is CommunityName -> {
FeedGroup.COMMUNITIES
}
is PeopleListName -> {
FeedGroup.LISTS
}
is RelayName -> {
FeedGroup.RELAYS
}
is GeoHashName -> {
FeedGroup.LOCATIONS
}
is ResourceName -> {
when (entry.item.code) {
is TopFilter.AroundMe -> FeedGroup.LOCATIONS
is TopFilter.Global -> FeedGroup.RELAYS
else -> FeedGroup.FEEDS
}
}
}
}
}
@@ -243,7 +243,7 @@ class TopNavFilterState(
}
@Stable
abstract class Name {
sealed class Name {
abstract fun name(): String
open fun name(context: Context) = name()
+1
View File
@@ -1675,6 +1675,7 @@
<string name="select_list_to_filter">Select an option to filter the feed</string>
<string name="feed_group_feeds">Feeds</string>
<string name="feed_group_hashtags">Hashtags</string>
<string name="feed_group_locations">Locations</string>
<string name="feed_group_communities">Communities</string>
<string name="feed_group_lists">Lists</string>
<string name="feed_group_relays">Relays</string>