@cometchat/skills 4.3.0 → 4.4.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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/bin/install.js +27 -0
  3. package/package.json +14 -1
  4. package/skills/cometchat/SKILL.md +233 -69
  5. package/skills/cometchat/references/asking-questions.md +48 -0
  6. package/skills/cometchat-a11y/SKILL.md +3 -2
  7. package/skills/cometchat-android-v5/SKILL.md +2 -1
  8. package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
  9. package/skills/cometchat-android-v5-calls/references/README.md +1 -1
  10. package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
  11. package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
  12. package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
  13. package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
  14. package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
  15. package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
  16. package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
  17. package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
  18. package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
  19. package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
  20. package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
  21. package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
  22. package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
  23. package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
  24. package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
  25. package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
  26. package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
  27. package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
  28. package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
  29. package/skills/cometchat-android-v5-components/SKILL.md +4 -3
  30. package/skills/cometchat-android-v5-core/SKILL.md +5 -3
  31. package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
  32. package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
  33. package/skills/cometchat-android-v5-features/SKILL.md +5 -4
  34. package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
  35. package/skills/cometchat-android-v5-production/SKILL.md +2 -1
  36. package/skills/cometchat-android-v5-push/SKILL.md +2 -3
  37. package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
  38. package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
  39. package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
  40. package/skills/cometchat-android-v6/SKILL.md +2 -1
  41. package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
  42. package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
  43. package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
  44. package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
  45. package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
  46. package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
  47. package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
  48. package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
  49. package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
  50. package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
  51. package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
  52. package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
  53. package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
  54. package/skills/cometchat-android-v6-core/SKILL.md +208 -28
  55. package/skills/cometchat-android-v6-events/SKILL.md +4 -1
  56. package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
  57. package/skills/cometchat-android-v6-features/SKILL.md +26 -2
  58. package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
  59. package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
  60. package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
  61. package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
  62. package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
  63. package/skills/cometchat-android-v6-production/SKILL.md +6 -3
  64. package/skills/cometchat-android-v6-push/SKILL.md +43 -2
  65. package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
  66. package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
  67. package/skills/cometchat-angular-calls/SKILL.md +256 -389
  68. package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
  69. package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
  70. package/skills/cometchat-angular-calls/references/call-session.md +2 -2
  71. package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
  72. package/skills/cometchat-angular-calls/references/device-management.md +53 -34
  73. package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
  74. package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
  75. package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
  76. package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
  77. package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
  78. package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
  79. package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
  80. package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
  81. package/skills/cometchat-angular-components/SKILL.md +149 -620
  82. package/skills/cometchat-angular-core/SKILL.md +232 -312
  83. package/skills/cometchat-angular-customization/SKILL.md +415 -223
  84. package/skills/cometchat-angular-features/SKILL.md +216 -334
  85. package/skills/cometchat-angular-patterns/SKILL.md +168 -359
  86. package/skills/cometchat-angular-placement/SKILL.md +189 -560
  87. package/skills/cometchat-angular-production/SKILL.md +241 -92
  88. package/skills/cometchat-angular-push/SKILL.md +280 -294
  89. package/skills/cometchat-angular-testing/SKILL.md +430 -158
  90. package/skills/cometchat-angular-theming/SKILL.md +190 -265
  91. package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
  92. package/skills/cometchat-astro-patterns/SKILL.md +2 -1
  93. package/skills/cometchat-calls/SKILL.md +25 -19
  94. package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
  95. package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
  96. package/skills/cometchat-calls/references/use-case-support.md +3 -4
  97. package/skills/cometchat-calls/references/use-case-team.md +23 -12
  98. package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
  99. package/skills/cometchat-components/SKILL.md +163 -25
  100. package/skills/cometchat-core/SKILL.md +255 -19
  101. package/skills/cometchat-customization/SKILL.md +50 -25
  102. package/skills/cometchat-features/SKILL.md +313 -34
  103. package/skills/cometchat-flutter-v5/SKILL.md +10 -4
  104. package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
  105. package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
  106. package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
  107. package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
  108. package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
  109. package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
  110. package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
  111. package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
  112. package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
  113. package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
  114. package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
  115. package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
  116. package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
  117. package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
  118. package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
  119. package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
  120. package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
  121. package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
  122. package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
  123. package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
  124. package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
  125. package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
  126. package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
  127. package/skills/cometchat-flutter-v6/SKILL.md +17 -16
  128. package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
  129. package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
  130. package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
  131. package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
  132. package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
  133. package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
  134. package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
  135. package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
  136. package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
  137. package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
  138. package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
  139. package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
  140. package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
  141. package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
  142. package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
  143. package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
  144. package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
  145. package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
  146. package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
  147. package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
  148. package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
  149. package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
  150. package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
  151. package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
  152. package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
  153. package/skills/cometchat-i18n/SKILL.md +139 -78
  154. package/skills/cometchat-ios/SKILL.md +4 -2
  155. package/skills/cometchat-ios-calls/SKILL.md +225 -95
  156. package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
  157. package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
  158. package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
  159. package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
  160. package/skills/cometchat-ios-calls/references/call-session.md +51 -54
  161. package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
  162. package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
  163. package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
  164. package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
  165. package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
  166. package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
  167. package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
  168. package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
  169. package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
  170. package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
  171. package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
  172. package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
  173. package/skills/cometchat-ios-components/SKILL.md +200 -12
  174. package/skills/cometchat-ios-core/SKILL.md +173 -45
  175. package/skills/cometchat-ios-customization/SKILL.md +276 -110
  176. package/skills/cometchat-ios-features/SKILL.md +64 -36
  177. package/skills/cometchat-ios-placement/SKILL.md +15 -12
  178. package/skills/cometchat-ios-production/SKILL.md +12 -4
  179. package/skills/cometchat-ios-push/SKILL.md +53 -19
  180. package/skills/cometchat-ios-testing/SKILL.md +14 -9
  181. package/skills/cometchat-ios-theming/SKILL.md +39 -3
  182. package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
  183. package/skills/cometchat-native-bare-patterns/SKILL.md +34 -17
  184. package/skills/cometchat-native-calls/SKILL.md +28 -16
  185. package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
  186. package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
  187. package/skills/cometchat-native-calls/references/call-session.md +2 -2
  188. package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
  189. package/skills/cometchat-native-calls/references/device-management.md +53 -30
  190. package/skills/cometchat-native-calls/references/group-calls.md +35 -30
  191. package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
  192. package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
  193. package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
  194. package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
  195. package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
  196. package/skills/cometchat-native-calls/references/share-invite.md +7 -5
  197. package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
  198. package/skills/cometchat-native-components/SKILL.md +84 -52
  199. package/skills/cometchat-native-core/SKILL.md +101 -32
  200. package/skills/cometchat-native-customization/SKILL.md +150 -28
  201. package/skills/cometchat-native-expo-patterns/SKILL.md +57 -26
  202. package/skills/cometchat-native-features/SKILL.md +23 -16
  203. package/skills/cometchat-native-placement/SKILL.md +19 -10
  204. package/skills/cometchat-native-production/SKILL.md +9 -3
  205. package/skills/cometchat-native-push/SKILL.md +2 -1
  206. package/skills/cometchat-native-testing/SKILL.md +1 -2
  207. package/skills/cometchat-native-theming/SKILL.md +54 -29
  208. package/skills/cometchat-native-troubleshooting/SKILL.md +9 -3
  209. package/skills/cometchat-nextjs-patterns/SKILL.md +20 -6
  210. package/skills/cometchat-placement/SKILL.md +42 -3
  211. package/skills/cometchat-production/SKILL.md +12 -5
  212. package/skills/cometchat-react-calls/SKILL.md +220 -10
  213. package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
  214. package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
  215. package/skills/cometchat-react-calls/references/call-session.md +1 -1
  216. package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
  217. package/skills/cometchat-react-calls/references/device-management.md +55 -51
  218. package/skills/cometchat-react-calls/references/group-calls.md +18 -23
  219. package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
  220. package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
  221. package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
  222. package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
  223. package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
  224. package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
  225. package/skills/cometchat-react-calls/references/share-invite.md +4 -5
  226. package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
  227. package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
  228. package/skills/cometchat-react-patterns/SKILL.md +44 -4
  229. package/skills/cometchat-react-push/SKILL.md +258 -72
  230. package/skills/cometchat-react-router-patterns/SKILL.md +10 -4
  231. package/skills/cometchat-react-testing/SKILL.md +14 -5
  232. package/skills/cometchat-theming/SKILL.md +181 -18
  233. package/skills/cometchat-troubleshooting/SKILL.md +40 -20
