-
public final class ChannelUtilsKt
-
-
Method Summary
Modifier and Type Method Description final static MessagegetLastMessage(Channel $self, User currentUser)Returns channel's last regular or system message if exists. final static List<Date>getReadStatuses(Channel $self, User userToIgnore)Filters the read status of each person other than the target user. final static BooleanisDistinct(Channel $self)Checks if the channel is distinct. final static BooleanisOneToOne(Channel $self, User currentUser)Checks if the channel is a direct conversation between the current user and some other user. final static StringgetMembersStatusText(Channel $self, Context context, User currentUser, UserPresence userPresence)Returns a string describing the member status of the channel: either a member count for a group channel or the last seen text for a direct one-to-one conversation with the current user. final static List<User>getOtherUsers(Channel $self, User currentUser)Returns a list of users that are members of the channel excluding the currently logged in user. -
-
Method Detail
-
getLastMessage
final static Message getLastMessage(Channel $self, User currentUser)
Returns channel's last regular or system message if exists. Deleted and silent messages, as well as messages from shadow-banned users, are not taken into account.
-
getReadStatuses
final static List<Date> getReadStatuses(Channel $self, User userToIgnore)
Filters the read status of each person other than the target user.
- Parameters:
userToIgnore- The user whose message it is.
-
isDistinct
final static Boolean isDistinct(Channel $self)
Checks if the channel is distinct.
A distinct channel is a channel created without ID based on members. Internally the server creates a CID which starts with "!members" prefix and is unique for this particular group of users.
-
isOneToOne
final static Boolean isOneToOne(Channel $self, User currentUser)
Checks if the channel is a direct conversation between the current user and some other user.
A one-to-one chat is basically a corner case of a distinct channel with only 2 members.
- Parameters:
currentUser- The currently logged in user.
-
getMembersStatusText
final static String getMembersStatusText(Channel $self, Context context, User currentUser, UserPresence userPresence)
Returns a string describing the member status of the channel: either a member count for a group channel or the last seen text for a direct one-to-one conversation with the current user.
- Parameters:
context- The context to load string resources.currentUser- The currently logged in user.userPresence- The user presence display configuration.
-
getOtherUsers
final static List<User> getOtherUsers(Channel $self, User currentUser)
Returns a list of users that are members of the channel excluding the currently logged in user.
- Parameters:
currentUser- The currently logged in user.
-
-
-
-