cometchat-android-v6-extensions

$npx mdskill add cometchat/cometchat-skills/cometchat-android-v6-extensions

Extend CometChat UIKit v6 data layer with custom DataSources and repositories.

  • Create custom DataSource implementations to change data fetching behavior.
  • Depends on CometChat UIKit v6 Android SDK and Kotlin 1.9+.
  • Uses clean architecture DataSource/Repository pattern to guide customizations.
  • Delivers overridden repository behavior and custom message types to the app.

SKILL.md

.github/skills/cometchat-android-v6-extensionsView on GitHub ↗
---
name: cometchat-android-v6-extensions
description: "CometChat Android UIKit v6 extension architecture — DataSource/Repository pattern, custom message types, and data-layer overrides"
license: "MIT"
compatibility: "Android 9.0+ (API 28); Kotlin 1.9+; com.cometchat:chatuikit-core-android:6.x"
metadata:
  author: "CometChat"
  version: "3.0.0"
  tags: "cometchat, android, extensions, datasource, repository, clean-architecture"
---

> **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/fundamentals/extensions-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.

> **Companion skills:** cometchat-android-v6-features (feature catalog), cometchat-android-v6-kotlin-customization, cometchat-android-v6-compose-customization

## Purpose

Extend the CometChat UIKit v6 data layer using the clean architecture DataSource/Repository pattern. Create custom DataSource implementations, override repository behavior, and register custom message types.

## Use this skill when

- Creating a custom DataSource implementation to change how data is fetched
- Overriding default repository behavior
- Registering custom message types
- Understanding the data flow from DataSource → Repository → ViewModel

## Do not use this skill when

