@cometchat/skills 4.3.0 → 4.4.1

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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/bin/install.js +27 -0
  3. package/package.json +14 -1
  4. package/skills/cometchat/SKILL.md +233 -69
  5. package/skills/cometchat/references/asking-questions.md +48 -0
  6. package/skills/cometchat-a11y/SKILL.md +3 -2
  7. package/skills/cometchat-android-v5/SKILL.md +2 -1
  8. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  9. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  10. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  11. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  16. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  17. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  18. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  19. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  20. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  21. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  22. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  23. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  24. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  25. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  26. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  27. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  28. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  29. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  30. package/skills/cometchat-android-v5-core/SKILL.md +5 -3
  31. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  32. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  33. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  34. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  35. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  37. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  38. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  40. package/skills/cometchat-android-v6/SKILL.md +2 -1
  41. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  42. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  43. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  44. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  45. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  46. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  47. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  48. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  49. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  50. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  51. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  52. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  53. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  54. package/skills/cometchat-android-v6-core/SKILL.md +208 -28
  55. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  56. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  57. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  58. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  59. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  60. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  61. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  62. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  63. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  64. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  65. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  66. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  67. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  68. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  69. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  70. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  71. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  72. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  73. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  74. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  75. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  76. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  77. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  78. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  79. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  80. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  81. package/skills/cometchat-angular-components/SKILL.md +149 -620
  82. package/skills/cometchat-angular-core/SKILL.md +232 -312
  83. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  84. package/skills/cometchat-angular-features/SKILL.md +216 -334
  85. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  86. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  87. package/skills/cometchat-angular-production/SKILL.md +241 -92
  88. package/skills/cometchat-angular-push/SKILL.md +280 -294
  89. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  90. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  91. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  92. package/skills/cometchat-astro-patterns/SKILL.md +3 -2
  93. package/skills/cometchat-calls/SKILL.md +25 -19
  94. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  95. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  96. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  97. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  98. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  99. package/skills/cometchat-components/SKILL.md +163 -25
  100. package/skills/cometchat-core/SKILL.md +258 -20
  101. package/skills/cometchat-customization/SKILL.md +50 -25
  102. package/skills/cometchat-features/SKILL.md +314 -35
  103. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  104. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  105. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  106. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  107. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  108. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  109. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  110. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  111. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  112. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  113. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  114. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  115. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  116. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  117. package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
  118. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  119. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  120. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  122. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  123. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  124. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  125. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  126. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  127. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  128. package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
  129. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
  130. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  131. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  132. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  133. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  134. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  135. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  136. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  137. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  138. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  139. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  140. package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
  141. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  142. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  143. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  144. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  145. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  146. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  147. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  148. package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
  149. package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
  150. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  151. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  152. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  153. package/skills/cometchat-i18n/SKILL.md +140 -79
  154. package/skills/cometchat-ios/SKILL.md +4 -2
  155. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  156. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  157. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  158. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  159. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  160. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  161. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  162. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  163. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  164. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  165. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  166. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  167. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  168. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  169. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  170. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  171. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  172. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  173. package/skills/cometchat-ios-components/SKILL.md +200 -12
  174. package/skills/cometchat-ios-core/SKILL.md +173 -45
  175. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  176. package/skills/cometchat-ios-features/SKILL.md +64 -36
  177. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  178. package/skills/cometchat-ios-production/SKILL.md +12 -4
  179. package/skills/cometchat-ios-push/SKILL.md +53 -19
  180. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  181. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  182. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  183. package/skills/cometchat-native-bare-patterns/SKILL.md +36 -19
  184. package/skills/cometchat-native-calls/SKILL.md +29 -17
  185. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  186. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  187. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  188. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  189. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  190. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  191. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  192. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  193. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  194. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  195. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  196. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  197. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  198. package/skills/cometchat-native-components/SKILL.md +84 -52
  199. package/skills/cometchat-native-core/SKILL.md +102 -33
  200. package/skills/cometchat-native-customization/SKILL.md +150 -28
  201. package/skills/cometchat-native-expo-patterns/SKILL.md +60 -29
  202. package/skills/cometchat-native-features/SKILL.md +24 -17
  203. package/skills/cometchat-native-placement/SKILL.md +19 -10
  204. package/skills/cometchat-native-production/SKILL.md +9 -3
  205. package/skills/cometchat-native-push/SKILL.md +2 -1
  206. package/skills/cometchat-native-testing/SKILL.md +1 -2
  207. package/skills/cometchat-native-theming/SKILL.md +54 -29
  208. package/skills/cometchat-native-troubleshooting/SKILL.md +11 -5
  209. package/skills/cometchat-nextjs-patterns/SKILL.md +22 -8
  210. package/skills/cometchat-placement/SKILL.md +42 -3
  211. package/skills/cometchat-production/SKILL.md +12 -5
  212. package/skills/cometchat-react-calls/SKILL.md +220 -10
  213. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  214. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  215. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  216. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  217. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  218. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  219. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  220. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  221. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  222. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  223. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  224. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  225. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  226. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  227. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  228. package/skills/cometchat-react-patterns/SKILL.md +45 -5
  229. package/skills/cometchat-react-push/SKILL.md +258 -72
  230. package/skills/cometchat-react-router-patterns/SKILL.md +12 -6
  231. package/skills/cometchat-react-testing/SKILL.md +14 -5
  232. package/skills/cometchat-theming/SKILL.md +181 -18
  233. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -1,8 +1,10 @@
1
1
  # Adding calls to an existing chat integration (Flutter V5)
2
2
 
