@cometchat/skills 4.2.1 → 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.
- package/LICENSE +21 -0
- package/README.md +33 -12
- package/bin/install.js +59 -4
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +460 -77
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +20 -2
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +389 -9
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +235 -293
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +22 -1
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +412 -13
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +313 -34
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +20 -2
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +78 -63
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +8 -6
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +348 -10
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +43 -21
- package/skills/cometchat-flutter-v6-testing/SKILL.md +6 -6
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +139 -78
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +281 -11
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +56 -18
- package/skills/cometchat-native-calls/SKILL.md +89 -19
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +91 -57
- package/skills/cometchat-native-core/SKILL.md +281 -9
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +77 -27
- package/skills/cometchat-native-features/SKILL.md +79 -49
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +71 -3
- package/skills/cometchat-nextjs-patterns/SKILL.md +48 -6
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +57 -4
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +43 -4
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# Call layouts on iOS
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
.
|
|
17
|
-
.
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
-
`
|
|
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
|
-
##
|
|
32
|
+
## Picking a layout at session start
|
|
79
33
|
|
|
80
34
|
```swift
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
-
.
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
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
|
-
- [ ]
|
|
125
|
-
- [ ]
|
|
126
|
-
- [ ]
|
|
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 —
|
|
1
|
+
# Call session — no ringing (iOS)
|
|
2
2
|
|
|
3
|
-
Server-generated sessionId, both parties enter it. Customer-validated against
|
|
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. **
|
|
14
|
-
2. **`
|
|
15
|
-
3. **`
|
|
16
|
-
4. **`
|
|
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 =
|
|
75
|
-
.
|
|
76
|
-
.
|
|
77
|
-
.
|
|
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
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
|
102
|
+
onError(error?.errorDescription ?? "Failed to generate call token")
|
|
93
103
|
}
|
|
94
104
|
}
|
|
95
105
|
}
|
|
96
106
|
|
|
97
|
-
class Coordinator: NSObject,
|
|
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
|
-
// ---
|
|
105
|
-
func
|
|
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
|
|
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
|
-
- **`
|
|
134
|
-
- **`
|
|
135
|
-
- **`Coordinator` implements `
|
|
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. **
|
|
188
|
-
2. **`SessionSettings
|
|
189
|
-
3. **`CometChatCalls.addEventListener(.sessionLeft)
|
|
190
|
-
4. **Skipping
|
|
191
|
-
5. **
|
|
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 `
|
|
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
|
-
- [ ] `
|
|
201
|
-
- [ ] Settings built via `
|
|
202
|
-
- [ ] `
|
|
203
|
-
- [ ] Coordinator
|
|
204
|
-
- [ ] `
|
|
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 —
|
|
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(
|
|
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(
|
|
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
|
|
231
|
-
//
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
.
|
|
235
|
-
.
|
|
236
|
-
.
|
|
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
|
-
//
|
|
240
|
-
//
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
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("
|
|
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
|
-
|
|
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.
|
|
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(
|
|
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.
|
|
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
|
|
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
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
79
|
+
// Configure audio session BEFORE starting
|
|
82
80
|
try? configureAudioSession()
|
|
83
81
|
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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("
|
|
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
|
-
|
|
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:
|
|
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
|
-
|
|
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 = "\(
|
|
156
|
+
self?.statusLabel.text = "\(userList.count) participants"
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
|
|
159
|
-
|
|
160
|
-
|
|
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.
|
|
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.
|
|
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 `
|
|
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
|
|
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
|
|