Skip to content

ListStore Guide: ListDescriptor (WIP)

Oguz Kocer edited this page Jan 22, 2020 · 2 revisions

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

  1. Introduction
  2. Most important component: The ListDescriptor
  3. How to consume an existing list
  4. How to implement a new list
  5. Sectioning (link added in consumption)
  6. Consider this! (Common gotchas)
  7. 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!