@stream-io/video-react-native-sdk 1.31.1-beta.0 → 1.31.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/CHANGELOG.md +11 -0
- package/android/src/main/AndroidManifest.xml +1 -8
- package/android/src/main/AndroidManifestNew.xml +0 -11
- package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +5 -42
- package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +6 -70
- package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +4 -6
- package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +95 -0
- package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js +2 -6
- package/dist/commonjs/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
- package/dist/commonjs/hooks/push/index.js +2 -0
- package/dist/commonjs/hooks/push/index.js.map +1 -1
- package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +160 -0
- package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +67 -0
- package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -0
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +97 -64
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/commonjs/index.js +0 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/modules/call-manager/CallManager.js +0 -26
- package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
- package/dist/commonjs/providers/StreamCall/index.js +6 -6
- package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
- package/dist/commonjs/utils/StreamVideoRN/index.js +21 -35
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +3 -53
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/push/android.js +202 -135
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/internal/ios.js +34 -17
- package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
- package/dist/commonjs/utils/push/internal/rxSubjects.js +45 -1
- package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
- package/dist/commonjs/utils/push/internal/utils.js +53 -71
- package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
- package/dist/commonjs/utils/push/ios.js.map +1 -1
- package/dist/commonjs/utils/push/libs/callkeep.js +17 -0
- package/dist/commonjs/utils/push/libs/callkeep.js.map +1 -0
- package/dist/commonjs/utils/push/libs/index.js +19 -8
- package/dist/commonjs/utils/push/libs/index.js.map +1 -1
- package/dist/commonjs/utils/push/libs/notifee/index.js +19 -0
- package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
- package/dist/commonjs/utils/push/libs/voipPushNotification.js +17 -0
- package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +1 -0
- package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +205 -0
- package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -0
- package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +6 -7
- package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/commonjs/version.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js +2 -6
- package/dist/module/components/Participant/ParticipantView/ParticipantLabel.js.map +1 -1
- package/dist/module/hooks/push/index.js +2 -0
- package/dist/module/hooks/push/index.js.map +1 -1
- package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +153 -0
- package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/module/hooks/push/useProcessPushCallEffect.js +60 -0
- package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -0
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +99 -66
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/module/index.js +0 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/modules/call-manager/CallManager.js +0 -26
- package/dist/module/modules/call-manager/CallManager.js.map +1 -1
- package/dist/module/providers/StreamCall/index.js +6 -6
- package/dist/module/providers/StreamCall/index.js.map +1 -1
- package/dist/module/utils/StreamVideoRN/index.js +21 -35
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/internal/registerSDKGlobals.js +3 -53
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/push/android.js +204 -137
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/internal/ios.js +34 -17
- package/dist/module/utils/push/internal/ios.js.map +1 -1
- package/dist/module/utils/push/internal/rxSubjects.js +44 -0
- package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
- package/dist/module/utils/push/internal/utils.js +50 -67
- package/dist/module/utils/push/internal/utils.js.map +1 -1
- package/dist/module/utils/push/ios.js.map +1 -1
- package/dist/module/utils/push/libs/callkeep.js +11 -0
- package/dist/module/utils/push/libs/callkeep.js.map +1 -0
- package/dist/module/utils/push/libs/index.js +2 -1
- package/dist/module/utils/push/libs/index.js.map +1 -1
- package/dist/module/utils/push/libs/notifee/index.js +18 -0
- package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
- package/dist/module/utils/push/libs/voipPushNotification.js +11 -0
- package/dist/module/utils/push/libs/voipPushNotification.js.map +1 -0
- package/dist/module/utils/push/setupIosCallKeepEvents.js +199 -0
- package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -0
- package/dist/module/utils/push/setupIosVoipPushEvents.js +6 -7
- package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
- package/dist/module/version.js +1 -1
- package/dist/module/version.js.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/ParticipantLabel.d.ts.map +1 -1
- package/dist/typescript/hooks/push/index.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +5 -0
- package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -0
- package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +8 -0
- package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -0
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
- package/dist/typescript/index.d.ts +0 -1
- package/dist/typescript/index.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/CallManager.d.ts +0 -5
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts +2 -22
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +25 -59
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
- package/dist/typescript/utils/push/android.d.ts +2 -1
- package/dist/typescript/utils/push/android.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts +33 -0
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/utils.d.ts +8 -14
- package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
- package/dist/typescript/utils/push/ios.d.ts +2 -1
- package/dist/typescript/utils/push/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/callkeep.d.ts +3 -0
- package/dist/typescript/utils/push/libs/callkeep.d.ts.map +1 -0
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +2 -16
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/index.d.ts +2 -1
- package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/notifee/index.d.ts +1 -0
- package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +3 -0
- package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +1 -0
- package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +6 -0
- package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -0
- package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
- package/dist/typescript/version.d.ts +1 -1
- package/dist/typescript/version.d.ts.map +1 -1
- package/expo-config-plugin/dist/withAndroidManifest.js +33 -1
- package/expo-config-plugin/dist/withAndroidPermissions.js +7 -2
- package/expo-config-plugin/dist/withAppDelegate.js +197 -19
- package/expo-config-plugin/dist/withMainActivity.js +1 -1
- package/expo-config-plugin/dist/withiOSInfoPlist.js +3 -2
- package/ios/StreamInCallManager.m +0 -2
- package/ios/StreamInCallManager.swift +7 -19
- package/ios/StreamVideoReactNative.h +4 -7
- package/ios/StreamVideoReactNative.m +82 -189
- package/package.json +16 -11
- package/src/components/Participant/ParticipantView/ParticipantLabel.tsx +2 -7
- package/src/hooks/push/index.ts +2 -0
- package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +235 -0
- package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +34 -21
- package/src/hooks/push/useProcessPushCallEffect.ts +108 -0
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +120 -94
- package/src/index.ts +0 -1
- package/src/modules/call-manager/CallManager.ts +0 -36
- package/src/modules/call-manager/native-module.d.ts +0 -7
- package/src/providers/StreamCall/index.tsx +6 -6
- package/src/utils/StreamVideoRN/index.ts +30 -42
- package/src/utils/StreamVideoRN/types.ts +25 -61
- package/src/utils/internal/registerSDKGlobals.ts +4 -52
- package/src/utils/push/android.ts +311 -198
- package/src/utils/push/internal/ios.ts +44 -28
- package/src/utils/push/internal/rxSubjects.ts +61 -0
- package/src/utils/push/internal/utils.ts +64 -108
- package/src/utils/push/ios.ts +6 -1
- package/src/utils/push/libs/callkeep.ts +16 -0
- package/src/utils/push/libs/index.ts +2 -1
- package/src/utils/push/libs/notifee/index.ts +27 -0
- package/src/utils/push/libs/voipPushNotification.ts +17 -0
- package/src/utils/push/setupIosCallKeepEvents.ts +252 -0
- package/src/utils/push/setupIosVoipPushEvents.ts +7 -11
- package/src/version.ts +1 -1
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +0 -83
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +0 -149
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +0 -144
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
- package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +0 -68
- package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +0 -1
- package/dist/commonjs/utils/internal/callingx/callingx.js +0 -150
- package/dist/commonjs/utils/internal/callingx/callingx.js.map +0 -1
- package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +0 -48
- package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +0 -1
- package/dist/commonjs/utils/push/libs/callingx.js +0 -75
- package/dist/commonjs/utils/push/libs/callingx.js.map +0 -1
- package/dist/commonjs/utils/push/setupCallingExpEvents.js +0 -105
- package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +0 -1
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +0 -137
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
- package/dist/module/utils/internal/callingx/audioSessionPromise.js +0 -61
- package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +0 -1
- package/dist/module/utils/internal/callingx/callingx.js +0 -140
- package/dist/module/utils/internal/callingx/callingx.js.map +0 -1
- package/dist/module/utils/keepCallAliveHeadlessTask.js +0 -42
- package/dist/module/utils/keepCallAliveHeadlessTask.js.map +0 -1
- package/dist/module/utils/push/libs/callingx.js +0 -67
- package/dist/module/utils/push/libs/callingx.js.map +0 -1
- package/dist/module/utils/push/setupCallingExpEvents.js +0 -99
- package/dist/module/utils/push/setupCallingExpEvents.js.map +0 -1
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +0 -5
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +0 -1
- package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +0 -16
- package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +0 -1
- package/dist/typescript/utils/internal/callingx/callingx.d.ts +0 -18
- package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +0 -1
- package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +0 -10
- package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/callingx.d.ts +0 -9
- package/dist/typescript/utils/push/libs/callingx.d.ts.map +0 -1
- package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +0 -8
- package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +0 -1
- package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +0 -189
- package/src/utils/internal/callingx/audioSessionPromise.ts +0 -65
- package/src/utils/internal/callingx/callingx.ts +0 -194
- package/src/utils/keepCallAliveHeadlessTask.ts +0 -54
- package/src/utils/push/libs/callingx.ts +0 -89
- package/src/utils/push/setupCallingExpEvents.ts +0 -135
|
@@ -5,18 +5,6 @@ import {
|
|
|
5
5
|
} from '@stream-io/video-client';
|
|
6
6
|
import type { AndroidChannel } from '@notifee/react-native';
|
|
7
7
|
|
|
8
|
-
export type AndroidChannelConfig = {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
sound?: string;
|
|
12
|
-
vibration?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type KeepAliveAndroidNotificationTexts = {
|
|
16
|
-
title: string;
|
|
17
|
-
body: string;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
8
|
export type NonRingingPushEvent =
|
|
21
9
|
| 'call.live_started'
|
|
22
10
|
| 'call.notification'
|
|
@@ -44,27 +32,6 @@ export type StreamVideoConfig = {
|
|
|
44
32
|
* @example "production-apn-video" or "staging-apn-video" based on the environment
|
|
45
33
|
*/
|
|
46
34
|
pushProviderName?: string;
|
|
47
|
-
supportsVideo?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Sound to play when an incoming call is received. Must be a valid sound resource name in the project.
|
|
50
|
-
* @default '' (no sound)
|
|
51
|
-
*/
|
|
52
|
-
sound?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Image to display when an incoming call is received. Must be a valid image resource name in the project.
|
|
55
|
-
* @default '' (no image)
|
|
56
|
-
*/
|
|
57
|
-
imageName?: string;
|
|
58
|
-
/**
|
|
59
|
-
* Enable calls history. When enabled, the call will be added to the calls history.
|
|
60
|
-
* @default false
|
|
61
|
-
*/
|
|
62
|
-
callsHistory?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* Timeout to display an incoming call. When the call is displayed for more than the timeout, the call will be rejected.
|
|
65
|
-
* @default 60000 (1 minute)
|
|
66
|
-
*/
|
|
67
|
-
displayCallTimeout?: number;
|
|
68
35
|
};
|
|
69
36
|
android: {
|
|
70
37
|
/**
|
|
@@ -94,30 +61,28 @@ export type StreamVideoConfig = {
|
|
|
94
61
|
* The notification channel to be used for incoming calls for Android.
|
|
95
62
|
* @example
|
|
96
63
|
* {
|
|
97
|
-
* id: '
|
|
98
|
-
* name: 'Incoming
|
|
99
|
-
*
|
|
100
|
-
* vibration?: boolean;
|
|
64
|
+
* id: 'stream_incoming_call',
|
|
65
|
+
* name: 'Incoming call notifications',
|
|
66
|
+
* importance: AndroidImportance.HIGH,
|
|
101
67
|
* }
|
|
102
68
|
*/
|
|
103
|
-
|
|
69
|
+
incomingCallChannel?: AndroidChannel;
|
|
104
70
|
/**
|
|
105
|
-
*
|
|
106
|
-
* If not provided, platform defaults will be used.
|
|
71
|
+
* Functions to create the texts shown in the notification for incoming calls in Android.
|
|
107
72
|
* @example
|
|
108
73
|
* {
|
|
109
|
-
*
|
|
110
|
-
*
|
|
74
|
+
* getTitle: (createdUserName: string) => `Incoming call from ${createdUserName}`,
|
|
75
|
+
* getBody: (createdUserName: string) => `Tap to answer the call`
|
|
76
|
+
* getAcceptButtonTitle?: () => `Accept`,
|
|
77
|
+
* getDeclineButtonTitle?: () => `Decline`,
|
|
111
78
|
* }
|
|
112
79
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
80
|
+
incomingCallNotificationTextGetters?: {
|
|
81
|
+
getTitle: (createdUserName: string) => string;
|
|
82
|
+
getBody: (createdUserName: string) => string;
|
|
83
|
+
getAcceptButtonTitle?: () => string;
|
|
84
|
+
getDeclineButtonTitle?: () => string;
|
|
116
85
|
};
|
|
117
|
-
/**
|
|
118
|
-
* The transformer to be used to transform the call title in the notification for ringing and ongoing calls for Android.
|
|
119
|
-
*/
|
|
120
|
-
titleTransformer?: (memberName: string, incoming: boolean) => string;
|
|
121
86
|
/**
|
|
122
87
|
* Functions to create the texts shown in the notification for non ringing calls in Android.
|
|
123
88
|
* @example
|
|
@@ -146,16 +111,6 @@ export type StreamVideoConfig = {
|
|
|
146
111
|
getBody: (type: NonRingingPushEvent, createdUserName: string) => string;
|
|
147
112
|
};
|
|
148
113
|
};
|
|
149
|
-
/**
|
|
150
|
-
* Whether to enable ongoing calls.
|
|
151
|
-
* @default false
|
|
152
|
-
*/
|
|
153
|
-
enableOngoingCalls?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Whether to reject calls when the user is busy.
|
|
156
|
-
* @default false
|
|
157
|
-
*/
|
|
158
|
-
shouldRejectCallWhenBusy?: boolean;
|
|
159
114
|
/**
|
|
160
115
|
* This function is used to create a custom video client.
|
|
161
116
|
* This is used create a video client for incoming calls in the background and inform call events to the server.
|
|
@@ -175,6 +130,12 @@ export type StreamVideoConfig = {
|
|
|
175
130
|
* }
|
|
176
131
|
*/
|
|
177
132
|
createStreamVideoClient: () => Promise<StreamVideoClient | undefined>;
|
|
133
|
+
/** @deprecated This method will be removed in the future. Please watch for incoming and outgoing calls in the root component of your app.
|
|
134
|
+
Please see https://getstream.io/video/docs/react-native/advanced/ringing-calls/#watch-for-incoming-and-outgoing-calls for more information */
|
|
135
|
+
navigateAcceptCall?: () => void;
|
|
136
|
+
/** @deprecated This method will be removed in the future. Please watch for incoming and outgoing calls in the root component of your app.
|
|
137
|
+
Please see https://getstream.io/video/docs/react-native/advanced/ringing-calls/#watch-for-incoming-and-outgoing-calls for more information */
|
|
138
|
+
navigateToIncomingCall?: () => void;
|
|
178
139
|
/** Callback that is called when a non ringing push notification was tapped */
|
|
179
140
|
onTapNonRingingCallNotification?: (
|
|
180
141
|
call_cid: string,
|
|
@@ -186,11 +147,14 @@ export type StreamVideoConfig = {
|
|
|
186
147
|
/**
|
|
187
148
|
* The notification channel to keep call alive in the background for Android using a foreground service.
|
|
188
149
|
*/
|
|
189
|
-
channel:
|
|
150
|
+
channel: AndroidChannel;
|
|
190
151
|
/**
|
|
191
152
|
* The texts shown in the notification to keep call alive in the background
|
|
192
153
|
*/
|
|
193
|
-
notificationTexts:
|
|
154
|
+
notificationTexts: {
|
|
155
|
+
title: string;
|
|
156
|
+
body: string;
|
|
157
|
+
};
|
|
194
158
|
/**
|
|
195
159
|
* The task to run in the foreground service
|
|
196
160
|
* The task must resolve a promise once complete
|
|
@@ -1,71 +1,23 @@
|
|
|
1
|
-
import { StreamRNVideoSDKGlobals } from '@stream-io/video-client';
|
|
1
|
+
import type { StreamRNVideoSDKGlobals } from '@stream-io/video-client';
|
|
2
2
|
import { NativeModules, PermissionsAndroid, Platform } from 'react-native';
|
|
3
|
-
import { getCallingxLibIfAvailable } from '../push/libs/callingx';
|
|
4
|
-
import {
|
|
5
|
-
endCallingxCall,
|
|
6
|
-
registerOutgoingCall,
|
|
7
|
-
joinCallingxCall,
|
|
8
|
-
} from './callingx/callingx';
|
|
9
3
|
|
|
10
4
|
const StreamInCallManagerNativeModule = NativeModules.StreamInCallManager;
|
|
11
5
|
const StreamVideoReactNativeModule = NativeModules.StreamVideoReactNative as {
|
|
12
6
|
checkPermission: StreamRNVideoSDKGlobals['permissions']['check'] | undefined;
|
|
13
7
|
};
|
|
14
8
|
|
|
15
|
-
const CallingxModule = getCallingxLibIfAvailable();
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Checks if StreamInCallManager should be bypassed because CallKit is handling
|
|
19
|
-
* the audio session via CallingX.
|
|
20
|
-
*
|
|
21
|
-
* On iOS, when CallingX is set up and has a registered call, the audio session
|
|
22
|
-
* is managed by CallKit through CallingxImpl.swift.
|
|
23
|
-
* In this case, StreamInCallManager should not run to avoid conflicting audio
|
|
24
|
-
* session configurations.
|
|
25
|
-
*/
|
|
26
|
-
const shouldBypassForCallKit = ({
|
|
27
|
-
isRingingTypeCall,
|
|
28
|
-
}: {
|
|
29
|
-
isRingingTypeCall: boolean;
|
|
30
|
-
}): boolean => {
|
|
31
|
-
if (Platform.OS !== 'ios') {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
if (!CallingxModule) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const bypass =
|
|
38
|
-
CallingxModule.isSetup &&
|
|
39
|
-
(isRingingTypeCall || CallingxModule.isOngoingCallsEnabled);
|
|
40
|
-
return bypass;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
9
|
const streamRNVideoSDKGlobals: StreamRNVideoSDKGlobals = {
|
|
44
|
-
callingX: {
|
|
45
|
-
joinCall: joinCallingxCall,
|
|
46
|
-
endCall: endCallingxCall,
|
|
47
|
-
registerOutgoingCall: registerOutgoingCall,
|
|
48
|
-
},
|
|
49
10
|
callManager: {
|
|
50
|
-
setup: ({ defaultDevice
|
|
51
|
-
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
11
|
+
setup: ({ defaultDevice }) => {
|
|
54
12
|
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(
|
|
55
13
|
defaultDevice,
|
|
56
14
|
);
|
|
57
15
|
StreamInCallManagerNativeModule.setup();
|
|
58
16
|
},
|
|
59
|
-
start: (
|
|
60
|
-
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
17
|
+
start: () => {
|
|
63
18
|
StreamInCallManagerNativeModule.start();
|
|
64
19
|
},
|
|
65
|
-
stop: (
|
|
66
|
-
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
20
|
+
stop: () => {
|
|
69
21
|
StreamInCallManagerNativeModule.stop();
|
|
70
22
|
},
|
|
71
23
|
},
|