@cometchat/skills 4.1.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 (257) hide show
  1. package/bin/install.js +298 -41
  2. package/package.json +1 -1
  3. package/skills/cometchat/SKILL.md +146 -27
  4. package/skills/cometchat-a11y/SKILL.md +476 -0
  5. package/skills/cometchat-android-v5/SKILL.md +1 -1
  6. package/skills/cometchat-android-v5-calls/SKILL.md +413 -0
  7. package/skills/cometchat-android-v5-calls/references/README.md +53 -0
  8. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +195 -0
  9. package/skills/cometchat-android-v5-calls/references/audio-controls.md +91 -0
  10. package/skills/cometchat-android-v5-calls/references/background-handling.md +168 -0
  11. package/skills/cometchat-android-v5-calls/references/call-layouts.md +123 -0
  12. package/skills/cometchat-android-v5-calls/references/call-logs.md +113 -0
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +274 -0
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +150 -0
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +123 -0
  16. package/skills/cometchat-android-v5-calls/references/group-calls.md +205 -0
  17. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +111 -0
  18. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +134 -0
  19. package/skills/cometchat-android-v5-calls/references/join-session.md +120 -0
  20. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +206 -0
  21. package/skills/cometchat-android-v5-calls/references/participant-management.md +110 -0
  22. package/skills/cometchat-android-v5-calls/references/picture-in-picture.md +106 -0
  23. package/skills/cometchat-android-v5-calls/references/raise-hand.md +242 -0
  24. package/skills/cometchat-android-v5-calls/references/recording.md +101 -0
  25. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +152 -0
  26. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +82 -0
  27. package/skills/cometchat-android-v5-calls/references/server-fcm-voip.md +215 -0
  28. package/skills/cometchat-android-v5-calls/references/session-settings.md +121 -0
  29. package/skills/cometchat-android-v5-calls/references/setup.md +137 -0
  30. package/skills/cometchat-android-v5-calls/references/share-invite.md +151 -0
  31. package/skills/cometchat-android-v5-calls/references/video-controls.md +87 -0
  32. package/skills/cometchat-android-v5-calls/references/voip-calling.md +526 -0
  33. package/skills/cometchat-android-v5-components/SKILL.md +1 -1
  34. package/skills/cometchat-android-v5-core/SKILL.md +1 -1
  35. package/skills/cometchat-android-v5-customization/SKILL.md +1 -1
  36. package/skills/cometchat-android-v5-extensions/SKILL.md +1 -1
  37. package/skills/cometchat-android-v5-features/SKILL.md +1 -1
  38. package/skills/cometchat-android-v5-placement/SKILL.md +1 -1
  39. package/skills/cometchat-android-v5-production/SKILL.md +1 -1
  40. package/skills/cometchat-android-v5-push/SKILL.md +1 -1
  41. package/skills/cometchat-android-v5-testing/SKILL.md +1 -1
  42. package/skills/cometchat-android-v5-theming/SKILL.md +1 -1
  43. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +1 -1
  44. package/skills/cometchat-android-v6/SKILL.md +1 -1
  45. package/skills/cometchat-android-v6-builder-settings/SKILL.md +1 -1
  46. package/skills/cometchat-android-v6-calls/SKILL.md +375 -0
  47. package/skills/cometchat-android-v6-calls/references/add-calls-to-existing-chat.md +97 -0
  48. package/skills/cometchat-android-v6-calls/references/call-layouts.md +91 -0
  49. package/skills/cometchat-android-v6-calls/references/call-session.md +163 -0
  50. package/skills/cometchat-android-v6-calls/references/device-management.md +171 -0
  51. package/skills/cometchat-android-v6-calls/references/group-calls.md +191 -0
  52. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +107 -0
  53. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +136 -0
  54. package/skills/cometchat-android-v6-calls/references/raise-hand.md +186 -0
  55. package/skills/cometchat-android-v6-calls/references/ringing-integration.md +176 -0
  56. package/skills/cometchat-android-v6-calls/references/server-fcm-voip.md +127 -0
  57. package/skills/cometchat-android-v6-calls/references/share-invite.md +105 -0
  58. package/skills/cometchat-android-v6-compose-components/SKILL.md +2 -2
  59. package/skills/cometchat-android-v6-compose-customization/SKILL.md +1 -1
  60. package/skills/cometchat-android-v6-compose-placement/SKILL.md +1 -1
  61. package/skills/cometchat-android-v6-compose-theming/SKILL.md +1 -1
  62. package/skills/cometchat-android-v6-core/SKILL.md +1 -1
  63. package/skills/cometchat-android-v6-events/SKILL.md +1 -1
  64. package/skills/cometchat-android-v6-extensions/SKILL.md +1 -1
  65. package/skills/cometchat-android-v6-features/SKILL.md +1 -1
  66. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +1 -1
  67. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +1 -1
  68. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +1 -1
  69. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +1 -1
  70. package/skills/cometchat-android-v6-migration/SKILL.md +398 -0
  71. package/skills/cometchat-android-v6-production/SKILL.md +1 -1
  72. package/skills/cometchat-android-v6-push/SKILL.md +1 -1
  73. package/skills/cometchat-android-v6-testing/SKILL.md +1 -1
  74. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +1 -1
  75. package/skills/cometchat-angular-calls/SKILL.md +511 -0
  76. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +95 -0
  77. package/skills/cometchat-angular-calls/references/call-layouts.md +106 -0
  78. package/skills/cometchat-angular-calls/references/call-session.md +167 -0
  79. package/skills/cometchat-angular-calls/references/custom-ui.md +231 -0
  80. package/skills/cometchat-angular-calls/references/device-management.md +135 -0
  81. package/skills/cometchat-angular-calls/references/group-calls.md +412 -0
  82. package/skills/cometchat-angular-calls/references/idle-timeout.md +145 -0
  83. package/skills/cometchat-angular-calls/references/in-call-chat.md +148 -0
  84. package/skills/cometchat-angular-calls/references/lazy-loading-pitfalls.md +205 -0
  85. package/skills/cometchat-angular-calls/references/migration-v4-to-v5.md +53 -0
  86. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +183 -0
  87. package/skills/cometchat-angular-calls/references/picture-in-picture.md +285 -0
  88. package/skills/cometchat-angular-calls/references/raise-hand.md +167 -0
  89. package/skills/cometchat-angular-calls/references/recording-screen-share.md +267 -0
  90. package/skills/cometchat-angular-calls/references/ringing-integration.md +131 -0
  91. package/skills/cometchat-angular-calls/references/server-web-push-vapid.md +100 -0
  92. package/skills/cometchat-angular-calls/references/share-invite.md +116 -0
  93. package/skills/cometchat-angular-components/SKILL.md +1 -1
  94. package/skills/cometchat-angular-core/SKILL.md +1 -1
  95. package/skills/cometchat-angular-customization/SKILL.md +1 -1
  96. package/skills/cometchat-angular-features/SKILL.md +1 -1
  97. package/skills/cometchat-angular-patterns/SKILL.md +1 -1
  98. package/skills/cometchat-angular-placement/SKILL.md +1 -1
  99. package/skills/cometchat-angular-production/SKILL.md +1 -1
  100. package/skills/cometchat-angular-push/SKILL.md +403 -0
  101. package/skills/cometchat-angular-testing/SKILL.md +333 -0
  102. package/skills/cometchat-angular-theming/SKILL.md +1 -1
  103. package/skills/cometchat-angular-troubleshooting/SKILL.md +1 -1
  104. package/skills/cometchat-astro-patterns/SKILL.md +1 -1
  105. package/skills/cometchat-calls/SKILL.md +358 -0
  106. package/skills/cometchat-calls/references/use-case-broadcast.md +194 -0
  107. package/skills/cometchat-calls/references/use-case-marketplace.md +158 -0
  108. package/skills/cometchat-calls/references/use-case-support.md +190 -0
  109. package/skills/cometchat-calls/references/use-case-team.md +169 -0
  110. package/skills/cometchat-calls/references/use-case-telehealth.md +154 -0
  111. package/skills/cometchat-components/SKILL.md +1 -1
  112. package/skills/cometchat-core/SKILL.md +1 -1
  113. package/skills/cometchat-customization/SKILL.md +2 -2
  114. package/skills/cometchat-features/SKILL.md +2 -2
  115. package/skills/cometchat-flutter-v5/SKILL.md +1 -1
  116. package/skills/cometchat-flutter-v5-calls/SKILL.md +325 -94
  117. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +169 -0
  118. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +98 -0
  119. package/skills/cometchat-flutter-v5-calls/references/call-session.md +330 -0
  120. package/skills/cometchat-flutter-v5-calls/references/device-management.md +120 -0
  121. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +187 -0
  122. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +97 -0
  123. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +132 -0
  124. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +160 -0
  125. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +244 -0
  126. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +193 -0
  127. package/skills/cometchat-flutter-v5-calls/references/server-push-bridge.md +101 -0
  128. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +142 -0
  129. package/skills/cometchat-flutter-v5-conversations/SKILL.md +1 -1
  130. package/skills/cometchat-flutter-v5-core/SKILL.md +1 -1
  131. package/skills/cometchat-flutter-v5-customization/SKILL.md +1 -1
  132. package/skills/cometchat-flutter-v5-events/SKILL.md +1 -1
  133. package/skills/cometchat-flutter-v5-messages/SKILL.md +1 -1
  134. package/skills/cometchat-flutter-v5-production/SKILL.md +1 -1
  135. package/skills/cometchat-flutter-v5-push/SKILL.md +1 -1
  136. package/skills/cometchat-flutter-v5-testing/SKILL.md +390 -0
  137. package/skills/cometchat-flutter-v5-theming/SKILL.md +1 -1
  138. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +1 -1
  139. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +1 -1
  140. package/skills/cometchat-flutter-v6/SKILL.md +1 -1
  141. package/skills/cometchat-flutter-v6-calls/SKILL.md +308 -243
  142. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +134 -0
  143. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +102 -0
  144. package/skills/cometchat-flutter-v6-calls/references/call-session.md +229 -0
  145. package/skills/cometchat-flutter-v6-calls/references/device-management.md +99 -0
  146. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +190 -0
  147. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +80 -0
  148. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +122 -0
  149. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +268 -0
  150. package/skills/cometchat-flutter-v6-calls/references/ringing-integration.md +171 -0
  151. package/skills/cometchat-flutter-v6-calls/references/server-push-bridge.md +93 -0
  152. package/skills/cometchat-flutter-v6-calls/references/share-invite.md +102 -0
  153. package/skills/cometchat-flutter-v6-components/SKILL.md +1 -1
  154. package/skills/cometchat-flutter-v6-conversations/SKILL.md +1 -1
  155. package/skills/cometchat-flutter-v6-core/SKILL.md +1 -1
  156. package/skills/cometchat-flutter-v6-customization/SKILL.md +1 -1
  157. package/skills/cometchat-flutter-v6-events/SKILL.md +1 -1
  158. package/skills/cometchat-flutter-v6-features/SKILL.md +1 -1
  159. package/skills/cometchat-flutter-v6-messages/SKILL.md +1 -1
  160. package/skills/cometchat-flutter-v6-migration/SKILL.md +1 -1
  161. package/skills/cometchat-flutter-v6-placement/SKILL.md +1 -1
  162. package/skills/cometchat-flutter-v6-production/SKILL.md +1 -1
  163. package/skills/cometchat-flutter-v6-push/SKILL.md +452 -0
  164. package/skills/cometchat-flutter-v6-testing/SKILL.md +319 -0
  165. package/skills/cometchat-flutter-v6-theming/SKILL.md +1 -1
  166. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +1 -1
  167. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +1 -1
  168. package/skills/cometchat-i18n/SKILL.md +358 -0
  169. package/skills/cometchat-ios/SKILL.md +5 -5
  170. package/skills/cometchat-ios-calls/SKILL.md +409 -0
  171. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +172 -0
  172. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +189 -0
  173. package/skills/cometchat-ios-calls/references/call-layouts.md +136 -0
  174. package/skills/cometchat-ios-calls/references/call-session.md +221 -0
  175. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +353 -0
  176. package/skills/cometchat-ios-calls/references/custom-ui.md +322 -0
  177. package/skills/cometchat-ios-calls/references/device-management.md +171 -0
  178. package/skills/cometchat-ios-calls/references/group-calls.md +396 -0
  179. package/skills/cometchat-ios-calls/references/idle-timeout.md +185 -0
  180. package/skills/cometchat-ios-calls/references/in-call-chat.md +183 -0
  181. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +138 -0
  182. package/skills/cometchat-ios-calls/references/picture-in-picture.md +246 -0
  183. package/skills/cometchat-ios-calls/references/raise-hand.md +239 -0
  184. package/skills/cometchat-ios-calls/references/recording-screen-share.md +339 -0
  185. package/skills/cometchat-ios-calls/references/ringing-integration.md +142 -0
  186. package/skills/cometchat-ios-calls/references/server-apns-pushkit.md +267 -0
  187. package/skills/cometchat-ios-calls/references/share-invite.md +152 -0
  188. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +246 -0
  189. package/skills/cometchat-ios-calls/references/voip-cert-setup.md +166 -0
  190. package/skills/cometchat-ios-components/SKILL.md +1 -1
  191. package/skills/cometchat-ios-core/SKILL.md +1 -1
  192. package/skills/cometchat-ios-customization/SKILL.md +1 -1
  193. package/skills/cometchat-ios-features/SKILL.md +1 -1
  194. package/skills/cometchat-ios-placement/SKILL.md +1 -1
  195. package/skills/cometchat-ios-production/SKILL.md +1 -1
  196. package/skills/cometchat-ios-push/SKILL.md +1 -1
  197. package/skills/cometchat-ios-testing/SKILL.md +371 -0
  198. package/skills/cometchat-ios-theming/SKILL.md +1 -1
  199. package/skills/cometchat-ios-troubleshooting/SKILL.md +1 -1
  200. package/skills/cometchat-native-bare-patterns/SKILL.md +45 -3
  201. package/skills/cometchat-native-calls/SKILL.md +599 -0
  202. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +203 -0
  203. package/skills/cometchat-native-calls/references/call-layouts.md +124 -0
  204. package/skills/cometchat-native-calls/references/call-session.md +182 -0
  205. package/skills/cometchat-native-calls/references/custom-ui.md +250 -0
  206. package/skills/cometchat-native-calls/references/device-management.md +135 -0
  207. package/skills/cometchat-native-calls/references/expo-vs-bare.md +179 -0
  208. package/skills/cometchat-native-calls/references/group-calls.md +291 -0
  209. package/skills/cometchat-native-calls/references/idle-timeout.md +128 -0
  210. package/skills/cometchat-native-calls/references/in-call-chat.md +143 -0
  211. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +72 -0
  212. package/skills/cometchat-native-calls/references/picture-in-picture.md +276 -0
  213. package/skills/cometchat-native-calls/references/raise-hand.md +203 -0
  214. package/skills/cometchat-native-calls/references/recording-screen-share.md +290 -0
  215. package/skills/cometchat-native-calls/references/ringing-integration.md +118 -0
  216. package/skills/cometchat-native-calls/references/server-push-bridge.md +135 -0
  217. package/skills/cometchat-native-calls/references/server-push-payloads.md +193 -0
  218. package/skills/cometchat-native-calls/references/share-invite.md +144 -0
  219. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +317 -0
  220. package/skills/cometchat-native-components/SKILL.md +1 -1
  221. package/skills/cometchat-native-core/SKILL.md +1 -1
  222. package/skills/cometchat-native-customization/SKILL.md +1 -1
  223. package/skills/cometchat-native-expo-patterns/SKILL.md +18 -1
  224. package/skills/cometchat-native-features/SKILL.md +1 -1
  225. package/skills/cometchat-native-placement/SKILL.md +1 -1
  226. package/skills/cometchat-native-production/SKILL.md +1 -1
  227. package/skills/cometchat-native-push/SKILL.md +1 -1
  228. package/skills/cometchat-native-testing/SKILL.md +1 -1
  229. package/skills/cometchat-native-theming/SKILL.md +1 -1
  230. package/skills/cometchat-native-troubleshooting/SKILL.md +1 -1
  231. package/skills/cometchat-nextjs-patterns/SKILL.md +1 -1
  232. package/skills/cometchat-placement/SKILL.md +1 -1
  233. package/skills/cometchat-production/SKILL.md +1 -1
  234. package/skills/cometchat-react-calls/SKILL.md +539 -0
  235. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +145 -0
  236. package/skills/cometchat-react-calls/references/call-layouts.md +161 -0
  237. package/skills/cometchat-react-calls/references/call-session.md +235 -0
  238. package/skills/cometchat-react-calls/references/custom-ui.md +201 -0
  239. package/skills/cometchat-react-calls/references/device-management.md +206 -0
  240. package/skills/cometchat-react-calls/references/group-calls.md +262 -0
  241. package/skills/cometchat-react-calls/references/idle-timeout.md +175 -0
  242. package/skills/cometchat-react-calls/references/in-call-chat.md +212 -0
  243. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +172 -0
  244. package/skills/cometchat-react-calls/references/picture-in-picture.md +245 -0
  245. package/skills/cometchat-react-calls/references/raise-hand.md +238 -0
  246. package/skills/cometchat-react-calls/references/recording-screen-share.md +143 -0
  247. package/skills/cometchat-react-calls/references/ringing-integration.md +255 -0
  248. package/skills/cometchat-react-calls/references/server-web-push-vapid.md +241 -0
  249. package/skills/cometchat-react-calls/references/share-invite.md +176 -0
  250. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +198 -0
  251. package/skills/cometchat-react-calls/references/voip-and-web-push.md +165 -0
  252. package/skills/cometchat-react-patterns/SKILL.md +1 -1
  253. package/skills/cometchat-react-push/SKILL.md +448 -0
  254. package/skills/cometchat-react-router-patterns/SKILL.md +1 -1
  255. package/skills/cometchat-react-testing/SKILL.md +404 -0
  256. package/skills/cometchat-theming/SKILL.md +3 -3
  257. package/skills/cometchat-troubleshooting/SKILL.md +2 -2
