@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,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-compose-theming
|
|
3
|
+
description: "CometChat Android UIKit v6 Jetpack Compose theming — CometChatTheme, CompositionLocal color schemes, typography, shapes, and dark mode"
|
|
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, theming, colors, typography, dark-mode"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-kotlin-theming (Views equivalent), cometchat-android-v6-compose-components, cometchat-android-v6-compose-customization
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Apply and customize the CometChat theme in Jetpack Compose — color schemes, typography, shapes, dark mode, and per-component style overrides using the `CompositionLocal`-based theme system.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Wrapping CometChat components in `CometChatTheme {}`
|
|
22
|
+
- Changing the primary color or color scheme
|
|
23
|
+
- Implementing dark mode support
|
|
24
|
+
- Customizing typography or shapes
|
|
25
|
+
- Accessing theme tokens in custom composables
|
|
26
|
+
|
|
27
|
+
## Do not use this skill when
|
|
28
|
+
|
|
29
|
+
- Working with Kotlin Views theming (use `cometchat-android-v6-kotlin-theming`)
|
|
30
|
+
- Customizing bubble rendering (use `cometchat-android-v6-compose-customization`)
|
|
31
|
+
|
|
32
|
+
## 1. CometChatTheme Wrapper
|
|
33
|
+
|
|
34
|
+
All CometChat Compose components must be wrapped in `CometChatTheme {}`:
|
|
35
|
+
|
|
36
|
+
```kotlin
|
|
37
|
+
import com.cometchat.uikit.compose.theme.CometChatTheme
|
|
38
|
+
|
|
39
|
+
setContent {
|
|
40
|
+
CometChatTheme {
|
|
41
|
+
// CometChat components go here
|
|
42
|
+
CometChatConversations()
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`CometChatTheme` is a composable that provides theme values via `CompositionLocalProvider`:
|
|
48
|
+
- `LocalColorScheme` → `CometChatColorScheme`
|
|
49
|
+
- `LocalTypography` → `CometChatTypography`
|
|
50
|
+
- `LocalShapes` → `Shapes`
|
|
51
|
+
|
|
52
|
+
## 2. Color Scheme
|
|
53
|
+
|
|
54
|
+
### 2.1 Default Light/Dark Schemes
|
|
55
|
+
|
|
56
|
+
```kotlin
|
|
57
|
+
import com.cometchat.uikit.compose.theme.*
|
|
58
|
+
|
|
59
|
+
// Light mode (default)
|
|
60
|
+
CometChatTheme(colorScheme = lightColorScheme()) {
|
|
61
|
+
// ...
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Dark mode
|
|
65
|
+
CometChatTheme(colorScheme = darkColorScheme()) {
|
|
66
|
+
// ...
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Auto based on system setting
|
|
70
|
+
CometChatTheme(
|
|
71
|
+
colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
|
|
72
|
+
) {
|
|
73
|
+
// ...
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 2.2 Custom Primary Color
|
|
78
|
+
|
|
79
|
+
```kotlin
|
|
80
|
+
CometChatTheme(
|
|
81
|
+
colorScheme = lightColorScheme(primary = Color(0xFF6851D6))
|
|
82
|
+
) {
|
|
83
|
+
// All extended primary colors (50-900) auto-generate from the primary
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2.3 CometChatColorScheme Token Reference
|
|
88
|
+
|
|
89
|
+
The `CometChatColorScheme` class contains these token groups:
|
|
90
|
+
|
|
91
|
+
**Primary Colors:**
|
|
92
|
+
- `primary` — Main brand color
|
|
93
|
+
|
|
94
|
+
**Extended Primary (auto-generated from primary):**
|
|
95
|
+
- `extendedPrimaryColor50` through `extendedPrimaryColor900` — 10 shades blended with white (light) or black (dark)
|
|
96
|
+
|
|
97
|
+
**Neutral Colors:**
|
|
98
|
+
- `neutralColor50` through `neutralColor900` — 10 neutral shades
|
|
99
|
+
|
|
100
|
+
**Alert Colors:**
|
|
101
|
+
- `infoColor`, `successColor`, `warningColor`, `errorColor`, `messageReadColor`
|
|
102
|
+
|
|
103
|
+
**Background Colors:**
|
|
104
|
+
- `backgroundColor1` (lightest) through `backgroundColor4` (darkest)
|
|
105
|
+
|
|
106
|
+
**Stroke/Border Colors:**
|
|
107
|
+
- `strokeColorDefault`, `strokeColorLight`, `strokeColorDark`, `strokeColorHighlight`
|
|
108
|
+
- Aliases: `borderColorLight`, `borderColorDefault`, `borderColorDark`, `borderColorHighlight`
|
|
109
|
+
|
|
110
|
+
**Text Colors:**
|
|
111
|
+
- `textColorPrimary`, `textColorSecondary`, `textColorTertiary`, `textColorDisabled`, `textColorWhite`, `textColorHighlight`
|
|
112
|
+
|
|
113
|
+
**Icon Tint Colors:**
|
|
114
|
+
- `iconTintPrimary`, `iconTintSecondary`, `iconTintTertiary`, `iconTintWhite`, `iconTintHighlight`
|
|
115
|
+
|
|
116
|
+
**Button Colors:**
|
|
117
|
+
- `primaryButtonBackgroundColor`, `primaryButtonIconTint`, `primaryButtonTextColor`
|
|
118
|
+
- `secondaryButtonBackgroundColor`, `secondaryButtonIconTint`, `secondaryButtonTextColor`
|
|
119
|
+
- `linkButtonColor`, `fabButtonBackgroundColor`, `fabButtonIconTint`, `whiteButtonPressed`
|
|
120
|
+
|
|
121
|
+
**Static Colors:**
|
|
122
|
+
- `colorWhite`, `colorBlack`
|
|
123
|
+
|
|
124
|
+
### 2.4 Fully Custom Color Scheme
|
|
125
|
+
|
|
126
|
+
```kotlin
|
|
127
|
+
val customScheme = lightColorScheme(
|
|
128
|
+
primary = Color(0xFF6851D6),
|
|
129
|
+
neutralColor50 = Color(0xFFFAFAFA),
|
|
130
|
+
neutralColor900 = Color(0xFF141414),
|
|
131
|
+
errorColor = Color(0xFFFF3B30),
|
|
132
|
+
successColor = Color(0xFF34C759),
|
|
133
|
+
// ... override any token
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
CometChatTheme(colorScheme = customScheme) {
|
|
137
|
+
// ...
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## 3. Typography
|
|
142
|
+
|
|
143
|
+
```kotlin
|
|
144
|
+
// Access typography in composables
|
|
145
|
+
val style: TextStyle = CometChatTheme.typography.heading1Bold
|
|
146
|
+
val bodyStyle: TextStyle = CometChatTheme.typography.bodyRegular
|
|
147
|
+
val titleStyle: TextStyle = CometChatTheme.typography.titleRegular
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Custom typography:
|
|
151
|
+
|
|
152
|
+
```kotlin
|
|
153
|
+
CometChatTheme(
|
|
154
|
+
typography = CometChatTypography(/* custom TextStyles */)
|
|
155
|
+
) {
|
|
156
|
+
// ...
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## 4. Shapes
|
|
161
|
+
|
|
162
|
+
```kotlin
|
|
163
|
+
// Access shapes
|
|
164
|
+
val shapes: Shapes = CometChatTheme.shapes
|
|
165
|
+
|
|
166
|
+
// Custom shapes
|
|
167
|
+
CometChatTheme(
|
|
168
|
+
shapes = Shapes(/* custom corner radii */)
|
|
169
|
+
) {
|
|
170
|
+
// ...
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## 5. Accessing Theme in Custom Composables
|
|
175
|
+
|
|
176
|
+
```kotlin
|
|
177
|
+
@Composable
|
|
178
|
+
fun MyCustomView() {
|
|
179
|
+
val colors = CometChatTheme.colorScheme
|
|
180
|
+
val typography = CometChatTheme.typography
|
|
181
|
+
|
|
182
|
+
Text(
|
|
183
|
+
text = "Hello",
|
|
184
|
+
color = colors.textColorPrimary,
|
|
185
|
+
style = typography.bodyRegular
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
Box(
|
|
189
|
+
modifier = Modifier.background(colors.backgroundColor1)
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## 6. Extended Primary Color Generation
|
|
195
|
+
|
|
196
|
+
Extended primary colors are auto-generated by blending the primary color with white (light mode) or black (dark mode):
|
|
197
|
+
|
|
198
|
+
```kotlin
|
|
199
|
+
// Light mode: primary blended with white at various percentages
|
|
200
|
+
// extendedPrimaryColor50 = blend(primary, white, 0.96) // lightest
|
|
201
|
+
// extendedPrimaryColor500 = blend(primary, white, 0.44) // mid
|
|
202
|
+
// extendedPrimaryColor900 = blend(primary, black, 0.08) // darkest
|
|
203
|
+
|
|
204
|
+
// Dark mode: primary blended with black at various percentages
|
|
205
|
+
// extendedPrimaryColor50 = blend(primary, black, 0.80) // lightest
|
|
206
|
+
// extendedPrimaryColor900 = blend(primary, white, 0.11) // lightest in dark
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
You can override individual extended colors:
|
|
210
|
+
|
|
211
|
+
```kotlin
|
|
212
|
+
lightColorScheme(
|
|
213
|
+
primary = Color(0xFF6851D6),
|
|
214
|
+
extendedPrimaryColor500 = Color(0xFF9B8AE0) // manual override
|
|
215
|
+
)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Hard rules
|
|
219
|
+
|
|
220
|
+
- ALWAYS wrap CometChat Compose components in `CometChatTheme {}` — components will crash or look wrong without it
|
|
221
|
+
- NEVER use Material `MaterialTheme` tokens inside CometChat components — use `CometChatTheme.colorScheme` / `.typography` / `.shapes`
|
|
222
|
+
- `CometChatTheme` does NOT extend `MaterialTheme` — they are separate theme systems
|
|
223
|
+
- When overriding just the primary color, extended primary colors auto-regenerate — you don't need to set all 10 shades
|
|
224
|
+
- `lightColorScheme()` and `darkColorScheme()` are factory functions, not data class constructors — use named parameters to override specific tokens
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-core
|
|
3
|
+
description: "CometChat Android UIKit v6 core setup — Gradle dependencies, SDK initialization, login/logout, and message sending"
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x / com.cometchat:chatuikit-kotlin-android:6.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.1"
|
|
10
|
+
tags: "cometchat, android, init, login, gradle, setup, core"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat (dispatcher), cometchat-android-v6-builder-settings (detailed UIKitSettings config), cometchat-android-v6-events (event system)
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Set up CometChat Android UIKit v6 in a project: add Gradle dependencies, initialize the SDK, authenticate users, and send messages. This skill covers the shared `chatuikit-core` module that both Kotlin Views and Jetpack Compose stacks depend on.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Adding CometChat to a new Android project
|
|
22
|
+
- Setting up Gradle dependencies for CometChat UIKit v6
|
|
23
|
+
- Initializing the CometChat SDK
|
|
24
|
+
- Implementing login, logout, or user creation
|
|
25
|
+
- Sending text, media, or custom messages via `CometChatUIKit`
|
|
26
|
+
|
|
27
|
+
## Do not use this skill when
|
|
28
|
+
|
|
29
|
+
- Configuring `UIKitSettings` in detail (use `cometchat-android-v6-builder-settings`)
|
|
30
|
+
- Working with UI components (use `cometchat-android-v6-kotlin-components` or `cometchat-android-v6-compose-components`)
|
|
31
|
+
- Handling events (use `cometchat-android-v6-events`)
|
|
32
|
+
|
|
33
|
+
## 1. Gradle Setup
|
|
34
|
+
|
|
35
|
+
### 1.1 Add the CometChat Maven Repository
|
|
36
|
+
|
|
37
|
+
In `settings.gradle` or `settings.gradle.kts`:
|
|
38
|
+
|
|
39
|
+
```kotlin
|
|
40
|
+
dependencyResolutionManagement {
|
|
41
|
+
repositories {
|
|
42
|
+
google()
|
|
43
|
+
mavenCentral()
|
|
44
|
+
maven { url = uri("https://dl.cloudsmith.io/public/cometchat/cometchat/maven/") }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 1.2 Add Dependencies
|
|
50
|
+
|
|
51
|
+
Choose the stack you need in your module's `build.gradle.kts`:
|
|
52
|
+
|
|
53
|
+
```kotlin
|
|
54
|
+
// Jetpack Compose stack (includes core transitively)
|
|
55
|
+
implementation("com.cometchat:chatuikit-compose-android:6.0.0-beta2")
|
|
56
|
+
|
|
57
|
+
// Kotlin Views stack (includes core transitively)
|
|
58
|
+
implementation("com.cometchat:chatuikit-kotlin-android:6.0.0-beta2")
|
|
59
|
+
|
|
60
|
+
// Core only (no UI — for shared modules or custom UI)
|
|
61
|
+
implementation("com.cometchat:chatuikit-core-android:6.0.0-beta2")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 1.3 SDK Requirements
|
|
65
|
+
|
|
66
|
+
```kotlin
|
|
67
|
+
android {
|
|
68
|
+
compileSdk = 36
|
|
69
|
+
defaultConfig {
|
|
70
|
+
minSdk = 28
|
|
71
|
+
}
|
|
72
|
+
compileOptions {
|
|
73
|
+
sourceCompatibility = JavaVersion.VERSION_11
|
|
74
|
+
targetCompatibility = JavaVersion.VERSION_11
|
|
75
|
+
}
|
|
76
|
+
kotlinOptions {
|
|
77
|
+
jvmTarget = "11"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 1.3a AndroidX + Jetifier (REQUIRED — non-negotiable)
|
|
83
|
+
|
|
84
|
+
The CometChat Chat SDK transitively depends on the legacy `com.android.support:support-compat` library. Modern Android Studio projects (Arctic Fox+) default to `androidx.core` instead. Without Jetifier, Gradle sees the same classes (`android.support.v4.os.ResultReceiver`, etc.) declared in both libraries and fails the build with:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
Duplicate class android.support.v4.os.ResultReceiver$1 found in modules
|
|
88
|
+
core-1.16.0.aar -> core-1.16.0-runtime (androidx.core:core:1.16.0)
|
|
89
|
+
and support-compat-26.1.0.aar -> support-compat-26.1.0-runtime
|
|
90
|
+
(com.android.support:support-compat:26.1.0)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Add these two lines to `gradle.properties` at the project root** before any UI Kit code is wired in:
|
|
94
|
+
|
|
95
|
+
```properties
|
|
96
|
+
android.useAndroidX=true
|
|
97
|
+
android.enableJetifier=true
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Both are **mandatory**. Jetifier rewrites the legacy `android.support.*` references in the CometChat SDK's transitive deps to their `androidx.*` equivalents at build time, so the duplicate-class error doesn't happen.
|
|
101
|
+
|
|
102
|
+
A freshly-created Android Studio project usually has `android.useAndroidX=true` already (Arctic Fox+) but **Jetifier is OFF by default** since it's deprecated in newer SDK landscapes. Both V5 and V6 CometChat SDKs still need it. If `gradle.properties` doesn't have either line, append both. If it has `useAndroidX=true` but no Jetifier line, add the Jetifier line. Idempotent.
|
|
103
|
+
|
|
104
|
+
### 1.3b Annotation library exclude (REQUIRED — non-negotiable)
|
|
105
|
+
|
|
106
|
+
The CometChat Chat SDK transitively depends on `org.jetbrains:annotations-java5:17.0.0`, which collides with Kotlin stdlib's `org.jetbrains:annotations:23.0.0` and fails the build with:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
Duplicate class org.jetbrains.annotations.ApiStatus$* found in modules
|
|
110
|
+
annotations-23.0.0 (org.jetbrains:annotations:23.0.0)
|
|
111
|
+
and annotations-java5-17.0.0 (org.jetbrains:annotations-java5:17.0.0)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Add this block to `app/build.gradle.kts`** at the top level (sibling of the `android { }` and `dependencies { }` blocks), before any UI Kit code is wired in:
|
|
115
|
+
|
|
116
|
+
```kotlin
|
|
117
|
+
configurations.all {
|
|
118
|
+
// CometChat SDK transitively pulls org.jetbrains:annotations-java5:17.0.0,
|
|
119
|
+
// which collides with Kotlin stdlib's org.jetbrains:annotations:23.0.0.
|
|
120
|
+
exclude(group = "org.jetbrains", module = "annotations-java5")
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This is mandatory for both V5 and V6, both Compose and Kotlin Views. Idempotent — if the block already exists, leave it.
|
|
125
|
+
|
|
126
|
+
### 1.4 Credentials → `local.properties` → `BuildConfig`
|
|
127
|
+
|
|
128
|
+
V6 has no runtime `.env` lookup; credentials are injected at compile time as `BuildConfig` fields. Do NOT hardcode App ID / Region / Auth Key in source files.
|
|
129
|
+
|
|
130
|
+
**Step 1.** Put credentials in `local.properties` (project root, gitignored by default in every Android Studio template):
|
|
131
|
+
|
|
132
|
+
```properties
|
|
133
|
+
cometchat.appId=<APP_ID>
|
|
134
|
+
cometchat.region=<REGION>
|
|
135
|
+
cometchat.authKey=<AUTH_KEY>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Step 2.** In `app/build.gradle.kts`, read those properties and surface them as `BuildConfig` fields:
|
|
139
|
+
|
|
140
|
+
```kotlin
|
|
141
|
+
import java.util.Properties
|
|
142
|
+
|
|
143
|
+
val localProps = Properties().apply {
|
|
144
|
+
val f = rootProject.file("local.properties")
|
|
145
|
+
if (f.exists()) f.inputStream().use { load(it) }
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
android {
|
|
149
|
+
defaultConfig {
|
|
150
|
+
buildConfigField("String", "COMETCHAT_APP_ID", "\"${localProps.getProperty("cometchat.appId", "")}\"")
|
|
151
|
+
buildConfigField("String", "COMETCHAT_REGION", "\"${localProps.getProperty("cometchat.region", "")}\"")
|
|
152
|
+
buildConfigField("String", "COMETCHAT_AUTH_KEY", "\"${localProps.getProperty("cometchat.authKey", "")}\"")
|
|
153
|
+
}
|
|
154
|
+
buildFeatures { buildConfig = true }
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Step 3.** In code, read `BuildConfig.COMETCHAT_APP_ID` etc.:
|
|
159
|
+
|
|
160
|
+
```kotlin
|
|
161
|
+
val settings = UIKitSettings.UIKitSettingsBuilder()
|
|
162
|
+
.setAppId(BuildConfig.COMETCHAT_APP_ID)
|
|
163
|
+
.setRegion(BuildConfig.COMETCHAT_REGION)
|
|
164
|
+
.setAuthKey(BuildConfig.COMETCHAT_AUTH_KEY) // dev only — drop for production
|
|
165
|
+
.build()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
If `npx @cometchat/skills-cli provision setup --framework android` ran first, it wrote a `.env` as a credentials handoff. Migrate those values into `local.properties` (above) and delete the `.env` — Android won't read it at runtime.
|
|
169
|
+
|
|
170
|
+
## 2. SDK Initialization
|
|
171
|
+
|
|
172
|
+
Initialize once in your `Application` class or splash screen — never in every Activity.
|
|
173
|
+
|
|
174
|
+
```kotlin
|
|
175
|
+
import com.cometchat.uikit.core.CometChatUIKit
|
|
176
|
+
import com.cometchat.uikit.core.UIKitSettings
|
|
177
|
+
import com.cometchat.chat.core.CometChat
|
|
178
|
+
import com.cometchat.chat.exceptions.CometChatException
|
|
179
|
+
|
|
180
|
+
val settings = UIKitSettings.UIKitSettingsBuilder()
|
|
181
|
+
.setAppId("YOUR_APP_ID")
|
|
182
|
+
.setRegion("us") // "us" or "eu"
|
|
183
|
+
.setAuthKey("YOUR_AUTH_KEY") // dev only — use token auth in production
|
|
184
|
+
.build()
|
|
185
|
+
|
|
186
|
+
CometChatUIKit.init(context, settings, object : CometChat.CallbackListener<String>() {
|
|
187
|
+
override fun onSuccess(result: String) {
|
|
188
|
+
// SDK ready — proceed to login
|
|
189
|
+
}
|
|
190
|
+
override fun onError(e: CometChatException) {
|
|
191
|
+
// Handle initialization error
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
For calling features, enable them in settings:
|
|
197
|
+
|
|
198
|
+
```kotlin
|
|
199
|
+
val settings = UIKitSettings.UIKitSettingsBuilder()
|
|
200
|
+
.setAppId("YOUR_APP_ID")
|
|
201
|
+
.setRegion("us")
|
|
202
|
+
.setAuthKey("YOUR_AUTH_KEY")
|
|
203
|
+
.setEnableCalling(true) // Auto-initializes CometChatCalls SDK
|
|
204
|
+
.build()
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
See `cometchat-android-v6-builder-settings` for all `UIKitSettingsBuilder` options.
|
|
208
|
+
|
|
209
|
+
## 3. Authentication
|
|
210
|
+
|
|
211
|
+
### 3.1 Login with UID (Development Only)
|
|
212
|
+
|
|
213
|
+
```kotlin
|
|
214
|
+
CometChatUIKit.login("user_uid", object : CometChat.CallbackListener<User>() {
|
|
215
|
+
override fun onSuccess(user: User) {
|
|
216
|
+
// User logged in — show chat UI
|
|
217
|
+
}
|
|
218
|
+
override fun onError(e: CometChatException) {
|
|
219
|
+
// Handle login error
|
|
220
|
+
}
|
|
221
|
+
})
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 3.2 Login with Auth Token (Production)
|
|
225
|
+
|
|
226
|
+
```kotlin
|
|
227
|
+
CometChatUIKit.loginWithAuthToken("auth_token_from_server",
|
|
228
|
+
object : CometChat.CallbackListener<User>() {
|
|
229
|
+
override fun onSuccess(user: User) {
|
|
230
|
+
// User logged in
|
|
231
|
+
}
|
|
232
|
+
override fun onError(e: CometChatException) {
|
|
233
|
+
// Handle error
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 3.3 Logout
|
|
240
|
+
|
|
241
|
+
```kotlin
|
|
242
|
+
CometChatUIKit.logout(object : CometChat.CallbackListener<String>() {
|
|
243
|
+
override fun onSuccess(message: String) {
|
|
244
|
+
// User logged out — navigate to login screen
|
|
245
|
+
}
|
|
246
|
+
override fun onError(e: CometChatException) {
|
|
247
|
+
// Handle error
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### 3.4 Create User
|
|
253
|
+
|
|
254
|
+
```kotlin
|
|
255
|
+
val user = User().apply {
|
|
256
|
+
uid = "new_user_uid"
|
|
257
|
+
name = "New User"
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
CometChatUIKit.createUser(user, object : CometChat.CallbackListener<User>() {
|
|
261
|
+
override fun onSuccess(createdUser: User) {
|
|
262
|
+
// User created — now login
|
|
263
|
+
}
|
|
264
|
+
override fun onError(e: CometChatException) {
|
|
265
|
+
// Handle error
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## 4. Utility Methods
|
|
271
|
+
|
|
272
|
+
```kotlin
|
|
273
|
+
// Check if SDK is initialized
|
|
274
|
+
val isReady = CometChatUIKit.isSDKInitialized()
|
|
275
|
+
|
|
276
|
+
// Check if Calls SDK is initialized (only if enableCalling = true)
|
|
277
|
+
val callsReady = CometChatUIKit.isCallsSDKInitialized()
|
|
278
|
+
|
|
279
|
+
// Get currently logged-in user (null if not logged in)
|
|
280
|
+
val currentUser: User? = CometChatUIKit.getLoggedInUser()
|
|
281
|
+
|
|
282
|
+
// Get current auth settings
|
|
283
|
+
val authSettings: UIKitSettings? = CometChatUIKit.getAuthSettings()
|
|
284
|
+
|
|
285
|
+
// Get conversation update settings
|
|
286
|
+
val convSettings = CometChatUIKit.getConversationUpdateSettings()
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 5. Sending Messages
|
|
290
|
+
|
|
291
|
+
`CometChatUIKit` provides convenience methods that automatically emit events via `CometChatEvents`:
|
|
292
|
+
|
|
293
|
+
### 5.1 Text Message
|
|
294
|
+
|
|
295
|
+
```kotlin
|
|
296
|
+
val textMessage = TextMessage("receiver_uid", "Hello!", CometChatConstants.RECEIVER_TYPE_USER)
|
|
297
|
+
|
|
298
|
+
CometChatUIKit.sendTextMessage(textMessage, object : CometChat.CallbackListener<TextMessage>() {
|
|
299
|
+
override fun onSuccess(message: TextMessage) {
|
|
300
|
+
// Message sent
|
|
301
|
+
}
|
|
302
|
+
override fun onError(e: CometChatException) {
|
|
303
|
+
// Handle error
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 5.2 Media Message
|
|
309
|
+
|
|
310
|
+
```kotlin
|
|
311
|
+
val mediaMessage = MediaMessage(
|
|
312
|
+
"receiver_uid",
|
|
313
|
+
file, // java.io.File
|
|
314
|
+
CometChatConstants.MESSAGE_TYPE_IMAGE,
|
|
315
|
+
CometChatConstants.RECEIVER_TYPE_USER
|
|
316
|
+
)
|
|
317
|
+
|
|
318
|
+
CometChatUIKit.sendMediaMessage(mediaMessage, object : CometChat.CallbackListener<MediaMessage>() {
|
|
319
|
+
override fun onSuccess(message: MediaMessage) { }
|
|
320
|
+
override fun onError(e: CometChatException) { }
|
|
321
|
+
})
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### 5.3 Custom Message
|
|
325
|
+
|
|
326
|
+
```kotlin
|
|
327
|
+
val customMessage = CustomMessage(
|
|
328
|
+
"receiver_uid",
|
|
329
|
+
CometChatConstants.RECEIVER_TYPE_USER,
|
|
330
|
+
"custom_type",
|
|
331
|
+
JSONObject().put("key", "value")
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
CometChatUIKit.sendCustomMessage(customMessage, object : CometChat.CallbackListener<CustomMessage>() {
|
|
335
|
+
override fun onSuccess(message: CustomMessage) { }
|
|
336
|
+
override fun onError(e: CometChatException) { }
|
|
337
|
+
})
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
All send methods automatically:
|
|
341
|
+
1. Set `sender`, `muid`, and `sentAt` if not already set
|
|
342
|
+
2. Emit `CometChatMessageEvent.MessageSent` with `IN_PROGRESS` status
|
|
343
|
+
3. On success: emit with `SUCCESS` status
|
|
344
|
+
4. On error: embed error in metadata and emit with `ERROR` status
|
|
345
|
+
|
|
346
|
+
## Hard rules
|
|
347
|
+
|
|
348
|
+
- NEVER call `CometChatUIKit.init()` in every Activity — call it once in `Application.onCreate()` or a splash screen
|
|
349
|
+
- NEVER ship `authKey` in production builds — use `loginWithAuthToken()` with server-generated tokens
|
|
350
|
+
- ALWAYS check `isSDKInitialized()` before making SDK calls if initialization might not have completed
|
|
351
|
+
- `minSdk` must be 28 or higher — v6 does not support lower API levels
|
|
352
|
+
- `compileSdk` should be 36 for full compatibility
|
|
353
|
+
- Both UI stacks depend on `chatuikit-core` transitively — do NOT add core as a separate dependency when using a UI stack
|
|
354
|
+
- `gradle.properties` MUST contain `android.useAndroidX=true` AND `android.enableJetifier=true` — see § 1.3a. Without Jetifier, the build fails with "Duplicate class android.support.v4.os.ResultReceiver$1" because the CometChat SDK's transitive `com.android.support:support-compat` collides with `androidx.core` in any modern Android Studio project
|