@cometchat/skills 4.1.0 → 4.2.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.
Files changed (257) hide show
  1. package/bin/install.js +298 -41
  2. package/package.json +1 -1
  3. package/skills/cometchat/SKILL.md +146 -27
  4. package/skills/cometchat-a11y/SKILL.md +476 -0
  5. package/skills/cometchat-android-v5/SKILL.md +1 -1
  6. package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
  7. package/skills/cometchat-android-v5-calls/references/README.md +53 -0
  8. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
  9. package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
  10. package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
  11. package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
  12. package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
  16. package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
  17. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
  18. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
  19. package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
  20. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
  21. package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
  22. package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
  23. package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
  24. package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
  25. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
  26. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
  27. package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
  28. package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
  29. package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
  30. package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
  31. package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
  32. package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
  33. package/skills/cometchat-android-v5-components/SKILL.md +1 -1
  34. package/skills/cometchat-android-v5-core/SKILL.md +1 -1
  35. package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
  36. package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
  37. package/skills/cometchat-android-v5-features/SKILL.md +1 -1
  38. package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
  39. package/skills/cometchat-android-v5-production/SKILL.md +1 -1
  40. package/skills/cometchat-android-v5-push/SKILL.md +1 -1
  41. package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
  42. package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
  43. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
  44. package/skills/cometchat-android-v6/SKILL.md +1 -1
  45. package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
  46. package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
  47. package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
  48. package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
  49. package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
  50. package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
  51. package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
  52. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
  53. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
  54. package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
  55. package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
  56. package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
  57. package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
  58. package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
  59. package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
  60. package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
  61. package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
  62. package/skills/cometchat-android-v6-core/SKILL.md +1 -1
  63. package/skills/cometchat-android-v6-events/SKILL.md +1 -1
  64. package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
  65. package/skills/cometchat-android-v6-features/SKILL.md +1 -1
  66. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
  67. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
  68. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
  69. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
  70. package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
  71. package/skills/cometchat-android-v6-production/SKILL.md +1 -1
  72. package/skills/cometchat-android-v6-push/SKILL.md +1 -1
  73. package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
  74. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
  75. package/skills/cometchat-angular-calls/SKILL.md +511 -0
  76. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
  77. package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
  78. package/skills/cometchat-angular-calls/references/call-session.md +167 -0
  79. package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
  80. package/skills/cometchat-angular-calls/references/device-management.md +135 -0
  81. package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
  82. package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
  83. package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
  84. package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
  85. package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
  86. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
  87. package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
  88. package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
  89. package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
  90. package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
  91. package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
  92. package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
  93. package/skills/cometchat-angular-components/SKILL.md +1 -1
  94. package/skills/cometchat-angular-core/SKILL.md +1 -1
  95. package/skills/cometchat-angular-customization/SKILL.md +1 -1
  96. package/skills/cometchat-angular-features/SKILL.md +1 -1
  97. package/skills/cometchat-angular-patterns/SKILL.md +1 -1
  98. package/skills/cometchat-angular-placement/SKILL.md +1 -1
  99. package/skills/cometchat-angular-production/SKILL.md +1 -1
  100. package/skills/cometchat-angular-push/SKILL.md +403 -0
  101. package/skills/cometchat-angular-testing/SKILL.md +333 -0
  102. package/skills/cometchat-angular-theming/SKILL.md +1 -1
  103. package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
  104. package/skills/cometchat-astro-patterns/SKILL.md +1 -1
  105. package/skills/cometchat-calls/SKILL.md +358 -0
  106. package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
  107. package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
  108. package/skills/cometchat-calls/references/use-case-support.md +190 -0
  109. package/skills/cometchat-calls/references/use-case-team.md +169 -0
  110. package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
  111. package/skills/cometchat-components/SKILL.md +1 -1
  112. package/skills/cometchat-core/SKILL.md +1 -1
  113. package/skills/cometchat-customization/SKILL.md +2 -2
  114. package/skills/cometchat-features/SKILL.md +2 -2
  115. package/skills/cometchat-flutter-v5/SKILL.md +1 -1
  116. package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
  117. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
  118. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
  119. package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
  120. package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
  121. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
  122. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
  123. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
  124. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
  125. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
  126. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
  127. package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
  128. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
  129. package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
  130. package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
  131. package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
  132. package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
  133. package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
  134. package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
  135. package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
  136. package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
  137. package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
  138. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
  139. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
  140. package/skills/cometchat-flutter-v6/SKILL.md +1 -1
  141. package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
  142. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
  143. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
  144. package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
  145. package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
  146. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
  147. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
  148. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
  149. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
  150. package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
  151. package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
  152. package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
  153. package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
  154. package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
  155. package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
  156. package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
  157. package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
  158. package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
  159. package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
  160. package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
  161. package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
  162. package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
  163. package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
  164. package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
  165. package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
  166. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
  167. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
  168. package/skills/cometchat-i18n/SKILL.md +358 -0
  169. package/skills/cometchat-ios/SKILL.md +5 -5
  170. package/skills/cometchat-ios-calls/SKILL.md +409 -0
  171. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
  172. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
  173. package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
  174. package/skills/cometchat-ios-calls/references/call-session.md +221 -0
  175. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
  176. package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
  177. package/skills/cometchat-ios-calls/references/device-management.md +171 -0
  178. package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
  179. package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
  180. package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
  181. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
  182. package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
  183. package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
  184. package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
  185. package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
  186. package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
  187. package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
  188. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
  189. package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
  190. package/skills/cometchat-ios-components/SKILL.md +1 -1
  191. package/skills/cometchat-ios-core/SKILL.md +1 -1
  192. package/skills/cometchat-ios-customization/SKILL.md +1 -1
  193. package/skills/cometchat-ios-features/SKILL.md +1 -1
  194. package/skills/cometchat-ios-placement/SKILL.md +1 -1
  195. package/skills/cometchat-ios-production/SKILL.md +1 -1
  196. package/skills/cometchat-ios-push/SKILL.md +1 -1
  197. package/skills/cometchat-ios-testing/SKILL.md +371 -0
  198. package/skills/cometchat-ios-theming/SKILL.md +1 -1
  199. package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
  200. package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
  201. package/skills/cometchat-native-calls/SKILL.md +599 -0
  202. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
  203. package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
  204. package/skills/cometchat-native-calls/references/call-session.md +182 -0
  205. package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
  206. package/skills/cometchat-native-calls/references/device-management.md +135 -0
  207. package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
  208. package/skills/cometchat-native-calls/references/group-calls.md +291 -0
  209. package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
  210. package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
  211. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
  212. package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
  213. package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
  214. package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
  215. package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
  216. package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
  217. package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
  218. package/skills/cometchat-native-calls/references/share-invite.md +144 -0
  219. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
  220. package/skills/cometchat-native-components/SKILL.md +1 -1
  221. package/skills/cometchat-native-core/SKILL.md +1 -1
  222. package/skills/cometchat-native-customization/SKILL.md +1 -1
  223. package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
  224. package/skills/cometchat-native-features/SKILL.md +1 -1
  225. package/skills/cometchat-native-placement/SKILL.md +1 -1
  226. package/skills/cometchat-native-production/SKILL.md +1 -1
  227. package/skills/cometchat-native-push/SKILL.md +1 -1
  228. package/skills/cometchat-native-testing/SKILL.md +1 -1
  229. package/skills/cometchat-native-theming/SKILL.md +1 -1
  230. package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
  231. package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
  232. package/skills/cometchat-placement/SKILL.md +1 -1
  233. package/skills/cometchat-production/SKILL.md +1 -1
  234. package/skills/cometchat-react-calls/SKILL.md +539 -0
  235. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
  236. package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
  237. package/skills/cometchat-react-calls/references/call-session.md +235 -0
  238. package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
  239. package/skills/cometchat-react-calls/references/device-management.md +206 -0
  240. package/skills/cometchat-react-calls/references/group-calls.md +262 -0
  241. package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
  242. package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
  243. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
  244. package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
  245. package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
  246. package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
  247. package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
  248. package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
  249. package/skills/cometchat-react-calls/references/share-invite.md +176 -0
  250. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
  251. package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
  252. package/skills/cometchat-react-patterns/SKILL.md +1 -1
  253. package/skills/cometchat-react-push/SKILL.md +448 -0
  254. package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
  255. package/skills/cometchat-react-testing/SKILL.md +404 -0
  256. package/skills/cometchat-theming/SKILL.md +3 -3
  257. package/skills/cometchat-troubleshooting/SKILL.md +2 -2
