CometChatUsersWithMessages
is a Composite Component that seamlessly merges the functionalities of both the Users and Messages modules. It empowers users to effortlessly navigate to any individual’s chat window by simply clicking on their respective list item in the user list.
Additionally, CometChatUsersWithMessages
inherits and encompasses all attributes available within the CometChatUsers
module, ensuring a comprehensive user experience.
Components | Description |
---|---|
Users | Users serves as a standalone component designed to establish a screen displaying a list of users , providing them with the capability to search for specific individuals. This component operates as a container, inheriting from CometChatListBase , and serves as a wrapper for the CometChatUserList component. |
Messages | Messages presents the chat interface for both individual users and group entities. It exhibits a message list containing all interactions where the loggedInUser has sent or received messages from any of these entities. |
CometChatUsersWithMessages
is a view controller, it can be launched either by a button click or through any event’s trigger. It inherits all the customizable properties and methods of CometChatUsers.
View Controller: To use CometChatUsersWithMessages in your view controller
, use the following code snippet.
setOnItemClick
method is used to override the onClick behavior in CometChatUsersWithMessages. By default, this action has a predefined behavior which navigates to the messages. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
setOnItemLongClick
, empowers users to customize long-click actions within CometChatUsersWithMessages, offering enhanced functionality and interaction possibilities.
setOnBack
, providing customization options for handling the back action.
By default, this action has a predefined behavior: it simply dismisses the current view controller. However, the flexibility of CometChat UI Kit allows you to override this standard behavior according to your application’s specific requirements. You can define a custom action that will be performed instead when the back button is pressed.
setOnError
, allows users to override error handling within CometChatUsersWithMessages, providing greater control over error responses and actions.
Users
by UID's
and setting the limit
to 10 using the usersRequestBuilder
.
import CometChatSDK
Component
. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.
The UsersWithMessages
does not produce any events but its component does.
UsersWithMessagesStyle
to the UsersWithMessages
Component to customize the styling.
Example
UsersWithMessages
.
Example
CometChatUsersWithMessages
component and configure it with a UsersConfiguration
object. This ensures seamless integration and optimal functionality within your application.
Users
subcomponent to navigate the User to MessagesMessages
subcomponent to navigatefrom Messages to Details..setMenu()
, the default behavior of UsersWithMessages will also be overridden.Users
and Messages
component. Hence, each of these components will have its individual `Configuration“.
Configurations
expose properties that are available in its individual components..set(usersConfiguration: usersConfiguration)
method as demonstrated below:
CometChatUsersWithMessages
as a child component. To configure CometChatUsersWithMessages, simply provide the usersConfiguration object using the .set(usersConfiguration:)
method. This facilitates seamless customization and integration of user-specific settings within the CometChatUsersWithMessages
component.
UsersConfiguration
can be found under Users. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Users subcomponent and, in addition, you only want to display users with offline status.
You can modify the style using the UsersStyle
method and filter the list with the UsersRequestBuilder
method.
import CometChatSDK
messagesConfiguration
. You can accomplish this by employing the messagesConfiguration
as demonstrated below:
MessagesConfiguration
can be found under Messages. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Messages subcomponent and, in addition, you want to hide message composer.
You can modify the style using the messagesStyle
method and hide using hide(messageComposer: bool)
method.