PacketRepository

Repository interface for managing mesh packets and message history.

This component provides methods for persisting received packets, querying message history, tracking unread counts, and managing contact-specific settings. It supports both reactive (Flow) and one-shot (suspend) queries.

Functions

Link copied to clipboard
abstract suspend fun clearAllUnreadCounts()

Clears the unread status for all messages across all conversations.

Link copied to clipboard
abstract suspend fun clearPacketDB()

Clears all packet and message history from the database.

Link copied to clipboard
abstract suspend fun clearUnreadCount(contact: String, timestamp: Long)

Clears the unread status for messages in a conversation up to the given timestamp.

Link copied to clipboard
abstract suspend fun deleteContacts(contactList: List<String>)

Deletes all messages and settings for the given contacts.

Link copied to clipboard
abstract suspend fun deleteMessages(uuidList: List<Long>)

Deletes messages by their database UUIDs.

Link copied to clipboard
abstract suspend fun deleteWaypoint(id: Int)

Deletes a waypoint by its ID.

Link copied to clipboard
abstract suspend fun findPacketsWithId(packetId: Int): List<ERROR CLASS: Symbol not found for DataPacket>

Finds all packets matching a specific packet ID.

Link copied to clipboard
abstract suspend fun findReactionsWithId(packetId: Int): List<ERROR CLASS: Symbol not found for Reaction>

Finds all reactions associated with a specific packet ID.

Link copied to clipboard
abstract fun getContacts(): ERROR CLASS: Symbol not found for Flow<kotlin/collections/Map<kotlin/String, ERROR CLASS: Symbol not found for DataPacket>>

Reactive flow of all conversation contacts, keyed by their contact identifier.

Link copied to clipboard
abstract fun getContactSettings(): ERROR CLASS: Symbol not found for Flow<kotlin/collections/Map<kotlin/String, ERROR CLASS: Symbol not found for ContactSettings>>

Reactive flow of all contact settings (e.g., mute status).

abstract suspend fun getContactSettings(contact: String): ERROR CLASS: Symbol not found for ContactSettings

Returns the settings for a specific contact.

Link copied to clipboard
abstract fun getContactsPaged(): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for PagingData<ERROR CLASS: Symbol not found for DataPacket>>

Reactive paged flow of conversation contacts.

Link copied to clipboard
abstract suspend fun getFilteredCount(contactKey: String): Int

Returns the total count of filtered messages for a contact.

Link copied to clipboard
abstract fun getFilteredCountFlow(contactKey: String): ERROR CLASS: Symbol not found for Flow<kotlin/Int>

Reactive flow of the number of filtered messages for a contact.

Link copied to clipboard
abstract fun getFirstUnreadMessageUuid(contact: String): ERROR CLASS: Symbol not found for Flow<kotlin/Long?>

Reactive flow of the UUID of the first unread message in a conversation.

Link copied to clipboard
abstract suspend fun getMessageCount(contact: String): Int

Returns the total number of messages in a conversation.

Link copied to clipboard
abstract suspend fun getMessagesFrom(contact: String, limit: Int? = null, includeFiltered: Boolean = true, getNode: suspend (String?) -> ERROR CLASS: Symbol not found for Node): ERROR CLASS: Symbol not found for Flow<kotlin/collections/List<ERROR CLASS: Symbol not found for Message>>

Returns a reactive flow of messages for a conversation.

Link copied to clipboard
abstract fun getMessagesFromPaged(contact: String, getNode: suspend (String?) -> ERROR CLASS: Symbol not found for Node): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for PagingData<ERROR CLASS: Symbol not found for Message>>

Returns a paged flow of messages for a conversation.

abstract fun getMessagesFromPaged(contactKey: String, includeFiltered: Boolean, getNode: suspend (String?) -> ERROR CLASS: Symbol not found for Node): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for PagingData<ERROR CLASS: Symbol not found for Message>>

Returns a paged flow of messages for a conversation, with filtering options.

Link copied to clipboard
abstract suspend fun getPacketById(id: Int): ERROR CLASS: Symbol not found for DataPacket??

Returns a packet by its internal database ID.

Link copied to clipboard
abstract suspend fun getPacketByPacketId(packetId: Int): ERROR CLASS: Symbol not found for DataPacket??

Returns a packet by its mesh-layer packet ID.

