MessagingProviderHelper

Helper class that provides all common functionality that is needed by messaging providers.

For example a messaging provider service can be initialized like this:

class StockSmsService(
iviServiceHostContext: IviServiceHostContext,
serviceIdProvider: IviDiscoverableServiceIdProvider
) : MessagingProviderServiceBase(iviServiceHostContext, serviceIdProvider) {
// ...

private val messagingProviderHelper = MessagingProviderHelper().also {
conversationsForProvider = it.conversations
messageTypesForProvider = it.messageTypes
it.registerSendMessageCallback { conversation, message ->
sendMessage(conversation, message)
}
}

// ...
}

Constructors

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard

The message types supported by the provider.

Functions

Link copied to clipboard

Adds or updates the specified conversations.

Link copied to clipboard

Adds or updates all the specified messages.

Link copied to clipboard

Adds or updates the specified conversation. Note that Conversation.unreadMessages will be ignored. Messages can only be added by using addOrUpdateMessage.

Link copied to clipboard

Adds or updates the specified message.

Link copied to clipboard

Finds a conversation originating from the source that has the specified contacts and the specified messageType. If source is null, the source field is ignored.

Link copied to clipboard
fun findMessageById(messageId: Uid<Message>): Message?

Finds the message with the specified messageId in all conversations.

Link copied to clipboard
fun findOrCreateConversation(contacts: Set<ConversationContact>, messageType: MessageType, source: ConversationSource?, applicationDisplayName: StringResolver, conversationCapabilities: EnumSet<ConversationCapability>): Conversation

Finds a conversation originating from the source that has the specified contacts and the specified messageType. Otherwise, creates and adds a new conversation with the specified parameters.

Link copied to clipboard

Marks all messages up to and including the message with the specified messageId as read for the conversation with the specified conversationId.

Link copied to clipboard

Registers the specified callback to be called when a message is added with the MessageState.OUTGOING_QUEUED state. This will replace a previously registered callback.

Link copied to clipboard
fun removeAllMessages(conversationId: Uid<Conversation>, messageIds: Collection<Uid<Message>>)

Removes all messages with specified messageIds from the conversation with the specified conversationId.

Link copied to clipboard

Removes the conversation with the specified conversationId.

Link copied to clipboard

Retains only the conversations with the specified conversationIds. Removes the remaining conversations.

Link copied to clipboard

Retains only the messages with the specified messageIds. Removes the remaining messages.

Link copied to clipboard
fun setMessageTypeEnabled(messageType: MessageType, enabled: Boolean)

Enables or disables the specified messageType according to the specified enabled parameter.