@cometchat/skills 3.0.0 → 4.0.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 (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -17
  3. package/bin/install.js +389 -43
  4. package/package.json +19 -9
  5. package/skills/cometchat/SKILL.md +1066 -265
  6. package/skills/cometchat-android-v5/SKILL.md +120 -0
  7. package/skills/cometchat-android-v5-components/SKILL.md +430 -0
  8. package/skills/cometchat-android-v5-core/SKILL.md +468 -0
  9. package/skills/cometchat-android-v5-customization/SKILL.md +305 -0
  10. package/skills/cometchat-android-v5-extensions/SKILL.md +124 -0
  11. package/skills/cometchat-android-v5-features/SKILL.md +130 -0
  12. package/skills/cometchat-android-v5-placement/SKILL.md +276 -0
  13. package/skills/cometchat-android-v5-production/SKILL.md +94 -0
  14. package/skills/cometchat-android-v5-push/SKILL.md +620 -0
  15. package/skills/cometchat-android-v5-testing/SKILL.md +187 -0
  16. package/skills/cometchat-android-v5-theming/SKILL.md +166 -0
  17. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +73 -0
  18. package/skills/cometchat-android-v6/SKILL.md +107 -0
  19. package/skills/cometchat-android-v6-builder-settings/SKILL.md +145 -0
  20. package/skills/cometchat-android-v6-compose-components/SKILL.md +202 -0
  21. package/skills/cometchat-android-v6-compose-customization/SKILL.md +280 -0
  22. package/skills/cometchat-android-v6-compose-placement/SKILL.md +213 -0
  23. package/skills/cometchat-android-v6-compose-theming/SKILL.md +224 -0
  24. package/skills/cometchat-android-v6-core/SKILL.md +354 -0
  25. package/skills/cometchat-android-v6-events/SKILL.md +212 -0
  26. package/skills/cometchat-android-v6-extensions/SKILL.md +191 -0
  27. package/skills/cometchat-android-v6-features/SKILL.md +130 -0
  28. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +197 -0
  29. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +268 -0
  30. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +248 -0
  31. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +202 -0
  32. package/skills/cometchat-android-v6-production/SKILL.md +187 -0
  33. package/skills/cometchat-android-v6-push/SKILL.md +274 -0
  34. package/skills/cometchat-android-v6-testing/SKILL.md +279 -0
  35. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +249 -0
  36. package/skills/cometchat-angular-components/SKILL.md +706 -0
  37. package/skills/cometchat-angular-core/SKILL.md +444 -0
  38. package/skills/cometchat-angular-customization/SKILL.md +424 -0
  39. package/skills/cometchat-angular-features/SKILL.md +447 -0
  40. package/skills/cometchat-angular-patterns/SKILL.md +447 -0
  41. package/skills/cometchat-angular-placement/SKILL.md +685 -0
  42. package/skills/cometchat-angular-production/SKILL.md +415 -0
  43. package/skills/cometchat-angular-theming/SKILL.md +365 -0
  44. package/skills/cometchat-angular-troubleshooting/SKILL.md +329 -0
  45. package/skills/cometchat-astro-patterns/SKILL.md +3 -3
  46. package/skills/cometchat-components/SKILL.md +11 -0
  47. package/skills/cometchat-core/SKILL.md +11 -6
  48. package/skills/cometchat-customization/references/component-catalog.md +1 -1
  49. package/skills/cometchat-features/SKILL.md +176 -108
  50. package/skills/cometchat-flutter-v5/SKILL.md +167 -0
  51. package/skills/cometchat-flutter-v5-calls/SKILL.md +192 -0
  52. package/skills/cometchat-flutter-v5-conversations/SKILL.md +117 -0
  53. package/skills/cometchat-flutter-v5-core/SKILL.md +221 -0
  54. package/skills/cometchat-flutter-v5-customization/SKILL.md +227 -0
  55. package/skills/cometchat-flutter-v5-events/SKILL.md +155 -0
  56. package/skills/cometchat-flutter-v5-messages/SKILL.md +258 -0
  57. package/skills/cometchat-flutter-v5-production/SKILL.md +207 -0
  58. package/skills/cometchat-flutter-v5-push/SKILL.md +284 -0
  59. package/skills/cometchat-flutter-v5-theming/SKILL.md +160 -0
  60. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +129 -0
  61. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +151 -0
  62. package/skills/cometchat-flutter-v6/SKILL.md +445 -0
  63. package/skills/cometchat-flutter-v6-calls/SKILL.md +333 -0
  64. package/skills/cometchat-flutter-v6-components/SKILL.md +365 -0
  65. package/skills/cometchat-flutter-v6-conversations/SKILL.md +210 -0
  66. package/skills/cometchat-flutter-v6-core/SKILL.md +305 -0
  67. package/skills/cometchat-flutter-v6-customization/SKILL.md +666 -0
  68. package/skills/cometchat-flutter-v6-events/SKILL.md +216 -0
  69. package/skills/cometchat-flutter-v6-features/SKILL.md +406 -0
  70. package/skills/cometchat-flutter-v6-messages/SKILL.md +333 -0
  71. package/skills/cometchat-flutter-v6-migration/SKILL.md +381 -0
  72. package/skills/cometchat-flutter-v6-placement/SKILL.md +398 -0
  73. package/skills/cometchat-flutter-v6-production/SKILL.md +632 -0
  74. package/skills/cometchat-flutter-v6-theming/SKILL.md +260 -0
  75. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +726 -0
  76. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +216 -0
  77. package/skills/cometchat-ios/SKILL.md +323 -0
  78. package/skills/cometchat-ios-components/SKILL.md +651 -0
  79. package/skills/cometchat-ios-core/SKILL.md +822 -0
  80. package/skills/cometchat-ios-customization/SKILL.md +825 -0
  81. package/skills/cometchat-ios-features/SKILL.md +725 -0
  82. package/skills/cometchat-ios-placement/SKILL.md +750 -0
  83. package/skills/cometchat-ios-production/SKILL.md +730 -0
  84. package/skills/cometchat-ios-push/SKILL.md +582 -0
  85. package/skills/cometchat-ios-theming/SKILL.md +631 -0
  86. package/skills/cometchat-ios-troubleshooting/SKILL.md +983 -0
  87. package/skills/cometchat-native-bare-patterns/SKILL.md +470 -0
  88. package/skills/cometchat-native-components/SKILL.md +594 -0
  89. package/skills/cometchat-native-core/SKILL.md +407 -0
  90. package/skills/cometchat-native-customization/SKILL.md +594 -0
  91. package/skills/cometchat-native-expo-patterns/SKILL.md +485 -0
  92. package/skills/cometchat-native-features/SKILL.md +608 -0
  93. package/skills/cometchat-native-placement/SKILL.md +500 -0
  94. package/skills/cometchat-native-production/SKILL.md +694 -0
  95. package/skills/cometchat-native-push/SKILL.md +593 -0
  96. package/skills/cometchat-native-testing/SKILL.md +583 -0
  97. package/skills/cometchat-native-theming/SKILL.md +656 -0
  98. package/skills/cometchat-native-troubleshooting/SKILL.md +433 -0
  99. package/skills/cometchat-nextjs-patterns/SKILL.md +5 -5
  100. package/skills/cometchat-production/SKILL.md +60 -0
  101. package/skills/cometchat-react-router-patterns/SKILL.md +23 -21
@@ -0,0 +1,333 @@
1
+ ---
2
+ name: cometchat-flutter-v6-calls
3
+ description: >
4
+ Use when implementing voice calls, video calls, or call UI with CometChat Flutter UIKit v6.
5
+ Covers CometChatCallButtons, CometChatIncomingCall, CometChatOutgoingCall,
6
+ CometChatOngoingCall, CometChatCallLogs, CometChatUIKitCalls, CallingConfiguration,
7
+ CallButtonsBloc, IncomingCallBloc, OutgoingCallBloc, OngoingCallBloc, CallLogsBloc,
8
+ CallEventService, CallOperationsServiceLocator, call_operations, call_settings,
9
+ SessionSettingsBuilder, CallAppSettings, initiateCall, acceptCall, rejectCall,
10
+ endSession, startSession, generateToken, CallNavigationContext,
11
+ CometChatDisplayIncomingCallOverlay, native_call_kit,
12
+ call permissions, audio call, video call, group call, call logs, call history,
13
+ incoming call screen, outgoing call screen, ongoing call screen, call bubble,
14
+ or "add calling to my app". Also use when seeing errors like
15
+ "CallManager not found", "startSession null", "call token null",
16
+ "session already started", or call-related crashes.
17
+ license: "MIT"
18
+ compatibility: "cometchat_chat_uikit ^6.0.0-beta2"
19
+ allowed-tools: "executeBash, readFile, readCode, fileSearch, listDirectory, grepSearch"
20
+ metadata:
21
+ author: "CometChat"
22
+ version: "3.0.0"
23
+ tags: "cometchat flutter calls voice video calling incoming outgoing ongoing call-logs"
24
+ ---
25
+
26
+ # CometChat Flutter UIKit — Calls
27
+
28
+ Voice and video calling for 1:1 and group conversations. Call functionality is built into `cometchat_chat_uikit` — no separate package needed.
29
+
30
+ ## Import
31
+
32
+ ```dart
33
+ import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
34
+ import 'package:cometchat_chat_uikit/cometchat_calls_uikit.dart';
35
+ ```
36
+
37
+ The first import gives you chat components. The second gives you call-specific types.
38
+
39
+ ## Rule: CALLS_INIT_AFTER_CHAT_INIT
40
+
41
+ `CometChatUIKitCalls.init()` MUST be called after `CometChatUIKit.init()` completes. The calls SDK needs the chat SDK's auth context.
42
+
43
+ ```dart
44
+ // ✅ CORRECT — calls init after chat init
45
+ CometChatUIKit.init(
46
+ uiKitSettings: settings,
47
+ onSuccess: (_) {
48
+ CometChatUIKitCalls.init(appId, region,
49
+ onSuccess: (_) => debugPrint('Calls SDK ready'),
50
+ onError: (e) => debugPrint('Calls init failed: ${e.message}'),
51
+ );
52
+ },
53
+ );
54
+
55
+ // ❌ WRONG — parallel init causes auth token null
56
+ CometChatUIKit.init(uiKitSettings: settings);
57
+ CometChatUIKitCalls.init(appId, region); // Race condition
58
+ ```
59
+
60
+ ## Rule: SINGLE_CALLS_INIT
61
+
62
+ `CometChatUIKitCalls.init()` must be called exactly once per app lifecycle. Calling it again after logout + re-login can cause "session already started" errors.
63
+
64
+ ## Rule: CALLS_REINIT_AFTER_LOGOUT
65
+
66
+ After `CometChatUIKit.logout()`, the calls SDK session is invalidated. On the next login, `CometChatUIKitCalls.init()` must be called again.
67
+
68
+ ## Architecture
69
+
70
+ ```
71
+ call_ui/src/
72
+ ├── call_buttons/ # Voice/video call buttons (CallButtonsBloc)
73
+ ├── incoming_call/ # Incoming call screen (IncomingCallBloc)
74
+ ├── outgoing_call/ # Outgoing call screen (OutgoingCallBloc)
75
+ ├── ongoing_call/ # Active call screen — WebRTC (OngoingCallBloc)
76
+ ├── call_logs/ # Call history list (CallLogsBloc + Clean Arch)
77
+ ├── call_operations/ # Shared clean architecture (DI, use cases, repos)
78
+ ├── call_bubble/ # Call message bubble in chat
79
+ ├── call_settings/ # CometChatUIKitCalls, CallNavigationContext
80
+ ├── native_call_kit/ # iOS CallKit / Android ConnectionService
81
+ ├── utils/ # CallUtils, CallStateService, CallPermissions
82
+ ├── call_event_service.dart # Centralized call event handling
83
+ └── calling_configuration.dart # Top-level config object
84
+ ```
85
+
86
+ ## Components
87
+
88
+ ### CometChatCallButtons
89
+
90
+ Voice and video call buttons. Typically placed in `CometChatMessageHeader`'s trailing view or standalone.
91
+
92
+ ```dart
93
+ CometChatCallButtons(
94
+ user: user, // For 1:1 calls
95
+ group: group, // For group calls (meetings)
96
+ hideVoiceCallButton: false,
97
+ hideVideoCallButton: false,
98
+ voiceCallIcon: Icon(Icons.call),
99
+ videoCallIcon: Icon(Icons.videocam),
100
+ callButtonsStyle: CometChatCallButtonsStyle(
101
+ voiceCallIconColor: colorPalette.iconPrimary,
102
+ videoCallIconColor: colorPalette.iconPrimary,
103
+ ),
104
+ outgoingCallConfiguration: CometChatOutgoingCallConfiguration(
105
+ outgoingCallStyle: CometChatOutgoingCallStyle(...),
106
+ ),
107
+ )
108
+ ```
109
+
110
+ Call buttons are built into `CometChatMessageHeader` by default:
111
+ ```dart
112
+ CometChatMessageHeader(
113
+ user: user,
114
+ group: group,
115
+ hideVoiceCallButton: false,
116
+ hideVideoCallButton: false,
117
+ )
118
+ ```
119
+
120
+ ### CometChatIncomingCall
121
+
122
+ Displays when the logged-in user receives a call. Supports accept/decline with custom views.
123
+
124
+ ```dart
125
+ CometChatIncomingCall(
126
+ call: call, // Required — the active Call object
127
+ user: callerUser, // Caller info for display
128
+ onAccept: (ctx, call) { },
129
+ onDecline: (ctx, call) { },
130
+ disableSoundForCalls: false,
131
+ customSoundForCalls: 'assets/ringtone.mp3',
132
+ incomingCallStyle: CometChatIncomingCallStyle(
133
+ backgroundColor: colorPalette.background3,
134
+ acceptButtonColor: colorPalette.success,
135
+ declineButtonColor: colorPalette.error,
136
+ ),
137
+ // Custom view slots
138
+ titleView: (ctx, call) => Text('Custom Title'),
139
+ subTitleView: (ctx, call) => Text('Custom Subtitle'),
140
+ leadingView: (ctx, call) => Icon(Icons.call),
141
+ trailingView: (ctx, call) => CometChatAvatar(image: user.avatar),
142
+ )
143
+ ```
144
+
145
+ ### CometChatOutgoingCall
146
+
147
+ Displays when the logged-in user initiates a call.
148
+
149
+ ```dart
150
+ CometChatOutgoingCall(
151
+ call: call,
152
+ user: receiverUser,
153
+ outgoingCallStyle: CometChatOutgoingCallStyle(
154
+ backgroundColor: colorPalette.background1,
155
+ ),
156
+ )
157
+ ```
158
+
159
+ ### CometChatOngoingCall
160
+
161
+ The active call screen with WebRTC video/audio. Rendered after a call is accepted.
162
+
163
+ ```dart
164
+ CometChatOngoingCall(
165
+ callSettingsBuilder: sessionSettingsBuilder,
166
+ sessionId: call.sessionId,
167
+ callWorkFlow: CallWorkFlow.directCalling,
168
+ )
169
+ ```
170
+
171
+ ### CometChatCallLogs
172
+
173
+ Scrollable list of call history. Clean Architecture + BLoC with `CallLogsServiceLocator`.
174
+
175
+ ```dart
176
+ CometChatCallLogs(
177
+ onItemClick: (callLog) { /* Navigate or initiate call */ },
178
+ callLogsStyle: CallLogsStyle(backgroundColor: colorPalette.background1),
179
+ )
180
+ ```
181
+
182
+ ### CometChatCallBubble
183
+
184
+ Message bubble for call events in the message list. Automatically rendered for call-type messages.
185
+
186
+ ## CallingConfiguration
187
+
188
+ Top-level configuration object bundling all call component configs:
189
+
190
+ ```dart
191
+ CallingConfiguration(
192
+ outgoingCallConfiguration: CometChatOutgoingCallConfiguration(...),
193
+ incomingCallConfiguration: CometChatIncomingCallConfiguration(...),
194
+ callButtonsConfiguration: CallButtonsConfiguration(...),
195
+ groupSessionSettingsBuilder: sessionSettingsBuilder,
196
+ )
197
+ ```
198
+
199
+ ## CometChatUIKitCalls API
200
+
201
+ | Method | Purpose |
202
+ |--------|---------|
203
+ | `CometChatUIKitCalls.init(appId, region)` | Initialize calls SDK |
204
+ | `CometChatUIKitCalls.initiateCall(call)` | Start a call |
205
+ | `CometChatUIKitCalls.acceptCall(sessionId)` | Accept incoming call |
206
+ | `CometChatUIKitCalls.rejectCall(sessionId, status)` | Reject/cancel call |
207
+ | `CometChatUIKitCalls.generateToken(sessionId)` | Generate call token |
208
+ | `CometChatUIKitCalls.startSession(sessionId, settings)` | Start WebRTC session |
209
+ | `CometChatUIKitCalls.endSession()` | End active call session |
210
+
211
+ ## Call Flow — 1:1 Direct Call
212
+
213
+ ```
214
+ Caller Receiver
215
+ |-- CometChatCallButtons tap ------->|
216
+ |-- initiateCall(Call) ------------->|
217
+ |-- CometChatOutgoingCall shown ---->|
218
+ | |-- CometChatIncomingCall shown
219
+ | |-- acceptCall(sessionId)
220
+ |<-- onOutgoingCallAccepted ---------|
221
+ |-- generateToken(sessionId) ------->|
222
+ |-- startSession(token, settings) -->|
223
+ |-- CometChatOngoingCall shown ----->|-- CometChatOngoingCall shown
224
+ |-- endSession() ------------------>|-- endSession()
225
+ ```
226
+
227
+ ## Golden Path — Messages Screen with Calls
228
+
229
+ ```dart
230
+ Scaffold(
231
+ resizeToAvoidBottomInset: false,
232
+ appBar: CometChatMessageHeader(
233
+ user: user,
234
+ group: group,
235
+ onBack: () => Navigator.pop(context),
236
+ hideVoiceCallButton: false,
237
+ hideVideoCallButton: false,
238
+ ),
239
+ body: Column(
240
+ children: [
241
+ Expanded(child: CometChatMessageList(user: user, group: group)),
242
+ CometChatMessageComposer(user: user, group: group),
243
+ ],
244
+ ),
245
+ )
246
+ ```
247
+
248
+ ## BLoC Events
249
+
250
+ ### CallButtonsBloc
251
+ | Event | Purpose |
252
+ |-------|---------|
253
+ | `InitiateVoiceCall` | Start audio call |
254
+ | `InitiateVideoCall` | Start video call |
255
+
256
+ ### IncomingCallBloc
257
+ | Event | Purpose |
258
+ |-------|---------|
259
+ | `AcceptCall` | Accept the incoming call |
260
+ | `RejectCall` | Decline the incoming call |
261
+
262
+ ### OutgoingCallBloc
263
+ | Event | Purpose |
264
+ |-------|---------|
265
+ | `CancelCall` | Cancel the outgoing call |
266
+ | `CallAccepted(call)` | Receiver accepted |
267
+ | `CallRejected(call)` | Receiver rejected |
268
+
269
+ ### OngoingCallBloc
270
+ | Event | Purpose |
271
+ |-------|---------|
272
+ | `StartSession(sessionId, settings)` | Begin WebRTC session |
273
+ | `EndSession` | End the call |
274
+
275
+ ### CallLogsBloc
276
+ | Event | Purpose |
277
+ |-------|---------|
278
+ | `LoadCallLogs` | Initial load |
279
+ | `LoadMoreCallLogs` | Pagination |
280
+
281
+ ## Gotchas
282
+
283
+ - `CometChatUIKitCalls.init()` must happen AFTER `CometChatUIKit.init()` — parallel init causes "auth token null".
284
+ - After logout, the calls SDK session is invalidated. Re-init required on next login.
285
+ - `startSession` on Android can return `null` with a 5-second timeout and no error feedback. Known platform issue.
286
+ - `SessionType.audio` is ignored on Android in some SDK versions — always opens with video. Known external SDK bug.
287
+ - Group calls use `CometChat.Group` not `CometChat.User` on `CometChatCallButtons`.
288
+ - Incoming call handling must be global (mounted at app root level) so calls ring on every screen.
289
+ - `CallOperationsServiceLocator` must be initialized before using call BLoCs directly. UIKit widgets handle this automatically.
290
+ - After logout, call `CallOperationsServiceLocator.instance.reset()` to clean up.
291
+ - On iOS, CallKit integration via `native_call_kit` shows the native call UI. Ensure `Info.plist` has the `voip` background mode.
292
+ - On Android, the ongoing call foreground service shows a notification during active calls. Launched automatically by `startSession`.
293
+
294
+ ## Anti-Patterns
295
+
296
+ ```dart
297
+ // ❌ WRONG — init calls SDK before chat SDK
298
+ CometChatUIKitCalls.init(appId, region);
299
+ CometChatUIKit.init(uiKitSettings: settings);
300
+
301
+ // ✅ CORRECT — calls init in chat init's onSuccess
302
+ CometChatUIKit.init(
303
+ uiKitSettings: settings,
304
+ onSuccess: (_) {
305
+ CometChatUIKitCalls.init(appId, region);
306
+ },
307
+ );
308
+ ```
309
+
310
+ ```dart
311
+ // ❌ WRONG — not handling incoming calls globally
312
+ CometChatIncomingCall(call: call, user: user) // Only on messages screen
313
+
314
+ // ✅ CORRECT — mount incoming call overlay at app root
315
+ MaterialApp(
316
+ builder: (context, child) {
317
+ return Stack(children: [child!, /* Global incoming call listener */]);
318
+ },
319
+ )
320
+ ```
321
+
322
+ ## Checklist
323
+
324
+ - [ ] `CometChatUIKitCalls.init()` called after `CometChatUIKit.init()` completes
325
+ - [ ] Incoming call handling is global (app root level), not per-screen
326
+ - [ ] Camera + microphone permissions handled (automatic via `CallPermissions`)
327
+ - [ ] `resizeToAvoidBottomInset: false` on any Scaffold with call UI
328
+ - [ ] Call buttons visible in `CometChatMessageHeader` (default) or standalone
329
+ - [ ] After logout, calls SDK re-initialized on next login
330
+ - [ ] Android: `minSdk = 26`, ProGuard rules for `com.cometchat.**`
331
+ - [ ] iOS: `voip` background mode in `Info.plist` for CallKit
332
+ - [ ] Theme cached in `didChangeDependencies()`, not `build()`
333
+ - [ ] SDK listeners cleaned up in `dispose()`