@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,250 @@
1
+ # Custom call UI on React Native
2
+
3
+ Two paths:
4
+
5
+ 1. **Style the kit's `<CometChatOngoingCall />`** — pass style props. Cheapest. Path-of-least-resistance for 80% of apps.
6
+ 2. **Render `<CometChatCalls.Component callToken={...} />` with the SDK's default-UI elements hidden, then overlay your own controls.** This is the canonical RN custom-UI path — the SDK's Component handles WebRTC + tile rendering; your code controls the chrome.
7
+
8
+ This reference covers path 2.
9
+
10
+ > **Note on raw WebRTC bypass:** Earlier versions of this skill suggested using `react-native-webrtc`'s `<RTCView />` directly with `CometChatCalls.startSession`. That API does NOT exist on RN session mode — the SDK exposes only the declarative `<CometChatCalls.Component>` primitive. The example below shows the supported pattern.
11
+
12
+ ---
13
+
14
+ ## Architecture
15
+
16
+ ```
17
+ Your screen component
18
+ ├── <RTCView /> for local user (preview + during call)
19
+ ├── <RTCView /> for remote participant(s)
20
+ ├── Custom control panel (mute / camera / end / switch)
21
+ └── Custom layout (Stack / Modal / etc.)
22
+ ```
23
+
24
+ `react-native-webrtc` ships `<RTCView />` — a native view that renders a `MediaStream` directly. The Calls SDK pipes streams to it through events.
25
+
26
+ ---
27
+
28
+ ## Required peer deps for custom UI
29
+
30
+ ```bash
31
+ npm install react-native-webrtc react-native-incall-manager
32
+ ```
33
+
34
+ `react-native-incall-manager` handles audio routing (speaker vs earpiece, Bluetooth, AirPods) — without it, voice calls default to earpiece-only and the user can't switch to speaker.
35
+
36
+ ---
37
+
38
+ ## Custom OngoingCallScreen
39
+
40
+ ```tsx
41
+ import { useEffect, useRef, useState } from "react";
42
+ import { View, StyleSheet } from "react-native";
43
+ import { RTCView, MediaStream } from "react-native-webrtc";
44
+ import InCallManager from "react-native-incall-manager";
45
+ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
46
+ import { ControlPanel } from "./ControlPanel";
47
+
48
+ interface Props {
49
+ sessionId: string;
50
+ authToken: string;
51
+ isAudioOnly: boolean;
52
+ onCallEnded: () => void;
53
+ }
54
+
55
+ export function CustomOngoingCallScreen({ sessionId, authToken, isAudioOnly, onCallEnded }: Props) {
56
+ const [localStream, setLocalStream] = useState<MediaStream | null>(null);
57
+ const [remoteStream, setRemoteStream] = useState<MediaStream | null>(null);
58
+ const [muted, setMuted] = useState(false);
59
+ const [cameraOff, setCameraOff] = useState(false);
60
+
61
+ const [callToken, setCallToken] = useState<string | null>(null);
62
+
63
+ useEffect(() => {
64
+ InCallManager.start({ media: isAudioOnly ? "audio" : "video" });
65
+ if (!isAudioOnly) InCallManager.setForceSpeakerphoneOn(true);
66
+
67
+ // Subscribe to lifecycle events. Use the v5 addEventListener API,
68
+ // not the deprecated OngoingCallListener.
69
+ const offClosed = CometChatCalls.addEventListener("onConnectionClosed", () => {
70
+ cleanup();
71
+ onCallEnded();
72
+ });
73
+
74
+ // Mint a fresh token for this session (v5 — generateToken takes only sessionId).
75
+ CometChatCalls.generateToken(sessionId).then(({ token }) => {
76
+ setCallToken(token);
77
+ });
78
+
79
+ return () => {
80
+ offClosed();
81
+ cleanup();
82
+ };
83
+
84
+ function cleanup() {
85
+ InCallManager.stop();
86
+ // leaveSession is v5 canonical (endSession is a deprecated shim).
87
+ CometChatCalls.leaveSession();
88
+ }
89
+ }, [sessionId, isAudioOnly, onCallEnded]);
90
+
91
+ return (
92
+ <View style={styles.container}>
93
+ {!isAudioOnly && remoteStream && (
94
+ <RTCView
95
+ streamURL={remoteStream.toURL()}
96
+ objectFit="cover"
97
+ style={styles.remoteVideo}
98
+ />
99
+ )}
100
+ {!isAudioOnly && localStream && (
101
+ <RTCView
102
+ streamURL={localStream.toURL()}
103
+ objectFit="cover"
104
+ style={styles.localVideo}
105
+ />
106
+ )}
107
+ <ControlPanel
108
+ muted={muted}
109
+ cameraOff={cameraOff}
110
+ onToggleMute={() => {
111
+ CometChatCalls.muteAudio(!muted);
112
+ setMuted(!muted);
113
+ }}
114
+ onToggleCamera={() => {
115
+ CometChatCalls.pauseVideo(!cameraOff);
116
+ setCameraOff(!cameraOff);
117
+ }}
118
+ onSwitchCamera={() => CometChatCalls.switchCamera()}
119
+ onEnd={() => {
120
+ // leaveSession is v5 canonical (endSession is a deprecated shim).
121
+ CometChatCalls.leaveSession();
122
+ onCallEnded();
123
+ }}
124
+ />
125
+ </View>
126
+ );
127
+ }
128
+
129
+ const styles = StyleSheet.create({
130
+ container: { flex: 1, backgroundColor: "#000" },
131
+ remoteVideo: { ...StyleSheet.absoluteFillObject },
132
+ localVideo: { position: "absolute", top: 60, right: 20, width: 120, height: 160, borderRadius: 8 },
133
+ });
134
+ ```
135
+
136
+ `react-native-webrtc`'s `<RTCView />` requires `streamURL`, not the `MediaStream` directly — call `.toURL()`.
137
+
138
+ ---
139
+
140
+ ## Control panel
141
+
142
+ ```tsx
143
+ import { View, TouchableOpacity, Text, StyleSheet } from "react-native";
144
+
145
+ interface Props {
146
+ muted: boolean;
147
+ cameraOff: boolean;
148
+ onToggleMute: () => void;
149
+ onToggleCamera: () => void;
150
+ onSwitchCamera: () => void;
151
+ onEnd: () => void;
152
+ }
153
+
154
+ export function ControlPanel({ muted, cameraOff, onToggleMute, onToggleCamera, onSwitchCamera, onEnd }: Props) {
155
+ return (
156
+ <View style={styles.row}>
157
+ <TouchableOpacity onPress={onToggleMute} style={styles.btn}>
158
+ <Text>{muted ? "Unmute" : "Mute"}</Text>
159
+ </TouchableOpacity>
160
+ <TouchableOpacity onPress={onToggleCamera} style={styles.btn}>
161
+ <Text>{cameraOff ? "Cam on" : "Cam off"}</Text>
162
+ </TouchableOpacity>
163
+ <TouchableOpacity onPress={onSwitchCamera} style={styles.btn}>
164
+ <Text>Flip</Text>
165
+ </TouchableOpacity>
166
+ <TouchableOpacity onPress={onEnd} style={[styles.btn, styles.endBtn]}>
167
+ <Text style={styles.endText}>End</Text>
168
+ </TouchableOpacity>
169
+ </View>
170
+ );
171
+ }
172
+
173
+ const styles = StyleSheet.create({
174
+ row: { position: "absolute", bottom: 40, left: 0, right: 0, flexDirection: "row", justifyContent: "space-around" },
175
+ btn: { backgroundColor: "rgba(255,255,255,0.2)", padding: 16, borderRadius: 32 },
176
+ endBtn: { backgroundColor: "red" },
177
+ endText: { color: "white" },
178
+ });
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Audio routing — InCallManager
184
+
185
+ The most-overlooked piece of custom RN call UI:
186
+
187
+ ```ts
188
+ // On call start
189
+ InCallManager.start({ media: "video" }); // audio routed to speaker by default for video
190
+ InCallManager.setForceSpeakerphoneOn(true);
191
+
192
+ // User toggles speaker
193
+ function toggleSpeaker(on: boolean) {
194
+ InCallManager.setForceSpeakerphoneOn(on);
195
+ }
196
+
197
+ // On call end
198
+ InCallManager.stop(); // CRITICAL — restores normal audio routing
199
+ ```
200
+
201
+ Without `InCallManager.stop()`, the app's other audio (music, video) routes through the call audio path until the user's device reboots. Particularly bad for podcast/music apps that have a chat screen.
202
+
203
+ ---
204
+
205
+ ## Active speaker detection (custom layout polish)
206
+
207
+ For multi-party calls where you want to highlight whoever's speaking:
208
+
209
+ ```ts
210
+ const listener = new CometChatCalls.OngoingCallListener({
211
+ onActiveSpeakerUpdated: (uid: string) => {
212
+ setActiveSpeakerUid(uid);
213
+ // Re-layout: move that uid's tile to a larger position
214
+ },
215
+ // ...
216
+ });
217
+ ```
218
+
219
+ Not all SDK versions emit this event reliably; verify with the version you're on before relying on it.
220
+
221
+ ---
222
+
223
+ ## Picture-in-picture (Android only)
224
+
225
+ Android supports system PiP; iOS supports it for video calls but requires CallKit integration (out of scope for custom UI).
226
+
227
+ ```ts
228
+ import { Platform } from "react-native";
229
+ import { enterPictureInPictureMode } from "react-native-webrtc"; // helper if available
230
+ // or use a native module — varies by RN version
231
+
232
+ function enterPip() {
233
+ if (Platform.OS !== "android") return;
234
+ // call your native bridge here
235
+ }
236
+ ```
237
+
238
+ The SKILL.md's verification checklist doesn't require PiP — it's an enhancement, not a hard rule.
239
+
240
+ ---
241
+
242
+ ## When NOT to go custom
243
+
244
+ Same calculus as web:
245
+
246
+ - 80% of apps are fine with the kit's default `<CometChatOngoingCall />`
247
+ - Custom code is yours to maintain across SDK upgrades
248
+ - Recording / screen-share / participant management have their own SDK plumbing — covered in the kit components for free, manual in custom
249
+
250
+ The dispatcher asks before scaffolding custom and defaults to "no — use kit."
@@ -0,0 +1,135 @@
1
+ # Device management on React Native
2
+
3
+ Same SDK API as web. RN-specific: `react-native-incall-manager` for audio routing (speaker / earpiece / Bluetooth) — the SDK's `setAudioOutputDevice` doesn't reach iOS/Android system audio routing the way it does in browsers.
4
+
5
+ **Canonical docs:** https://www.cometchat.com/docs/calls/react-native/device-management
6
+ **Read first:** `cometchat-react-calls/references/device-management.md` — pre-call picker pattern + empty-label gotcha + Bluetooth caveats.
7
+
8
+ ---
9
+
10
+ ## SDK API
11
+
12
+ ```ts
13
+ import { CometChatCalls } from "@cometchat/calls-sdk-react-native";
14
+
15
+ const cameras = await CometChatCalls.getVideoInputDevices();
16
+ const mics = await CometChatCalls.getAudioInputDevices();
17
+
18
+ await CometChatCalls.setVideoInputDevice(deviceId);
19
+ ```
20
+
21
+ Camera + mic enumeration works the same as web. Speaker/output is where it diverges.
22
+
23
+ ---
24
+
25
+ ## Audio routing — react-native-incall-manager
26
+
27
+ For speaker on/off + Bluetooth/earpiece routing, RN integrates `react-native-incall-manager` (already a peer dep of the kit when calls are integrated):
28
+
29
+ ```ts
30
+ import InCallManager from "react-native-incall-manager";
31
+
32
+ // Force speakerphone on (default for video calls)
33
+ InCallManager.setForceSpeakerphoneOn(true);
34
+
35
+ // Earpiece (small speaker near top of phone — for private 1:1 voice calls)
36
+ InCallManager.setForceSpeakerphoneOn(false);
37
+
38
+ // Toggle Bluetooth audio
39
+ InCallManager.setBluetoothScoOn(true);
40
+
41
+ // Stop on call end (CRITICAL — restores normal audio routing)
42
+ InCallManager.stop();
43
+ ```
44
+
45
+ `InCallManager.stop()` MUST be called on hangup or the device's audio routing stays "in-call mode" — affects other apps' audio until phone reboots. (Same canonical "music doesn't resume" bug as iOS rule 1.5.)
46
+
47
+ ---
48
+
49
+ ## Bluetooth detection
50
+
51
+ ```ts
52
+ import InCallManager from "react-native-incall-manager";
53
+
54
+ // Listen for Bluetooth connection events (iOS + Android)
55
+ const sub = InCallManager.addListener("WiredHeadset", (data) => {
56
+ if (data.isPlugged) {
57
+ console.log("Headphones plugged in");
58
+ } else {
59
+ console.log("Headphones unplugged");
60
+ }
61
+ });
62
+
63
+ // Bluetooth state
64
+ InCallManager.startProximitySensor(); // optional — auto-screen-off when phone near ear
65
+ ```
66
+
67
+ `react-native-incall-manager` doesn't fire a clean "Bluetooth connected" event consistently across platforms. The reliable signal: poll `InCallManager.getAudioRoute()` periodically, or use platform-channel native bridges for production-grade Bluetooth detection.
68
+
69
+ ---
70
+
71
+ ## Camera picker UI
72
+
73
+ ```tsx
74
+ import { TouchableOpacity, Text, FlatList } from "react-native";
75
+
76
+ function CameraPicker({ onClose }: { onClose: () => void }) {
77
+ const [cameras, setCameras] = useState<MediaDevice[]>([]);
78
+
79
+ useEffect(() => {
80
+ CometChatCalls.getVideoInputDevices().then(setCameras);
81
+ }, []);
82
+
83
+ return (
84
+ <FlatList
85
+ data={cameras}
86
+ keyExtractor={(d) => d.id}
87
+ renderItem={({ item }) => (
88
+ <TouchableOpacity
89
+ onPress={async () => {
90
+ await CometChatCalls.setVideoInputDevice(item.id);
91
+ onClose();
92
+ }}
93
+ accessibilityRole="button"
94
+ accessibilityLabel={`Select ${item.label}`}
95
+ >
96
+ <Text>{item.label || `Camera ${item.id.slice(0, 6)}`}</Text>
97
+ </TouchableOpacity>
98
+ )}
99
+ />
100
+ );
101
+ }
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Anti-patterns
107
+
108
+ Web sister rules apply, plus RN-specific:
109
+
110
+ 1. **Forgetting `InCallManager.stop()` on hangup.** Music + phone audio sound wrong until reboot.
111
+ 2. **Switching cameras mid-call without checking `setVideoInputDevice` await.** SDK queues the switch; switching twice rapidly without awaiting causes the second switch to drop.
112
+ 3. **Skipping permissions check before enumeration.** Empty labels (same as web).
113
+ 4. **Hardcoding speakerphone-on for voice calls.** User holding phone to ear wants earpiece. Default to earpiece for voice; speaker for video.
114
+
115
+ ---
116
+
117
+ ## Verification checklist
118
+
119
+ - [ ] `react-native-incall-manager` installed (it's a peer dep of the kit)
120
+ - [ ] `InCallManager.start({ media: "video"|"audio" })` on call start
121
+ - [ ] `InCallManager.stop()` on call end
122
+ - [ ] `setForceSpeakerphoneOn(true)` for video; `false` for voice
123
+ - [ ] Permissions checked before device enumeration
124
+ - [ ] Real-device smoke: AirPods connect mid-call → audio routes to AirPods
125
+ - [ ] Real-device smoke: speaker toggle on/off works
126
+ - [ ] Hangup smoke: music app's playback resumes correctly after call end
127
+
128
+ ---
129
+
130
+ ## Pointers
131
+
132
+ - `cometchat-react-calls/references/device-management.md` — sister web reference
133
+ - `cometchat-native-calls` SKILL.md — the seven hard rules (rule 1.5 = audio teardown)
134
+ - `references/voip-push-end-to-end.md` — incall manager + callkeep coordination
135
+ - Canonical docs: https://www.cometchat.com/docs/calls/react-native/device-management
@@ -0,0 +1,179 @@
1
+ # Expo managed vs bare RN — calls integration paths
2
+
3
+ Calls require native modules. Expo managed workflows have three states; only two of them can run calls.
4
+
5
+ | Expo state | Calls work? | What the skill does |
6
+ |---|---|---|
7
+ | **Bare RN CLI** | ✓ | Edit native files directly |
8
+ | **Expo + dev client** | ✓ | Config plugins regenerate native projects on prebuild |
9
+ | **Expo Go (the public client)** | ✗ | Skill refuses to scaffold; tells the user to add `expo-dev-client` or eject |
10
+
11
+ ---
12
+
13
+ ## Detect which mode the project is in
14
+
15
+ The skill checks (in order):
16
+
17
+ 1. `app.json` exists with `"expo"` key → Expo project
18
+ 2. `expo-dev-client` in `package.json` deps → has dev client
19
+ 3. `ios/` and `android/` directories committed → bare or prebuild already ran
20
+ 4. `expo-modules-core` in `package.json` → managed
21
+
22
+ The dispatcher branches:
23
+
24
+ - **Bare RN** (no `expo` in app.json): edit `ios/` + `android/` directly. Run `cd ios && pod install` after package install.
25
+ - **Expo + dev client**: write config plugins to `app.json`, run `npx expo prebuild --clean`, the prebuild regenerates `ios/` + `android/` with the calls config baked in.
26
+ - **Expo Go**: print the message below and exit.
27
+
28
+ ---
29
+
30
+ ## Expo Go message
31
+
32
+ When the project is Expo managed without a dev client, the dispatcher prints:
33
+
34
+ > Calls require native modules that Expo Go cannot load (`react-native-callkeep`, `react-native-voip-push-notification`, `react-native-webrtc`). To proceed:
35
+ >
36
+ > **Option A — Add expo-dev-client (recommended for managed projects):**
37
+ > ```bash
38
+ > npx expo install expo-dev-client
39
+ > npx expo prebuild --clean
40
+ > npx expo run:ios # or run:android
41
+ > ```
42
+ > This builds a custom dev client locally. Re-run `/cometchat-calls` after that.
43
+ >
44
+ > **Option B — Eject to bare:**
45
+ > ```bash
46
+ > npx expo prebuild --no-install
47
+ > ```
48
+ > This generates `ios/` + `android/` directories permanently. After this, you're a bare RN project; the calls flow runs normally.
49
+ >
50
+ > **Option C — Use EAS Build:**
51
+ > If you don't want to build locally, EAS can build the dev client for you. Configure `eas.json` profiles, then `eas build --profile development`.
52
+ >
53
+ > Pick one and re-run `/cometchat-calls`.
54
+
55
+ ---
56
+
57
+ ## Config plugins for Expo + dev client
58
+
59
+ The skill writes the following to `app.json` `expo.plugins`:
60
+
61
+ ```json
62
+ {
63
+ "expo": {
64
+ "plugins": [
65
+ [
66
+ "react-native-callkeep",
67
+ {
68
+ "ios": {
69
+ "appName": "YourApp",
70
+ "supportsVideo": true,
71
+ "imageName": "callkit_icon"
72
+ }
73
+ }
74
+ ],
75
+ "@react-native-firebase/app",
76
+ "@react-native-firebase/messaging",
77
+ [
78
+ "expo-build-properties",
79
+ {
80
+ "ios": { "useFrameworks": "static" },
81
+ "android": { "minSdkVersion": 26 }
82
+ }
83
+ ]
84
+ ],
85
+ "ios": {
86
+ "infoPlist": {
87
+ "UIBackgroundModes": ["audio", "voip", "remote-notification"],
88
+ "NSMicrophoneUsageDescription": "So you can talk during voice and video calls.",
89
+ "NSCameraUsageDescription": "So you can be seen during video calls."
90
+ },
91
+ "googleServicesFile": "./GoogleService-Info.plist"
92
+ },
93
+ "android": {
94
+ "permissions": [
95
+ "RECORD_AUDIO",
96
+ "CAMERA",
97
+ "MANAGE_OWN_CALLS",
98
+ "BIND_TELECOM_CONNECTION_SERVICE",
99
+ "FOREGROUND_SERVICE",
100
+ "FOREGROUND_SERVICE_PHONE_CALL",
101
+ "FOREGROUND_SERVICE_MICROPHONE",
102
+ "FOREGROUND_SERVICE_CAMERA",
103
+ "POST_NOTIFICATIONS"
104
+ ],
105
+ "googleServicesFile": "./google-services.json"
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ Then `npx expo prebuild --clean` regenerates `ios/` + `android/` from this config. Re-run after every config change.
112
+
113
+ ---
114
+
115
+ ## EAS Build profile for the dev client
116
+
117
+ `eas.json`:
118
+
119
+ ```json
120
+ {
121
+ "build": {
122
+ "development": {
123
+ "developmentClient": true,
124
+ "distribution": "internal",
125
+ "ios": { "simulator": false },
126
+ "android": { "buildType": "apk" }
127
+ },
128
+ "preview": {
129
+ "distribution": "internal"
130
+ },
131
+ "production": {}
132
+ }
133
+ }
134
+ ```
135
+
136
+ Run `eas build --profile development --platform ios` (or `android`). Wait ~10-15 min, install the resulting `.ipa` / `.apk` to a real device, and `expo start --dev-client` connects to it.
137
+
138
+ **Real device only** for VoIP testing — simulators don't deliver PushKit / FCM VoIP messages.
139
+
140
+ ---
141
+
142
+ ## When to recommend bare over Expo
143
+
144
+ The dispatcher defaults to keeping projects on Expo if they're already there. But for calls specifically, bare can be simpler if:
145
+
146
+ - The project will need many native modules (calls is one of several)
147
+ - The team is comfortable with Xcode + Android Studio
148
+ - They want full control of `Podfile`, `build.gradle`, `Info.plist`
149
+
150
+ Bare's downside: no `expo prebuild` to regenerate from config — every native config change is manual. For most teams, Expo + dev client is the right balance.
151
+
152
+ ---
153
+
154
+ ## File-tree differences
155
+
156
+ Bare:
157
+
158
+ ```
159
+ ios/
160
+ Podfile ← edit directly
161
+ YourApp/Info.plist ← edit directly
162
+ YourApp/AppDelegate.mm ← edit for PushKit registration
163
+ android/
164
+ app/build.gradle ← edit directly
165
+ app/src/main/AndroidManifest.xml
166
+ app/google-services.json ← drop in directly
167
+ ```
168
+
169
+ Expo + dev client:
170
+
171
+ ```
172
+ app.json ← single source of truth (config plugins)
173
+ google-services.json ← root of project
174
+ GoogleService-Info.plist ← root of project
175
+ ios/ ← regenerated by prebuild; DO NOT edit directly
176
+ android/ ← regenerated by prebuild; DO NOT edit directly
177
+ ```
178
+
179
+ The skill is aware of this and writes to `app.json` for Expo, to native files for bare.