@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,305 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v5-customization
|
|
3
|
+
description: "Customize CometChat components beyond theming — custom message templates, DataSource decorators, event listeners, and custom view slots."
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 7.0+; Java 8+; Kotlin 1.8+; com.cometchat:chat-uikit-android:5.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory, grepSearch"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat android customization custom-view message-template datasource events"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** `cometchat-android-v5-components` provides the component
|
|
14
|
+
> catalog; `cometchat-android-v5-theming` covers visual styling;
|
|
15
|
+
> `cometchat-android-v5-extensions` covers the extension architecture.
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
This skill teaches how to customize CometChat components beyond what theming provides. It covers custom message templates, the DataSource/DataSourceDecorator pattern, ChatConfigurator, event listeners, and custom view slots.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Use this skill when
|
|
24
|
+
|
|
25
|
+
- "Customize the message list"
|
|
26
|
+
- "Add a custom message bubble"
|
|
27
|
+
- "Listen to message events"
|
|
28
|
+
- "Add a custom action to message options"
|
|
29
|
+
- "Filter conversations"
|
|
30
|
+
|
|
31
|
+
## Do not use this skill when
|
|
32
|
+
|
|
33
|
+
- Changing colors/fonts → use `cometchat-android-v5-theming`
|
|
34
|
+
- Enabling a packaged feature → use `cometchat-android-v5-features`
|
|
35
|
+
- Setting up init/login → use `cometchat-android-v5-core`
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 1. CometChatMessageTemplate
|
|
40
|
+
|
|
41
|
+
Templates define how message bubbles are rendered. Each template maps a message `type` + `category` to custom views.
|
|
42
|
+
|
|
43
|
+
**Java:**
|
|
44
|
+
```java
|
|
45
|
+
CometChatMessageTemplate template = new CometChatMessageTemplate()
|
|
46
|
+
.setType(CometChatConstants.MESSAGE_TYPE_TEXT)
|
|
47
|
+
.setCategory(CometChatConstants.CATEGORY_MESSAGE)
|
|
48
|
+
.setContentView(new MessagesViewHolderListener() {
|
|
49
|
+
@Override
|
|
50
|
+
public View createView(Context context, CometChatMessageBubble messageBubble,
|
|
51
|
+
UIKitConstants.MessageBubbleAlignment alignment) {
|
|
52
|
+
// Return your custom view
|
|
53
|
+
return LayoutInflater.from(context).inflate(R.layout.custom_text_bubble, null);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Override
|
|
57
|
+
public void bindView(Context context, View createdView, BaseMessage message,
|
|
58
|
+
UIKitConstants.MessageBubbleAlignment alignment,
|
|
59
|
+
RecyclerView.ViewHolder holder, List<BaseMessage> messageList,
|
|
60
|
+
int position) {
|
|
61
|
+
// Bind data to your custom view
|
|
62
|
+
TextView textView = createdView.findViewById(R.id.customText);
|
|
63
|
+
textView.setText(((TextMessage) message).getText());
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
.setOptions((context, baseMessage, group) -> {
|
|
67
|
+
// Return custom message options (long-press menu)
|
|
68
|
+
List<CometChatMessageOption> options = new ArrayList<>();
|
|
69
|
+
options.add(new CometChatMessageOption("custom_action", "Custom Action",
|
|
70
|
+
R.drawable.ic_custom, () -> { /* handle click */ }));
|
|
71
|
+
return options;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Apply to message list
|
|
75
|
+
messageList.setTemplates(Collections.singletonList(template));
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Kotlin:**
|
|
79
|
+
```kotlin
|
|
80
|
+
val template = CometChatMessageTemplate()
|
|
81
|
+
.setType(CometChatConstants.MESSAGE_TYPE_TEXT)
|
|
82
|
+
.setCategory(CometChatConstants.CATEGORY_MESSAGE)
|
|
83
|
+
.setContentView(object : MessagesViewHolderListener() {
|
|
84
|
+
override fun createView(context: Context, messageBubble: CometChatMessageBubble,
|
|
85
|
+
alignment: UIKitConstants.MessageBubbleAlignment): View {
|
|
86
|
+
return LayoutInflater.from(context).inflate(R.layout.custom_text_bubble, null)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override fun bindView(context: Context, createdView: View, message: BaseMessage,
|
|
90
|
+
alignment: UIKitConstants.MessageBubbleAlignment,
|
|
91
|
+
holder: RecyclerView.ViewHolder, messageList: List<BaseMessage>,
|
|
92
|
+
position: Int) {
|
|
93
|
+
val textView = createdView.findViewById<TextView>(R.id.customText)
|
|
94
|
+
textView.text = (message as TextMessage).text
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.setOptions { context, baseMessage, group ->
|
|
98
|
+
listOf(CometChatMessageOption("custom_action", "Custom Action",
|
|
99
|
+
R.drawable.ic_custom) { /* handle click */ })
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
messageList.setTemplates(listOf(template))
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Template view slots
|
|
106
|
+
|
|
107
|
+
| Slot | Method | Description |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| `bubbleView` | `setBubbleView(MessagesViewHolderListener)` | Entire message bubble |
|
|
110
|
+
| `headerView` | `setHeaderView(MessagesViewHolderListener)` | Above the bubble |
|
|
111
|
+
| `contentView` | `setContentView(MessagesViewHolderListener)` | Inside the bubble |
|
|
112
|
+
| `bottomView` | `setBottomView(MessagesViewHolderListener)` | Below the content, inside bubble |
|
|
113
|
+
| `footerView` | `setFooterView(MessagesViewHolderListener)` | Below the bubble |
|
|
114
|
+
| `statusInfoView` | `setStatusInfoView(MessagesViewHolderListener)` | Status info area |
|
|
115
|
+
| `replyView` | `setReplyView(MessagesViewHolderListener)` | Reply preview above bubble |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 2. CometChatMessageOption
|
|
120
|
+
|
|
121
|
+
Custom actions in the message long-press menu.
|
|
122
|
+
|
|
123
|
+
**Java:**
|
|
124
|
+
```java
|
|
125
|
+
CometChatMessageOption option = new CometChatMessageOption(
|
|
126
|
+
"bookmark", // unique ID
|
|
127
|
+
"Bookmark", // title
|
|
128
|
+
R.drawable.ic_bookmark, // icon
|
|
129
|
+
() -> { // onClick
|
|
130
|
+
// Handle bookmark action
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 3. DataSource and DataSourceDecorator
|
|
138
|
+
|
|
139
|
+
The `DataSource` interface defines how messages are rendered and what options are available. `DataSourceDecorator` wraps an existing DataSource to add or modify behavior without replacing it.
|
|
140
|
+
|
|
141
|
+
**Java:**
|
|
142
|
+
```java
|
|
143
|
+
public class CustomDataSource extends DataSourceDecorator {
|
|
144
|
+
public CustomDataSource(DataSource dataSource) {
|
|
145
|
+
super(dataSource);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@Override
|
|
149
|
+
public List<CometChatMessageOption> getTextMessageOptions(Context context,
|
|
150
|
+
BaseMessage baseMessage, Group group, AdditionParameter additionParameter) {
|
|
151
|
+
List<CometChatMessageOption> options = super.getTextMessageOptions(context,
|
|
152
|
+
baseMessage, group, additionParameter);
|
|
153
|
+
// Add custom option
|
|
154
|
+
options.add(new CometChatMessageOption("translate", "Translate",
|
|
155
|
+
R.drawable.ic_translate, () -> { /* translate */ }));
|
|
156
|
+
return options;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**Kotlin:**
|
|
162
|
+
```kotlin
|
|
163
|
+
class CustomDataSource(dataSource: DataSource) : DataSourceDecorator(dataSource) {
|
|
164
|
+
override fun getTextMessageOptions(context: Context, baseMessage: BaseMessage,
|
|
165
|
+
group: Group?, additionParameter: AdditionParameter): List<CometChatMessageOption> {
|
|
166
|
+
val options = super.getTextMessageOptions(context, baseMessage, group, additionParameter).toMutableList()
|
|
167
|
+
options.add(CometChatMessageOption("translate", "Translate",
|
|
168
|
+
R.drawable.ic_translate) { /* translate */ })
|
|
169
|
+
return options
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Register via ChatConfigurator
|
|
175
|
+
|
|
176
|
+
**Java:**
|
|
177
|
+
```java
|
|
178
|
+
ChatConfigurator.enable(dataSource -> new CustomDataSource(dataSource));
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Kotlin:**
|
|
182
|
+
```kotlin
|
|
183
|
+
ChatConfigurator.enable { dataSource -> CustomDataSource(dataSource) }
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 4. Event system
|
|
189
|
+
|
|
190
|
+
CometChat provides event classes for reacting to chat events. Register listeners with a unique tag.
|
|
191
|
+
|
|
192
|
+
### CometChatMessageEvents
|
|
193
|
+
|
|
194
|
+
**Java:**
|
|
195
|
+
```java
|
|
196
|
+
CometChatMessageEvents.addListener("unique-tag", new CometChatMessageEvents() {
|
|
197
|
+
@Override
|
|
198
|
+
public void ccMessageSent(BaseMessage baseMessage, int status) {
|
|
199
|
+
// Message sent
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
@Override
|
|
203
|
+
public void onTextMessageReceived(TextMessage textMessage) {
|
|
204
|
+
// Text message received
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@Override
|
|
208
|
+
public void onMessageReactionAdded(ReactionEvent reactionEvent) {
|
|
209
|
+
// Reaction added
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Remove when done
|
|
214
|
+
CometChatMessageEvents.removeListener("unique-tag");
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Kotlin:**
|
|
218
|
+
```kotlin
|
|
219
|
+
CometChatMessageEvents.addListener("unique-tag", object : CometChatMessageEvents() {
|
|
220
|
+
override fun ccMessageSent(baseMessage: BaseMessage, status: Int) {
|
|
221
|
+
// Message sent
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
override fun onTextMessageReceived(textMessage: TextMessage) {
|
|
225
|
+
// Text message received
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
override fun onMessageReactionAdded(reactionEvent: ReactionEvent) {
|
|
229
|
+
// Reaction added
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
// Remove when done
|
|
234
|
+
CometChatMessageEvents.removeListener("unique-tag")
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### CometChatUserEvents
|
|
238
|
+
|
|
239
|
+
```java
|
|
240
|
+
CometChatUserEvents.addUserListener("unique-tag", new CometChatUserEvents() {
|
|
241
|
+
@Override
|
|
242
|
+
public void ccUserBlocked(User user) { }
|
|
243
|
+
|
|
244
|
+
@Override
|
|
245
|
+
public void ccUserUnblocked(User user) { }
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### CometChatGroupEvents
|
|
250
|
+
|
|
251
|
+
```java
|
|
252
|
+
CometChatGroupEvents.addGroupListener("unique-tag", new CometChatGroupEvents() {
|
|
253
|
+
@Override
|
|
254
|
+
public void ccGroupCreated(Group group) { }
|
|
255
|
+
@Override
|
|
256
|
+
public void ccGroupDeleted(Group group) { }
|
|
257
|
+
@Override
|
|
258
|
+
public void ccGroupMemberJoined(User joinedUser, Group joinedGroup) { }
|
|
259
|
+
@Override
|
|
260
|
+
public void ccGroupMemberKicked(Action action, User kicked, User kickedBy, Group from) { }
|
|
261
|
+
@Override
|
|
262
|
+
public void ccGroupMemberBanned(Action action, User banned, User bannedBy, Group from) { }
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### CometChatCallEvents
|
|
267
|
+
|
|
268
|
+
```java
|
|
269
|
+
CometChatCallEvents.addListener("unique-tag", new CometChatCallEvents() {
|
|
270
|
+
@Override
|
|
271
|
+
public void ccOutgoingCall(Call call) { }
|
|
272
|
+
@Override
|
|
273
|
+
public void ccCallAccepted(Call call) { }
|
|
274
|
+
@Override
|
|
275
|
+
public void ccCallRejected(Call call) { }
|
|
276
|
+
@Override
|
|
277
|
+
public void ccCallEnded(Call call) { }
|
|
278
|
+
});
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 5. Custom view slots on components
|
|
284
|
+
|
|
285
|
+
Most components support custom view injection via `Function3<Context, User, Group, View>`:
|
|
286
|
+
|
|
287
|
+
```java
|
|
288
|
+
CometChatMessageHeader header = findViewById(R.id.header);
|
|
289
|
+
header.setSubtitleView((context, user, group) -> {
|
|
290
|
+
TextView subtitle = new TextView(context);
|
|
291
|
+
if (user != null) {
|
|
292
|
+
subtitle.setText(user.getStatus().equals("online") ? "Active now" : "Offline");
|
|
293
|
+
}
|
|
294
|
+
return subtitle;
|
|
295
|
+
});
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Hard rules
|
|
301
|
+
|
|
302
|
+
- **Always extend `DataSourceDecorator`, never implement `DataSource` directly.** The decorator preserves existing behavior.
|
|
303
|
+
- **Register `ChatConfigurator.enable()` AFTER `CometChatUIKit.init()` succeeds.** The configurator resets on init.
|
|
304
|
+
- **Always remove event listeners when the Activity/Fragment is destroyed.** Use `onDestroy()` or `onDestroyView()`.
|
|
305
|
+
- **Template view slots use `MessagesViewHolderListener`.** Implement both `createView()` and `bindView()`.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v5-extensions
|
|
3
|
+
description: "Extension architecture for CometChat Android — ExtensionsDataSource, decorators, built-in extensions, and how to create custom extensions."
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 7.0+; Java 8+; Kotlin 1.8+; com.cometchat:chat-uikit-android:5.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat android extensions datasource decorator polls stickers collaborative"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** `cometchat-android-v5-customization` covers DataSource decorators;
|
|
14
|
+
> `cometchat-android-v5-features` covers the feature catalog.
|
|
15
|
+
|
|
16
|
+
## Purpose
|
|
17
|
+
|
|
18
|
+
This skill covers the CometChat extension architecture — how extensions plug into the UI Kit, the built-in extensions, and how to create custom ones.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Use this skill when
|
|
23
|
+
|
|
24
|
+
- "How do extensions work?"
|
|
25
|
+
- "How do I add a custom extension?"
|
|
26
|
+
- "How do I disable an extension?"
|
|
27
|
+
- Working with `ExtensionsDataSource` or `ExtensionDecorator`
|
|
28
|
+
|
|
29
|
+
## Do not use this skill when
|
|
30
|
+
|
|
31
|
+
- Enabling a backend extension or AI feature → use `cometchat-android-v5-features` (which routes to `cometchat apply-feature <id> --app-id <X>`)
|
|
32
|
+
- Writing custom message templates → use `cometchat-android-v5-customization`
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## 1. Extension architecture
|
|
37
|
+
|
|
38
|
+
Extensions are split into two class types:
|
|
39
|
+
|
|
40
|
+
- **Registrar** classes (e.g. `PollsExtension`, `StickerExtension`) — extend `ExtensionsDataSource`. These are what you pass to `setExtensions(...)` to enable a built-in extension.
|
|
41
|
+
- **Decorator** classes (e.g. `PollsExtensionDecorator`, `StickerExtensionDecorator`) — extend `DataSourceDecorator`. These are the runtime decorators that wrap the active `DataSource` chain. The kit creates them internally; you don't construct them directly.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
ChatConfigurator.getDataSource()
|
|
45
|
+
└── SmartRepliesExtensionDecorator (created by SmartRepliesExtension)
|
|
46
|
+
└── PollsExtensionDecorator (created by PollsExtension)
|
|
47
|
+
└── StickerExtensionDecorator (created by StickerExtension)
|
|
48
|
+
└── MessagesDataSource (base)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 2. Built-in extensions
|
|
52
|
+
|
|
53
|
+
| Extension | Package | What it adds |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| Polls | `com.cometchat.chatuikit.extensions.polls` | Poll creation and voting in messages |
|
|
56
|
+
| Stickers | `com.cometchat.chatuikit.extensions.sticker` | Sticker keyboard and sticker bubbles |
|
|
57
|
+
| Collaborative Document | `com.cometchat.chatuikit.extensions.collaborative` | Shared document editing |
|
|
58
|
+
| Collaborative Whiteboard | `com.cometchat.chatuikit.extensions.collaborative` | Shared whiteboard |
|
|
59
|
+
| Smart Replies | `com.cometchat.chatuikit.extensions.smartreplies` | AI-powered reply suggestions |
|
|
60
|
+
| Message Translation | `com.cometchat.chatuikit.extensions.messagetranslation` | Translate messages |
|
|
61
|
+
| Text Moderation | `com.cometchat.chatuikit.extensions.textmoderation` | Profanity filtering |
|
|
62
|
+
| Thumbnail Generation | `com.cometchat.chatuikit.extensions.thumbnailgeneration` | Image thumbnails |
|
|
63
|
+
|
|
64
|
+
## 3. Enabling/disabling extensions
|
|
65
|
+
|
|
66
|
+
Extensions are enabled by default. To customize which extensions are active, pass a custom list to `UIKitSettingsBuilder`:
|
|
67
|
+
|
|
68
|
+
```java
|
|
69
|
+
List<ExtensionsDataSource> extensions = new ArrayList<>();
|
|
70
|
+
extensions.add(new PollsExtension()); // registrar, NOT PollsExtensionDecorator
|
|
71
|
+
extensions.add(new StickerExtension()); // registrar, NOT StickerExtensionDecorator
|
|
72
|
+
extensions.add(new SmartRepliesExtension());
|
|
73
|
+
// Omit extensions you don't want
|
|
74
|
+
|
|
75
|
+
UIKitSettings settings = new UIKitSettings.UIKitSettingsBuilder()
|
|
76
|
+
.setAppId(APP_ID)
|
|
77
|
+
.setRegion(REGION)
|
|
78
|
+
.setAuthKey(AUTH_KEY)
|
|
79
|
+
.setExtensions(extensions)
|
|
80
|
+
.build();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
> **Why not `PollsExtensionDecorator`?** `*ExtensionDecorator` extends `DataSourceDecorator`, not `ExtensionsDataSource` — so it won't compile when added to a `List<ExtensionsDataSource>`. The kit's runtime decorator chain is built by the registrar's `enable()` method internally; you don't add decorators directly.
|
|
84
|
+
|
|
85
|
+
## 4. Creating a custom extension
|
|
86
|
+
|
|
87
|
+
A custom extension has TWO classes:
|
|
88
|
+
|
|
89
|
+
1. A **registrar** that extends `ExtensionsDataSource` (gets added to `setExtensions(...)`)
|
|
90
|
+
2. A **decorator** that extends `DataSourceDecorator` (created by the registrar via `ChatConfigurator.enable(...)`)
|
|
91
|
+
|
|
92
|
+
```java
|
|
93
|
+
// 1. Decorator — extends DataSourceDecorator, overrides per-message behavior
|
|
94
|
+
public class MyExtensionDecorator extends DataSourceDecorator {
|
|
95
|
+
public MyExtensionDecorator(DataSource dataSource) {
|
|
96
|
+
super(dataSource);
|
|
97
|
+
}
|
|
98
|
+
// Override methods to add custom behavior
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 2. Registrar — extends ExtensionsDataSource, exposes getExtensionId() and enable()
|
|
102
|
+
public class MyExtension extends ExtensionsDataSource {
|
|
103
|
+
@Override
|
|
104
|
+
public String getExtensionId() {
|
|
105
|
+
return "my-custom-extension";
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@Override
|
|
109
|
+
public void enable() {
|
|
110
|
+
ChatConfigurator.enable(dataSource -> new MyExtensionDecorator(dataSource));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Then add the registrar to UIKitSettings:
|
|
115
|
+
extensions.add(new MyExtension());
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Hard rules
|
|
121
|
+
|
|
122
|
+
- **Two classes per extension.** A registrar (`ExtensionsDataSource`, holds `getExtensionId()` + `enable()`) and a decorator (`DataSourceDecorator`, holds the per-message override). `setExtensions(...)` wants registrars; the chain builds decorators automatically.
|
|
123
|
+
- **Register after init.** `ChatConfigurator.enable()` must be called after `CometChatUIKit.init()` succeeds.
|
|
124
|
+
- **Backend extension toggle still applies.** Even if an extension is registered client-side, it needs to be enabled on the app's backend. Use `cometchat apply-feature <id> --app-id <X>` (the CLI hits the dashboard API). For dashboard-only extensions (Giphy / Stipop / Tenor / Chatwoot / Intercom — those needing third-party API keys), the user has to enter the third-party config in the dashboard manually.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v5-features
|
|
3
|
+
description: "Add features (calls, reactions, polls, file sharing, AI, etc.) to an already-integrated CometChat project. Routes to the right sub-flow based on feature type."
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 7.0+; Java 8+; Kotlin 1.8+; com.cometchat:chat-uikit-android:5.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat android features extensions calls reactions polls ai-features"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** `cometchat-android-v5-core` covers initialization;
|
|
14
|
+
> `cometchat-android-v5-customization` covers deeper component customization;
|
|
15
|
+
> `cometchat-android-v5-extensions` covers the extension architecture.
|
|
16
|
+
|
|
17
|
+
## Purpose
|
|
18
|
+
|
|
19
|
+
This skill teaches how CometChat features are structured and what work is required to enable each one. Most features require zero code — they are either already built into the UI Kit, toggled via the `cometchat apply-feature` CLI (extensions + AI features), or activated by adding a dependency (calls).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Use this skill when
|
|
24
|
+
|
|
25
|
+
- "Add reactions to my chat"
|
|
26
|
+
- "Add video calling"
|
|
27
|
+
- "Enable polls"
|
|
28
|
+
- "Add file sharing"
|
|
29
|
+
- "Enable smart replies"
|
|
30
|
+
|
|
31
|
+
## Do not use this skill when
|
|
32
|
+
|
|
33
|
+
- Customizing how a feature looks → use `cometchat-android-v5-customization`
|
|
34
|
+
- Setting up the initial integration → use `cometchat-android-v5-core`
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 1. Feature types
|
|
39
|
+
|
|
40
|
+
| Type | What it means | Action required |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| Type 1 — Default | Built into the UI Kit at compile time | None — already there |
|
|
43
|
+
| Type 2a — Extension | Backend extension, pure boolean toggle | `cometchat apply-feature <id> --app-id <X>` (CLI hits dashboard API) |
|
|
44
|
+
| Type 2b — AI feature | Backend AI feature requiring an OpenAI key | `cometchat apply-feature <id> --app-id <X> --openai-key sk-...` |
|
|
45
|
+
| Type 2c — Dashboard-only | Third-party API key / multi-field config (Giphy, Stipop, Tenor, Chatwoot, Intercom) | Open https://app.cometchat.com → Extensions → configure |
|
|
46
|
+
| Type 3 — Package-install | Requires a separate SDK dependency | Add Gradle dependency |
|
|
47
|
+
| Type 4 — Component-toggle | Hide/show via `setHide*` / `disable*` methods on the relevant component | Call the setter on the component instance (see catalog) |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 2. Type 1 — Default features (already enabled)
|
|
52
|
+
|
|
53
|
+
| Feature | Component | Notes |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| Text messaging | `CometChatMessageComposer` + `CometChatMessageList` | Core feature |
|
|
56
|
+
| Media sharing (image/video/audio/file) | `CometChatMessageComposer` | Attachment button |
|
|
57
|
+
| Read receipts | `CometChatMessageList` | `setReceiptsVisibility()` |
|
|
58
|
+
| Typing indicators | `CometChatMessageList` + `CometChatConversations` | Auto-enabled |
|
|
59
|
+
| User presence (online/offline) | `CometChatConversations`, `CometChatUsers` | Requires `subscribePresenceForAllUsers()` in init |
|
|
60
|
+
| Reactions | `CometChatMessageList` | Long-press message → react |
|
|
61
|
+
| Mentions (@user, @all) | `CometChatMessageComposer` | Type `@` to trigger |
|
|
62
|
+
| Threaded conversations | `CometChatMessageList` | `setReplyInThreadOptionVisibility()` |
|
|
63
|
+
| Quoted replies | `CometChatMessageList` | Swipe to reply |
|
|
64
|
+
| Edit/delete messages | `CometChatMessageList` | Long-press options |
|
|
65
|
+
| Group chat | All components | Use `setGroup()` instead of `setUser()` |
|
|
66
|
+
| Report message | `CometChatMessageList` | Long-press → Report |
|
|
67
|
+
| Search | `CometChatSearch` | Standalone component |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 3. Type 2 — Backend toggle features (no code needed)
|
|
72
|
+
|
|
73
|
+
Android projects don't run `cometchat apply`, so call the CLI in stateless mode with `--app-id`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Pure boolean extensions:
|
|
77
|
+
cometchat apply-feature polls --app-id <your-app-id>
|
|
78
|
+
cometchat apply-feature stickers --app-id <your-app-id>
|
|
79
|
+
|
|
80
|
+
# AI features (require OpenAI key):
|
|
81
|
+
cometchat apply-feature smart-replies --app-id <your-app-id> --openai-key sk-...
|
|
82
|
+
cometchat apply-feature conversation-summary --app-id <your-app-id>
|
|
83
|
+
cometchat apply-feature conversation-starter --app-id <your-app-id>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Requires `cometchat auth login` once per machine.
|
|
87
|
+
|
|
88
|
+
**Extensions (CLI-toggleable — pure boolean):**
|
|
89
|
+
- User Engagement: Polls, Message Translation, Reminders
|
|
90
|
+
- Collaboration: Collaborative Document, Collaborative Whiteboard
|
|
91
|
+
- Security: Disappearing Messages, E2E Encryption (Enterprise)
|
|
92
|
+
- Moderation: Profanity Filter, Image Moderation, Data Masking, Sentiment Analysis, XSS Filter
|
|
93
|
+
|
|
94
|
+
**AI Features (CLI-toggleable — needs `--openai-key`):**
|
|
95
|
+
Conversation Starter, Conversation Summary, Smart Reply
|
|
96
|
+
|
|
97
|
+
**Dashboard-only (third-party config — open https://app.cometchat.com → Extensions):**
|
|
98
|
+
Stickers (Stipop), Giphy, Tenor, Chatwoot, Intercom — these require API keys / webhooks the user must enter manually.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 4. Type 3 — Package-install features
|
|
103
|
+
|
|
104
|
+
### Voice/Video Calling
|
|
105
|
+
|
|
106
|
+
Add the calling SDK:
|
|
107
|
+
|
|
108
|
+
```groovy
|
|
109
|
+
implementation 'com.cometchat:calls-sdk-android:4.+'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The UI Kit auto-detects the calling SDK and enables call buttons in `CometChatMessageHeader`. No additional code needed — `CometChatIncomingCall`, `CometChatOutgoingCall`, and `CometChatOngoingCall` activate automatically.
|
|
113
|
+
|
|
114
|
+
Configure call buttons visibility:
|
|
115
|
+
|
|
116
|
+
```java
|
|
117
|
+
CometChatMessageHeader header = findViewById(R.id.header);
|
|
118
|
+
header.setVoiceCallButtonVisibility(View.VISIBLE);
|
|
119
|
+
header.setVideoCallButtonVisibility(View.VISIBLE);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Hard rules
|
|
125
|
+
|
|
126
|
+
- **Don't write code for Type 1 features.** They're already there. Tell the user where to find them.
|
|
127
|
+
- **Don't write code for Type 2a/2b features.** Run `cometchat apply-feature <id> --app-id <X>` (extension) or `... --openai-key sk-...` (ai-feature). The CLI flips the dashboard toggle via API. Never tell the user to "open the dashboard and toggle X" for an extension or ai-feature — that's what the CLI does.
|
|
128
|
+
- **For Type 2c (dashboard-only) features**, the CLI cannot automate (third-party keys / multi-field config). Walk the user through the dashboard path returned by `cometchat apply-feature <id>`'s `manual-action-required` response.
|
|
129
|
+
- **For Type 3 (calls), just add the Gradle dependency.** The UI Kit handles the rest.
|
|
130
|
+
- **Always run `cometchat apply-feature <id>` first** for extensions and AI features. If the user reports a "missing feature," it's almost always an unflipped toggle the CLI can fix in one call.
|