- Customizing UI/bubble rendering (use `cometchat-*-customization` — that's the BubbleFactory layer)
- Working with component APIs (use `cometchat-*-components`)

## 1. Clean Architecture Overview

The `chatuikit-core` module follows clean architecture with three layers:

```
┌─────────────────────────────────────────┐
│  UI Layer (chatuikit-kotlin / compose)  │
│  Components observe ViewModel state     │
├─────────────────────────────────────────┤
│  ViewModel Layer (core/viewmodel/)      │
│  Calls use cases / repositories         │
├─────────────────────────────────────────┤
│  Domain Layer (core/domain/)            │
│  Repository interfaces, Use cases       │
├─────────────────────────────────────────┤
│  Data Layer (core/data/)                │
│  DataSource interfaces + impls          │
│  Repository implementations            │
└─────────────────────────────────────────┘
```

## 2. DataSource Pattern

Each feature area has a DataSource interface and default implementation:

```
core/data/datasource/
├── ConversationListDataSource.kt       (interface)
├── ConversationListDataSourceImpl.kt   (default implementation)
├── MessageListDataSource.kt
├── MessageListDataSourceImpl.kt
├── ...
```

### 2.1 All DataSource Types

| DataSource | Implementation | What it provides |
|---|---|---|
| `CallButtonsDataSource` | `CallButtonsDataSourceImpl` | Call button actions |
| `CallLogsDataSource` | `CallLogsDataSourceImpl` | Call history fetching |
| `CollaborativeDataSource` | `CollaborativeDataSourceImpl` | Document/whiteboard data |
| `ConversationListDataSource` | `ConversationListDataSourceImpl` | Conversation list fetching |
| `GroupMembersDataSource` | `GroupMembersDataSourceImpl` | Group member operations |
| `GroupsDataSource` | `GroupsDataSourceImpl` | Group list fetching |
| `MessageComposerDataSource` | `MessageComposerDataSourceImpl` | Composer actions/attachments |
| `MessageHeaderDataSource` | `MessageHeaderDataSourceImpl` | Header data (name, status) |
| `MessageInformationDataSource` | `MessageInformationDataSourceImpl` | Read receipts, delivery info |
| `MessageListDataSource` | `MessageListDataSourceImpl` | Message fetching/pagination |
| `PollDataSource` | `PollDataSourceImpl` | Poll creation/voting |
| `ReactionListDataSource` | `ReactionListDataSourceImpl` | Reaction data |
| `SearchDataSource` | `SearchDataSourceImpl` | Global search |
| `StickerDataSource` | `StickerDataSourceImpl` | Sticker fetching |
| `UsersDataSource` | `UsersDataSourceImpl` | User list fetching |

### 2.2 Additional DataSource

| File | Purpose |
|---|---|
| `MessageReceiptEventListener.kt` | Listens for receipt events at the data layer |

## 3. Repository Pattern

Repositories in `core/data/repository/` implement domain interfaces from `core/domain/repository/`:

```
core/data/repository/
├── CallButtonsRepositoryImpl.kt
├── CallLogsRepositoryImpl.kt
├── ConversationListRepositoryImpl.kt
├── GroupMembersRepositoryImpl.kt
├── GroupsRepositoryImpl.kt
├── MessageComposerRepositoryImpl.kt
├── MessageHeaderRepositoryImpl.kt
├── MessageInformationRepositoryImpl.kt
├── MessageListRepositoryImpl.kt
├── PollRepositoryImpl.kt
├── ReactionListRepositoryImpl.kt
├── SearchRepositoryImpl.kt
├── StickerRepositoryImpl.kt
├── UsersRepositoryImpl.kt
```

Each repository wraps a DataSource and adds business logic, caching, or transformation.

## 4. ViewModel Layer

ViewModels in `core/viewmodel/` consume repositories and expose UI state:

```kotlin
// Example: CometChatConversationsViewModel
// - Injected via CometChatConversationsViewModelFactory
// - Exposes StateFlow<ConversationListUIState>
// - Calls ConversationListRepositoryImpl internally
```

ViewModel factories in `core/factory/` handle dependency injection:

| Factory | ViewModel |
|---|---|
| `CometChatConversationsViewModelFactory` | `CometChatConversationsViewModel` |
| `CometChatMessageListViewModelFactory` | `CometChatMessageListViewModel` |
| `CometChatGroupsViewModelFactory` | `CometChatGroupsViewModel` |
| `CometChatUsersViewModelFactory` | `CometChatUsersViewModel` |
| `CometChatCallLogsViewModelFactory` | `CometChatCallLogsViewModel` |
| `CometChatMessageComposerViewModelFactory` | `CometChatMessageComposerViewModel` |
| `CometChatMessageHeaderViewModelFactory` | `CometChatMessageHeaderViewModel` |
| `CometChatGroupMembersViewModelFactory` | `CometChatGroupMembersViewModel` |
| `CometChatMessageInformationViewModelFactory` | `CometChatMessageInformationViewModel` |
| `CometChatReactionListViewModelFactory` | `CometChatReactionListViewModel` |
| `CometChatSearchViewModelFactory` | `CometChatSearchViewModel` |
| `CometChatCallButtonsViewModelFactory` | `CometChatCallButtonsViewModel` |
| `CometChatCreatePollViewModelFactory` | `CometChatCreatePollViewModel` |
| `CometChatThreadHeaderViewModelFactory` | `CometChatThreadHeaderViewModel` |
| `CometChatStickerKeyboardViewModelFactory` | `CometChatStickerKeyboardViewModel` |
| `CometChatIncomingCallViewModelFactory` | `CometChatIncomingCallViewModel` |
| `CometChatOutgoingCallViewModelFactory` | `CometChatOutgoingCallViewModel` |
| `CometChatAIAssistantChatHistoryViewModelFactory` | `CometChatAIAssistantChatHistoryViewModel` |

## 5. UI State Classes

Each ViewModel exposes a sealed UI state from `core/state/`:

| State Class | Used By |
|---|---|
| `CallLogsUIState` | Call logs |
| `MessageListUIState` | Message list |
| `GroupsUIState` | Groups list |
| `UsersUIState` | Users list |
| `GroupMembersUIState` | Group members |
| `MessageComposerUIState` | Composer |
| `MessageHeaderUIState` | Header |
| `MessageInformationUIState` | Message info |
| `ReactionListUIState` | Reactions |
| `SearchUIState` | Search |
| `CallButtonsUIState` | Call buttons |
| `CreatePollUIState` | Poll creation |
| `ThreadHeaderUIState` | Thread header |
| `StickerKeyboardUIState` | Sticker keyboard |
| `IncomingCallUIState` | Incoming call |
| `OutgoingCallUIState` | Outgoing call |
| `ChatHistoryUIState` | AI chat history |
| `ConversationStarterUIState` | AI conversation starter |
| `ConversationSummaryUIState` | AI conversation summary |
| `SmartRepliesUIState` | AI smart replies |
| `DeleteState` | Delete operations |
| `UIState` | Base UI state |

## 6. Data Flow

```
User Action → Component → ViewModel → Repository → DataSource → CometChat SDK
                                                                      ↓
UI Update  ← Component ← ViewModel ← StateFlow ← Repository ← SDK Response
```

## Hard rules

- DataSources are the DATA layer — they fetch and mutate data. Do NOT confuse with BubbleFactory which is the UI rendering layer
- The v5 `DataSource` decorator / `ChatConfigurator` pattern for bubble customization does NOT exist in v6 — use BubbleFactory instead (see `cometchat-*-customization`)
- ViewModels are shared across both UI stacks (Kotlin Views and Compose) — they live in `chatuikit-core`
- Always use the provided ViewModel factories — do not instantiate ViewModels directly

More from cometchat/cometchat-skills

SkillDescription
cometchatEntry-point for CometChat integration in any React, React Native, Angular, Android, Flutter, or iOS project — web (React/Next.js/React Router/Astro), React Native (Expo/bare), Angular (12-15), native Android (V6 stable, V5 legacy), Flutter (V6 stable, V5 legacy), and native iOS (V5 stable). Detects the framework, gathers requirements through an interactive conversation, and writes production-quality integration code.
cometchat-a11yAccessibility (a11y) for CometChat UI Kit integrations across all families — React, React Native, Angular, Android (V5/V6), iOS, Flutter. Covers WCAG 2.1 AA targets, keyboard navigation in chat, screen reader announcements (live regions for new messages), color contrast, focus management on call screens, motion-reduction support, and the cross-family checks that catch the common production a11y bugs. Cross-family — applies wherever the agent is checking accessibility.
cometchat-android-v5Entry-point dispatcher for CometChat Android UI Kit v5. Detects project setup, understands what the dev is building, and routes to the right sub-skills.
cometchat-android-v5-callsCometChat Calls SDK v5 integration for native Android (V5 stable, Java + Kotlin Views). Covers SDK setup (Cloudsmith Maven, CallAppSettings, init), the dual-SDK ringing pattern (Chat SDK initiateCall + Calls SDK joinSession), session settings, event listeners, call logs, recording, screen sharing, picture-in-picture, foreground service for ongoing calls, VoIP push via FCM + ConnectionService, audio/video/participant controls, custom UI, and in-call chat. Use in standalone mode (calls is the product) or additive mode (calls layered on top of an existing CometChat Android v5 chat integration).
cometchat-android-v5-componentsComplete catalog of CometChat Android UI Kit v5 components. Reference before writing integration code — never invent component names.
cometchat-android-v5-coreFoundational rules for CometChat Android UI Kit v5. Initialization, login, UIKitSettings builder, dependency setup, and anti-patterns. Read this first.
cometchat-android-v5-customizationCustomize CometChat components beyond theming — custom message templates, DataSource decorators, event listeners, and custom view slots.
cometchat-android-v5-extensionsExtension architecture for CometChat Android — ExtensionsDataSource, decorators, built-in extensions, and how to create custom extensions.
cometchat-android-v5-featuresAdd features (calls, reactions, polls, file sharing, AI, etc.) to an already-integrated CometChat project. Routes to the right sub-flow based on feature type.
cometchat-android-v5-placementWhere to put CometChat in your Android app — Activity, Fragment, BottomSheet, Dialog, Tab, or embedded patterns.