@@ -0,0 +1,185 @@
1
+ # Idle timeout on iOS
2
+
3
+ Same SDK API as web — `idleTimeoutPeriodBeforePrompt` / `idleTimeoutPeriodAfterPrompt` on `CallSettingsBuilder`, `onSessionTimedOut` event. iOS-specific deltas: CallKit interaction (idle timeout doesn't end the OS-level call card automatically; you have to report end to CallKit), foreground/background interplay (iOS can suspend the call session in background), and SwiftUI/UIKit prompt UI.
4
+
5
+ **Canonical docs:** https://www.cometchat.com/docs/calls/ios/idle-timeout
6
+ **Read first:** `cometchat-react-calls/references/idle-timeout.md` — settings + archetype timeouts + Pattern A custom timer.
7
+
8
+ ---
9
+
10
+ ## SDK API
11
+
12
+ ```swift
13
+ import CometChatCallsSDK
14
+
15
+ let settings = CallSettingsBuilder()
16
+ .setSessionType(.video)
17
+ .setIsAudioOnly(false)
18
+ .setIdleTimeoutPeriodBeforePrompt(60_000) // ms
19
+ .setIdleTimeoutPeriodAfterPrompt(120_000)
20
+ .build()
21
+ ```
22
+
23
+ Listener — implement on the `CometChatCallsEventsListener`:
24
+
25
+ ```swift
26
+ class CallListener: NSObject, CometChatCallsEventsListener {
27
+ func onSessionTimedOut() {
28
+ DispatchQueue.main.async {
29
+ // Report end to CallKit (rule 1.5 — hangup cleanup)
30
+ CallManager.shared.endCall(reason: .answeredElsewhere)
31
+ // Navigate away
32
+ }
33
+ }
34
+ // ...
35
+ }
36
+ ```
37
+
38
+ The `CallManager.shared.endCall(reason:)` call is critical — see `references/callkit-and-pushkit.md`. CallKit's call card persists on the lock screen unless you report the end.
39
+
40
+ ---
41
+
42
+ ## CallKit interaction — endCall reason
43
+
44
+ When the SDK fires `onSessionTimedOut`, you must report the call end to CallKit. The reason matters for system UI:
45
+
46
+ ```swift
47
+ let endReason: CXCallEndedReason = .remoteEnded
48
+ // Other options:
49
+ // .failed — error / network issue
50
+ // .remoteEnded — counterparty hung up
51
+ // .unanswered — incoming call not answered
52
+ // .answeredElsewhere — answered on another device
53
+ // .declinedElsewhere — declined on another device
54
+
55
+ provider.reportCall(
56
+ with: callUUID,
57
+ endedAt: Date(),
58
+ reason: endReason,
59
+ )
60
+ ```
61
+
62
+ Use `.remoteEnded` for idle timeout — it's the closest semantic match (the "remote" effectively ended the call by leaving). Don't use `.failed` (implies error; iOS shows a "call failed" UI).
63
+
64
+ ---
65
+
66
+ ## Foreground/background gotcha
67
+
68
+ iOS suspends background JavaScript / WebRTC threads aggressively. If the user backgrounds the app, the call session may pause. The idle timer continues running in the SDK's tracking, but participant-leave events may queue until foreground.
69
+
70
+ Practical implication: idle timeout fires immediately on app return, even if the user only backgrounded for a few seconds. Same as RN.
71
+
72
+ If using CallKit (rule 1.7 in SKILL.md), the background-mode `voip` capability keeps the call alive — but participant tracking may still lag. Test the foreground transition.
73
+
74
+ ---
75
+
76
+ ## Custom prompt — SwiftUI
77
+
78
+ ```swift
79
+ struct IdleTimeoutPrompt: View {
80
+ let onStay: () -> Void
81
+ let onEnd: () -> Void
82
+
83
+ var body: some View {
84
+ VStack(spacing: 16) {
85
+ Text("Still there?")
86
+ .font(.headline)
87
+ Text("You're alone in this call. It'll end in 60 seconds.")
88
+ .multilineTextAlignment(.center)
89
+ .foregroundColor(.secondary)
90
+ HStack(spacing: 12) {
91
+ Button("End now", role: .destructive, action: onEnd)
92
+ .buttonStyle(.bordered)
93
+ Button("Stay", action: onStay)
94
+ .buttonStyle(.borderedProminent)
95
+ }
96
+ }
97
+ .padding(24)
98
+ .background(.regularMaterial, in: RoundedRectangle(cornerRadius: 16))
99
+ .accessibilityElement(children: .contain)
100
+ .accessibilityAddTraits(.isModal)
101
+ }
102
+ }
103
+ ```
104
+
105
+ Used as an overlay:
106
+
107
+ ```swift
108
+ struct CallView: View {
109
+ @State private var showIdlePrompt = false
110
+
111
+ var body: some View {
112
+ ZStack {
113
+ // Call surface
114
+ if showIdlePrompt {
115
+ Color.black.opacity(0.5)
116
+ .ignoresSafeArea()
117
+ .onTapGesture { /* prevent dismiss on backdrop */ }
118
+ IdleTimeoutPrompt(
119
+ onStay: { showIdlePrompt = false; resetIdleTimer() },
120
+ onEnd: { CometChatCallsSDK.CallSession.shared.leaveSession() },
121
+ )
122
+ }
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ `accessibilityAddTraits(.isModal)` is the SwiftUI equivalent of web's `aria-modal="true"`. VoiceOver focus stays trapped within the prompt.
129
+
130
+ ---
131
+
132
+ ## UIKit pattern — UIAlertController
133
+
134
+ For UIKit projects, the simplest path is `UIAlertController`:
135
+
136
+ ```swift
137
+ let alert = UIAlertController(
138
+ title: "Still there?",
139
+ message: "You're alone in this call. It'll end in 60 seconds.",
140
+ preferredStyle: .alert,
141
+ )
142
+ alert.addAction(UIAlertAction(title: "Stay", style: .default) { _ in
143
+ resetIdleTimer()
144
+ })
145
+ alert.addAction(UIAlertAction(title: "End now", style: .destructive) { _ in
146
+ CometChatCallsSDK.CallSession.shared.leaveSession()
147
+ })
148
+ alert.preferredAction = alert.actions.first // make Stay the default
149
+ present(alert, animated: true)
150
+ ```
151
+
152
+ `alert.preferredAction` makes "Stay" the default highlighted action — VoiceOver activates it on triple-click home button as the default response.
153
+
154
+ ---
155
+
156
+ ## Anti-patterns
157
+
158
+ Web sister reference rules apply, plus iOS-specific:
159
+
160
+ 1. **`onSessionTimedOut` without reporting end to CallKit.** Lock-screen call card persists — user sees a stuck "ongoing call" until they manually end it.
161
+ 2. **Using `.failed` reason for idle timeout end.** iOS shows "call failed" — wrong semantic. Use `.remoteEnded`.
162
+ 3. **Custom prompt that doesn't dim background.** Calls UI keeps rendering behind the prompt; user can interact with controls and call ends prematurely.
163
+ 4. **`UIAlertController` from background queue.** Crashes — must be on main. Wrap in `DispatchQueue.main.async`.
164
+
165
+ ---
166
+
167
+ ## Verification checklist
168
+
169
+ - [ ] CallSettingsBuilder sets both idle periods
170
+ - [ ] `onSessionTimedOut` listener reports end to CallKit with `.remoteEnded` reason
171
+ - [ ] Custom prompt uses `accessibilityAddTraits(.isModal)` (SwiftUI) or `UIAlertController.preferredStyle = .alert`
172
+ - [ ] Backdrop dimmed; prevents accidental dismiss
173
+ - [ ] All UIKit alert presentations on main thread
174
+ - [ ] Real-device smoke: 2 iPhones in call, hangup from one → other shows prompt after configured delay
175
+ - [ ] Lock-screen smoke: when call times out, lock-screen card disappears (CallKit reported)
176
+
177
+ ---
178
+
179
+ ## Pointers
180
+
181
+ - `cometchat-react-calls/references/idle-timeout.md` — sister reference (settings, archetype timeouts)
182
+ - `cometchat-ios-calls` SKILL.md
183
+ - `references/callkit-and-pushkit.md` — CallKit reporting end
184
+ - `references/swiftui-uikit-hosting.md` — embedding SwiftUI prompts in UIKit nav
185
+ - Canonical docs: https://www.cometchat.com/docs/calls/ios/idle-timeout
@@ -0,0 +1,183 @@
1
+ # In-call chat on iOS
2
+
3
+ Same SDK shape as web. iOS-specific: `UISheetPresentationController` for the chat sheet (iOS 15+) + AVAudioSession ducking when keyboard is open.
4
+
5
+ **Canonical docs:** https://www.cometchat.com/docs/calls/ios/in-call-chat
6
+ **Read first:** `cometchat-react-calls/references/in-call-chat.md` — group-as-session architecture + anti-patterns.
7
+
8
+ ---
9
+
10
+ ## SDK API
11
+
12
+ ```swift
13
+ import CometChatCallsSDK
14
+ import CometChatSDK
15
+
16
+ let settings = CallSettingsBuilder()
17
+ .setSessionType(.video)
18
+ .setHideChatButton(false)
19
+ .build()
20
+
21
+ // Chat button event — implement in your CometChatCallsEventsListener
22
+ func onChatButtonClicked() {
23
+ DispatchQueue.main.async {
24
+ self.presentChatSheet()
25
+ }
26
+ }
27
+
28
+ // Unread badge
29
+ CometChatCalls.setChatButtonUnreadCount(5)
30
+ CometChatCalls.setChatButtonUnreadCount(0)
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Sheet presentation (iOS 15+)
36
+
37
+ ```swift
38
+ import UIKit
39
+
40
+ class CallViewController: UIViewController {
41
+ func presentChatSheet() {
42
+ let chatVC = InCallChatViewController(sessionId: sessionId)
43
+ let nav = UINavigationController(rootViewController: chatVC)
44
+
45
+ if #available(iOS 15.0, *) {
46
+ if let sheet = nav.sheetPresentationController {
47
+ sheet.detents = [.medium(), .large()]
48
+ sheet.prefersGrabberVisible = true
49
+ sheet.preferredCornerRadius = 16
50
+ }
51
+ }
52
+
53
+ present(nav, animated: true)
54
+ }
55
+ }
56
+ ```
57
+
58
+ `.detents = [.medium(), .large()]` is iOS 15+'s pull-up sheet API. Matches the BottomSheet UX from RN/Flutter.
59
+
60
+ ---
61
+
62
+ ## InCallChatViewController
63
+
64
+ ```swift
65
+ class InCallChatViewController: UIViewController {
66
+ let sessionId: String
67
+ private var group: Group?
68
+ private var listenerId: String!
69
+
70
+ init(sessionId: String) {
71
+ self.sessionId = sessionId
72
+ super.init(nibName: nil, bundle: nil)
73
+ self.title = "Chat"
74
+ }
75
+ required init?(coder: NSCoder) { fatalError() }
76
+
77
+ override func viewDidLoad() {
78
+ super.viewDidLoad()
79
+ listenerId = "in-call-chat-\(sessionId)"
80
+
81
+ Task {
82
+ do {
83
+ group = try await ensureGroup(sessionId: sessionId)
84
+ try await joinGroup(sessionId: sessionId)
85
+ await MainActor.run {
86
+ self.embedMessageList()
87
+ }
88
+ } catch {
89
+ print("Failed to set up in-call chat:", error)
90
+ }
91
+ }
92
+ }
93
+
94
+ override func viewWillDisappear(_ animated: Bool) {
95
+ super.viewWillDisappear(animated)
96
+ // Clear badge on close
97
+ CometChatCalls.setChatButtonUnreadCount(0)
98
+ }
99
+
100
+ private func embedMessageList() {
101
+ guard let group = group else { return }
102
+ // The kit's CometChatMessageList is a UIViewController
103
+ let messageList = CometChatMessageList()
104
+ messageList.group = group
105
+ addChild(messageList)
106
+ view.addSubview(messageList.view)
107
+ // ... AutoLayout pinning to fill view
108
+ messageList.didMove(toParent: self)
109
+
110
+ // Composer
111
+ let composer = CometChatMessageComposer()
112
+ composer.group = group
113
+ addChild(composer)
114
+ view.addSubview(composer.view)
115
+ // ... AutoLayout pinning to bottom
116
+ composer.didMove(toParent: self)
117
+ }
118
+ }
119
+
120
+ func ensureGroup(sessionId: String) async throws -> Group {
121
+ do {
122
+ return try await fetchGroup(sessionId) // CometChat.getGroup wrapper
123
+ } catch {
124
+ let group = Group(guid: sessionId, name: "Call \(sessionId)", groupType: .public, password: "")
125
+ return try await createGroup(group)
126
+ }
127
+ }
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Audio ducking when keyboard opens
133
+
134
+ iOS auto-ducks call audio when the system keyboard opens (the kit handles this). For custom UI you may want to maintain unducked audio for the whole call — explicit override:
135
+
136
+ ```swift
137
+ NotificationCenter.default.addObserver(
138
+ forName: UIResponder.keyboardWillShowNotification,
139
+ object: nil, queue: .main
140
+ ) { _ in
141
+ // Re-assert non-ducking audio category
142
+ try? AVAudioSession.sharedInstance().setCategory(
143
+ .playAndRecord,
144
+ mode: .voiceChat,
145
+ options: [.allowBluetooth, .defaultToSpeaker]
146
+ )
147
+ }
148
+ ```
149
+
150
+ Most apps don't need this; the kit's defaults are sensible. Override only if user testing surfaces the audio ducking as confusing.
151
+
152
+ ---
153
+
154
+ ## Anti-patterns
155
+
156
+ Web sister rules apply, plus iOS-specific:
157
+
158
+ 1. **`UIAlertController` instead of sheet for in-call chat.** Wrong UX — `UIAlertController` is for confirmations, not extended UIs.
159
+ 2. **`present(nav, animated: true)` from background queue.** Crash. Always main queue (covered by `DispatchQueue.main.async` in `onChatButtonClicked`).
160
+ 3. **Mutating `group` from background.** `group` updates must be on main; `Task { @MainActor in ... }` or `DispatchQueue.main.async`.
161
+ 4. **Forgetting `dismiss(animated: true)` on call end.** Sheet stays up over the post-call screen — looks broken.
162
+
163
+ ---
164
+
165
+ ## Verification checklist
166
+
167
+ - [ ] `setHideChatButton(false)` in CallSettings
168
+ - [ ] `onChatButtonClicked` presents the chat sheet on main queue
169
+ - [ ] `UISheetPresentationController` with `[.medium(), .large()]` detents (iOS 15+)
170
+ - [ ] `CometChatMessageList` + `CometChatMessageComposer` embedded as child VCs
171
+ - [ ] Sheet dismissed on call end
172
+ - [ ] Real-device smoke: 2 iPhones in call, send message → badge in other
173
+ - [ ] Sheet drag-down dismisses cleanly
174
+ - [ ] Lock-screen smoke: backgrounded → return → chat sheet still visible if open
175
+
176
+ ---
177
+
178
+ ## Pointers
179
+
180
+ - `cometchat-react-calls/references/in-call-chat.md` — sister web reference (group-as-session pattern)
181
+ - `cometchat-ios-calls` SKILL.md — the seven hard rules
182
+ - `references/swiftui-uikit-hosting.md` — embedding SwiftUI sheets
183
+ - Canonical docs: https://www.cometchat.com/docs/calls/ios/in-call-chat
@@ -0,0 +1,138 @@
1
+ # CometChat Calls iOS SDK v4 → v5 migration
2
+
3
+ `CometChatCallsSDK` v5 is a drop-in upgrade for v4 — bump the SwiftPM/CocoaPods version, your existing call code still compiles. Migrate to v5 APIs for granular events + simpler init.
4
+
5
+ **Canonical docs:** https://www.cometchat.com/docs/calls/ios/migration-guide-v5
6
+
7
+ ---
8
+
9
+ ## Step 1 — Bump the SDK
10
+
11
+ **SwiftPM:** Update the `CometChatCallsSDK` package version pin to `5.0.0` or higher.
12
+
13
+ **CocoaPods:**
14
+ ```ruby
15
+ # Podfile
16
+ pod 'CometChatCallsSDK', '~> 5.0'
17
+ ```
18
+
19
+ ```bash
20
+ pod install --repo-update
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Step 2 — Migrate init to plain struct
26
+
27
+ ```diff
28
+ - let callAppSettings = CallAppSettings.Builder()
29
+ - .setAppId("APP_ID")
30
+ - .setRegion("REGION")
31
+ - .build()
32
+ - CometChatCalls.init(with: callAppSettings) { error in
33
+ - // ...
34
+ - }
35
+
36
+ + let settings = CallAppSettings(appId: "APP_ID", region: "REGION")
37
+ + try await CometChatCalls.init(with: settings)
38
+ ```
39
+
40
+ V5 ships async/await. The completion-handler form still works for backwards compat.
41
+
42
+ ---
43
+
44
+ ## Step 3 — Add Calls SDK login
45
+
46
+ ```swift
47
+ // After CometChat.login() resolves with a User:
48
+ let authToken = user.authToken
49
+ try await CometChatCalls.login(authToken: authToken)
50
+ ```
51
+
52
+ After this, `generateToken()` and `joinSession()` no longer need an authToken parameter.
53
+
54
+ ---
55
+
56
+ ## Step 4 — Migrate session settings
57
+
58
+ ```diff
59
+ - let callSettings = CallSettings.Builder()
60
+ - .setSessionType(.video)
61
+ - .startWithAudioMuted(false)
62
+ - .showRecordingButton(true)
63
+ - .build()
64
+
65
+ + let sessionSettings = SessionSettings(
66
+ + sessionType: .video,
67
+ + startAudioMuted: false,
68
+ + hideRecordingButton: false, // INVERTED — was showRecordingButton(true)
69
+ + layout: .tile
70
+ + )
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Step 5 — Migrate events to delegates / closures
76
+
77
+ ```diff
78
+ - // v4: implementing CometChatCallsEventsListener with all callbacks
79
+ - class MyCallEvents: CometChatCallsEventsListener {
80
+ - func onCallEnded() { /* ... */ }
81
+ - func onUserJoined(user: User) { /* ... */ }
82
+ - func onUserLeft(user: User) { /* ... */ }
83
+ - func onError(error: Error) { /* ... */ }
84
+ - }
85
+
86
+ + // v5: granular subscriptions
87
+ + let unsub1 = CometChatCalls.addEventListener(.sessionLeft) { _ in /* ... */ }
88
+ + let unsub2 = CometChatCalls.addEventListener(.participantJoined) { participant in /* ... */ }
89
+ + let unsub3 = CometChatCalls.addEventListener(.participantLeft) { participant in /* ... */ }
90
+ +
91
+ + // Cleanup
92
+ + deinit { unsub1(); unsub2(); unsub3() }
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Step 6 — Method renames
98
+
99
+ ```diff
100
+ // session lifecycle — receiver changed from CometChatCalls (static) to CallSession.shared (singleton)
101
+ - CometChatCalls.endSession()
102
+ + CallSession.shared.leaveSession()
103
+
104
+ - CometChatCalls.muteAudio(true)
105
+ + CallSession.shared.muteAudio()
106
+ - CometChatCalls.muteAudio(false)
107
+ + CallSession.shared.unmuteAudio()
108
+
109
+ - CometChatCalls.startScreenShare()
110
+ + CallSession.shared.startScreenShare()
111
+
112
+ // layout stays static on CometChatCalls
113
+ - CometChatCalls.setMode(mode)
114
+ + CometChatCalls.setLayout(layout)
115
+ ```
116
+
117
+ **Hold onto the `CallSession.shared` singleton** — most in-call APIs (mute, video, screen-share, layout-events, leave) live on it, not on `CometChatCalls`. Same shift the Android SDK did in v5; if you've been writing call code against v4's static-method-everything pattern, this is the biggest re-org.
118
+
119
+ ---
120
+
121
+ ## Verification checklist
122
+
123
+ - [ ] Podfile / Package.swift updated
124
+ - [ ] `pod install --repo-update` (CocoaPods) or SwiftPM resolved cleanly
125
+ - [ ] `CometChatCalls.login(authToken:)` called after `CometChat.login`
126
+ - [ ] CallSettings.Builder replaced with `SessionSettings` struct
127
+ - [ ] CometChatCallsEventsListener replaced with `addEventListener`
128
+ - [ ] Method renames applied
129
+ - [ ] PushKit + CallKit integration still works (no v5 changes there)
130
+ - [ ] Real-device smoke: incoming call from iPhone → answer → mute → end
131
+
132
+ ---
133
+
134
+ ## Pointers
135
+
136
+ - Canonical migration: https://www.cometchat.com/docs/calls/ios/migration-guide-v5
137
+ - `cometchat-ios-calls/SKILL.md` — seven hard rules (still apply post-v5)
138
+ - `cometchat-ios-calls/references/server-apns-pushkit.md` — PushKit setup (unchanged in v5)