@cometchat/calls-sdk-react-native 5.0.3 → 5.0.5

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.
@@ -0,0 +1,75 @@
1
+ #import <AVFoundation/AVFoundation.h>
2
+ #import <Foundation/Foundation.h>
3
+
4
+ #import <React/RCTBridgeModule.h>
5
+
6
+ // Where react-native-webrtc's headers land depends on how the host app links
7
+ // its pods, which an SDK does not get to choose: a directory named after the
8
+ // module under `use_frameworks!`, one named after the pod when CocoaPods
9
+ // namespaces its public headers, and the bare search path otherwise.
10
+ #if __has_include(<react_native_webrtc/WebRTCModuleOptions.h>)
11
+ #import <react_native_webrtc/WebRTCModuleOptions.h>
12
+ #elif __has_include(<react-native-webrtc/WebRTCModuleOptions.h>)
13
+ #import <react-native-webrtc/WebRTCModuleOptions.h>
14
+ #else
15
+ #import "WebRTCModuleOptions.h"
16
+ #endif
17
+
18
+ /**
19
+ * Opts every camera capture session react-native-webrtc creates into
20
+ * multitasking camera access, and reports to JS whether iOS actually grants it.
21
+ *
22
+ * Without it iOS interrupts capture
23
+ * (AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps)
24
+ * as soon as the app stops being the sole full-screen foreground app — which
25
+ * includes entering system Picture in Picture — and the local camera freezes on
26
+ * its last frame for everyone else in the call.
27
+ *
28
+ * react-native-webrtc reads the flag when it builds each VideoCaptureController
29
+ * and applies it in -startCapture, but only after checking
30
+ * AVCaptureSession.isMultitaskingCameraAccessSupported, so leaving it on is a
31
+ * no-op where the OS or device does not allow it. Support is limited to iPads
32
+ * that run Stage Manager before iOS 18; from iOS 18 it also covers
33
+ * video-conferencing apps that declare `voip` in UIBackgroundModes, which
34
+ * Info.plist already does.
35
+ */
36
+ /**
37
+ * Set at image load, so the flag is in place before any getUserMedia call — the
38
+ * capture session only reads it when the capture starts, so setting it later
39
+ * would not affect tracks that are already running. A constructor rather than a
40
+ * +load because RCT_EXPORT_MODULE already defines +load on this class.
41
+ */
42
+ __attribute__((constructor)) static void CometChatEnableMultitaskingCameraAccess(void) {
43
+ [WebRTCModuleOptions sharedInstance].enableMultitaskingCameraAccess = YES;
44
+ }
45
+
46
+ @interface MultitaskingCameraModule : NSObject <RCTBridgeModule>
47
+ @end
48
+
49
+ @implementation MultitaskingCameraModule
50
+
51
+ RCT_EXPORT_MODULE(MultitaskingCamera);
52
+
53
+ + (BOOL)requiresMainQueueSetup {
54
+ return NO;
55
+ }
56
+
57
+ /**
58
+ * Asked of a throwaway session on purpose: the answer turns on the device, the
59
+ * OS version and this app's own linkage and background modes, not on how a
60
+ * particular session is configured. Allocating a session neither touches the
61
+ * camera nor triggers the permission prompt.
62
+ */
63
+ + (BOOL)isSupported {
64
+ if (@available(iOS 16.0, *)) {
65
+ return [[AVCaptureSession alloc] init].isMultitaskingCameraAccessSupported;
66
+ }
67
+
68
+ return NO;
69
+ }
70
+
71
+ - (NSDictionary *)constantsToExport {
72
+ return @{@"isSupported" : @([MultitaskingCameraModule isSupported])};
73
+ }
74
+
75
+ @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/calls-sdk-react-native",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "CometChat Calls SDK for React Native provides voice and video calling capabilities for React Native applications.",
5
5
  "private": false,
6
6
  "main": "dist/index.js",
@@ -23,7 +23,34 @@
23
23
  "zustand": "^5.0.4"
24
24
  },
25
25
  "devDependencies": {},
26
- "peerDependencies": {},
26
+ "peerDependencies": {
27
+ "@react-native-async-storage/async-storage": "^2.1.2",
28
+ "react-native-background-timer": "^2.4.1",
29
+ "react-native-performance": "^5.1.2",
30
+ "react-native-svg": "^15.12.0",
31
+ "react-native-url-polyfill": "^2.0.0",
32
+ "react-native-webrtc": "^124.0.7"
33
+ },
34
+ "peerDependenciesMeta": {
35
+ "@react-native-async-storage/async-storage": {
36
+ "optional": true
37
+ },
38
+ "react-native-background-timer": {
39
+ "optional": true
40
+ },
41
+ "react-native-performance": {
42
+ "optional": true
43
+ },
44
+ "react-native-svg": {
45
+ "optional": true
46
+ },
47
+ "react-native-url-polyfill": {
48
+ "optional": true
49
+ },
50
+ "react-native-webrtc": {
51
+ "optional": true
52
+ }
53
+ },
27
54
  "engines": {
28
55
  "node": ">=18"
29
56
  },