@@ -1,9 +1,8 @@
1
1
  # Call layouts on iOS
2
2
 
3
- Same three layouts (TILE/SIDEBAR/SPOTLIGHT). iOS-specific: `UISegmentedControl` is the native pattern for the switcher; layout selection persists across the app via `UserDefaults`.
3
+ The iOS Calls SDK v5 exposes layout via the `DisplayModes` enum (swiftinterface:175 — `.default` / `.single` / `.spotlight`), passed ONCE at session start via `CallSettingsBuilder.setMode(_:)`. The current setter is `setMode(_ value: DisplayModes) -> Self` (swiftinterface:281); the `setMode(_ value: NSString)` string overload (swiftinterface:280) is DEPRECATED — prefer the typed enum. There is no `CallLayout` type, no runtime `setLayout`, no `setHideChangeLayoutButton`, and no `onCallLayoutChanged` callback. To change layout you must end and restart the session with a different `setMode`.
4
4
 
5
5
  **Canonical docs:** https://www.cometchat.com/docs/calls/ios/call-layouts
6
- **Read first:** `cometchat-react-calls/references/call-layouts.md` — layout matrix.
7
6
 
8
7
  ---
9
8
 
@@ -13,124 +12,65 @@ Same three layouts (TILE/SIDEBAR/SPOTLIGHT). iOS-specific: `UISegmentedControl`
13
12
  import CometChatCallsSDK
14
13
 
15
14
  let settings = CallSettingsBuilder()
16
- .setSessionType(.video)
17
- .setLayout(.tile) // .tile | .sidebar | .spotlight
18
- .setHideChangeLayoutButton(false)
15
+ .setIsAudioOnly(false)
16
+ .setMode(.default) // swiftinterface:281 setMode(_ value: DisplayModes) -> Self
19
17
  .build()
