Class MessageStreamExtensionsKt
-
- All Implemented Interfaces:
public final class MessageStreamExtensionsKt
-
-
Field Summary
Fields Modifier and Type Field Description private final static SharedFlow<Pair<Context, Message>>
messageReadFlow
private final static SharedFlow<Pair<Context, Integer>>
unreadMessageCountFlow
-
Method Summary
Modifier and Type Method Description final SharedFlow<Pair<Context, Message>>
getMessageReadFlow()
final SharedFlow<Pair<Context, Integer>>
getUnreadMessageCountFlow()
final static ArrayList<Message>
getMessages(MessageStream $self)
Retrieve all Messages visible for this device. final static Result<ArrayList<Message>>
getMessagesResult(MessageStream $self)
Retrieve all Messages visible for this device. final static Message
getMessage(MessageStream $self, String messageId)
Retrieves a Message for a given Message ID. final static Result<Message>
getMessageResult(MessageStream $self, String messageId)
Retrieves a Message for a given Message ID. final static Unit
deleteMessage(MessageStream $self, Message message)
Removes a Message from appearing in a device's message stream. final static Result<Unit>
deleteMessageResult(MessageStream $self, Message message)
Removes a Message from appearing in a device's message stream. final static Unit
clearMessages(MessageStream $self)
Clear the Message Stream for the device. final static Result<Unit>
clearMessagesResult(MessageStream $self)
Clear the Message Stream for the device. final static Integer
getUnreadMessageCount(MessageStream $self)
Get the total number of unread messages in the message stream. final static Result<Integer>
getUnreadMessageCountResult(MessageStream $self)
Get the total number of unread messages in the message stream. final static Unit
setMessageRead(MessageStream $self, Message message)
Convenience method for setMessagesRead. final static Result<Unit>
setMessageReadResult(MessageStream $self, Message message)
Convenience method for setMessagesRead. final static Unit
setMessagesRead(MessageStream $self, List<Message> messages)
Marks all given messages as read and triggers an update broadcast to the unread messages count. final static Result<Unit>
setMessagesReadResult(MessageStream $self, List<Message> messages)
Marks all given messages as read and triggers an update broadcast to the unread messages count. -
-
Method Detail
-
getMessageReadFlow
final SharedFlow<Pair<Context, Message>> getMessageReadFlow()
-
getUnreadMessageCountFlow
final SharedFlow<Pair<Context, Integer>> getUnreadMessageCountFlow()
-
getMessages
final static ArrayList<Message> getMessages(MessageStream $self)
Retrieve all Messages visible for this device.
- Returns:
ArrayList of Messages
-
getMessagesResult
final static Result<ArrayList<Message>> getMessagesResult(MessageStream $self)
Retrieve all Messages visible for this device.
-
getMessage
final static Message getMessage(MessageStream $self, String messageId)
Retrieves a Message for a given Message ID.
- Parameters:
messageId
- The Message ID- Returns:
The Message matching the provided ID
-
getMessageResult
final static Result<Message> getMessageResult(MessageStream $self, String messageId)
Retrieves a Message for a given Message ID.
-
deleteMessage
final static Unit deleteMessage(MessageStream $self, Message message)
Removes a Message from appearing in a device's message stream.
- Parameters:
message
- the Message to delete from this device's stream.
-
deleteMessageResult
final static Result<Unit> deleteMessageResult(MessageStream $self, Message message)
Removes a Message from appearing in a device's message stream.
- Parameters:
message
- the Message to delete from this device's stream.- Returns:
Result representing the outcome of the request
-
clearMessages
final static Unit clearMessages(MessageStream $self)
Clear the Message Stream for the device.
-
clearMessagesResult
final static Result<Unit> clearMessagesResult(MessageStream $self)
Clear the Message Stream for the device.
- Returns:
Result representing the outcome of the request
-
getUnreadMessageCount
final static Integer getUnreadMessageCount(MessageStream $self)
Get the total number of unread messages in the message stream.
- Returns:
Int representing unread message count.
-
getUnreadMessageCountResult
final static Result<Integer> getUnreadMessageCountResult(MessageStream $self)
Get the total number of unread messages in the message stream.
- Returns:
Result containing either the unread count Int or an error.
-
setMessageRead
final static Unit setMessageRead(MessageStream $self, Message message)
Convenience method for setMessagesRead.
- Parameters:
message
- the Message to mark as read- Returns:
The Message matching the provided ID
-
setMessageReadResult
final static Result<Unit> setMessageReadResult(MessageStream $self, Message message)
Convenience method for setMessagesRead.
-
setMessagesRead
final static Unit setMessagesRead(MessageStream $self, List<Message> messages)
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 read
-
setMessagesReadResult
final static Result<Unit> setMessagesReadResult(MessageStream $self, List<Message> messages)
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 read- Returns:
Result representing the outcome of the request
-
-
-
-