@@ -3,7 +3,7 @@ name: cometchat-native-bare-patterns
3
3
  description: "Integration patterns for bare React Native CLI projects — pod install, Info.plist + AndroidManifest permissions, Apple privacy manifest, native module linking, Metro config."
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; React Native >=0.77; @cometchat/chat-uikit-react-native ^5"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory, AskUserQuestion"
6
+ allowed-tools: "shell, file-read, file-search, file-list, ask-user"
7
7
  metadata:
8
8
  author: "CometChat"
9
9
  version: "3.0.0"
@@ -350,11 +350,53 @@ const appId = Config.COMETCHAT_APP_ID;
350
350
 
351
351
  **iOS post-setup**: Xcode needs to know about the `.env` file. Either use `react-native-config`'s Xcode build-phase script (documented in its README) or create a `.xcconfig` file. Without this, `Config.*` returns `undefined` on iOS.
352
352
 
353
- ### Option B — `babel-plugin-dotenv-import`
353
+ ### Option B — `react-native-dotenv` (`@env` imports, very common)
354
+
355
+ ```bash
356
+ npm install --save-dev react-native-dotenv
357
+ ```
358
+
359
+ Add to `babel.config.js`:
360
+
361
+ ```js
362
+ module.exports = {
363
+ presets: ['module:@react-native/babel-preset'],
364
+ plugins: [
365
+ ['module:react-native-dotenv', { moduleName: '@env' }],
366
+ ],
367
+ };
368
+ ```
369
+
370
+ Create `.env` and consume via `@env` imports:
371
+
372
+ ```ts
373
+ import { COMETCHAT_APP_ID, COMETCHAT_REGION, COMETCHAT_AUTH_KEY } from '@env';
374
+ ```
375
+
376
+ **⚠️ `react-native-dotenv` is a babel-time plugin — `.env` changes need a Metro cache reset (validated 2026-05-14).**
377
+
378
+ The plugin reads `.env` at babel compile time and inlines values. Editing `.env` and reloading does NOT pick up new values — Metro keeps the previously bundled inline value forever. Workflow when creds change:
379
+
380
+ ```bash
381
+ pkill -9 -f "react-native start"
382
+ npx react-native start --reset-cache
383
+
384
+ # react-native start does NOT run `adb reverse` like run-android does —
385
+ # restore the port forwarding manually:
386
+ adb reverse tcp:8081 tcp:8081
387
+
388
+ # Then force-stop + relaunch the app
389
+ adb shell am force-stop com.<package>
390
+ adb shell monkey -p com.<package> -c android.intent.category.LAUNCHER 1
391
+ ```
392
+
393
+ Silent failure mode: device shows "unable to load scripts" (no adb reverse) OR app boots with old credentials (cache not cleared). Hit twice on the rn-new / rn-existing cohorts 2026-05-14.
394
+
395
+ ### Option C — `babel-plugin-dotenv-import`
354
396
 
355
397
  Simpler but less mature. Only if the user's already picked this.
356
398
 
357
- ### Option C — hardcoded constants (NEVER for production)
399
+ ### Option D — hardcoded constants (NEVER for production)
358
400
 
359
401
  For a quick dev-mode proof-of-concept only, just declare the values as constants in a dedicated config file:
360
402
 
