@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
@@ -0,0 +1,452 @@
1
+ ---
2
+ name: cometchat-flutter-v6-push
3
+ description: Push notifications for CometChat Flutter UIKit v6 (beta, Bloc-based). Covers firebase_messaging setup for FCM (Android) + APNs (iOS via Firebase), CometChat dashboard PushPlatform configuration, token registration via the Notifications SDK, background isolate handler (Dart entry-point rule), foreground vs background message routing, notification tap deep-link to chat threads, and the Bloc patterns for surfacing push state. Sister skill of cometchat-flutter-v5-push — same FCM stack, Bloc-flavored client integration.
4
+ license: "MIT"
5
+ compatibility: "Flutter >= 2.5, Dart >= 3.0; cometchat_chat_uikit ^6.0.0-beta2; firebase_messaging ^14.0.0; firebase_core ^2.0.0; Android minSdk 26+; iOS 13+ deployment target"
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 flutter v6 push notifications fcm apns firebase-messaging background-isolate dart-entry-point pushplatform bloc deep-link"
11
+ ---
12
+
13
+ ## Purpose
14
+
15
+ Push notifications for Flutter v6 (beta). Notifies users on incoming messages when the app is backgrounded or terminated. Two components: **Firebase Messaging** (FCM on Android, APNs forwarded via Firebase on iOS) on the client, plus **CometChat dashboard PushPlatform** configured to forward CometChat's webhook to Firebase.
16
+
17
+ This skill is for **chat push** (new messages). Calls/VoIP push has different mechanics — see `cometchat-flutter-v6-calls/references/voip-push-end-to-end.md` (or the relevant section of `cometchat-flutter-v6-calls/SKILL.md` rule 1.2).
18
+
19
+ **Read these other skills first:**
20
+ - `cometchat-flutter-v6-core` — UIKitSettings, init/login order
21
+ - `cometchat-flutter-v5-push` — sister skill (V5/GetX); same FCM stack with different client wiring
22
+ - `cometchat-flutter-v6-calls` — calls VoIP push (overlap with this; both can coexist)
23
+
24
+ **Ground truth:**
25
+ - firebase_messaging — https://pub.dev/packages/firebase_messaging
26
+ - CometChat docs — https://www.cometchat.com/docs/notifications/push-notifications
27
+ - FCM data vs notification payloads — https://firebase.google.com/docs/cloud-messaging/concept-options
28
+
29
+ ---
30
+
31
+ ## 1. Architecture
32
+
33
+ ```
34
+ Flutter app
35
+ ├── firebase_messaging — FCM token registration + receive
36
+ └── Background isolate handler — handles pushes when app is killed
37
+
38
+ CometChat Notifications SDK (server-side, dashboard-managed)
39
+ ├── PushPlatform configured (FCM key for Android, APNs cert for iOS)
40
+ └── Listens for new-message events → fans out to FCM/APNs
41
+
42
+ CometChat dashboard
43
+ └── Webhook → CometChat Notifications backend (no custom server needed for chat push)
44
+ ```
45
+
46
+ Unlike Web Push (which requires you to run a push server), CometChat hosts the chat-push relay. Configure FCM/APNs creds in the dashboard's Notifications settings; CometChat does the rest.
47
+
48
+ ---
49
+
50
+ ## 2. Setup
51
+
52
+ ### Add packages
53
+
54
+ ```yaml
55
+ # pubspec.yaml
56
+ dependencies:
57
+ flutter:
58
+ sdk: flutter
59
+ cometchat_chat_uikit: ^6.0.0-beta2
60
+ firebase_messaging: ^14.0.0
61
+ firebase_core: ^2.0.0
62
+ flutter_local_notifications: ^16.0.0 # for foreground notifications + iOS in-app banner
63
+ ```
64
+
65
+ ### Firebase project setup
66
+
67
+ ```bash
68
+ flutterfire configure
69
+ ```
70
+
71
+ This wizard:
72
+ - Asks which Firebase project to use (or creates one)
73
+ - Asks which platforms (iOS, Android, Web)
74
+ - Generates `lib/firebase_options.dart`
75
+ - Places `android/app/google-services.json`
76
+ - Places `ios/Runner/GoogleService-Info.plist`
77
+
78
+ If you don't have FlutterFire CLI: `dart pub global activate flutterfire_cli`.
79
+
80
+ ### Android — `android/app/build.gradle`
81
+
82
+ ```gradle
83
+ apply plugin: 'com.google.gms.google-services'
84
+
85
+ android {
86
+ defaultConfig {
87
+ minSdkVersion 26 // V6 floor; FCM needs 19+
88
+ }
89
+ }
90
+ ```
91
+
92
+ In `android/build.gradle`:
93
+
94
+ ```gradle
95
+ buildscript {
96
+ dependencies {
97
+ classpath 'com.google.gms:google-services:4.4.0'
98
+ }
99
+ }
100
+ ```
101
+
102
+ ### Android — manifest
103
+
104
+ ```xml
105
+ <!-- android/app/src/main/AndroidManifest.xml -->
106
+ <uses-permission android:name="android.permission.INTERNET" />
107
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <!-- Android 13+ -->
108
+
109
+ <application>
110
+ <meta-data
111
+ android:name="com.google.firebase.messaging.default_notification_channel_id"
112
+ android:value="cometchat_messages" />
113
+ <meta-data
114
+ android:name="com.google.firebase.messaging.default_notification_icon"
115
+ android:resource="@drawable/ic_notification" />
116
+ </application>
117
+ ```
118
+
119
+ ### iOS — capabilities
120
+
121
+ In Xcode → target → Signing & Capabilities:
122
+ - ☑ Push Notifications
123
+ - ☑ Background Modes → Remote notifications
124
+
125
+ Then upload an APNs Authentication Key (.p8) to **Firebase Console → Project Settings → Cloud Messaging → Apple app configuration**. Token-based auth (.p8) is preferred over cert-based — same key works for sandbox + production.
126
+
127
+ ---
128
+
129
+ ## 3. Initialize Firebase + register for push
130
+
131
+ ```dart
132
+ // lib/main.dart
133
+ import 'package:firebase_core/firebase_core.dart';
134
+ import 'package:firebase_messaging/firebase_messaging.dart';
135
+ import 'firebase_options.dart';
136
+
137
+ void main() async {
138
+ WidgetsFlutterBinding.ensureInitialized();
139
+ await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
140
+
141
+ // CRITICAL: register the background handler BEFORE runApp
142
+ FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
143
+
144
+ runApp(const MyApp());
145
+ }
146
+
147
+ // Background handler MUST be a top-level function (not a closure inside a class)
148
+ // AND must be annotated with @pragma to survive tree-shaking in release builds
149
+ @pragma('vm:entry-point')
150
+ Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
151
+ // Runs in a SEPARATE isolate. No Bloc, no UI state — just data persistence
152
+ // or local notifications if needed.
153
+ await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
154
+ // CometChat Notifications backend already shows the system notification;
155
+ // typically no extra work needed here.
156
+ }
157
+ ```
158
+
159
+ **The `@pragma('vm:entry-point')` annotation is non-negotiable.** Without it, Flutter's tree-shaking removes the function in release builds and the background handler silently fails.
160
+
161
+ ---
162
+
163
+ ## 4. Token registration with CometChat
164
+
165
+ The CometChat Notifications backend needs the device's FCM token to send pushes. Register it via the `CometChatNotifications` SDK after login resolves:
166
+
167
+ ```dart
168
+ // lib/services/push_service.dart
169
+ import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
170
+ import 'package:firebase_messaging/firebase_messaging.dart';
171
+ import 'package:flutter/services.dart';
172
+
173
+ class PushService {
174
+ final FirebaseMessaging _fcm = FirebaseMessaging.instance;
175
+
176
+ /// Call AFTER CometChatUIKit.login resolves.
177
+ Future<void> registerForPush() async {
178
+ // Request permission (iOS prompts; Android 13+ prompts)
179
+ final settings = await _fcm.requestPermission(
180
+ alert: true,
181
+ badge: true,
182
+ sound: true,
183
+ );
184
+ if (settings.authorizationStatus != AuthorizationStatus.authorized) return;
185
+
186
+ // Get the FCM token
187
+ final token = await _fcm.getToken();
188
+ if (token == null) return;
189
+
190
+ // Register with CometChat — provider ID matches your dashboard PushPlatform
191
+ await _registerWithCometChat(token, platform: defaultTargetPlatform);
192
+
193
+ // Listen for token refresh — happens on OS upgrades, app reinstalls
194
+ _fcm.onTokenRefresh.listen((newToken) async {
195
+ await _registerWithCometChat(newToken, platform: defaultTargetPlatform);
196
+ });
197
+ }
198
+
199
+ Future<void> unregister() async {
200
+ final token = await _fcm.getToken();
201
+ if (token == null) return;
202
+ await _unregisterWithCometChat(token);
203
+ }
204
+
205
+ Future<void> _registerWithCometChat(String token, {required TargetPlatform platform}) async {
206
+ // Audit 2026-05-14: the canonical SDK method is `PNRegistry.registerPNService`,
207
+ // NOT `CometChatNotifications.registerPushToken` (which was cited in earlier
208
+ // drafts of this doc but doesn't exist on the installed SDK).
209
+ // Source: https://www.cometchat.com/docs/notifications/flutter-push-notifications-android.md
210
+ //
211
+ // The provider ID (FCM vs APN) is pulled from `AppCredentials.fcmProviderId`
212
+ // (or the APN equivalent) at registration time — you don't pass it directly.
213
+ PNRegistry.registerPNService(token, true, false);
214
+ }
215
+
216
+ Future<void> _unregisterWithCometChat(String token) async {
217
+ // Same `PNRegistry` namespace — pass `false` as the second arg to unregister.
218
+ PNRegistry.registerPNService(token, false, false);
219
+ }
220
+ }
221
+ ```
222
+
223
+ **Audit 2026-05-14** — the symbols are `PNRegistry.registerPNService(token, register, additionalFlag)`. Earlier drafts of this doc cited `CometChatNotifications.registerPushToken` / `unregisterPushToken` — those don't exist. Confirmed against the vendor docs at `https://www.cometchat.com/docs/notifications/flutter-push-notifications-android.md`. If you've copied the old symbols into your code, they will not compile.
224
+
225
+ ---
226
+
227
+ ## 5. Wire into the auth flow
228
+
229
+ ```dart
230
+ // lib/main.dart (continued)
231
+ class MyApp extends StatefulWidget {
232
+ @override
233
+ State<MyApp> createState() => _MyAppState();
234
+ }
235
+
236
+ class _MyAppState extends State<MyApp> {
237
+ final PushService _push = PushService();
238
+
239
+ @override
240
+ void initState() {
241
+ super.initState();
242
+ _initCometChat();
243
+ }
244
+
245
+ Future<void> _initCometChat() async {
246
+ final settings = (UIKitSettings.builder()
247
+ ..appId = CometChatConfig.appId
248
+ ..region = CometChatConfig.region
249
+ ..authKey = CometChatConfig.authKey)
250
+ .build();
251
+
252
+ CometChatUIKit.init(
253
+ uiKitSettings: settings,
254
+ onSuccess: (_) async {
255
+ // After login (in your AuthBloc or wherever)
256
+ await _push.registerForPush();
257
+ _setupForegroundHandler();
258
+ _setupNotificationTapHandler();
259
+ },
260
+ );
261
+ }
262
+
263
+ void _setupForegroundHandler() {
264
+ FirebaseMessaging.onMessage.listen((RemoteMessage message) {
265
+ // App is in foreground — system doesn't show a notification automatically.
266
+ // Either show a flutter_local_notifications banner, or surface in-app via Bloc.
267
+ });
268
+ }
269
+
270
+ void _setupNotificationTapHandler() {
271
+ // Tap on notification while app is backgrounded
272
+ FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
273
+ _navigateToConversation(message);
274
+ });
275
+
276
+ // Cold-start tap — app was terminated, user tapped notification
277
+ FirebaseMessaging.instance.getInitialMessage().then((RemoteMessage? message) {
278
+ if (message != null) _navigateToConversation(message);
279
+ });
280
+ }
281
+
282
+ void _navigateToConversation(RemoteMessage message) {
283
+ final data = message.data;
284
+ final conversationId = data['conversationId'] as String?;
285
+ final receiverType = data['receiverType'] as String?;
286
+ if (conversationId == null) return;
287
+
288
+ // Use a global navigator key (set on MaterialApp.navigatorKey) to navigate
289
+ // from outside the widget tree
290
+ AppNavigator.navigatorKey.currentState?.pushNamed(
291
+ receiverType == 'group' ? '/messages/group/$conversationId' : '/messages/user/$conversationId',
292
+ );
293
+ }
294
+ }
295
+ ```
296
+
297
+ ---
298
+
299
+ ## 6. CometChat dashboard PushPlatform
300
+
301
+ In the dashboard:
302
+
303
+ 1. Navigate to **Notifications → Push Notifications**.
304
+ 2. Add provider:
305
+ - **FCM** for Android: paste the FCM Server Key (from Firebase Console → Project Settings → Cloud Messaging → Cloud Messaging API (Legacy)) OR the new HTTP v1 API service account JSON
306
+ - **APN** for iOS: paste the .p8 + Team ID + Key ID, OR the .p12 (legacy)
307
+ 3. Save. CometChat now relays new-message events to FCM/APNs.
308
+
309
+ **Use HTTP v1 API for FCM** — Google deprecated the legacy server keys. The dashboard's UI lists both; pick HTTP v1 for new setups.
310
+
311
+ ---
312
+
313
+ ## 7. Foreground notifications
314
+
315
+ When the app is foregrounded, FCM does NOT show a system notification — `onMessage` fires instead and you decide what to do. Options:
316
+
317
+ ### A — In-app banner via Bloc
318
+
319
+ ```dart
320
+ // In your AppBloc or a NotificationBloc
321
+ on<IncomingMessageNotification>((event, emit) {
322
+ emit(state.copyWith(banner: BannerData(
323
+ title: event.senderName,
324
+ body: event.preview,
325
+ onTap: () => navigatorKey.currentState?.pushNamed(...),
326
+ )));
327
+ });
328
+ ```
329
+
330
+ Render the banner in `MaterialApp.builder`.
331
+
332
+ ### B — Local notification via flutter_local_notifications
333
+
334
+ ```dart
335
+ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
336
+
337
+ final FlutterLocalNotificationsPlugin _localNotifs = FlutterLocalNotificationsPlugin();
338
+
339
+ Future<void> _showLocalNotif(RemoteMessage message) async {
340
+ await _localNotifs.show(
341
+ message.hashCode,
342
+ message.notification?.title ?? '',
343
+ message.notification?.body ?? '',
344
+ NotificationDetails(
345
+ android: AndroidNotificationDetails(
346
+ 'cometchat_messages',
347
+ 'Messages',
348
+ importance: Importance.high,
349
+ priority: Priority.high,
350
+ ),
351
+ iOS: DarwinNotificationDetails(),
352
+ ),
353
+ payload: jsonEncode(message.data),
354
+ );
355
+ }
356
+ ```
357
+
358
+ Initialize `flutter_local_notifications` once in `main()`:
359
+
360
+ ```dart
361
+ await _localNotifs.initialize(
362
+ InitializationSettings(
363
+ android: AndroidInitializationSettings('@mipmap/ic_launcher'),
364
+ iOS: DarwinInitializationSettings(),
365
+ ),
366
+ onDidReceiveNotificationResponse: (response) {
367
+ if (response.payload != null) {
368
+ final data = jsonDecode(response.payload!);
369
+ // navigate
370
+ }
371
+ },
372
+ );
373
+ ```
374
+
375
+ ---
376
+
377
+ ## 8. Logout cleanup
378
+
379
+ ```dart
380
+ class AuthBloc extends Bloc<AuthEvent, AuthState> {
381
+ final PushService _push;
382
+
383
+ on<LogoutRequested>((event, emit) async {
384
+ await _push.unregister(); // CRITICAL — before SDK logout
385
+ await CometChatUIKit.logout(/* ... */);
386
+ emit(Unauthenticated());
387
+ });
388
+ }
389
+ ```
390
+
391
+ If you skip unregister, the previous user keeps getting notifications for the new user's messages.
392
+
393
+ ---
394
+
395
+ ## 9. v5 → v6 push migration
396
+
397
+ If migrating from v5:
398
+
399
+ | Concern | V5 | V6 |
400
+ |---|---|---|
401
+ | Listener pattern | GetX `Get.put` for push handlers | Bloc — handlers in app shell or a NotificationBloc |
402
+ | Init lifecycle | `CometChatUIKit.init` callback | Same shape — `onSuccess` / `onError` |
403
+ | Token registration API | Verify against installed `cometchat_chat_uikit` | Same — likely renamed; verify |
404
+ | Background handler | `@pragma('vm:entry-point')` required | Unchanged — Flutter framework requirement |
405
+ | Calls VoIP push interaction | `cometchat_calls_uikit ^5` separate package | Calls bundled into `cometchat_chat_uikit ^6.0.0-beta2`; VoIP push handled in `cometchat-flutter-v6-calls` references |
406
+
407
+ The migration is small for push specifically — the FCM/firebase_messaging stack is unchanged; the deltas are in the surrounding architecture.
408
+
409
+ ---
410
+
411
+ ## 10. Anti-patterns
412
+
413
+ 1. **Background handler missing `@pragma('vm:entry-point')`.** Tree-shaken in release builds; works in debug. The "works in dev, fails in production" canary.
414
+ 2. **Background handler as a closure inside a class.** Must be a TOP-LEVEL function. Closures can't be passed across isolate boundaries.
415
+ 3. **Calling `_push.registerForPush()` before login.** CometChat doesn't know whose UID this token belongs to. Register from the post-login success callback.
416
+ 4. **Skipping `onTokenRefresh`.** OS upgrades and app reinstalls rotate the FCM token without warning. Listen to refresh and re-register.
417
+ 5. **Using FCM legacy server keys.** Google deprecated them. Use HTTP v1 API service account in CometChat dashboard.
418
+ 6. **Not unregistering on logout.** Previous user's notifications keep arriving for the new session.
419
+ 7. **Showing a foreground notification AND an in-app banner for the same message.** Pick one. The skill defaults to in-app banner (Bloc-driven) if the chat tab is active; system notification otherwise.
420
+ 8. **`flutter_local_notifications` initialization missing icon resource.** Crashes on Android with "Notification icon not found." Drop a `ic_notification.png` in `android/app/src/main/res/drawable/`.
421
+
422
+ ---
423
+
424
+ ## 11. Verification checklist
425
+
426
+ - [ ] `firebase_messaging ^14.0.0` + `firebase_core ^2.0.0` in pubspec.yaml
427
+ - [ ] `flutterfire configure` ran successfully; `lib/firebase_options.dart` exists
428
+ - [ ] `google-services.json` in `android/app/`
429
+ - [ ] `GoogleService-Info.plist` in `ios/Runner/`
430
+ - [ ] iOS: Push Notifications + Remote-notification background mode capabilities enabled
431
+ - [ ] iOS: APNs .p8 key uploaded to Firebase Console
432
+ - [ ] Android: `minSdkVersion 26` in `android/app/build.gradle` (V6 floor)
433
+ - [ ] Android manifest: `POST_NOTIFICATIONS` permission + notification channel meta-data
434
+ - [ ] Background handler is top-level + `@pragma('vm:entry-point')`
435
+ - [ ] Background handler initialized via `FirebaseMessaging.onBackgroundMessage` BEFORE `runApp`
436
+ - [ ] FCM/APN token registered with CometChat via `PNRegistry.registerPNService(token, true, false)` AFTER login (NOT `CometChatNotifications.registerPushToken` — that symbol doesn't exist; audit 2026-05-14)
437
+ - [ ] `onTokenRefresh` re-registers
438
+ - [ ] Foreground handler decides banner vs no-banner based on chat tab focus
439
+ - [ ] `onMessageOpenedApp` + `getInitialMessage` both navigate to the conversation
440
+ - [ ] Logout calls `_push.unregister()` BEFORE `CometChatUIKit.logout()`
441
+ - [ ] Dashboard PushPlatform configured with FCM HTTP v1 + APNs .p8
442
+ - [ ] Real-device smoke (NOT simulator): backgrounded app → message → notification rings + tapping opens chat thread
443
+
444
+ ---
445
+
446
+ ## 12. Pointers
447
+
448
+ - `cometchat-flutter-v5-push` — V5/GetX sister skill (FCM stack unchanged; client wiring different)
449
+ - `cometchat-flutter-v6-calls/references/voip-push-end-to-end.md` — calls VoIP push (overlap; both can coexist)
450
+ - `cometchat-flutter-v6-core` — UIKitSettings, init/login order
451
+ - `cometchat-flutter-v6-troubleshooting` — push debugging (token never registers, background handler doesn't fire, FCM payload not received)
452
+ - `cometchat-flutter-v6-migration` — full V5→V6 migration recipe; push delta is one section