DocumentModel

class DocumentModel(val documentStore: DocumentStore, val documentTypeRepository: DocumentTypeRepository?, val documentOrderKey: String = "org.multipaz.DocumentModel.orderingKey")

Model that loads documents from a DocumentStore and keeps them updated.

This model exposes a StateFlow of all documents as DocumentInfo and listens to live updates from the store. If a Document has no card art the model creates a default card art using Branding.renderFallbackCardArt. The model also maintains a persistent order of documents and applications can call e.g. setDocumentPosition to change the order.

Parameters

documentStore

the DocumentStore which manages Document and Credential instances.

documentTypeRepository

a DocumentTypeRepository with information about document types or null.

documentOrderKey

the name of the key to use for storing the document order in the Tags object associated with documentStore.

Constructors

Link copied to clipboard
constructor(documentStore: DocumentStore, documentTypeRepository: DocumentTypeRepository?, documentOrderKey: String = "org.multipaz.DocumentModel.orderingKey")

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A list of DocumentInfo for the documents in documentStore.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
suspend fun setDocumentPosition(documentInfo: DocumentInfo, position: Int)

Sets the position of a document.