Inbox

class Inbox

The inbox provides access to the device's local inbox data. Modifications (e.g., deletions or mark read) will be sent to the Airship server the next time the inbox is synchronized.

Types

Link copied to clipboard
fun interface FetchMessagesCallback

A callback used to be notified when refreshing messages.

Properties

Link copied to clipboard
val user: User

The User.

Functions

Link copied to clipboard
fun addListener(listener: InboxListener)

Subscribe a listener for inbox update event callbacks.

Link copied to clipboard

Mark all Messages deleted.

Link copied to clipboard
fun deleteMessages(vararg messageIds: String)
fun deleteMessages(messageIds: Set<String>)

Mark Messages deleted.

Link copied to clipboard
suspend fun fetchMessages(): Boolean

Suspending function to fetch the latest inbox changes from Airship.

fun fetchMessages(looper: Looper? = null, callback: Inbox.FetchMessagesCallback? = null): Cancelable

Fetches the latest inbox changes from Airship.

Link copied to clipboard
suspend fun getCount(): Int

The total message count.

Link copied to clipboard

A PendingResult of the total message count.

Link copied to clipboard
suspend fun getMessage(messageId: String?): Message?

Get the Message with the corresponding message ID.

Link copied to clipboard
suspend fun getMessageByUrl(messageUrl: String?): Message?

Get the Message with the corresponding message body URL.

Link copied to clipboard

Get the Message with the corresponding message body URL as a PendingResult.

Link copied to clipboard
suspend fun getMessageIds(): Set<String>

All the message IDs in the Inbox.

Link copied to clipboard

A PendingResult of all the message IDs in the Inbox.

Link copied to clipboard

Get the Message with the corresponding message ID as a PendingResult.

Link copied to clipboard
suspend fun getMessages(predicate: Predicate<Message>? = null): List<Message>

Gets a list of RichPushMessages, filtered by the provided predicate, and sorted by descending sent-at date.

Link copied to clipboard
fun getMessagesFlow(predicate: Predicate<Message>? = null): Flow<List<Message>>

Subscribes to the list of messages as a flow. The flow will emit the current list of messages, filtered by the provided predicate, and sorted by descending sent-at date, and will emit new lists whenever the inbox is updated.

Link copied to clipboard

Gets a list of RichPushMessages as a PendingResult, filtered by the provided predicate, and sorted by descending sent-at date.

Link copied to clipboard
suspend fun getReadCount(): Int

The number of read messages currently in the Inbox.

Link copied to clipboard

A PendingResult of the read message count.

Link copied to clipboard
suspend fun getReadMessages(predicate: Predicate<Message>? = null): List<Message>

Gets a list of read RichPushMessages, filtered by the provided predicate. Sorted by descending sent-at date.

Link copied to clipboard

Gets a list of read RichPushMessages as a PendingResult, filtered by the provided predicate, and sorted by descending sent-at date.

Link copied to clipboard
suspend fun getUnreadCount(): Int

The number of unread messages currently in the Inbox.

Link copied to clipboard

A PendingResult of the unread message count.

Link copied to clipboard
suspend fun getUnreadMessages(predicate: Predicate<Message>? = null): List<Message>

Gets a list of unread RichPushMessages, filtered by the provided predicate, and sorted by descending sent-at date.

Link copied to clipboard
fun getUnreadMessagesFlow(predicate: Predicate<Message>? = null): Flow<List<Message>>

Subscribes to the list of unread messages as a flow. The flow will emit the current list of unread messages, filtered by the provided predicate, and sorted by descending sent-at date, and will emit new lists whenever the inbox is updated.

Link copied to clipboard

Gets a list of unread RichPushMessages as a PendingResult, filtered by the provided predicate, and sorted by descending sent-at date.

Link copied to clipboard
fun markMessagesRead(vararg messageIds: String)
fun markMessagesRead(messageIds: Set<String>)

Mark Messages read in bulk.

Link copied to clipboard
fun markMessagesUnread(vararg messageIds: String)
fun markMessagesUnread(messageIds: Set<String>)

Mark Messages unread in bulk.

Link copied to clipboard

Unsubscribe a listener for inbox update event callbacks.