3
- You have `cometchat_chat_uikit` v5 working. Adding calls = `cometchat_calls_uikit: ^5.0.15` plus iOS/Android native config.
3
+ You have `cometchat_chat_uikit` v5 working. Adding calls = the **raw 5.x calls SDK** (`cometchat_calls_sdk: ^5.0.2`, direct dependency) plus iOS/Android native config and a custom call surface.
4
4
 
5
- **Read first:** `cometchat-flutter-v5-calls/SKILL.md` — Flutter calls architecture (GetX patterns).
5
+ > **Do NOT add `cometchat_calls_uikit`.** Its latest (5.0.16) pins `cometchat_calls_sdk ^4.2.2` and its prebuilt call widgets are 4.x-bound incompatible with the 5.x calls SDK. Use the raw SDK + custom UI.
6
+
7
+ **Read first:** `cometchat-flutter-v5-calls/SKILL.md` — Flutter calls architecture (GetX patterns) + `references/call-session.md` for the canonical 5.x surface.
6
8
 
7
9
  ---
8
10
 
@@ -11,8 +13,8 @@ You have `cometchat_chat_uikit` v5 working. Adding calls = `cometchat_calls_uiki
11
13
  ```yaml
12
14
  # pubspec.yaml
13
15
  dependencies:
14
- cometchat_chat_uikit: ^5.x.x # existing
15
- cometchat_calls_uikit: ^5.0.15 # NEW
16
+ cometchat_chat_uikit: ^5.x.x # existing (GetX chat kit — keep)
17
+ cometchat_calls_sdk: ^5.0.2 # NEW — raw 5.x calls SDK (direct)
16
18
  flutter_callkit_incoming: ^2.0.4 # for OS-level incoming-call UI
17
19
  flutter_voip_pushkit: ^0.2.1 # iOS PushKit
18
20
  firebase_messaging: ^15.0.0 # Android FCM
@@ -44,7 +46,7 @@ In your existing init (typically `main.dart`):
44
46
 
45
47
  ```dart
46
48
  import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
47
- import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
49
+ import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
48
50
 
49
51
  Future<void> main() async {
50
52
  WidgetsFlutterBinding.ensureInitialized();
@@ -55,9 +57,19 @@ Future<void> main() async {
55
57
  ..setRegion(REGION);
56
58
  await CometChatUIKit.init(uiKitSettings: chatSettings.build());
57
59
 
58
- // NEW: Calls init AFTER chat init
59
- final callsSettings = CallAppSettings(appId: APP_ID, region: REGION);
60
- await CometChatCalls.init(callsSettings);
60
+ // NEW: 5.x Calls SDK init AFTER chat init.
61
+ // init is callback-based (NOT awaitable) and takes a CallAppSettings built
62
+ // via CallAppSettingBuilder — no authKey field (call_app_settings_request.dart).
63
+ // Verified cometchatcalls.dart:172.
64
+ final callsSettings = (CallAppSettingBuilder()
65
+ ..appId = APP_ID
66
+ ..region = REGION)
67
+ .build();
68
+ CometChatCalls.init(
69
+ callsSettings,
70
+ onSuccess: (String success) {/* Calls SDK ready */},
71
+ onError: (CometChatCallsException e) {/* surface */},
72
+ );
61
73
 
62
74
  runApp(const MyApp());
63
75
  }
@@ -65,30 +77,39 @@ Future<void> main() async {
65
77
 
66
78
  ---
67
79
 
68
- ## Step 4 — Login both SDKs
80
+ ## Step 4 — Login BOTH SDKs (5.x Calls SDK has its own login)
69
81
 
70
- After `CometChatUIKit.login`:
82
+ Unlike 4.x, the 5.x Calls SDK logs in explicitly and caches the auth token (`cometchatcalls.dart:316`). Log the chat user in, then log the Calls SDK in with the same token:
71
83
 
72
84
  ```dart
73
85
  final user = await CometChatUIKit.login(uid: uid, authKey: AUTH_KEY);
74
- final authToken = user.authToken;
75
- await CometChatCalls.login(authToken: authToken);
86
+ final authToken = await CometChat.getUserAuthToken(); // static; no User.getAuthToken() method
87
+ if (authToken != null) {
88
+ CometChatCalls.loginWithAuthToken(
89
+ authToken: authToken,
90
+ onSuccess: (cu) {/* Calls SDK ready */},
91
+ onError: (CometChatCallsException e) {/* surface */},
92
+ );
93
+ }
76
94
  ```
77
95
 
78
96
  ---
79
97
 
80
- ## Step 5 — Mount IncomingCall at app root
98
+ ## Step 5 — Mount a custom incoming-call overlay at app root
99
+
100
+ There is no prebuilt `CometChatIncomingCall` on the raw 5.x SDK (that widget is 4.x-kit-only). Listen for incoming calls via the Chat SDK `CallListener` (app shell, SKILL.md rule 1.7) and show your own overlay; on accept, `CometChat.acceptCall(sessionId)` → `CometChatCalls.joinSession(...)`.
81
101
 
82
102
  ```dart
