-
Notifications
You must be signed in to change notification settings - Fork 37
ListStore Guide: ListDescriptor (WIP)
This guide is currently WIP and its contents might change significantly while the rest of the guide is fleshed out. If you have any questions/feedback, please reach out to @oguzkocer.
Table of Contents // TODO: Add links for each page
- Introduction
- Most important component: The
ListDescriptor
- How to consume an existing list
- How to implement a new list
- Sectioning (link added in consumption)
- Consider this! (Common gotchas)
- Internals
This interface is how we define a list and what all of ListStore
is built on. Here we can add all kinds of information about a list, such as which site it belongs to, what filters it has, its order and whatever else that's needed for a feature. Here is a simple example:
class PostListDescriptor(
val site: SiteModel,
val statusList: List<PostStatus>,
val order: ListOrder,
val orderBy: PostListOrderBy,
listConfig: ListConfig
) : ListDescriptor
Check out ListConfig
to configure things like initial load size, DB page size, network page size and prefetch distance.
Note: The actual PostListDescriptor
is slightly more complicated due to XML-RPC & REST API differences.
While working with an existing ListDescriptor
, understanding this much should be enough. However, in order to implement a new list or modify an existing one, it's crucial to know how to implement a ListDescriptor
. This is covered in its documentation and it's not duplicated in this guide to avoid syncing issues. So, please make sure to check it out before implementing a new list or changing an existing one. Specifically, if you don't set your uniqueIdentifier
and typeIdentifier
correctly, a lot of weird things might happen, so be absolutely sure you understand how it works and ask for help otherwise.
// TODO: Add more information as necessary. Feedback required!