@cometchat/skills 4.0.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 (258) hide show
  1. package/README.md +42 -2
  2. package/bin/install.js +448 -57
  3. package/package.json +1 -1
  4. package/skills/cometchat/SKILL.md +337 -80
  5. package/skills/cometchat-a11y/SKILL.md +476 -0
  6. package/skills/cometchat-android-v5/SKILL.md +1 -1
  7. package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
  8. package/skills/cometchat-android-v5-calls/references/README.md +53 -0
  9. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
  10. package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
  11. package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
  13. package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
  14. package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
  15. package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
  16. package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
  17. package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
  18. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
  19. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
  20. package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
  21. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
  22. package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
  23. package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
  24. package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
  25. package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
  26. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
  27. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
  28. package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
  29. package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
  30. package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
  31. package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
  32. package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
  33. package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
  34. package/skills/cometchat-android-v5-components/SKILL.md +1 -1
  35. package/skills/cometchat-android-v5-core/SKILL.md +1 -1
  36. package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
  37. package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
  38. package/skills/cometchat-android-v5-features/SKILL.md +1 -1
  39. package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
  40. package/skills/cometchat-android-v5-production/SKILL.md +1 -1
  41. package/skills/cometchat-android-v5-push/SKILL.md +1 -1
  42. package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
  43. package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
  44. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
  45. package/skills/cometchat-android-v6/SKILL.md +1 -1
  46. package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
  47. package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
  48. package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
  49. package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
  50. package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
  51. package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
  52. package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
  53. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
  54. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
  55. package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
  56. package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
  57. package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
  58. package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
  59. package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
  60. package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
  61. package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
  62. package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
  63. package/skills/cometchat-android-v6-core/SKILL.md +1 -1
  64. package/skills/cometchat-android-v6-events/SKILL.md +1 -1
  65. package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
  66. package/skills/cometchat-android-v6-features/SKILL.md +1 -1
  67. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
  68. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
  69. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
  70. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
  71. package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
  72. package/skills/cometchat-android-v6-production/SKILL.md +1 -1
  73. package/skills/cometchat-android-v6-push/SKILL.md +1 -1
  74. package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
  75. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
  76. package/skills/cometchat-angular-calls/SKILL.md +511 -0
  77. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
  78. package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
  79. package/skills/cometchat-angular-calls/references/call-session.md +167 -0
  80. package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
  81. package/skills/cometchat-angular-calls/references/device-management.md +135 -0
  82. package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
  83. package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
  84. package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
  85. package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
  86. package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
  87. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
  88. package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
  89. package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
  90. package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
  91. package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
  92. package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
  93. package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
  94. package/skills/cometchat-angular-components/SKILL.md +1 -1
  95. package/skills/cometchat-angular-core/SKILL.md +1 -1
  96. package/skills/cometchat-angular-customization/SKILL.md +1 -1
  97. package/skills/cometchat-angular-features/SKILL.md +1 -1
  98. package/skills/cometchat-angular-patterns/SKILL.md +1 -1
  99. package/skills/cometchat-angular-placement/SKILL.md +1 -1
  100. package/skills/cometchat-angular-production/SKILL.md +1 -1
  101. package/skills/cometchat-angular-push/SKILL.md +403 -0
  102. package/skills/cometchat-angular-testing/SKILL.md +333 -0
  103. package/skills/cometchat-angular-theming/SKILL.md +1 -1
  104. package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
  105. package/skills/cometchat-astro-patterns/SKILL.md +1 -1
  106. package/skills/cometchat-calls/SKILL.md +358 -0
  107. package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
  108. package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
  109. package/skills/cometchat-calls/references/use-case-support.md +190 -0
  110. package/skills/cometchat-calls/references/use-case-team.md +169 -0
  111. package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
  112. package/skills/cometchat-components/SKILL.md +1 -1
  113. package/skills/cometchat-core/SKILL.md +1 -1
  114. package/skills/cometchat-customization/SKILL.md +2 -2
  115. package/skills/cometchat-features/SKILL.md +2 -2
  116. package/skills/cometchat-flutter-v5/SKILL.md +1 -1
  117. package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
  118. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
  119. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
  120. package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
  121. package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
  122. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
  123. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
  124. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
  125. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
  126. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
  127. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
  128. package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
  129. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
  130. package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
  131. package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
  132. package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
  133. package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
  134. package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
  135. package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
  136. package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
  137. package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
  138. package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
  139. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
  140. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
  141. package/skills/cometchat-flutter-v6/SKILL.md +1 -1
  142. package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
  143. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
  144. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
  145. package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
  146. package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
  147. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
  148. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
  149. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
  150. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
  151. package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
  152. package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
  153. package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
  154. package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
  155. package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
  156. package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
  157. package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
  158. package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
  159. package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
  160. package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
  161. package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
  162. package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
  163. package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
  164. package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
  165. package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
  166. package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
  167. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
  168. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
  169. package/skills/cometchat-i18n/SKILL.md +358 -0
  170. package/skills/cometchat-ios/SKILL.md +5 -5
  171. package/skills/cometchat-ios-calls/SKILL.md +409 -0
  172. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
  173. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
  174. package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
  175. package/skills/cometchat-ios-calls/references/call-session.md +221 -0
  176. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
  177. package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
  178. package/skills/cometchat-ios-calls/references/device-management.md +171 -0
  179. package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
  180. package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
  181. package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
  182. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
  183. package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
  184. package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
  185. package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
  186. package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
  187. package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
  188. package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
  189. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
  190. package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
  191. package/skills/cometchat-ios-components/SKILL.md +1 -1
  192. package/skills/cometchat-ios-core/SKILL.md +1 -1
  193. package/skills/cometchat-ios-customization/SKILL.md +1 -1
  194. package/skills/cometchat-ios-features/SKILL.md +1 -1
  195. package/skills/cometchat-ios-placement/SKILL.md +1 -1
  196. package/skills/cometchat-ios-production/SKILL.md +1 -1
  197. package/skills/cometchat-ios-push/SKILL.md +1 -1
  198. package/skills/cometchat-ios-testing/SKILL.md +371 -0
  199. package/skills/cometchat-ios-theming/SKILL.md +1 -1
  200. package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
  201. package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
  202. package/skills/cometchat-native-calls/SKILL.md +599 -0
  203. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
  204. package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
  205. package/skills/cometchat-native-calls/references/call-session.md +182 -0
  206. package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
  207. package/skills/cometchat-native-calls/references/device-management.md +135 -0
  208. package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
  209. package/skills/cometchat-native-calls/references/group-calls.md +291 -0
  210. package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
  211. package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
  212. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
  213. package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
  214. package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
  215. package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
  216. package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
  217. package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
  218. package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
  219. package/skills/cometchat-native-calls/references/share-invite.md +144 -0
  220. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
  221. package/skills/cometchat-native-components/SKILL.md +1 -1
  222. package/skills/cometchat-native-core/SKILL.md +1 -1
  223. package/skills/cometchat-native-customization/SKILL.md +1 -1
  224. package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
  225. package/skills/cometchat-native-features/SKILL.md +1 -1
  226. package/skills/cometchat-native-placement/SKILL.md +1 -1
  227. package/skills/cometchat-native-production/SKILL.md +1 -1
  228. package/skills/cometchat-native-push/SKILL.md +1 -1
  229. package/skills/cometchat-native-testing/SKILL.md +1 -1
  230. package/skills/cometchat-native-theming/SKILL.md +1 -1
  231. package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
  232. package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
  233. package/skills/cometchat-placement/SKILL.md +29 -1
  234. package/skills/cometchat-production/SKILL.md +1 -1
  235. package/skills/cometchat-react-calls/SKILL.md +539 -0
  236. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
  237. package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
  238. package/skills/cometchat-react-calls/references/call-session.md +235 -0
  239. package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
  240. package/skills/cometchat-react-calls/references/device-management.md +206 -0
  241. package/skills/cometchat-react-calls/references/group-calls.md +262 -0
  242. package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
  243. package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
  244. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
  245. package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
  246. package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
  247. package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
  248. package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
  249. package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
  250. package/skills/cometchat-react-calls/references/share-invite.md +176 -0
  251. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
  252. package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
  253. package/skills/cometchat-react-patterns/SKILL.md +56 -8
  254. package/skills/cometchat-react-push/SKILL.md +448 -0
  255. package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
  256. package/skills/cometchat-react-testing/SKILL.md +404 -0
  257. package/skills/cometchat-theming/SKILL.md +3 -3
  258. package/skills/cometchat-troubleshooting/SKILL.md +2 -2