@@ -0,0 +1,599 @@
1
+ ---
2
+ name: cometchat-native-calls
3
+ description: CometChat Calls SDK integration for React Native (Expo managed + bare CLI). Covers @cometchat/calls-sdk-react-native install, dual-SDK init, native module linking (iOS pods, Android Gradle), VoIP push via react-native-callkeep + react-native-voip-push-notification + @react-native-firebase/messaging, CallKit on iOS / ConnectionService on Android, foreground service correctness on Android 14+, gesture handler + reanimated peer deps, Expo-specific config plugins, and additive-vs-standalone modes.
4
+ license: "MIT"
5
+ compatibility: "React Native >= 0.70 (>= 0.72 recommended), Expo SDK >= 49 (managed) / bare RN CLI; @cometchat/calls-sdk-react-native ^4.x; @cometchat/chat-sdk-react-native ^4.x; @cometchat/chat-uikit-react-native ^5.x (additive mode)"
6
+ allowed-tools: "shell, file-read, file-search, file-list, ask-user"
7
+ metadata:
8
+ author: "CometChat"
9
+ version: "4.0.0"
10
+ tags: "cometchat react-native calls voice video webrtc expo bare-rn callkeep voip-push pushkit callkit connectionservice fcm gesture-handler"
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Production-grade voice + video calling for React Native (Expo managed + bare CLI). Loaded by `cometchat-calls` when `framework` is `expo` or `react-native`. Operates in two modes:
16
+
17
+ - **Standalone** — calls is the product. Chat SDK (signaling) + Calls SDK (WebRTC) + your own RN screens. **VoIP push is mandatory** — same rule as native iOS / Android.
18
+ - **Additive** — calls layered onto an existing CometChat React Native UI Kit integration. Adds call buttons inline, mounts `CometChatIncomingCall` at app root.
19
+
20
+ **Read these other skills first:**
21
+ - `cometchat-calls` — dispatcher (modes, hard rules, anti-patterns)
22
+ - `cometchat-native-core` — Chat SDK init, login, env conventions, gesture handler peer-dep rules
23
+ - Framework path: `cometchat-native-expo-patterns` (managed) OR `cometchat-native-bare-patterns` (CLI)
24
+
25
+ **Ground truth:**
26
+ - SDK source — `~/Downloads/calls-sdk/calls-sdk-react-native-5/package/`
27
+ - Sample app — `~/Downloads/calls-sdk/calls-sdk-react-native-5/sample-apps/cometchat-calls-sample-app-react-native/`
28
+ - Public docs — https://www.cometchat.com/docs/calls/react-native/overview
29
+
30
+ ---
31
+
32
+ ## 1. Hard rules — RN specialization
33
+
34
+ ### 1.0 Calls SDK login is its own step (v5+)
35
+
36
+ The v5 Calls SDK has its own auth state, separate from the Chat SDK. After `CometChat.login(uid, AUTH_KEY)` succeeds, you MUST also call `await CometChatCalls.login(uid, AUTH_KEY)` — without it, the FIRST calls API call (`initiateCall`, `joinSession`, `generateToken`) throws **"auth token cannot be null"**. The chat skill's "login once, persist forever" pattern does NOT transfer.
37
+
38
+ ```ts
39
+ import { CometChat } from "@cometchat/chat-sdk-react-native";
40
+ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
41
+
42
+ // ✓ RIGHT — chat login first, then calls login
43
+ await CometChat.login(uid, AUTH_KEY);
44
+ try {
45
+ const callUser = await CometChatCalls.login(uid, AUTH_KEY); // dev mode
46
+ // OR for production:
47
+ // const callUser = await CometChatCalls.loginWithAuthToken(authToken);
48
+ } catch (e) {
49
+ // surface to user — common cause: typo in app id / auth key
50
+ }
51
+ ```
52
+
53
+ **Surprises that bite on real devices:**
54
+ - The Chat SDK persists login across launches via AsyncStorage; the **Calls SDK does NOT**. Even if `CometChat.getLoggedinUser()` returns a non-null user on cold start, call `CometChatCalls.login` again before any calls API works.
55
+ - A single-arg `CometChatCalls.login(uid)` overload exists for re-login when the SDK has cached auth — default to the (uid, AUTH_KEY) form for dev to avoid foot-guns.
56
+ - Login errors surface as Promise rejections — wrap in try/catch.
57
+
58
+ ### 1.1 Dual-SDK contract
59
+
60
+ Same shape as web. `@cometchat/chat-sdk-react-native` initiates ringing; `@cometchat/calls-sdk-react-native` runs the WebRTC session. Both packages.
61
+
62
+ ```ts
63
+ import { CometChat } from "@cometchat/chat-sdk-react-native";
64
+ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
65
+
66
+ // Chat SDK — initiate
67
+ const outgoing = new CometChat.Call(receiverUid, CometChat.CALL_TYPE.VIDEO, CometChat.RECEIVER_TYPE.USER);
68
+ const initiated = await CometChat.initiateCall(outgoing);
69
+
70
+ // Calls SDK — generate the token (v5 takes only sessionId; auth is internal after login).
71
+ const { token: callToken } = await CometChatCalls.generateToken(initiated.getSessionId());
72
+
73
+ // On RN, session/join is rendered via the SDK's declarative Component.
74
+ // There is NO imperative joinSession(token, settings, viewRef) on RN — the
75
+ // Component IS the call surface. With the kit, <CometChatOngoingCall />
76
+ // wraps this internally. For custom UI, render <CometChatCalls.Component
77
+ // callToken={callToken} /> directly. See references/custom-ui.md.
78
+ ```
79
+
80
+ ### 1.2 VoIP push — react-native-callkeep + platform-specific push
81
+
82
+ VoIP push on RN is the highest-effort piece. The standard production stack:
83
+
84
+ - **`react-native-callkeep`** — bridges CallKit (iOS) + ConnectionService (Android). Single API for "report incoming call to OS"
85
+ - **`react-native-voip-push-notification`** — iOS PushKit token registration + payload delivery
86
+ - **`@react-native-firebase/messaging`** — Android FCM high-priority data messages
87
+ - **Server side** — your push server must split iOS sends to PushKit (VoIP cert) and Android sends to FCM with `priority: "high"` and a `data` payload (NOT `notification`, which ConnectionService can't intercept)
88
+
89
+ The skill scaffolds all four pieces in standalone mode. Additive mode prompts before adding (it's substantial).
90
+
91
+ ### 1.3 Foreground service — same Android 14+ rules as native
92
+
93
+ When the call is active on Android, an ongoing-call foreground service must run. `react-native-callkeep` handles registration but the app's `AndroidManifest.xml` must declare:
94
+
95
+ ```xml
96
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
97
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
98
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
99
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
100
+ <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
101
+ <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE" />
102
+ ```
103
+
104
+ Same silent-crash failure mode as native Android (cf. `cometchat-android-v5-calls` rule 1.3).
105
+
106
+ For Expo managed, these go into `app.json` `expo.android.permissions` AND require a config plugin (`react-native-callkeep`'s plugin) to merge into the generated `AndroidManifest.xml` during prebuild. Bare RN can edit the manifest directly.
107
+
108
+ ### 1.4 Server-minted auth tokens
109
+
110
+ Same — `cometchat-native-production` covers it.
111
+
112
+ ### 1.5 Hangup cleanup — RTCPeerConnection + audio session
113
+
114
+ Combined web + iOS rules. RN's WebRTC bridge wraps both:
115
+
116
+ ```ts
117
+ function endCall() {
118
+ CometChatCalls.leaveSession(); // v5 canonical (endSession is a deprecated shim)
119
+ RNCallKeep.endCall(callUUID); // tells CallKit/ConnectionService the call ended
120
+
121
+ // iOS: matching audio session deactivation happens inside callkeep
122
+ // Android: foreground service stop happens inside callkeep
123
+ }
124
+ ```
125
+
126
+ Skipping `RNCallKeep.endCall` leaves the system call UI stuck (lock-screen card persists, OS thinks there's an active call). Common bug.
127
+
128
+ ### 1.6 Permissions
129
+
130
+ Required:
131
+
132
+ - iOS `Info.plist` — `NSCameraUsageDescription`, `NSMicrophoneUsageDescription` (same as native)
133
+ - Android — runtime requests via `PermissionsAndroid.requestMultiple` for `RECORD_AUDIO`, `CAMERA`, `POST_NOTIFICATIONS` (Android 13+)
134
+ - Expo managed — declare in `app.json` `expo.ios.infoPlist` and `expo.android.permissions`; the prebuild merges into native manifests
135
+
136
+ ### 1.7 IncomingCall mounted at app root
137
+
138
+ `<CometChatIncomingCall />` (additive mode) goes inside the root navigator OR in the App.tsx wrapper, ABOVE all stacks/tabs. Same rule as web — calls only ring on screens where the listener exists.
139
+
140
+ In standalone mode, CallKit/ConnectionService own the foreground UI; `<CometChatIncomingCall />` is not used. Instead, a `react-native-callkeep` event listener at app root reports new calls to the OS.
141
+
142
+ ### 1.8 Three canonical provider/scaffold patterns (non-negotiable)
143
+
144
+ Validated across 4 RN cohorts on 2026-05-14. Each bug silently breaks integration in a different way; each fix is one line. Future scaffolds MUST emit all three.
145
+
146
+ **1.8.a — `getLoggedInUser()` throws on no-session; always `.catch(() => null)`.**
147
+
148
+ ```ts
149
+ // ❌ Throws "User not found" on every fresh launch → init fails → app stuck
150
+ const existing = await CometChatUIKit.getLoggedInUser();
151
+ if (existing) return;
152
+
153
+ // ✅
154
+ const existing = await CometChatUIKit.getLoggedInUser().catch(() => null);
155
+ if (existing) return;
156
+ ```
157
+
158
+ The RN SDK treats "no logged-in user" as a thrown error (not `null`), unlike the web SDK. Without the catch, every fresh launch aborts before reaching `login()`.
159
+
160
+ **1.8.b — Render `e.message`, not `String(e)`.**
161
+
162
+ ```ts
163
+ // ❌ Most CometChat SDK errors are plain objects, not Error subclasses
164
+ // → setError(String(e)) shows "[object Object]" on screen
165
+ catch (e) {
166
+ setError(String(e));
167
+ }
168
+
169
+ // ✅
170
+ catch (e) {
171
+ initialized = false; // let hot-reload retry
172
+ const msg = e instanceof Error ? e.message : JSON.stringify(e);
173
+ setError(msg);
174
+ }
175
+ ```
176
+
177
+ Hiding the underlying error from the user is the single biggest debugging-time-sink in this stack. Always render `e.message` (or `JSON.stringify(e)` as fallback) so the actionable text reaches the screen.
178
+
179
+ **1.8.c — DO NOT pass `onAccept` to `<CometChatIncomingCall>`.**
180
+
181
+ ```tsx
182
+ // ❌ Short-circuits the kit's internal acceptCall + OngoingCall transition.
183
+ // Symptom: callee taps Accept; caller's outgoing screen stays on "Calling…"
184
+ // indefinitely; the call connects at server level but UI never transitions.
185
+ <CometChatIncomingCall call={call} onAccept={(c) => navigate('OngoingCall', ...)} ... />
186
+
187
+ // ✅ Let the kit own the accept path; only handle decline + error
188
+ <CometChatIncomingCall
189
+ call={call}
190
+ onDecline={() => setCallReceived(false)}
191
+ onError={() => setCallReceived(false)}
192
+ />
193
+ ```
194
+
195
+ The kit calls `CometChat.acceptCall` internally and pushes its own OngoingCall surface. Providing `onAccept` replaces that behavior with the caller's function — typically incomplete, never matches what the kit does.
196
+
197
+ **Also recommended** — guard creds at init time so undefined `@env`/`process.env.EXPO_PUBLIC_*` values surface as actionable errors:
198
+
199
+ ```ts
200
+ if (!appId || !region) {
201
+ throw new Error(
202
+ `Missing CometChat credentials at init time: appId=${JSON.stringify(appId)}, region=${JSON.stringify(region)}. ` +
203
+ `Check .env defines COMETCHAT_APP_ID/COMETCHAT_REGION/COMETCHAT_AUTH_KEY ` +
204
+ `and restart Metro with cache wipe.`,
205
+ );
206
+ }
207
+ ```
208
+
209
+ Without this guard, undefined env values produce opaque `TypeError: undefined is not a function` from deep inside the SDK — the most expensive failure mode of a typo'd env name.
210
+
211
+ ---
212
+
213
+ ## 2. Setup
214
+
215
+ ### Bare RN CLI
216
+
217
+ ```bash
218
+ npm install @cometchat/chat-sdk-react-native @cometchat/calls-sdk-react-native
219
+ npm install react-native-callkeep react-native-voip-push-notification @react-native-firebase/app @react-native-firebase/messaging
220
+ npm install react-native-webrtc # Calls SDK peer dep
221
+ npm install react-native-gesture-handler react-native-reanimated # already installed if using UI Kit
222
+ ```
223
+
224
+ **iOS — four hardening steps before `pod install`** (validated 2026-05-14 on Apple Silicon, iOS 26.5 sim):
225
+
226
+ 1. **`USE_FRAMEWORKS=static pod install`** — required for WebRTC + CometChat pods. Default dynamic linkage silently produces a binary that can't load WebRTC at runtime. Set in shell rc or invoke every time:
227
+
228
+ ```bash
229
+ cd ios && USE_FRAMEWORKS=static pod install && cd ..
230
+ # Subsequent builds:
231
+ USE_FRAMEWORKS=static npx react-native run-ios
232
+ ```
233
+
234
+ 2. **Remove `EXCLUDED_ARCHS arm64 i386` from `ios/Podfile`** (Apple Silicon). RN templates often add this Intel-era workaround to the post-install hook; on Apple Silicon it blocks `react-native-webrtc`/`JitsiWebRTC` arm64 slices from linking against the simulator. Delete the line:
235
+
236
+ ```ruby
237
+ # ❌ Remove this from post_install on Apple Silicon
238
+ config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64 i386'
239
+ ```
240
+
241
+ 3. **`ios/Info.plist`** — minimum set for calls:
242
+
243
+ ```xml
244
+ <key>NSCameraUsageDescription</key>
245
+ <string>Camera access for video calls</string>
246
+ <key>NSMicrophoneUsageDescription</key>
247
+ <string>Microphone access for voice and video calls</string>
248
+ <key>NSBluetoothAlwaysUsageDescription</key>
249
+ <string>Bluetooth access for using headsets during calls</string>
250
+ <key>UIBackgroundModes</key>
251
+ <array>
252
+ <string>audio</string>
253
+ <string>voip</string>
254
+ <string>remote-notification</string>
255
+ </array>
256
+ ```
257
+
258
+ `UIBackgroundModes: audio` is the load-bearing one for call-audio survival when the app backgrounds; without it, audio cuts the instant the app loses foreground. `NSBluetoothAlways` prevents a crash when the user connects a Bluetooth headset mid-call.
259
+
260
+ 4. **`ios/.xcode.env.local` NODE_BINARY** — point at a stable Homebrew Node path, not an nvm path that may have been cleaned up:
261
+
262
+ ```bash
263
+ # ios/.xcode.env.local
264
+ export NODE_BINARY=/opt/homebrew/opt/node@20/bin/node
265
+ ```
266
+
267
+ nvm paths in `~/.nvm/versions/node/v20.x.y/bin/node` go stale when nvm prunes — Xcode build fails with `node: command not found`. Homebrew `/opt/homebrew/opt/node@20/bin/node` is symlinked to whatever node@20.x is currently installed; survives `brew upgrade`.
268
+
269
+ **iOS-on-RN works even where iOS V5 NATIVE is blocked.** The native iOS V5 cohort is gated upstream by a Cloudsmith 404 on `cometchat-calls-ios`. The RN-on-iOS path links a different WebRTC surface (`react-native-webrtc` + `JitsiWebRTC` pod transitives), so customers on RN + iOS are NOT blocked by the native cohort's vendor issue.
270
+
271
+ **Android — manifest permissions** (rule 1.3 + 1.6), Firebase config (`google-services.json` in `android/app/`), service registration:
272
+
273
+ ```xml
274
+ <service
275
+ android:name="io.wazo.callkeep.RNCallKeepBackgroundMessagingService"
276
+ android:foregroundServiceType="phoneCall|microphone|camera"
277
+ android:exported="false" />
278
+ ```
279
+
280
+ ### Expo managed
281
+
282
+ Calls SDK requires native modules — Expo managed CANNOT run it without a custom dev client. The skill detects the project mode:
283
+
284
+ - **Managed + has `expo-dev-client`**: scaffolds config plugins for callkeep/firebase/voip-push, regenerates native projects, builds dev client
285
+ - **Managed without dev client**: prompts the user — calls require either ejecting to bare or adding `expo-dev-client`
286
+ - **EAS Build**: configures `eas.json` profiles + build commands
287
+
288
+ Expo Go (the public dev client) cannot run calls. The skill states this clearly and refuses to scaffold without a dev client.
289
+
290
+ #### ⚠️ Real build-time landmines on Expo SDK 54 + chat-uikit-react-native 5.3.x (validated 2026-05-14, 4 cohorts)
291
+
292
+ A previous version of this doc listed three "Expo SDK 54 build traps" (document-picker removal, react-native-worklets install, NDK override). Re-validation on 2026-05-14 across **expo-new, expo-existing, rn-new, rn-existing** showed **none of those three fired** on the current combo (`chat-uikit-react-native@5.3.5` + `calls-sdk-react-native@5.0.0`/`4.4.1` + Expo SDK 54). Removed. The real landmines on this combo are different:
293
+
294
+ 1. **`@cometchat/calls-lib-webrtc` is Cloudsmith-only, NOT on npm.** `npm install @cometchat/calls-lib-webrtc` returns 404. The package lives on CometChat's Cloudsmith registry. Use the tarball URL:
295
+
296
+ ```bash
297
+ npm install --legacy-peer-deps \
298
+ 'https://dl.cloudsmith.io/public/cometchat/cometchat/raw/files/cometchat-calls-lib-webrtc-346a46ff.tgz'
299
+ ```
300
+
301
+ The exact revision hash may roll forward — check the Cloudsmith page for the current version. Without this, runtime fails when the WebRTC layer initializes.
302
+
303
+ 2. **`--legacy-peer-deps` silently strips peer deps the kit needs at runtime.** chat-uikit-react-native does not declare all its transitive runtime peers in `peerDependencies` (kit + calls SDK together pull in `expo-linking`, `expo-constants`, `expo-asset`, `expo-font` via expo-router, plus `valibot`, `zustand`, `@xmldom/xmldom`, `abab`, `promise.allsettled`, `text-encoding`, `react-native-url-polyfill`, `react-native-performance`). With `--legacy-peer-deps`, npm skips them. Each one bites on first bundle as `Unable to resolve module ...`. Reinstall them explicitly:
304
+
305
+ ```bash
306
+ # Bare RN
307
+ npm install --legacy-peer-deps \
308
+ valibot zustand @xmldom/xmldom abab promise.allsettled text-encoding \
309
+ react-native-url-polyfill react-native-performance
310
+
311
+ # Expo (resolves to SDK-compatible versions)
312
+ npx expo install \
313
+ expo-linking expo-constants expo-asset expo-font \
314
+ -- --legacy-peer-deps
315
+ ```
316
+
317
+ 3. **`expo.extra` (app.json) caches on the Expo dev client manifest.** Edits to `app.json → expo.extra` after `expo prebuild` do NOT reload to the device — `Constants.expoConfig.extra` keeps reading the prebuild-time snapshot. For dev iteration on credentials, EITHER hardcode in `src/config/*.ts` (Metro hot-bundles source changes) OR run `expo prebuild --clean && expo run:android` after every `app.json → extra` change.
318
+
319
+ 4. **`react-native start` does NOT run `adb reverse` (bare RN only).** Only `react-native run-android` sets `adb reverse tcp:8081 tcp:8081`. When you restart Metro standalone (e.g. after `.env` changes), the device loses port-forwarding and shows "unable to load scripts." Fix:
320
+
321
+ ```bash
322
+ adb reverse tcp:8081 tcp:8081
323
+ ```
324
+
325
+ 5. **`react-native-dotenv` needs Metro `--reset-cache` after `.env` changes (bare RN only).** The babel plugin processes `.env` at compile time, not runtime. Workflow:
326
+
327
+ ```bash
328
+ pkill -9 -f "react-native start"
329
+ npx react-native start --reset-cache
330
+ adb reverse tcp:8081 tcp:8081
331
+ adb shell am force-stop com.<package> && adb shell monkey -p com.<package> -c android.intent.category.LAUNCHER 1
332
+ ```
333
+
334
+ ### Init
335
+
336
+ ```ts
337
+ // cometchat/init.ts
338
+ import { CometChat } from "@cometchat/chat-sdk-react-native";
339
+ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
340
+
341
+ let initialized = false;
342
+
343
+ export async function initCometChat() {
344
+ if (initialized) return;
345
+
346
+ const appSettings = new CometChat.AppSettingsBuilder()
347
+ .subscribePresenceForAllUsers()
348
+ .setRegion(process.env.EXPO_PUBLIC_COMETCHAT_REGION!)
349
+ .build();
350
+
351
+ await CometChat.init(process.env.EXPO_PUBLIC_COMETCHAT_APP_ID!, appSettings);
352
+
353
+ const callAppSettings = new CometChatCalls.CallAppSettingsBuilder()
354
+ .setAppId(process.env.EXPO_PUBLIC_COMETCHAT_APP_ID!)
355
+ .setRegion(process.env.EXPO_PUBLIC_COMETCHAT_REGION!)
356
+ .build();
357
+
358
+ CometChatCalls.init(callAppSettings);
359
+
360
+ initialized = true;
361
+ }
362
+ ```
363
+
364
+ (Bare RN uses `react-native-dotenv` and `@env` imports instead of `process.env.EXPO_PUBLIC_*` — see `cometchat-native-bare-patterns`.)
365
+
366
+ ---
367
+
368
+ ## 3. Components catalog
369
+
370
+ ### Calls SDK primitives
371
+
372
+ Same names + shapes as the JavaScript SDK (Section 3 of `cometchat-react-calls`). The RN SDK adds platform-specific helpers — `CometChatCalls.setUserVideoProxy` for native track piping etc. — covered in deeper sample-app references.
373
+
374
+ ### UI Kit views (additive mode — `@cometchat/chat-uikit-react-native`)
375
+
376
+ | Component | Purpose |
377
+ |---|---|
378
+ | `<CometChatCallButtons user={u} group={g} />` | Voice + video icon row (typically inside `CometChatMessageHeader`). **Group + user semantics differ** — see callout below |
379
+ | `<CometChatIncomingCall />` | Root-mounted listener |
380
+ | `<CometChatOutgoingCall />` | Auto-mounted by IncomingCall on initiate |
381
+ | `<CometChatOngoingCall />` | Active call view |
382
+ | `<CometChatCallLogs onItemClick={fn} />` | History |
383
+
384
+ #### ⚠️ Group calls use message-based join, not the ringing channel (validated 2026-05-15)
385
+
386
+ `<CometChatCallButtons group={group} />` does NOT call `CometChat.initiateCall` like the 1:1 user variant does. Source: `node_modules/@cometchat/chat-uikit-react-native/src/calls/CometChatCallButtons/CometChatCallButtons.tsx:138-201`.
387
+
388
+ | Surface | What `<CometChatCallButtons>` does |
389
+ |---|---|
390
+ | `user={u}` | `CometChat.initiateCall(call)` → standard Ringing flow → `onIncomingCallReceived` fires on peer's `CallListener` |
391
+ | `group={g}` | `CometChat.sendCustomMessage(meetingMessage)` → meeting-card message in the group; caller jumps straight to in-call surface |
392
+
393
+ **Implication for receivers:**
394
+ - **Other kit-based clients** (apps using `<CometChatMessageList />` to render group messages) — get the "Join meeting" card rendered automatically; tap to join. No additional plumbing.
395
+ - **Custom-UI clients** (apps that render their own message list, or no list at all) — receive NOTHING on the `CallListener` channel for group calls. To handle group meetings, add a `CometChat.addMessageListener` and check for the custom meeting type:
396
+
397
+ ```ts
398
+ CometChat.addMessageListener('GROUP_MEETING_LISTENER', new CometChat.MessageListener({
399
+ onCustomMessageReceived: (msg) => {
400
+ if (msg.getCategory() === CometChat.CATEGORY_CUSTOM && msg.getType() === 'meeting') {
401
+ const sessionId = (msg.getCustomData() as any)?.sessionId;
402
+ const callType = (msg.getCustomData() as any)?.callType; // "audio" | "video"
403
+ // Show your own "incoming group call" UI; tap to navigate to ongoing-call with sessionId
404
+ }
405
+ },
406
+ }));
407
+ ```
408
+
409
+ This semantic is the same across all CometChat kits (React, Angular, native iOS, native Android, Flutter) — group calls broadcast via custom message, NOT the ringing channel. Document loudly because the symptom (group-call recipient sees nothing) looks like a bug but is by design.
410
+
411
+ ---
412
+
413
+ ## 4. Standalone integration
414
+
415
+ When `product === "voice-video"` and there is no existing UI Kit.
416
+
417
+ **Split by calling mode — these are two different shapes:**
418
+
419
+ ### 4a. Standalone — Session mode (meeting-room UX, no ringing)
420
+
421
+ Calls SDK ONLY. NO Chat SDK. Matches `~/Downloads/calls-sdk/calls-sdk-react-native-5/sample-apps/cometchat-calls-sample-app-react-native/`.
422
+
423
+ **MANDATORY install set (MUST run BEFORE scaffolding files — bundle will fail with `Unable to resolve module <name>` for each one missing):**
424
+
425
+ ```bash
426
+ # Bare RN — session-only mode (all version pins are load-bearing, see notes below)
427
+ npm install --legacy-peer-deps \
428
+ '@cometchat/calls-sdk-react-native@^5.0.0' \
429
+ 'https://dl.cloudsmith.io/public/cometchat/cometchat/raw/files/cometchat-calls-lib-webrtc-346a46ff.tgz' \
430
+ 'react-native-webrtc@^124.0.0' \
431
+ 'react-native-permissions@^5.0.0' \
432
+ 'react-native-safe-area-context@^5.0.0' \
433
+ '@react-native-async-storage/async-storage@^2.2.0' \
434
+ '@xmldom/xmldom@^0.8.11' \
435
+ 'react-native-svg@^15.0.0' \
436
+ 'react-native-background-timer@^2.4.1' \
437
+ 'react-native-performance@^5.1.0' \
438
+ 'react-native-url-polyfill@^2.0.0' \
439
+ 'valibot@^1.2.0' \
440
+ 'zustand@^5.0.0' \
441
+ 'text-encoding@^0.7.0' \
442
+ 'abab@^2.0.6' \
443
+ 'promise.allsettled@^1.0.7'
444
+
445
+ # The Cloudsmith tarball sometimes silently skips on the same install line as
446
+ # other packages — re-run it on its own if it's missing afterwards:
447
+ [ -d node_modules/@cometchat/calls-lib-webrtc ] || \
448
+ npm install --save --force \
449
+ 'https://dl.cloudsmith.io/public/cometchat/cometchat/raw/files/cometchat-calls-lib-webrtc-346a46ff.tgz'
450
+ ```
451
+
452
+ **Critical version pins** — empirically validated 2026-05-15 (test #3, RN bare on Pixel 3 + RN 0.85):
453
+
454
+ | Pin | Why |
455
+ |---|---|
456
+ | `@react-native-async-storage/async-storage@^2.2.0` | v3.x splits Android native code into a separate Maven artifact (`org.asyncstorage.shared_storage:storage-android:1.0.0`) that isn't widely published. Gradle fails with `Could not find org.asyncstorage.shared_storage:...`. Pin to ^2.2.0 (self-contained Android). |
457
+ | `@xmldom/xmldom@^0.8.11` | The Calls SDK's polyfill (`dist/polyfills/browser.js`) assumes the xmldom 0.8 prototype shape. v0.9.x reorganized the prototype chain; runtime crashes with `Cannot set property 'innerHTML' of undefined` during polyfill init. Pin to ^0.8.11 (matches SDK's declared peer range). |
458
+ | `react-native-webrtc@^124.0.0` | Older versions don't support React Native 0.74+ Fabric. |
459
+ | `valibot@^1.2.0` / `zustand@^5.0.0` | SDK declares these specific majors; minor upgrades have been API-stable but pin to the declared range to avoid surprises. |
460
+
461
+ **Metro config patch: route the calls SDK to its .mjs entry.** `@cometchat/calls-sdk-react-native@5.0.0` ships a broken CJS bundle at `dist/index.js` — line 1 is `import "./polyfills"` (ESM syntax inside a CJS file). Metro can't parse it; the import returns `undefined` and crashes at runtime as `Cannot read property 'CometChatCalls' of undefined` in your `init.ts`. The `dist/index.mjs` is correctly formed. Patch `metro.config.js`:
462
+
463
+ ```js
464
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
465
+ const path = require('path');
466
+
467
+ const config = {
468
+ resolver: {
469
+ resolveRequest: (context, moduleName, platform) => {
470
+ if (moduleName === '@cometchat/calls-sdk-react-native') {
471
+ return {
472
+ filePath: path.resolve(
473
+ __dirname,
474
+ 'node_modules/@cometchat/calls-sdk-react-native/dist/index.mjs',
475
+ ),
476
+ type: 'sourceFile',
477
+ };
478
+ }
479
+ return context.resolveRequest(context, moduleName, platform);
480
+ },
481
+ },
482
+ };
483
+
484
+ module.exports = mergeConfig(getDefaultConfig(__dirname), config);
485
+ ```
486
+
487
+ After patching, **`npx react-native start --reset-cache`** to clear Metro's resolver cache, then `run-android` / `run-ios`. Customer-found 2026-05-15 (test #3).
488
+
489
+ **11 peer deps total** — derived empirically (test #3, 2026-05-15) by parsing the SDK's actual bundle imports (`node_modules/@cometchat/calls-sdk-react-native/dist/index.js` + `dist/polyfills/*.js`). Every one is a real bundle-time or runtime requirement. The npm CLI `--legacy-peer-deps` flag silently strips them, so they must be listed explicitly.
490
+
491
+ **Failure-mode breakdown:**
492
+
493
+ | Missing peer | Symptom |
494
+ |---|---|
495
+ | `@react-native-async-storage/async-storage` | `Unable to resolve module @react-native-async-storage/async-storage` at first bundle |
496
+ | `react-native-svg` | `Unable to resolve module react-native-svg` at first bundle |
497
+ | `react-native-background-timer` | `Unable to resolve module react-native-background-timer` (polyfills/browser.js) |
498
+ | `valibot`, `zustand`, `react-native-webrtc` | Same — bundle-time imports in SDK index |
499
+ | `@xmldom/xmldom`, `abab`, `promise.allsettled` | Same — polyfills/browser.js DOM + Promise polyfills |
500
+ | `text-encoding`, `react-native-url-polyfill`, `react-native-performance` | Runtime — used inside SDK init code paths |
501
+
502
+ **Also: DO NOT install `@cometchat/chat-sdk-react-native` in session-only mode.** Dead weight in source (never imported, never initialized) AND it transitively pulls async-storage which conflicts with our own peer-dep management.
503
+
504
+ Verify checks: `rn_webrtc_peers` (11-peer presence) + `no_chat_sdk_in_session_only` (Chat SDK absence).
505
+
506
+ The skill then scaffolds:
507
+
508
+ 1. **`cometchat/init.ts`** — `CometChatCalls.init({ appId, region, authKey })` ONLY. No `CometChat.init`, no `CometChat.login`. Pass `authKey` at init so `CometChatCalls.login(uid)` needs no second arg.
509
+ 2. **`screens/JoinSession.tsx`** — UID picker + Start/Join meeting + state machine (`inMeeting && callToken`).
510
+ 3. **`screens/CallRoom.tsx`** — Renders `<CometChatCalls.Component callToken={callToken} />` inside `SafeAreaView`. `onConnectionClosed` listener resets state. See `references/call-session.md`.
511
+ 4. **No VoIP push** — session mode is link-driven, not ringing-driven. No `react-native-callkeep`, no PushKit, no FCM data messages.
512
+ 5. **Native config** — Camera + microphone permissions only.
513
+
514
+ **Why no Chat SDK / no VoIP push:** session mode never initiates a call entity. Customers tap a meeting link, the app generates a token, joins the session. There's nothing to "ring." Initializing both SDKs + the VoIP-push stack adds substantial complexity for zero benefit.
515
+
516
+ ### 4b. Standalone — Ringing mode (CallKeep + CallKit/ConnectionService + Incoming/Outgoing/Ongoing kit)
517
+
518
+ Dual-SDK: Chat SDK signaling channel + Calls SDK media channel. The skill scaffolds:
519
+
520
+ 1. **`cometchat/init.ts`** — Chat SDK + Calls SDK init (sequential).
521
+ 2. **`cometchat/CometChatProvider.tsx`** — Provider with init+login gate.
522
+ 3. **`hooks/useCallKeep.ts`** — Sets up `react-native-callkeep`, registers event listeners (didReceiveStartCallAction, answerCall, endCall).
523
+ 4. **`services/voipPush.ts`** — Combines `react-native-voip-push-notification` (iOS) + `@react-native-firebase/messaging` (Android). Handles incoming-call payloads → `RNCallKeep.displayIncomingCall(...)`.
524
+ 5. **`screens/ProfileScreen.tsx`** (or wherever the call trigger lives) — Voice + video buttons.
525
+ 6. **`screens/OngoingCallScreen.tsx`** — Hosts call surface via `<CometChatCalls.Component />` OR custom UI overlay. Implements rule 1.5 cleanup (`CometChatCalls.leaveSession()` + `RNCallKeep.endCall(callUUID)`).
526
+ 7. **`screens/CallLogsScreen.tsx`** — Paginated history.
527
+ 8. **Native config** — Info.plist, AndroidManifest.xml, Firebase setup, capabilities.
528
+ 9. **Server-side push docs** — describes the VoIP cert + FCM key requirements; cannot automate.
529
+
530
+ ## 5. Additive integration
531
+
532
+ When `cometchat-native-core` integration already exists. The skill:
533
+
534
+ 1. Adds `@cometchat/calls-sdk-react-native` + the four push deps.
535
+ 2. Patches `cometchat/init.ts` to add `CometChatCalls.init` after `CometChat.init`.
536
+ 3. Mounts `<CometChatIncomingCall />` at app root (rule 1.7).
537
+ 4. Wires `CometChatMessageHeader` call buttons (auto-rendered when `user` prop is set).
538
+ 5. VoIP push: opt-in (asks user — substantial native config).
539
+ 6. Adds a `CallLogsScreen` to the existing navigator if the user picked "dedicated screen".
540
+
541
+ ## 6. Anti-patterns
542
+
543
+ 1. **Using Expo Go for calls.** Calls require native modules that Expo Go can't load. Either eject or use a dev client. The skill refuses to scaffold against Expo Go.
544
+ 2. **Skipping `cd ios && pod install`** after install. Symbols missing → "Native module CometChatCalls is null" runtime error. Bare RN only.
545
+ 3. **Mounting `<CometChatIncomingCall />` inside a stack/tab navigator.** Loses the listener on stack push. Mount in App.tsx above the navigator (rule 1.7).
546
+ 4. **Forgetting `RNCallKeep.endCall`** in the hangup path. CallKit/ConnectionService thinks the call is still active; lock-screen UI gets stuck.
547
+ 5. **Sending Android push as `notification` instead of `data`.** ConnectionService cannot intercept `notification` payloads. Server must send `data: { type: "incoming_call", sessionId: "..." }` with `priority: "high"`.
548
+ 6. **Missing Firebase `google-services.json`** for Android. Builds fail at compile time but the error is buried in Gradle output.
549
+ 7. **Mixing `react-native-callkeep` v4 with RN <0.70.** Older RN versions need callkeep v3.x; the skill checks RN version.
550
+ 8. **Passing `onAccept` to `<CometChatIncomingCall>`** (rule 1.8.c). Short-circuits the kit's internal `acceptCall` + OngoingCall transition — callee's UI moves but caller stays on "Calling…" indefinitely. Only handle `onDecline` + `onError`; let the kit own the accept path.
551
+ 9. **`setError(String(e))` in catch blocks** (rule 1.8.b). Most SDK errors aren't `Error` subclasses → screen shows `[object Object]`. Use `e instanceof Error ? e.message : JSON.stringify(e)`.
552
+ 10. **`await CometChatUIKit.getLoggedInUser()` without `.catch(() => null)`** (rule 1.8.a). RN SDK throws "User not found" on no-session — kills init before login can run.
553
+ 11. **`pod install` without `USE_FRAMEWORKS=static`.** Default dynamic linkage produces a binary that can't load WebRTC at runtime. iOS only.
554
+ 12. **`EXCLUDED_ARCHS = 'arm64 i386'` in Podfile post_install on Apple Silicon.** Intel-era workaround that breaks arm64 simulator linking for WebRTC pods. Remove on Apple Silicon hosts.
555
+ 13. **`react-native start` followed by app reload without `adb reverse tcp:8081 tcp:8081`.** Only `run-android` sets the port forward; standalone Metro restart loses it. Symptom: "unable to load scripts." Bare RN only.
556
+ 14. **Editing `.env` and expecting Metro hot-reload to pick it up.** `react-native-dotenv` is a babel-time plugin — `.env` changes need Metro `--reset-cache`. Bare RN only.
557
+ 15. **Installing CometChat deps with `--legacy-peer-deps` and expecting all transitive peers to land.** npm silently skips peers — install `valibot`, `zustand`, `@xmldom/xmldom`, `abab`, `promise.allsettled`, `text-encoding`, `react-native-url-polyfill`, `react-native-performance`, plus Expo's `expo-linking`/`expo-constants`/`expo-asset`/`expo-font` explicitly. See §2 setup landmines.
558
+ 16. **`npm install @cometchat/calls-lib-webrtc`.** Returns 404 — package is Cloudsmith-only. Use the `https://dl.cloudsmith.io/...` tarball URL.
559
+
560
+ ## 7. Verification checklist
561
+
562
+ **Static:**
563
+
564
+ - [ ] All seven packages: chat-sdk-react-native, calls-sdk-react-native, callkeep, voip-push-notification, firebase/app, firebase/messaging, webrtc
565
+ - [ ] `@cometchat/calls-lib-webrtc` installed via Cloudsmith tarball (not npm — npm returns 404)
566
+ - [ ] iOS: `Info.plist` has UIBackgroundModes (audio + voip + remote-notification) + camera/mic/Bluetooth strings (rule 1.6 + §2 setup)
567
+ - [ ] iOS: PushKit token registration in App.tsx (or a hook called from there)
568
+ - [ ] iOS: `USE_FRAMEWORKS=static` used for `pod install`
569
+ - [ ] iOS (Apple Silicon): no `EXCLUDED_ARCHS = 'arm64 i386'` in Podfile post_install
570
+ - [ ] iOS: `.xcode.env.local` NODE_BINARY points at stable Homebrew node path
571
+ - [ ] Android: manifest has all four FOREGROUND_SERVICE_* permissions + MANAGE_OWN_CALLS + BIND_TELECOM_CONNECTION_SERVICE
572
+ - [ ] Android: `google-services.json` in `android/app/`
573
+ - [ ] Android: callkeep service registered with correct `foregroundServiceType`
574
+ - [ ] CometChatIncomingCall mounted at App.tsx (additive mode), no `onAccept` prop (rule 1.8.c)
575
+ - [ ] CometChatUIKit.getLoggedInUser called with `.catch(() => null)` (rule 1.8.a)
576
+ - [ ] Error rendering uses `e.message` not `String(e)` (rule 1.8.b)
577
+ - [ ] Env-var guard: provider throws actionable error when appId/region undefined (rule 1.8.c "Also recommended")
578
+ - [ ] Hangup path includes `endSession` + `RNCallKeep.endCall`
579
+ - [ ] Module-level `initialized` flag
580
+
581
+ **Runtime (real devices, both platforms):**
582
+
583
+ - [ ] iOS — terminated app, lock screen rings on incoming call
584
+ - [ ] iOS — answer from lock screen → opens app, joins ongoing call
585
+ - [ ] Android — terminated app, ConnectionService rings (full-screen heads-up) on incoming call
586
+ - [ ] Android — answer from notification → opens app, joins ongoing call
587
+ - [ ] Both — outgoing call connects, two-way audio + video
588
+ - [ ] Both — hangup releases camera + mic, no lingering system call UI
589
+ - [ ] Both — Android 14+: ongoing-call notification visible, doesn't get killed by swipe
590
+ - [ ] Expo: only on dev client / standalone build, not Expo Go
591
+
592
+ ## 8. Pointers
593
+
594
+ - `cometchat-native-core` — provider, init, gesture handler peer deps
595
+ - `cometchat-native-{expo,bare}-patterns` — pod install, gesture handler, dev client setup
596
+ - `cometchat-native-components` — full UI Kit catalog (additive mode)
597
+ - `cometchat-native-push` — APNs + FCM for chat (overlap with VoIP push but distinct paths — chat push is APNs/FCM standard, VoIP push is PushKit/FCM data-message)
598
+ - `cometchat-native-production` — server-minted tokens
599
+ - `cometchat-native-troubleshooting` — Metro cache, pod install failures, privacy manifest, gesture handler conflicts