@cometchat/skills 4.3.0 → 4.4.1
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/bin/install.js +27 -0
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +233 -69
- 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 +5 -3
- 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 +208 -28
- 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 +232 -312
- 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 +3 -2
- 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 +258 -20
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +314 -35
- 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 +5 -4
- 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 +72 -57
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
- 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 +182 -21
- 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 +41 -19
- package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
- 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 +140 -79
- 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 +173 -45
- 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 +36 -19
- package/skills/cometchat-native-calls/SKILL.md +29 -17
- 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 +84 -52
- package/skills/cometchat-native-core/SKILL.md +102 -33
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +60 -29
- package/skills/cometchat-native-features/SKILL.md +24 -17
- 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 +11 -5
- package/skills/cometchat-nextjs-patterns/SKILL.md +22 -8
- 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 +45 -5
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +12 -6
- 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,8 +1,10 @@
|
|
|
1
1
|
# Adding calls to an existing chat integration (Flutter V5)
|
|
2
2
|
|
|
3
|
-
You have `cometchat_chat_uikit` v5 working. Adding calls = `
|
|
3
|
+
You have `cometchat_chat_uikit` v5 working. Adding calls = the **raw 5.x calls SDK** (`cometchat_calls_sdk: ^5.0.2`, direct dependency) plus iOS/Android native config and a custom call surface.
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
> **Do NOT add `cometchat_calls_uikit`.** Its latest (5.0.16) pins `cometchat_calls_sdk ^4.2.2` and its prebuilt call widgets are 4.x-bound — incompatible with the 5.x calls SDK. Use the raw SDK + custom UI.
|
|
6
|
+
|
|
7
|
+
**Read first:** `cometchat-flutter-v5-calls/SKILL.md` — Flutter calls architecture (GetX patterns) + `references/call-session.md` for the canonical 5.x surface.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -11,8 +13,8 @@ You have `cometchat_chat_uikit` v5 working. Adding calls = `cometchat_calls_uiki
|
|
|
11
13
|
```yaml
|
|
12
14
|
# pubspec.yaml
|
|
13
15
|
dependencies:
|
|
14
|
-
cometchat_chat_uikit: ^5.x.x # existing
|
|
15
|
-
|
|
16
|
+
cometchat_chat_uikit: ^5.x.x # existing (GetX chat kit — keep)
|
|
17
|
+
cometchat_calls_sdk: ^5.0.2 # NEW — raw 5.x calls SDK (direct)
|
|
16
18
|
flutter_callkit_incoming: ^2.0.4 # for OS-level incoming-call UI
|
|
17
19
|
flutter_voip_pushkit: ^0.2.1 # iOS PushKit
|
|
18
20
|
firebase_messaging: ^15.0.0 # Android FCM
|
|
@@ -44,7 +46,7 @@ In your existing init (typically `main.dart`):
|
|
|
44
46
|
|
|
45
47
|
```dart
|
|
46
48
|
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
|
|
47
|
-
import 'package:
|
|
49
|
+
import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
|
|
48
50
|
|
|
49
51
|
Future<void> main() async {
|
|
50
52
|
WidgetsFlutterBinding.ensureInitialized();
|
|
@@ -55,9 +57,19 @@ Future<void> main() async {
|
|
|
55
57
|
..setRegion(REGION);
|
|
56
58
|
await CometChatUIKit.init(uiKitSettings: chatSettings.build());
|
|
57
59
|
|
|
58
|
-
// NEW: Calls init AFTER chat init
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
// NEW: 5.x Calls SDK init AFTER chat init.
|
|
61
|
+
// init is callback-based (NOT awaitable) and takes a CallAppSettings built
|
|
62
|
+
// via CallAppSettingBuilder — no authKey field (call_app_settings_request.dart).
|
|
63
|
+
// Verified cometchatcalls.dart:172.
|
|
64
|
+
final callsSettings = (CallAppSettingBuilder()
|
|
65
|
+
..appId = APP_ID
|
|
66
|
+
..region = REGION)
|
|
67
|
+
.build();
|
|
68
|
+
CometChatCalls.init(
|
|
69
|
+
callsSettings,
|
|
70
|
+
onSuccess: (String success) {/* Calls SDK ready */},
|
|
71
|
+
onError: (CometChatCallsException e) {/* surface */},
|
|
72
|
+
);
|
|
61
73
|
|
|
62
74
|
runApp(const MyApp());
|
|
63
75
|
}
|
|
@@ -65,30 +77,39 @@ Future<void> main() async {
|
|
|
65
77
|
|
|
66
78
|
---
|
|
67
79
|
|
|
68
|
-
## Step 4 — Login
|
|
80
|
+
## Step 4 — Login BOTH SDKs (5.x Calls SDK has its own login)
|
|
69
81
|
|
|
70
|
-
|
|
82
|
+
Unlike 4.x, the 5.x Calls SDK logs in explicitly and caches the auth token (`cometchatcalls.dart:316`). Log the chat user in, then log the Calls SDK in with the same token:
|
|
71
83
|
|
|
72
84
|
```dart
|
|
73
85
|
final user = await CometChatUIKit.login(uid: uid, authKey: AUTH_KEY);
|
|
74
|
-
final authToken =
|
|
75
|
-
|
|
86
|
+
final authToken = await CometChat.getUserAuthToken(); // static; no User.getAuthToken() method
|
|
87
|
+
if (authToken != null) {
|
|
88
|
+
CometChatCalls.loginWithAuthToken(
|
|
89
|
+
authToken: authToken,
|
|
90
|
+
onSuccess: (cu) {/* Calls SDK ready */},
|
|
91
|
+
onError: (CometChatCallsException e) {/* surface */},
|
|
92
|
+
);
|
|
93
|
+
}
|
|
76
94
|
```
|
|
77
95
|
|
|
78
96
|
---
|
|
79
97
|
|
|
80
|
-
## Step 5 — Mount
|
|
98
|
+
## Step 5 — Mount a custom incoming-call overlay at app root
|
|
99
|
+
|
|
100
|
+
There is no prebuilt `CometChatIncomingCall` on the raw 5.x SDK (that widget is 4.x-kit-only). Listen for incoming calls via the Chat SDK `CallListener` (app shell, SKILL.md rule 1.7) and show your own overlay; on accept, `CometChat.acceptCall(sessionId)` → `CometChatCalls.joinSession(...)`.
|
|
81
101
|
|
|
82
102
|
```dart
|
|
83
103
|
class MyApp extends StatelessWidget {
|
|
104
|
+
const MyApp({super.key});
|
|
84
105
|
@override
|
|
85
106
|
Widget build(BuildContext context) {
|
|
86
107
|
return MaterialApp(
|
|
87
|
-
|
|
108
|
+
navigatorKey: navigatorKey, // GlobalKey<NavigatorState> — rule 1.7
|
|
109
|
+
home: const Stack(
|
|
88
110
|
children: [
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
const CometChatIncomingCall(),
|
|
111
|
+
AppRoot(), // hosts the Chat SDK CallListener
|
|
112
|
+
MyIncomingCallOverlay(), // your custom ring UI
|
|
92
113
|
],
|
|
93
114
|
),
|
|
94
115
|
);
|
|
@@ -128,7 +149,7 @@ class CallPushService {
|
|
|
128
149
|
}
|
|
129
150
|
```
|
|
130
151
|
|
|
131
|
-
Trigger after `
|
|
152
|
+
Trigger after `CometChatUIKit.login` completes (there is no separate Calls login).
|
|
132
153
|
|
|
133
154
|
---
|
|
134
155
|
|
|
@@ -136,7 +157,10 @@ Trigger after `CometChatCalls.login` completes.
|
|
|
136
157
|
|
|
137
158
|
```dart
|
|
138
159
|
Future<void> endCall(String sessionId) async {
|
|
139
|
-
|
|
160
|
+
// 5.x: teardown is the CallSession INSTANCE leaveSession() (call_session.dart:272).
|
|
161
|
+
// The static CometChatCalls.endSession exists (cometchatcalls.dart:676) but is
|
|
162
|
+
// @Deprecated and just delegates to leaveSession().
|
|
163
|
+
await CallSession.getInstance()?.leaveSession();
|
|
140
164
|
await CometChat.endCall(sessionId);
|
|
141
165
|
// OS-level UI dismiss via flutter_callkit_incoming
|
|
142
166
|
await FlutterCallkitIncoming.endCall(sessionId);
|
|
@@ -147,14 +171,14 @@ Future<void> endCall(String sessionId) async {
|
|
|
147
171
|
|
|
148
172
|
## Verification checklist
|
|
149
173
|
|
|
150
|
-
- [ ] `
|
|
174
|
+
- [ ] `cometchat_calls_sdk: ^5.0.2` (direct) + native plugins in pubspec; NO `cometchat_calls_uikit`
|
|
151
175
|
- [ ] iOS Background Modes + Info.plist usage descriptions
|
|
152
176
|
- [ ] Android permissions + ConnectionService declared
|
|
153
|
-
- [ ] Calls init AFTER chat init in main()
|
|
154
|
-
- [ ]
|
|
155
|
-
- [ ]
|
|
177
|
+
- [ ] Calls init AFTER chat init in main() (callback-based `CometChatCalls.init`, NOT awaited)
|
|
178
|
+
- [ ] `CometChatCalls.loginWithAuthToken(...)` after chat login (5.x has its own login)
|
|
179
|
+
- [ ] Custom incoming-call overlay driven by the Chat SDK `CallListener` (no `CometChatIncomingCall`)
|
|
156
180
|
- [ ] VoIP token registration triggered post-login
|
|
157
|
-
- [ ] Hangup teardown calls leaveSession + endCall + endCall (callkit)
|
|
181
|
+
- [ ] Hangup teardown calls `CallSession.getInstance()?.leaveSession()` + `CometChat.endCall` + endCall (callkit)
|
|
158
182
|
- [ ] Real-device smoke: backgrounded incoming call rings on lock screen
|
|
159
183
|
- [ ] Run `cometchat verify --calls` — should pass
|
|
160
184
|
|
|
@@ -9,19 +9,24 @@ Same three layouts (TILE/SIDEBAR/SPOTLIGHT). Flutter-specific: `SegmentedButton`
|
|
|
9
9
|
|
|
10
10
|
## SDK API
|
|
11
11
|
|
|
12
|
+
`setLayout` is an **instance method on the `CallSession` singleton** (`cometchat_calls_sdk-5.0.2` `src/call_session.dart:394`), and the layout enum is `LayoutType { tile, sidebar, spotlight }` (`src/enums/layout_type.dart`) — there is no `CallLayout` type and no static `CometChatCalls.setLayout`.
|
|
13
|
+
|
|
12
14
|
```dart
|
|
13
|
-
import 'package:
|
|
15
|
+
import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
// Initial layout via the (non-deprecated) SessionSettingsBuilder
|
|
18
|
+
final settings = (SessionSettingsBuilder()
|
|
19
|
+
..setLayout(LayoutType.tile) // session_settings.dart:179
|
|
20
|
+
..hideChangeLayoutButton(false)) // :293
|
|
21
|
+
.build();
|
|
18
22
|
|
|
19
|
-
// Mid-call switch
|
|
20
|
-
|
|
23
|
+
// Mid-call switch — instance method on the session singleton
|
|
24
|
+
CallSession.getInstance()?.setLayout(LayoutType.spotlight); // call_session.dart:394
|
|
21
25
|
|
|
22
|
-
// Listen — implement
|
|
26
|
+
// Listen — implement LayoutListeners, attach via the layoutListener setter
|
|
27
|
+
// (CallSession.getInstance()?.layoutListener = myLayoutListener; call_session.dart:98).
|
|
23
28
|
@override
|
|
24
|
-
void onCallLayoutChanged(
|
|
29
|
+
void onCallLayoutChanged(LayoutType layout) { // layout_listeners.dart:9
|
|
25
30
|
Get.find<CallLayoutController>().layout.value = layout;
|
|
26
31
|
}
|
|
27
32
|
```
|
|
@@ -32,10 +37,10 @@ void onCallLayoutChanged(CallLayout layout) {
|
|
|
32
37
|
|
|
33
38
|
```dart
|
|
34
39
|
class CallLayoutController extends GetxController {
|
|
35
|
-
final layout =
|
|
40
|
+
final layout = LayoutType.tile.obs;
|
|
36
41
|
|
|
37
|
-
void set(
|
|
38
|
-
|
|
42
|
+
void set(LayoutType next) {
|
|
43
|
+
CallSession.getInstance()?.setLayout(next);
|
|
39
44
|
layout.value = next;
|
|
40
45
|
}
|
|
41
46
|
}
|
|
@@ -52,11 +57,11 @@ class LayoutSwitcher extends StatelessWidget {
|
|
|
52
57
|
@override
|
|
53
58
|
Widget build(BuildContext context) {
|
|
54
59
|
final ctrl = Get.find<CallLayoutController>();
|
|
55
|
-
return Obx(() => SegmentedButton<
|
|
60
|
+
return Obx(() => SegmentedButton<LayoutType>(
|
|
56
61
|
segments: const [
|
|
57
|
-
ButtonSegment(value:
|
|
58
|
-
ButtonSegment(value:
|
|
59
|
-
ButtonSegment(value:
|
|
62
|
+
ButtonSegment(value: LayoutType.tile, label: Text('Tile')),
|
|
63
|
+
ButtonSegment(value: LayoutType.sidebar, label: Text('Sidebar')),
|
|
64
|
+
ButtonSegment(value: LayoutType.spotlight, label: Text('Spotlight')),
|
|
60
65
|
],
|
|
61
66
|
selected: {ctrl.layout.value},
|
|
62
67
|
onSelectionChanged: (set) {
|
|
@@ -1,45 +1,21 @@
|
|
|
1
|
-
# Call session — joinSession
|
|
1
|
+
# Call session — joinSession, no ringing (Flutter V5 / GetX, 5.x Calls SDK)
|
|
2
2
|
|
|
3
|
-
Server-generated sessionId, both parties enter it.
|
|
3
|
+
Server-generated sessionId, both parties enter it. Built on the **5.x** Calls SDK (`cometchat_calls_sdk ^5.0.2`) added as a **direct** dependency (NOT pulled via `cometchat_calls_uikit`, which would bring 4.x). This is the canonical SDK API surface for all the V5 calls references.
|
|
4
4
|
|
|
5
5
|
**Read first:** `cometchat-react-calls/references/call-session.md` — full architecture (sessionId strategies, server-side authorization, token generation). Then come back here for the Flutter-specific shape.
|
|
6
6
|
|
|
7
|
+
> **5.x SHAPE.** Lifecycle is **static on `CometChatCalls`** (`init`/`login`/`loginWithAuthToken`/`generateCallToken`/`joinSession`/`getLoggedInUser` — `src/plugin/cometchatcalls.dart`). In-call controls are **instance methods on the `CallSession` singleton** via `CallSession.getInstance()` (`src/call_session.dart`). Settings use `SessionSettingsBuilder` (`src/builder/session_settings.dart`). Events arrive through the **5 split listeners** in `src/listener/`. Substrate of record: `~/.pub-cache/hosted/pub.dev/cometchat_calls_sdk-5.0.2/lib/`.
|
|
8
|
+
|
|
7
9
|
---
|
|
8
10
|
|
|
9
11
|
## Hard rules (Flutter-specific overrides on top of the cross-platform rules)
|
|
10
12
|
|
|
11
|
-
1.
|
|
12
|
-
2. **`SessionSettingsBuilder` is the
|
|
13
|
-
3. **Implement
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
void _navigateBack() {
|
|
19
|
-
if (_isLeavingSession) return;
|
|
20
|
-
if (!mounted) return;
|
|
21
|
-
if (!Navigator.of(context).canPop()) return;
|
|
22
|
-
_isLeavingSession = true;
|
|
23
|
-
CometChatOngoingCallService.abort();
|
|
24
|
-
Navigator.of(context).pop();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
@override
|
|
28
|
-
void onSessionLeft() => _navigateBack();
|
|
29
|
-
@override
|
|
30
|
-
void onConnectionClosed() => _navigateBack();
|
|
31
|
-
@override
|
|
32
|
-
void onSessionTimedOut() => _navigateBack();
|
|
33
|
-
|
|
34
|
-
@override
|
|
35
|
-
void onLeaveSessionButtonClicked() {
|
|
36
|
-
// Trigger the leave; the listener chain calls _navigateBack().
|
|
37
|
-
_callSession?.leaveSession();
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
4. **`CometChatOngoingCallService.launch()` + `CometChatOngoingCallService.abort()`** manage the platform foreground service. Call `launch()` after `onSessionJoined`; call `abort()` inside the `_navigateBack()` helper (so it fires exactly once on the first termination event).
|
|
41
|
-
5. **Render the returned widget with `SizedBox.expand(child: videoWidget)`.** Anything that constrains the widget (Padding, Container with explicit width/height smaller than viewport) clips the call UI.
|
|
42
|
-
6. **For standalone session-only integrations, the Chat SDK is OPTIONAL.** The upstream Flutter sample only uses `cometchat_calls_sdk`. Keep dual-SDK only for additive (chat + calls) integrations.
|
|
13
|
+
1. **One step: `joinSession({sessionId:, sessionSettings:, onSuccess:, onError:})`** (`cometchatcalls.dart:735`). Provide EITHER `sessionId:` (the SDK mints the call token internally using the cached auth token) OR a pre-minted `callToken:` — not both. `onSuccess` hands back a `Widget?` you render. There is no `generateToken` + `startSession` two-step in the primary 5.x path (those are `@Deprecated` v4-compat shims, `cometchatcalls.dart:449,621`).
|
|
14
|
+
2. **`SessionSettingsBuilder` is the settings shape** (`builder/session_settings.dart:126`). e.g. `(SessionSettingsBuilder()..setTitle('Meeting')..startAudioMuted(false)..startVideoPaused(false)).build()`. `CallSettingsBuilder` is `@Deprecated` (`builder/call_settings.dart:209`).
|
|
15
|
+
3. **Implement the split listeners and register them on `CallSession.getInstance()`** inside `joinSession`'s `onSuccess` (the singleton is non-null only after the session is created). `SessionStatusListeners` (`addSessionStatusListener`, `call_session.dart:66`) carries `onSessionJoined`/`onSessionLeft`/`onConnectionClosed`/`onSessionTimedOut`/`onConnectionLost`/`onConnectionRestored`. Remove via `removeSessionStatusListener` in `dispose`. Do NOT use the single `CometChatCallsEventsListener` (`@Deprecated`).
|
|
16
|
+
4. **`CometChatOngoingCallService.launch()` + `.abort()`** (`services/ongoing_call_service.dart:33,51`) manage the platform foreground service. `launch()` after the session starts; `abort()` inside the guarded `_navigateBack()` helper (fires exactly once on the first termination event).
|
|
17
|
+
5. **Render the returned widget with `SizedBox.expand(child: videoWidget)`.** Anything that constrains it (Padding, undersized Container) clips the call UI.
|
|
18
|
+
6. **Log the Calls SDK in before joining.** `joinSession`/`generateCallToken` use the cached auth token from `CometChatCalls.loginWithAuthToken(...)` (or `CometChatCalls.login(...)`). Source that token with the static `await CometChat.getUserAuthToken()` (there is no `User.getAuthToken()` instance method).
|
|
43
19
|
|
|
44
20
|
---
|
|
45
21
|
|
|
@@ -47,19 +23,19 @@ void onLeaveSessionButtonClicked() {
|
|
|
47
23
|
|
|
48
24
|
```yaml
|
|
49
25
|
dependencies:
|
|
50
|
-
cometchat_calls_sdk: ^5.0.
|
|
26
|
+
cometchat_calls_sdk: ^5.0.2
|
|
27
|
+
cometchat_chat_sdk: ^4.0.0 # signaling + source of the auth token
|
|
51
28
|
permission_handler: ^11.0.0
|
|
52
29
|
uni_links: ^0.5.1
|
|
53
30
|
```
|
|
54
31
|
|
|
55
|
-
For standalone session-only, you do NOT need `cometchat_chat_sdk`.
|
|
56
|
-
|
|
57
32
|
---
|
|
58
33
|
|
|
59
34
|
## Call screen (StatefulWidget + SessionStatusListeners)
|
|
60
35
|
|
|
61
36
|
```dart
|
|
62
37
|
import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
|
|
38
|
+
import 'package:cometchat_sdk/cometchat_sdk.dart';
|
|
63
39
|
import 'package:flutter/material.dart';
|
|
64
40
|
|
|
65
41
|
class CallScreen extends StatefulWidget {
|
|
@@ -71,74 +47,81 @@ class CallScreen extends StatefulWidget {
|
|
|
71
47
|
}
|
|
72
48
|
|
|
73
49
|
class _CallScreenState extends State<CallScreen>
|
|
74
|
-
implements SessionStatusListeners
|
|
50
|
+
implements SessionStatusListeners {
|
|
75
51
|
Widget? _videoContainer;
|
|
76
52
|
bool _isLoading = true;
|
|
77
53
|
bool _hasError = false;
|
|
78
54
|
String? _errorMessage;
|
|
79
55
|
bool _isLeavingSession = false;
|
|
80
|
-
CallSession?
|
|
56
|
+
CallSession? _session;
|
|
81
57
|
|
|
82
58
|
@override
|
|
83
59
|
void initState() {
|
|
84
60
|
super.initState();
|
|
85
|
-
|
|
61
|
+
_startCall();
|
|
86
62
|
}
|
|
87
63
|
|
|
88
64
|
@override
|
|
89
65
|
void dispose() {
|
|
90
|
-
|
|
66
|
+
_session?.removeSessionStatusListener(this);
|
|
91
67
|
CometChatOngoingCallService.abort();
|
|
92
68
|
super.dispose();
|
|
93
69
|
}
|
|
94
70
|
|
|
95
|
-
void
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
71
|
+
Future<void> _startCall() async {
|
|
72
|
+
// Ensure the Calls SDK is logged in (caches the auth token used below).
|
|
73
|
+
final authToken = await CometChat.getUserAuthToken();
|
|
74
|
+
if (authToken != null) {
|
|
75
|
+
CometChatCalls.loginWithAuthToken( // cometchatcalls.dart:316
|
|
76
|
+
authToken: authToken,
|
|
77
|
+
onSuccess: (_) => _join(),
|
|
78
|
+
onError: (CometChatCallsException e) => _fail(e.message),
|
|
79
|
+
);
|
|
80
|
+
} else {
|
|
81
|
+
_join(); // already logged in via CometChatCalls.login earlier
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
void _join() {
|
|
86
|
+
final settings = (SessionSettingsBuilder()
|
|
87
|
+
..setTitle('CometChat Meeting') // session_settings.dart:155
|
|
88
|
+
..startAudioMuted(false) // :173
|
|
89
|
+
..startVideoPaused(false)) // :167
|
|
100
90
|
.build();
|
|
101
91
|
|
|
102
|
-
CometChatCalls.joinSession(
|
|
103
|
-
sessionId: widget.sessionId,
|
|
104
|
-
sessionSettings:
|
|
92
|
+
CometChatCalls.joinSession( // cometchatcalls.dart:735
|
|
93
|
+
sessionId: widget.sessionId, // SDK mints the call token internally
|
|
94
|
+
sessionSettings: settings,
|
|
105
95
|
onSuccess: (Widget? videoWidget) {
|
|
106
96
|
if (!mounted) return;
|
|
97
|
+
// Register split listeners now that the session exists.
|
|
98
|
+
_session = CallSession.getInstance(); // call_session.dart:36
|
|
99
|
+
_session?.addSessionStatusListener(this); // :66
|
|
100
|
+
CometChatOngoingCallService.launch(); // ongoing_call_service.dart:33
|
|
107
101
|
setState(() {
|
|
108
102
|
_videoContainer = videoWidget;
|
|
109
103
|
_isLoading = false;
|
|
110
104
|
_hasError = false;
|
|
111
105
|
});
|
|
112
|
-
_registerListeners();
|
|
113
|
-
CometChatOngoingCallService.launch();
|
|
114
|
-
},
|
|
115
|
-
onError: (CometChatCallsException error) {
|
|
116
|
-
if (!mounted) return;
|
|
117
|
-
setState(() {
|
|
118
|
-
_isLoading = false;
|
|
119
|
-
_hasError = true;
|
|
120
|
-
_errorMessage = error.message ?? 'Failed to join session';
|
|
121
|
-
});
|
|
122
106
|
},
|
|
107
|
+
onError: (CometChatCallsException error) => _fail(error.message),
|
|
123
108
|
);
|
|
124
109
|
}
|
|
125
110
|
|
|
126
|
-
void
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
_callSession?.removeSessionStatusListener(this);
|
|
134
|
-
_callSession?.removeButtonClickListener(this);
|
|
111
|
+
void _fail(String? msg) {
|
|
112
|
+
if (!mounted) return;
|
|
113
|
+
setState(() {
|
|
114
|
+
_isLoading = false;
|
|
115
|
+
_hasError = true;
|
|
116
|
+
_errorMessage = msg ?? 'Failed to join session';
|
|
117
|
+
});
|
|
135
118
|
}
|
|
136
119
|
|
|
137
120
|
void _navigateBack() {
|
|
138
121
|
// ONE guarded path for all termination events (onSessionLeft +
|
|
139
|
-
// onConnectionClosed + onSessionTimedOut
|
|
140
|
-
//
|
|
141
|
-
//
|
|
122
|
+
// onConnectionClosed + onSessionTimedOut). The 5.x SDK fires several in
|
|
123
|
+
// sequence on hangup; without the guard a second pop crashes with
|
|
124
|
+
// `Bad state: No element`.
|
|
142
125
|
if (_isLeavingSession) return;
|
|
143
126
|
if (!mounted) return;
|
|
144
127
|
if (!Navigator.of(context).canPop()) return;
|
|
@@ -147,16 +130,11 @@ class _CallScreenState extends State<CallScreen>
|
|
|
147
130
|
Navigator.of(context).pop();
|
|
148
131
|
}
|
|
149
132
|
|
|
150
|
-
// --- SessionStatusListeners ---
|
|
133
|
+
// --- SessionStatusListeners (session_status_listeners.dart) ---
|
|
151
134
|
|
|
152
135
|
@override
|
|
153
|
-
void onSessionJoined() {
|
|
154
|
-
CometChatOngoingCallService.launch();
|
|
155
|
-
}
|
|
136
|
+
void onSessionJoined() {}
|
|
156
137
|
|
|
157
|
-
// All termination events funnel through ONE guarded _navigateBack().
|
|
158
|
-
// SDK fires onSessionLeft + onConnectionClosed in sequence on every
|
|
159
|
-
// hangup; unguarded pops crash with `Bad state: No element`.
|
|
160
138
|
@override
|
|
161
139
|
void onSessionLeft() => _navigateBack();
|
|
162
140
|
|
|
@@ -167,54 +145,16 @@ class _CallScreenState extends State<CallScreen>
|
|
|
167
145
|
void onSessionTimedOut() => _navigateBack();
|
|
168
146
|
|
|
169
147
|
@override
|
|
170
|
-
void onConnectionLost() {
|
|
171
|
-
if (mounted) {
|
|
172
|
-
ScaffoldMessenger.of(context).showSnackBar(
|
|
173
|
-
const SnackBar(content: Text('Connection lost')),
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
@override
|
|
179
|
-
void onConnectionRestored() {
|
|
180
|
-
if (mounted) {
|
|
181
|
-
ScaffoldMessenger.of(context).showSnackBar(
|
|
182
|
-
const SnackBar(content: Text('Connection restored')),
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// --- ButtonClickListeners (stub the ones you don't customize) ---
|
|
148
|
+
void onConnectionLost() {}
|
|
188
149
|
|
|
189
150
|
@override
|
|
190
|
-
void
|
|
191
|
-
// Trigger leave; the listener chain calls _navigateBack().
|
|
192
|
-
_callSession?.leaveSession();
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
@override
|
|
196
|
-
void onChangeLayoutButtonClicked() {}
|
|
197
|
-
@override
|
|
198
|
-
void onChatButtonClicked() {}
|
|
199
|
-
@override
|
|
200
|
-
void onParticipantListButtonClicked() {}
|
|
201
|
-
@override
|
|
202
|
-
void onRaiseHandButtonClicked() {}
|
|
203
|
-
@override
|
|
204
|
-
void onRecordingToggleButtonClicked() {}
|
|
205
|
-
@override
|
|
206
|
-
void onShareInviteButtonClicked() {}
|
|
207
|
-
@override
|
|
208
|
-
void onSwitchCameraButtonClicked() {}
|
|
209
|
-
@override
|
|
210
|
-
void onToggleAudioButtonClicked() {}
|
|
211
|
-
@override
|
|
212
|
-
void onToggleVideoButtonClicked() {}
|
|
151
|
+
void onConnectionRestored() {}
|
|
213
152
|
|
|
214
153
|
@override
|
|
215
154
|
Widget build(BuildContext context) {
|
|
216
155
|
return Scaffold(
|
|
217
156
|
backgroundColor: Colors.black,
|
|
157
|
+
resizeToAvoidBottomInset: false,
|
|
218
158
|
body: _buildBody(),
|
|
219
159
|
);
|
|
220
160
|
}
|
|
@@ -236,11 +176,26 @@ class _CallScreenState extends State<CallScreen>
|
|
|
236
176
|
|
|
237
177
|
**Why this shape:**
|
|
238
178
|
|
|
239
|
-
- **
|
|
240
|
-
- **`SessionSettingsBuilder`** instead of `
|
|
241
|
-
- **`SessionStatusListeners`
|
|
242
|
-
- **`
|
|
243
|
-
- **`
|
|
179
|
+
- **Single-step `joinSession`** instead of `generateToken` + `startSession` — the 5.x primary path joins in one call; the call widget arrives via `joinSession`'s `onSuccess`.
|
|
180
|
+
- **`SessionSettingsBuilder`** instead of `CallSettingsBuilder` — the latter is `@Deprecated` in 5.0.2.
|
|
181
|
+
- **`SessionStatusListeners` registered on `CallSession.getInstance()`** instead of one `CometChatCallsEventsListener` on `CometChatCalls` — 5.x splits events across 5 listeners attached to the session singleton.
|
|
182
|
+
- **`CallSession.getInstance()?.leaveSession()`** for teardown (`call_session.dart:272`) — the static `CometChatCalls.endSession` exists (`cometchatcalls.dart:676`) but is `@Deprecated` and just delegates here.
|
|
183
|
+
- **`CometChatOngoingCallService.launch()/abort()`** — required for foreground-service correctness on Android 14+.
|
|
184
|
+
- **`SizedBox.expand`** — the SDK's returned widget must fill its parent.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Ending the call from a button
|
|
189
|
+
|
|
190
|
+
```dart
|
|
191
|
+
ElevatedButton(
|
|
192
|
+
onPressed: () async {
|
|
193
|
+
await CallSession.getInstance()?.leaveSession(); // call_session.dart:272
|
|
194
|
+
// onSessionLeft then funnels through _navigateBack().
|
|
195
|
+
},
|
|
196
|
+
child: const Text('Leave'),
|
|
197
|
+
)
|
|
198
|
+
```
|
|
244
199
|
|
|
245
200
|
---
|
|
246
201
|
|
|
@@ -263,7 +218,7 @@ iOS:
|
|
|
263
218
|
<string>Microphone is needed for calls</string>
|
|
264
219
|
```
|
|
265
220
|
|
|
266
|
-
Runtime request before `
|
|
221
|
+
Runtime request before `_startCall`:
|
|
267
222
|
```dart
|
|
268
223
|
await Permission.camera.request();
|
|
269
224
|
await Permission.microphone.request();
|
|
@@ -291,32 +246,30 @@ See `cometchat-flutter-v5-calls/references/share-invite.md` for full deep-link c
|
|
|
291
246
|
|
|
292
247
|
## Anti-patterns
|
|
293
248
|
|
|
294
|
-
1. **Using `CallSettings(
|
|
295
|
-
2. **`
|
|
296
|
-
3. **
|
|
297
|
-
4. **
|
|
298
|
-
5.
|
|
299
|
-
6. **
|
|
300
|
-
7.
|
|
301
|
-
8. **
|
|
302
|
-
|
|
249
|
+
1. **Using `CallSettingsBuilder()` / `CallSettings(...)` instead of `SessionSettingsBuilder()`.** `CallSettingsBuilder` is `@Deprecated` in 5.0.2.
|
|
250
|
+
2. **`CometChatCalls.startSession` / `generateToken` two-step.** Those are `@Deprecated` v4-compat shims. Use `joinSession` with `sessionId:` (or `callToken:`).
|
|
251
|
+
3. **Single `CometChatCallsEventsListener`.** `@Deprecated` in 5.0.2. Use the 5 split listeners on `CallSession.getInstance()`.
|
|
252
|
+
4. **Registering listeners before `joinSession.onSuccess`.** `CallSession.getInstance()` is null until the session is created — register inside `onSuccess`.
|
|
253
|
+
5. **`CometChatOngoingCallController` / `CometChatOngoingCallView`.** These do not exist in the Calls SDK. Render the `Widget?` from `onSuccess`.
|
|
254
|
+
6. **Skipping `CometChatOngoingCallService.abort()` in cleanup paths.** Android foreground-service notification persists after the call ends.
|
|
255
|
+
7. **Rendering the returned widget inside a constrained `Container`.** Clips. Use `SizedBox.expand`.
|
|
256
|
+
8. **No `mounted` check before `Navigator.pop`.** Async callback fires after dispose → exception.
|
|
257
|
+
9. **Popping the navigator from each termination event independently.** Crashes with `Bad state: No element` on the second pop. Funnel all termination events through ONE guarded `_navigateBack()`.
|
|
303
258
|
|
|
304
259
|
---
|
|
305
260
|
|
|
306
261
|
## Verification checklist
|
|
307
262
|
|
|
308
|
-
- [ ] `joinSession
|
|
309
|
-
- [ ] Settings built via `SessionSettingsBuilder()`, not `CallSettings`
|
|
310
|
-
- [ ] `SessionStatusListeners`
|
|
263
|
+
- [ ] `joinSession(sessionId:, sessionSettings:, onSuccess:, onError:)` — NOT `generateToken`/`startSession`
|
|
264
|
+
- [ ] Settings built via `SessionSettingsBuilder()`, not `CallSettingsBuilder` / `CallSettings(...)`
|
|
265
|
+
- [ ] `SessionStatusListeners` implemented and registered on `CallSession.getInstance()` inside `onSuccess`; removed in `dispose`
|
|
266
|
+
- [ ] Calls SDK logged in (`loginWithAuthToken` / `login`) before `joinSession`
|
|
311
267
|
- [ ] Returned widget rendered via `SizedBox.expand(child: _videoContainer)`
|
|
312
|
-
- [ ] `CometChatOngoingCallService.launch()`
|
|
313
|
-
- [ ] `CometChatOngoingCallService.abort()` called in EVERY termination path (dispose, onSessionLeft, onConnectionClosed, onSessionTimedOut, error)
|
|
314
|
-
- [ ] Listeners removed in `dispose` (avoid leaks)
|
|
268
|
+
- [ ] `CometChatOngoingCallService.launch()` after `onSuccess`; `.abort()` in EVERY termination path
|
|
315
269
|
- [ ] `mounted` check before `Navigator.pop`
|
|
316
|
-
- [ ] Single guarded `_navigateBack()`
|
|
270
|
+
- [ ] Single guarded `_navigateBack()` handles ALL termination events
|
|
271
|
+
- [ ] Teardown uses `CallSession.getInstance()?.leaveSession()`
|
|
317
272
|
- [ ] iOS `Info.plist` + Android `AndroidManifest.xml` permissions configured
|
|
318
|
-
- [ ] **Standalone session-only:** no `cometchat_chat_sdk` dependency — Calls SDK alone
|
|
319
|
-
- [ ] **Additive (chat + calls):** dual-SDK contract preserved (Chat first, then Calls)
|
|
320
273
|
- [ ] Real-device smoke: tap meeting link → app opens at /meet → joins → video flows → leave → notification clears
|
|
321
274
|
|
|
322
275
|
---
|
|
@@ -324,7 +277,9 @@ See `cometchat-flutter-v5-calls/references/share-invite.md` for full deep-link c
|
|
|
324
277
|
## Pointers
|
|
325
278
|
|
|
326
279
|
- `cometchat-react-calls/references/call-session.md` — cross-platform architecture
|
|
327
|
-
- `cometchat-flutter-v5-calls/SKILL.md` — Flutter V5 / GetX seven hard rules
|
|
280
|
+
- `cometchat-flutter-v5-calls/SKILL.md` — Flutter V5 / GetX seven hard rules (5.x Calls SDK)
|
|
328
281
|
- `cometchat-flutter-v5-calls/references/share-invite.md` — deep-link config
|
|
329
|
-
-
|
|
282
|
+
- `cometchat-flutter-v6-calls/references/call-session.md` — V6 (Bloc) sibling on the SAME 5.0.2 SDK
|
|
283
|
+
- Substrate of record: `~/.pub-cache/hosted/pub.dev/cometchat_calls_sdk-5.0.2/lib/src/plugin/cometchatcalls.dart` + `src/call_session.dart`
|
|
330
284
|
- Canonical docs: https://www.cometchat.com/docs/calls/flutter/join-session
|
|
285
|
+
```
|
|
@@ -9,14 +9,16 @@ The Calls SDK exposes basic camera switching (`switchCamera()`); audio device ma
|
|
|
9
9
|
|
|
10
10
|
## SDK API
|
|
11
11
|
|
|
12
|
+
Camera switching and audio-output selection are **instance methods on the `CallSession` singleton** (`cometchat_calls_sdk-5.0.2` `src/call_session.dart`). There is no `setSpeakerEnabled` in 5.x — audio output is chosen via `setAudioModeType(AudioMode)` where `AudioMode { speaker, earpiece, bluetooth }` (`src/enums/audio_mode.dart`).
|
|
13
|
+
|
|
12
14
|
```dart
|
|
13
|
-
import 'package:
|
|
15
|
+
import 'package:cometchat_calls_sdk/cometchat_calls_sdk.dart';
|
|
14
16
|
|
|
15
17
|
// Camera flip
|
|
16
|
-
|
|
18
|
+
CallSession.getInstance()?.switchCamera(); // call_session.dart:205
|
|
17
19
|
|
|
18
|
-
//
|
|
19
|
-
|
|
20
|
+
// Audio output (speaker / earpiece / bluetooth)
|
|
21
|
+
CallSession.getInstance()?.setAudioModeType(AudioMode.speaker); // call_session.dart:381
|
|
20
22
|
```
|
|
21
23
|
|
|
22
24
|
---
|
|
@@ -48,7 +50,7 @@ class CameraFlipButton extends StatelessWidget {
|
|
|
48
50
|
return IconButton(
|
|
49
51
|
icon: const Icon(Icons.flip_camera_ios),
|
|
50
52
|
onPressed: () {
|
|
51
|
-
|
|
53
|
+
CallSession.getInstance()?.switchCamera();
|
|
52
54
|
SemanticsService.announce('Camera flipped', TextDirection.ltr);
|
|
53
55
|
},
|
|
54
56
|
tooltip: 'Flip camera',
|
|
@@ -84,7 +86,9 @@ class CallController extends GetxController {
|
|
|
84
86
|
|
|
85
87
|
void toggleSpeaker() {
|
|
86
88
|
speakerOn.value = !speakerOn.value;
|
|
87
|
-
|
|
89
|
+
CallSession.getInstance()?.setAudioModeType(
|
|
90
|
+
speakerOn.value ? AudioMode.speaker : AudioMode.earpiece,
|
|
91
|
+
);
|
|
88
92
|
}
|
|
89
93
|
}
|
|
90
94
|
```
|
|
@@ -103,8 +107,8 @@ Web sister rules apply, plus Flutter-specific:
|
|
|
103
107
|
|
|
104
108
|
## Verification checklist
|
|
105
109
|
|
|
106
|
-
- [ ] Camera flip wired to `
|
|
107
|
-
- [ ] Speaker toggle uses `
|
|
110
|
+
- [ ] Camera flip wired to `CallSession.getInstance()?.switchCamera()`
|
|
111
|
+
- [ ] Speaker toggle uses `CallSession.getInstance()?.setAudioModeType(AudioMode.speaker | .earpiece)`
|
|
108
112
|
- [ ] System audio route picker (CallKit / ConnectionService) preferred for Bluetooth
|
|
109
113
|
- [ ] Real-device smoke: speaker toggle works
|
|
110
114
|
- [ ] Real-device smoke: camera flip works
|