@cometchat/skills 4.3.0 → 4.4.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/bin/install.js +27 -0
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +233 -69
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +5 -3
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +208 -28
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +232 -312
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +2 -1
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +255 -19
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +313 -34
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
- package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +139 -78
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +173 -45
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +34 -17
- package/skills/cometchat-native-calls/SKILL.md +28 -16
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +84 -52
- package/skills/cometchat-native-core/SKILL.md +101 -32
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +57 -26
- package/skills/cometchat-native-features/SKILL.md +23 -16
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +9 -3
- package/skills/cometchat-nextjs-patterns/SKILL.md +20 -6
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +44 -4
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +10 -4
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -3,13 +3,14 @@ name: cometchat-android-v6-compose-components
|
|
|
3
3
|
description: "CometChat Android UIKit v6 Jetpack Compose component catalog — all @Composable chat UI components, their parameters, styles, and usage"
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
8
|
version: "3.0.0"
|
|
10
9
|
tags: "cometchat, android, compose, components, conversations, messages, users, groups, calls"
|
|
11
10
|
---
|
|
12
11
|
|
|
12
|
+
> **Ground truth:** `com.cometchat:chatuikit-compose-android:6.x` component catalog (javap the AAR) + `docs/ui-kit/android/v6`. **Official docs:** https://www.cometchat.com/docs/ui-kit/android/v6/components-overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
13
|
+
|
|
13
14
|
> **Companion skills:** cometchat-android-v6-kotlin-components (Views equivalent), cometchat-android-v6-compose-theming, cometchat-android-v6-compose-customization, cometchat-android-v6-compose-placement
|
|
14
15
|
|
|
15
16
|
## Purpose
|
|
@@ -31,6 +32,7 @@ Complete catalog of all Jetpack Compose components in CometChat UIKit v6. Each c
|
|
|
31
32
|
|
|
32
33
|
## 1. Component Catalog
|
|
33
34
|
|
|
35
|
+
> ⛔ **Only the `@Composable`s in THIS catalog exist — do not invent or recall names from v4/older memory.** Before emitting any `CometChat*` composable, confirm it's listed below; if it's not here, it doesn't exist (→ "unresolved reference" compile error). **There is no all-in-one composable:** the v4-era composites `CometChatConversationsWithMessages` / `CometChatUsersWithMessages` / `CometChatGroupsWithMessages` / `CometChatMessages` and the `CometChatUI` god-component do **not** exist in v6 Android (verified against the v6 Kotlin-Views kit, which the Compose stack mirrors). Compose a two-pane experience yourself: `CometChatConversations()` (list) → on item-click, host `CometChatMessageHeader()` + `CometChatMessageList()` + `CometChatMessageComposer()` for the selected `User`/`Group`.
|
|
34
36
|
|
|
35
37
|
### 1.1 List Components
|
|
36
38
|
|
|
@@ -44,6 +46,8 @@ Complete catalog of all Jetpack Compose components in CometChat UIKit v6. Each c
|
|
|
44
46
|
|
|
45
47
|
### 1.2 Messaging Components
|
|
46
48
|
|
|
49
|
+
> ⚠️ **There is NO combined `CometChatMessages` composable on Android Compose.** Unlike React / Flutter / Android V5 (Views), the V6 Compose surface ships the three pieces separately and you compose the chat screen manually as `CometChatMessageHeader + CometChatMessageList + CometChatMessageComposer` in a `Column` (see §2.2). Do not import `com.cometchat.uikit.compose.presentation.cometchatmessages.CometChatMessages` — that package does not exist (ENG-35698 fix).
|
|
50
|
+
|
|
47
51
|
| Component | Package | Purpose |
|
|
48
52
|
|---|---|---|
|
|
49
53
|
| `CometChatMessageList` | `presentation.messagelist.ui` | Message list with bubbles |
|
|
@@ -74,6 +78,7 @@ Complete catalog of all Jetpack Compose components in CometChat UIKit v6. Each c
|
|
|
74
78
|
| `CometChatImageViewerScreen` | `presentation.imageviewer.ui` | Full-screen image viewer |
|
|
75
79
|
| `CometChatFlagMessageDialog` | `presentation.report` | Report/flag message |
|
|
76
80
|
| `CometChatAIAssistantChatHistory` | `presentation.aiassistantchathistory.ui` | AI chat history |
|
|
81
|
+
| `CometChatNotificationFeed` | `presentation.notificationfeed.ui` | Full-screen notification feed (category filter chips, timestamp grouping, rich cards, real-time updates) |
|
|
77
82
|
|
|
78
83
|
### 1.5 Shared Elements
|
|
79
84
|
|
|
@@ -93,40 +98,61 @@ The `preview/` package provides preview data, domain models, and presentation he
|
|
|
93
98
|
|
|
94
99
|
## 2. Basic Usage Examples
|
|
95
100
|
|
|
101
|
+
> **`CometChatTheme {}` is applied ONCE at the app root, outside the `NavHost` — not per screen.** The examples below assume that root wrapper is already in place (see `cometchat-android-v6-compose-placement` §1), so individual screens do NOT re-wrap in `CometChatTheme {}`. Nesting multiple `CometChatTheme {}` wrappers is an anti-pattern.
|
|
102
|
+
|
|
96
103
|
### 2.1 Conversations List
|
|
97
104
|
|
|
98
105
|
```kotlin
|
|
99
106
|
import com.cometchat.uikit.compose.presentation.conversations.ui.CometChatConversations
|
|
100
|
-
import com.cometchat.uikit.compose.theme.CometChatTheme
|
|
101
107
|
|
|
102
108
|
@Composable
|
|
103
109
|
fun ConversationsScreen(onConversationClick: (Conversation) -> Unit) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
110
|
-
}
|
|
110
|
+
CometChatConversations(
|
|
111
|
+
onItemClick = { conversation ->
|
|
112
|
+
onConversationClick(conversation)
|
|
113
|
+
}
|
|
114
|
+
)
|
|
111
115
|
}
|
|
112
116
|
```
|
|
113
117
|
|
|
114
118
|
### 2.2 Message List
|
|
115
119
|
|
|
120
|
+
The chat screen composes the three pieces in a `Column`. Match the kit sample app (`sample-app-compose/.../messages/MessagesScreen.kt`): wrap in a `Scaffold(contentWindowInsets = WindowInsets.statusBars)` and give the `Column` `.navigationBarsPadding().imePadding()` so the soft keyboard pushes the composer up instead of covering it. Header and Composer take `Modifier.fillMaxWidth()`; the List takes `weight(1f)`.
|
|
121
|
+
|
|
116
122
|
```kotlin
|
|
123
|
+
import androidx.compose.foundation.layout.Column
|
|
124
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
125
|
+
import androidx.compose.foundation.layout.consumeWindowInsets
|
|
126
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
127
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
128
|
+
import androidx.compose.foundation.layout.imePadding
|
|
129
|
+
import androidx.compose.foundation.layout.navigationBarsPadding
|
|
130
|
+
import androidx.compose.foundation.layout.padding
|
|
131
|
+
import androidx.compose.foundation.layout.statusBars
|
|
132
|
+
import androidx.compose.material3.Scaffold
|
|
133
|
+
import androidx.compose.ui.Modifier
|
|
117
134
|
import com.cometchat.uikit.compose.presentation.messagelist.ui.CometChatMessageList
|
|
118
135
|
import com.cometchat.chat.models.User
|
|
119
136
|
|
|
120
137
|
@Composable
|
|
121
138
|
fun ChatScreen(user: User) {
|
|
122
|
-
|
|
123
|
-
Column
|
|
124
|
-
|
|
139
|
+
Scaffold(contentWindowInsets = WindowInsets.statusBars) { paddingValues ->
|
|
140
|
+
Column(
|
|
141
|
+
modifier = Modifier
|
|
142
|
+
.fillMaxSize()
|
|
143
|
+
.padding(paddingValues)
|
|
144
|
+
.consumeWindowInsets(paddingValues)
|
|
145
|
+
.navigationBarsPadding()
|
|
146
|
+
.imePadding()
|
|
147
|
+
) {
|
|
148
|
+
CometChatMessageHeader(modifier = Modifier.fillMaxWidth(), user = user)
|
|
125
149
|
CometChatMessageList(
|
|
126
150
|
user = user,
|
|
127
|
-
modifier = Modifier
|
|
151
|
+
modifier = Modifier
|
|
152
|
+
.fillMaxWidth()
|
|
153
|
+
.weight(1f)
|
|
128
154
|
)
|
|
129
|
-
CometChatMessageComposer(user = user)
|
|
155
|
+
CometChatMessageComposer(modifier = Modifier.fillMaxWidth(), user = user)
|
|
130
156
|
}
|
|
131
157
|
}
|
|
132
158
|
}
|
|
@@ -137,13 +163,11 @@ fun ChatScreen(user: User) {
|
|
|
137
163
|
```kotlin
|
|
138
164
|
@Composable
|
|
139
165
|
fun UsersScreen() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
)
|
|
146
|
-
}
|
|
166
|
+
CometChatUsers(
|
|
167
|
+
onItemClick = { user ->
|
|
168
|
+
// Navigate to chat with user
|
|
169
|
+
}
|
|
170
|
+
)
|
|
147
171
|
}
|
|
148
172
|
```
|
|
149
173
|
|
|
@@ -152,13 +176,11 @@ fun UsersScreen() {
|
|
|
152
176
|
```kotlin
|
|
153
177
|
@Composable
|
|
154
178
|
fun GroupsScreen() {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
)
|
|
161
|
-
}
|
|
179
|
+
CometChatGroups(
|
|
180
|
+
onItemClick = { group ->
|
|
181
|
+
// Navigate to group chat
|
|
182
|
+
}
|
|
183
|
+
)
|
|
162
184
|
}
|
|
163
185
|
```
|
|
164
186
|
|
|
@@ -177,6 +199,7 @@ Every component has a corresponding `@Immutable data class` style in its `style/
|
|
|
177
199
|
| `CometChatMessageHeader` | `CometChatMessageHeaderStyle` | `.default()` |
|
|
178
200
|
| `CometChatCallLogs` | `CometChatCallLogsStyle` | `.default()` |
|
|
179
201
|
| `CometChatThreadHeader` | `CometChatThreadHeaderStyle` | `.default()` |
|
|
202
|
+
| `CometChatNotificationFeed` | `CometChatNotificationFeedStyle` | constructor (`Color.Unspecified` defaults) + `.fromTheme(overrides)` |
|
|
180
203
|
|
|
181
204
|
Usage:
|
|
182
205
|
|
|
@@ -196,7 +219,7 @@ Each component creates its own ViewModel internally via factories from `chatuiki
|
|
|
196
219
|
|
|
197
220
|
## Hard rules
|
|
198
221
|
|
|
199
|
-
-
|
|
222
|
+
- CometChat Compose components depend on `CometChatTheme {}` `CompositionLocal` values — apply `CometChatTheme {}` ONCE at the app root (outside the `NavHost`), NOT per screen; never nest multiple `CometChatTheme {}` wrappers
|
|
200
223
|
- Components create their own ViewModels internally — do NOT try to create or inject ViewModels manually
|
|
201
224
|
- Style classes use `Companion.default()` factory functions — do NOT use the data class constructor directly (it requires all parameters)
|
|
202
225
|
- All style defaults source from `CometChatTheme` tokens — override only what you need via named parameters
|
|
@@ -3,13 +3,14 @@ name: cometchat-android-v6-compose-customization
|
|
|
3
3
|
description: "CometChat Android UIKit v6 Compose customization — BubbleFactory interface, slot lambdas, @Immutable style classes, and per-slot overrides"
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
8
|
version: "3.0.0"
|
|
10
9
|
tags: "cometchat, android, compose, customization, bubble-factory, slots, style"
|
|
11
10
|
---
|
|
12
11
|
|
|
12
|
+
> **Ground truth:** `com.cometchat:chatuikit-{compose,kotlin}-android:6.x` (+ `calls-sdk-android:5.x`) — resolved AAR (javap) + `ui-kit/android/v6`. **Official docs:** https://www.cometchat.com/docs/ui-kit/android/v6/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
13
|
+
|
|
13
14
|
> **Companion skills:** cometchat-android-v6-kotlin-customization (Views equivalent), cometchat-android-v6-compose-components, cometchat-android-v6-compose-theming, cometchat-android-v6-extensions (DataSource layer), cometchat-android-v6-events
|
|
14
15
|
|
|
15
16
|
## Purpose
|
|
@@ -135,6 +136,139 @@ override fun onDispose(message: BaseMessage) {
|
|
|
135
136
|
}
|
|
136
137
|
```
|
|
137
138
|
|
|
139
|
+
### 1.7 Custom attachment options (Scenario 3) — pass the `attachmentOptions` parameter
|
|
140
|
+
|
|
141
|
+
A `BubbleFactory` only *renders* a custom type; to let users *create* one you usually add a composer attachment action. On Compose the canonical path is the **`attachmentOptions` parameter** on `CometChatMessageComposer` — a `List<CometChatMessageComposerAction>` whose contents are added **after** the built-in options.
|
|
142
|
+
|
|
143
|
+
```kotlin
|
|
144
|
+
CometChatMessageComposer(
|
|
145
|
+
user = user,
|
|
146
|
+
attachmentOptions = listOf(
|
|
147
|
+
CometChatMessageComposerAction(
|
|
148
|
+
id = "location",
|
|
149
|
+
title = "Send Location",
|
|
150
|
+
icon = R.drawable.ic_location,
|
|
151
|
+
onClick = OnClick { /* pick + send (see 1.8) */ }
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Append is automatic — your list does NOT replace the defaults.** Internally the composable calls `composerViewModel.setAttachmentOptions(attachmentOptions)` (`CometChatMessageComposer.kt:431-432`), which sets only the *custom* options list (`_customAttachmentOptions`). The defaults (camera/image/video/audio/document/poll/collab-doc/collab-whiteboard) are rebuilt every time by `getDefaultAttachmentOptions(...)` and your custom options are concatenated at the end (`CometChatMessageComposerViewModel.kt:646-649`). There is no "wipe defaults" footgun here — `setAttachmentOptions` despite its name does NOT drop the built-ins.
|
|
158
|
+
|
|
159
|
+
> Hide a built-in instead with the composer's `hide*Option` flags (e.g. `hidePollOption = true`), which flip the `_show*Option` visibility checked inside `getDefaultAttachmentOptions`.
|
|
160
|
+
|
|
161
|
+
If you hold a `CometChatMessageComposerViewModel` directly (advanced), `addAttachmentOption(action)` appends one custom option and `setAttachmentOptions(list)` replaces the custom list — both verified at `CometChatMessageComposerViewModel.kt:657 / :666`. The built-in option IDs are constants on `CometChatMessageComposerAction` (`ID_CAMERA`, `ID_IMAGE`, `ID_VIDEO`, `ID_AUDIO`, `ID_DOCUMENT`, `ID_POLL`, `ID_COLLABORATIVE_DOCUMENT`, `ID_COLLABORATIVE_WHITEBOARD` — `CometChatMessageComposerAction.kt:42-49`).
|
|
162
|
+
|
|
163
|
+
### 1.8 Sending a custom message — use the UIKit path, not the raw SDK
|
|
164
|
+
|
|
165
|
+
```kotlin
|
|
166
|
+
val message = CustomMessage(
|
|
167
|
+
receiverId,
|
|
168
|
+
CometChatConstants.RECEIVER_TYPE_USER, // or RECEIVER_TYPE_GROUP
|
|
169
|
+
"location", // matches the BubbleFactory type
|
|
170
|
+
customData // org.json.JSONObject
|
|
171
|
+
)
|
|
172
|
+
// ✅ kit path — sets muid + sender, fires ccMessageSent → list APPENDS
|
|
173
|
+
CometChatUIKit.sendCustomMessage(message, object : CometChat.CallbackListener<CustomMessage>() {
|
|
174
|
+
override fun onSuccess(p0: CustomMessage) {}
|
|
175
|
+
override fun onError(p0: CometChatException) {}
|
|
176
|
+
})
|
|
177
|
+
// ❌ CometChat.sendCustomMessage(...) — no muid/sender/event → recipient error + realtime replace
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Verified (v6 core/compose): `CometChatMessageComposer(attachmentOptions = …)` param (`CometChatMessageComposer.kt:338`), `CometChatMessageComposerViewModel.addAttachmentOption / setAttachmentOptions / getDefaultAttachmentOptions` (`:657 / :666 / :547`), `CometChatUIKit.sendCustomMessage(CustomMessage, CallbackListener)` (`CometChatUIKit.kt:472`).
|
|
181
|
+
|
|
182
|
+
### 1.9 Override an EXISTING type's bubble (Scenario 2)
|
|
183
|
+
|
|
184
|
+
To replace the rendering of a built-in type (e.g. text or image), register a `BubbleFactory` whose `getCategory()`/`getType()` **match the built-in identifiers**. Built-in types are NOT pre-seeded as factory entries — the bubble falls back to `InternalContentRenderer` only when no factory matches a `"category_type"` key (`CometChatMessageBubble.kt:155` "Falls back to InternalContentRenderer if no factory is provided"). So a matching factory simply takes priority over the internal default.
|
|
185
|
+
|
|
186
|
+
```kotlin
|
|
187
|
+
import com.cometchat.chat.constants.CometChatConstants
|
|
188
|
+
|
|
189
|
+
class MyTextBubbleFactory : BubbleFactory {
|
|
190
|
+
override fun getCategory(): String = CometChatConstants.CATEGORY_MESSAGE // "message"
|
|
191
|
+
override fun getType(): String = CometChatConstants.MESSAGE_TYPE_TEXT // "text"
|
|
192
|
+
|
|
193
|
+
override fun getContentView(
|
|
194
|
+
message: BaseMessage,
|
|
195
|
+
alignment: UIKitConstants.MessageBubbleAlignment,
|
|
196
|
+
style: CometChatMessageBubbleStyle,
|
|
197
|
+
textFormatters: List<CometChatTextFormatter>
|
|
198
|
+
): @Composable () -> Unit = {
|
|
199
|
+
MyCustomTextContent(message as TextMessage) // only the content area
|
|
200
|
+
}
|
|
201
|
+
// …or override getBubbleView() to replace the whole bubble (see 1.3)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
CometChatMessageList(user = user, bubbleFactories = listOf(MyTextBubbleFactory()))
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
This is still additive at the list level: registering a `message_text` factory only overrides text bubbles; image/video/custom types keep their internal rendering. Use `getContentView()` for content-only override, `getBubbleView()` for full-bubble replacement.
|
|
208
|
+
|
|
209
|
+
### 1.10 Add a long-press message option (Scenario 4 — Forward-style)
|
|
210
|
+
|
|
211
|
+
`CometChatMessageList` exposes two lambda parameters for the long-press option sheet (`CometChatMessageList.kt:577-598`):
|
|
212
|
+
|
|
213
|
+
| Param | Type | Semantics |
|
|
214
|
+
|---|---|---|
|
|
215
|
+
| `addOptions` | `((BaseMessage) -> List<CometChatMessageOption>)?` | **Append** after the defaults |
|
|
216
|
+
| `options` | `((BaseMessage) -> List<CometChatMessageOption>?)?` | **Replace** all defaults (takes precedence over `addOptions`; return `null` to keep defaults) |
|
|
217
|
+
| `onMessageOptionClick` | `((BaseMessage, optionId: String, optionName: String) -> Unit)?` | Click handler |
|
|
218
|
+
|
|
219
|
+
Use `addOptions` for a Forward-style action so the built-in Reply/Copy/Edit/Delete survive:
|
|
220
|
+
|
|
221
|
+
```kotlin
|
|
222
|
+
import com.cometchat.uikit.core.domain.model.CometChatMessageOption
|
|
223
|
+
|
|
224
|
+
CometChatMessageList(
|
|
225
|
+
user = user,
|
|
226
|
+
addOptions = { message -> // ✅ appended to defaults
|
|
227
|
+
listOf(
|
|
228
|
+
CometChatMessageOption(
|
|
229
|
+
id = "forward",
|
|
230
|
+
title = "Forward",
|
|
231
|
+
icon = R.drawable.ic_forward,
|
|
232
|
+
onClick = { /* open forward picker for `message` */ }
|
|
233
|
+
)
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
// ❌ options = { listOf(forward) } // would DROP reply/copy/edit/delete
|
|
237
|
+
)
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
`CometChatMessageOption(id, title, titleColor, icon, iconTintColor, …, onClick)` is a data class at `CometChatMessageOption.kt:21`. Resolution order is verified in `CometChatMessageListViewModel.resolveMessageOptions` (`:817-827`): `setOptions` result wins if non-null, else `defaultOptions + addOptions`.
|
|
241
|
+
|
|
242
|
+
### 1.11 MessageTemplate via the DataSource (docs-taught alternative to BubbleFactory)
|
|
243
|
+
|
|
244
|
+
> ⚠️ **Verify before using — symbols not found in the GA v6 Compose source.** `CometChatUIKit.getDataSource()`, `getMessageTemplates()`, `CometChatMessageTemplate`, and a `templates` parameter on the Compose `CometChatMessageList` appear in the Android **docs** but are **absent from the verified `com.cometchat.uikit.compose` GA source** (they're the legacy `com.cometchat.chatuikit` v5-shaped API; the Compose list only exposes `bubbleFactories`). Treat this section as a docs reference that may not compile against your installed v6 kit — **prefer `BubbleFactory` (the confirmed v6-native path) for all new code.**
|
|
245
|
+
|
|
246
|
+
The `BubbleFactory` / slot-lambda surface above is the primary v6 customization path. The Android docs also teach a **`MessageTemplate`** path through the data source ([message-template](https://www.cometchat.com/docs/ui-kit/android/v6/message-template)) — fetch the existing templates, mutate the one you want, then re-apply (append, never replace with a single-item list):
|
|
247
|
+
|
|
248
|
+
```kotlin
|
|
249
|
+
// 1. fetch existing templates from the data source
|
|
250
|
+
val templates = CometChatUIKit.getDataSource()
|
|
251
|
+
.getMessageTemplates(additionParameter) // pass the list's additionParameter
|
|
252
|
+
.toMutableList()
|
|
253
|
+
|
|
254
|
+
// 2. mutate the template you want (or create a new one for a custom type)
|
|
255
|
+
templates.find { it.type == UIKitConstants.MessageType.TEXT }
|
|
256
|
+
?.setContentView { baseMessage, alignment ->
|
|
257
|
+
Text(text = (baseMessage as? TextMessage)?.text ?: "")
|
|
258
|
+
}
|
|
259
|
+
// new custom type:
|
|
260
|
+
val contact = CometChatMessageTemplate().apply {
|
|
261
|
+
setType("contact"); setCategory(UIKitConstants.MessageCategory.CUSTOM)
|
|
262
|
+
setContentView { baseMessage, _ -> /* custom composable */ }
|
|
263
|
+
}
|
|
264
|
+
templates.add(contact)
|
|
265
|
+
|
|
266
|
+
// 3. re-apply — Compose passes the list to CometChatMessageList
|
|
267
|
+
CometChatMessageList(user = user, templates = templates)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Compose templates expose lambda slot setters (`setContentView`, `setHeaderView`, `setFooterView`, `setBottomView`, `setStatusInfoView`, `setBubbleView`, `setOptions`) mirroring §2's slots. Prefer `BubbleFactory` for new code; use `getMessageTemplates(...)` when you want to start from the kit's defaults and tweak one type. (This overlaps the custom-message topic.)
|
|
271
|
+
|
|
138
272
|
## 2. Slot Lambda Parameters (Per-Slot Overrides)
|
|
139
273
|
|
|
140
274
|
Override individual slots across ALL message types directly on `CometChatMessageList`:
|
|
@@ -270,6 +404,23 @@ CometChatMessageList(
|
|
|
270
404
|
| No bubble replacement | `getBubbleView()` for complete replacement |
|
|
271
405
|
| Theme-level styling only | Per-factory `getBubbleStyle()` |
|
|
272
406
|
|
|
407
|
+
## Text formatters (inline mentions / URLs / custom tokens)
|
|
408
|
+
|
|
409
|
+
Style/transform message text inline by passing `textFormatters` to the composer/list. The kit ships `CometChatMentionsFormatter` + `CometChatRichTextFormatter` (subclasses of the abstract `CometChatTextFormatter`) in `com.cometchat.uikit.compose.presentation.shared.formatters`. Default behavior (a mentions formatter) applies when you pass nothing — so to ADD a custom one, include the defaults too.
|
|
410
|
+
|
|
411
|
+
```kotlin
|
|
412
|
+
import com.cometchat.uikit.compose.presentation.shared.formatters.CometChatMentionsFormatter
|
|
413
|
+
import com.cometchat.uikit.compose.presentation.shared.formatters.CometChatTextFormatter
|
|
414
|
+
|
|
415
|
+
CometChatMessageComposer(
|
|
416
|
+
user = user,
|
|
417
|
+
textFormatters = listOf(CometChatMentionsFormatter(context) /* , YourFormatter(context) */),
|
|
418
|
+
)
|
|
419
|
+
// CometChatMessageList also takes textFormatters: List<CometChatTextFormatter>.
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
For a custom @/#/! token: subclass `CometChatTextFormatter(trackingCharacter)` and implement its `search()` + view hooks (see the kit's `formatters/` source + the per-platform docs).
|
|
423
|
+
|
|
273
424
|
## Hard rules
|
|
274
425
|
|
|
275
426
|
- BubbleFactory is an `interface` — implement it, don't extend an abstract class
|
|
@@ -278,3 +429,7 @@ CometChatMessageList(
|
|
|
278
429
|
- Slot lambda parameters on `CometChatMessageList` override BubbleFactory slot methods — use lambdas for cross-type overrides, factories for per-type overrides
|
|
279
430
|
- Style classes must use `Companion.default()` factory — the data class constructor requires ALL parameters
|
|
280
431
|
- Do NOT confuse BubbleFactory (UI rendering) with DataSource (data fetching) — they are separate layers
|
|
432
|
+
|
|
433
|
+
## Sound (in-app message + call sounds)
|
|
434
|
+
|
|
435
|
+
Sound is a customization sub-dimension. The UI Kit plays incoming/outgoing message + call sounds via `CometChatSoundManager` — mute it, swap custom audio, or play a specific sound. The full API + recipe lives in **`cometchat-android-v6-compose-theming`** (Sound section). Verify the access path against the installed kit before relying on it.
|
|
@@ -3,18 +3,19 @@ name: cometchat-android-v6-compose-placement
|
|
|
3
3
|
description: "CometChat Android UIKit v6 Compose placement — setContent, Compose Navigation, Dialog, BottomSheet, and Tab patterns"
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
8
|
version: "3.0.0"
|
|
10
9
|
tags: "cometchat, android, compose, navigation, placement, screens, tabs"
|
|
11
10
|
---
|
|
12
11
|
|
|
12
|
+
> **Ground truth:** `com.cometchat:chatuikit-compose-android:6.x` composables + `docs/ui-kit/android/v6`. **Official docs:** https://www.cometchat.com/docs/ui-kit/android/v6/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
13
|
+
|
|
13
14
|
> **Companion skills:** cometchat-android-v6-kotlin-placement (Views equivalent), cometchat-android-v6-compose-components, cometchat-android-v6-compose-theming
|
|
14
15
|
|
|
15
16
|
## Purpose
|
|
16
17
|
|
|
17
|
-
Place CometChat Compose components into app screens using Compose Navigation, Dialogs, BottomSheets, and Tab layouts. Patterns derived from `
|
|
18
|
+
Place CometChat Compose components into app screens using Compose Navigation, Dialogs, BottomSheets, and Tab layouts. Patterns derived from `sample-app-compose`.
|
|
18
19
|
|
|
19
20
|
## Use this skill when
|
|
20
21
|
|
|
@@ -34,68 +35,154 @@ Place CometChat Compose components into app screens using Compose Navigation, Di
|
|
|
34
35
|
class MainActivity : ComponentActivity() {
|
|
35
36
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
36
37
|
super.onCreate(savedInstanceState)
|
|
38
|
+
// Edge-to-edge enables drawing under the system bars; safeDrawingPadding
|
|
39
|
+
// below puts CometChat content back inside the safe area.
|
|
40
|
+
enableEdgeToEdge()
|
|
37
41
|
setContent {
|
|
38
42
|
CometChatTheme {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
Box(Modifier.fillMaxSize().safeDrawingPadding()) {
|
|
44
|
+
CometChatConversations(
|
|
45
|
+
onItemClick = { conversation -> /* navigate */ }
|
|
46
|
+
)
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
```
|
|
47
53
|
|
|
54
|
+
> ⚠️ **Always wrap CometChat composables in a `Modifier.safeDrawingPadding()` (or `systemBarsPadding()`) container when using edge-to-edge (ENG-35715).** Without it the kit's top app bar / composer is clipped under the status bar / navigation gesture area on modern Android (API 30+). The kit itself does NOT apply `WindowInsets` for you — that's the host's job. On XML host activities, the equivalent is `android:fitsSystemWindows="true"` on the root view (or per-fragment).
|
|
55
|
+
|
|
48
56
|
## 2. Compose Navigation
|
|
49
57
|
|
|
50
|
-
Pattern from `
|
|
58
|
+
Pattern from `sample-app-compose/navigation/NavGraph.kt` + `messages/MessagesScreen.kt`.
|
|
59
|
+
|
|
60
|
+
> **Carry `userId` / `groupId` on the route — NOT `conversation.conversationId`.** A `conversationId` is the conversation's own identifier, not a UID/GUID; the kit components need a `User` or `Group` object. The sample resolves the route's `userId`/`groupId` back into a `User`/`Group` on the chat screen via `CometChat.getUser(...)` / `CometChat.getGroup(...)` inside a `LaunchedEffect`. `CometChatTheme {}` is applied once at the app root (see §1), so it is NOT re-wrapped here.
|
|
51
61
|
|
|
52
62
|
```kotlin
|
|
63
|
+
import androidx.navigation.NavType
|
|
53
64
|
import androidx.navigation.compose.NavHost
|
|
54
65
|
import androidx.navigation.compose.composable
|
|
55
66
|
import androidx.navigation.compose.rememberNavController
|
|
67
|
+
import androidx.navigation.navArgument
|
|
56
68
|
|
|
57
69
|
@Composable
|
|
58
70
|
fun AppNavigation() {
|
|
59
71
|
val navController = rememberNavController()
|
|
60
72
|
|
|
61
|
-
|
|
62
|
-
NavHost(navController = navController, startDestination = "conversations") {
|
|
73
|
+
NavHost(navController = navController, startDestination = "conversations") {
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
composable("conversations") {
|
|
76
|
+
CometChatConversations(
|
|
77
|
+
onItemClick = { conversation ->
|
|
78
|
+
// Resolve the participant and pass the UID/GUID on the route —
|
|
79
|
+
// NOT conversation.conversationId.
|
|
80
|
+
when (val entity = conversation.conversationWith) {
|
|
81
|
+
is User -> navController.navigate("chat?userId=${entity.uid}")
|
|
82
|
+
is Group -> navController.navigate("chat?groupId=${entity.guid}")
|
|
69
83
|
}
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
88
|
+
composable(
|
|
89
|
+
route = "chat?userId={userId}&groupId={groupId}",
|
|
90
|
+
arguments = listOf(
|
|
91
|
+
navArgument("userId") { type = NavType.StringType; nullable = true; defaultValue = null },
|
|
92
|
+
navArgument("groupId") { type = NavType.StringType; nullable = true; defaultValue = null }
|
|
93
|
+
)
|
|
94
|
+
) { backStackEntry ->
|
|
95
|
+
val userId = backStackEntry.arguments?.getString("userId")
|
|
96
|
+
val groupId = backStackEntry.arguments?.getString("groupId")
|
|
97
|
+
ChatScreen(userId = userId, groupId = groupId, onBackPress = { navController.popBackStack() })
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
composable("users") {
|
|
101
|
+
CometChatUsers(
|
|
102
|
+
onItemClick = { user ->
|
|
103
|
+
navController.navigate("chat?userId=${user.uid}")
|
|
83
104
|
}
|
|
84
|
-
|
|
105
|
+
)
|
|
106
|
+
}
|
|
85
107
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
108
|
+
composable("groups") {
|
|
109
|
+
CometChatGroups(
|
|
110
|
+
onItemClick = { group ->
|
|
111
|
+
navController.navigate("chat?groupId=${group.guid}")
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
93
118
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
119
|
+
The chat screen re-fetches the `User`/`Group` from the route key, then composes the three pieces with `imePadding()` so the keyboard pushes the composer up (matches `MessagesScreen.kt`):
|
|
120
|
+
|
|
121
|
+
```kotlin
|
|
122
|
+
import androidx.compose.foundation.layout.Column
|
|
123
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
124
|
+
import androidx.compose.foundation.layout.consumeWindowInsets
|
|
125
|
+
import androidx.compose.foundation.layout.fillMaxSize
|
|
126
|
+
import androidx.compose.foundation.layout.fillMaxWidth
|
|
127
|
+
import androidx.compose.foundation.layout.imePadding
|
|
128
|
+
import androidx.compose.foundation.layout.navigationBarsPadding
|
|
129
|
+
import androidx.compose.foundation.layout.padding
|
|
130
|
+
import androidx.compose.foundation.layout.statusBars
|
|
131
|
+
import androidx.compose.material3.Scaffold
|
|
132
|
+
import androidx.compose.runtime.*
|
|
133
|
+
import androidx.compose.ui.Modifier
|
|
134
|
+
import com.cometchat.chat.core.CometChat
|
|
135
|
+
import com.cometchat.chat.exceptions.CometChatException
|
|
136
|
+
import com.cometchat.chat.models.Group
|
|
137
|
+
import com.cometchat.chat.models.User
|
|
138
|
+
|
|
139
|
+
@Composable
|
|
140
|
+
fun ChatScreen(userId: String?, groupId: String?, onBackPress: () -> Unit) {
|
|
141
|
+
var user by remember { mutableStateOf<User?>(null) }
|
|
142
|
+
var group by remember { mutableStateOf<Group?>(null) }
|
|
143
|
+
|
|
144
|
+
// Re-fetch the entity from the route key — routes carry IDs, not objects.
|
|
145
|
+
LaunchedEffect(userId, groupId) {
|
|
146
|
+
when {
|
|
147
|
+
userId != null -> CometChat.getUser(userId, object : CometChat.CallbackListener<User>() {
|
|
148
|
+
override fun onSuccess(fetched: User) { user = fetched; group = null }
|
|
149
|
+
override fun onError(e: CometChatException) {}
|
|
150
|
+
})
|
|
151
|
+
groupId != null -> CometChat.getGroup(groupId, object : CometChat.CallbackListener<Group>() {
|
|
152
|
+
override fun onSuccess(fetched: Group) { group = fetched; user = null }
|
|
153
|
+
override fun onError(e: CometChatException) {}
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (user != null || group != null) {
|
|
159
|
+
Scaffold(contentWindowInsets = WindowInsets.statusBars) { paddingValues ->
|
|
160
|
+
Column(
|
|
161
|
+
modifier = Modifier
|
|
162
|
+
.fillMaxSize()
|
|
163
|
+
.padding(paddingValues)
|
|
164
|
+
.consumeWindowInsets(paddingValues)
|
|
165
|
+
.navigationBarsPadding()
|
|
166
|
+
.imePadding()
|
|
167
|
+
) {
|
|
168
|
+
CometChatMessageHeader(
|
|
169
|
+
modifier = Modifier.fillMaxWidth(),
|
|
170
|
+
user = user,
|
|
171
|
+
group = group,
|
|
172
|
+
hideBackButton = false,
|
|
173
|
+
onBackPress = onBackPress
|
|
174
|
+
)
|
|
175
|
+
CometChatMessageList(
|
|
176
|
+
modifier = Modifier
|
|
177
|
+
.fillMaxWidth()
|
|
178
|
+
.weight(1f),
|
|
179
|
+
user = user,
|
|
180
|
+
group = group
|
|
181
|
+
)
|
|
182
|
+
CometChatMessageComposer(
|
|
183
|
+
modifier = Modifier.fillMaxWidth(),
|
|
184
|
+
user = user,
|
|
185
|
+
group = group
|
|
99
186
|
)
|
|
100
187
|
}
|
|
101
188
|
}
|
|
@@ -190,7 +277,9 @@ CometChatOngoingCallActivity.launchOngoingCallActivity(
|
|
|
190
277
|
|
|
191
278
|
## 7. Incoming Call Overlay
|
|
192
279
|
|
|
193
|
-
|
|
280
|
+
> **Note on canonical references:** the **Compose** sample app (`sample-app-compose`) ships **without** calling enabled, so it has no incoming-call wiring to copy. The only canonical Android sample that wires incoming calls is the **Kotlin-Views** `sample-app-kotlin`, which adds `CometChatIncomingCall` to a programmatic `Snackbar` host after a `CometChat.addCallListener` fires (see `cometchat-android-v6-calls`). The Compose pattern below — register the call listener, push the `Call` into a `StateFlow`, render an overlay — is the idiomatic Compose adaptation of that same flow (you wire it yourself; it is not lifted verbatim from a sample file).
|
|
281
|
+
|
|
282
|
+
Incoming calls are shown as an overlay using a StateFlow you expose from the `Application` (register a `CometChat.addCallListener` that pushes incoming `Call`s into it):
|
|
194
283
|
|
|
195
284
|
```kotlin
|
|
196
285
|
// In Application class
|
|
@@ -210,4 +299,4 @@ incomingCall?.let { call ->
|
|
|
210
299
|
- ALWAYS wrap CometChat components in `CometChatTheme {}` at the top level — do not nest multiple `CometChatTheme` wrappers
|
|
211
300
|
- Place `CometChatTheme {}` OUTSIDE the `NavHost` so all screens share the same theme
|
|
212
301
|
- Ongoing calls MUST use `CometChatOngoingCallActivity` — they cannot be a composable screen (they need a separate Activity for PiP and lifecycle)
|
|
213
|
-
- When
|
|
302
|
+
- When navigating to a chat, carry `userId`/`groupId` on the route and re-fetch the `User`/`Group` with `CometChat.getUser`/`CometChat.getGroup` on the chat screen (see §2) — do NOT serialize full objects, and do NOT pass `conversation.conversationId` (it is not a UID/GUID)
|
|
@@ -3,13 +3,14 @@ name: cometchat-android-v6-compose-theming
|
|
|
3
3
|
description: "CometChat Android UIKit v6 Jetpack Compose theming — CometChatTheme, CompositionLocal color schemes, typography, shapes, and dark mode"
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-compose-android:6.x"
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
8
|
version: "3.0.0"
|
|
10
9
|
tags: "cometchat, android, compose, theming, colors, typography, dark-mode"
|
|
11
10
|
---
|
|
12
11
|
|
|
12
|
+
> **Ground truth:** `com.cometchat:chatuikit-{compose,kotlin}-android:6.x` (+ `calls-sdk-android:5.x`) — resolved AAR (javap) + `ui-kit/android/v6`. **Official docs:** https://www.cometchat.com/docs/ui-kit/android/v6/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
13
|
+
|
|
13
14
|
> **Companion skills:** cometchat-android-v6-kotlin-theming (Views equivalent), cometchat-android-v6-compose-components, cometchat-android-v6-compose-customization
|
|
14
15
|
|
|
15
16
|
## Purpose
|
|
@@ -215,6 +216,31 @@ lightColorScheme(
|
|
|
215
216
|
)
|
|
216
217
|
```
|
|
217
218
|
|
|
219
|
+
## Localization
|
|
220
|
+
|
|
221
|
+
To translate the UI, switch the active language, or override individual strings, route to the dedicated **`cometchat-i18n`** skill — the canonical cross-family localization reference. Android uses `CometChatLocalize.setLocale(context, Language.Code.<lang>)` / `getLocale(context)` (a separate method, **not** an `init` object — unlike web/RN). `cometchat-i18n` covers bundled languages, custom translations, and RTL. Docs: https://www.cometchat.com/docs/ui-kit/android/localize
|
|
222
|
+
|
|
223
|
+
## Sound Manager — custom notification & call sounds
|
|
224
|
+
|
|
225
|
+
Sounds are a **behavioral** customization — driven by `CometChatSoundManager`, an **instance** class that needs a `Context`. The UI Kit plays the built-in cues automatically; use this to override a cue with your own raw resource. V6 package (NOT the V5 `com.cometchat.chatuikit.*` path):
|
|
226
|
+
|
|
227
|
+
```kotlin
|
|
228
|
+
import com.cometchat.uikit.core.resources.soundmanager.CometChatSoundManager
|
|
229
|
+
import com.cometchat.uikit.core.resources.soundmanager.Sound
|
|
230
|
+
|
|
231
|
+
val soundManager = CometChatSoundManager(context)
|
|
232
|
+
|
|
233
|
+
// Play a default cue — Sound enum is SCREAMING_SNAKE_CASE: INCOMING_CALL |
|
|
234
|
+
// OUTGOING_CALL | INCOMING_MESSAGE | INCOMING_MESSAGE_FROM_OTHER | OUTGOING_MESSAGE
|
|
235
|
+
soundManager.play(Sound.INCOMING_CALL)
|
|
236
|
+
|
|
237
|
+
// Override with your own raw resource (R.raw.*)
|
|
238
|
+
soundManager.play(Sound.INCOMING_MESSAGE, R.raw.my_ping)
|
|
239
|
+
|
|
240
|
+
// Stop whatever is playing
|
|
241
|
+
soundManager.pause()
|
|
242
|
+
```
|
|
243
|
+
|
|
218
244
|
## Hard rules
|
|
219
245
|
|
|
220
246
|
- ALWAYS wrap CometChat Compose components in `CometChatTheme {}` — components will crash or look wrong without it
|