Link copied to clipboard
abstract suspend fun getQueuedPackets(): List<ERROR CLASS: Symbol not found for DataPacket>?

Returns all packets currently queued for transmission.

Link copied to clipboard
abstract suspend fun getReactionByPacketId(packetId: Int): ERROR CLASS: Symbol not found for Reaction??

Returns a reaction associated with a specific packet ID.

Link copied to clipboard
abstract suspend fun getUnreadCount(contact: String): Int

Returns the count of unread messages in a conversation.

Link copied to clipboard
abstract fun getUnreadCountFlow(contact: String): ERROR CLASS: Symbol not found for Flow<kotlin/Int>

Reactive flow of the unread message count in a conversation.

Link copied to clipboard
abstract fun getUnreadCountTotal(): ERROR CLASS: Symbol not found for Flow<kotlin/Int>

Reactive flow of the total unread message count across all conversations.

Link copied to clipboard
abstract fun getWaypoints(): ERROR CLASS: Symbol not found for Flow<kotlin/collections/List<ERROR CLASS: Symbol not found for DataPacket>>

Reactive flow of all persisted waypoints (GPS locations).

Link copied to clipboard
abstract fun hasUnreadMessages(contact: String): ERROR CLASS: Symbol not found for Flow<kotlin/Boolean>

Reactive flow indicating whether a conversation has any unread messages.

Link copied to clipboard
abstract suspend fun insert(packet: ERROR CLASS: Symbol not found for DataPacket, myNodeNum: Int, contactKey: String, receivedTime: Long, read: Boolean = true, filtered: Boolean = false)

Inserts a packet into the database.

Link copied to clipboard
abstract suspend fun insertReaction(reaction: ERROR CLASS: Symbol not found for Reaction, myNodeNum: Int)

Persists a message reaction (emoji).

Link copied to clipboard
abstract suspend fun migrateChannelsByPSK(oldSettings: List<ERROR CLASS: Symbol not found for ChannelSettings>, newSettings: List<ERROR CLASS: Symbol not found for ChannelSettings>)

Migrates channel-specific message history when encryption keys change.

Link copied to clipboard
abstract suspend fun savePacket(myNodeNum: Int, contactKey: String, packet: ERROR CLASS: Symbol not found for DataPacket, receivedTime: Long, read: Boolean = true, filtered: Boolean = false)

Persists a packet in the database.

Link copied to clipboard
abstract suspend fun setContactFilteringDisabled(contactKey: String, disabled: Boolean)

Disables or enables message filtering for a specific contact.

Link copied to clipboard
abstract suspend fun setMuteUntil(contacts: List<String>, until: Long)

Mutes the given contacts until the specified timestamp.

Link copied to clipboard
abstract suspend fun update(packet: ERROR CLASS: Symbol not found for DataPacket)

Updates an existing packet in the database.

Link copied to clipboard
abstract suspend fun updateFilteredBySender(senderId: String, filtered: Boolean)

Marks all messages from a specific sender as filtered or unfiltered.

Link copied to clipboard
abstract suspend fun updateLastReadMessage(contact: String, messageUuid: Long, lastReadTimestamp: Long)

Updates the identifier of the last read message in a conversation.

Link copied to clipboard
abstract suspend fun updateMessageId(d: ERROR CLASS: Symbol not found for DataPacket, id: Int)

Updates the identifier of a persisted packet.

Link copied to clipboard
abstract suspend fun updateMessageStatus(d: ERROR CLASS: Symbol not found for DataPacket, m: ERROR CLASS: Symbol not found for MessageStatus)

Updates the transmission status of a packet.

Link copied to clipboard
abstract suspend fun updateReaction(reaction: ERROR CLASS: Symbol not found for Reaction)

Updates an existing reaction.

Link copied to clipboard
abstract suspend fun updateSFPPStatus(packetId: Int, from: Int, to: Int, hash: ByteArray, status: ERROR CLASS: Symbol not found for MessageStatus, rxTime: Long, myNodeNum: Int?)

Updates the Store-and-Forward PlusPlus (SFPP) status for packets.

Link copied to clipboard
abstract suspend fun updateSFPPStatusByHash(hash: ByteArray, status: ERROR CLASS: Symbol not found for MessageStatus, rxTime: Long)

Updates the SFPP status of packets matching the given commit hash.