Class MessageStream
-
- All Implemented Interfaces:
public final class MessageStream
Class to handle interactions with in-app message stream.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
MessageStream.MessageStreamHandler
Generic handler for async calls to the Marigold SDK.
public interface
MessageStream.MessagesHandler
Handler interface for getting Messages for this device.
public interface
MessageStream.MessagesReadHandler
Handler interface for setting messages as read.
public interface
MessageStream.MessageDeletedHandler
Handler interface for deleting a Message.
public interface
MessageStream.OnInAppNotificationDisplayListener
-
Field Summary
Fields Modifier and Type Field Description public final static String
EXTRA_UNREAD_MESSAGE_COUNT
public final static String
EXTRA_MESSAGE_ID
public final static String
EXTRA_MESSAGE_TYPE
-
Constructor Summary
Constructors Constructor Description MessageStream()
-
Method Summary
Modifier and Type Method Description final Unit
getUnreadMessageCount(MessageStream.MessageStreamHandler<Integer> handler)
Asynchronously returns the total number of unread messages in the message stream. final Unit
setUnreadMessageCount(Integer unreadMessageCount)
final Unit
getMessages(MessageStream.MessagesHandler messagesHandler)
Retrieve all Messages visible for this device. final Unit
getMessage(String messageId, MessageStream.MessageStreamHandler<Message> messageHandler)
Retrieves a Message for a given Message ID. final Unit
registerMessageImpression(ImpressionType type, Message message)
Creates an impression for a message for a given interaction type. final Unit
setMessageRead(Message message, MessageStream.MessagesReadHandler handler)
Convenience method for setMessagesRead()
.final Unit
setMessagesRead(List<Message> messages, MessageStream.MessagesReadHandler handler)
Marks all given messages as read and triggers an update broadcast to the unread messages count. final Unit
deleteMessage(Message message, MessageStream.MessageDeletedHandler handler)
Removes a Message from appearing in a device's message stream. final Unit
clearMessages(MessageStream.MessageStreamHandler<Void> handler)
Clear the Message Stream for the device. final Unit
setOnInAppNotificationDisplayListener(MessageStream.OnInAppNotificationDisplayListener listener)
Set the listener to handle In-App notification on display callbacks. final Unit
setInAppOnClickListener(InAppNotificationTappedListener listener)
Set the listener to handle taps on the in-app notification banner final Unit
addMessageReadListener(MessageReadListener listener)
Add a listener to handle when messages are read by the user. final Unit
addUnreadMessageCountListener(UnreadMessageCountListener listener)
Add a listener to handle when the unread message count is updated. -
-
Method Detail
-
getUnreadMessageCount
final Unit getUnreadMessageCount(MessageStream.MessageStreamHandler<Integer> handler)
Asynchronously returns the total number of unread messages in the message stream.
- Parameters:
handler
- The handler that the unread count is passed to
-
setUnreadMessageCount
final Unit setUnreadMessageCount(Integer unreadMessageCount)
-
getMessages
final Unit getMessages(MessageStream.MessagesHandler messagesHandler)
Retrieve all Messages visible for this device.
- Parameters:
messagesHandler
- Handler for retrieving the list of Messages
-
getMessage
final Unit getMessage(String messageId, MessageStream.MessageStreamHandler<Message> messageHandler)
Retrieves a Message for a given Message ID.
- Parameters:
messageId
- The Message IDmessageHandler
- Handler for retrieving the Message
-
registerMessageImpression
final Unit registerMessageImpression(ImpressionType type, Message message)
Creates an impression for a message for a given interaction type.
- Parameters:
type
- The type of impression that is being registeredmessage
- The Message to register the impression for.
-
setMessageRead
final Unit setMessageRead(Message message, MessageStream.MessagesReadHandler handler)
Convenience method for
setMessagesRead()
.- Parameters:
message
- the Message to mark as readhandler
- optional response handler callback for request success or failure.
-
setMessagesRead
final Unit setMessagesRead(List<Message> messages, MessageStream.MessagesReadHandler handler)
Marks all given messages as read and triggers an update broadcast to the unread messages count.
- Parameters:
messages
- a List of Messages to mark as readhandler
- optional response handler callback for request success or failure.
-
deleteMessage
final Unit deleteMessage(Message message, MessageStream.MessageDeletedHandler handler)
Removes a Message from appearing in a device's message stream. Does nothing if
message
is null.- Parameters:
message
- the Message to delete from this device's stream.handler
- optional response handler callback for request success or failure.
-
clearMessages
final Unit clearMessages(MessageStream.MessageStreamHandler<Void> handler)
Clear the Message Stream for the device.
- Parameters:
handler
- callback handler
-
setOnInAppNotificationDisplayListener
final Unit setOnInAppNotificationDisplayListener(MessageStream.OnInAppNotificationDisplayListener listener)
Set the listener to handle In-App notification on display callbacks.
- Parameters:
listener
- In-App notification on display callback listener
-
setInAppOnClickListener
final Unit setInAppOnClickListener(InAppNotificationTappedListener listener)
Set the listener to handle taps on the in-app notification banner
- Parameters:
listener
- Listener to call when an in-app notification is clicked by the user.
-
addMessageReadListener
final Unit addMessageReadListener(MessageReadListener listener)
Add a listener to handle when messages are read by the user.
- Parameters:
listener
- Listener to call when a message is read by the user.
-
addUnreadMessageCountListener
final Unit addUnreadMessageCountListener(UnreadMessageCountListener listener)
Add a listener to handle when the unread message count is updated.
- Parameters:
listener
- Listener to call when the unread message count is updated.
-
-
-
-