@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,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-kotlin-placement
|
|
3
|
+
description: "CometChat Android UIKit v6 Kotlin Views placement — Activity, Fragment, BottomSheet, Tab, and Intent navigation patterns"
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; 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, kotlin-views, placement, activity, fragment, navigation, tabs"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-compose-placement (Compose equivalent), cometchat-android-v6-kotlin-components, cometchat-android-v6-kotlin-theming
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Place CometChat Kotlin Views components into Activities, Fragments, BottomSheets, and Tab layouts. Patterns derived from `master-app-kotlin`.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Adding CometChat Views to an Activity or Fragment
|
|
22
|
+
- Setting up Intent-based navigation between chat screens
|
|
23
|
+
- Building a tabbed layout with Conversations, Users, Groups, Calls tabs
|
|
24
|
+
- Showing CometChat components in BottomSheets or Dialogs
|
|
25
|
+
|
|
26
|
+
## Do not use this skill when
|
|
27
|
+
|
|
28
|
+
- Working with Compose placement (use `cometchat-android-v6-compose-placement`)
|
|
29
|
+
- Looking up component APIs (use `cometchat-android-v6-kotlin-components`)
|
|
30
|
+
|
|
31
|
+
## 1. Activity-Based Placement
|
|
32
|
+
|
|
33
|
+
### 1.1 Conversations Activity
|
|
34
|
+
|
|
35
|
+
```kotlin
|
|
36
|
+
class ConversationsActivity : AppCompatActivity() {
|
|
37
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
38
|
+
super.onCreate(savedInstanceState)
|
|
39
|
+
|
|
40
|
+
val conversations = CometChatConversations(this)
|
|
41
|
+
conversations.setOnItemClick { conversation ->
|
|
42
|
+
val intent = Intent(this, MessagesActivity::class.java)
|
|
43
|
+
// Pass user or group via intent extras
|
|
44
|
+
startActivity(intent)
|
|
45
|
+
}
|
|
46
|
+
setContentView(conversations)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 1.2 Messages Activity
|
|
52
|
+
|
|
53
|
+
Pattern from `master-app-kotlin/appflow/MessagesActivity.kt`:
|
|
54
|
+
|
|
55
|
+
```kotlin
|
|
56
|
+
class MessagesActivity : AppCompatActivity() {
|
|
57
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
58
|
+
super.onCreate(savedInstanceState)
|
|
59
|
+
setContentView(R.layout.activity_messages)
|
|
60
|
+
|
|
61
|
+
val header = findViewById<CometChatMessageHeader>(R.id.messageHeader)
|
|
62
|
+
val messageList = findViewById<CometChatMessageList>(R.id.messageList)
|
|
63
|
+
val composer = findViewById<CometChatMessageComposer>(R.id.messageComposer)
|
|
64
|
+
|
|
65
|
+
// Set user or group
|
|
66
|
+
header.setUser(user)
|
|
67
|
+
messageList.setUser(user)
|
|
68
|
+
composer.setUser(user)
|
|
69
|
+
|
|
70
|
+
// For groups:
|
|
71
|
+
// header.setGroup(group)
|
|
72
|
+
// messageList.setGroup(group)
|
|
73
|
+
// composer.setGroup(group)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
XML layout:
|
|
79
|
+
|
|
80
|
+
```xml
|
|
81
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
82
|
+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
83
|
+
android:layout_width="match_parent"
|
|
84
|
+
android:layout_height="match_parent"
|
|
85
|
+
android:orientation="vertical">
|
|
86
|
+
|
|
87
|
+
<com.cometchat.uikit.kotlin.presentation.messageheader.ui.CometChatMessageHeader
|
|
88
|
+
android:id="@+id/messageHeader"
|
|
89
|
+
android:layout_width="match_parent"
|
|
90
|
+
android:layout_height="wrap_content" />
|
|
91
|
+
|
|
92
|
+
<com.cometchat.uikit.kotlin.presentation.messagelist.ui.CometChatMessageList
|
|
93
|
+
android:id="@+id/messageList"
|
|
94
|
+
android:layout_width="match_parent"
|
|
95
|
+
android:layout_height="0dp"
|
|
96
|
+
android:layout_weight="1" />
|
|
97
|
+
|
|
98
|
+
<com.cometchat.uikit.kotlin.presentation.messagecomposer.ui.CometChatMessageComposer
|
|
99
|
+
android:id="@+id/messageComposer"
|
|
100
|
+
android:layout_width="match_parent"
|
|
101
|
+
android:layout_height="wrap_content" />
|
|
102
|
+
|
|
103
|
+
</LinearLayout>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 2. Fragment-Based Placement
|
|
107
|
+
|
|
108
|
+
```kotlin
|
|
109
|
+
class ConversationsFragment : Fragment() {
|
|
110
|
+
override fun onCreateView(
|
|
111
|
+
inflater: LayoutInflater,
|
|
112
|
+
container: ViewGroup?,
|
|
113
|
+
savedInstanceState: Bundle?
|
|
114
|
+
): View {
|
|
115
|
+
val conversations = CometChatConversations(requireContext())
|
|
116
|
+
conversations.setOnItemClick { conversation ->
|
|
117
|
+
// Navigate using FragmentManager or Navigation Component
|
|
118
|
+
}
|
|
119
|
+
return conversations
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 3. Tabbed Layout with ViewPager2
|
|
125
|
+
|
|
126
|
+
```kotlin
|
|
127
|
+
class HomeActivity : AppCompatActivity() {
|
|
128
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
129
|
+
super.onCreate(savedInstanceState)
|
|
130
|
+
setContentView(R.layout.activity_home)
|
|
131
|
+
|
|
132
|
+
val tabLayout = findViewById<TabLayout>(R.id.tabLayout)
|
|
133
|
+
val viewPager = findViewById<ViewPager2>(R.id.viewPager)
|
|
134
|
+
|
|
135
|
+
viewPager.adapter = object : FragmentStateAdapter(this) {
|
|
136
|
+
override fun getItemCount() = 4
|
|
137
|
+
override fun createFragment(position: Int): Fragment = when (position) {
|
|
138
|
+
0 -> ConversationsFragment()
|
|
139
|
+
1 -> UsersFragment()
|
|
140
|
+
2 -> GroupsFragment()
|
|
141
|
+
3 -> CallLogsFragment()
|
|
142
|
+
else -> ConversationsFragment()
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
TabLayoutMediator(tabLayout, viewPager) { tab, position ->
|
|
147
|
+
tab.text = when (position) {
|
|
148
|
+
0 -> "Chats"
|
|
149
|
+
1 -> "Users"
|
|
150
|
+
2 -> "Groups"
|
|
151
|
+
3 -> "Calls"
|
|
152
|
+
else -> ""
|
|
153
|
+
}
|
|
154
|
+
}.attach()
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## 4. BottomSheet Placement
|
|
160
|
+
|
|
161
|
+
```kotlin
|
|
162
|
+
// Show message info in a BottomSheet
|
|
163
|
+
val bottomSheet = CometChatMessageInformationBottomSheet.newInstance(message)
|
|
164
|
+
bottomSheet.show(supportFragmentManager, "messageInfo")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
For custom BottomSheets:
|
|
168
|
+
|
|
169
|
+
```kotlin
|
|
170
|
+
class ReactionsBottomSheet : BottomSheetDialogFragment() {
|
|
171
|
+
override fun onCreateView(
|
|
172
|
+
inflater: LayoutInflater,
|
|
173
|
+
container: ViewGroup?,
|
|
174
|
+
savedInstanceState: Bundle?
|
|
175
|
+
): View {
|
|
176
|
+
val reactionList = CometChatReactionList(requireContext())
|
|
177
|
+
reactionList.setBaseMessage(message)
|
|
178
|
+
return reactionList
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 5. Dialog Placement
|
|
184
|
+
|
|
185
|
+
`CometChatFlagMessageDialog` is a regular Android `Dialog` (NOT a `DialogFragment`). The message is passed at construction; there is no `setMessage` setter and no `show(fm, tag)` overload.
|
|
186
|
+
|
|
187
|
+
```kotlin
|
|
188
|
+
// Flag/report message dialog
|
|
189
|
+
val dialog = CometChatFlagMessageDialog(this, message) // (context, BaseMessage)
|
|
190
|
+
dialog.show()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 6. App Flow Pattern
|
|
194
|
+
|
|
195
|
+
From `master-app-kotlin/appflow/DefaultComponentAppFlowActivity.kt` — a single Activity hosts the full chat flow with Fragment transactions:
|
|
196
|
+
|
|
197
|
+
```kotlin
|
|
198
|
+
class AppFlowActivity : AppCompatActivity() {
|
|
199
|
+
override fun onCreate(savedInstanceState: Bundle?) {
|
|
200
|
+
super.onCreate(savedInstanceState)
|
|
201
|
+
setContentView(R.layout.activity_app_flow)
|
|
202
|
+
|
|
203
|
+
// Start with conversations
|
|
204
|
+
supportFragmentManager.beginTransaction()
|
|
205
|
+
.replace(R.id.container, ConversationsFragment())
|
|
206
|
+
.commit()
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
fun navigateToMessages(user: User) {
|
|
210
|
+
supportFragmentManager.beginTransaction()
|
|
211
|
+
.replace(R.id.container, MessagesFragment.newInstance(user))
|
|
212
|
+
.addToBackStack(null)
|
|
213
|
+
.commit()
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Activity theme — REQUIRED parent
|
|
219
|
+
|
|
220
|
+
V6 Kotlin Views components (`CometChatConversations`, `CometChatMessageList`, etc.) extend Material Components widgets (`MaterialCardView`, `MaterialButton`) and reference kit-specific theme attributes (`?attr/cometchatPrimaryColor`, `?attr/cometchatBackgroundColor01`, etc.). The kit ships its own pre-configured theme that supplies every required attribute.
|
|
221
|
+
|
|
222
|
+
**Inherit your Activity theme from `CometChatTheme.DayNight`** (or `CometChatTheme.Light` / `CometChatTheme.Dark` for fixed-mode apps). Edit `app/src/main/res/values/themes.xml`:
|
|
223
|
+
|
|
224
|
+
```xml
|
|
225
|
+
<resources>
|
|
226
|
+
<style name="Theme.YourApp" parent="CometChatTheme.DayNight" />
|
|
227
|
+
</resources>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Do **not** use any of these as the parent — they all crash at component inflation:
|
|
231
|
+
|
|
232
|
+
- `Theme.AppCompat.*` — missing Material Components style attrs (`MaterialCardView` rejects with `IllegalArgumentException: requires Theme.MaterialComponents (or descendant)`)
|
|
233
|
+
- `Theme.MaterialComponents.*.Bridge` — Bridge variants drop Material widget defaults (`MaterialButton` fails with `Failed to resolve attribute at index N`)
|
|
234
|
+
- `Theme.MaterialComponents.*` (without the kit) — has Material attrs but missing `cometchat*` attrs (same `Failed to resolve attribute` crash)
|
|
235
|
+
- `Theme.Material3.*` — Material 3 attrs don't satisfy the kit's MaterialComponents-based widgets
|
|
236
|
+
- `android:Theme.Material.*` — predates AppCompat; AppCompatActivity rejects it
|
|
237
|
+
|
|
238
|
+
`CometChatTheme.DayNight` itself parents `Theme.MaterialComponents.DayNight.NoActionBar`, so it remains AppCompat-compatible while supplying every `cometchat*` attr the components reference.
|
|
239
|
+
|
|
240
|
+
To brand-customize colors, override `cometchat*` attrs in your Activity theme (see `cometchat-android-v6-kotlin-theming`), or call `CometChatTheme.setPrimaryColor(...)` programmatically.
|
|
241
|
+
|
|
242
|
+
## Hard rules
|
|
243
|
+
|
|
244
|
+
- ALWAYS set the user or group on messaging components (`setUser()` / `setGroup()`) before the component is displayed
|
|
245
|
+
- Activity theme MUST inherit from `CometChatTheme.DayNight` / `.Light` / `.Dark` (see "Activity theme" section above) — vague guidance about "include CometChat attrs" is insufficient; use the kit's pre-configured theme
|
|
246
|
+
- Ongoing calls MUST use `CometChatOngoingCallActivity.launchOngoingCallActivity(context, ...)` (in `com.cometchat.uikit.kotlin.presentation.ongoingcall.ui`) — they need a separate Activity for proper lifecycle / PiP management. `CometChatCallActivity` (in `com.cometchat.uikit.kotlin.calls`) handles outgoing/incoming/conference launches via `launchOutgoingCallScreen` / `launchIncomingCallScreen` / `launchConferenceCallScreen` — it has no `launchOngoingCallActivity` method.
|
|
247
|
+
- When passing User/Group between Activities, serialize the UID/GUID and re-fetch, or use a shared cache — do NOT pass full SDK objects via Intent extras
|
|
248
|
+
- Use `AppCompatActivity` (not plain `Activity`) to ensure proper theme attribute resolution
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-kotlin-theming
|
|
3
|
+
description: "CometChat Android UIKit v6 Kotlin Views theming — CometChatTheme singleton, XML attributes, programmatic overrides, typography, and dark mode"
|
|
4
|
+
license: "MIT"
|
|
5
|
+
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-kotlin-android:6.x"
|
|
6
|
+
allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
|
|
7
|
+
metadata:
|
|
8
|
+
author: "CometChat"
|
|
9
|
+
version: "3.0.0"
|
|
10
|
+
tags: "cometchat, android, kotlin-views, theming, xml-attrs, colors, typography, dark-mode"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-compose-theming (Compose equivalent), cometchat-android-v6-kotlin-components, cometchat-android-v6-kotlin-customization
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Apply and customize the CometChat theme in Kotlin Views — XML theme attributes, programmatic color/font overrides via the `CometChatTheme` singleton, dark mode support, and per-component style classes.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Setting CometChat theme colors via XML attributes or programmatically
|
|
22
|
+
- Overriding primary, neutral, alert, or button colors
|
|
23
|
+
- Customizing typography and fonts
|
|
24
|
+
- Implementing dark mode for Kotlin Views components
|
|
25
|
+
- Clearing the theme cache after dynamic theme changes
|
|
26
|
+
|
|
27
|
+
## Do not use this skill when
|
|
28
|
+
|
|
29
|
+
- Working with Compose theming (use `cometchat-android-v6-compose-theming`)
|
|
30
|
+
- Customizing bubble rendering (use `cometchat-android-v6-kotlin-customization`)
|
|
31
|
+
|
|
32
|
+
## 1. CometChatTheme Singleton
|
|
33
|
+
|
|
34
|
+
`CometChatTheme` is a Kotlin `object` in `com.cometchat.uikit.kotlin.theme` that provides `Context`-based getters and setters for all theme tokens.
|
|
35
|
+
|
|
36
|
+
```kotlin
|
|
37
|
+
import com.cometchat.uikit.kotlin.theme.CometChatTheme
|
|
38
|
+
|
|
39
|
+
// Get a color (requires Context)
|
|
40
|
+
val primaryColor: Int = CometChatTheme.getPrimaryColor(context)
|
|
41
|
+
val textColor: Int = CometChatTheme.getTextColorPrimary(context)
|
|
42
|
+
|
|
43
|
+
// Set a color programmatically (cached globally)
|
|
44
|
+
CometChatTheme.setPrimaryColor(Color.parseColor("#6851D6"))
|
|
45
|
+
CometChatTheme.setErrorColor(Color.RED)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 2. XML Theme Attributes
|
|
49
|
+
|
|
50
|
+
Define theme colors in your app's `styles.xml` or `themes.xml`:
|
|
51
|
+
|
|
52
|
+
```xml
|
|
53
|
+
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
|
|
54
|
+
<!-- Primary -->
|
|
55
|
+
<item name="cometchatPrimaryColor">#6851D6</item>
|
|
56
|
+
|
|
57
|
+
<!-- Neutral scale -->
|
|
58
|
+
<item name="cometchatNeutralColor50">#FAFAFA</item>
|
|
59
|
+
<item name="cometchatNeutralColor100">#F5F5F5</item>
|
|
60
|
+
<item name="cometchatNeutralColor200">#E8E8E8</item>
|
|
61
|
+
<!-- ... through cometchatNeutralColor900 -->
|
|
62
|
+
|
|
63
|
+
<!-- Alert colors -->
|
|
64
|
+
<item name="cometchatSuccessColor">#34C759</item>
|
|
65
|
+
<item name="cometchatErrorColor">#FF3B30</item>
|
|
66
|
+
<item name="cometchatWarningColor">#FFCC00</item>
|
|
67
|
+
<item name="cometchatInfoColor">#007AFF</item>
|
|
68
|
+
<item name="cometchatMessageReadColor">#007AFF</item>
|
|
69
|
+
|
|
70
|
+
<!-- Background colors -->
|
|
71
|
+
<item name="cometchatBackgroundColor1">@color/bg1</item>
|
|
72
|
+
<!-- ... through cometchatBackgroundColor4 -->
|
|
73
|
+
|
|
74
|
+
<!-- Stroke/border colors -->
|
|
75
|
+
<item name="cometchatStrokeColorDefault">@color/stroke</item>
|
|
76
|
+
<item name="cometchatStrokeColorLight">@color/strokeLight</item>
|
|
77
|
+
<item name="cometchatStrokeColorDark">@color/strokeDark</item>
|
|
78
|
+
<item name="cometchatStrokeColorHighlight">@color/primary</item>
|
|
79
|
+
|
|
80
|
+
<!-- Text colors -->
|
|
81
|
+
<item name="cometchatTextColorPrimary">@color/textPrimary</item>
|
|
82
|
+
<item name="cometchatTextColorSecondary">@color/textSecondary</item>
|
|
83
|
+
<!-- ... -->
|
|
84
|
+
|
|
85
|
+
<!-- Icon tints -->
|
|
86
|
+
<item name="cometchatIconTintPrimary">@color/iconPrimary</item>
|
|
87
|
+
<!-- ... -->
|
|
88
|
+
|
|
89
|
+
<!-- Button colors -->
|
|
90
|
+
<item name="cometchatPrimaryButtonBackgroundColor">@color/primary</item>
|
|
91
|
+
<item name="cometchatPrimaryButtonIconTint">@color/white</item>
|
|
92
|
+
<item name="cometchatPrimaryButtonTextColor">@color/white</item>
|
|
93
|
+
<!-- ... -->
|
|
94
|
+
</style>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 3. Color Token Reference
|
|
98
|
+
|
|
99
|
+
### 3.1 Primary Colors
|
|
100
|
+
|
|
101
|
+
| Getter | Setter | XML Attr |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `getPrimaryColor(ctx)` | `setPrimaryColor(color)` | `cometchatPrimaryColor` |
|
|
104
|
+
|
|
105
|
+
### 3.2 Extended Primary (auto-generated from primary)
|
|
106
|
+
|
|
107
|
+
| Getter | Setter | XML Attr |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| `getExtendedPrimaryColor50(ctx)` | `setExtendedPrimaryColor50(color)` | `cometchatExtendedPrimaryColor50` |
|
|
110
|
+
| ... through 900 | ... | ... |
|
|
111
|
+
|
|
112
|
+
Extended primary colors auto-generate by blending primary with white (day) or black (night) if not explicitly set.
|
|
113
|
+
|
|
114
|
+
### 3.3 Neutral Colors
|
|
115
|
+
|
|
116
|
+
`getNeutralColor50(ctx)` through `getNeutralColor900(ctx)` with corresponding setters and XML attrs `cometchatNeutralColor50` through `cometchatNeutralColor900`.
|
|
117
|
+
|
|
118
|
+
### 3.4 Alert Colors
|
|
119
|
+
|
|
120
|
+
| Getter | Setter | XML Attr |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| `getSuccessColor(ctx)` | `setSuccessColor(color)` | `cometchatSuccessColor` |
|
|
123
|
+
| `getErrorColor(ctx)` | `setErrorColor(color)` | `cometchatErrorColor` |
|
|
124
|
+
| `getWarningColor(ctx)` | `setWarningColor(color)` | `cometchatWarningColor` |
|
|
125
|
+
| `getInfoColor(ctx)` | `setInfoColor(color)` | `cometchatInfoColor` |
|
|
126
|
+
| `getMessageReadColor(ctx)` | `setMessageReadColor(color)` | `cometchatMessageReadColor` |
|
|
127
|
+
|
|
128
|
+
### 3.5 Background, Stroke, Text, Icon, Button Colors
|
|
129
|
+
|
|
130
|
+
All follow the same pattern: `get{Token}(ctx)` / `set{Token}(color)` / `cometchat{Token}` XML attr. Defaults fall back to neutral scale values if not explicitly set.
|
|
131
|
+
|
|
132
|
+
Border color aliases: `getBorderColorLight()` = `getStrokeColorLight()`, etc.
|
|
133
|
+
|
|
134
|
+
## 4. Typography
|
|
135
|
+
|
|
136
|
+
```kotlin
|
|
137
|
+
// Get text appearance resource IDs
|
|
138
|
+
val titleBold: Int = CometChatTheme.getTextAppearanceTitleBold(context)
|
|
139
|
+
val bodyRegular: Int = CometChatTheme.getTextAppearanceBodyRegular(context)
|
|
140
|
+
val heading1Medium: Int = CometChatTheme.getTextAppearanceHeading1Medium(context)
|
|
141
|
+
// ... all combinations: Title, Heading1-4, Body, Caption1-2, Button, Link × Regular/Medium/Bold
|
|
142
|
+
|
|
143
|
+
// Get font resource IDs
|
|
144
|
+
val regularFont: Int = CometChatTheme.getFontRegular(context)
|
|
145
|
+
val mediumFont: Int = CometChatTheme.getFontMedium(context)
|
|
146
|
+
val boldFont: Int = CometChatTheme.getFontBold(context)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Override via XML attrs: `cometchatTextAppearanceTitleBold`, `cometchatFontRegular`, etc.
|
|
150
|
+
|
|
151
|
+
## 5. Dark Mode
|
|
152
|
+
|
|
153
|
+
Dark mode is detected via `Configuration.UI_MODE_NIGHT_MASK`:
|
|
154
|
+
|
|
155
|
+
```kotlin
|
|
156
|
+
val nightMode = context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
|
157
|
+
val isDark = nightMode == Configuration.UI_MODE_NIGHT_YES
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The theme automatically:
|
|
161
|
+
- Uses day/night qualified XML resources
|
|
162
|
+
- Blends extended primary colors with white (day) or black (night)
|
|
163
|
+
- Falls back to appropriate neutral scale for each mode
|
|
164
|
+
|
|
165
|
+
For programmatic overrides, set colors after detecting the mode:
|
|
166
|
+
|
|
167
|
+
```kotlin
|
|
168
|
+
if (isDark) {
|
|
169
|
+
CometChatTheme.setPrimaryColor(Color.parseColor("#BB86FC"))
|
|
170
|
+
} else {
|
|
171
|
+
CometChatTheme.setPrimaryColor(Color.parseColor("#6851D6"))
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 6. Theme Cache
|
|
176
|
+
|
|
177
|
+
Programmatic overrides are cached in memory. Clear the cache when the theme changes:
|
|
178
|
+
|
|
179
|
+
```kotlin
|
|
180
|
+
CometChatTheme.clearCache()
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Call this when:
|
|
184
|
+
- The user switches between light and dark mode at runtime
|
|
185
|
+
- You dynamically change the primary color
|
|
186
|
+
- The Activity recreates with a new theme
|
|
187
|
+
|
|
188
|
+
## 7. Static Colors
|
|
189
|
+
|
|
190
|
+
```kotlin
|
|
191
|
+
val white: Int = CometChatTheme.getColorWhite(context)
|
|
192
|
+
val black: Int = CometChatTheme.getColorBlack(context)
|
|
193
|
+
val transparent: Int = CometChatTheme.getColorTransparent(context)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Hard rules
|
|
197
|
+
|
|
198
|
+
- ALWAYS pass a valid `Context` to getter methods — they resolve XML attributes from the theme
|
|
199
|
+
- Call `CometChatTheme.clearCache()` after programmatic theme changes to ensure fresh values
|
|
200
|
+
- Programmatic setters (`setPrimaryColor()`, etc.) take priority over XML attributes
|
|
201
|
+
- Extended primary colors auto-generate from the primary color — only override them if you need specific shades
|
|
202
|
+
- Do NOT mix Compose `CometChatTheme.colorScheme` with Views `CometChatTheme.getPrimaryColor(ctx)` — they are separate theme systems in separate modules
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cometchat-android-v6-production
|
|
3
|
+
description: "CometChat Android UIKit v6 production readiness — token auth, ProGuard/R8, security checklist, release configuration"
|
|
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.0"
|
|
10
|
+
tags: "cometchat, android, production, security, proguard, release, auth-token"
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
> **Companion skills:** cometchat-android-v6-core (init/login), cometchat-android-v6-builder-settings (UIKitSettings), cometchat-android-v6-push (FCM)
|
|
14
|
+
|
|
15
|
+
## Purpose
|
|
16
|
+
|
|
17
|
+
Prepare a CometChat v6 Android app for production release — switch to token-based auth, configure ProGuard/R8, apply security best practices, and optimize the release build.
|
|
18
|
+
|
|
19
|
+
## Use this skill when
|
|
20
|
+
|
|
21
|
+
- Preparing an app for production/release
|
|
22
|
+
- Switching from authKey to token-based authentication
|
|
23
|
+
- Configuring ProGuard/R8 rules for CometChat
|
|
24
|
+
- Reviewing security best practices
|
|
25
|
+
|
|
26
|
+
## Do not use this skill when
|
|
27
|
+
|
|
28
|
+
- Setting up for development (use `cometchat-android-v6-core`)
|
|
29
|
+
- Debugging issues (use `cometchat-android-v6-troubleshooting`)
|
|
30
|
+
|
|
31
|
+
## 1. Token-Based Authentication
|
|
32
|
+
|
|
33
|
+
### 1.1 Never Ship authKey
|
|
34
|
+
|
|
35
|
+
```kotlin
|
|
36
|
+
// ❌ NEVER in production
|
|
37
|
+
val settings = UIKitSettings.UIKitSettingsBuilder()
|
|
38
|
+
.setAppId("APP_ID")
|
|
39
|
+
.setRegion("us")
|
|
40
|
+
.setAuthKey("AUTH_KEY") // REMOVE THIS
|
|
41
|
+
.build()
|
|
42
|
+
|
|
43
|
+
CometChatUIKit.login("uid", callback) // Uses authKey internally
|
|
44
|
+
|
|
45
|
+
// ✅ Production pattern
|
|
46
|
+
val settings = UIKitSettings.UIKitSettingsBuilder()
|
|
47
|
+
.setAppId("APP_ID")
|
|
48
|
+
.setRegion("us")
|
|
49
|
+
// No authKey
|
|
50
|
+
.build()
|
|
51
|
+
|
|
52
|
+
// Get token from your backend server
|
|
53
|
+
val authToken = yourServer.getAuthToken(userId)
|
|
54
|
+
CometChatUIKit.loginWithAuthToken(authToken, callback)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 1.2 Server-Side Token Generation
|
|
58
|
+
|
|
59
|
+
Your backend generates auth tokens using the CometChat REST API:
|
|
60
|
+
- Endpoint: `POST https://{appId}.api-{region}.cometchat.io/v3/users/{uid}/auth_tokens`
|
|
61
|
+
- Header: `apiKey: YOUR_API_KEY` (server-side only)
|
|
62
|
+
|
|
63
|
+
The auth token is then passed to the client for `loginWithAuthToken()`.
|
|
64
|
+
|
|
65
|
+
## 2. ProGuard / R8 Configuration
|
|
66
|
+
|
|
67
|
+
### 2.1 Consumer Rules
|
|
68
|
+
|
|
69
|
+
CometChat UIKit modules include `consumer-rules.pro` that are automatically applied. Check that your app's `build.gradle.kts` has:
|
|
70
|
+
|
|
71
|
+
```kotlin
|
|
72
|
+
android {
|
|
73
|
+
buildTypes {
|
|
74
|
+
release {
|
|
75
|
+
isMinifyEnabled = true
|
|
76
|
+
proguardFiles(
|
|
77
|
+
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
78
|
+
"proguard-rules.pro"
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2.2 Additional ProGuard Rules
|
|
86
|
+
|
|
87
|
+
If you encounter issues with minification, add these rules:
|
|
88
|
+
|
|
89
|
+
```proguard
|
|
90
|
+
# CometChat SDK
|
|
91
|
+
-keep class com.cometchat.chat.** { *; }
|
|
92
|
+
-keep class com.cometchat.calls.** { *; }
|
|
93
|
+
|
|
94
|
+
# CometChat UIKit
|
|
95
|
+
-keep class com.cometchat.uikit.** { *; }
|
|
96
|
+
|
|
97
|
+
# Gson (used for FCM DTO parsing)
|
|
98
|
+
-keep class com.google.gson.** { *; }
|
|
99
|
+
-keepattributes Signature
|
|
100
|
+
-keepattributes *Annotation*
|
|
101
|
+
|
|
102
|
+
# Firebase
|
|
103
|
+
-keep class com.google.firebase.** { *; }
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 3. Security Checklist
|
|
107
|
+
|
|
108
|
+
| Item | Status | Notes |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| Remove `authKey` from client code | Required | Use `loginWithAuthToken()` |
|
|
111
|
+
| Store `appId` securely | Recommended | Use BuildConfig or encrypted prefs |
|
|
112
|
+
| Use HTTPS for all custom endpoints | Required | `overrideAdminHost` / `overrideClientHost` |
|
|
113
|
+
| Validate auth tokens server-side | Required | Tokens should expire |
|
|
114
|
+
| Do not log sensitive data | Required | Remove debug logs in release |
|
|
115
|
+
| Enable R8/ProGuard | Recommended | Obfuscates code |
|
|
116
|
+
| Pin SSL certificates | Optional | For high-security apps |
|
|
117
|
+
|
|
118
|
+
## 4. Release Build Configuration
|
|
119
|
+
|
|
120
|
+
```kotlin
|
|
121
|
+
android {
|
|
122
|
+
compileSdk = 36
|
|
123
|
+
|
|
124
|
+
defaultConfig {
|
|
125
|
+
minSdk = 28
|
|
126
|
+
targetSdk = 36
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
buildTypes {
|
|
130
|
+
release {
|
|
131
|
+
isMinifyEnabled = true
|
|
132
|
+
isShrinkResources = true
|
|
133
|
+
proguardFiles(
|
|
134
|
+
getDefaultProguardFile("proguard-android-optimize.txt"),
|
|
135
|
+
"proguard-rules.pro"
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
compileOptions {
|
|
141
|
+
sourceCompatibility = JavaVersion.VERSION_11
|
|
142
|
+
targetCompatibility = JavaVersion.VERSION_11
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
kotlinOptions {
|
|
146
|
+
jvmTarget = "11"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## 5. Dependency Management
|
|
152
|
+
|
|
153
|
+
### 5.1 Compose BOM
|
|
154
|
+
|
|
155
|
+
For Compose stack, use the BOM to align Compose library versions:
|
|
156
|
+
|
|
157
|
+
```kotlin
|
|
158
|
+
implementation(platform("androidx.compose:compose-bom:2024.x.x"))
|
|
159
|
+
implementation("androidx.compose.ui:ui")
|
|
160
|
+
implementation("androidx.compose.material3:material3")
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 5.2 Version Pinning
|
|
164
|
+
|
|
165
|
+
Pin CometChat SDK versions explicitly:
|
|
166
|
+
|
|
167
|
+
```kotlin
|
|
168
|
+
implementation("com.cometchat:chatuikit-compose-android:6.0.0-beta2")
|
|
169
|
+
// or
|
|
170
|
+
implementation("com.cometchat:chatuikit-kotlin-android:6.0.0-beta2")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## 6. minSdk 28 Implications
|
|
174
|
+
|
|
175
|
+
v6 requires `minSdk = 28` (Android 9.0 Pie). This means:
|
|
176
|
+
- No support for Android 7.0-8.1 devices
|
|
177
|
+
- Full TLS 1.3 support
|
|
178
|
+
- Native BiometricPrompt API available
|
|
179
|
+
- Adaptive icons required
|
|
180
|
+
|
|
181
|
+
## Hard rules
|
|
182
|
+
|
|
183
|
+
- NEVER ship `authKey` in production builds — it allows anyone to create users and login
|
|
184
|
+
- ALWAYS use `loginWithAuthToken()` with server-generated tokens in production
|
|
185
|
+
- ALWAYS test the release build with ProGuard/R8 enabled before shipping — CometChat uses reflection in some areas
|
|
186
|
+
- `minSdk` must be 28 — do NOT lower it, v6 APIs depend on API 28+ features
|
|
187
|
+
- Remove all `Log.d()` / debug logging in release builds — use `BuildConfig.DEBUG` guards
|