@@ -3,7 +3,7 @@ name: cometchat-customization
3
3
  description: Customize a CometChat React UI Kit integration beyond what `cometchat init` and `cometchat apply-feature` produce — custom message bubbles, custom header views, custom subtitle views, custom empty/loading states, custom action menus, request builder filters, event listeners, and component composition. Picks up where the framework skills end (after Phase A init succeeds).
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; @cometchat/chat-uikit-react ^6"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory, grepSearch"
6
+ allowed-tools: "shell, file-read, file-search, file-list, grep"
7
7
  metadata:
8
8
  author: "CometChat"
9
9
  version: "3.0.0"
@@ -20,7 +20,7 @@ metadata:
20
20
 
21
21
  ## Use this skill when
22
22
 
23
- The user has already run `/cometchat` (Phase A complete — there's a
23
+ The user has already run `/cometchat` (or invoked the cometchat skill via their agent's mechanism — keyword "cometchat" or "integrate chat" works in most agents) (Phase A complete — there's a
24
24
  working integration with `.cometchat/state.json`) and wants to **change
25
25
  how a component looks or behaves** beyond what the CLI's deterministic
26
26
  commands handle.
@@ -3,7 +3,7 @@ name: cometchat-features
3
3
  description: Add features (calls, reactions, polls, file sharing, presence, etc.) to an already-integrated CometChat project. Routes to the right sub-flow based on feature type — default (already enabled), extension (API toggle), ai-feature (API toggle + OpenAI key), dashboard-only (third-party config), package-install (calls), or component-swap (rich text).
4
4
  license: "MIT"
5
5
  compatibility: "Node.js >=18; @cometchat/chat-uikit-react ^6; integration must already be applied"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
6
+ allowed-tools: "shell, file-read, file-search, file-list"
7
7
  metadata:
8
8
  author: "CometChat"
9
9
  version: "3.0.0"
@@ -31,7 +31,7 @@ is prevents unnecessary work.
31
31
  The user wants to add a specific feature to an already-integrated CometChat
32
32
  project. Trigger phrases:
33
33
 
34
- - `/cometchat features`
34
+ - `/cometchat features` (or invoke the cometchat-features skill via your agent's mechanism — keyword "cometchat feature" or "add chat feature" works in most agents)
35
35
  - `/cometchat features <name>` (e.g. `/cometchat features reactions`)
36
36
  - `/cometchat <feature>` (e.g. `/cometchat polls`, `/cometchat calls`)
37
37
  - "add reactions to my chat"
@@ -3,7 +3,7 @@ name: cometchat-flutter-v5
3
3
  description: "Use when building chat with CometChat Flutter UIKit v5 (cometchat_chat_uikit v5.2.14, cometchat_calls_uikit v5.0.15). Orchestrator skill that routes to feature-specific skills."
4
4
  license: "MIT"
5
5
  compatibility: "cometchat_chat_uikit ^5.2.14; cometchat_calls_uikit ^5.0.15; cometchat_uikit_shared ^5.2.3; cometchat_sdk ^4.1.2; get ^4.6.5"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
6
+ allowed-tools: "shell, file-read, file-search, file-list"
7
7
  metadata:
8
8
  author: "CometChat"
9
9
  version: "3.0.0"
@@ -1,41 +1,84 @@
1
1
  ---
2
2
  name: cometchat-flutter-v5-calls
3
- description: "Use when working with CometChat Flutter UIKit v5 call components. Triggers on CometChatCallButtons, CometChatIncomingCall, CometChatOutgoingCall, CometChatOngoingCall, CometChatCallLogs, calling."
3
+ description: CometChat Calls integration for Flutter UIKit v5 (GetX-based, cometchat_calls_uikit separate package). Covers package wiring (cometchat_calls_uikit ^5.0.15 alongside cometchat_chat_uikit ^5.2), CometChatCallingExtension via UIKitSettingsBuilder, CallNavigationContext.navigatorKey, the kit's CometChatCallButtons / CometChatIncomingCall / CometChatOutgoingCall / CometChatOngoingCall / CometChatCallLogs widgets, dual-SDK ringing (CometChat.initiateCall + CometChatUIKitCalls.joinSession), Android FCM + ConnectionService for VoIP push, iOS CallKit + PushKit, foreground service correctness on Android 14+, hangup cleanup, and additive-vs-standalone modes.
4
4
  license: "MIT"
5
- compatibility: "cometchat_calls_uikit ^5.0.15; cometchat_calls_sdk ^4.2.2; cometchat_sdk ^4.1.2"
6
- allowed-tools: "executeBash, readFile, fileSearch, listDirectory"
5
+ compatibility: "Flutter >= 2.5, Dart >= 2.17; cometchat_chat_uikit ^5.2.14; cometchat_calls_uikit ^5.0.15; cometchat_calls_sdk ^4.2.2; cometchat_sdk ^4.1.2"
6
+ allowed-tools: "shell, file-read, file-search, file-list, ask-user"
7
7
  metadata:
8
8
  author: "CometChat"
9
- version: "3.0.0"
10
- tags: "cometchat flutter v5 calls voice video incoming outgoing ongoing logs"
9
+ version: "4.0.0"
10
+ tags: "cometchat flutter v5 calls voice video webrtc getx incoming outgoing ongoing call-logs callkit pushkit connectionservice fcm voip-push foreground-service navigatorkey calling-extension"
11
11
  ---
12
12
 
13
- # CometChat Flutter UIKit v5 — Calls
13
+ ## Purpose
14
14
 
15
- Components and utilities for voice/video calling.
15
+ Production-grade voice + video calling for Flutter UIKit v5 (GetX-based). Loaded by `cometchat-calls` when `framework === "flutter"` and `flutter_version === "v5"`. Operates in two modes:
16
16
 
17
- ## Package Structure
17
+ - **Standalone** — calls is the product. `cometchat_chat_sdk` (signaling) + `cometchat_calls_sdk` (WebRTC) without the `cometchat_chat_uikit` UI Kit. Custom call screens (or hand-roll the kit's call widgets without the conversation kit). **VoIP push is mandatory** — same rule as native iOS / Android.
18
+ - **Additive** — calls layered onto an existing v5 chat integration. Adds `cometchat_calls_uikit` package, configures the calling extension via `UIKitSettingsBuilder.callingExtension`, sets `CallNavigationContext.navigatorKey` on `MaterialApp`, mounts the global incoming-call listener at the app shell.
18
19
 
19
- Calls are in a **separate package**: `cometchat_calls_uikit`.
20
+ **Read these other skills first:**
21
+ - `cometchat-calls` — dispatcher (modes, hard rules, anti-patterns)
22
+ - `cometchat-flutter-v5-core` — UIKitSettingsBuilder, init/login order, GetX scope rules, app entry conventions
23
+ - `cometchat-flutter-v5-events` — CometChatMessageEvents / CometChatCallEvents subscription patterns
20
24
 
21
- ```yaml
22
- dependencies:
23
- cometchat_calls_uikit: ^5.0.15
25
+ **Ground truth:**
26
+ - SDK source — `~/Downloads/calls-sdk/calls-sdk-flutter-5/sdk/`
27
+ - Sample app — `~/Downloads/calls-sdk/calls-sdk-flutter-5/sample-apps/`
28
+ - Public docs — https://www.cometchat.com/docs/calls/flutter/overview
29
+
30
+ ---
31
+
32
+ ## 1. The seven hard rules — Flutter v5 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` succeeds, you MUST also call `CometChatCalls.login` — without it, the FIRST calls API call throws **"auth token cannot be null"**.
37
+
38
+ ```dart
39
+ import 'package:cometchat_sdk/cometchat_sdk.dart';
40
+ import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
41
+
42
+ CometChat.login(uid, AUTH_KEY,
43
+ onSuccess: (User user) {
44
+ // Chat SDK ready — now login Calls SDK
45
+ CometChatCalls.login(
46
+ uid: uid,
47
+ authKey: AUTH_KEY,
48
+ onSuccess: (User? callUser) {
49
+ // both ready
50
+ },
51
+ onError: (CometChatException e) {
52
+ // surface to user
53
+ },
54
+ );
55
+ },
56
+ onError: (CometChatException e) {
57
+ // chat login failed
58
+ },
59
+ );
24
60
  ```
25
61
 
26
- Import everything from:
62
+ For production with server-minted tokens:
63
+
27
64
  ```dart
28
- import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
65
+ CometChatCalls.loginWithAuthToken(
66
+ authToken: tokenFromBackend,
67
+ onSuccess: (User? user) { /* … */ },
68
+ onError: (CometChatException e) { /* … */ },
69
+ );
29
70
  ```
30
71
 
31
- This re-exports `cometchat_uikit_shared`, `cometchat_sdk`, and `cometchat_calls_sdk`.
72
+ **Surprises:**
73
+ - Chat SDK persists login via shared preferences across launches. The **Calls SDK does NOT** — always check `CometChatCalls.getLoggedInUser()` on app start and re-login if it returns null.
74
+ - The Calls SDK's onSuccess hands back `User?` (nullable) — guard before using.
32
75
 
33
- ## Rule: CALLS_INIT_ORDER
76
+ ### 1.1 Dual-SDK contract — `CometChatCallingExtension` hides it (additive); standalone code sees both
34
77
 
35
- Chat SDK must be initialized BEFORE Calls SDK. The calling extension handles this automatically when configured via `UIKitSettingsBuilder.callingExtension`.
78
+ In additive mode, the `CometChatCallingExtension` registered via `UIKitSettingsBuilder.callingExtension` wires both SDKs internally your code rarely touches `CometChatUIKitCalls` directly. In standalone mode (no UI Kit), you call both SDKs explicitly:
36
79
 
37
80
  ```dart
38
- // CORRECTenable calling via UIKitSettings
81
+ // RIGHTadditive mode (calling extension owns the dual-SDK split)
39
82
  final settings = (UIKitSettingsBuilder()
40
83
  ..appId = 'APP_ID'
41
84
  ..region = 'us'
@@ -43,86 +86,152 @@ final settings = (UIKitSettingsBuilder()
43
86
  ..subscriptionType = CometChatSubscriptionType.allUsers
44
87
  ..callingExtension = CometChatCallingExtension())
45
88
  .build();
46
-
47
89
  CometChatUIKit.init(uiKitSettings: settings);
48
90
  ```
49
91
 
50
- `CometChatCallingExtension` extends `ExtensionsDataSource` and uses `ChatConfigurator.enable()` to register the calling decorator.
92
+ ```dart
93
+ // ✓ RIGHT — standalone mode (explicit dual-SDK)
94
+ import 'package:cometchat_chat_sdk/cometchat_chat_sdk.dart';
95
+ import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
96
+
97
+ // Chat SDK — initiate ringing
98
+ final outgoing = Call(receiverUid, CometChatReceiverType.user, CometChatCallType.video);
99
+ final initiated = await CometChat.initiateCall(call: outgoing);
100
+
101
+ // Calls SDK — join WebRTC session after acceptance.
102
+ // Use SessionSettingsBuilder + callback shape — matches the upstream sample
103
+ // at calls-sdk-flutter-5/sample-apps/cometchat-calls-sample-app-flutter/.
104
+ // CallSettingsBuilder is the chat-side type; SessionSettingsBuilder is what
105
+ // session/joinSession accepts.
106
+ final sessionSettings = (SessionSettingsBuilder()
107
+ .setTitle('CometChat Call')
108
+ .startVideoPaused(false)
109
+ .startAudioMuted(false))
110
+ .build();
51
111
 
52
- ## Rule: CALL_NAVIGATION_CONTEXT
112
+ CometChatCalls.joinSession(
113
+ sessionId: sessionId,
114
+ sessionSettings: sessionSettings,
115
+ onSuccess: (Widget? widget) {
116
+ // render widget via SizedBox.expand; register SessionStatusListeners
117
+ },
118
+ onError: (CometChatCallsException err) {
119
+ debugPrint('joinSession failed: ${err.message}');
120
+ },
121
+ );
122
+ ```
53
123
 
54
- `CallNavigationContext.navigatorKey` must be set on `MaterialApp` for call overlays to navigate:
124
+ ### 1.2 VoIP push `flutter_callkit_incoming` + `firebase_messaging` + platform-channel bridges
55
125
 
56
- ```dart
57
- MaterialApp(
58
- navigatorKey: CallNavigationContext.navigatorKey,
59
- )
126
+ Standalone mode requires working VoIP push end-to-end. The Flutter stack:
127
+
128
+ - **`flutter_callkit_incoming`** — bridges CallKit (iOS) and a custom heads-up notification (Android). Single Dart API for "ring this device".
129
+ - **`firebase_messaging`** — FCM data messages on Android (priority `high`, `data` payload — NOT `notification`).
130
+ - **iOS PushKit** — Flutter doesn't have a first-party PushKit plugin; the skill ships a tiny platform-channel bridge in `ios/Runner/AppDelegate.swift` registering `PKPushRegistry.voIP` and forwarding payloads through a `MethodChannel` to Dart.
131
+ - **Server side** — same split as native: PushKit (VoIP cert) for iOS, FCM data-message for Android.
132
+
133
+ In additive mode, this is opt-in but recommended.
134
+
135
+ ### 1.3 Foreground service — Android 14+ rules apply unchanged
136
+
137
+ **⚠️ Android build prerequisite — Jetifier is mandatory.** One of the `cometchat_calls_uikit` transitive deps pulls in the legacy `com.android.support:support-compat:26.1.0` AAR. Without Jetifier, AGP fails the assembleDebug step with dozens of `Duplicate class android.support.v4.*` errors against `androidx.core`. Set in `android/gradle.properties`:
138
+
139
+ ```properties
140
+ android.useAndroidX=true
141
+ android.enableJetifier=true
60
142
  ```
61
143
 
62
- ## CometChatCallButtons
144
+ Flutter 3.x scaffolds omit `enableJetifier=true` by default — the build blows up on the first `flutter build apk` if you skip this. The error is loud but the fix is one line.
63
145
 
64
- Voice and video call buttons for a user or group.
146
+ The `cometchat_calls_uikit` registers `CometChatOngoingCallService` via manifest merge, but the host app's `android/app/src/main/AndroidManifest.xml` must declare the four FOREGROUND_SERVICE permissions plus MANAGE_OWN_CALLS / BIND_TELECOM_CONNECTION_SERVICE — the same rule as native Android (cf. `cometchat-android-v5-calls` rule 1.3).
65
147
 
66
- ```dart
67
- CometChatCallButtons(user: user)
68
- CometChatCallButtons(group: group, hideVoiceCallButton: true)
148
+ ```xml
149
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
150
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
151
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
152
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
153
+ <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
154
+ <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
155
+ tools:ignore="ProtectedPermissions" />
69
156
  ```
70
157
 
71
- Key props: `user`, `group`, `callButtonsStyle`, `hideVoiceCallButton`, `hideVideoCallButton`, `outgoingCallConfiguration`, `callSettingsBuilder`, `onError`.
158
+ Silent crash on Android 14+ if `FOREGROUND_SERVICE_PHONE_CALL` is missing. The `tools` namespace must be declared on the `<manifest>` element.
159
+
160
+ ### 1.4 Server-minted auth tokens
72
161
 
73
- ## CometChatCallLogs
162
+ `cometchat-flutter-v5-production` covers the token-endpoint pattern. Production calls path uses `CometChatUIKit.loginWithAuthToken(token)`, not `loginWithAuthKey(uid, authKey)`. The Calls SDK piggybacks on the Chat SDK auth context — there is no separate calls-only token.
74
163
 
75
- Call history list.
164
+ ### 1.5 Hangup cleanup — Dart + native + system call UI
76
165
 
77
166
  ```dart
78
- CometChatCallLogs(
79
- onItemClick: (callLog) {
80
- // CometChatCallLogDetails is NOT a UIKit exportcopy the
81
- // sample-app pattern from `sample_app/lib/call_log_details/` into
82
- // your own project and route to it here.
83
- Navigator.push(context, MaterialPageRoute(
84
- builder: (_) => YourCallLogDetailsScreen(callLog: callLog),
85
- ));
86
- },
87
- )
167
+ Future<void> endCall(String sessionId) async {
168
+ // 1. End the Calls SDK session — releases WebRTC tracks.
169
+ // CometChatCalls.endSession() does NOT exist on Flutteruse the
170
+ // CallSession singleton's leaveSession().
171
+ await CallSession.getInstance().leaveSession();
172
+ await CometChatOngoingCallService.abort();
173
+
174
+ // 2. Tell the OS-level call UI the call ended
175
+ await FlutterCallkitIncoming.endAllCalls();
176
+
177
+ // 3. Pop the call screen
178
+ if (mounted) {
179
+ Navigator.of(context, rootNavigator: true).popUntil((r) => r.isFirst);
180
+ }
181
+
182
+ // 4. After logout flows: reset ServiceLocator if it was used directly
183
+ // (UIKit handles this for additive mode)
184
+ }
88
185
  ```
89
186
 
90
- Key props: `callLogsRequestBuilder`, `callLogsStyle`, `onItemClick`, `listItemView`, `subTitleView`, `trailingView`, `onError`.
187
+ Skipping `FlutterCallkitIncoming.endAllCalls` leaves the lock-screen/heads-up call UI stuck. Skipping the `Navigator.popUntil` strands the Dart-side call screen with WebRTC views still in the tree.
91
188
 
92
- ## CometChatIncomingCall / CometChatOutgoingCall / CometChatOngoingCall
189
+ ### 1.6 Permissions `permission_handler` + Info.plist + AndroidManifest
93
190
 
94
- These are typically managed automatically by `CometChatCallingExtension`. Manual usage is rare.
191
+ ```dart
192
+ import 'package:permission_handler/permission_handler.dart';
95
193
 
96
- - `CometChatIncomingCall(call: call, onAccept: (BuildContext, Call)? ..., onDecline: (BuildContext, Call)? ...)` — callbacks take `(BuildContext, Call)`, NOT `(Call)` alone.
97
- - `CometChatOutgoingCall(call: returnedCall, user: user OR group: group, onCancelled: (BuildContext, Call)? ...)` — takes the active `Call` object plus the `User` or `Group` it's directed at. The `call:` param holds the result of `CometChatUIKitCalls.initiateCall(...)`. Callbacks are `(BuildContext, Call)?`, NOT `(Call)?` alone.
98
- - `CometChatOngoingCall(callSettingsBuilder: ..., sessionId: ...)`
194
+ await [Permission.camera, Permission.microphone, Permission.notification].request();
195
+ ```
99
196
 
100
- ## Call Flow Outgoing
197
+ iOS`ios/Runner/Info.plist`:
198
+ ```xml
199
+ <key>NSCameraUsageDescription</key>
200
+ <string>So you can be seen during video calls.</string>
201
+ <key>NSMicrophoneUsageDescription</key>
202
+ <string>So you can talk during voice and video calls.</string>
203
+ <key>UIBackgroundModes</key>
204
+ <array>
205
+ <string>audio</string>
206
+ <string>voip</string>
207
+ <string>remote-notification</string>
208
+ </array>
209
+ ```
101
210
 
102
- 1. User taps call button `CometChatUIKitCalls.initiateCall(call)`
103
- 2. `CometChatOutgoingCall` screen pushed
104
- 3. Recipient accepts → `CometChatOngoingCall` replaces outgoing
105
- 4. Call ends → screens pop back
211
+ Android manifest as above (rule 1.3) plus runtime requests via `permission_handler`.
106
212
 
107
- ## Call Flow Incoming
213
+ ### 1.7 IncomingCall mounted at app root + `CallNavigationContext.navigatorKey`
108
214
 
109
- 1. `CometChatCallingExtension` listens via SDK listener
110
- 2. `CometChatIncomingCall` overlay displayed via `CallNavigationContext.navigatorKey`
111
- 3. Accept → `CometChatUIKitCalls.acceptCall(sessionId)` → `CometChatOngoingCall`
112
- 4. Decline → `CometChatUIKitCalls.rejectCall(sessionId, status)`
215
+ V5 uses GetX's navigator key pattern. `CallNavigationContext.navigatorKey` MUST be set on `MaterialApp.navigatorKey` so call overlays can navigate even when a call is initiated from a sub-route:
113
216
 
114
- ## Incoming Call Handling (Global)
217
+ ```dart
218
+ // ✓ RIGHT
219
+ MaterialApp(
220
+ navigatorKey: CallNavigationContext.navigatorKey,
221
+ // ...
222
+ );
223
+ ```
115
224
 
116
- Handle incoming calls at the app level (dashboard/home), not per-screen:
225
+ Global call listener registration (incoming calls fire app-wide) belongs in the app shell's State, not in a feature screen:
117
226
 
118
227
  ```dart
119
- class _DashboardState extends State<Dashboard>
228
+ class AppShellState extends State<AppShell>
120
229
  with CallListener, CometChatCallEventListener {
230
+ static const _listenerId = 'app-shell-call-listener';
121
231
 
122
232
  @override
123
233
  void initState() {
124
234
  super.initState();
125
- _listenerId = 'calls_${DateTime.now().millisecondsSinceEpoch}';
126
235
  CometChat.addCallListener(_listenerId, this);
127
236
  CometChatCallEvents.addCallEventsListener(_listenerId, this);
128
237
  }
@@ -136,57 +245,179 @@ class _DashboardState extends State<Dashboard>
136
245
 
137
246
  @override
138
247
  void onIncomingCallReceived(Call call) {
139
- // Handle incoming call globally
248
+ // Route through CallNavigationContext or flutter_callkit_incoming
140
249
  }
141
250
  }
142
251
  ```
143
252
 
144
- ## Permissions
253
+ Use a stable string ID for the listener — duplicate IDs overwrite, distinct IDs fire both (double-ring bug).
145
254
 
146
- Request camera and microphone permissions before calls:
255
+ ---
147
256
 
148
- ```dart
149
- await [Permission.camera, Permission.microphone].request();
257
+ ## 2. Setup
258
+
259
+ ```yaml
260
+ # pubspec.yaml
261
+ dependencies:
262
+ flutter:
263
+ sdk: flutter
264
+ cometchat_chat_uikit: ^5.2.14 # additive mode — already there
265
+ cometchat_calls_uikit: ^5.0.15 # adds the calling extension + widgets
266
+ permission_handler: ^11.0.0 # rule 1.6
267
+ flutter_callkit_incoming: ^2.0.0 # standalone — VoIP UI bridge
268
+ firebase_messaging: ^14.0.0 # standalone — Android FCM
269
+ firebase_core: ^2.0.0 # firebase_messaging peer
150
270
  ```
151
271
 
152
- ## Golden Path Enable Calling
272
+ Hosted source if pub.dev resolution lags:
273
+
274
+ ```yaml
275
+ cometchat_calls_uikit:
276
+ hosted: https://dart.cloudsmith.io/cometchat/cometchat/
277
+ version: ^5.0.15
278
+ ```
279
+
280
+ Init order — calling extension flows the dual-SDK init internally:
153
281
 
154
282
  ```dart
155
- // 1. Configure calling extension
156
283
  final settings = (UIKitSettingsBuilder()
157
- ..appId = 'APP_ID'
158
- ..region = 'us'
159
- ..authKey = 'AUTH_KEY'
284
+ ..appId = CometChatConfig.appId
285
+ ..region = CometChatConfig.region
286
+ ..authKey = CometChatConfig.authKey
160
287
  ..subscriptionType = CometChatSubscriptionType.allUsers
161
- ..callingExtension = CometChatCallingExtension())
288
+ ..callingExtension = CometChatCallingExtension()) // ← rule 1.1 (additive)
162
289
  .build();
163
290
 
164
- // 2. Init
165
- CometChatUIKit.init(uiKitSettings: settings);
291
+ await CometChatUIKit.init(uiKitSettings: settings);
292
+ ```
166
293
 
167
- // 3. Set navigator key
168
- MaterialApp(navigatorKey: CallNavigationContext.navigatorKey)
294
+ In standalone mode (no UI Kit), use the SDKs directly:
169
295
 
170
- // 4. Call buttons appear automatically in CometChatMessageHeader
296
+ ```dart
297
+ await CometChat.init(CometChatConfig.appId, AppSettings.builder
298
+ ..setRegion(CometChatConfig.region)
299
+ ..subscribePresenceForAllUsers());
300
+
301
+ await CometChatCalls.init(CallAppSettings.builder
302
+ ..setAppId(CometChatConfig.appId)
303
+ ..setRegion(CometChatConfig.region));
171
304
  ```
172
305
 
173
- ## Anti-Patterns
306
+ ---
307
+
308
+ ## 3. Components catalog (UI Kit widgets)
309
+
310
+ Imports (additive mode — barrel re-exports `cometchat_uikit_shared`, `cometchat_sdk`, `cometchat_calls_sdk`):
174
311
 
175
312
  ```dart
176
- // ❌ WRONG — forgetting navigatorKey
177
- MaterialApp(/* missing navigatorKey */)
313
+ import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
314
+ ```
178
315
 
179
- // WRONG not enabling calling extension
180
- UIKitSettingsBuilder()..appId = 'APP_ID'..region = 'us'
181
- // Missing: ..callingExtension = CometChatCallingExtension()
316
+ | Widget | Purpose |
317
+ |---|---|
318
+ | `CometChatCallButtons(user: ..., group: ...)` | Voice + video buttons. Drop into `CometChatMessageHeader` trailing slot or anywhere in the tree. Mutually exclusive `user` / `group`. |
319
+ | `CometChatIncomingCall(call:, onAccept:, onDecline:)` | Foreground in-app ring UI (additive mode). **Callbacks take `(BuildContext, Call)`, NOT `(Call)` alone** — common mistake. |
320
+ | `CometChatOutgoingCall(call:, user: OR group:, onCancelled:)` | Dialing UI. `call:` is the result of `CometChatUIKitCalls.initiateCall(...)`. Callbacks `(BuildContext, Call)?`. |
321
+ | `CometChatOngoingCall(callSettingsBuilder:, sessionId:)` | Active call view, hosts WebRTC. |
322
+ | `CometChatCallLogs(onItemClick:, callLogsRequestBuilder:)` | Paginated history. **`CometChatCallLogDetails` is NOT a UIKit export** — copy the sample-app pattern from `~/Downloads/calls-sdk/calls-sdk-flutter-5/sample-apps/.../call_log_details/` for the detail screen. |
323
+
324
+ `CometChatUIKitCalls` API:
325
+
326
+ | Method | Purpose |
327
+ |---|---|
328
+ | `CometChatUIKitCalls.initiateCall(call)` | Start a call (wraps Chat SDK `initiateCall` + Calls SDK preflight) |
329
+ | `CometChatUIKitCalls.acceptCall(sessionId)` | Accept incoming |
330
+ | `CometChatUIKitCalls.rejectCall(sessionId, status)` | Reject / cancel |
331
+ | `CometChatUIKitCalls.generateToken(sessionId)` | Mint session-scoped RTC token |
332
+ | `CometChatUIKitCalls.startSession(sessionId, settings)` | Start WebRTC |
333
+ | `CometChatUIKitCalls.endSession()` | End and cleanup |
182
334
 
183
- // ❌ WRONG — handling incoming calls per-screen instead of globally
184
- ```
335
+ ---
336
+
337
+ ## 4. Standalone integration
338
+
339
+ When `product === "voice-video"` and there is no v5 chat integration.
340
+
341
+ **Split by calling mode:**
342
+
343
+ ### 4a. Standalone — Session mode (meeting-room UX, no ringing)
344
+
345
+ Calls SDK ONLY. NO Chat SDK. Matches `~/Downloads/calls-sdk/calls-sdk-flutter-5/sample-apps/cometchat-calls-sample-app-flutter/`. Scaffold:
346
+
347
+ 1. **`pubspec.yaml`** — `cometchat_calls_sdk: ^5.0.0` ONLY. No `cometchat_chat_sdk` / `cometchat_uikit_chat`.
348
+ 2. **`lib/main.dart`** — `CometChatCalls.init(appId, region, authKey)` + `permission_handler` flow.
349
+ 3. **`lib/screens/call_screen.dart`** — `StatefulWidget implements SessionStatusListeners, ButtonClickListeners`. `CometChatCalls.joinSession(sessionId:, sessionSettings: SessionSettingsBuilder().build(), onSuccess:, onError:)`. `CometChatOngoingCallService.launch/abort`. See `references/call-session.md`.
350
+ 4. **Native config** — Camera + microphone permissions only (no PushKit, no FCM for VoIP).
351
+
352
+ **Why no Chat SDK / no VoIP push:** session mode never touches a Chat SDK call entity. No ringing.
353
+
354
+ ### 4b. Standalone — Ringing mode (CallKit + FCM + UIKit-driven UI)
355
+
356
+ Dual-SDK: Chat SDK signaling + Calls SDK media. Scaffold:
357
+
358
+ 1. **`lib/main.dart`** — Chat SDK + Calls SDK init (no UIKit). Permission_handler request flow. PushKit + FCM listener registration.
359
+ 2. **`lib/services/voip_service.dart`** — Combines `flutter_callkit_incoming` events + `firebase_messaging` + iOS platform-channel PushKit. On payload → `FlutterCallkitIncoming.showCallkitIncoming(...)`. On accept → navigate to ongoing-call screen.
360
+ 3. **`lib/widgets/call_button.dart`** — Voice + video icon buttons rendered next to a user / contact.
361
+ 4. **`lib/screens/ongoing_call_screen.dart`** — `CometChatCalls.joinSession(sessionId:, sessionSettings:, onSuccess:, onError:)` with the returned Widget rendered via `SizedBox.expand`. Implements rule 1.5 cleanup. Sets `resizeToAvoidBottomInset: false`.
362
+ 5. **`lib/screens/call_logs_screen.dart`** — `/calls` route. Paginated via `CallLogsRequestBuilder`.
363
+ 6. **`MaterialApp.navigatorKey: CallNavigationContext.navigatorKey`** — rule 1.7.
364
+ 7. **Native config** — `Info.plist` (rule 1.6), `AndroidManifest.xml` (rule 1.3 + FCM service registration), Firebase config (`google-services.json` in `android/app/`, `GoogleService-Info.plist` in `ios/Runner/`).
365
+
366
+ ## 5. Additive integration
367
+
368
+ When chat is already integrated. The skill:
369
+
370
+ 1. Adds `cometchat_calls_uikit` to `pubspec.yaml`.
371
+ 2. Patches the existing `UIKitSettingsBuilder` to add `..callingExtension = CometChatCallingExtension()`.
372
+ 3. Sets `CallNavigationContext.navigatorKey` on `MaterialApp.navigatorKey` (rule 1.7).
373
+ 4. Mounts the global call listener in the app-shell `State` (rule 1.7).
374
+ 5. Confirms `CometChatMessageHeader` already shows call buttons (auto-rendered when `user` / `group` is passed).
375
+ 6. Optionally adds `CometChatCallLogs` as a tab/screen if user picked dedicated history.
376
+ 7. VoIP push: opt-in (substantial native config).
377
+
378
+ ## 6. Anti-patterns
379
+
380
+ 1. **`MaterialApp` without `CallNavigationContext.navigatorKey`.** Call overlays can't navigate; in-app ring works but accept-into-ongoing breaks. Rule 1.7.
381
+ 2. **Forgetting `..callingExtension = CometChatCallingExtension()`** on `UIKitSettingsBuilder`. Calls compile but `CometChatMessageHeader` doesn't show call icons; nothing rings. Most common additive-mode mistake.
382
+ 3. **`onAccept` / `onDecline` typed as `Function(Call)`** instead of `Function(BuildContext, Call)`. Compile errors are obvious; the dangerous case is when an agent wraps an existing chat screen's accept handler and silently mismatches signatures.
383
+ 4. **Per-screen incoming-call handling.** Calls only ring on the screen where the listener is attached. Listener belongs in the app shell (rule 1.7).
384
+ 5. **Skipping `resizeToAvoidBottomInset: false`** on Scaffolds with call UI. Keyboard-show during a call resizes WebRTC views and breaks layout.
385
+ 6. **Mixing `cometchat_chat_uikit ^5.x` with `cometchat_calls_uikit ^4.x`** (or vice versa). Internal SDK pin clash. Both UI Kit packages must be on matching majors.
386
+ 7. **Sending Android push as `notification`** instead of `data`. ConnectionService can't intercept `notification` payloads. Server must send `data: { type: "incoming_call", sessionId: ... }` with `priority: "high"`.
387
+
388
+ ## 7. Verification checklist
389
+
390
+ **Static:**
391
+
392
+ - [ ] `cometchat_calls_uikit ^5.0.15` in `pubspec.yaml` (additive) OR `cometchat_calls_sdk ^4.2.2` + `cometchat_sdk ^4.1.2` (standalone)
393
+ - [ ] `..callingExtension = CometChatCallingExtension()` on `UIKitSettingsBuilder` (additive)
394
+ - [ ] `MaterialApp.navigatorKey` is `CallNavigationContext.navigatorKey`
395
+ - [ ] Global call listener attached in app-shell State, removed in `dispose`
396
+ - [ ] Listener uses a stable string ID
397
+ - [ ] Camera + microphone + notification permissions requested via `permission_handler`
398
+ - [ ] iOS `Info.plist`: NSCameraUsageDescription + NSMicrophoneUsageDescription + UIBackgroundModes (audio + voip + remote-notification)
399
+ - [ ] Android manifest: four FOREGROUND_SERVICE_* permissions + MANAGE_OWN_CALLS + BIND_TELECOM_CONNECTION_SERVICE
400
+ - [ ] Hangup path: `endSession()` + `FlutterCallkitIncoming.endAllCalls()` + `Navigator.popUntil` (rule 1.5)
401
+ - [ ] **Standalone only:** Firebase configured (`google-services.json` + `GoogleService-Info.plist`)
402
+ - [ ] **Standalone only:** `flutter_callkit_incoming` + `firebase_messaging` + iOS PushKit platform-channel bridge
403
+
404
+ **Runtime (real devices, both platforms):**
405
+
406
+ - [ ] iOS — terminated app, lock-screen rings on incoming call
407
+ - [ ] iOS — answer from lock screen → opens app, joins ongoing call
408
+ - [ ] Android — terminated app, heads-up notification rings on incoming call
409
+ - [ ] Android — answer from heads-up → opens app, joins ongoing call
410
+ - [ ] Both — outgoing call connects, two-way audio + video
411
+ - [ ] Both — hangup releases camera + mic, no system call UI stuck
412
+ - [ ] Android 14+: ongoing-call notification visible, swipe-up doesn't kill the call
413
+ - [ ] Keyboard-show during call doesn't break WebRTC view (rule from anti-pattern 5)
185
414
 
186
- ## Checklist — Calls
415
+ ## 8. Pointers
187
416
 
188
- - [ ] `CometChatCallingExtension()` set on `UIKitSettingsBuilder.callingExtension`
189
- - [ ] `CallNavigationContext.navigatorKey` set on `MaterialApp.navigatorKey`
190
- - [ ] Incoming call handling is global (dashboard level)
191
- - [ ] Camera/microphone permissions requested
192
- - [ ] Import from `package:cometchat_calls_uikit/cometchat_calls_uikit.dart`
417
+ - `cometchat-calls` dispatcher
418
+ - `cometchat-flutter-v5-core` UIKitSettingsBuilder, init/login order, GetX scope
419
+ - `cometchat-flutter-v5-events` CometChatCallEvents subscription patterns
420
+ - `cometchat-flutter-v5-push` FCM/APNs for chat (overlap with VoIP push but distinct paths)
421
+ - `cometchat-flutter-v5-production` server-minted tokens, ProGuard, environment config
422
+ - `cometchat-flutter-v5-troubleshooting` — pubspec conflicts, GetX issues, Pod errors, runtime crashes
423
+ - `cometchat-flutter-v6-calls` + `cometchat-flutter-v6-migration` — when migrating to V6 (calls fold into the unified package, Bloc replaces GetX)