20
-
21
- // Mid-call switch
22
- CometChatCalls.setLayout(.spotlight)
23
-
24
- // Listen
25
- class CallEvents: CometChatCallsEventsListener {
26
- func onCallLayoutChanged(layout: CallLayout) {
27
- DispatchQueue.main.async {
28
- // Update UI
29
- }
30
- }
31
- }
32
18
  ```
33
19
 
34
- ---
35
-
36
- ## SwiftUI switcher
20
+ `setMode` takes a `DisplayModes` value:
37
21
 
38
- ```swift
39
- import SwiftUI
40
-
41
- enum CallLayoutPicker: String, CaseIterable, Identifiable {
42
- case tile = "Tile"
43
- case sidebar = "Sidebar"
44
- case spotlight = "Spotlight"
45
- var id: String { rawValue }
46
-
47
- var sdkLayout: CallLayout {
48
- switch self {
49
- case .tile: return .tile
50
- case .sidebar: return .sidebar
51
- case .spotlight: return .spotlight
52
- }
53
- }
54
- }
55
-
56
- struct LayoutSwitcher: View {
57
- @State private var selection: CallLayoutPicker = .tile
58
-
59
- var body: some View {
60
- Picker("Layout", selection: $selection) {
61
- ForEach(CallLayoutPicker.allCases) { opt in
62
- Text(opt.rawValue).tag(opt)
63
- }
64
- }
65
- .pickerStyle(.segmented)
66
- .accessibilityLabel("Call layout")
67
- .onChange(of: selection) { _, new in
68
- CometChatCalls.setLayout(new.sdkLayout)
69
- }
70
- }
71
- }
72
- ```
22
+ | Value | Meaning |
23
+ |---|---|
24
+ | `.default` | Standard grid of participant tiles |
25
+ | `.single` | One participant fills the surface |
26
+ | `.spotlight` | Active speaker enlarged, others as a strip |
73
27
 
74
- `Picker(.segmented)` renders as `UISegmentedControl`, which is the iOS-native expected pattern for radio-group selection.
28
+ > **There is no runtime layout switch.** `CometChatCalls` has no `setLayout`/`setMode` instance/static method that re-lays-out a live session. `setMode(_:)` exists only on `CallSettingsBuilder` and only takes effect at `startSession`. If you need to offer a switcher, tear down and restart the session with new settings (expensive — most apps just pick one mode).
75
29
 
76
30
  ---
77
31
 
78
- ## Persisting the user's preference
32
+ ## Picking a layout at session start
79
33
 
80
34
  ```swift
