AGENT SKILL

cometchat-android-v6-migration

Upgrade an Android app from the CometChat v5 UI Kit (Java, XML Views) to v6 (Kotlin — XML Views or Jetpack Compose): artifact and package changes, the CometChatThreadedMessagesHeader rename, LiveData→StateFlow, events→CometChatEvents SharedFlow, style objects→theme attributes/style data classes, and minSdk 28. Triggers: 'upgrade cometchat android v5 to v6', 'migrate android ui kit to v6', 'v6 import paths android', 'cometchat android breaking changes'.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 1.6k
Forks
491

01 前言 Front Matter

name
cometchat-android-v6-migration
license
MIT
metadata
{ "tags": "cometchat android migration v5 v6 upgrade kotlin compose breaking-changes", "author": "CometChat", "version": "1.0.0" }
description
Upgrade an Android app from the CometChat v5 UI Kit (Java, XML Views) to v6 (Kotlin — XML Views or Jetpack Compose): artifact and package changes, the CometChatThreadedMessagesHeader rename, LiveData→StateFlow, events→CometChatEvents SharedFlow, style objects→theme attributes/style data classes, and minSdk 28. Triggers: 'upgrade cometchat android v5 to v6', 'migrate android ui kit to v6', 'v6 import paths android', 'cometchat android breaking changes'.
compatibility
FROM com.cometchat:chat-uikit-android 5.x (Java/XML Views, minSdk 24 — note the DIFFERENT artifact id; chatuikit-kotlin-android has no 5.x) TO 6.1.x (verified 6.1.1) — com.cometchat:chatuikit-kotlin-android (XML Views) or com.cometchat:chatuikit-compose-android (Compose) + chatuikit-core-android; Kotlin >=2.1 / AGP >=8.9.1; JVM 11; minSdk 28; compileSdk >=36; com.cometchat:chat-sdk-android ^5

03 SKILL.md 正文

Ground truth: the live page /ui-kit/android/upgrading-from-v5 (the authoritative breaking-change map — every mapping below is quoted from it) + catalog android-v6.json (what exists AFTER the upgrade) + COVERAGE.md (the v5→v6 verdict table). Removed/renamed v5 names appear in PROSE only — never emit a v5 symbol in a code fence.

⚠️ Before you touch code: set android.useAndroidX=true in gradle.properties. Target 6.1.1: its POMs carry the annotations-java5 exclusion and its chat-sdk 5.0.7 is all-AndroidX, so neither Jetifier nor the exclude is needed (verified on a clean app). Stopping at 6.0.x? Then also set android.enableJetifier=true (pre-AndroidX transitive → Duplicate class android.support.v4.*) and keep configurations.all { exclude(group = "org.jetbrains", module = "annotations-java5") }. Floors also rise: minSdk 28 · Kotlin 2.1 · AGP 8.9.1.

Companion skills (read first)

  • cometchat-android-v6-core — the v6 install, credentials (assets/cometchat-settings.json), initFromSettings → login → render. The migration ENDS in core's golden path; this skill gets you there.
  • After migrating: cometchat-android-v6-{kotlin,compose}-customization (styling moved), cometchat-android-v6-events (events moved).

Use this skill when

"upgrade our Android UI Kit from v5 to v6", "we're on the Java UI Kit, move us to Kotlin/Compose", "what breaks in v6?", "fix these v5 imports". This is reconciliation, not onboarding — a version_conflict is expected here and resolving it IS the job.

Prerequisites & install

Before touching code: confirm the current artifact + version, that the app builds, and minSdk. v6 requires minSdk 28 (v5 allowed 24) — if the app targets lower, that's a product decision to raise it; surface it FIRST, it can block the whole migration.

Breaking-change map (from the docs table)

Area V5 V6
Language Java Kotlin
Modules single com.cometchat:chat-uikit-android (the v5 id — not chatuikit-kotlin-android, which only ever published 6.x) chatuikit-kotlin-android (XML) or chatuikit-compose-android (Compose) + shared chatuikit-core-android
Import root com.cometchat.chatuikit.* com.cometchat.uikit.kotlin.presentation.* / com.cometchat.uikit.compose.presentation.*
CometChatUIKit com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit com.cometchat.uikit.core.CometChatUIKit
UIKitSettings com.cometchat.chatuikit.shared.cometchatuikit.UIKitSettings com.cometchat.uikit.core.UIKitSettings
State LiveData observers StateFlow / coroutines
Architecture View + ViewModel + Adapter (2 layers) View → ViewModel → Repository → DataSource (4 layers)
Events CometChat*Events.addListener()/removeListener() CometChatEvents singleton, SharedFlow collected in a coroutine scope
Theming Palette + Typography objects XML attrs extending CometChatTheme.DayNight, or the CometChatTheme {} composable
Styling setStyle(ComponentStyle) XML @StyleRes theme attributes, or style data classes .default().copy()
ViewModel access Java ViewModel + LiveData Kotlin ViewModel + StateFlow (getViewModel()/setViewModel())
List ops adapter manipulation ListOperations<T> (addItem, removeItem, updateItem, moveItemToTop, batch {})
Repository not exposed swappable via factory (*ViewModelFactory)
minSdk 24 28

Component renames — only ONE: CometChatThreadedMessagesHeader → CometChatThreadHeader. Everything else (CometChatConversations, CometChatUsers, CometChatGroups, CometChatMessageHeader, CometChatMessageList, CometChatMessageComposer, CometChatIncomingCall, CometChatOutgoingCall, CometChatCallButtons, CometChatCallLogs, CometChatGroupMembers) keeps its name and only moves package.

