Remove unnecessary params for FeedDefinitions
This commit is contained in:
@@ -30,31 +30,8 @@ import com.vitorpamplona.amethyst.model.TopFilter
|
|||||||
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
import com.vitorpamplona.amethyst.ui.navigation.routes.Route
|
||||||
import com.vitorpamplona.amethyst.ui.stringRes
|
import com.vitorpamplona.amethyst.ui.stringRes
|
||||||
import com.vitorpamplona.quartz.experimental.audio.header.AudioHeaderEvent
|
|
||||||
import com.vitorpamplona.quartz.experimental.audio.track.AudioTrackEvent
|
|
||||||
import com.vitorpamplona.quartz.experimental.interactiveStories.InteractiveStoryPrologueEvent
|
|
||||||
import com.vitorpamplona.quartz.experimental.nipsOnNostr.NipTextEvent
|
|
||||||
import com.vitorpamplona.quartz.experimental.zapPolls.PollNoteEvent
|
|
||||||
import com.vitorpamplona.quartz.nip02FollowList.ContactListEvent
|
|
||||||
import com.vitorpamplona.quartz.nip10Notes.TextNoteEvent
|
|
||||||
import com.vitorpamplona.quartz.nip18Reposts.GenericRepostEvent
|
|
||||||
import com.vitorpamplona.quartz.nip18Reposts.RepostEvent
|
|
||||||
import com.vitorpamplona.quartz.nip22Comments.CommentEvent
|
|
||||||
import com.vitorpamplona.quartz.nip23LongContent.LongTextNoteEvent
|
|
||||||
import com.vitorpamplona.quartz.nip51Lists.PinListEvent
|
|
||||||
import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent
|
import com.vitorpamplona.quartz.nip51Lists.followList.FollowListEvent
|
||||||
import com.vitorpamplona.quartz.nip51Lists.muteList.MuteListEvent
|
|
||||||
import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent
|
import com.vitorpamplona.quartz.nip51Lists.peopleList.PeopleListEvent
|
||||||
import com.vitorpamplona.quartz.nip53LiveActivities.chat.LiveActivitiesChatMessageEvent
|
|
||||||
import com.vitorpamplona.quartz.nip53LiveActivities.streaming.LiveActivitiesEvent
|
|
||||||
import com.vitorpamplona.quartz.nip54Wiki.WikiNoteEvent
|
|
||||||
import com.vitorpamplona.quartz.nip64Chess.ChessGameEvent
|
|
||||||
import com.vitorpamplona.quartz.nip64Chess.LiveChessGameChallengeEvent
|
|
||||||
import com.vitorpamplona.quartz.nip64Chess.LiveChessGameEndEvent
|
|
||||||
import com.vitorpamplona.quartz.nip72ModCommunities.approval.CommunityPostApprovalEvent
|
|
||||||
import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent
|
|
||||||
import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent
|
|
||||||
import com.vitorpamplona.quartz.nip99Classifieds.ClassifiedsEvent
|
|
||||||
import com.vitorpamplona.quartz.utils.Log
|
import com.vitorpamplona.quartz.utils.Log
|
||||||
import kotlinx.collections.immutable.persistentListOf
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
@@ -78,66 +55,42 @@ class TopNavFilterState(
|
|||||||
PeopleListOutBoxFeedDefinition(
|
PeopleListOutBoxFeedDefinition(
|
||||||
code = TopFilter.AllFollows,
|
code = TopFilter.AllFollows,
|
||||||
name = ResourceName(R.string.follow_list_kind3follows),
|
name = ResourceName(R.string.follow_list_kind3follows),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
unpackList = listOf(ContactListEvent.blockListFor(account.signer.pubKey)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val userFollows =
|
val userFollows =
|
||||||
PeopleListOutBoxFeedDefinition(
|
PeopleListOutBoxFeedDefinition(
|
||||||
code = TopFilter.AllUserFollows,
|
code = TopFilter.AllUserFollows,
|
||||||
name = ResourceName(R.string.follow_list_kind3follows_users_only),
|
name = ResourceName(R.string.follow_list_kind3follows_users_only),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
unpackList = listOf(ContactListEvent.blockListFor(account.signer.pubKey)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val kind3Follows =
|
val kind3Follows =
|
||||||
PeopleListOutBoxFeedDefinition(
|
PeopleListOutBoxFeedDefinition(
|
||||||
code = TopFilter.DefaultFollows,
|
code = TopFilter.DefaultFollows,
|
||||||
name = ResourceName(R.string.follow_list_kind3_follows_users_only),
|
name = ResourceName(R.string.follow_list_kind3_follows_users_only),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
unpackList = listOf(ContactListEvent.blockListFor(account.signer.pubKey)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val globalFollow =
|
val globalFollow =
|
||||||
GlobalFeedDefinition(
|
GlobalFeedDefinition(
|
||||||
code = TopFilter.Global,
|
code = TopFilter.Global,
|
||||||
name = ResourceName(R.string.follow_list_global),
|
name = ResourceName(R.string.follow_list_global),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val aroundMe =
|
val aroundMe =
|
||||||
AroundMeFeedDefinition(
|
AroundMeFeedDefinition(
|
||||||
code = TopFilter.AroundMe,
|
code = TopFilter.AroundMe,
|
||||||
name = ResourceName(R.string.follow_list_aroundme),
|
name = ResourceName(R.string.follow_list_aroundme),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val muteListFollow =
|
val muteListFollow =
|
||||||
PeopleListOutBoxFeedDefinition(
|
PeopleListOutBoxFeedDefinition(
|
||||||
code = TopFilter.MuteList(account.muteList.getMuteListAddress()),
|
code = TopFilter.MuteList(account.muteList.getMuteListAddress()),
|
||||||
name = ResourceName(R.string.follow_list_mute_list),
|
name = ResourceName(R.string.follow_list_mute_list),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
unpackList = listOf(MuteListEvent.blockListFor(account.userProfile().pubkeyHex)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val chessFollow =
|
val chessFollow =
|
||||||
GlobalFeedDefinition(
|
GlobalFeedDefinition(
|
||||||
code = TopFilter.Chess,
|
code = TopFilter.Chess,
|
||||||
name = ResourceName(R.string.follow_list_chess),
|
name = ResourceName(R.string.follow_list_chess),
|
||||||
type = CodeNameType.HARDCODED,
|
|
||||||
kinds =
|
|
||||||
listOf(
|
|
||||||
ChessGameEvent.KIND, // Completed games (Kind 64)
|
|
||||||
LiveChessGameChallengeEvent.KIND, // Challenges (Kind 30064)
|
|
||||||
LiveChessGameEndEvent.KIND, // Game endings (Kind 30067)
|
|
||||||
// Note: LiveChessMoveEvent (Kind 30066) intentionally excluded - too noisy
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val defaultLists = persistentListOf(allFollows, userFollows, kind3Follows, aroundMe, globalFollow, muteListFollow)
|
val defaultLists = persistentListOf(allFollows, userFollows, kind3Follows, aroundMe, globalFollow, muteListFollow)
|
||||||
@@ -151,9 +104,6 @@ class TopNavFilterState(
|
|||||||
PeopleListOutBoxFeedDefinition(
|
PeopleListOutBoxFeedDefinition(
|
||||||
TopFilter.PeopleList(it.address),
|
TopFilter.PeopleList(it.address),
|
||||||
PeopleListName(it),
|
PeopleListName(it),
|
||||||
CodeNameType.PEOPLE_LIST,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
listOf(it.idHex),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,9 +112,6 @@ class TopNavFilterState(
|
|||||||
PeopleListOutBoxFeedDefinition(
|
PeopleListOutBoxFeedDefinition(
|
||||||
TopFilter.PeopleList(it.address),
|
TopFilter.PeopleList(it.address),
|
||||||
PeopleListName(it),
|
PeopleListName(it),
|
||||||
CodeNameType.PEOPLE_LIST,
|
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
listOf(it.idHex),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,10 +142,7 @@ class TopNavFilterState(
|
|||||||
TagFeedDefinition(
|
TagFeedDefinition(
|
||||||
TopFilter.Hashtag(it),
|
TopFilter.Hashtag(it),
|
||||||
HashtagName(it),
|
HashtagName(it),
|
||||||
CodeNameType.ROUTE,
|
|
||||||
route = Route.Hashtag(it),
|
route = Route.Hashtag(it),
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
tTags = listOf(it),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,10 +151,7 @@ class TopNavFilterState(
|
|||||||
TagFeedDefinition(
|
TagFeedDefinition(
|
||||||
TopFilter.Geohash(it),
|
TopFilter.Geohash(it),
|
||||||
GeoHashName(it),
|
GeoHashName(it),
|
||||||
CodeNameType.ROUTE,
|
|
||||||
route = Route.Geohash(it),
|
route = Route.Geohash(it),
|
||||||
kinds = DEFAULT_FEED_KINDS,
|
|
||||||
gTags = listOf(it),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,10 +160,7 @@ class TopNavFilterState(
|
|||||||
TagFeedDefinition(
|
TagFeedDefinition(
|
||||||
TopFilter.Community(communityNote.address),
|
TopFilter.Community(communityNote.address),
|
||||||
CommunityName(communityNote),
|
CommunityName(communityNote),
|
||||||
CodeNameType.ROUTE,
|
|
||||||
route = Route.Community(communityNote.address.kind, communityNote.address.pubKeyHex, communityNote.address.dTag),
|
route = Route.Community(communityNote.address.kind, communityNote.address.pubKeyHex, communityNote.address.dTag),
|
||||||
kinds = DEFAULT_COMMUNITY_FEEDS,
|
|
||||||
aTags = listOf(communityNote.idHex),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,12 +230,6 @@ class TopNavFilterState(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class CodeNameType {
|
|
||||||
HARDCODED,
|
|
||||||
PEOPLE_LIST,
|
|
||||||
ROUTE,
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class Name {
|
abstract class Name {
|
||||||
abstract fun name(): String
|
abstract fun name(): String
|
||||||
|
|
||||||
@@ -349,7 +281,6 @@ class CommunityName(
|
|||||||
abstract class FeedDefinition(
|
abstract class FeedDefinition(
|
||||||
val code: TopFilter,
|
val code: TopFilter,
|
||||||
val name: Name,
|
val name: Name,
|
||||||
val type: CodeNameType,
|
|
||||||
val route: Route?,
|
val route: Route?,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -357,74 +288,23 @@ abstract class FeedDefinition(
|
|||||||
class GlobalFeedDefinition(
|
class GlobalFeedDefinition(
|
||||||
code: TopFilter,
|
code: TopFilter,
|
||||||
name: Name,
|
name: Name,
|
||||||
type: CodeNameType,
|
) : FeedDefinition(code, name, null)
|
||||||
val kinds: List<Int>,
|
|
||||||
) : FeedDefinition(code, name, type, null)
|
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
class TagFeedDefinition(
|
class TagFeedDefinition(
|
||||||
code: TopFilter,
|
code: TopFilter,
|
||||||
name: Name,
|
name: Name,
|
||||||
type: CodeNameType,
|
|
||||||
route: Route?,
|
route: Route?,
|
||||||
val kinds: List<Int>,
|
) : FeedDefinition(code, name, route)
|
||||||
val pTags: List<String>? = null,
|
|
||||||
val eTags: List<String>? = null,
|
|
||||||
val aTags: List<String>? = null,
|
|
||||||
val tTags: List<String>? = null,
|
|
||||||
val gTags: List<String>? = null,
|
|
||||||
) : FeedDefinition(code, name, type, route)
|
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
class AroundMeFeedDefinition(
|
class AroundMeFeedDefinition(
|
||||||
code: TopFilter,
|
code: TopFilter,
|
||||||
name: Name,
|
name: Name,
|
||||||
type: CodeNameType,
|
) : FeedDefinition(code, name, null)
|
||||||
val kinds: List<Int>,
|
|
||||||
) : FeedDefinition(code, name, type, null)
|
|
||||||
|
|
||||||
@Immutable
|
@Immutable
|
||||||
class PeopleListOutBoxFeedDefinition(
|
class PeopleListOutBoxFeedDefinition(
|
||||||
code: TopFilter,
|
code: TopFilter,
|
||||||
name: Name,
|
name: Name,
|
||||||
type: CodeNameType,
|
) : FeedDefinition(code, name, null)
|
||||||
val kinds: List<Int>,
|
|
||||||
val unpackList: List<String>,
|
|
||||||
) : FeedDefinition(code, name, type, null)
|
|
||||||
|
|
||||||
val DEFAULT_FEED_KINDS =
|
|
||||||
listOf(
|
|
||||||
TextNoteEvent.KIND,
|
|
||||||
RepostEvent.KIND,
|
|
||||||
GenericRepostEvent.KIND,
|
|
||||||
ClassifiedsEvent.KIND,
|
|
||||||
LongTextNoteEvent.KIND,
|
|
||||||
PollNoteEvent.KIND,
|
|
||||||
PollEvent.KIND,
|
|
||||||
HighlightEvent.KIND,
|
|
||||||
AudioTrackEvent.KIND,
|
|
||||||
AudioHeaderEvent.KIND,
|
|
||||||
PinListEvent.KIND,
|
|
||||||
LiveActivitiesChatMessageEvent.KIND,
|
|
||||||
LiveActivitiesEvent.KIND,
|
|
||||||
WikiNoteEvent.KIND,
|
|
||||||
NipTextEvent.KIND,
|
|
||||||
InteractiveStoryPrologueEvent.KIND,
|
|
||||||
)
|
|
||||||
|
|
||||||
val DEFAULT_COMMUNITY_FEEDS =
|
|
||||||
listOf(
|
|
||||||
TextNoteEvent.KIND,
|
|
||||||
CommentEvent.KIND,
|
|
||||||
LongTextNoteEvent.KIND,
|
|
||||||
ClassifiedsEvent.KIND,
|
|
||||||
HighlightEvent.KIND,
|
|
||||||
AudioHeaderEvent.KIND,
|
|
||||||
AudioTrackEvent.KIND,
|
|
||||||
PollEvent.KIND,
|
|
||||||
PinListEvent.KIND,
|
|
||||||
WikiNoteEvent.KIND,
|
|
||||||
NipTextEvent.KIND,
|
|
||||||
CommunityPostApprovalEvent.KIND,
|
|
||||||
InteractiveStoryPrologueEvent.KIND,
|
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user