MessagingService

Service responsible for receiving and sending messages.

This is the entry service for messaging within the TomTom Digital Cockpit platform. It provides an aggregated view of all available MessagingProviderServices.

Messages are organized in conversations. All messages from the same contact, that are received through the same messaging application, are part of a single conversation. If the conversation has unread messages, it will be visible through the allConversations map.

Note: Only unread messages are available. Once a message has been marked as read, it will be removed from this service.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

All messaging conversations.

Link copied to clipboard

All the message types that the messaging services handles.

Functions

Link copied to clipboard
abstract suspend fun getMessage(messageId: Uid<Message>): Message?

Get the message with the specified messageId, or null if that message is not available.

Link copied to clipboard
abstract suspend fun getOrCreateConversationId(conversationContacts: Set<ConversationContact>, messageType: MessageType, source: ConversationSource?): Uid<Conversation>?

Returns the ID of the conversation between the user and conversationContacts that contains messages of type messageType and originates from the source. If the conversation does not exist, it tries to create a new one and returns its ID. If there is no messaging provider available for the messageType, or no conversation was available and the service provider does not support creating a new conversation, it returns null.

Link copied to clipboard
abstract suspend fun markConversationReadUpToAndIncluding(conversationId: Uid<Conversation>, messageId: Uid<Message>)

Mark the message with messageId, and all messages that were received before it in the same conversation, as read.

Link copied to clipboard
abstract suspend fun reply(reply: ConversationReply): Boolean

Replies with the specified ConversationReply to the conversation with the specified ConversationReply.id.

Link copied to clipboard
abstract suspend fun updateMessageState(messageId: Uid<Message>, newState: MessageState)

Updates the state of the message with the specified messageId to the specified newState.