CometChatDetails
is a Component that provides additional information and settings related to a specific group.
The details screen includes the following elements and functionalities:
CometChatDetails
component is composed of the following BaseComponents:
Components | Description |
---|---|
CometChatListBase | CometChatListBase serves as a container component equipped with a title (navigationBar), search functionality (search-bar), background settings, and a container for embedding a list view. |
CometChatDetails
, as a custom view controller, offers flexible integration options, allowing it to be launched directly via button clicks or any user-triggered action. Additionally, it seamlessly integrates into tab view controllers. With banned members, users gain access to a wide range of parameters and methods for effortless customization of its user interface.
The following code snippet exemplifies how you can seamlessly integrate the CometChatDetails component into your application.
onClose
event is typically triggered when the close button is clicked and it carries a default action. However, with the following code snippet, you can effortlessly override this default operation.
This action does not come with any predefined behavior. However, you have the flexibility to override this event and tailor it to suit your needs using the following code snippet.
On Error
and improve error handling.
SetOnBack
feature. This capability allows you to customize the behavior associated with navigating back within your app. Utilize the provided code snippet to override default behaviors and tailor the user experience according to your specific requirements.
CometChatDetails
component does not have available filters.
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.
Events emitted by the Join Group component is as follows.
Event | Description |
---|---|
onGroupMemberLeave | This event is triggered when the group member leaves the group successfully. |
onGroupDelete | This event is triggered when the group member deletes the group successfully. |
onGroupMemberChangeScope | This will get triggered when the logged in user changes the scope of another group member. |
onGroupMemberBan | This will get triggered when the logged in user bans a group member from the group. |
onGroupMemberKick | This will get triggered when the logged in user kicks another group member from the group. |
onGroupMemberUnban | This will get triggered when the logged in user unbans a user banned from the group. |
onGroupMemberJoin | This will get triggered when the logged in user joins a group. |
onGroupMemberAdd | This will get triggered when the logged in user add new members to the group. |
onOwnershipChange | This will get triggered when the logged in user transfer the ownership of their group to some other member. |
onGroupCreate | This will get triggered when the logged in user creates a new group. |
onCreateGroupClick | This will get triggered when the logged in user taps on create group button. |
DetailsStyle
to the CometChatDetails Component to customize the styling.
Property | Description | Code |
---|---|---|
Background | Sets the background color | set(background: UIColor) |
CornerRadius | Sets the corner radius | set(cornerRadius: CometChatCornerStyle) |
BorderWidth | Sets the border width | set(borderWidth: CGFloat) |
TitleColor | Sets the title color | set(titleColor: UIColor) |
TitleFont | Sets the title font | set(titleFont: UIFont) |
OnlineStatusColor | Sets online status color | set(onlineStatusColor: UIColor) |
PrivateGroupIconBackgroundColor | Sets private group background color | set(privateGroupIconBackgroundColor: UIColor) |
ProtectedGroupIconBackgroundColor | Sets protected group background color | set(protectedGroupIconBackgroundColor: UIColor) |
HeaderBackground | Sets header background color | set(headerBackground: UIColor) |
HeaderTextColor | Sets header text color | set(headerTextColor: UIColor) |
HeaderTextFont | Sets header text font | set(headerTextFont: UIFont) |
ListItemTitleColor | Sets list item title color | set(listItemTitleColor: UIColor) |
ListItemTitleFont | Sets list item title font | set(listItemTitleFont: UIFont) |
ListItemSubtitleFont | Sets list item subtitle font | set(listItemsubTitleFont: UIFont) |
Avatar
component in the CometChatDetails Component, you can use the following code snippet. For further insights on Avatar
Styles refer
ListItemStyle
component in the CometChatDetails
Component, you can use the following code snippet. For further insights on ListItemStyle
Styles refer
Property | Description | Code |
---|---|---|
Title | Custom title for the component | .set(title: String, mode: UINavigationItem.LargeTitleDisplayMode) |
BackButtonTitle | Custom text for the back button | .set(backButtonTitle: String?) |
SearchPlaceholderText | Custom placeholder text for search field | .set(searchPlaceholder: String) |
ShowBackButton | Whether to hide/show the back button | .show(backButton: Bool) |
ErrorStateText | Custom error state text | .set(errorStateText: String) |
BackButtonIcon | Custom back button icon | .set(backButtonIcon: UIImage) |
HideAddButton | Whether to hide the add button | .hide(addButton: Bool) |
SearchPlaceholder | Set the placeholder for search bar | set(searchPlaceholder: String) |
SearchIcon | Sets the icon for the search bar | set(searchIcon:UIImage) |
SearchClearIcon | Sets the clear icon for the search bar | set(searchClearIcon:UIImage) |
SearchBarHeight | Set the height for the search bar | set(searchBarHeight: CGFloat) |
HideSearch | Hide / unhide the search bar as per boolean value | hide(search: Bool) |
SelectionMode | This enables a selection, it has three modes: .single, .multiple | selectionMode(mode: SelectionMode) |
HideSeparator | This method will hide the separator | hide(separator: Bool) |
DisableUserPresence | This method disables user’s online/offline status | disable(userPresence: Bool) |
UpdateUser | This method specifies the option to update user object locally | .update(user: User?) |
UpdateGroup | This method specifies the option to update group object locally | .update(group: Group?) |
PrivateGroupIcon | Sets the group icon for private group | set(privateGroupIcon: UIImage) |
ProtectedGroupIcon | Sets the group icon for protected group | set(protectedGroupIcon: UIImage) |
BackButtonTint | Sets the tint color for the back button | set(backButtonTint: UIColor) |
BackButtonIcon | Sets the icon for the back button | set(backButtonIcon: UIImage) |
BackButtonTitle | Sets the title for the back button | set(backButtonTitle: String) |
BackButtonTitleFont | Sets the title font for the back button | set(backButtonTitleFont: UIFont) |
BackButtonTitleColor | Sets the title color for the back button | set(backButtonTitleColor: UIColor) |
Title | Sets the title for CometChatDetails | set(title: String) |
TitleColor | Sets the title color for CometChatDetails | set(titleColor: UIColor) |
LargeTitleColor | Sets the large title color for CometChatDetails | set(largeTitleColor: UIColor) |
TitleFont | Sets the title font for CometChatDetails | set(titleFont: UIFont) |
LargeTitleFont | Sets the title font for CometChatDetails | set(largeTitleFont: UIFont) |
CloseButton | Shows close button for CometChatDetails | show(closeButton: Bool) |
CloseButtonIcon | Shows close button icon for CometChatDetails | set(closeButtonIcon: UIImage) |
.setSubtitleView()
method. But keep in mind, by using this you will override the default Subtitle view functionality.
Custom_GroupDetails_SubtitleView
a UIView file.
Custom_GroupDetails_SubtitleView
CometChatDetails
. If a navigation controller is already in use, utilize the pushViewController function instead of directly presenting the view controller.CometChatDetailsTemplate
offers a structure for organizing information in the CometChat details component. It serves as a blueprint, defining how group-related details are presented. This structure allows for customization and organization within the CometChat interface.
Properties | Type | Description |
---|---|---|
id | String | Unique identifier for the template. |
title | String | A text to display below the template. |
titleColor | UIColor | Defines the color for the title in the template. |
itemSeparatorColor | UIColor | Defines the separator color for the option in the template. |
hideItemSeparator | Bool | Used to hide the item separator in the template. |
customView | UIView | Used to set the custom view for the template. |
options | ((_ user: CometChat.User?, _ group: CometChat.Group?) -> [CometChatDetailsOption])? | Used to set the list of options for the template. It is a closure that returns an array of CometChatDetailsOption . |
DetailsOption
defines the structure for individual options within the CometChat details component, facilitating customization and functionality for user interactions. This defines the structure of each option for a template in the details component.
Method | Description |
---|---|
add(option: CometChatDetailsOption, templateID: String) | Add new option in template for given templateID. |
update(oldOption: CometChatDetailsOption, newOption: CometChatDetailsOption, templateID: String) | Updates existing option with new option in template for given templateID. |
remove(option: CometChatDetailsOption, templateID: String) | Removes option in template for given templateID. |
Properties | Type | Description |
---|---|---|
id | String | Unique identifier for the option. |
title | String | A text to display below the icon. |
icon | UIImage | A image to display for the option. |
titleColor | UIColor | Defines the color for the title. |
titleFont | UIFont | Defines the font for the title. |
iconTint | UIColor | Defines the color for the icon. |
height | CGFloat | Defines the height for the option. |
customView | UIView | Defines the custom view for the option. |
onClick | ((_ user: User?, _ group: Group?, _ section: Int, _ option: CometChatDetailsOption, _ controller: UIViewController?) -> ())? | The action to perform when user clicks on the option. |
Add Members
, Banned Members
, Transfer Ownership
and Group Members
component. Hence, each of these components will have its individual `Configuration“.
Configurations
expose properties that are available in its individual components.groupMembersConfiguration
. You can accomplish this by employing the groupMembersConfiguration
as demonstrated below:
GroupMembersConfiguration
can be found under Group Members. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Group Member subcomponent and, in addition, you only want to hide separator and show back button.
You can modify the style using the groupMembersStyle
property, hide the separator using hideSeparator
property and show back button using .show(backButton: bool)
property.
AddMembersConfiguration
. You can accomplish this by employing the addMembersConfiguration
as demonstrated below:
AddMembersConfiguration
can be found under Add Members. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Add Members subcomponent and, in addition, you only want to show the back button.
You can modify the style using the ListItemStyle
property and AvatarStyle
property
BannedMembersConfiguration
. You can accomplish this by employing the bannedMembersConfiguration
as demonstrated below:
BannedMembersConfiguration
can be found under Banned Members. Properties marked with the symbol are not accessible within the Configuration Object.
Example
Let’s say you want to change the style of the Banned Members subcomponent and, in addition, you only want to show the back button.
You can modify the style using the ListItemStyle
property and AvatarStyle
property
TransferOwnershipConfiguration
. You can accomplish this by employing the transferOwnershipConfiguration
as demonstrated below:
TransferOwnershipConfiguration
can be found under Transfer Ownership. Properties marked with the symbol are not accessible within the Configuration Object.
Example Let’s say you want to change the style of the Transfer Ownership subcomponent and, in addition, you only want to show the back button.
You can modify the style using the ListItemStyle
property and AvatarStyle
property