@cometchat/calls-sdk-react-native 5.0.0-beta.2 → 5.0.0-beta.3
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/dist/index.d.mts +51 -56
- package/dist/index.d.ts +43 -48
- package/dist/index.js +160 -96
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +160 -96
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -44,17 +44,24 @@ var EventBus = class {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
subscribe(actionType, listener) {
|
|
47
|
+
subscribe(actionType, listener, options) {
|
|
48
|
+
if (options?.signal?.aborted) {
|
|
49
|
+
return () => {};
|
|
50
|
+
}
|
|
48
51
|
if (!this.actionListenersMap.get(actionType)) {
|
|
49
52
|
this.actionListenersMap.set(actionType, []);
|
|
50
53
|
}
|
|
51
54
|
this.actionListenersMap.get(actionType)?.push(listener);
|
|
52
|
-
|
|
55
|
+
const unsubscribe = () => {
|
|
53
56
|
const listenersList = this.actionListenersMap.get(actionType);
|
|
54
57
|
if (listenersList) {
|
|
55
58
|
this.actionListenersMap.set(actionType, listenersList.filter((l) => l !== listener));
|
|
56
59
|
}
|
|
57
60
|
};
|
|
61
|
+
if (options?.signal) {
|
|
62
|
+
options.signal.addEventListener("abort", unsubscribe, { once: true });
|
|
63
|
+
}
|
|
64
|
+
return unsubscribe;
|
|
58
65
|
}
|
|
59
66
|
};
|
|
60
67
|
const eventBus = new EventBus();
|
|
@@ -408,9 +415,9 @@ function getDefaultDevice(devices) {
|
|
|
408
415
|
|
|
409
416
|
//#endregion
|
|
410
417
|
//#region calls-sdk-core/utils/try-catch.ts
|
|
411
|
-
async function tryCatch(promise) {
|
|
418
|
+
async function tryCatch(promise, timeoutMs) {
|
|
412
419
|
try {
|
|
413
|
-
const data = await promise;
|
|
420
|
+
const data = timeoutMs != null ? await Promise.race([promise, new Promise((_, reject) => setTimeout(() => reject(new Error("timeout")), timeoutMs))]) : await promise;
|
|
414
421
|
return {
|
|
415
422
|
data,
|
|
416
423
|
error: null
|
|
@@ -485,18 +492,6 @@ var SessionMethodsCore = class {
|
|
|
485
492
|
leaveSession();
|
|
486
493
|
}
|
|
487
494
|
/**
|
|
488
|
-
* Starts sharing the user's screen with other participants.
|
|
489
|
-
*/
|
|
490
|
-
static startScreenSharing() {
|
|
491
|
-
startScreenSharing();
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Stops the ongoing screen sharing session.
|
|
495
|
-
*/
|
|
496
|
-
static stopScreenSharing() {
|
|
497
|
-
stopScreenSharing();
|
|
498
|
-
}
|
|
499
|
-
/**
|
|
500
495
|
* Raises the user's virtual hand in the call.
|
|
501
496
|
*/
|
|
502
497
|
static raiseHand() {
|
|
@@ -530,18 +525,6 @@ var SessionMethodsCore = class {
|
|
|
530
525
|
*/
|
|
531
526
|
static stopRecording() {}
|
|
532
527
|
/**
|
|
533
|
-
* Enables Picture-in-Picture (PIP) layout during the call.
|
|
534
|
-
*/
|
|
535
|
-
static enablePictureInPictureLayout() {
|
|
536
|
-
enablePictureInPictureLayout();
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Disables Picture-in-Picture (PIP) layout.
|
|
540
|
-
*/
|
|
541
|
-
static disablePictureInPictureLayout() {
|
|
542
|
-
disablePictureInPictureLayout();
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
528
|
* Pins a participant's video to focus on them.
|
|
546
529
|
* @param participantId - The ID of the participant to pin.
|
|
547
530
|
* @param type - The type of the participant.
|
|
@@ -577,18 +560,6 @@ var SessionMethodsCore = class {
|
|
|
577
560
|
setChatButtonUnreadCount(count);
|
|
578
561
|
}
|
|
579
562
|
/**
|
|
580
|
-
* @deprecated use startScreenSharing() instead
|
|
581
|
-
*/
|
|
582
|
-
static startScreenShare() {
|
|
583
|
-
this.startScreenSharing();
|
|
584
|
-
}
|
|
585
|
-
/**
|
|
586
|
-
* @deprecated use stopScreenSharing() instead
|
|
587
|
-
*/
|
|
588
|
-
static stopScreenShare() {
|
|
589
|
-
this.stopScreenSharing();
|
|
590
|
-
}
|
|
591
|
-
/**
|
|
592
563
|
* @deprecated switchToVideoCall is deprecated and not supported.
|
|
593
564
|
*/
|
|
594
565
|
static switchToVideoCall() {
|
|
@@ -679,6 +650,27 @@ async function createLocalTrack(type, deviceId = null, cameraFacing = CAMERA_FAC
|
|
|
679
650
|
}
|
|
680
651
|
}
|
|
681
652
|
}
|
|
653
|
+
function createLocalTracks() {
|
|
654
|
+
const enableCompanionMode = useConfigStore.getState().enableCompanionMode;
|
|
655
|
+
if (!enableCompanionMode) {
|
|
656
|
+
const audioInputDeviceId = useConfigStore.getState().audioInputDeviceId ?? useBaseStore.getState().audioInputDevice?.deviceId;
|
|
657
|
+
createLocalTrack("audio", audioInputDeviceId);
|
|
658
|
+
}
|
|
659
|
+
const sessionType = useConfigStore.getState().sessionType;
|
|
660
|
+
if (sessionType === SESSION_TYPE.VIDEO) {
|
|
661
|
+
const videoInputDeviceIdP1 = useConfigStore.getState().videoInputDeviceId;
|
|
662
|
+
const videoInputDeviceIdP2 = useBaseStore.getState().videoInputDevice?.deviceId;
|
|
663
|
+
const initialCameraFacingP1 = useConfigStore.getState().initialCameraFacing;
|
|
664
|
+
const initialCameraFacingP2 = useBaseStore.getState().cameraFacing;
|
|
665
|
+
if (videoInputDeviceIdP1) {
|
|
666
|
+
createLocalTrack("video", videoInputDeviceIdP1);
|
|
667
|
+
} else if (initialCameraFacingP1) {
|
|
668
|
+
createLocalTrack("video", null, initialCameraFacingP2);
|
|
669
|
+
} else {
|
|
670
|
+
createLocalTrack("video", videoInputDeviceIdP2, initialCameraFacingP2);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
}
|
|
682
674
|
function updateAudioInputDevice(deviceId) {
|
|
683
675
|
const audioInputDevices = useBaseStore.getState().audioInputDevices.filter((device) => device.deviceId !== "");
|
|
684
676
|
if (audioInputDevices.length > 0) {
|
|
@@ -878,7 +870,6 @@ const initialState$7 = {
|
|
|
878
870
|
hideLeaveSessionButton: false,
|
|
879
871
|
hideToggleAudioButton: false,
|
|
880
872
|
hideParticipantListButton: false,
|
|
881
|
-
hideSwitchLayoutButton: false,
|
|
882
873
|
hideChatButton: true,
|
|
883
874
|
hideToggleVideoButton: false,
|
|
884
875
|
hideScreenSharingButton: false,
|
|
@@ -895,7 +886,9 @@ const initialState$7 = {
|
|
|
895
886
|
idleTimeoutPeriodAfterPrompt: 18e4,
|
|
896
887
|
enableSpotlightDrag: true,
|
|
897
888
|
enableSpotlightSwap: true,
|
|
898
|
-
showFrameRate: false
|
|
889
|
+
showFrameRate: false,
|
|
890
|
+
enableCompanionMode: false,
|
|
891
|
+
isPeerCall: false
|
|
899
892
|
};
|
|
900
893
|
const useConfigStore = create()(subscribeWithSelector(combine(initialState$7, (set) => ({ reset: () => set(initialState$7) }))));
|
|
901
894
|
const setConfig = (config) => {
|
|
@@ -1173,13 +1166,22 @@ const useConferenceStore = create()(subscribeWithSelector(combine(initialState$5
|
|
|
1173
1166
|
leaveConference: async () => {
|
|
1174
1167
|
const conference = useConferenceStore.getState().conference;
|
|
1175
1168
|
if (conference) {
|
|
1176
|
-
const { error } = await tryCatch(conference.leave());
|
|
1169
|
+
const { error } = await tryCatch(conference.leave(), 500);
|
|
1177
1170
|
if (error) {
|
|
1178
1171
|
console.warn("Error leaving conference:", error);
|
|
1179
1172
|
eventBus.publish({ type: EVENT_LISTENER_METHODS.SessionStatusListener.onSessionLeft });
|
|
1180
1173
|
}
|
|
1181
1174
|
}
|
|
1182
1175
|
},
|
|
1176
|
+
endConference: async () => {
|
|
1177
|
+
const conference = useConferenceStore.getState().conference;
|
|
1178
|
+
if (conference) {
|
|
1179
|
+
const { error } = await tryCatch(conference.end());
|
|
1180
|
+
if (error) {
|
|
1181
|
+
console.warn("Error ending conference:", error);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1183
1185
|
stopRecording: async () => {
|
|
1184
1186
|
const conference = useConferenceStore.getState().conference;
|
|
1185
1187
|
if (conference) {
|
|
@@ -2023,12 +2025,34 @@ const useConnectionStore = create()(subscribeWithSelector(combine(initialState$2
|
|
|
2023
2025
|
},
|
|
2024
2026
|
reset: () => set(initialState$2)
|
|
2025
2027
|
}))));
|
|
2028
|
+
function waitForConnection() {
|
|
2029
|
+
const { connectionStatus } = useConnectionStore.getState();
|
|
2030
|
+
if (connectionStatus === "connected") return Promise.resolve();
|
|
2031
|
+
return new Promise((resolve, reject) => {
|
|
2032
|
+
const timeout = setTimeout(() => {
|
|
2033
|
+
unsub();
|
|
2034
|
+
reject(new Error("Connection timed out after 3 seconds"));
|
|
2035
|
+
}, 3e3);
|
|
2036
|
+
const unsub = useConnectionStore.subscribe((s) => s.connectionStatus, (status) => {
|
|
2037
|
+
if (status === "connected") {
|
|
2038
|
+
clearTimeout(timeout);
|
|
2039
|
+
unsub();
|
|
2040
|
+
resolve();
|
|
2041
|
+
} else if (status === "error") {
|
|
2042
|
+
clearTimeout(timeout);
|
|
2043
|
+
unsub();
|
|
2044
|
+
reject(useConnectionStore.getState().error);
|
|
2045
|
+
}
|
|
2046
|
+
});
|
|
2047
|
+
});
|
|
2048
|
+
}
|
|
2026
2049
|
|
|
2027
2050
|
//#endregion
|
|
2028
2051
|
//#region calls-sdk-core/store/utils/hooks.ts
|
|
2029
2052
|
const useHideMuteAudioButton = () => {
|
|
2030
2053
|
const hideMuteAudioButton = useConfigStore((state) => state.hideToggleAudioButton);
|
|
2031
|
-
|
|
2054
|
+
const enableCompanionMode = useConfigStore((state) => state.enableCompanionMode);
|
|
2055
|
+
return hideMuteAudioButton || enableCompanionMode;
|
|
2032
2056
|
};
|
|
2033
2057
|
const useHideToggleVideoButton = () => {
|
|
2034
2058
|
const hideToggleVideoButton = useConfigStore((state) => state.hideToggleVideoButton);
|
|
@@ -2346,8 +2370,13 @@ var ConferenceListener = class {
|
|
|
2346
2370
|
track.removeAllListeners(JitsiMeetJS.events.track.NO_DATA_FROM_SOURCE);
|
|
2347
2371
|
}
|
|
2348
2372
|
onConferenceJoinInProgress() {}
|
|
2349
|
-
onConferenceFailed(
|
|
2350
|
-
console.
|
|
2373
|
+
onConferenceFailed(errorName, error, message) {
|
|
2374
|
+
console.log();
|
|
2375
|
+
if (errorName === JitsiMeetJS.errors.conference.CONFERENCE_DESTROYED) {
|
|
2376
|
+
leaveSession({ forceLeave: true });
|
|
2377
|
+
return;
|
|
2378
|
+
}
|
|
2379
|
+
console.error("Conference failed:", errorName, error, message);
|
|
2351
2380
|
useConferenceStore.setState({
|
|
2352
2381
|
conferenceStatus: "error",
|
|
2353
2382
|
conferenceJoined: false,
|
|
@@ -2547,17 +2576,23 @@ function addConferenceListeners(conference) {
|
|
|
2547
2576
|
}
|
|
2548
2577
|
});
|
|
2549
2578
|
}
|
|
2550
|
-
async function
|
|
2579
|
+
async function _createConference() {
|
|
2580
|
+
const sessionId = useConfigStore.getState().sessionId;
|
|
2581
|
+
const connection = useConnectionStore.getState().connection;
|
|
2551
2582
|
if (!connection) {
|
|
2552
2583
|
throw new Error("No connection available");
|
|
2553
2584
|
}
|
|
2585
|
+
const connectionStatus = useConnectionStore.getState().connectionStatus;
|
|
2586
|
+
if (connectionStatus !== "connected") {
|
|
2587
|
+
await waitForConnection();
|
|
2588
|
+
}
|
|
2554
2589
|
const existingConference = useConferenceStore.getState().conference;
|
|
2555
2590
|
if (existingConference) {
|
|
2556
2591
|
console.log("Conference already exists, skipping creation");
|
|
2557
2592
|
return;
|
|
2558
2593
|
}
|
|
2559
2594
|
const connectionConfig = useConnectionStore.getState().connectionConfig;
|
|
2560
|
-
const conference = connection.initJitsiConference(
|
|
2595
|
+
const conference = connection.initJitsiConference(sessionId, connectionConfig);
|
|
2561
2596
|
const localAudioTrack = getLocalTrack(MEDIA_TYPE.AUDIO)?.originalTrack;
|
|
2562
2597
|
const localVideoTrack = getLocalTrack(MEDIA_TYPE.VIDEO)?.originalTrack;
|
|
2563
2598
|
if (localAudioTrack) {
|
|
@@ -2572,6 +2607,20 @@ async function createConference(connection, roomName) {
|
|
|
2572
2607
|
conference.setDisplayName(useParticipantStore.getState().localParticipant.name);
|
|
2573
2608
|
conference.join();
|
|
2574
2609
|
}
|
|
2610
|
+
async function createConference() {
|
|
2611
|
+
const conference = useConferenceStore.getState().conference;
|
|
2612
|
+
if (!conference) {
|
|
2613
|
+
const result = await tryCatch(_createConference());
|
|
2614
|
+
if (result.error) {
|
|
2615
|
+
console.error("Error creating conference", result.error);
|
|
2616
|
+
useConferenceStore.setState({
|
|
2617
|
+
conferenceStatus: "error",
|
|
2618
|
+
conferenceJoined: false,
|
|
2619
|
+
conferenceError: result.error.message
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2575
2624
|
function muteParticipant(participantId) {
|
|
2576
2625
|
const conference = useConferenceStore.getState().conference;
|
|
2577
2626
|
conference?.muteParticipant(participantId, "audio");
|
|
@@ -2583,7 +2632,12 @@ function pauseParticipantVideo(participantId) {
|
|
|
2583
2632
|
|
|
2584
2633
|
//#endregion
|
|
2585
2634
|
//#region calls-sdk-core/handlers/connection.ts
|
|
2586
|
-
function connect(
|
|
2635
|
+
async function connect(autoJoinConference = true) {
|
|
2636
|
+
const existingConnection = useConnectionStore.getState().connection;
|
|
2637
|
+
if (existingConnection) {
|
|
2638
|
+
createConference();
|
|
2639
|
+
return;
|
|
2640
|
+
}
|
|
2587
2641
|
const options = useConnectionStore.getState().connectionConfig;
|
|
2588
2642
|
const jwt = useConnectionStore.getState().jwt;
|
|
2589
2643
|
const iAmRecorder = useConfigStore.getState().iAmRecorder;
|
|
@@ -2599,15 +2653,8 @@ function connect(roomName) {
|
|
|
2599
2653
|
async function onConnectionEstablished() {
|
|
2600
2654
|
useConnectionStore.getState().connectionEstablished(connection);
|
|
2601
2655
|
eventBus.publish({ type: INTERNAL_EVENTS.onConnectionEstablished });
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
console.error("Error creating conference", result.error);
|
|
2605
|
-
useConferenceStore.setState({
|
|
2606
|
-
conferenceStatus: "error",
|
|
2607
|
-
conferenceJoined: false,
|
|
2608
|
-
conferenceError: result.error.message
|
|
2609
|
-
});
|
|
2610
|
-
}
|
|
2656
|
+
if (!autoJoinConference) return;
|
|
2657
|
+
createConference();
|
|
2611
2658
|
}
|
|
2612
2659
|
function onConnectionFailed(err, message, ...args) {
|
|
2613
2660
|
unsubscribe();
|
|
@@ -2813,6 +2860,7 @@ function initializeLib() {
|
|
|
2813
2860
|
let isSessionStarted = false;
|
|
2814
2861
|
let reconnectTimeoutId = null;
|
|
2815
2862
|
const RECONNECT_DEBOUNCE_DELAY = 3e3;
|
|
2863
|
+
initializeLib();
|
|
2816
2864
|
function startSession() {
|
|
2817
2865
|
const sessionId = useConfigStore.getState().sessionId;
|
|
2818
2866
|
if (!sessionId) {
|
|
@@ -2825,29 +2873,13 @@ function startSession() {
|
|
|
2825
2873
|
}
|
|
2826
2874
|
isSessionStarted = true;
|
|
2827
2875
|
console.log(`Session started in room: ${sessionId}`);
|
|
2828
|
-
|
|
2829
|
-
const audioInputDeviceId = useConfigStore.getState().audioInputDeviceId ?? useBaseStore.getState().audioInputDevice?.deviceId;
|
|
2830
|
-
createLocalTrack("audio", audioInputDeviceId);
|
|
2831
|
-
const sessionType = useConfigStore.getState().sessionType;
|
|
2832
|
-
if (sessionType === SESSION_TYPE.VIDEO) {
|
|
2833
|
-
const videoInputDeviceIdP1 = useConfigStore.getState().videoInputDeviceId;
|
|
2834
|
-
const videoInputDeviceIdP2 = useBaseStore.getState().videoInputDevice?.deviceId;
|
|
2835
|
-
const initialCameraFacingP1 = useConfigStore.getState().initialCameraFacing;
|
|
2836
|
-
const initialCameraFacingP2 = useBaseStore.getState().cameraFacing;
|
|
2837
|
-
if (videoInputDeviceIdP1) {
|
|
2838
|
-
createLocalTrack("video", videoInputDeviceIdP1);
|
|
2839
|
-
} else if (initialCameraFacingP1) {
|
|
2840
|
-
createLocalTrack("video", null, initialCameraFacingP2);
|
|
2841
|
-
} else {
|
|
2842
|
-
createLocalTrack("video", videoInputDeviceIdP2, initialCameraFacingP2);
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2876
|
+
createLocalTracks();
|
|
2845
2877
|
const audioOutputDeviceId = useConfigStore.getState().audioOutputDeviceId ?? useBaseStore.getState().audioOutputDevice?.deviceId;
|
|
2846
2878
|
if (audioOutputDeviceId) {
|
|
2847
2879
|
updateAudioOutputDevice(audioOutputDeviceId);
|
|
2848
2880
|
}
|
|
2849
2881
|
eventBus.startEmitting();
|
|
2850
|
-
const test = tryCatchSync(() => connect(
|
|
2882
|
+
const test = tryCatchSync(() => connect());
|
|
2851
2883
|
if (test.error) {
|
|
2852
2884
|
console.error("Error connecting to session:", test.error);
|
|
2853
2885
|
useConnectionStore.getState().connectionFailed(test.error.message);
|
|
@@ -2864,8 +2896,14 @@ async function _leaveSession() {
|
|
|
2864
2896
|
await useConnectionStore.getState().disconnect();
|
|
2865
2897
|
}
|
|
2866
2898
|
const sessionMutex = new Mutex();
|
|
2867
|
-
function leaveSession() {
|
|
2899
|
+
function leaveSession(options = {}) {
|
|
2868
2900
|
return sessionMutex.run(async () => {
|
|
2901
|
+
const isPeerCall = useConfigStore.getState().isPeerCall;
|
|
2902
|
+
const shouldEnd = isPeerCall && !options.forceLeave;
|
|
2903
|
+
if (shouldEnd) {
|
|
2904
|
+
useConferenceStore.getState().endConference();
|
|
2905
|
+
return;
|
|
2906
|
+
}
|
|
2869
2907
|
useBaseStore.getState().clearIdealTimeoutTimer();
|
|
2870
2908
|
cancelPendingReconnect();
|
|
2871
2909
|
await _leaveSession();
|
|
@@ -3962,6 +4000,11 @@ const PopupMenu = ({ visible, onClose, options, anchorLayout }) => {
|
|
|
3962
4000
|
return /* @__PURE__ */ jsx(Modal, {
|
|
3963
4001
|
transparent: true,
|
|
3964
4002
|
animationType: "none",
|
|
4003
|
+
supportedOrientations: [
|
|
4004
|
+
"portrait",
|
|
4005
|
+
"landscape-left",
|
|
4006
|
+
"landscape-right"
|
|
4007
|
+
],
|
|
3965
4008
|
onRequestClose: onClose,
|
|
3966
4009
|
children: /* @__PURE__ */ jsx(Pressable, {
|
|
3967
4010
|
style: styles$27.backdrop,
|
|
@@ -5048,6 +5091,11 @@ function ConfirmationDialog() {
|
|
|
5048
5091
|
visible,
|
|
5049
5092
|
transparent: true,
|
|
5050
5093
|
animationType: "fade",
|
|
5094
|
+
supportedOrientations: [
|
|
5095
|
+
"portrait",
|
|
5096
|
+
"landscape-left",
|
|
5097
|
+
"landscape-right"
|
|
5098
|
+
],
|
|
5051
5099
|
onRequestClose: handleBackdropPress,
|
|
5052
5100
|
children: /* @__PURE__ */ jsx(Pressable, {
|
|
5053
5101
|
style: styles$15.backdrop,
|
|
@@ -5852,6 +5900,11 @@ const IdealTimeoutModal = ({ style = {} }) => {
|
|
|
5852
5900
|
transparent: true,
|
|
5853
5901
|
visible: idleTimeoutModalVisible,
|
|
5854
5902
|
animationType: "none",
|
|
5903
|
+
supportedOrientations: [
|
|
5904
|
+
"portrait",
|
|
5905
|
+
"landscape-left",
|
|
5906
|
+
"landscape-right"
|
|
5907
|
+
],
|
|
5855
5908
|
statusBarTranslucent: true,
|
|
5856
5909
|
children: /* @__PURE__ */ jsx(TouchableWithoutFeedback, {
|
|
5857
5910
|
onPress: handleOverlayPress,
|
|
@@ -5904,7 +5957,7 @@ const IdealTimeoutModal = ({ style = {} }) => {
|
|
|
5904
5957
|
})
|
|
5905
5958
|
}), /* @__PURE__ */ jsx(TouchableOpacity, {
|
|
5906
5959
|
style: [styles$6.button, styles$6.buttonPrimary],
|
|
5907
|
-
onPress: leaveSession,
|
|
5960
|
+
onPress: () => leaveSession(),
|
|
5908
5961
|
activeOpacity: .8,
|
|
5909
5962
|
children: /* @__PURE__ */ jsx(Text, {
|
|
5910
5963
|
style: [commonStyles.bodyMedium, styles$6.buttonPrimaryText],
|
|
@@ -5933,6 +5986,7 @@ const styles$6 = StyleSheet.create({
|
|
|
5933
5986
|
borderWidth: 1,
|
|
5934
5987
|
borderColor: "#383838",
|
|
5935
5988
|
width: "100%",
|
|
5989
|
+
maxWidth: 372,
|
|
5936
5990
|
paddingTop: 32,
|
|
5937
5991
|
paddingHorizontal: 20,
|
|
5938
5992
|
paddingBottom: 20,
|
|
@@ -6474,11 +6528,11 @@ function CallUI(props) {
|
|
|
6474
6528
|
const isConferenceJoined = useIsConferenceJoined();
|
|
6475
6529
|
useLayoutEffect(() => {
|
|
6476
6530
|
eventBus.publish({ type: INTERNAL_EVENTS.lifecycle.componentDidMount });
|
|
6477
|
-
updateConfig(props.
|
|
6531
|
+
updateConfig(props.sessionSettings);
|
|
6478
6532
|
return () => {
|
|
6479
6533
|
eventBus.publish({ type: INTERNAL_EVENTS.lifecycle.componentWillUnmount }, true);
|
|
6480
6534
|
};
|
|
6481
|
-
}, [props.
|
|
6535
|
+
}, [props.sessionSettings]);
|
|
6482
6536
|
useEffect(() => {
|
|
6483
6537
|
useBaseStore.setState({ sdkPlatform: Platform.OS });
|
|
6484
6538
|
startSession();
|
|
@@ -6495,13 +6549,13 @@ function CallUI(props) {
|
|
|
6495
6549
|
useEffect(() => {
|
|
6496
6550
|
if (Platform.OS === "android") {
|
|
6497
6551
|
AudioModeModule_default.setMode(type === SESSION_TYPE.VOICE ? AudioModeModule_default.AUDIO_CALL : AudioModeModule_default.VIDEO_CALL);
|
|
6498
|
-
if (props.
|
|
6499
|
-
AudioModeModule_default.setAudioDevice(props.
|
|
6552
|
+
if (props.sessionSettings.audioMode) {
|
|
6553
|
+
AudioModeModule_default.setAudioDevice(props.sessionSettings.audioMode);
|
|
6500
6554
|
}
|
|
6501
6555
|
} else if (Platform.OS === "ios") {
|
|
6502
6556
|
AudioModeModule_default.updateDeviceList();
|
|
6503
6557
|
}
|
|
6504
|
-
}, [props.
|
|
6558
|
+
}, [props.sessionSettings.audioMode, type]);
|
|
6505
6559
|
if (isPIPLayoutEnabled) {
|
|
6506
6560
|
return /* @__PURE__ */ jsx(PiPTile_default, {});
|
|
6507
6561
|
}
|
|
@@ -6793,8 +6847,8 @@ async function callVerifyTokenAPI({ appId, region, calltoken, baseURL }) {
|
|
|
6793
6847
|
}
|
|
6794
6848
|
|
|
6795
6849
|
//#endregion
|
|
6796
|
-
//#region src/
|
|
6797
|
-
function
|
|
6850
|
+
//#region src/AppReactNativeSDK.tsx
|
|
6851
|
+
function AppReactNativeSDK(props) {
|
|
6798
6852
|
const [internalSettings, setInternalSettings] = React.useState(null);
|
|
6799
6853
|
const [infoMessage, setInfoMessage] = React.useState(null);
|
|
6800
6854
|
useEffect(() => {
|
|
@@ -6806,7 +6860,7 @@ function App(props) {
|
|
|
6806
6860
|
}, []);
|
|
6807
6861
|
useEffect(() => {
|
|
6808
6862
|
const listeners = [];
|
|
6809
|
-
const cs = props.
|
|
6863
|
+
const cs = props.sessionSettings ?? {};
|
|
6810
6864
|
if (cs.listener?.onUserJoined) {
|
|
6811
6865
|
listeners.push(CometChatCalls.addEventListener("onParticipantJoined", cs.listener.onUserJoined));
|
|
6812
6866
|
}
|
|
@@ -6844,7 +6898,7 @@ function App(props) {
|
|
|
6844
6898
|
listener();
|
|
6845
6899
|
});
|
|
6846
6900
|
};
|
|
6847
|
-
}, [props.
|
|
6901
|
+
}, [props.sessionSettings]);
|
|
6848
6902
|
useEffect(() => {
|
|
6849
6903
|
callVerifyTokenAPI({
|
|
6850
6904
|
appId: CometChatCalls.appSettings?.appId || "",
|
|
@@ -6873,14 +6927,12 @@ function App(props) {
|
|
|
6873
6927
|
visible: true
|
|
6874
6928
|
});
|
|
6875
6929
|
}
|
|
6876
|
-
return /* @__PURE__ */ jsx(index_native_default, {
|
|
6877
|
-
...props.
|
|
6878
|
-
...convertLegacyCallSettingsToV5Props(props?.
|
|
6930
|
+
return /* @__PURE__ */ jsx(index_native_default, { sessionSettings: {
|
|
6931
|
+
...props.sessionSettings,
|
|
6932
|
+
...convertLegacyCallSettingsToV5Props(props?.sessionSettings ?? {}),
|
|
6879
6933
|
internalSettings
|
|
6880
6934
|
} });
|
|
6881
6935
|
}
|
|
6882
|
-
var AppRN_default = App;
|
|
6883
|
-
const AppComponent = App;
|
|
6884
6936
|
|
|
6885
6937
|
//#endregion
|
|
6886
6938
|
//#region src/v4/Constants.ts
|
|
@@ -10613,7 +10665,7 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10613
10665
|
static OngoingCallListener = OngoingCallListener;
|
|
10614
10666
|
static CallSettingsBuilder = CallSettingsBuilder;
|
|
10615
10667
|
static CallAppSettingsBuilder = CallAppSettingsBuilder;
|
|
10616
|
-
static Component =
|
|
10668
|
+
static Component = AppReactNativeSDK;
|
|
10617
10669
|
/**
|
|
10618
10670
|
* Initializes the CometChat Calls SDK with the provided app settings.
|
|
10619
10671
|
* Must be called before any other SDK methods.
|
|
@@ -10704,7 +10756,6 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10704
10756
|
if (this.loggedInUser && this.loggedInUser.uid !== uid) {
|
|
10705
10757
|
await this.logoutInternal();
|
|
10706
10758
|
}
|
|
10707
|
-
console.log("Logging in user with UID:", uid);
|
|
10708
10759
|
const authToken = await this.loginWithUID(uid, resolvedAuthKey);
|
|
10709
10760
|
const user = await this.authenticateWithToken(authToken);
|
|
10710
10761
|
this.loginInProgress = false;
|
|
@@ -11073,10 +11124,23 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
11073
11124
|
* Adds an event listener for SDK events.
|
|
11074
11125
|
* @param eventType - The type of event to listen for.
|
|
11075
11126
|
* @param listener - The callback function to invoke when the event fires.
|
|
11127
|
+
* @param options - Optional configuration including an AbortSignal for automatic cleanup.
|
|
11076
11128
|
* @returns An unsubscribe function to remove the listener.
|
|
11077
11129
|
*/
|
|
11078
|
-
static addEventListener(eventType, listener) {
|
|
11079
|
-
return eventBus.subscribe(eventType, listener);
|
|
11130
|
+
static addEventListener(eventType, listener, options) {
|
|
11131
|
+
return eventBus.subscribe(eventType, listener, options);
|
|
11132
|
+
}
|
|
11133
|
+
/**
|
|
11134
|
+
* Enables Picture-in-Picture (PIP) layout during the call.
|
|
11135
|
+
*/
|
|
11136
|
+
static enablePictureInPictureLayout() {
|
|
11137
|
+
enablePictureInPictureLayout();
|
|
11138
|
+
}
|
|
11139
|
+
/**
|
|
11140
|
+
* Disables Picture-in-Picture (PIP) layout.
|
|
11141
|
+
*/
|
|
11142
|
+
static disablePictureInPictureLayout() {
|
|
11143
|
+
disablePictureInPictureLayout();
|
|
11080
11144
|
}
|
|
11081
11145
|
};
|
|
11082
11146
|
|