83
103
  class MyApp extends StatelessWidget {
104
+ const MyApp({super.key});
84
105
  @override
85
106
  Widget build(BuildContext context) {
86
107
  return MaterialApp(
87
- home: Stack(
108
+ navigatorKey: navigatorKey, // GlobalKey<NavigatorState> — rule 1.7
109
+ home: const Stack(
88
110
  children: [
89
- const AppRoot(),
90
- // Sibling overlay
91
- const CometChatIncomingCall(),
111
+ AppRoot(), // hosts the Chat SDK CallListener
112
+ MyIncomingCallOverlay(), // your custom ring UI
92
113
  ],
93
114
  ),
94
115
  );
@@ -128,7 +149,7 @@ class CallPushService {
128
149
  }
129
150
  ```
130
151
 
131
- Trigger after `CometChatCalls.login` completes.
152
+ Trigger after `CometChatUIKit.login` completes (there is no separate Calls login).
132
153
 
133
154
  ---
134
155
 
@@ -136,7 +157,10 @@ Trigger after `CometChatCalls.login` completes.
136
157
 
137
158
  ```dart
138
159
  Future<void> endCall(String sessionId) async {
139
- CometChatCalls.leaveSession();
160
+ // 5.x: teardown is the CallSession INSTANCE leaveSession() (call_session.dart:272).
161
+ // The static CometChatCalls.endSession exists (cometchatcalls.dart:676) but is
162
+ // @Deprecated and just delegates to leaveSession().
163
+ await CallSession.getInstance()?.leaveSession();
140
164
  await CometChat.endCall(sessionId);
141
165
  // OS-level UI dismiss via flutter_callkit_incoming
142
166
  await FlutterCallkitIncoming.endCall(sessionId);
@@ -147,14 +171,14 @@ Future<void> endCall(String sessionId) async {
147
171
 
148
172
  ## Verification checklist
149
173
 
150
- - [ ] `cometchat_calls_uikit: ^5.0.15` + native plugins in pubspec
174
+ - [ ] `cometchat_calls_sdk: ^5.0.2` (direct) + native plugins in pubspec; NO `cometchat_calls_uikit`
151
175
  - [ ] iOS Background Modes + Info.plist usage descriptions
152
176
  - [ ] Android permissions + ConnectionService declared
153
- - [ ] Calls init AFTER chat init in main()
154
- - [ ] Calls login AFTER chat login
155
- - [ ] `CometChatIncomingCall` sibling-overlay at root
177
+ - [ ] Calls init AFTER chat init in main() (callback-based `CometChatCalls.init`, NOT awaited)
178
+ - [ ] `CometChatCalls.loginWithAuthToken(...)` after chat login (5.x has its own login)
179
+ - [ ] Custom incoming-call overlay driven by the Chat SDK `CallListener` (no `CometChatIncomingCall`)
156
180
  - [ ] VoIP token registration triggered post-login
157
- - [ ] Hangup teardown calls leaveSession + endCall + endCall (callkit)
181
+ - [ ] Hangup teardown calls `CallSession.getInstance()?.leaveSession()` + `CometChat.endCall` + endCall (callkit)
158
182
  - [ ] Real-device smoke: backgrounded incoming call rings on lock screen
159
183
  - [ ] Run `cometchat verify --calls` — should pass
160
184
 
@@ -9,19 +9,24 @@ Same three layouts (TILE/SIDEBAR/SPOTLIGHT). Flutter-specific: `SegmentedButton`
9
9
 
10
10
  ## SDK API
11
11
 
12
+ `setLayout` is an **instance method on the `CallSession` singleton** (`cometchat_calls_sdk-5.0.2` `src/call_session.dart:394`), and the layout enum is `LayoutType { tile, sidebar, spotlight }` (`src/enums/layout_type.dart`) — there is no `CallLayout` type and no static `CometChatCalls.setLayout`.
13
+
12
14
  ```dart
13
- import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
15
+ import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
14
16
 
15
- final settings = CallSettingsBuilder()
16
- ..setLayout(CallLayout.tile) // CallLayout.tile | .sidebar | .spotlight
17
- ..setHideChangeLayoutButton(false);
17
+ // Initial layout via the (non-deprecated) SessionSettingsBuilder
18
+ final settings = (SessionSettingsBuilder()
19
+ ..setLayout(LayoutType.tile) // session_settings.dart:179
20
+ ..hideChangeLayoutButton(false)) // :293
21
+ .build();
18
22
 
19
- // Mid-call switch
20
- CometChatCalls.setLayout(CallLayout.spotlight);
23
+ // Mid-call switch — instance method on the session singleton
24
+ CallSession.getInstance()?.setLayout(LayoutType.spotlight); // call_session.dart:394
21
25
 
22
- // Listen — implement in your CometChatCallsEventsListener
26
+ // Listen — implement LayoutListeners, attach via the layoutListener setter
27
+ // (CallSession.getInstance()?.layoutListener = myLayoutListener; call_session.dart:98).
23
28
  @override
24
- void onCallLayoutChanged(CallLayout layout) {
29
+ void onCallLayoutChanged(LayoutType layout) { // layout_listeners.dart:9
25
30
  Get.find<CallLayoutController>().layout.value = layout;
26
31
  }
27
32
  ```
@@ -32,10 +37,10 @@ void onCallLayoutChanged(CallLayout layout) {
32
37
 
33
38
  ```dart
34
39
  class CallLayoutController extends GetxController {
35
- final layout = CallLayout.tile.obs;
40
+ final layout = LayoutType.tile.obs;
36
41
 
37
- void set(CallLayout next) {
38
- CometChatCalls.setLayout(next);
42
+ void set(LayoutType next) {
43
+ CallSession.getInstance()?.setLayout(next);
39
44
  layout.value = next;
40
45
  }
41
46
  }
@@ -52,11 +57,11 @@ class LayoutSwitcher extends StatelessWidget {
52
57
  @override
53
58
  Widget build(BuildContext context) {
54
59
  final ctrl = Get.find<CallLayoutController>();
55
- return Obx(() => SegmentedButton<CallLayout>(
60
+ return Obx(() => SegmentedButton<LayoutType>(
56
61
  segments: const [
57
- ButtonSegment(value: CallLayout.tile, label: Text('Tile')),
58
- ButtonSegment(value: CallLayout.sidebar, label: Text('Sidebar')),
59
- ButtonSegment(value: CallLayout.spotlight, label: Text('Spotlight')),
62
+ ButtonSegment(value: LayoutType.tile, label: Text('Tile')),
63
+ ButtonSegment(value: LayoutType.sidebar, label: Text('Sidebar')),
64
+ ButtonSegment(value: LayoutType.spotlight, label: Text('Spotlight')),
60
65
  ],
61
66
  selected: {ctrl.layout.value},
62
67
  onSelectionChanged: (set) {
@@ -1,45 +1,21 @@
1
- # Call session — joinSession with no ringing (Flutter V5 / GetX)
1
+ # Call session — joinSession, no ringing (Flutter V5 / GetX, 5.x Calls SDK)
2
2
 
3
- Server-generated sessionId, both parties enter it. Customer-validated against `~/Downloads/calls-sdk/calls-sdk-flutter-5/sample-apps/cometchat-calls-sample-app-flutter/lib/screens/call_screen.dart`.
3
+ Server-generated sessionId, both parties enter it. Built on the **5.x** Calls SDK (`cometchat_calls_sdk ^5.0.2`) added as a **direct** dependency (NOT pulled via `cometchat_calls_uikit`, which would bring 4.x). This is the canonical SDK API surface for all the V5 calls references.
4
4
 
5
5
  **Read first:** `cometchat-react-calls/references/call-session.md` — full architecture (sessionId strategies, server-side authorization, token generation). Then come back here for the Flutter-specific shape.
6
6
 
7
+ > **5.x SHAPE.** Lifecycle is **static on `CometChatCalls`** (`init`/`login`/`loginWithAuthToken`/`generateCallToken`/`joinSession`/`getLoggedInUser` — `src/plugin/cometchatcalls.dart`). In-call controls are **instance methods on the `CallSession` singleton** via `CallSession.getInstance()` (`src/call_session.dart`). Settings use `SessionSettingsBuilder` (`src/builder/session_settings.dart`). Events arrive through the **5 split listeners** in `src/listener/`. Substrate of record: `~/.pub-cache/hosted/pub.dev/cometchat_calls_sdk-5.0.2/lib/`.
8
+
7
9
  ---
8
10
 
9
11
  ## Hard rules (Flutter-specific overrides on top of the cross-platform rules)
10
12
 
11
- 1. **`CometChatCalls.joinSession(sessionId:, sessionSettings:, onSuccess:, onError:)` uses CALLBACKS, not Futures.** `onSuccess` receives a `Widget?` you must render. There is NO controller-based API in the Calls SDK; do not invent one.
12
- 2. **`SessionSettingsBuilder` is the canonical settings shape.** `SessionSettingsBuilder().setTitle().startVideoPaused(false).startAudioMuted(false).build()`. NOT `CallSettings(sessionType:, layout:)` — that is a chat-side type. The sample uses the Builder pattern.
13
- 3. **Implement `SessionStatusListeners`** for lifecycle events: `onSessionJoined`, `onSessionLeft`, `onConnectionClosed`, `onConnectionLost`, `onConnectionRestored`, `onSessionTimedOut`. Register via `CallSession.getInstance().addSessionStatusListener(this)` AFTER `onSuccess` fires.
14
- 3a. **Funnel ALL termination paths through a single guarded `_navigateBack()` helper.** The v5 Calls SDK fires 3 termination listeners in sequence on every hangup: `onLeaveSessionButtonClicked` `onSessionLeft` → `onConnectionClosed`. If each one pops the navigator independently, the second pop crashes with `Bad state: No element` because the route is already gone. The upstream sample at `~/Downloads/calls-sdk/calls-sdk-flutter-5/sample-apps/cometchat-calls-sample-app-flutter/lib/screens/call_screen.dart` has the unguarded multi-pop pattern it happens to work there because of timing differences but is fragile. **Always use a single guarded helper**:
15
- ```dart
16
- bool _isLeavingSession = false;
17
-
18
- void _navigateBack() {
19
- if (_isLeavingSession) return;
20
- if (!mounted) return;
21
- if (!Navigator.of(context).canPop()) return;
22
- _isLeavingSession = true;
23
- CometChatOngoingCallService.abort();
24
- Navigator.of(context).pop();
25
- }
26
-
27
- @override
28
- void onSessionLeft() => _navigateBack();
29
- @override
30
- void onConnectionClosed() => _navigateBack();
31
- @override
32
- void onSessionTimedOut() => _navigateBack();
33
-
34
- @override
35
- void onLeaveSessionButtonClicked() {
36
- // Trigger the leave; the listener chain calls _navigateBack().
37
- _callSession?.leaveSession();
38
- }
39
- ```
40
- 4. **`CometChatOngoingCallService.launch()` + `CometChatOngoingCallService.abort()`** manage the platform foreground service. Call `launch()` after `onSessionJoined`; call `abort()` inside the `_navigateBack()` helper (so it fires exactly once on the first termination event).
41
- 5. **Render the returned widget with `SizedBox.expand(child: videoWidget)`.** Anything that constrains the widget (Padding, Container with explicit width/height smaller than viewport) clips the call UI.
42
- 6. **For standalone session-only integrations, the Chat SDK is OPTIONAL.** The upstream Flutter sample only uses `cometchat_calls_sdk`. Keep dual-SDK only for additive (chat + calls) integrations.
13
+ 1. **One step: `joinSession({sessionId:, sessionSettings:, onSuccess:, onError:})`** (`cometchatcalls.dart:735`). Provide EITHER `sessionId:` (the SDK mints the call token internally using the cached auth token) OR a pre-minted `callToken:` — not both. `onSuccess` hands back a `Widget?` you render. There is no `generateToken` + `startSession` two-step in the primary 5.x path (those are `@Deprecated` v4-compat shims, `cometchatcalls.dart:449,621`).
14
+ 2. **`SessionSettingsBuilder` is the settings shape** (`builder/session_settings.dart:126`). e.g. `(SessionSettingsBuilder()..setTitle('Meeting')..startAudioMuted(false)..startVideoPaused(false)).build()`. `CallSettingsBuilder` is `@Deprecated` (`builder/call_settings.dart:209`).
15
+ 3. **Implement the split listeners and register them on `CallSession.getInstance()`** inside `joinSession`'s `onSuccess` (the singleton is non-null only after the session is created). `SessionStatusListeners` (`addSessionStatusListener`, `call_session.dart:66`) carries `onSessionJoined`/`onSessionLeft`/`onConnectionClosed`/`onSessionTimedOut`/`onConnectionLost`/`onConnectionRestored`. Remove via `removeSessionStatusListener` in `dispose`. Do NOT use the single `CometChatCallsEventsListener` (`@Deprecated`).
16
+ 4. **`CometChatOngoingCallService.launch()` + `.abort()`** (`services/ongoing_call_service.dart:33,51`) manage the platform foreground service. `launch()` after the session starts; `abort()` inside the guarded `_navigateBack()` helper (fires exactly once on the first termination event).
17
+ 5. **Render the returned widget with `SizedBox.expand(child: videoWidget)`.** Anything that constrains it (Padding, undersized Container) clips the call UI.
18
+ 6. **Log the Calls SDK in before joining.** `joinSession`/`generateCallToken` use the cached auth token from `CometChatCalls.loginWithAuthToken(...)` (or `CometChatCalls.login(...)`). Source that token with the static `await CometChat.getUserAuthToken()` (there is no `User.getAuthToken()` instance method).
43
19
 
44
20
  ---
45
21
 
@@ -47,19 +23,19 @@ void onLeaveSessionButtonClicked() {
47
23
 
48
24
  ```yaml
49
25
  dependencies:
50
- cometchat_calls_sdk: ^5.0.0
26
+ cometchat_calls_sdk: ^5.0.2
27
+ cometchat_chat_sdk: ^4.0.0 # signaling + source of the auth token
51
28
  permission_handler: ^11.0.0
52
29
  uni_links: ^0.5.1
53
30
  ```
54
31
 
55
- For standalone session-only, you do NOT need `cometchat_chat_sdk`.
56
-
57
32
  ---
58
33
 
59
34
  ## Call screen (StatefulWidget + SessionStatusListeners)
60
35
 
61
36
  ```dart
62
37
  import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
38
+ import 'package:cometchat_sdk/cometchat_sdk.dart';
63
39
  import 'package:flutter/material.dart';
64
40
 
65
41
  class CallScreen extends StatefulWidget {
@@ -71,74 +47,81 @@ class CallScreen extends StatefulWidget {
71
47
  }
72
48
 
73
49
  class _CallScreenState extends State<CallScreen>
74
- implements SessionStatusListeners, ButtonClickListeners {
50
+ implements SessionStatusListeners {
75
51
  Widget? _videoContainer;
76
52
  bool _isLoading = true;
77
53
  bool _hasError = false;
78
54
  String? _errorMessage;
79
55
  bool _isLeavingSession = false;
80
- CallSession? _callSession;
56
+ CallSession? _session;
81
57
 
82
58
  @override
83
59
  void initState() {
84
60
  super.initState();
85
- _joinSession();
61
+ _startCall();
86
62
  }
87
63
 
88
64
  @override
89
65
  void dispose() {
90
- _unregisterListeners();
66
+ _session?.removeSessionStatusListener(this);
91
67
  CometChatOngoingCallService.abort();
92
68
  super.dispose();
93
69
  }
94
70
 
95
- void _joinSession() {
96
- final sessionSettings = (SessionSettingsBuilder()
97
- .setTitle('CometChat Meeting')
98
- .startVideoPaused(false)
99
- .startAudioMuted(false))
71
+ Future<void> _startCall() async {
72
+ // Ensure the Calls SDK is logged in (caches the auth token used below).
73
+ final authToken = await CometChat.getUserAuthToken();
74
+ if (authToken != null) {
75
+ CometChatCalls.loginWithAuthToken( // cometchatcalls.dart:316
76
+ authToken: authToken,
77
+ onSuccess: (_) => _join(),
78
+ onError: (CometChatCallsException e) => _fail(e.message),
79
+ );
80
+ } else {
81
+ _join(); // already logged in via CometChatCalls.login earlier
82
+ }
83
+ }
84
+
85
+ void _join() {
86
+ final settings = (SessionSettingsBuilder()
87
+ ..setTitle('CometChat Meeting') // session_settings.dart:155
88
+ ..startAudioMuted(false) // :173
89
+ ..startVideoPaused(false)) // :167
100
90
  .build();
101
91
 
102
- CometChatCalls.joinSession(
103
- sessionId: widget.sessionId,
104
- sessionSettings: sessionSettings,
92
+ CometChatCalls.joinSession( // cometchatcalls.dart:735
93
+ sessionId: widget.sessionId, // SDK mints the call token internally
94
+ sessionSettings: settings,
105
95
  onSuccess: (Widget? videoWidget) {
106
96
  if (!mounted) return;
97
+ // Register split listeners now that the session exists.
98
+ _session = CallSession.getInstance(); // call_session.dart:36
99
+ _session?.addSessionStatusListener(this); // :66
100
+ CometChatOngoingCallService.launch(); // ongoing_call_service.dart:33
107
101
  setState(() {
108
102
  _videoContainer = videoWidget;
109
103
  _isLoading = false;
110
104
  _hasError = false;
111
105
  });
112
- _registerListeners();
113
- CometChatOngoingCallService.launch();
114
- },
115
- onError: (CometChatCallsException error) {
116
- if (!mounted) return;
117
- setState(() {
118
- _isLoading = false;
119
- _hasError = true;
120
- _errorMessage = error.message ?? 'Failed to join session';
121
- });
122
106
  },
107
+ onError: (CometChatCallsException error) => _fail(error.message),
123
108
  );
124
109
  }
125
110
 
126
- void _registerListeners() {
127
- _callSession = CallSession.getInstance();
128
- _callSession?.addSessionStatusListener(this);
129
- _callSession?.addButtonClickListener(this);
130
- }
131
-
132
- void _unregisterListeners() {
133
- _callSession?.removeSessionStatusListener(this);
134
- _callSession?.removeButtonClickListener(this);
111
+ void _fail(String? msg) {
112
+ if (!mounted) return;
113
+ setState(() {
114
+ _isLoading = false;
115
+ _hasError = true;
116
+ _errorMessage = msg ?? 'Failed to join session';
117
+ });
135
118
  }
136
119
 
137
120
  void _navigateBack() {
138
121
  // ONE guarded path for all termination events (onSessionLeft +
139
- // onConnectionClosed + onSessionTimedOut + post-leaveSession).
140
- // The SDK fires multiple termination listeners in sequence; without
141
- // this guard, the second pop crashes with `Bad state: No element`.
122
+ // onConnectionClosed + onSessionTimedOut). The 5.x SDK fires several in
123
+ // sequence on hangup; without the guard a second pop crashes with
124
+ // `Bad state: No element`.
142
125
  if (_isLeavingSession) return;
143
126
  if (!mounted) return;
144
127
  if (!Navigator.of(context).canPop()) return;
@@ -147,16 +130,11 @@ class _CallScreenState extends State<CallScreen>
147
130
  Navigator.of(context).pop();
148
131
  }
149
132
 
150
- // --- SessionStatusListeners ---
133
+ // --- SessionStatusListeners (session_status_listeners.dart) ---
151
134
 
152
135
  @override
153
- void onSessionJoined() {
154
- CometChatOngoingCallService.launch();
155
- }
136
+ void onSessionJoined() {}
156
137
 
157
- // All termination events funnel through ONE guarded _navigateBack().
158
- // SDK fires onSessionLeft + onConnectionClosed in sequence on every
159
- // hangup; unguarded pops crash with `Bad state: No element`.
160
138
  @override
161
139
  void onSessionLeft() => _navigateBack();
162
140
 
@@ -167,54 +145,16 @@ class _CallScreenState extends State<CallScreen>
167
145
  void onSessionTimedOut() => _navigateBack();
168
146
 
169
147
  @override
170
- void onConnectionLost() {
171
- if (mounted) {
172
- ScaffoldMessenger.of(context).showSnackBar(
173
- const SnackBar(content: Text('Connection lost')),
174
- );
175
- }
176
- }
177
-
178
- @override
179
- void onConnectionRestored() {
180
- if (mounted) {
181
- ScaffoldMessenger.of(context).showSnackBar(
182
- const SnackBar(content: Text('Connection restored')),
183
- );
184
- }
185
- }
186
-
187
- // --- ButtonClickListeners (stub the ones you don't customize) ---
148
+ void onConnectionLost() {}
188
149
 
189
150
  @override
190
- void onLeaveSessionButtonClicked() {
191
- // Trigger leave; the listener chain calls _navigateBack().
192
- _callSession?.leaveSession();
193
- }
194
-
195
- @override
196
- void onChangeLayoutButtonClicked() {}
197
- @override
198
- void onChatButtonClicked() {}
199
- @override
200
- void onParticipantListButtonClicked() {}
201
- @override
202
- void onRaiseHandButtonClicked() {}
203
- @override
204
- void onRecordingToggleButtonClicked() {}
205
- @override
206
- void onShareInviteButtonClicked() {}
207
- @override
208
- void onSwitchCameraButtonClicked() {}
209
- @override
210
- void onToggleAudioButtonClicked() {}
211
- @override
212
- void onToggleVideoButtonClicked() {}
151
+ void onConnectionRestored() {}
213
152
 
214
153
  @override
215
154
  Widget build(BuildContext context) {
216
155
  return Scaffold(
217
156
  backgroundColor: Colors.black,
157
+ resizeToAvoidBottomInset: false,
218
158
  body: _buildBody(),
219
159
  );
220
160
  }
@@ -236,11 +176,26 @@ class _CallScreenState extends State<CallScreen>
236
176
 
237
177
  **Why this shape:**
238
178
 
239
- - **Callback API** (`onSuccess`, `onError`) instead of `Future` `joinSession` returns void; the widget arrives via `onSuccess`. Awaiting it does nothing useful.
240
- - **`SessionSettingsBuilder`** instead of `CallSettings` — `CallSettings` is the chat-side type for ringing-mode call entities; `SessionSettingsBuilder` is what session-mode actually accepts.
241
- - **`SessionStatusListeners` interface implementation** instead of stream subscriptions register against `CallSession.getInstance()` after `onSuccess`. Returns nothing; cleanup via `removeSessionStatusListener` in `dispose`.
242
- - **`CometChatOngoingCallService.launch()/abort()`** required for foreground-service correctness on Android 14+. Without `abort()` the service notification persists after the call ends.
243
- - **`SizedBox.expand`** — the SDK's returned widget must fill its parent. Constraining it (Container with width/height, Padding) clips the call surface.
179
+ - **Single-step `joinSession`** instead of `generateToken` + `startSession` the 5.x primary path joins in one call; the call widget arrives via `joinSession`'s `onSuccess`.
180
+ - **`SessionSettingsBuilder`** instead of `CallSettingsBuilder` — the latter is `@Deprecated` in 5.0.2.
181
+ - **`SessionStatusListeners` registered on `CallSession.getInstance()`** instead of one `CometChatCallsEventsListener` on `CometChatCalls` 5.x splits events across 5 listeners attached to the session singleton.
182
+ - **`CallSession.getInstance()?.leaveSession()`** for teardown (`call_session.dart:272`) the static `CometChatCalls.endSession` exists (`cometchatcalls.dart:676`) but is `@Deprecated` and just delegates here.
183
+ - **`CometChatOngoingCallService.launch()/abort()`** — required for foreground-service correctness on Android 14+.
184
+ - **`SizedBox.expand`** — the SDK's returned widget must fill its parent.
185
+
186
+ ---
187
+
188
+ ## Ending the call from a button
189
+
190
+ ```dart
191
+ ElevatedButton(
192
+ onPressed: () async {
193
+ await CallSession.getInstance()?.leaveSession(); // call_session.dart:272
194
+ // onSessionLeft then funnels through _navigateBack().
195
+ },
196
+ child: const Text('Leave'),
197
+ )
198
+ ```
244
199
 
245
200
  ---
246
201
 
@@ -263,7 +218,7 @@ iOS:
263
218
  <string>Microphone is needed for calls</string>
264
219
  ```
265
220
 
266
- Runtime request before `_joinSession`:
221
+ Runtime request before `_startCall`:
267
222
  ```dart
268
223
  await Permission.camera.request();
269
224
  await Permission.microphone.request();
@@ -291,32 +246,30 @@ See `cometchat-flutter-v5-calls/references/share-invite.md` for full deep-link c
291
246
 
292
247
  ## Anti-patterns
293
248
 
294
- 1. **Using `CallSettings(sessionType:, layout:)` instead of `SessionSettingsBuilder()`.** `CallSettings` is the chat-side entity type, not the session-mode settings shape. Wrong type → joinSession rejects.
295
- 2. **`CometChatOngoingCallController` / `CometChatOngoingCallView`.** These do not exist in the Calls SDK. Prior versions of this skill cited them — they are NOT part of the public Flutter Calls SDK API.
296
- 3. **Awaiting `CometChatCalls.joinSession(...)`** as if it returns a `Future<Widget>`. It returns void; widget arrives via `onSuccess`.
297
- 4. **Skipping `CometChatOngoingCallService.abort()` in cleanup paths.** Android foreground-service notification persists after the call ends; user sees "Ongoing call" with no way to clear it.
298
- 5. **Rendering the returned widget inside a constrained `Container`.** Clips to that size. Use `SizedBox.expand`.
299
- 6. **No `mounted` check before `Navigator.pop`.** Async callback fires after dispose exception.
300
- 7. **`StatelessWidget` for the call screen.** Can't track `_isLeavingSession` flag or listener references → double leave / leaked listeners.
301
- 8. **Popping the navigator from each termination listener independently.** Crashes with `Bad state: No element` on the second pop because the route is already gone. The SDK fires 3 termination events in sequence (`onLeaveSessionButtonClicked` `onSessionLeft` → `onConnectionClosed`). Funnel them through ONE guarded `_navigateBack()` helper that checks `_isLeavingSession` + `mounted` + `canPop()`. Customer-found 2026-05-17 (Flutter v5 cohort hangup crash).
302
- 8. **Initializing Chat SDK for a session-only integration.** Wastes time and adds two extra failure modes. Drop `CometChat.init` / `CometChat.login` entirely for standalone session apps.
249
+ 1. **Using `CallSettingsBuilder()` / `CallSettings(...)` instead of `SessionSettingsBuilder()`.** `CallSettingsBuilder` is `@Deprecated` in 5.0.2.
250
+ 2. **`CometChatCalls.startSession` / `generateToken` two-step.** Those are `@Deprecated` v4-compat shims. Use `joinSession` with `sessionId:` (or `callToken:`).
251
+ 3. **Single `CometChatCallsEventsListener`.** `@Deprecated` in 5.0.2. Use the 5 split listeners on `CallSession.getInstance()`.
252
+ 4. **Registering listeners before `joinSession.onSuccess`.** `CallSession.getInstance()` is null until the session is created register inside `onSuccess`.
253
+ 5. **`CometChatOngoingCallController` / `CometChatOngoingCallView`.** These do not exist in the Calls SDK. Render the `Widget?` from `onSuccess`.
254
+ 6. **Skipping `CometChatOngoingCallService.abort()` in cleanup paths.** Android foreground-service notification persists after the call ends.
255
+ 7. **Rendering the returned widget inside a constrained `Container`.** Clips. Use `SizedBox.expand`.
256
+ 8. **No `mounted` check before `Navigator.pop`.** Async callback fires after disposeexception.
257
+ 9. **Popping the navigator from each termination event independently.** Crashes with `Bad state: No element` on the second pop. Funnel all termination events through ONE guarded `_navigateBack()`.
303
258
 
304
259
  ---
305
260
 
306
261
  ## Verification checklist
307
262
 
308
- - [ ] `joinSession` called with `sessionId:`, `sessionSettings:`, `onSuccess:`, `onError:` — NOT `callToken:`, `callSettings:`, `controller:`
309
- - [ ] Settings built via `SessionSettingsBuilder()`, not `CallSettings`
310
- - [ ] `SessionStatusListeners` interface implemented and registered against `CallSession.getInstance()` in `onSuccess`
263
+ - [ ] `joinSession(sessionId:, sessionSettings:, onSuccess:, onError:)` — NOT `generateToken`/`startSession`
264
+ - [ ] Settings built via `SessionSettingsBuilder()`, not `CallSettingsBuilder` / `CallSettings(...)`
265
+ - [ ] `SessionStatusListeners` implemented and registered on `CallSession.getInstance()` inside `onSuccess`; removed in `dispose`
266
+ - [ ] Calls SDK logged in (`loginWithAuthToken` / `login`) before `joinSession`
311
267
  - [ ] Returned widget rendered via `SizedBox.expand(child: _videoContainer)`
312
- - [ ] `CometChatOngoingCallService.launch()` called after `onSessionJoined`
313
- - [ ] `CometChatOngoingCallService.abort()` called in EVERY termination path (dispose, onSessionLeft, onConnectionClosed, onSessionTimedOut, error)
314
- - [ ] Listeners removed in `dispose` (avoid leaks)
268
+ - [ ] `CometChatOngoingCallService.launch()` after `onSuccess`; `.abort()` in EVERY termination path
315
269
  - [ ] `mounted` check before `Navigator.pop`
316
- - [ ] Single guarded `_navigateBack()` helper handles ALL termination events (no per-listener pops)
270
+ - [ ] Single guarded `_navigateBack()` handles ALL termination events
271
+ - [ ] Teardown uses `CallSession.getInstance()?.leaveSession()`
317
272
  - [ ] iOS `Info.plist` + Android `AndroidManifest.xml` permissions configured
318
- - [ ] **Standalone session-only:** no `cometchat_chat_sdk` dependency — Calls SDK alone
319
- - [ ] **Additive (chat + calls):** dual-SDK contract preserved (Chat first, then Calls)
320
273
  - [ ] Real-device smoke: tap meeting link → app opens at /meet → joins → video flows → leave → notification clears
321
274
 
322
275
  ---
@@ -324,7 +277,9 @@ See `cometchat-flutter-v5-calls/references/share-invite.md` for full deep-link c
324
277
  ## Pointers
325
278
 
326
279
  - `cometchat-react-calls/references/call-session.md` — cross-platform architecture
327
- - `cometchat-flutter-v5-calls/SKILL.md` — Flutter V5 / GetX seven hard rules
280
+ - `cometchat-flutter-v5-calls/SKILL.md` — Flutter V5 / GetX seven hard rules (5.x Calls SDK)
328
281
  - `cometchat-flutter-v5-calls/references/share-invite.md` — deep-link config
329
- - Upstream Flutter sample — `~/Downloads/calls-sdk/calls-sdk-flutter-5/sample-apps/cometchat-calls-sample-app-flutter/lib/screens/call_screen.dart`
282
+ - `cometchat-flutter-v6-calls/references/call-session.md` — V6 (Bloc) sibling on the SAME 5.0.2 SDK
283
+ - Substrate of record: `~/.pub-cache/hosted/pub.dev/cometchat_calls_sdk-5.0.2/lib/src/plugin/cometchatcalls.dart` + `src/call_session.dart`
330
284
  - Canonical docs: https://www.cometchat.com/docs/calls/flutter/join-session
285
+ ```
@@ -9,14 +9,16 @@ The Calls SDK exposes basic camera switching (`switchCamera()`); audio device ma
9
9
 
10
10
  ## SDK API
11
11
 
12
+ Camera switching and audio-output selection are **instance methods on the `CallSession` singleton** (`cometchat_calls_sdk-5.0.2` `src/call_session.dart`). There is no `setSpeakerEnabled` in 5.x — audio output is chosen via `setAudioModeType(AudioMode)` where `AudioMode { speaker, earpiece, bluetooth }` (`src/enums/audio_mode.dart`).
13
+
12
14
  ```dart
13
- import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
15
+ import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
14
16
 
15
17
  // Camera flip
16
- CometChatCalls.switchCamera();
18
+ CallSession.getInstance()?.switchCamera(); // call_session.dart:205
17
19
 
18
- // Speaker toggle (iOS + Android — wraps native AudioManager / AVAudioSession)
19
- CometChatCalls.setSpeakerEnabled(true);
20
+ // Audio output (speaker / earpiece / bluetooth)
21
+ CallSession.getInstance()?.setAudioModeType(AudioMode.speaker); // call_session.dart:381
20
22
  ```
21
23
 
22
24
  ---
@@ -48,7 +50,7 @@ class CameraFlipButton extends StatelessWidget {
48
50
  return IconButton(
49
51
  icon: const Icon(Icons.flip_camera_ios),
50
52
  onPressed: () {
51
- CometChatCalls.switchCamera();
53
+ CallSession.getInstance()?.switchCamera();
52
54
  SemanticsService.announce('Camera flipped', TextDirection.ltr);
53
55
  },
54
56
  tooltip: 'Flip camera',
@@ -84,7 +86,9 @@ class CallController extends GetxController {
84
86
 
85
87
  void toggleSpeaker() {
86
88
  speakerOn.value = !speakerOn.value;
87
- CometChatCalls.setSpeakerEnabled(speakerOn.value);
89
+ CallSession.getInstance()?.setAudioModeType(
90
+ speakerOn.value ? AudioMode.speaker : AudioMode.earpiece,
91
+ );
88
92
  }
89
93
  }
90
94
  ```
@@ -103,8 +107,8 @@ Web sister rules apply, plus Flutter-specific:
103
107
 
104
108
  ## Verification checklist
105
109
 
106
- - [ ] Camera flip wired to `CometChatCalls.switchCamera()`
107
- - [ ] Speaker toggle uses `setSpeakerEnabled`
110
+ - [ ] Camera flip wired to `CallSession.getInstance()?.switchCamera()`
111
+ - [ ] Speaker toggle uses `CallSession.getInstance()?.setAudioModeType(AudioMode.speaker | .earpiece)`
108
112
  - [ ] System audio route picker (CallKit / ConnectionService) preferred for Bluetooth
109
113
  - [ ] Real-device smoke: speaker toggle works
110
114
  - [ ] Real-device smoke: camera flip works