@cometchat/skills 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +44 -17
- package/bin/install.js +389 -43
- package/package.json +19 -9
- package/skills/cometchat/SKILL.md +1066 -265
- package/skills/cometchat-android-v5/SKILL.md +120 -0
- package/skills/cometchat-android-v5-components/SKILL.md +430 -0
- package/skills/cometchat-android-v5-core/SKILL.md +468 -0
- package/skills/cometchat-android-v5-customization/SKILL.md +305 -0
- package/skills/cometchat-android-v5-extensions/SKILL.md +124 -0
- package/skills/cometchat-android-v5-features/SKILL.md +130 -0
- package/skills/cometchat-android-v5-placement/SKILL.md +276 -0
- package/skills/cometchat-android-v5-production/SKILL.md +94 -0
- package/skills/cometchat-android-v5-push/SKILL.md +620 -0
- package/skills/cometchat-android-v5-testing/SKILL.md +187 -0
- package/skills/cometchat-android-v5-theming/SKILL.md +166 -0
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +73 -0
- package/skills/cometchat-android-v6/SKILL.md +107 -0
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +145 -0
- package/skills/cometchat-android-v6-compose-components/SKILL.md +202 -0
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +280 -0
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +213 -0
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +224 -0
- package/skills/cometchat-android-v6-core/SKILL.md +354 -0
- package/skills/cometchat-android-v6-events/SKILL.md +212 -0
- package/skills/cometchat-android-v6-extensions/SKILL.md +191 -0
- package/skills/cometchat-android-v6-features/SKILL.md +130 -0
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +197 -0
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +268 -0
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +248 -0
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +202 -0
- package/skills/cometchat-android-v6-production/SKILL.md +187 -0
- package/skills/cometchat-android-v6-push/SKILL.md +274 -0
- package/skills/cometchat-android-v6-testing/SKILL.md +279 -0
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +249 -0
- package/skills/cometchat-angular-components/SKILL.md +706 -0
- package/skills/cometchat-angular-core/SKILL.md +444 -0
- package/skills/cometchat-angular-customization/SKILL.md +424 -0
- package/skills/cometchat-angular-features/SKILL.md +447 -0
- package/skills/cometchat-angular-patterns/SKILL.md +447 -0
- package/skills/cometchat-angular-placement/SKILL.md +685 -0
- package/skills/cometchat-angular-production/SKILL.md +415 -0
- package/skills/cometchat-angular-theming/SKILL.md +365 -0
- package/skills/cometchat-angular-troubleshooting/SKILL.md +329 -0
- package/skills/cometchat-astro-patterns/SKILL.md +3 -3
- package/skills/cometchat-components/SKILL.md +11 -0
- package/skills/cometchat-core/SKILL.md +11 -6
- package/skills/cometchat-customization/references/component-catalog.md +1 -1
- package/skills/cometchat-features/SKILL.md +176 -108
- package/skills/cometchat-flutter-v5/SKILL.md +167 -0
- package/skills/cometchat-flutter-v5-calls/SKILL.md +192 -0
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +117 -0
- package/skills/cometchat-flutter-v5-core/SKILL.md +221 -0
- package/skills/cometchat-flutter-v5-customization/SKILL.md +227 -0
- package/skills/cometchat-flutter-v5-events/SKILL.md +155 -0
- package/skills/cometchat-flutter-v5-messages/SKILL.md +258 -0
- package/skills/cometchat-flutter-v5-production/SKILL.md +207 -0
- package/skills/cometchat-flutter-v5-push/SKILL.md +284 -0
- package/skills/cometchat-flutter-v5-theming/SKILL.md +160 -0
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +129 -0
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +151 -0
- package/skills/cometchat-flutter-v6/SKILL.md +445 -0
- package/skills/cometchat-flutter-v6-calls/SKILL.md +333 -0
- package/skills/cometchat-flutter-v6-components/SKILL.md +365 -0
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +210 -0
- package/skills/cometchat-flutter-v6-core/SKILL.md +305 -0
- package/skills/cometchat-flutter-v6-customization/SKILL.md +666 -0
- package/skills/cometchat-flutter-v6-events/SKILL.md +216 -0
- package/skills/cometchat-flutter-v6-features/SKILL.md +406 -0
- package/skills/cometchat-flutter-v6-messages/SKILL.md +333 -0
- package/skills/cometchat-flutter-v6-migration/SKILL.md +381 -0
- package/skills/cometchat-flutter-v6-placement/SKILL.md +398 -0
- package/skills/cometchat-flutter-v6-production/SKILL.md +632 -0
- package/skills/cometchat-flutter-v6-theming/SKILL.md +260 -0
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +726 -0
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +216 -0
- package/skills/cometchat-ios/SKILL.md +323 -0
- package/skills/cometchat-ios-components/SKILL.md +651 -0
- package/skills/cometchat-ios-core/SKILL.md +822 -0
- package/skills/cometchat-ios-customization/SKILL.md +825 -0
- package/skills/cometchat-ios-features/SKILL.md +725 -0
- package/skills/cometchat-ios-placement/SKILL.md +750 -0
- package/skills/cometchat-ios-production/SKILL.md +730 -0
- package/skills/cometchat-ios-push/SKILL.md +582 -0
- package/skills/cometchat-ios-theming/SKILL.md +631 -0
- package/skills/cometchat-ios-troubleshooting/SKILL.md +983 -0
- package/skills/cometchat-native-bare-patterns/SKILL.md +470 -0
- package/skills/cometchat-native-components/SKILL.md +594 -0
- package/skills/cometchat-native-core/SKILL.md +407 -0
- package/skills/cometchat-native-customization/SKILL.md +594 -0
- package/skills/cometchat-native-expo-patterns/SKILL.md +485 -0
- package/skills/cometchat-native-features/SKILL.md +608 -0
- package/skills/cometchat-native-placement/SKILL.md +500 -0
- package/skills/cometchat-native-production/SKILL.md +694 -0
- package/skills/cometchat-native-push/SKILL.md +593 -0
- package/skills/cometchat-native-testing/SKILL.md +583 -0
- package/skills/cometchat-native-theming/SKILL.md +656 -0
- package/skills/cometchat-native-troubleshooting/SKILL.md +433 -0
- package/skills/cometchat-nextjs-patterns/SKILL.md +5 -5
- package/skills/cometchat-production/SKILL.md +60 -0
- package/skills/cometchat-react-router-patterns/SKILL.md +23 -21
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-compose-components
|
|
3
|
+
description: "CometChat Android UIKit v6 Jetpack Compose component catalog — all @Composable chat UI components, their parameters, styles, and usage"
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat, android, compose, components, conversations, messages, users, groups, calls"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-kotlin-components (Views equivalent), cometchat-android-v6-compose-theming, cometchat-android-v6-compose-customization, cometchat-android-v6-compose-placement
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Complete catalog of all Jetpack Compose components in CometChat UIKit v6. Each component is a `@Composable` function in `com.cometchat.uikit.compose.presentation`.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Adding a CometChat Compose component to a screen
|
|
22
|
+
- Looking up component parameters and their types
|
|
23
|
+
- Understanding which component to use for a specific chat feature
|
|
24
|
+
- Finding the style class for a component
|
|
25
|
+
|
|
26
|
+
## Do not use this skill when
|
|
27
|
+
|
|
28
|
+
- Working with Kotlin Views components (use `cometchat-android-v6-kotlin-components`)
|
|
29
|
+
- Customizing bubble rendering (use `cometchat-android-v6-compose-customization`)
|
|
30
|
+
- Placing components in navigation (use `cometchat-android-v6-compose-placement`)
|
|
31
|
+
|
|
32
|
+
## 1. Component Catalog
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### 1.1 List Components
|
|
36
|
+
|
|
37
|
+
| Component | Package | Purpose |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `CometChatConversations` | `presentation.conversations.ui` | Recent conversations list |
|
|
40
|
+
| `CometChatUsers` | `presentation.users.ui` | User list |
|
|
41
|
+
| `CometChatGroups` | `presentation.groups.ui` | Group list |
|
|
42
|
+
| `CometChatGroupMembers` | `presentation.groupmembers.ui` | Members of a group |
|
|
43
|
+
| `CometChatCallLogs` | `presentation.calllogs.ui` | Call history |
|
|
44
|
+
|
|
45
|
+
### 1.2 Messaging Components
|
|
46
|
+
|
|
47
|
+
| Component | Package | Purpose |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `CometChatMessageList` | `presentation.messagelist.ui` | Message list with bubbles |
|
|
50
|
+
| `CometChatMessageComposer` | `presentation.messagecomposer.ui` | Message input with attachments |
|
|
51
|
+
| `CometChatMessageHeader` | `presentation.messageheader.ui` | Chat header (name, status, actions) |
|
|
52
|
+
| `CometChatMessageInformation` | `presentation.messageinformation.ui` | Message delivery/read info |
|
|
53
|
+
| `CometChatThreadHeader` | `presentation.threadheader.ui` | Thread parent message header |
|
|
54
|
+
|
|
55
|
+
### 1.3 Call Components
|
|
56
|
+
|
|
57
|
+
| Component | Package | Purpose |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `CometChatCallButtons` | `presentation.callbuttons.ui` | Audio/video call buttons |
|
|
60
|
+
| `CometChatIncomingCall` | `presentation.incomingcall.ui` | Incoming call screen |
|
|
61
|
+
| `CometChatOutgoingCall` | `presentation.outgoingcall.ui` | Outgoing call screen |
|
|
62
|
+
| `CometChatOngoingCall` | `presentation.ongoingcall.ui` | Active call screen |
|
|
63
|
+
| `CometChatCallActivity` | `calls` | Activity wrapper for calls |
|
|
64
|
+
|
|
65
|
+
### 1.4 Utility Components
|
|
66
|
+
|
|
67
|
+
| Component | Package | Purpose |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `CometChatSearch` | `presentation.search.ui` | Global search |
|
|
70
|
+
| `CometChatReactionList` | `presentation.reactionlist.ui` | Reaction details |
|
|
71
|
+
| `CometChatEmojiKeyboard` | `presentation.emojikeyboard.ui` | Emoji picker |
|
|
72
|
+
| `CometChatStickerKeyboard` | `presentation.stickerkeyboard.ui` | Sticker picker |
|
|
73
|
+
| `CometChatCreatePoll` | `presentation.createpoll.ui` | Poll creation |
|
|
74
|
+
| `CometChatImageViewerScreen` | `presentation.imageviewer.ui` | Full-screen image viewer |
|
|
75
|
+
| `CometChatFlagMessageDialog` | `presentation.report` | Report/flag message |
|
|
76
|
+
| `CometChatAIAssistantChatHistory` | `presentation.aiassistantchathistory.ui` | AI chat history |
|
|
77
|
+
|
|
78
|
+
### 1.5 Shared Elements
|
|
79
|
+
|
|
80
|
+
Located in `presentation.shared/`:
|
|
81
|
+
|
|
82
|
+
- AI features: `aiconversationstarter/`, `aiconversationsummary/`, `aismartreplies/`
|
|
83
|
+
- Message bubble: `messagebubble/` (BubbleFactory, InternalContentRenderer, CometChatMessageBubble)
|
|
84
|
+
- Mentions: `mentions/`
|
|
85
|
+
- Formatters: `formatters/` (CometChatTextFormatter, CometChatMentionsFormatter)
|
|
86
|
+
- Default states: `defaultstates/` (empty, error, loading state composables)
|
|
87
|
+
- Dialog: `dialog/`
|
|
88
|
+
- Popup menu: `popupmenu/`
|
|
89
|
+
|
|
90
|
+
### 1.6 Preview Support
|
|
91
|
+
|
|
92
|
+
The `preview/` package provides preview data, domain models, and presentation helpers for `@Preview` composables during development.
|
|
93
|
+
|
|
94
|
+
## 2. Basic Usage Examples
|
|
95
|
+
|
|
96
|
+
### 2.1 Conversations List
|
|
97
|
+
|
|
98
|
+
```kotlin
|
|
99
|
+
import com.cometchat.uikit.compose.presentation.conversations.ui.CometChatConversations
|
|
100
|
+
import com.cometchat.uikit.compose.theme.CometChatTheme
|
|
101
|
+
|
|
102
|
+
@Composable
|
|
103
|
+
fun ConversationsScreen(onConversationClick: (Conversation) -> Unit) {
|
|
104
|
+
CometChatTheme {
|
|
105
|
+
CometChatConversations(
|
|
106
|
+
onItemClick = { conversation ->
|
|
107
|
+
onConversationClick(conversation)
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 2.2 Message List
|
|
115
|
+
|
|
116
|
+
```kotlin
|
|
117
|
+
import com.cometchat.uikit.compose.presentation.messagelist.ui.CometChatMessageList
|
|
118
|
+
import com.cometchat.chat.models.User
|
|
119
|
+
|
|
120
|
+
@Composable
|
|
121
|
+
fun ChatScreen(user: User) {
|
|
122
|
+
CometChatTheme {
|
|
123
|
+
Column {
|
|
124
|
+
CometChatMessageHeader(user = user)
|
|
125
|
+
CometChatMessageList(
|
|
126
|
+
user = user,
|
|
127
|
+
modifier = Modifier.weight(1f)
|
|
128
|
+
)
|
|
129
|
+
CometChatMessageComposer(user = user)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 2.3 Users List
|
|
136
|
+
|
|
137
|
+
```kotlin
|
|
138
|
+
@Composable
|
|
139
|
+
fun UsersScreen() {
|
|
140
|
+
CometChatTheme {
|
|
141
|
+
CometChatUsers(
|
|
142
|
+
onItemClick = { user ->
|
|
143
|
+
// Navigate to chat with user
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 2.4 Groups List
|
|
151
|
+
|
|
152
|
+
```kotlin
|
|
153
|
+
@Composable
|
|
154
|
+
fun GroupsScreen() {
|
|
155
|
+
CometChatTheme {
|
|
156
|
+
CometChatGroups(
|
|
157
|
+
onItemClick = { group ->
|
|
158
|
+
// Navigate to group chat
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## 3. Style Classes
|
|
166
|
+
|
|
167
|
+
Every component has a corresponding `@Immutable data class` style in its `style/` subpackage:
|
|
168
|
+
|
|
169
|
+
| Component | Style Class | Factory |
|
|
170
|
+
|---|---|---|
|
|
171
|
+
| `CometChatConversations` | `CometChatConversationsStyle` | `.default()` |
|
|
172
|
+
| `CometChatUsers` | `CometChatUsersStyle` | `.default()` |
|
|
173
|
+
| `CometChatGroups` | `CometChatGroupsStyle` | `.default()` |
|
|
174
|
+
| `CometChatGroupMembers` | `CometChatGroupMembersStyle` | `.default()` |
|
|
175
|
+
| `CometChatMessageList` | `CometChatMessageListStyle` | `.default()` |
|
|
176
|
+
| `CometChatMessageComposer` | `CometChatMessageComposerStyle` | `.default()` |
|
|
177
|
+
| `CometChatMessageHeader` | `CometChatMessageHeaderStyle` | `.default()` |
|
|
178
|
+
| `CometChatCallLogs` | `CometChatCallLogsStyle` | `.default()` |
|
|
179
|
+
| `CometChatThreadHeader` | `CometChatThreadHeaderStyle` | `.default()` |
|
|
180
|
+
|
|
181
|
+
Usage:
|
|
182
|
+
|
|
183
|
+
```kotlin
|
|
184
|
+
CometChatConversations(
|
|
185
|
+
style = CometChatConversationsStyle.default(
|
|
186
|
+
backgroundColor = Color.White,
|
|
187
|
+
titleTextColor = Color.Black,
|
|
188
|
+
titleTextStyle = CometChatTheme.typography.heading1Bold
|
|
189
|
+
)
|
|
190
|
+
)
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 4. ViewModel Integration
|
|
194
|
+
|
|
195
|
+
Each component creates its own ViewModel internally via factories from `chatuikit-core`. The ViewModels expose `StateFlow` of sealed UI state classes. You typically don't need to interact with ViewModels directly — the components handle everything.
|
|
196
|
+
|
|
197
|
+
## Hard rules
|
|
198
|
+
|
|
199
|
+
- ALWAYS wrap CometChat Compose components in `CometChatTheme {}` — they depend on `CompositionLocal` theme values
|
|
200
|
+
- Components create their own ViewModels internally — do NOT try to create or inject ViewModels manually
|
|
201
|
+
- Style classes use `Companion.default()` factory functions — do NOT use the data class constructor directly (it requires all parameters)
|
|
202
|
+
- All style defaults source from `CometChatTheme` tokens — override only what you need via named parameters
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-compose-customization
|
|
3
|
+
description: "CometChat Android UIKit v6 Compose customization — BubbleFactory interface, slot lambdas, @Immutable style classes, and per-slot overrides"
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat, android, compose, customization, bubble-factory, slots, style"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-kotlin-customization (Views equivalent), cometchat-android-v6-compose-components, cometchat-android-v6-compose-theming, cometchat-android-v6-extensions (DataSource layer), cometchat-android-v6-events
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Customize CometChat Compose components — override message bubble rendering with BubbleFactory, use slot lambda parameters for per-slot overrides, and apply @Immutable style classes. This is the v6 replacement for v5's DataSource/ChatConfigurator pattern.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Creating custom message bubble rendering for specific message types
|
|
22
|
+
- Overriding individual bubble slots (avatar, header, footer, content, etc.)
|
|
23
|
+
- Applying custom styles to components
|
|
24
|
+
- Replacing the entire bubble layout for a message type
|
|
25
|
+
|
|
26
|
+
## Do not use this skill when
|
|
27
|
+
|
|
28
|
+
- Working with Kotlin Views customization (use `cometchat-android-v6-kotlin-customization`)
|
|
29
|
+
- Changing theme colors globally (use `cometchat-android-v6-compose-theming`)
|
|
30
|
+
- Extending the data layer (use `cometchat-android-v6-extensions`)
|
|
31
|
+
|
|
32
|
+
## 1. BubbleFactory (Message Bubble Customization)
|
|
33
|
+
|
|
34
|
+
`BubbleFactory` is an interface in `com.cometchat.uikit.compose.presentation.shared.messagebubble`. Each implementation handles a specific message type.
|
|
35
|
+
|
|
36
|
+
### 1.1 Creating a Custom BubbleFactory
|
|
37
|
+
|
|
38
|
+
```kotlin
|
|
39
|
+
import com.cometchat.uikit.compose.presentation.shared.messagebubble.BubbleFactory
|
|
40
|
+
import com.cometchat.chat.constants.CometChatConstants
|
|
41
|
+
import com.cometchat.chat.models.BaseMessage
|
|
42
|
+
import com.cometchat.uikit.core.constants.UIKitConstants.MessageBubbleAlignment
|
|
43
|
+
|
|
44
|
+
class LocationBubbleFactory : BubbleFactory {
|
|
45
|
+
|
|
46
|
+
override fun getCategory(): String = CometChatConstants.CATEGORY_CUSTOM
|
|
47
|
+
override fun getType(): String = "location"
|
|
48
|
+
|
|
49
|
+
override fun getContentView(
|
|
50
|
+
message: BaseMessage,
|
|
51
|
+
alignment: MessageBubbleAlignment,
|
|
52
|
+
style: CometChatMessageBubbleStyle,
|
|
53
|
+
textFormatters: List<CometChatTextFormatter>
|
|
54
|
+
): @Composable () -> Unit = {
|
|
55
|
+
// Your custom content composable
|
|
56
|
+
val metadata = message.metadata
|
|
57
|
+
val lat = metadata?.optDouble("latitude") ?: 0.0
|
|
58
|
+
val lng = metadata?.optDouble("longitude") ?: 0.0
|
|
59
|
+
LocationMapView(latitude = lat, longitude = lng)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 1.2 Registering BubbleFactories
|
|
65
|
+
|
|
66
|
+
```kotlin
|
|
67
|
+
CometChatMessageList(
|
|
68
|
+
user = user,
|
|
69
|
+
bubbleFactories = listOf(
|
|
70
|
+
LocationBubbleFactory(),
|
|
71
|
+
PaymentBubbleFactory()
|
|
72
|
+
)
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The list is converted to a map keyed by `"category_type"` internally via `toFactoryMap()`.
|
|
77
|
+
|
|
78
|
+
### 1.3 Complete Bubble Replacement
|
|
79
|
+
|
|
80
|
+
Override `getBubbleView()` to replace the ENTIRE bubble (all slots):
|
|
81
|
+
|
|
82
|
+
```kotlin
|
|
83
|
+
class CustomBubbleFactory : BubbleFactory {
|
|
84
|
+
override fun getCategory(): String = "custom"
|
|
85
|
+
override fun getType(): String = "payment"
|
|
86
|
+
|
|
87
|
+
override fun getBubbleView(
|
|
88
|
+
message: BaseMessage,
|
|
89
|
+
alignment: MessageBubbleAlignment
|
|
90
|
+
): (@Composable () -> Unit)? = {
|
|
91
|
+
// Complete custom bubble — no header, footer, avatar, etc.
|
|
92
|
+
PaymentCard(message = message, alignment = alignment)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
When `getBubbleView()` returns non-null, all other slot methods are ignored.
|
|
98
|
+
|
|
99
|
+
### 1.4 Slot Methods
|
|
100
|
+
|
|
101
|
+
All return `(@Composable () -> Unit)?` — return `null` to use defaults:
|
|
102
|
+
|
|
103
|
+
| Method | Slot | Parameters |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| `getContentView()` | Main content | `message, alignment, style, textFormatters` |
|
|
106
|
+
| `getLeadingView()` | Avatar | `message, alignment, style` |
|
|
107
|
+
| `getHeaderView()` | Sender name | `message, alignment, style, showTime` |
|
|
108
|
+
| `getReplyView()` | Reply preview | `message, alignment, style` |
|
|
109
|
+
| `getBottomView()` | Moderation | `message, alignment, style, hideModerationView` |
|
|
110
|
+
| `getStatusInfoView()` | Timestamp/receipts | `message, alignment, style, showTime` |
|
|
111
|
+
| `getThreadView()` | Thread indicator | `message, alignment, style, onThreadRepliesClick` |
|
|
112
|
+
| `getFooterView()` | Reactions | `message, alignment, style, onReactionClick, onReactionLongClick, onAddMoreReactionsClick` |
|
|
113
|
+
|
|
114
|
+
### 1.5 Style Override
|
|
115
|
+
|
|
116
|
+
```kotlin
|
|
117
|
+
override fun getBubbleStyle(
|
|
118
|
+
message: BaseMessage,
|
|
119
|
+
alignment: MessageBubbleAlignment
|
|
120
|
+
): CometChatMessageBubbleStyle? {
|
|
121
|
+
return CometChatMessageBubbleStyle(
|
|
122
|
+
backgroundColor = Color(0xFFE8F5E9),
|
|
123
|
+
cornerRadius = 16.dp
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Factory style is the highest priority in the 3-tier style chain.
|
|
129
|
+
|
|
130
|
+
### 1.6 Lifecycle
|
|
131
|
+
|
|
132
|
+
```kotlin
|
|
133
|
+
override fun onDispose(message: BaseMessage) {
|
|
134
|
+
// Clean up resources when bubble leaves composition
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 2. Slot Lambda Parameters (Per-Slot Overrides)
|
|
139
|
+
|
|
140
|
+
Override individual slots across ALL message types directly on `CometChatMessageList`:
|
|
141
|
+
|
|
142
|
+
```kotlin
|
|
143
|
+
CometChatMessageList(
|
|
144
|
+
user = user,
|
|
145
|
+
|
|
146
|
+
// Custom avatar for all messages
|
|
147
|
+
leadingView = { message, alignment ->
|
|
148
|
+
if (alignment == MessageAlignment.LEFT) {
|
|
149
|
+
AsyncImage(
|
|
150
|
+
model = message.sender?.avatar,
|
|
151
|
+
contentDescription = null,
|
|
152
|
+
modifier = Modifier.size(32.dp).clip(CircleShape)
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
// Custom timestamp for all messages
|
|
158
|
+
statusInfoView = { message, alignment ->
|
|
159
|
+
Text(
|
|
160
|
+
text = formatTime(message.sentAt),
|
|
161
|
+
style = CometChatTheme.typography.caption1Regular,
|
|
162
|
+
color = CometChatTheme.colorScheme.textColorTertiary
|
|
163
|
+
)
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
// Custom footer for all messages
|
|
167
|
+
footerView = { message, alignment ->
|
|
168
|
+
// Custom reactions display
|
|
169
|
+
ReactionsRow(message = message)
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 2.1 All Slot Parameters
|
|
175
|
+
|
|
176
|
+
| Parameter | Type | Slot |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `leadingView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Avatar |
|
|
179
|
+
| `headerView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Sender name |
|
|
180
|
+
| `replyView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Reply preview |
|
|
181
|
+
| `contentView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Main content |
|
|
182
|
+
| `bottomView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Moderation |
|
|
183
|
+
| `statusInfoView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Timestamp/receipts |
|
|
184
|
+
| `threadView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Thread indicator |
|
|
185
|
+
| `footerView` | `@Composable (BaseMessage, MessageAlignment) -> Unit` | Reactions |
|
|
186
|
+
|
|
187
|
+
### 2.2 Priority Order
|
|
188
|
+
|
|
189
|
+
For each slot, the resolution order is:
|
|
190
|
+
1. Explicit slot lambda parameter (highest priority)
|
|
191
|
+
2. BubbleFactory slot method
|
|
192
|
+
3. Internal default rendering
|
|
193
|
+
|
|
194
|
+
## 3. Style Classes
|
|
195
|
+
|
|
196
|
+
### 3.1 Using Style Classes
|
|
197
|
+
|
|
198
|
+
```kotlin
|
|
199
|
+
CometChatConversations(
|
|
200
|
+
style = CometChatConversationsStyle.default(
|
|
201
|
+
backgroundColor = Color(0xFFF5F5F5),
|
|
202
|
+
titleTextColor = Color.Black,
|
|
203
|
+
titleTextStyle = CometChatTheme.typography.heading1Bold,
|
|
204
|
+
separatorColor = Color.LightGray,
|
|
205
|
+
itemStyle = CometChatConversationListItemStyle.default(
|
|
206
|
+
titleTextColor = Color.DarkGray
|
|
207
|
+
)
|
|
208
|
+
)
|
|
209
|
+
)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 3.2 Style Class Pattern
|
|
213
|
+
|
|
214
|
+
All style classes follow this pattern:
|
|
215
|
+
|
|
216
|
+
```kotlin
|
|
217
|
+
@Immutable
|
|
218
|
+
data class CometChatConversationsStyle(
|
|
219
|
+
val backgroundColor: Color,
|
|
220
|
+
val titleTextColor: Color,
|
|
221
|
+
val titleTextStyle: TextStyle,
|
|
222
|
+
// ... many properties
|
|
223
|
+
) {
|
|
224
|
+
companion object {
|
|
225
|
+
@Composable
|
|
226
|
+
fun default(
|
|
227
|
+
backgroundColor: Color = CometChatTheme.colorScheme.backgroundColor1,
|
|
228
|
+
titleTextColor: Color = CometChatTheme.colorScheme.textColorPrimary,
|
|
229
|
+
// ... defaults from CometChatTheme
|
|
230
|
+
): CometChatConversationsStyle = CometChatConversationsStyle(/* ... */)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Use `Companion.default()` with named parameter overrides — never call the data class constructor directly.
|
|
236
|
+
|
|
237
|
+
### 3.3 Nested Styles
|
|
238
|
+
|
|
239
|
+
Some styles contain nested style classes:
|
|
240
|
+
|
|
241
|
+
```kotlin
|
|
242
|
+
CometChatConversationsStyle.default(
|
|
243
|
+
itemStyle = CometChatConversationListItemStyle.default(/* ... */),
|
|
244
|
+
popupMenuStyle = CometChatPopupMenuStyle.default(/* ... */),
|
|
245
|
+
emptyStateStyle = CometChatEmptyStateStyle.default(/* ... */),
|
|
246
|
+
errorStateStyle = CometChatErrorStateStyle.default(/* ... */),
|
|
247
|
+
loadingStateStyle = CometChatLoadingStateStyle.default(/* ... */),
|
|
248
|
+
dialogStyle = CometChatDialogStyle.default(/* ... */)
|
|
249
|
+
)
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 4. Custom State Views
|
|
253
|
+
|
|
254
|
+
```kotlin
|
|
255
|
+
CometChatMessageList(
|
|
256
|
+
user = user,
|
|
257
|
+
loadingView = { CircularProgressIndicator() },
|
|
258
|
+
emptyView = { Text("No messages yet") },
|
|
259
|
+
errorView = { Text("Something went wrong") }
|
|
260
|
+
)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 5. v5 → v6 Migration
|
|
264
|
+
|
|
265
|
+
| v5 Pattern | v6 Pattern |
|
|
266
|
+
|---|---|
|
|
267
|
+
| `ChatConfigurator.enable(decorator)` | `CometChatMessageList(bubbleFactories = listOf(...))` |
|
|
268
|
+
| DataSource template methods | BubbleFactory slot methods |
|
|
269
|
+
| Global decorator chain | Per-component factory registration |
|
|
270
|
+
| No bubble replacement | `getBubbleView()` for complete replacement |
|
|
271
|
+
| Theme-level styling only | Per-factory `getBubbleStyle()` |
|
|
272
|
+
|
|
273
|
+
## Hard rules
|
|
274
|
+
|
|
275
|
+
- BubbleFactory is an `interface` — implement it, don't extend an abstract class
|
|
276
|
+
- `getCategory()` and `getType()` are REQUIRED — they identify which message type the factory handles
|
|
277
|
+
- When `getBubbleView()` returns non-null, ALL other slot methods are ignored for that message type
|
|
278
|
+
- Slot lambda parameters on `CometChatMessageList` override BubbleFactory slot methods — use lambdas for cross-type overrides, factories for per-type overrides
|
|
279
|
+
- Style classes must use `Companion.default()` factory — the data class constructor requires ALL parameters
|
|
280
|
+
- Do NOT confuse BubbleFactory (UI rendering) with DataSource (data fetching) — they are separate layers
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-compose-placement
|
|
3
|
+
description: "CometChat Android UIKit v6 Compose placement — setContent, Compose Navigation, Dialog, BottomSheet, and Tab patterns"
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat, android, compose, navigation, placement, screens, tabs"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-kotlin-placement (Views equivalent), cometchat-android-v6-compose-components, cometchat-android-v6-compose-theming
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Place CometChat Compose components into app screens using Compose Navigation, Dialogs, BottomSheets, and Tab layouts. Patterns derived from `master-app-jetpack`.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Setting up Compose Navigation with CometChat screens
|
|
22
|
+
- Placing CometChat components in a NavHost
|
|
23
|
+
- Showing CometChat components in Dialogs or BottomSheets
|
|
24
|
+
- Building a tabbed layout with Conversations, Users, Groups, Calls tabs
|
|
25
|
+
|
|
26
|
+
## Do not use this skill when
|
|
27
|
+
|
|
28
|
+
- Working with Kotlin Views placement (use `cometchat-android-v6-kotlin-placement`)
|
|
29
|
+
- Looking up component APIs (use `cometchat-android-v6-compose-components`)
|
|
30
|
+
|
|
31
|
+
## 1. Basic setContent Placement
|
|
32
|
+
|
|
33
|
+
```kotlin
|
|
34
|
+
class MainActivity : ComponentActivity() {
|
|
35
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
36
|
+
super.onCreate(savedInstanceState)
|
|
37
|
+
setContent {
|
|
38
|
+
CometChatTheme {
|
|
39
|
+
CometChatConversations(
|
|
40
|
+
onItemClick = { conversation -> /* navigate */ }
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 2. Compose Navigation
|
|
49
|
+
|
|
50
|
+
Pattern from `master-app-jetpack/navigation/NavGraph.kt`:
|
|
51
|
+
|
|
52
|
+
```kotlin
|
|
53
|
+
import androidx.navigation.compose.NavHost
|
|
54
|
+
import androidx.navigation.compose.composable
|
|
55
|
+
import androidx.navigation.compose.rememberNavController
|
|
56
|
+
|
|
57
|
+
@Composable
|
|
58
|
+
fun AppNavigation() {
|
|
59
|
+
val navController = rememberNavController()
|
|
60
|
+
|
|
61
|
+
CometChatTheme {
|
|
62
|
+
NavHost(navController = navController, startDestination = "conversations") {
|
|
63
|
+
|
|
64
|
+
composable("conversations") {
|
|
65
|
+
CometChatConversations(
|
|
66
|
+
onItemClick = { conversation ->
|
|
67
|
+
// Pass conversation ID or user/group via route
|
|
68
|
+
navController.navigate("chat/${conversation.conversationId}")
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
composable("chat/{conversationId}") { backStackEntry ->
|
|
74
|
+
val conversationId = backStackEntry.arguments?.getString("conversationId")
|
|
75
|
+
// Resolve user or group from conversationId, then:
|
|
76
|
+
Column {
|
|
77
|
+
CometChatMessageHeader(user = resolvedUser)
|
|
78
|
+
CometChatMessageList(
|
|
79
|
+
user = resolvedUser,
|
|
80
|
+
modifier = Modifier.weight(1f)
|
|
81
|
+
)
|
|
82
|
+
CometChatMessageComposer(user = resolvedUser)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
composable("users") {
|
|
87
|
+
CometChatUsers(
|
|
88
|
+
onItemClick = { user ->
|
|
89
|
+
navController.navigate("chat/user_${user.uid}")
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
composable("groups") {
|
|
95
|
+
CometChatGroups(
|
|
96
|
+
onItemClick = { group ->
|
|
97
|
+
navController.navigate("chat/group_${group.guid}")
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 3. Tabbed Layout
|
|
107
|
+
|
|
108
|
+
```kotlin
|
|
109
|
+
@Composable
|
|
110
|
+
fun HomeScreen() {
|
|
111
|
+
var selectedTab by remember { mutableIntStateOf(0) }
|
|
112
|
+
val tabs = listOf("Chats", "Users", "Groups", "Calls")
|
|
113
|
+
|
|
114
|
+
CometChatTheme {
|
|
115
|
+
Column {
|
|
116
|
+
TabRow(selectedTabIndex = selectedTab) {
|
|
117
|
+
tabs.forEachIndexed { index, title ->
|
|
118
|
+
Tab(
|
|
119
|
+
selected = selectedTab == index,
|
|
120
|
+
onClick = { selectedTab = index },
|
|
121
|
+
text = { Text(title) }
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
when (selectedTab) {
|
|
127
|
+
0 -> CometChatConversations(onItemClick = { /* navigate */ })
|
|
128
|
+
1 -> CometChatUsers(onItemClick = { /* navigate */ })
|
|
129
|
+
2 -> CometChatGroups(onItemClick = { /* navigate */ })
|
|
130
|
+
3 -> CometChatCallLogs(onItemClick = { /* navigate */ })
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 4. Dialog Placement
|
|
138
|
+
|
|
139
|
+
```kotlin
|
|
140
|
+
@Composable
|
|
141
|
+
fun ChatScreenWithInfo(message: BaseMessage) {
|
|
142
|
+
var showInfo by remember { mutableStateOf(false) }
|
|
143
|
+
|
|
144
|
+
if (showInfo) {
|
|
145
|
+
Dialog(onDismissRequest = { showInfo = false }) {
|
|
146
|
+
CometChatMessageInformation(message = message)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## 5. BottomSheet Placement
|
|
153
|
+
|
|
154
|
+
```kotlin
|
|
155
|
+
@OptIn(ExperimentalMaterial3Api::class)
|
|
156
|
+
@Composable
|
|
157
|
+
fun ChatScreenWithReactions(message: BaseMessage) {
|
|
158
|
+
var showReactions by remember { mutableStateOf(false) }
|
|
159
|
+
val sheetState = rememberModalBottomSheetState()
|
|
160
|
+
|
|
161
|
+
if (showReactions) {
|
|
162
|
+
ModalBottomSheet(
|
|
163
|
+
onDismissRequest = { showReactions = false },
|
|
164
|
+
sheetState = sheetState
|
|
165
|
+
) {
|
|
166
|
+
CometChatReactionList(baseMessage = message)
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## 6. Call Activity Launch
|
|
173
|
+
|
|
174
|
+
Ongoing calls use a dedicated Activity (not a composable screen):
|
|
175
|
+
|
|
176
|
+
```kotlin
|
|
177
|
+
import com.cometchat.uikit.compose.presentation.ongoingcall.ui.CometChatOngoingCallActivity
|
|
178
|
+
import com.cometchat.uikit.core.constants.UIKitConstants.CallWorkFlow
|
|
179
|
+
|
|
180
|
+
// Launch ongoing call
|
|
181
|
+
CometChatOngoingCallActivity.launchOngoingCallActivity(
|
|
182
|
+
activity, // Current Activity
|
|
183
|
+
call.sessionId, // Call session ID
|
|
184
|
+
call.type, // "audio" or "video"
|
|
185
|
+
CallWorkFlow.DEFAULT,
|
|
186
|
+
null, // Custom CallSettingsBuilder (optional)
|
|
187
|
+
null // CometChatOngoingCallStyle (optional)
|
|
188
|
+
)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## 7. Incoming Call Overlay
|
|
192
|
+
|
|
193
|
+
From `master-app-jetpack/Application.kt` — incoming calls are shown as an overlay using StateFlow:
|
|
194
|
+
|
|
195
|
+
```kotlin
|
|
196
|
+
// In Application class
|
|
197
|
+
private val _incomingCall = MutableStateFlow<Call?>(null)
|
|
198
|
+
val incomingCall: StateFlow<Call?> = _incomingCall.asStateFlow()
|
|
199
|
+
|
|
200
|
+
// In your root composable
|
|
201
|
+
val incomingCall by application.incomingCall.collectAsStateWithLifecycle()
|
|
202
|
+
|
|
203
|
+
incomingCall?.let { call ->
|
|
204
|
+
CometChatIncomingCall(call = call)
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Hard rules
|
|
209
|
+
|
|
210
|
+
- ALWAYS wrap CometChat components in `CometChatTheme {}` at the top level — do not nest multiple `CometChatTheme` wrappers
|
|
211
|
+
- Place `CometChatTheme {}` OUTSIDE the `NavHost` so all screens share the same theme
|
|
212
|
+
- Ongoing calls MUST use `CometChatOngoingCallActivity` — they cannot be a composable screen (they need a separate Activity for PiP and lifecycle)
|
|
213
|
+
- When passing User/Group objects between screens, use a cache or resolver pattern (like `master-app-jetpack/navigation/EntityCache.kt`) — do NOT serialize full objects in navigation routes
|