@cometchat/calls-sdk-react-native 5.0.0-beta.1 → 5.0.0-beta.2
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/cometchat-calls-sdk-react-native.podspec +20 -0
- package/dist/index.d.mts +128 -2
- package/dist/index.d.ts +136 -10
- package/dist/index.js +127 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +127 -1
- package/dist/index.mjs.map +1 -1
- package/ios/Audio/CometChatAudioSession+Private.h +24 -0
- package/ios/Audio/CometChatAudioSession.h +26 -0
- package/ios/Audio/CometChatAudioSession.m +35 -0
- package/ios/Modules/AudioMode.m +384 -0
- package/ios/Modules/KeepAwake.h +4 -0
- package/ios/Modules/KeepAwake.m +29 -0
- package/package.json +10 -3
package/dist/index.mjs
CHANGED
|
@@ -454,59 +454,125 @@ function debounce(func, delay) {
|
|
|
454
454
|
//#endregion
|
|
455
455
|
//#region calls-sdk-core/utils/session-methods-core.ts
|
|
456
456
|
var SessionMethodsCore = class {
|
|
457
|
+
/**
|
|
458
|
+
* Mutes the local user's audio during the call.
|
|
459
|
+
*/
|
|
457
460
|
static muteAudio() {
|
|
458
461
|
muteAudioTrack();
|
|
459
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Unmutes the local user's audio during the call.
|
|
465
|
+
*/
|
|
460
466
|
static unmuteAudio() {
|
|
461
467
|
unMuteAudioTrack();
|
|
462
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* Pauses the local user's video stream.
|
|
471
|
+
*/
|
|
463
472
|
static pauseVideo() {
|
|
464
473
|
pauseVideoTrack();
|
|
465
474
|
}
|
|
475
|
+
/**
|
|
476
|
+
* Resumes the local user's video stream.
|
|
477
|
+
*/
|
|
466
478
|
static resumeVideo() {
|
|
467
479
|
resumeVideoTrack();
|
|
468
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Local user leaves the current session.
|
|
483
|
+
*/
|
|
469
484
|
static leaveSession() {
|
|
470
485
|
leaveSession();
|
|
471
486
|
}
|
|
487
|
+
/**
|
|
488
|
+
* Starts sharing the user's screen with other participants.
|
|
489
|
+
*/
|
|
472
490
|
static startScreenSharing() {
|
|
473
491
|
startScreenSharing();
|
|
474
492
|
}
|
|
493
|
+
/**
|
|
494
|
+
* Stops the ongoing screen sharing session.
|
|
495
|
+
*/
|
|
475
496
|
static stopScreenSharing() {
|
|
476
497
|
stopScreenSharing();
|
|
477
498
|
}
|
|
499
|
+
/**
|
|
500
|
+
* Raises the user's virtual hand in the call.
|
|
501
|
+
*/
|
|
478
502
|
static raiseHand() {
|
|
479
503
|
raisedHandLocal();
|
|
480
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Lowers the user's virtual hand in the call.
|
|
507
|
+
*/
|
|
481
508
|
static lowerHand() {
|
|
482
509
|
lowerHandLocal();
|
|
483
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* Switches between the front and rear camera.
|
|
513
|
+
*/
|
|
484
514
|
static switchCamera() {
|
|
485
515
|
switchCamera();
|
|
486
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* Sets the layout type for the call.
|
|
519
|
+
* @param layout - The type of layout to set (tile, sidebar or spotlight).
|
|
520
|
+
*/
|
|
487
521
|
static setLayout(layout$1) {
|
|
488
522
|
setLayout(layout$1);
|
|
489
523
|
}
|
|
524
|
+
/**
|
|
525
|
+
* Starts recording the call.
|
|
526
|
+
*/
|
|
490
527
|
static startRecording() {}
|
|
528
|
+
/**
|
|
529
|
+
* Stops the ongoing call recording.
|
|
530
|
+
*/
|
|
491
531
|
static stopRecording() {}
|
|
532
|
+
/**
|
|
533
|
+
* Enables Picture-in-Picture (PIP) layout during the call.
|
|
534
|
+
*/
|
|
492
535
|
static enablePictureInPictureLayout() {
|
|
493
536
|
enablePictureInPictureLayout();
|
|
494
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Disables Picture-in-Picture (PIP) layout.
|
|
540
|
+
*/
|
|
495
541
|
static disablePictureInPictureLayout() {
|
|
496
542
|
disablePictureInPictureLayout();
|
|
497
543
|
}
|
|
544
|
+
/**
|
|
545
|
+
* Pins a participant's video to focus on them.
|
|
546
|
+
* @param participantId - The ID of the participant to pin.
|
|
547
|
+
* @param type - The type of the participant.
|
|
548
|
+
*/
|
|
498
549
|
static pinParticipant(participantId, type) {
|
|
499
550
|
pinParticipant(participantId, type);
|
|
500
551
|
}
|
|
552
|
+
/**
|
|
553
|
+
* Unpins a participant's video.
|
|
554
|
+
*/
|
|
501
555
|
static unpinParticipant() {
|
|
502
556
|
unpinParticipant();
|
|
503
557
|
}
|
|
558
|
+
/**
|
|
559
|
+
* Mutes the audio of a specific participant.
|
|
560
|
+
* @param participantId - The ID of the participant to mute.
|
|
561
|
+
*/
|
|
504
562
|
static muteParticipant(participantId) {
|
|
505
563
|
muteParticipant(participantId);
|
|
506
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Pauses the video stream of a specific participant.
|
|
567
|
+
* @param participantId - The ID of the participant whose video to pause.
|
|
568
|
+
*/
|
|
507
569
|
static pauseParticipantVideo(participantId) {
|
|
508
570
|
pauseParticipantVideo(participantId);
|
|
509
571
|
}
|
|
572
|
+
/**
|
|
573
|
+
* Sets the unread message count displayed on the chat button.
|
|
574
|
+
* @param count - The number of unread messages.
|
|
575
|
+
*/
|
|
510
576
|
static setChatButtonUnreadCount(count) {
|
|
511
577
|
setChatButtonUnreadCount(count);
|
|
512
578
|
}
|
|
@@ -523,7 +589,7 @@ var SessionMethodsCore = class {
|
|
|
523
589
|
this.stopScreenSharing();
|
|
524
590
|
}
|
|
525
591
|
/**
|
|
526
|
-
* @deprecated switchToVideoCall is deprecated and not supported
|
|
592
|
+
* @deprecated switchToVideoCall is deprecated and not supported.
|
|
527
593
|
*/
|
|
528
594
|
static switchToVideoCall() {
|
|
529
595
|
console.error("switchToVideoCall method deprecated and not supported.");
|
|
@@ -10548,6 +10614,12 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10548
10614
|
static CallSettingsBuilder = CallSettingsBuilder;
|
|
10549
10615
|
static CallAppSettingsBuilder = CallAppSettingsBuilder;
|
|
10550
10616
|
static Component = AppComponent;
|
|
10617
|
+
/**
|
|
10618
|
+
* Initializes the CometChat Calls SDK with the provided app settings.
|
|
10619
|
+
* Must be called before any other SDK methods.
|
|
10620
|
+
* @param appSettings - The application settings for configuring the SDK.
|
|
10621
|
+
* @returns An object indicating success or failure with error details.
|
|
10622
|
+
*/
|
|
10551
10623
|
static async init(appSettings) {
|
|
10552
10624
|
const parsedAppSettings = v.safeParse(CallAppSettingsSchema, appSettings);
|
|
10553
10625
|
if (!parsedAppSettings.success) {
|
|
@@ -10582,6 +10654,14 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10582
10654
|
error: null
|
|
10583
10655
|
};
|
|
10584
10656
|
}
|
|
10657
|
+
/**
|
|
10658
|
+
* Logs in a user with their UID and an optional auth key.
|
|
10659
|
+
* If no auth key is provided, the one from app settings is used.
|
|
10660
|
+
* @param uid - The unique identifier of the user.
|
|
10661
|
+
* @param authKey - The authentication key. Falls back to the key provided in app settings.
|
|
10662
|
+
* @returns A Promise that resolves to the logged-in User object.
|
|
10663
|
+
* @throws {CometChatException} If login fails or validation errors occur.
|
|
10664
|
+
*/
|
|
10585
10665
|
static async login(uid, authKey) {
|
|
10586
10666
|
try {
|
|
10587
10667
|
if (this.loginInProgress) {
|
|
@@ -10639,6 +10719,12 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10639
10719
|
throw cometChatError;
|
|
10640
10720
|
}
|
|
10641
10721
|
}
|
|
10722
|
+
/**
|
|
10723
|
+
* Logs in a user directly with an auth token.
|
|
10724
|
+
* @param authToken - The authentication token for the user.
|
|
10725
|
+
* @returns A Promise that resolves to the logged-in User object.
|
|
10726
|
+
* @throws {CometChatException} If login fails or the token is invalid.
|
|
10727
|
+
*/
|
|
10642
10728
|
static async loginWithAuthToken(authToken) {
|
|
10643
10729
|
try {
|
|
10644
10730
|
if (this.loginInProgress) {
|
|
@@ -10681,6 +10767,11 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10681
10767
|
throw cometChatError;
|
|
10682
10768
|
}
|
|
10683
10769
|
}
|
|
10770
|
+
/**
|
|
10771
|
+
* Logs out the currently logged-in user and clears local session data.
|
|
10772
|
+
* @returns A Promise that resolves to a success message string.
|
|
10773
|
+
* @throws {CometChatException} If no user is logged in or logout fails.
|
|
10774
|
+
*/
|
|
10684
10775
|
static async logout() {
|
|
10685
10776
|
try {
|
|
10686
10777
|
if (!this.loggedInUser) {
|
|
@@ -10698,24 +10789,53 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10698
10789
|
throw cometChatError;
|
|
10699
10790
|
}
|
|
10700
10791
|
}
|
|
10792
|
+
/**
|
|
10793
|
+
* Retrieves the currently logged-in user.
|
|
10794
|
+
* @returns The logged-in User object, or null if no user is logged in.
|
|
10795
|
+
*/
|
|
10701
10796
|
static getLoggedInUser() {
|
|
10702
10797
|
if (this.loggedInUser && typeof this.loggedInUser === "string") {
|
|
10703
10798
|
this.loggedInUser = JSON.parse(this.loggedInUser);
|
|
10704
10799
|
}
|
|
10705
10800
|
return this.loggedInUser;
|
|
10706
10801
|
}
|
|
10802
|
+
/**
|
|
10803
|
+
* Retrieves the auth token of the currently logged-in user.
|
|
10804
|
+
* @returns The auth token string, or null if no user is logged in.
|
|
10805
|
+
*/
|
|
10707
10806
|
static getUserAuthToken() {
|
|
10708
10807
|
return this.loggedInUser?.authToken || null;
|
|
10709
10808
|
}
|
|
10809
|
+
/**
|
|
10810
|
+
* Checks whether a user is currently logged in.
|
|
10811
|
+
* @returns True if a user is logged in with a valid auth token, false otherwise.
|
|
10812
|
+
*/
|
|
10710
10813
|
static isUserLoggedIn() {
|
|
10711
10814
|
return this.loggedInUser !== null && this.loggedInUser.authToken !== undefined;
|
|
10712
10815
|
}
|
|
10816
|
+
/**
|
|
10817
|
+
* Registers a login listener to receive login/logout lifecycle callbacks.
|
|
10818
|
+
* @param listenerId - A unique identifier for the listener.
|
|
10819
|
+
* @param listener - The listener object with callback methods.
|
|
10820
|
+
*/
|
|
10713
10821
|
static addLoginListener(listenerId, listener) {
|
|
10714
10822
|
this.loginListeners.set(listenerId, listener);
|
|
10715
10823
|
}
|
|
10824
|
+
/**
|
|
10825
|
+
* Removes a previously registered login listener.
|
|
10826
|
+
* @param listenerId - The unique identifier of the listener to remove.
|
|
10827
|
+
*/
|
|
10716
10828
|
static removeLoginListener(listenerId) {
|
|
10717
10829
|
this.loginListeners.delete(listenerId);
|
|
10718
10830
|
}
|
|
10831
|
+
/**
|
|
10832
|
+
* Generates a call token for the given session.
|
|
10833
|
+
* Uses the provided auth token or falls back to the logged-in user's token.
|
|
10834
|
+
* @param sessionId - The session ID to generate a token for.
|
|
10835
|
+
* @param authToken - Optional auth token. If omitted, the logged-in user's token is used.
|
|
10836
|
+
* @returns A Promise that resolves to an object containing the generated token.
|
|
10837
|
+
* @throws {CometChatException} If the session ID is missing, no auth token is available, or the SDK is not initialized.
|
|
10838
|
+
*/
|
|
10719
10839
|
static async generateToken(sessionId, authToken) {
|
|
10720
10840
|
try {
|
|
10721
10841
|
if (!sessionId || sessionId.trim() === "") {
|
|
@@ -10949,6 +11069,12 @@ var CometChatCalls = class extends SessionMethodsCore {
|
|
|
10949
11069
|
}
|
|
10950
11070
|
});
|
|
10951
11071
|
}
|
|
11072
|
+
/**
|
|
11073
|
+
* Adds an event listener for SDK events.
|
|
11074
|
+
* @param eventType - The type of event to listen for.
|
|
11075
|
+
* @param listener - The callback function to invoke when the event fires.
|
|
11076
|
+
* @returns An unsubscribe function to remove the listener.
|
|
11077
|
+
*/
|
|
10952
11078
|
static addEventListener(eventType, listener) {
|
|
10953
11079
|
return eventBus.subscribe(eventType, listener);
|
|
10954
11080
|
}
|