Codemod / steps (in this order)

  1. Decide the cohort — staying on XML Views (chatuikit-kotlin-android, smallest diff) or moving to Compose (chatuikit-compose-android, a UI rewrite of the chat screens). Ask; don't assume. Never ship both.
  2. Raise minSdk to 28 and confirm Kotlin/AGP/JVM 11 are in place.
  3. Swap the dependency to the 6.x artifact for the chosen cohort (+ the CometChat Maven repo, core §Install). Remove the v5 artifact — grep the build file for com.cometchat:chat-uikit-android (that is the v5 id) — entirely — a leftover v5 dependency is the duplicate-class/version_conflict failure.
  4. Rewrite imports (the bulk of the diff, mechanical):
    • com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit → com.cometchat.uikit.core.CometChatUIKit (same for UIKitSettings).
    • com.cometchat.chatuikit.<area>.<Component> → com.cometchat.uikit.kotlin.presentation.<area>.ui.<Component> (XML Views) or ...uikit.compose.presentation.<area>.ui.<Component> (Compose).
    • Grep targets: com.cometchat.chatuikit. (any hit is v5) and CometChatThreadedMessagesHeader (the one rename).
  5. Migrate init to v6 — the v6 default is CometChatUIKit.initFromSettings(context, callback) reading app/src/main/assets/cometchat-settings.json, then login in onSuccess (core). Move credentials out of source while you're here.
  6. Events — replace every addListener/removeListener pair with a CometChatEvents.<domain>Events.collect { } in lifecycleScope (Views) or LaunchedEffect (Compose). No manual removal (→ cometchat-android-v6-events).
  7. State — LiveData.observe(...) → collecting StateFlow in a lifecycle-aware scope.
  8. Styling/theming — style objects → theme attributes (themes.xml extending CometChatTheme.DayNight) or Compose style data classes (→ cometchat-android-v6-{kotlin,compose}-customization).
  9. Compose only: rebuild the chat screens as composables (core's golden path / cometchat-android-v6-{kotlin,compose}-placement recipes) — XML layouts hosting kit views don't carry over.
  10. Build, then run — fix per component using the docs page's "Component-by-Component Migration" section (fetch it: /ui-kit/android/upgrading-from-v5.md).

Before → after patterns

// V5 (Java) — imports + init
import com.cometchat.chatuikit.shared.cometchatuikit.CometChatUIKit;
import com.cometchat.chatuikit.conversations.CometChatConversations;
// V6 (Kotlin, XML Views cohort)
import com.cometchat.uikit.core.CometChatUIKit
import com.cometchat.uikit.kotlin.presentation.conversations.ui.CometChatConversations
// V6 events — the old addListener/removeListener pair becomes a scoped collect
lifecycleScope.launch {
    CometChatEvents.messageEvents.collect { event -> /* when (event) { ... } */ }
}

The thread header is the one rename to grep for; everything else is a package move. Full per-component diffs (Conversations, Users, Groups, Message Header/List/Composer): the docs page's component sections.

Common pitfalls

Leaving the v5 artifact in the tree (duplicate classes) · mixing both v6 cohorts · missing the minSdk 28 bump · migrating imports but keeping LiveData observers · keeping addListener/removeListener for UI-Kit events (now flows) · missing the CometChatThreadedMessagesHeader → CometChatThreadHeader rename · carrying v5 style objects forward · keeping the classic init(...) instead of moving to initFromSettings · assuming Compose is a drop-in for XML screens · migrating code but leaving credentials hardcoded.

Verify it works

Zero matches for com.cometchat.chatuikit. and CometChatThreadedMessagesHeader in the source; only ONE cometchat UI-Kit artifact resolves (./gradlew :app:dependencies); the fence gate compiles (./gradlew :app:assembleDebug # in YOUR app (npm run verify:fences:android-v6 is a pack-repo gate)). On device: init + login succeed, conversations → messages works, threads/search round-trip, events fire once, theming still matches the brand, calls/push (if used) still work. Any capability that existed in v5 and has no v6 equivalent must be reported to the user, not silently dropped — see COVERAGE.md.

04 同仓库更多 Skills

hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-review-with-annotations

Create, inspect, reply to, update, or resolve situated Worktable annotations. Use when feedback belongs to a Doc section, block, text range, or HTML Doc, or when the user asks to address existing review feedback and coordinate a requested artifact edit.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-find-and-synthesize-context

Find, assess, and synthesize context from Worktable Docs and Records. Use when the user asks what a workspace contains, wants workspace-backed research, needs current facts reconciled across artifacts, or requests a cited synthesis without changing workspace state.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-update-docs

Create, edit, rename, or maintain narrative Worktable Docs. Use for plans, decisions, briefs, notes, research syntheses, and other durable prose when the user requests a new artifact or a safe update to an existing one.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-manage-records

Organize repeated structured information as durable Worktable Records. Use for research datasets, inventories, directories, pipelines, trackers, and other collections whose items need identity, fields, filtering, links, validation, or individual updates.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-create-or-manage-interactive-html

Create or improve durable visual and interactive artifacts in Worktable. Use for dashboards, trackers, calculators, mini apps, slide presentations, and other requests that benefit from a polished HTML Doc.

★ 1.6k
hashgraph-online
hashgraph-online/awesome-codex-plugins

worktable-collaborate-threads

Read, answer, and hand off messages through durable Worktable threads with users or other authenticated participants. Use when the user asks to check addressed messages, reply to a participant, continue a thread, request another agent's help, wait briefly for a response, or watch for comments and messages sent to the agent.

★ 1.6k