81
- extension UserDefaults {
82
- var preferredCallLayout: CallLayout {
83
- get {
84
- switch string(forKey: "preferredCallLayout") {
85
- case "sidebar": return .sidebar
86
- case "spotlight": return .spotlight
87
- default: return .tile
88
- }
89
- }
90
- set {
91
- let str: String = {
92
- switch newValue {
93
- case .tile: return "tile"
94
- case .sidebar: return "sidebar"
95
- case .spotlight: return "spotlight"
96
- @unknown default: return "tile"
97
- }
98
- }()
99
- set(str, forKey: "preferredCallLayout")
100
- }
35
+ // Read a persisted preference and map it to a DisplayModes value before startSession:
36
+ let stored = UserDefaults.standard.string(forKey: "preferredDisplayMode") ?? "default"
37
+ let mode: DisplayModes = {
38
+ switch stored {
39
+ case "single": return .single
40
+ case "spotlight": return .spotlight
41
+ default: return .default
101
42
  }
102
- }
103
-
104
- // In your CallViewController:
43
+ }()
105
44
  let settings = CallSettingsBuilder()
106
- .setLayout(UserDefaults.standard.preferredCallLayout)
45
+ .setMode(mode)
107
46
  .build()
47
+ // ... generateToken → startSession(callToken:callSetting:view:) ...
108
48
  ```
109
49
 
50
+ A SwiftUI `Picker(.segmented)` over the three modes is a fine way to capture the preference BEFORE the call starts (on a pre-join screen). It cannot drive a live re-layout.
51
+
110
52
  ---
111
53
 
112
54
  ## Anti-patterns
113
55
 
114
- Web sister rules apply, plus iOS-specific:
115
-
116
- 1. **`Picker(.menu)` instead of `.segmented`.** Wrong UX — menu hides the options, segmented shows them. For 3 options, segmented is the iOS norm.
117
- 2. **`onChange` on background queue.** Crash. SwiftUI's `onChange` is on main but if you bridge through Combine make sure to `.receive(on: DispatchQueue.main)`.
118
- 3. **Forgetting to `.accessibilityLabel`.** VoiceOver announces "Picker" with no context.
56
+ 1. **`CallLayout` / `.tile` / `.sidebar`.** Don't exist on iOS v5. `setMode` takes a `DisplayModes` value (`.default`/`.single`/`.spotlight`, swiftinterface:175). The deprecated `setMode(_ value: NSString)` string overload still exists but prefer the typed enum.
57
+ 2. **`CometChatCalls.setLayout(...)` mid-call.** No such method. Layout is fixed at `startSession`.
58
+ 3. **Implementing `onCallLayoutChanged` on the delegate.** Not a callback on `CallsEventsDelegate`. There is no layout-change event.
59
+ 4. **`setHideChangeLayoutButton(_:)`.** Not a `CallSettingsBuilder` method.
119
60
 
120
61
  ---
121
62
 
122
63
  ## Verification checklist
123
64
 
124
- - [ ] Initial layout via `setLayout` on builder
125
- - [ ] SwiftUI `Picker(.segmented)` for switcher
126
- - [ ] Layout listener implemented in `CometChatCallsEventsListener`
65
+ - [ ] Layout set via `CallSettingsBuilder.setMode(_:)` with a `DisplayModes` value (`.default`/`.single`/`.spotlight`)
66
+ - [ ] No `CallLayout`, `.tile`, `.sidebar`, `setLayout`, `onCallLayoutChanged`, or `setHideChangeLayoutButton` anywhere
67
+ - [ ] Any preference UI captured BEFORE `startSession` (no live switch attempted)
127
68
  - [ ] User preference persisted via `UserDefaults` if desired
128
- - [ ] Real-device smoke: switcher cycles all 3, persists across calls
129
69
 
130
70
  ---
131
71
 
132
72
  ## Pointers
133
73
 
134
- - `cometchat-react-calls/references/call-layouts.md` — sister
74
+ - `cometchat-react-calls/references/call-layouts.md` — sister (web exposes more layout control)
135
75
  - `cometchat-ios-calls` SKILL.md
136
76
  - Canonical docs: https://www.cometchat.com/docs/calls/ios/call-layouts
@@ -1,6 +1,6 @@
1
- # Call session — joinSession with no ringing (iOS)
1
+ # Call session — no ringing (iOS)
2
2
 
3
- Server-generated sessionId, both parties enter it. Customer-validated against `~/Downloads/calls-sdk/calls-sdk-ios-5/sample-apps/cometchat-calls-sample-app-ios/CometChatCallsSample/CallView.swift`.
3
+ Server-generated sessionId, both parties enter it. Customer-validated against `calls-sdk-ios-5/sample-apps/cometchat-calls-sample-app-ios/CometChatCallsSample/CallView.swift`.
4
4
 
5
5
  **Read first:** `cometchat-react-calls/references/call-session.md` — cross-platform architecture (sessionId strategies, server-side authorization). Then come back here for the iOS shape.
6
6
 
@@ -10,10 +10,10 @@ Server-generated sessionId, both parties enter it. Customer-validated against `~
10
10
 
11
11
  ## Hard rules (iOS-specific overrides on top of the cross-platform rules)
12
12
 
13
- 1. **Use the `joinSession(sessionID:callSetting:container:onSuccess:onError:)` convenience method.** It handles token generation internally you do NOT need to call `generateToken` separately. Matches the upstream sample exactly.
14
- 2. **`SessionSettingsBuilder()` is the canonical settings shape** (chained `.setTitle().startVideoPaused(false).startAudioMuted(false).build()`). NOT `SessionSettings(sessionType:layout:)` that initializer is the chat-side type.
15
- 3. **`SessionStatusListener` protocol on a Coordinator object**, registered against `CometChatCallsSDK.CallSession.shared.addSessionStatusListener(...)`. NOT raw `CometChatCalls.addEventListener(.sessionLeft)` that does not exist on iOS.
16
- 4. **`onSessionLeft`, `onConnectionClosed`, `onSessionTimedOut` all trigger UI dismiss.** All three are real termination paths; ignoring any of them leaves the call view stranded.
13
+ 1. **Two-step session start: `generateToken` then `startSession`.** `CometChatCalls.generateToken(authToken:sessionID:onSuccess:onError:)` returns a call token; pass it to `CometChatCalls.startSession(callToken:callSetting:view:onSuccess:onError:)`. There is NO `joinSession` convenience method on the iOS Calls SDK v5.
14
+ 2. **`CallSettingsBuilder()` is the canonical settings shape** (chained `.setIsAudioOnly(false).setStartVideoMuted(false).setStartAudioMuted(false).setDelegate(coordinator).build()`). There is NO `SessionSettings` or `SessionSettingsBuilder` type.
15
+ 3. **`CallsEventsDelegate` protocol on a Coordinator object**, set via `CallSettingsBuilder.setDelegate(_:)` or registered with `CometChatCalls.addCallEventListener(observerId:delegate:)`. There is NO `SessionStatusListener`, NO `ButtonClickListener`, NO `CometChatCallsEventsListener`, and NO `addEventListener(.sessionLeft)`.
16
+ 4. **`onCallEnded` and `onCallEndButtonPressed` trigger UI dismiss.** These are the real termination callbacks; ignoring either leaves the call view stranded. `CallsEventsDelegate` ALSO has an optional `onSessionTimeout()` callback (swiftinterface:30) that fires when the idle timeout set via `CallSettingsBuilder.setIdleTimeoutPeriod(_:)` elapses — handle it for dismiss/cleanup too. See `references/idle-timeout.md`.
17
17
  5. **For standalone session-only integrations, the Chat SDK is OPTIONAL.** The upstream iOS sample never imports `CometChatSDK` (the chat SDK). Keep `CometChat.init` / `CometChat.login` only for additive (chat + calls) integrations.
18
18
  6. **`AVAudioSession` activated with `.playAndRecord` + `.voiceChat`** — `.playback` mode captures NO mic input.
19
19
 
@@ -71,58 +71,55 @@ struct CallContainerView: UIViewRepresentable {
71
71
  }
72
72
 
73
73
  private func startSession(container: UIView, coordinator: Coordinator) {
74
- let settings = SessionSettingsBuilder()
75
- .setTitle("CometChat Meeting")
76
- .startVideoPaused(false)
77
- .startAudioMuted(false)
74
+ let settings = CallSettingsBuilder()
75
+ .setIsAudioOnly(false)
76
+ .setStartVideoMuted(false)
77
+ .setStartAudioMuted(false)
78
+ .setDelegate(coordinator) // CallsEventsDelegate — set here, on the builder
78
79
  .build()
79
80
 
80
- // The convenience joinSession(sessionID:) generates the token internally.
81
- // No separate generateToken call needed.
82
- CometChatCalls.joinSession(
83
- sessionID: sessionID,
84
- callSetting: settings,
85
- container: container
86
- ) { success in
87
- let session = CometChatCallsSDK.CallSession.shared
88
- session.addSessionStatusListener(coordinator)
89
- session.addButtonClickListener(coordinator)
81
+ // Two-step: generateToken THEN startSession. There is no joinSession convenience.
82
+ // authToken is nil for session-only apps (Calls SDK derives it server-side from the
83
+ // session); pass CometChat.getUserAuthToken() in additive (chat + calls) integrations.
84
+ CometChatCalls.generateToken(authToken: nil, sessionID: sessionID) { token in
85
+ guard let token = token else {
86
+ DispatchQueue.main.async { onError("Failed to generate call token") }
87
+ return
88
+ }
89
+ CometChatCalls.startSession(
90
+ callToken: token,
91
+ callSetting: settings,
92
+ view: container
93
+ ) { _ in
94
+ // session started — delegate already wired via setDelegate
95
+ } onError: { error in
96
+ DispatchQueue.main.async {
97
+ onError(error?.errorDescription ?? "Failed to start call")
98
+ }
99
+ }
90
100
  } onError: { error in
91
101
  DispatchQueue.main.async {
92
- onError(error?.errorDescription ?? "Failed to join call")
102
+ onError(error?.errorDescription ?? "Failed to generate call token")
93
103
  }
94
104
  }
95
105
  }
96
106
 
97
- class Coordinator: NSObject, SessionStatusListener, ButtonClickListener {
107
+ class Coordinator: NSObject, CallsEventsDelegate {
98
108
  let onEnd: () -> Void
99
109
 
100
110
  init(onEnd: @escaping () -> Void) {
101
111
  self.onEnd = onEnd
102
112
  }
103
113
 
104
- // --- SessionStatusListener ---
105
- func onSessionJoined() {}
106
-
107
- func onSessionLeft() {
114
+ // --- CallsEventsDelegate (all @objc optional) ---
115
+ func onCallEnded() {
108
116
  DispatchQueue.main.async { self.onEnd() }
109
117
  }
110
118
 
111
- func onConnectionClosed() {
119
+ func onCallEndButtonPressed() {
120
+ CometChatCalls.endSession() // EXISTS on the static facade
112
121
  DispatchQueue.main.async { self.onEnd() }
113
122
  }
114
-
115
- func onSessionTimedOut() {
116
- DispatchQueue.main.async { self.onEnd() }
117
- }
118
-
119
- func onConnectionLost() {}
120
- func onConnectionRestored() {}
121
-
122
- // --- ButtonClickListener ---
123
- func onLeaveSessionButtonClicked() {
124
- CometChatCallsSDK.CallSession.shared.leaveSession()
125
- }
126
123
  }
127
124
  }
128
125
  ```
@@ -130,9 +127,9 @@ struct CallContainerView: UIViewRepresentable {
130
127
  **Why this shape:**
131
128
 
132
129
  - **`UIViewRepresentable` bridging a `UIView` container**, not a raw SwiftUI view — the SDK draws into a `UIView` it owns and lays out internally. SwiftUI can't host that directly.
133
- - **`joinSession(sessionID:callSetting:container:)` convenience**generates the call token internally. No need for `CometChatCalls.generateToken(forSession:)` then `joinSession(callToken:)` two-step. The sample uses this and so should every customer.
134
- - **`SessionSettingsBuilder().build()`** — chained builder ending in `.build()`. The non-builder `SessionSettings(sessionType:layout:)` is the chat-side type and rejects at runtime.
135
- - **`Coordinator` implements `SessionStatusListener` AND `ButtonClickListener`** — register both against `CallSession.shared` AFTER `onSuccess` fires. Don't register against `CometChatCalls` that's not where the events live.
130
+ - **`generateToken` then `startSession`** — the iOS Calls SDK v5 has no single-call `joinSession`. Generate the call token, then start the session into the container `UIView`.
131
+ - **`CallSettingsBuilder().build()`** — chained builder ending in `.build()` returning `CallSettings`. There is no `SessionSettings`/`SessionSettingsBuilder` type.
132
+ - **`Coordinator` implements `CallsEventsDelegate`** — wired via `setDelegate(_:)` on the builder. There is no `SessionStatusListener`/`ButtonClickListener`; do not register against `CallSession.shared` (it doesn't exist).
136
133
 
137
134
  ---
138
135
 
@@ -184,24 +181,24 @@ Configure `applinks:yourapp.com` per `references/share-invite.md`.
184
181
 
185
182
  ## Anti-patterns
186
183
 
187
- 1. **Calling `CometChatCalls.generateToken(forSession:)` then `joinSession(callToken:)`.** Two-step doesn't match the sample — the sample uses the single-call `joinSession(sessionID:)` convenience. Prior versions of this skill cited the two-step; it works but is not the canonical iOS shape.
188
- 2. **`SessionSettings(sessionType:layout:)` initializer.** Wrong type — that's the chat-side entity. Use `SessionSettingsBuilder()...build()`.
189
- 3. **`CometChatCalls.addEventListener(.sessionLeft)`** iOS uses the protocol-based `SessionStatusListener`, not a string-keyed listener API.
190
- 4. **Skipping `onConnectionClosed` and `onSessionTimedOut` callbacks.** User's call ends via either of these (network drop, server timeout) → call view stays mounted forever.
191
- 5. **Calling `joinSession` from `viewDidAppear`.** Re-runs on every navigation push. Use `viewDidLoad` + a `joined` flag, OR use `UIViewRepresentable` + Coordinator (the sample's pattern).
184
+ 1. **Looking for a single-call `joinSession(sessionID:)` convenience.** It does not exist on iOS v5. Always do `generateToken` `startSession`.
185
+ 2. **`SessionSettings` / `SessionSettingsBuilder`.** Neither type exists. Use `CallSettingsBuilder()...build()`.
186
+ 3. **`CometChatCalls.addEventListener(.sessionLeft)` or `SessionStatusListener`/`ButtonClickListener`.** None exist. iOS uses the `CallsEventsDelegate` protocol set via `setDelegate(_:)` or `addCallEventListener(observerId:delegate:)`.
187
+ 4. **Skipping the `onCallEnded` callback.** The call ends via this (remote hangup, server end) → call view stays mounted forever. (For idle-timeout termination, also handle `onSessionTimeout()` — swiftinterface:30.)
188
+ 5. **Starting the session from `viewDidAppear`.** Re-runs on every navigation push. Use `viewDidLoad` + a `started` flag, OR use `UIViewRepresentable` + Coordinator (the pattern above).
192
189
  6. **`AVAudioSession.setCategory(.playback)`.** Mic input doesn't capture. Use `.playAndRecord` + `.voiceChat` mode.
193
- 7. **`async/await` on `joinSession`.** It returns void with completion handlers — `try await` does nothing.
190
+ 7. **`async/await` on `startSession`/`generateToken`.** They use completion handlers — `try await` does nothing.
194
191
  8. **Initializing Chat SDK for a session-only integration.** Wastes time and adds two extra failure modes. Drop `CometChat.init` / `CometChat.login` entirely for standalone session apps.
195
192
 
196
193
  ---
197
194
 
198
195
  ## Verification checklist
199
196
 
200
- - [ ] `joinSession(sessionID:callSetting:container:)` used (single-call), NOT `generateToken` + `joinSession(callToken:)` two-step
201
- - [ ] Settings built via `SessionSettingsBuilder()`, not `SessionSettings(sessionType:layout:)`
202
- - [ ] `SessionStatusListener` protocol implemented on a Coordinator class
203
- - [ ] Coordinator registered via `CallSession.shared.addSessionStatusListener(...)` AFTER `onSuccess`
204
- - [ ] `onSessionLeft`, `onConnectionClosed`, `onSessionTimedOut` ALL trigger dismiss
197
+ - [ ] `generateToken(authToken:sessionID:)` `startSession(callToken:callSetting:view:)` two-step (no `joinSession`)
198
+ - [ ] Settings built via `CallSettingsBuilder()`, not `SessionSettings`/`SessionSettingsBuilder`
199
+ - [ ] `CallsEventsDelegate` protocol implemented on a Coordinator class
200
+ - [ ] Coordinator wired via `CallSettingsBuilder.setDelegate(_:)` (or `addCallEventListener(observerId:delegate:)`)
201
+ - [ ] `onCallEnded` and `onCallEndButtonPressed` both trigger dismiss
205
202
  - [ ] `Info.plist` has `NSCameraUsageDescription`, `NSMicrophoneUsageDescription`, `UIBackgroundModes: audio, voip`
206
203
  - [ ] `AVAudioSession.setCategory(.playAndRecord, mode: .voiceChat, ...)`
207
204
  - [ ] Universal Link routing wired in SceneDelegate
@@ -217,5 +214,5 @@ Configure `applinks:yourapp.com` per `references/share-invite.md`.
217
214
  - `cometchat-ios-calls/SKILL.md` — iOS seven hard rules
218
215
  - `cometchat-ios-calls/references/share-invite.md` — Universal Link config
219
216
  - `cometchat-ios-calls/references/avaudiosession-routing.md` — audio session routing
220
- - Upstream iOS sample — `~/Downloads/calls-sdk/calls-sdk-ios-5/sample-apps/cometchat-calls-sample-app-ios/CometChatCallsSample/CallView.swift`
217
+ - Upstream iOS sample — `calls-sdk-ios-5/sample-apps/cometchat-calls-sample-app-ios/CometChatCallsSample/CallView.swift`
221
218
  - Canonical docs: https://www.cometchat.com/docs/calls/ios/join-session
@@ -76,7 +76,7 @@ struct YourApp: App {
76
76
  .onAppear {
77
77
  CometChat.init(appId: Secrets.cometchatAppID, appSettings: appSettings) { isInitialized, error in
78
78
  guard error == nil else { return }
79
- CometChatCalls.init(callAppSettings: callAppSettings) { _ in
79
+ CometChatCalls.init(callsAppSettings: callAppSettings) { _ in
80
80
  callManager.registerForPushKit() // wait for SDK ready
81
81
  }
82
82
  }
@@ -98,7 +98,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
98
98
  func application(_ app: UIApplication, didFinishLaunchingWithOptions options: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
99
99
  CometChat.init(appId: Secrets.cometchatAppID, appSettings: appSettings) { _, error in
100
100
  guard error == nil else { return }
101
- CometChatCalls.init(callAppSettings: callAppSettings) { _ in
101
+ CometChatCalls.init(callsAppSettings: callAppSettings) { _ in
102
102
  CallManager.shared.registerForPushKit()
103
103
  }
104
104
  }
@@ -227,30 +227,35 @@ extension CallManager: CXProviderDelegate {
227
227
  try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .voiceChat)
228
228
  try AVAudioSession.sharedInstance().setActive(true)
229
229
 
230
- // Build session settings via SessionSettingsBuilder (matches upstream
231
- // ringing sample at calls-sdk-ios-5/sample-apps/cometchat-calls-sample-
232
- // app-ringing-ios/CometChatCallsRinging/CallView.swift).
233
- let settings = SessionSettingsBuilder()
234
- .setTitle("CometChat Call")
235
- .startVideoPaused(false)
236
- .startAudioMuted(false)
230
+ // Build session settings via CallSettingsBuilder. The CallsEventsDelegate
231
+ // is wired with setDelegate(_:); there is no SessionSettings(Builder).
232
+ let settings = CallSettingsBuilder()
233
+ .setIsAudioOnly(false)
234
+ .setStartVideoMuted(false)
235
+ .setStartAudioMuted(false)
236
+ .setDelegate(callListener) // callListener conforms to CallsEventsDelegate
237
237
  .build()
238
238
 
239
- // Single-call joinSession(sessionID:callSetting:container:) the SDK
240
- // generates the token internally. Do NOT call generateToken separately.
241
- // Container is the UIView the ongoing-call UI will be drawn into.
242
- CometChatCalls.joinSession(
243
- sessionID: sessionId,
244
- callSetting: settings,
245
- container: callContainerView // a UIView with measurable bounds
246
- ) { success in
247
- // Register listeners on the resulting CallSession AFTER onSuccess
248
- let session = CometChatCallsSDK.CallSession.shared
249
- session.addSessionStatusListener(callListener)
250
- session.addButtonClickListener(callListener)
251
- action.fulfill() // tell CallKit we answered successfully
239
+ // Two-step: generateToken THEN startSession. There is no joinSession.
240
+ // `view` is the UIView the ongoing-call UI will be drawn into.
241
+ CometChatCalls.generateToken(authToken: CometChat.getUserAuthToken(), sessionID: sessionId) { token in
242
+ guard let token = token else {
243
+ print("generateToken returned nil")
244
+ action.fail()
245
+ return
246
+ }
247
+ CometChatCalls.startSession(
248
+ callToken: token,
249
+ callSetting: settings,
250
+ view: callContainerView // a UIView with measurable bounds
251
+ ) { _ in
252
+ action.fulfill() // tell CallKit we answered successfully
253
+ } onError: { error in
254
+ print("startSession failed: \(error?.errorDescription ?? "unknown")")
255
+ action.fail()
256
+ }
252
257
  } onError: { error in
253
- print("joinSession failed: \(error?.errorDescription ?? "unknown")")
258
+ print("generateToken failed: \(error?.errorDescription ?? "unknown")")
254
259
  action.fail()
255
260
  }
256
261
 
@@ -266,9 +271,7 @@ extension CallManager: CXProviderDelegate {
266
271
 
267
272
  func provider(_ provider: CXProvider, perform action: CXEndCallAction) {
268
273
  // User tapped "End" or call ended remotely.
269
- // Use CallSession.shared.leaveSession() `CometChatCalls.endSession()`
270
- // doesn't exist on iOS (matches upstream ringing sample).
271
- CometChatCallsSDK.CallSession.shared.leaveSession()
274
+ CometChatCalls.endSession() // EXISTS on the static facade in v5
272
275
 
273
276
  // CRITICAL: deactivate audio session (rule 1.5)
274
277
  do {
@@ -282,7 +285,7 @@ extension CallManager: CXProviderDelegate {
282
285
  }
283
286
 
284
287
  func provider(_ provider: CXProvider, perform action: CXSetMutedCallAction) {
285
- CometChatCalls.muteAudio(action.isMuted)
288
+ CometChatCalls.audioMuted(action.isMuted) // NOT muteAudio
286
289
  action.fulfill()
287
290
  }
288
291
  }
@@ -316,8 +319,9 @@ extension CallManager {
316
319
  func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
317
320
  Task {
318
321
  do {
319
- let outgoing = Call(receiverUid: action.handle.value, receiverType: .user,
320
- callType: action.isVideo ? .video : .voice)
322
+ let outgoing = Call(receiverId: action.handle.value,
323
+ callType: action.isVideo ? .video : .audio, // CallType has no .voice
324
+ receiverType: .user)
321
325
  let initiated = try await CometChat.initiateCall(call: outgoing)
322
326
  pendingSessionIds[action.callUUID] = initiated.sessionID
323
327
  provider.reportOutgoingCall(with: action.callUUID, startedConnectingAt: nil)
@@ -7,7 +7,7 @@ Same shape as the other families' custom-ui references. iOS-specific because of
7
7
  ## Two paths
8
8
 
9
9
  1. **Style the kit's `CometChatOngoingCall`** UIViewController via theming + property overrides. Cheapest. Covers most apps.
10
- 2. **Build your own UIViewController on the SDK** — direct `CometChatCalls.joinSession` with your own UIView containers. Maximum control.
10
+ 2. **Build your own UIViewController on the SDK** — direct `CometChatCalls.generateToken` → `startSession` with your own UIView container. Maximum control.
11
11
 
12
12
  This reference covers path 2.
13
13
 
@@ -42,7 +42,8 @@ class CustomOngoingCallViewController: UIViewController {
42
42
 
43
43
  private let sessionID: String
44
44
  private let isAudioOnly: Bool
45
- private var listener: CometChatCallsEventsListener?
45
+ private var muted = false
46
+ private var cameraOff = false
46
47
 
47
48
  init(sessionID: String, isAudioOnly: Bool) {
48
49
  self.sessionID = sessionID
@@ -66,35 +67,35 @@ class CustomOngoingCallViewController: UIViewController {
66
67
  }
67
68
 
68
69
  private func startCall() {
69
- listener = self
70
- // Build SessionSettings match upstream sample shape.
71
- // For custom UI, you typically build your own controls and just need the SDK
72
- // to feed video tiles into your container. enableDefaultLayout is not part
73
- // of SessionSettings — disable individual default-UI elements via the
74
- // hide* setters on SessionSettingsBuilder if you want a minimal surface.
75
- let settings = SessionSettingsBuilder()
76
- .setTitle(isAudioOnly ? "Voice Call" : "Video Call")
77
- .startVideoPaused(isAudioOnly)
78
- .startAudioMuted(false)
70
+ // Build CallSettings via CallSettingsBuilder. The CallsEventsDelegate is
71
+ // wired with setDelegate(_:); there is no SessionSettings/SessionSettingsBuilder.
72
+ let settings = CallSettingsBuilder()
73
+ .setIsAudioOnly(isAudioOnly)
74
+ .setStartVideoMuted(isAudioOnly)
75
+ .setStartAudioMuted(false)
76
+ .setDelegate(self)
79
77
  .build()
80
78
 
81
- // Configure audio session BEFORE joining
79
+ // Configure audio session BEFORE starting
82
80
  try? configureAudioSession()
83
81
 
84
- // Single-call joinSession(sessionID:callSetting:container:) the SDK
85
- // generates the token internally. NO separate generateToken call.
86
- CometChatCalls.joinSession(
87
- sessionID: sessionID,
88
- callSetting: settings,
89
- container: containerView
90
- ) { [weak self] success in
91
- guard let self = self else { return }
92
- // Register listeners on the resulting CallSession AFTER onSuccess.
93
- let session = CometChatCallsSDK.CallSession.shared
94
- session.addSessionStatusListener(self.listener)
95
- session.addButtonClickListener(self.listener)
82
+ // Two-step: generateToken THEN startSession into your container UIView.
83
+ // There is no single-call joinSession on the iOS Calls SDK v5.
84
+ // authToken: pass CometChat.getUserAuthToken() in additive (chat + calls)
85
+ // integrations; nil for session-only apps.
86
+ CometChatCalls.generateToken(authToken: nil, sessionID: sessionID) { [weak self] token in
87
+ guard let self = self, let token = token else { return }
88
+ CometChatCalls.startSession(
89
+ callToken: token,
90
+ callSetting: settings,
91
+ view: self.containerView
92
+ ) { _ in
93
+ // session started — delegate already wired via setDelegate
94
+ } onError: { error in
95
+ print("startSession failed: \(error?.errorDescription ?? "unknown")")
96
+ }
96
97
  } onError: { error in
97
- print("joinSession failed: \(error?.errorDescription ?? "unknown")")
98
+ print("generateToken failed: \(error?.errorDescription ?? "unknown")")
98
99
  }
99
100
  }
100
101
 
@@ -109,8 +110,7 @@ class CustomOngoingCallViewController: UIViewController {
109
110
  }
110
111
 
111
112
  private func cleanup() {
112
- // CometChatCalls.endSession() does NOT exist on iOS use CallSession.shared.leaveSession()
113
- CometChatCallsSDK.CallSession.shared.leaveSession()
113
+ CometChatCalls.endSession() // EXISTS on the static facade in v5
114
114
  try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
115
115
  }
116
116
 
@@ -142,7 +142,7 @@ class CustomOngoingCallViewController: UIViewController {
142
142
  }
143
143
  }
144
144
 
145
- extension CustomOngoingCallViewController: CometChatCallsEventsListener {
145
+ extension CustomOngoingCallViewController: CallsEventsDelegate {
146
146
  func onCallEnded() {
147
147
  DispatchQueue.main.async { [weak self] in
148
148
  self?.cleanup()
@@ -150,15 +150,15 @@ extension CustomOngoingCallViewController: CometChatCallsEventsListener {
150
150
  }
151
151
  }
152
152
 
153
- func onUserListUpdated(_ users: [Any]) {
153
+ // swiftinterface: onUserListChanged(userList: NSArray) — payload is NSArray of [String: Any]
154
+ func onUserListChanged(userList: NSArray) {
154
155
  DispatchQueue.main.async { [weak self] in
155
- self?.statusLabel.text = "\(users.count) participants"
156
+ self?.statusLabel.text = "\(userList.count) participants"
156
157
  }
157
158
  }
158
159
 
159
- func onError(_ error: Error) {
160
- print("Call error: \(error)")
161
- }
160
+ // Note: CallsEventsDelegate has no onError callback. Surface generateToken /
161
+ // startSession failures from their onError closures (see startCall above).
162
162
  }
163
163
  ```
164
164
 
@@ -222,12 +222,12 @@ override func viewDidLoad() {
222
222
  controlPanel.onMute = { [weak self] in
223
223
  guard let self = self else { return }
224
224
  self.muted.toggle()
225
- CometChatCalls.muteAudio(self.muted)
225
+ CometChatCalls.audioMuted(self.muted) // NOT muteAudio
226
226
  }
227
227
  controlPanel.onCamera = { [weak self] in
228
228
  guard let self = self else { return }
229
229
  self.cameraOff.toggle()
230
- CometChatCalls.pauseVideo(self.cameraOff)
230
+ CometChatCalls.videoPaused(self.cameraOff) // NOT pauseVideo
231
231
  }
232
232
  controlPanel.onSwitch = { CometChatCalls.switchCamera() }
233
233
  controlPanel.onEnd = { [weak self] in
@@ -265,7 +265,7 @@ private func stopLocalPreview() {
265
265
  }
266
266
  ```
267
267
 
268
- Stop the preview BEFORE `joinSession` — the SDK takes over the camera and your `AVCaptureSession` will fight with it.
268
+ Stop the preview BEFORE `startSession` — the SDK takes over the camera and your `AVCaptureSession` will fight with it.
269
269
 
270
270
  ---
271
271
 
@@ -311,7 +311,7 @@ class CustomOngoingCallViewController {
311
311
  }
312
312
  ```
313
313
 
314
- Setting up PiP for WebRTC video is involved — the SDK doesn't expose a `CMSampleBuffer` stream directly. For most apps, `enableDefaultLayout(true)` and let the kit's PiP work; custom UI authors who need PiP can use `CometChatPictureInPicture` (kit class) as a hybrid kit's PiP, custom rest of UI.
314
+ Setting up your own `AVPictureInPictureController` for WebRTC video is involved — the SDK doesn't expose a `CMSampleBuffer` stream directly. For most apps, use the Calls SDK's built-in PiP instead: `CometChatCalls.enterPIPMode()` / `CometChatCalls.exitPIPMode()` toggle the SDK-managed picture-in-picture for the session view. See `references/picture-in-picture.md`.
315
315
 
316
316
  ---
317
317