@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,163 @@
1
+ # Call session — joinSession with no ringing (Android V6 / Compose)
2
+
3
+ V6 uses the same SDK (`com.cometchat.calls-sdk-android`) as V5. The canonical SDK API surface is documented in the V5 sister; this file documents only the Compose-specific delta (bridging `AndroidView` to the SDK's `RelativeLayout` container).
4
+
5
+ **Read first:**
6
+ - `cometchat-android-v5-calls/references/call-session.md` — canonical SDK API (single-call `joinSession`, `SessionSettingsBuilder`, `SessionStatusListener`, `CometChatOngoingCallService`)
7
+ - `cometchat-react-calls/references/call-session.md` — cross-platform architecture
8
+
9
+ **Source of truth:** `~/Downloads/calls-sdk/calls-sdk-android-5/samples/sample-app/src/main/kotlin/com/cometchat/samplecalls/ui/activity/CallActivity.kt` (no Compose-specific upstream sample exists; the SDK surface is identical).
10
+
11
+ ---
12
+
13
+ ## Hard rules
14
+
15
+ All V5 rules apply (single-call `joinSession(sessionId, settings, container, callback)`, `CometChatCalls.SessionSettingsBuilder()`, `SessionStatusListener` on the `CallSession` instance, `CometChatOngoingCallService.launch/abort`, runtime permissions, no Chat SDK for session-only). The V6 Compose-specific deltas:
16
+
17
+ 1. **`AndroidView` with `remember`-stable factory** to host the SDK's `RelativeLayout` container. The factory MUST be wrapped in `remember { }` — re-creating the layout on every recomposition flickers / re-joins the session.
18
+ 2. **`LaunchedEffect(sessionId)` to fire `joinSession` once**, not in a Composable body. Composable bodies re-run on recomposition; the SDK would join multiple times.
19
+ 3. **`DisposableEffect` for cleanup**, NOT `LaunchedEffect`'s cleanup lambda. `LaunchedEffect`'s cleanup fires on key change too, not just final dispose. `DisposableEffect.onDispose` is the correct teardown hook.
20
+ 4. **State observation via `mutableStateOf` set from listener callbacks** — the listener callbacks must hop to `Main` dispatcher (or use `runOnUiThread` from a hosting activity ref) before touching Compose state.
21
+
22
+ ---
23
+
24
+ ## Compose CallRoom
25
+
26
+ ```kotlin
27
+ @Composable
28
+ fun CallRoom(sessionId: String, onLeft: () -> Unit) {
29
+ val context = LocalContext.current
30
+ val activity = context as Activity
31
+ val containerRef = remember { mutableStateOf<RelativeLayout?>(null) }
32
+ val joined = remember { mutableStateOf(false) }
33
+ val callSession = remember { mutableStateOf<CallSession?>(null) }
34
+
35
+ AndroidView(
36
+ factory = { ctx ->
37
+ RelativeLayout(ctx).apply {
38
+ layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
39
+ setBackgroundColor(android.graphics.Color.BLACK)
40
+ containerRef.value = this
41
+ }
42
+ },
43
+ modifier = Modifier.fillMaxSize(),
44
+ )
45
+
46
+ LaunchedEffect(sessionId) {
47
+ if (joined.value) return@LaunchedEffect
48
+ val container = containerRef.value ?: return@LaunchedEffect
49
+ joined.value = true
50
+
51
+ val sessionSettings = CometChatCalls.SessionSettingsBuilder()
52
+ .setTitle("CometChat Meeting")
53
+ .startVideoPaused(false)
54
+ .startAudioMuted(false)
55
+ .build()
56
+
57
+ CometChatCalls.joinSession(
58
+ sessionId,
59
+ sessionSettings,
60
+ container,
61
+ object : CometChatCalls.CallbackListener<CallSession>() {
62
+ override fun onSuccess(session: CallSession) {
63
+ callSession.value = session
64
+
65
+ // Single guarded termination handler — the v5 Calls SDK fires
66
+ // onSessionLeft + onConnectionClosed in sequence on every hangup.
67
+ // Without the guard, abort() + onLeft() fire 3 times (wasteful;
68
+ // can race the composable's exit transition).
69
+ val isTerminating = mutableStateOf(false)
70
+ fun handleTermination() {
71
+ if (isTerminating.value) return
72
+ isTerminating.value = true
73
+ activity.runOnUiThread {
74
+ CometChatOngoingCallService.abort(activity)
75
+ onLeft()
76
+ }
77
+ }
78
+
79
+ session.addSessionStatusListener(activity, object : SessionStatusListener() {
80
+ override fun onSessionJoined() {
81
+ CometChatOngoingCallService.launch(activity)
82
+ }
83
+
84
+ override fun onSessionLeft() = handleTermination()
85
+ override fun onConnectionClosed() = handleTermination()
86
+ override fun onSessionTimedOut() = handleTermination()
87
+
88
+ override fun onConnectionLost() {}
89
+ override fun onConnectionRestored() {}
90
+ })
91
+
92
+ session.addButtonClickListener(activity, object : ButtonClickListener() {
93
+ override fun onLeaveSessionButtonClicked() {
94
+ val active = CallSession.getInstance()
95
+ if (active.isSessionActive) active.leaveSession()
96
+ // The listener chain calls handleTermination().
97
+ }
98
+ })
99
+ }
100
+
101
+ override fun onError(e: CometChatException) {
102
+ activity.runOnUiThread {
103
+ Toast.makeText(activity, "Failed to join: ${e.message}", Toast.LENGTH_LONG).show()
104
+ onLeft()
105
+ }
106
+ }
107
+ }
108
+ )
109
+ }
110
+
111
+ DisposableEffect(sessionId) {
112
+ onDispose {
113
+ val active = CallSession.getInstance()
114
+ if (active.isSessionActive) active.leaveSession()
115
+ CometChatOngoingCallService.abort(activity)
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ **Why this shape:**
122
+
123
+ - **`AndroidView` factory wrapped in `remember`** — Compose otherwise re-creates the `RelativeLayout` on every recomposition; the SDK's video tile dies along with it.
124
+ - **`LaunchedEffect(sessionId)` for the join call** — Composable body re-runs on every recomposition; `LaunchedEffect` runs once per key. The `joined` guard handles configuration changes (rotation re-keys the effect).
125
+ - **`runOnUiThread` inside listener callbacks** — SDK callbacks fire on background threads; touching Compose state from them throws without the dispatcher hop.
126
+ - **`DisposableEffect.onDispose` for `leaveSession`** — `LaunchedEffect`'s cleanup runs on key change too. `DisposableEffect.onDispose` only runs when the composable actually leaves composition.
127
+
128
+ ---
129
+
130
+ ## Anti-patterns
131
+
132
+ V5 sister rules apply, plus V6 Compose-specific:
133
+
134
+ 1. **`AndroidView` without `remember { }` around the layout reference.** Each recomposition creates a new layout → call surface flickers, joinSession orphans previous container.
135
+ 2. **`leaveSession()` in `LaunchedEffect`'s cleanup lambda.** Fires on every key change, not just dispose. Use `DisposableEffect.onDispose`.
136
+ 3. **Skipping the `joined` guard.** Configuration changes (rotation) re-run `LaunchedEffect` with the same key (StrictMode-like behavior in dev); guard prevents double-join.
137
+ 4. **Touching `mutableStateOf` from listener callbacks without `runOnUiThread`.** Compose state isn't thread-safe; race conditions corrupt state.
138
+ 5. **Putting `joinSession` directly in the Composable body** (not in `LaunchedEffect`). Recomposition re-runs the call → multiple sessions.
139
+
140
+ ---
141
+
142
+ ## Verification checklist
143
+
144
+ V5 checklist applies, plus Compose-specific:
145
+
146
+ - [ ] `AndroidView` factory creates `RelativeLayout` once, stored via `remember { mutableStateOf<RelativeLayout?>(null) }`
147
+ - [ ] `joinSession` fired inside `LaunchedEffect(sessionId)`, NOT in Composable body
148
+ - [ ] `joined` flag guards re-entry on rotation / key re-trigger
149
+ - [ ] `DisposableEffect.onDispose` calls `leaveSession` + `CometChatOngoingCallService.abort`
150
+ - [ ] Listener callbacks use `activity.runOnUiThread { ... }` before touching Compose state
151
+ - [ ] `onSessionLeft`, `onConnectionClosed`, `onSessionTimedOut` ALL fire the `onLeft` callback
152
+ - [ ] **Standalone session-only:** no chat-sdk-android dependency
153
+ - [ ] Real-device smoke: rotation doesn't double-join, dispose tears down cleanly, foreground-service notification clears
154
+
155
+ ---
156
+
157
+ ## Pointers
158
+
159
+ - `cometchat-android-v5-calls/references/call-session.md` — canonical SDK API + Views patterns
160
+ - `cometchat-android-v6-calls/SKILL.md` — V6 Compose architecture (W1–W5 workarounds for the kit)
161
+ - `cometchat-android-v6-calls/references/share-invite.md` — App Links config
162
+ - Upstream Android sample — `~/Downloads/calls-sdk/calls-sdk-android-5/samples/sample-app/src/main/kotlin/com/cometchat/samplecalls/ui/activity/CallActivity.kt`
163
+ - Canonical docs: https://www.cometchat.com/docs/calls/android/join-session
@@ -0,0 +1,171 @@
1
+ # Device management on Android V6
2
+
3
+ V6 inherits the V5 SDK API for device management — `CallSession.muteAudio()` / `pauseVideo()` / `setAudioMode()` / camera flip. V5 has detailed audio-controls + video-controls references; this V6 reference covers the Compose-specific UI patterns.
4
+
5
+ **Canonical docs:** https://www.cometchat.com/docs/calls/android/device-management
6
+ **Read first:**
7
+ - `cometchat-android-v5-calls/references/audio-controls.md` — full audio control SDK API (carries over)
8
+ - `cometchat-android-v5-calls/references/video-controls.md` — camera flip + pause/resume
9
+
10
+ ---
11
+
12
+ ## Compose toggle controls
13
+
14
+ ```kotlin
15
+ @Composable
16
+ fun CallControls(viewModel: CallControlsViewModel = viewModel()) {
17
+ val state by viewModel.state.collectAsStateWithLifecycle()
18
+
19
+ Row(horizontalArrangement = Arrangement.spacedBy(16.dp)) {
20
+ IconButton(onClick = { viewModel.toggleMic() }) {
21
+ Icon(
22
+ imageVector = if (state.micMuted) Icons.Filled.MicOff else Icons.Filled.Mic,
23
+ contentDescription = if (state.micMuted) "Unmute microphone" else "Mute microphone",
24
+ tint = if (state.micMuted) Color.Red else Color.White,
25
+ )
26
+ }
27
+
28
+ IconButton(onClick = { viewModel.toggleCamera() }) {
29
+ Icon(
30
+ imageVector = if (state.cameraOff) Icons.Filled.VideocamOff else Icons.Filled.Videocam,
31
+ contentDescription = if (state.cameraOff) "Turn on camera" else "Turn off camera",
32
+ tint = if (state.cameraOff) Color.Red else Color.White,
33
+ )
34
+ }
35
+
36
+ IconButton(onClick = { viewModel.flipCamera() }) {
37
+ Icon(
38
+ imageVector = Icons.Filled.FlipCameraIos,
39
+ contentDescription = "Flip camera",
40
+ tint = Color.White,
41
+ )
42
+ }
43
+
44
+ IconButton(onClick = { viewModel.toggleSpeaker() }) {
45
+ Icon(
46
+ imageVector = when (state.audioMode) {
47
+ AudioMode.SPEAKER -> Icons.Filled.VolumeUp
48
+ AudioMode.EARPIECE -> Icons.Filled.PhoneInTalk
49
+ AudioMode.BLUETOOTH -> Icons.Filled.Bluetooth
50
+ },
51
+ contentDescription = "Audio output: ${state.audioMode.name}",
52
+ tint = Color.White,
53
+ )
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ---
60
+
61
+ ## ViewModel
62
+
63
+ ```kotlin
64
+ data class CallControlsState(
65
+ val micMuted: Boolean = false,
66
+ val cameraOff: Boolean = false,
67
+ val audioMode: AudioMode = AudioMode.SPEAKER,
68
+ )
69
+
70
+ class CallControlsViewModel : ViewModel() {
71
+ private val _state = MutableStateFlow(CallControlsState())
72
+ val state: StateFlow<CallControlsState> = _state
73
+
74
+ fun toggleMic() {
75
+ val callSession = CallSession.getInstance()
76
+ if (_state.value.micMuted) {
77
+ callSession.unMuteAudio()
78
+ } else {
79
+ callSession.muteAudio()
80
+ }
81
+ _state.update { it.copy(micMuted = !it.micMuted) }
82
+ }
83
+
84
+ fun toggleCamera() {
85
+ val callSession = CallSession.getInstance()
86
+ if (_state.value.cameraOff) {
87
+ callSession.resumeVideo()
88
+ } else {
89
+ callSession.pauseVideo()
90
+ }
91
+ _state.update { it.copy(cameraOff = !it.cameraOff) }
92
+ }
93
+
94
+ fun flipCamera() {
95
+ val callSession = CallSession.getInstance()
96
+ val newFacing = if (callSession.currentCameraFacing == CameraFacing.FRONT) {
97
+ CameraFacing.BACK
98
+ } else {
99
+ CameraFacing.FRONT
100
+ }
101
+ callSession.switchCamera(newFacing)
102
+ }
103
+
104
+ fun toggleSpeaker() {
105
+ val callSession = CallSession.getInstance()
106
+ val nextMode = when (_state.value.audioMode) {
107
+ AudioMode.SPEAKER -> AudioMode.EARPIECE
108
+ AudioMode.EARPIECE -> AudioMode.SPEAKER
109
+ AudioMode.BLUETOOTH -> AudioMode.SPEAKER
110
+ }
111
+ callSession.setAudioMode(nextMode)
112
+ _state.update { it.copy(audioMode = nextMode) }
113
+ }
114
+ }
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Bluetooth audio routing
120
+
121
+ V6 still uses the V5 SDK's `MediaEventsListener` for audio mode change detection:
122
+
123
+ ```kotlin
124
+ class CallControlsViewModel : ViewModel(), MediaEventsListener {
125
+ init {
126
+ CallSession.getInstance().addMediaEventsListener("controls", this)
127
+ }
128
+
129
+ override fun onAudioModeUpdated(mode: AudioMode) {
130
+ _state.update { it.copy(audioMode = mode) }
131
+ }
132
+
133
+ override fun onCleared() {
134
+ CallSession.getInstance().removeMediaEventsListener("controls")
135
+ }
136
+ // ... other MediaEventsListener methods
137
+ }
138
+ ```
139
+
140
+ When the user connects Bluetooth headphones mid-call, `onAudioModeUpdated(BLUETOOTH)` fires. Update the UI button accordingly.
141
+
142
+ ---
143
+
144
+ ## Anti-patterns
145
+
146
+ V5 audio-controls + video-controls references list the SDK-level anti-patterns; V6 Compose-specific:
147
+
148
+ 1. **`Icons.Filled.MicOff` without `tint`.** Default tint is theme-dependent; on dark call surfaces, the icon may be invisible.
149
+ 2. **`collectAsState()` instead of `collectAsStateWithLifecycle()`.** State updates run while paused; CPU waste.
150
+ 3. **Camera flip without checking current facing.** SDK's `switchCamera()` (no arg) toggles, but `switchCamera(CameraFacing)` requires explicit value. Use the explicit-arg form for clarity.
151
+
152
+ ---
153
+
154
+ ## Verification checklist
155
+
156
+ - [ ] ViewModel uses `StateFlow` + `collectAsStateWithLifecycle()`
157
+ - [ ] All toggle buttons have `contentDescription` (a11y)
158
+ - [ ] `MediaEventsListener` registered with stable ID
159
+ - [ ] Listener cleaned up in `onCleared()`
160
+ - [ ] Real-device smoke: mute / camera / flip / speaker all work
161
+ - [ ] Bluetooth smoke: connect headphones → audio mode icon updates
162
+
163
+ ---
164
+
165
+ ## Pointers
166
+
167
+ - `cometchat-android-v5-calls/references/audio-controls.md` — full audio SDK API (mute/audio mode)
168
+ - `cometchat-android-v5-calls/references/video-controls.md` — camera pause/resume/flip
169
+ - `cometchat-android-v6-calls` SKILL.md
170
+ - `cometchat-android-v6-calls/references/raise-hand.md` — Compose pattern sibling
171
+ - Canonical docs: https://www.cometchat.com/docs/calls/android/device-management
@@ -0,0 +1,191 @@
1
+ # Group calls — broadcast meeting pattern (Android V6)
2
+
3
+ Group calls use a **different signaling channel than 1:1 user calls**. The Ringing flow (`CometChat.initiateCall` → `onIncomingCallReceived` on peer) is **1:1 user only**. For groups, the kit broadcasts a **custom message of type `"meeting"`** to the group; receivers see a "Join meeting" card in `CometChatMessageList` (kit) or need an explicit `MessageListener.onCustomMessageReceived` (custom UI).
4
+
5
+ By-design kit behavior — same semantic across all CometChat kits.
6
+
7
+ **Canonical docs:** https://www.cometchat.com/docs/calls/android/group-calls
8
+
9
+ V6 specifics: this applies equally to Compose and Kotlin Views surfaces. Calls bundling into V6's chatuikit module doesn't change the signaling — the kit's `CometChatCallButtons` composable (or Views equivalent) sends the same meeting `CustomMessage` as V5.
10
+
11
+ ---
12
+
13
+ ## Architecture
14
+
15
+ ```
16
+ Caller (uidA, member of groupX) CometChat Receivers (members of groupX)
17
+ │ │ │
18
+ │ CometChatCallButtons sends │ │
19
+ │ CustomMessage(GUID, GROUP, "meeting", │ │
20
+ │ { callType, sessionId }) │ │
21
+ ├──────────────────────────────────────>│ │
22
+ │ │ onCustomMessageReceived │
23
+ │ ├─────────────────────────────>│
24
+ │ caller jumps to OngoingCall surface │ receiver taps Join │
25
+ │ sessionId = groupGuid │ → joinSession(GUID) │
26
+ ├──────────────────────────────────────>│ <─────────────────────────── │
27
+ │ ───── WebRTC session active (sessionId = group GUID) ─────│
28
+ ```
29
+
30
+ | Channel | 1:1 user calls | Group calls |
31
+ |---|---|---|
32
+ | Signaling | `CometChat.initiateCall(call, callback)` | `CometChat.sendCustomMessage(message, callback)` (type="meeting") |
33
+ | Receiver event | `CallListener.onIncomingCallReceived` | `MessageListener.onCustomMessageReceived` |
34
+ | Session ID | server-generated unique | group's GUID (persistent) |
35
+ | Ring/decline | yes — `acceptCall` / `rejectCall` | no — receivers join or ignore |
36
+
37
+ ---
38
+
39
+ ## Hard rules
40
+
41
+ 1. **Group calls broadcast a custom message; they do NOT use the call listener.** Add a `MessageListener` for custom UI.
42
+ 2. **Session ID = group GUID.** Persistent.
43
+ 3. **V6's "five required workarounds" (W1–W5 in SKILL.md) apply to group calls too** — same calls-sdk-android peer dep, same `Call` constructor arg order, same stub classes. Group calls share the underlying WebRTC layer.
44
+ 4. **No `CometChat.endCall` for groups.** Use `CallSession.getInstance().leaveSession()` only.
45
+
46
+ ---
47
+
48
+ ## Caller side — Compose (kit)
49
+
50
+ ```kotlin
51
+ import com.cometchat.chatuikit.calls.callbuttons.CometChatCallButtons
52
+
53
+ @Composable
54
+ fun GroupHeader(group: Group) {
55
+ Row {
56
+ Text(group.name)
57
+ // ⚠️ V6 W4 — DO NOT use CometChatCallButtons composable for 1:1 user
58
+ // calls (broken in 6.0.0 — captures first-rendered user globally).
59
+ // For groups, the composable's same bug may or may not apply; check
60
+ // current chatuikit-compose-android version's release notes.
61
+ CometChatCallButtons(group = group)
62
+ }
63
+ }
64
+ ```
65
+
66
+ The kit's `CometChatCallButtons(group = group)` composable sends the same `CustomMessage` of type `"meeting"` as the Kotlin Views variant. V6 W4 (the per-row state-capture bug) primarily affects the `user` prop variant; group-targeted use may be safer but verify against the installed version.
67
+
68
+ ## Caller side — Kotlin Views (kit)
69
+
70
+ ```kotlin
71
+ val callButtons = CometChatCallButtons(this).apply {
72
+ setGroup(group)
73
+ }
74
+ ```
75
+
76
+ Same behavior as V5.
77
+
78
+ ## Caller side — custom UI
79
+
80
+ ```kotlin
81
+ import com.cometchat.chat.core.CometChat
82
+ import com.cometchat.chat.models.CustomMessage
83
+ import com.cometchat.chat.constants.CometChatConstants
84
+ import org.json.JSONObject
85
+
86
+ fun startGroupCall(groupGuid: String, callType: String) {
87
+ val sessionId = groupGuid
88
+ val customData = JSONObject().apply {
89
+ put("callType", callType)
90
+ put("sessionId", sessionId)
91
+ }
92
+ val meetingMessage = CustomMessage(
93
+ groupGuid,
94
+ CometChatConstants.RECEIVER_TYPE_GROUP,
95
+ "meeting",
96
+ customData,
97
+ ).apply {
98
+ category = CometChatConstants.CATEGORY_CUSTOM
99
+ metadata = JSONObject().apply {
100
+ put("incrementUnreadCount", true)
101
+ put("pushNotification", "meeting")
102
+ put("callType", callType)
103
+ put("sessionId", sessionId)
104
+ }
105
+ }
106
+ CometChat.sendCustomMessage(meetingMessage, object : CometChat.CallbackListener<CustomMessage>() {
107
+ override fun onSuccess(p0: CustomMessage) {
108
+ // navigate to your OngoingCall composable / Activity with sessionId
109
+ }
110
+ override fun onError(p0: CometChatException) { /* surface */ }
111
+ })
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## Receiver side — kit-based (auto-renders meeting card)
118
+
119
+ `CometChatMessageList(group = group)` (Compose) or the Kotlin Views equivalent renders the meeting message as a "Join meeting" card.
120
+
121
+ ## Receiver side — custom UI
122
+
123
+ ```kotlin
124
+ private val GROUP_MEETING_LISTENER_ID = "APP_ROOT_GROUP_MEETING_LISTENER"
125
+
126
+ CometChat.addMessageListener(GROUP_MEETING_LISTENER_ID, object : CometChat.MessageListener() {
127
+ override fun onCustomMessageReceived(msg: CustomMessage) {
128
+ if (msg.category != CometChatConstants.CATEGORY_CUSTOM) return
129
+ if (msg.type != "meeting") return
130
+ val customData = msg.customData ?: return
131
+ val sessionId = customData.optString("sessionId", msg.receiverUid)
132
+ val callType = customData.optString("callType", "video")
133
+ val fromUid = msg.sender.uid
134
+ val groupGuid = msg.receiverUid
135
+ // Compose: state.update { it.copy(incomingMeeting = ...) }
136
+ // Views: runOnUiThread { showIncomingMeetingDialog(...) }
137
+ }
138
+ })
139
+
140
+ // Cleanup:
141
+ DisposableEffect(Unit) {
142
+ onDispose { CometChat.removeMessageListener(GROUP_MEETING_LISTENER_ID) }
143
+ }
144
+ ```
145
+
146
+ Wrap in `DisposableEffect` (Compose) or `onDestroy()` (Views).
147
+
148
+ ---
149
+
150
+ ## Edge cases
151
+
152
+ ### Late joining
153
+
154
+ Meeting message persists in chat history. Tap to join — works hours after.
155
+
156
+ ### V6 calls-sdk-android peer dep
157
+
158
+ Same W1 workaround applies to group calls — `com.cometchat:calls-sdk-android:5.0.+` must be an explicit peer dep in `app/build.gradle.kts`. Without it, group-call join fails the same way 1:1 join fails.
159
+
160
+ ### Push notifications
161
+
162
+ Meeting `CustomMessage.metadata.pushNotification = "meeting"` — routed via regular FCM. No ConnectionService-ring out of the box.
163
+
164
+ ---
165
+
166
+ ## Anti-patterns
167
+
168
+ 1. **Registering `CometChat.addCallListener` only — expecting group ringing.** Won't fire.
169
+ 2. **Skipping the V6 W1–W5 workarounds for groups.** They apply equally — calls-sdk-android peer dep, annotations-java5 exclude, stub classes, Call constructor arg order, avoid V6 `CometChatCallButtons` composable per-row bug.
170
+ 3. **`CometChat.endCall(sessionId)` after group hangup.** No call entity. Use `CallSession.getInstance().leaveSession()`.
171
+ 4. **Treating sessionId as ephemeral.** It's the group GUID.
172
+
173
+ ---
174
+
175
+ ## Verification checklist
176
+
177
+ - [ ] V6 workarounds W1–W5 applied (calls-sdk-android peer dep + manifest etc. — see SKILL.md §"Five required workarounds")
178
+ - [ ] Kit caller: `CometChatCallButtons(group = ...)` / `setGroup(group)` initiates meeting message
179
+ - [ ] Custom caller: `CometChat.sendCustomMessage` with `type="meeting"`, `category=CATEGORY_CUSTOM`
180
+ - [ ] Kit receiver: `CometChatMessageList` renders meeting card
181
+ - [ ] Custom receiver: `addMessageListener` registered with category+type filter
182
+ - [ ] On hangup: `CallSession.getInstance().leaveSession()` only (no `endCall`)
183
+
184
+ ---
185
+
186
+ ## Pointers
187
+
188
+ - `cometchat-android-v6-calls/SKILL.md` §"Five required workarounds" — V6 build prerequisites
189
+ - `ringing-integration.md` — 1:1 user calls
190
+ - Canonical docs: https://www.cometchat.com/docs/calls/android/group-calls
191
+ - Cross-platform reference (semantic ground-truth): `cometchat-react-calls/references/group-calls.md`
@@ -0,0 +1,107 @@
1
+ # Idle timeout on Android V6 (Compose + Kotlin Views)
2
+
3
+ Same SDK API as V5. V6-specific: Compose `AlertDialog` for new code, ViewModel + `collectAsStateWithLifecycle` (cf. `references/raise-hand.md` V6 sibling).
4
+
5
+ **Canonical docs:** https://www.cometchat.com/docs/calls/android/idle-timeout
6
+ **Read first:** `cometchat-android-v5-calls/references/idle-timeout.md` — V5 sister covers ViewModel pattern.
7
+
8
+ ---
9
+
10
+ ## SDK API (same as V5)
11
+
12
+ ```kotlin
13
+ val settings = SessionSettingsBuilder(context, callContainer)
14
+ .setSessionType(SessionType.VIDEO)
15
+ .setIdleTimeoutPeriodBeforePrompt(60_000)
16
+ .setIdleTimeoutPeriodAfterPrompt(120_000)
17
+ .build()
18
+ ```
19
+
20
+ ---
21
+
22
+ ## Compose prompt
23
+
24
+ ```kotlin
25
+ @Composable
26
+ fun IdleTimeoutPrompt(
27
+ onStay: () -> Unit,
28
+ onEnd: () -> Unit,
29
+ ) {
30
+ AlertDialog(
31
+ onDismissRequest = { /* prevent backdrop dismiss */ },
32
+ title = { Text("Still there?") },
33
+ text = { Text("You're alone in this call. It'll end in 60 seconds.") },
34
+ confirmButton = {
35
+ Button(onClick = onStay) { Text("Stay") }
36
+ },
37
+ dismissButton = {
38
+ TextButton(onClick = onEnd) {
39
+ Text("End now", color = MaterialTheme.colorScheme.error)
40
+ }
41
+ },
42
+ )
43
+ }
44
+ ```
45
+
46
+ `onDismissRequest = { }` (empty) prevents backdrop dismiss — Compose's AlertDialog doesn't have a `setCancelable(false)` equivalent; you swallow the dismiss.
47
+
48
+ ---
49
+
50
+ ## Wiring in CallScreen
51
+
52
+ ```kotlin
53
+ @Composable
54
+ fun CallScreen(viewModel: CallViewModel = viewModel()) {
55
+ val state by viewModel.state.collectAsStateWithLifecycle()
56
+
57
+ Box(modifier = Modifier.fillMaxSize()) {
58
+ // CometChat call surface
59
+ CometChatOngoingCall(modifier = Modifier.fillMaxSize())
60
+
61
+ if (state.showIdlePrompt) {
62
+ IdleTimeoutPrompt(
63
+ onStay = { viewModel.dismissIdlePrompt() },
64
+ onEnd = { CallSession.getInstance().leaveSession() },
65
+ )
66
+ }
67
+
68
+ // Toast for actual timeout (after grace period)
69
+ val context = LocalContext.current
70
+ LaunchedEffect(state.timedOut) {
71
+ if (state.timedOut) {
72
+ Toast.makeText(context, "Call ended due to inactivity", Toast.LENGTH_LONG).show()
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ `collectAsStateWithLifecycle()` (V6 pattern) replaces V5's manual `repeatOnLifecycle`.
80
+
81
+ ---
82
+
83
+ ## Anti-patterns
84
+
85
+ V5 sister rules apply, plus V6-specific:
86
+
87
+ 1. **`AlertDialog` with `onDismissRequest = { onEnd() }`.** Wrong — backdrop tap accidentally ends the call. Empty body or explicit no-op.
88
+ 2. **`LaunchedEffect(state)` instead of `LaunchedEffect(state.timedOut)`.** Re-fires on every state change.
89
+
90
+ ---
91
+
92
+ ## Verification checklist
93
+
94
+ - [ ] SessionSettingsBuilder sets both idle periods
95
+ - [ ] Compose AlertDialog `onDismissRequest = { }` (empty)
96
+ - [ ] `collectAsStateWithLifecycle()` for state binding
97
+ - [ ] LaunchedEffect on specific field, not whole state
98
+ - [ ] Real-device smoke: same as V5
99
+
100
+ ---
101
+
102
+ ## Pointers
103
+
104
+ - `cometchat-android-v5-calls/references/idle-timeout.md` — V5 sister
105
+ - `cometchat-android-v6-calls` SKILL.md
106
+ - `cometchat-android-v6-calls/references/raise-hand.md` — Compose pattern sibling
107
+ - Canonical docs: https://www.cometchat.com/docs/calls/android/idle-timeout