@stream-io/video-react-native-sdk 1.28.3 → 1.29.0-beta.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/android/src/main/AndroidManifest.xml +8 -1
- package/android/src/main/AndroidManifestNew.xml +11 -0
- package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +42 -5
- package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +70 -6
- package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +6 -4
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +134 -0
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +3 -1
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +5 -2
- package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
- package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js +6 -3
- package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/commonjs/components/Participant/FloatingParticipantView/index.js +3 -1
- package/dist/commonjs/components/Participant/FloatingParticipantView/index.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/ParticipantView.js +3 -1
- package/dist/commonjs/components/Participant/ParticipantView/ParticipantView.js.map +1 -1
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js +3 -2
- package/dist/commonjs/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +216 -0
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
- package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +64 -97
- package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
- 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 +33 -21
- package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/commonjs/utils/internal/audioSessionPromise.js +46 -0
- package/dist/commonjs/utils/internal/audioSessionPromise.js.map +1 -0
- package/dist/commonjs/utils/internal/callingx.js +84 -0
- package/dist/commonjs/utils/internal/callingx.js.map +1 -0
- package/dist/commonjs/utils/internal/registerSDKGlobals.js +52 -3
- package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
- package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
- package/dist/commonjs/utils/push/android.js +145 -200
- package/dist/commonjs/utils/push/android.js.map +1 -1
- package/dist/commonjs/utils/push/internal/ios.js +16 -34
- package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
- package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -20
- package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
- package/dist/commonjs/utils/push/internal/utils.js +17 -1
- 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/callingx.js +75 -0
- package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
- package/dist/commonjs/utils/push/libs/index.js +8 -19
- package/dist/commonjs/utils/push/libs/index.js.map +1 -1
- package/dist/commonjs/utils/push/libs/notifee/index.js +0 -19
- package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
- package/dist/commonjs/utils/push/setupCallingExpEvents.js +97 -0
- package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
- package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
- 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/Call/CallLayout/CallParticipantsGrid.js +3 -1
- package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
- package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +5 -2
- package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
- package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js +6 -3
- package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
- package/dist/module/components/Participant/FloatingParticipantView/index.js +3 -1
- package/dist/module/components/Participant/FloatingParticipantView/index.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/ParticipantView.js +3 -1
- package/dist/module/components/Participant/ParticipantView/ParticipantView.js.map +1 -1
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js +3 -2
- package/dist/module/components/Participant/ParticipantView/VideoRenderer/index.js.map +1 -1
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +209 -0
- package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
- package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +66 -99
- package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/modules/call-manager/CallManager.js +26 -0
- 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 +33 -21
- package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
- package/dist/module/utils/internal/audioSessionPromise.js +39 -0
- package/dist/module/utils/internal/audioSessionPromise.js.map +1 -0
- package/dist/module/utils/internal/callingx.js +75 -0
- package/dist/module/utils/internal/callingx.js.map +1 -0
- package/dist/module/utils/internal/registerSDKGlobals.js +53 -4
- package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
- package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
- package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
- package/dist/module/utils/push/android.js +147 -202
- package/dist/module/utils/push/android.js.map +1 -1
- package/dist/module/utils/push/internal/ios.js +16 -34
- package/dist/module/utils/push/internal/ios.js.map +1 -1
- package/dist/module/utils/push/internal/rxSubjects.js +0 -19
- package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
- package/dist/module/utils/push/internal/utils.js +14 -0
- 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/callingx.js +67 -0
- package/dist/module/utils/push/libs/callingx.js.map +1 -0
- package/dist/module/utils/push/libs/index.js +1 -2
- package/dist/module/utils/push/libs/index.js.map +1 -1
- package/dist/module/utils/push/libs/notifee/index.js +0 -18
- package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
- package/dist/module/utils/push/setupCallingExpEvents.js +91 -0
- package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
- package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
- 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/Call/CallLayout/CallParticipantsGrid.d.ts +2 -2
- package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts +2 -2
- package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
- package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts +6 -1
- package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts.map +1 -1
- package/dist/typescript/components/Participant/FloatingParticipantView/index.d.ts +2 -2
- package/dist/typescript/components/Participant/FloatingParticipantView/index.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/ParticipantView.d.ts +6 -1
- package/dist/typescript/components/Participant/ParticipantView/ParticipantView.d.ts.map +1 -1
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/index.d.ts +2 -2
- package/dist/typescript/components/Participant/ParticipantView/VideoRenderer/index.d.ts.map +1 -1
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
- package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
- package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
- package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
- package/dist/typescript/index.d.ts +1 -0
- package/dist/typescript/index.d.ts.map +1 -1
- package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
- package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/index.d.ts +20 -2
- package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
- package/dist/typescript/utils/StreamVideoRN/types.d.ts +54 -29
- package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
- package/dist/typescript/utils/internal/audioSessionPromise.d.ts +16 -0
- package/dist/typescript/utils/internal/audioSessionPromise.d.ts.map +1 -0
- package/dist/typescript/utils/internal/callingx.d.ts +13 -0
- package/dist/typescript/utils/internal/callingx.d.ts.map +1 -0
- package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
- package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
- package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
- package/dist/typescript/utils/push/android.d.ts +1 -2
- 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 +0 -12
- package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
- package/dist/typescript/utils/push/internal/utils.d.ts +4 -0
- package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
- package/dist/typescript/utils/push/ios.d.ts +1 -2
- package/dist/typescript/utils/push/ios.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
- package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts +16 -2
- package/dist/typescript/utils/push/libs/firebaseMessaging/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/index.d.ts +1 -2
- package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -1
- package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
- package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
- package/dist/typescript/utils/push/setupCallingExpEvents.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 +1 -33
- package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
- package/expo-config-plugin/dist/withAppDelegate.js +19 -197
- package/expo-config-plugin/dist/withMainActivity.js +1 -1
- package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
- package/ios/StreamInCallManager.m +2 -0
- package/ios/StreamInCallManager.swift +20 -5
- package/ios/StreamVideoReactNative.h +7 -4
- package/ios/StreamVideoReactNative.m +191 -82
- package/package.json +10 -15
- package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +3 -1
- package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +4 -1
- package/src/components/Call/CallParticipantsList/CallParticipantsList.tsx +8 -0
- package/src/components/Participant/FloatingParticipantView/index.tsx +3 -1
- package/src/components/Participant/ParticipantView/ParticipantView.tsx +7 -0
- package/src/components/Participant/ParticipantView/VideoRenderer/index.tsx +7 -2
- package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +307 -0
- package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +94 -120
- package/src/index.ts +1 -0
- package/src/modules/call-manager/CallManager.ts +36 -0
- package/src/modules/call-manager/native-module.d.ts +7 -0
- package/src/providers/StreamCall/index.tsx +6 -6
- package/src/utils/StreamVideoRN/index.ts +40 -30
- package/src/utils/StreamVideoRN/types.ts +56 -29
- package/src/utils/internal/audioSessionPromise.ts +39 -0
- package/src/utils/internal/callingx.ts +108 -0
- package/src/utils/internal/registerSDKGlobals.ts +47 -4
- package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
- package/src/utils/push/android.ts +223 -308
- package/src/utils/push/internal/ios.ts +25 -46
- package/src/utils/push/internal/rxSubjects.ts +0 -29
- package/src/utils/push/internal/utils.ts +25 -0
- package/src/utils/push/ios.ts +1 -6
- package/src/utils/push/libs/callingx.ts +90 -0
- package/src/utils/push/libs/index.ts +1 -2
- package/src/utils/push/libs/notifee/index.ts +0 -27
- package/src/utils/push/setupCallingExpEvents.ts +117 -0
- package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
- package/src/version.ts +1 -1
- package/CHANGELOG.md +0 -3103
- package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
- package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
- package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
- package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
- package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
- package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
- package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
- package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
- package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
- package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
- package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
- package/dist/module/utils/push/libs/callkeep.js +0 -11
- package/dist/module/utils/push/libs/callkeep.js.map +0 -1
- package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
- package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
- package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
- package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
- package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
- package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
- package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
- package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
- package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
- package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
- package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
- package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
- package/src/utils/push/libs/callkeep.ts +0 -16
- package/src/utils/push/libs/voipPushNotification.ts +0 -17
- package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
|
@@ -5,6 +5,18 @@ 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
|
+
|
|
8
20
|
export type NonRingingPushEvent =
|
|
9
21
|
| 'call.live_started'
|
|
10
22
|
| 'call.notification'
|
|
@@ -32,6 +44,27 @@ export type StreamVideoConfig = {
|
|
|
32
44
|
* @example "production-apn-video" or "staging-apn-video" based on the environment
|
|
33
45
|
*/
|
|
34
46
|
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;
|
|
35
68
|
};
|
|
36
69
|
android: {
|
|
37
70
|
/**
|
|
@@ -61,28 +94,21 @@ export type StreamVideoConfig = {
|
|
|
61
94
|
* The notification channel to be used for incoming calls for Android.
|
|
62
95
|
* @example
|
|
63
96
|
* {
|
|
64
|
-
* id: '
|
|
65
|
-
* name: 'Incoming
|
|
66
|
-
*
|
|
97
|
+
* id: 'incoming_calls_channel',
|
|
98
|
+
* name: 'Incoming calls',
|
|
99
|
+
* sound?: string;
|
|
100
|
+
* vibration?: boolean;
|
|
67
101
|
* }
|
|
68
102
|
*/
|
|
69
|
-
|
|
103
|
+
incomingChannel?: AndroidChannelConfig;
|
|
70
104
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* {
|
|
74
|
-
* getTitle: (createdUserName: string) => `Incoming call from ${createdUserName}`,
|
|
75
|
-
* getBody: (createdUserName: string) => `Tap to answer the call`
|
|
76
|
-
* getAcceptButtonTitle?: () => `Accept`,
|
|
77
|
-
* getDeclineButtonTitle?: () => `Decline`,
|
|
78
|
-
* }
|
|
105
|
+
* The transformer to be used to transform the call title in the notification for ringing and ongoing calls for Android.
|
|
79
106
|
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
};
|
|
107
|
+
titleTransformer?: (memberName: string, incoming: boolean) => string;
|
|
108
|
+
/**
|
|
109
|
+
* The transformer to be used to transform the call subtitle for ringing and ongoing calls for Android.
|
|
110
|
+
*/
|
|
111
|
+
subtitleTransformer?: (call_cid: string, incoming: boolean) => string;
|
|
86
112
|
/**
|
|
87
113
|
* Functions to create the texts shown in the notification for non ringing calls in Android.
|
|
88
114
|
* @example
|
|
@@ -111,6 +137,16 @@ export type StreamVideoConfig = {
|
|
|
111
137
|
getBody: (type: NonRingingPushEvent, createdUserName: string) => string;
|
|
112
138
|
};
|
|
113
139
|
};
|
|
140
|
+
/**
|
|
141
|
+
* Whether to enable ongoing calls.
|
|
142
|
+
* @default false
|
|
143
|
+
*/
|
|
144
|
+
enableOngoingCalls?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Whether to reject calls when the user is busy.
|
|
147
|
+
* @default false
|
|
148
|
+
*/
|
|
149
|
+
shouldRejectCallWhenBusy?: boolean;
|
|
114
150
|
/**
|
|
115
151
|
* This function is used to create a custom video client.
|
|
116
152
|
* This is used create a video client for incoming calls in the background and inform call events to the server.
|
|
@@ -130,12 +166,6 @@ export type StreamVideoConfig = {
|
|
|
130
166
|
* }
|
|
131
167
|
*/
|
|
132
168
|
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;
|
|
139
169
|
/** Callback that is called when a non ringing push notification was tapped */
|
|
140
170
|
onTapNonRingingCallNotification?: (
|
|
141
171
|
call_cid: string,
|
|
@@ -147,14 +177,11 @@ export type StreamVideoConfig = {
|
|
|
147
177
|
/**
|
|
148
178
|
* The notification channel to keep call alive in the background for Android using a foreground service.
|
|
149
179
|
*/
|
|
150
|
-
channel:
|
|
180
|
+
channel: Omit<AndroidChannelConfig, 'sound' | 'vibration'>;
|
|
151
181
|
/**
|
|
152
182
|
* The texts shown in the notification to keep call alive in the background
|
|
153
183
|
*/
|
|
154
|
-
notificationTexts:
|
|
155
|
-
title: string;
|
|
156
|
-
body: string;
|
|
157
|
-
};
|
|
184
|
+
notificationTexts: KeepAliveAndroidNotificationTexts;
|
|
158
185
|
/**
|
|
159
186
|
* The task to run in the foreground service
|
|
160
187
|
* The task must resolve a promise once complete
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module to manage pending promise for audio session activation.
|
|
3
|
+
* Used to wait for iOS CallKit's didActivateAudioSession event after starting a call.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let pendingResolve: (() => void) | null = null;
|
|
7
|
+
let pendingTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
8
|
+
|
|
9
|
+
const AUDIO_SESSION_TIMEOUT_MS = 5000;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates a promise that resolves when the audio session is activated,
|
|
13
|
+
* or after a timeout to prevent hanging indefinitely.
|
|
14
|
+
* @returns Promise that resolves when audio session is activated or timeout occurs
|
|
15
|
+
*/
|
|
16
|
+
export function waitForAudioSessionActivation(): Promise<void> {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
pendingResolve = resolve;
|
|
19
|
+
pendingTimeout = setTimeout(() => {
|
|
20
|
+
// Resolve on timeout to prevent hanging
|
|
21
|
+
resolvePendingAudioSession();
|
|
22
|
+
}, AUDIO_SESSION_TIMEOUT_MS);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the pending audio session activation promise.
|
|
28
|
+
* Called when the didActivateAudioSession event fires or on timeout.
|
|
29
|
+
*/
|
|
30
|
+
export function resolvePendingAudioSession(): void {
|
|
31
|
+
if (pendingTimeout) {
|
|
32
|
+
clearTimeout(pendingTimeout);
|
|
33
|
+
pendingTimeout = null;
|
|
34
|
+
}
|
|
35
|
+
if (pendingResolve) {
|
|
36
|
+
pendingResolve();
|
|
37
|
+
pendingResolve = null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/***
|
|
2
|
+
* Internal utils for callingx library usage from video-client.
|
|
3
|
+
* See @./registerSDKGlobals.ts for more usage details.
|
|
4
|
+
*/
|
|
5
|
+
import { Platform } from 'react-native';
|
|
6
|
+
import { getCallingxLibIfAvailable } from '../push/libs/callingx';
|
|
7
|
+
import {
|
|
8
|
+
Call,
|
|
9
|
+
MemberResponse,
|
|
10
|
+
StreamVideoParticipant,
|
|
11
|
+
videoLoggerSystem,
|
|
12
|
+
} from '@stream-io/video-client';
|
|
13
|
+
import { waitForAudioSessionActivation } from './audioSessionPromise';
|
|
14
|
+
|
|
15
|
+
const CallingxModule = getCallingxLibIfAvailable();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Gets the call display name. To be used for display in native call screen.
|
|
19
|
+
*/
|
|
20
|
+
export function getCallDisplayName(
|
|
21
|
+
callMembers: MemberResponse[] | undefined,
|
|
22
|
+
participants: StreamVideoParticipant[] | undefined,
|
|
23
|
+
currentUserId: string | undefined,
|
|
24
|
+
) {
|
|
25
|
+
if (!callMembers || !participants || !currentUserId) {
|
|
26
|
+
return 'Call';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let names: string[] = [];
|
|
30
|
+
|
|
31
|
+
if (callMembers.length > 0) {
|
|
32
|
+
// for ringing calls, members array contains all call members from the very early state and participants array is empty in the beginning
|
|
33
|
+
names = callMembers
|
|
34
|
+
.filter((member) => member.user.id !== currentUserId)
|
|
35
|
+
.map((member) => member.user.name)
|
|
36
|
+
.filter((name): name is string => name !== undefined);
|
|
37
|
+
} else if (participants.length > 0) {
|
|
38
|
+
// for non-ringing calls, members array is empty and we rely on participants array there
|
|
39
|
+
names = participants
|
|
40
|
+
.filter((participant) => participant.userId !== currentUserId)
|
|
41
|
+
.map((participant) => participant.name)
|
|
42
|
+
.filter(Boolean);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// if no names are found, we use the name of the current user
|
|
46
|
+
if (names.length === 0) {
|
|
47
|
+
names = [
|
|
48
|
+
participants.find((participant) => participant.userId === currentUserId)
|
|
49
|
+
?.name ?? 'Call',
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return names.sort().join(', ');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Starts the call in the callingx library.
|
|
58
|
+
* Must be called for all outgoing calls
|
|
59
|
+
* and optionally for non-ringing calls when ongoing calls are enabled.
|
|
60
|
+
*/
|
|
61
|
+
export async function startCallingxCall(call: Call) {
|
|
62
|
+
if (!CallingxModule || CallingxModule.isCallRegistered(call.cid)) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const isOutcomingCall = call.ringing && call.isCreatedByMe;
|
|
66
|
+
if (
|
|
67
|
+
isOutcomingCall ||
|
|
68
|
+
(!call.ringing && CallingxModule.isOngoingCallsEnabled)
|
|
69
|
+
) {
|
|
70
|
+
const callDisplayName = getCallDisplayName(
|
|
71
|
+
call.state.members,
|
|
72
|
+
call.state.participants,
|
|
73
|
+
call.currentUserId,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
await CallingxModule.startCall(
|
|
78
|
+
call.cid, // unique id for call
|
|
79
|
+
call.id, // phone number for display in dialer (we use call id as phone number)
|
|
80
|
+
callDisplayName, // display name for display in call screen
|
|
81
|
+
call.state.settings?.video?.enabled ?? false, // is video call?
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
// Wait for audio session activation on iOS only
|
|
85
|
+
if (Platform.OS === 'ios') {
|
|
86
|
+
await waitForAudioSessionActivation();
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
videoLoggerSystem
|
|
90
|
+
.getLogger('startCallingxCall')
|
|
91
|
+
.error(`Error starting call in callingx: ${call.cid}`, error);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function endCallingxCall(call: Call) {
|
|
97
|
+
if (!CallingxModule || !CallingxModule.isCallRegistered(call.cid)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
await CallingxModule.endCallWithReason(call.cid, 'local');
|
|
103
|
+
} catch (error) {
|
|
104
|
+
videoLoggerSystem
|
|
105
|
+
.getLogger('endCallingxCall')
|
|
106
|
+
.error(`Error ending call in callingx: ${call.cid}`, error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -1,20 +1,63 @@
|
|
|
1
1
|
import { StreamRNVideoSDKGlobals } from '@stream-io/video-client';
|
|
2
|
-
import { NativeModules } from 'react-native';
|
|
2
|
+
import { NativeModules, Platform } from 'react-native';
|
|
3
|
+
import { getCallingxLibIfAvailable } from '../push/libs/callingx';
|
|
4
|
+
import { endCallingxCall, startCallingxCall } from './callingx';
|
|
3
5
|
|
|
4
6
|
const StreamInCallManagerNativeModule = NativeModules.StreamInCallManager;
|
|
5
7
|
|
|
8
|
+
const CallingxModule = getCallingxLibIfAvailable();
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Checks if StreamInCallManager should be bypassed because CallKit is handling
|
|
12
|
+
* the audio session via CallingX.
|
|
13
|
+
*
|
|
14
|
+
* On iOS, when CallingX is set up and has a registered call, the audio session
|
|
15
|
+
* is managed by CallKit through CallingxImpl.swift.
|
|
16
|
+
* In this case, StreamInCallManager should not run to avoid conflicting audio
|
|
17
|
+
* session configurations.
|
|
18
|
+
*/
|
|
19
|
+
const shouldBypassForCallKit = ({
|
|
20
|
+
isRingingTypeCall,
|
|
21
|
+
}: {
|
|
22
|
+
isRingingTypeCall: boolean;
|
|
23
|
+
}): boolean => {
|
|
24
|
+
if (Platform.OS !== 'ios') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (!CallingxModule) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const bypass =
|
|
31
|
+
CallingxModule.isSetup &&
|
|
32
|
+
(isRingingTypeCall || CallingxModule.isOngoingCallsEnabled);
|
|
33
|
+
return bypass;
|
|
34
|
+
};
|
|
35
|
+
|
|
6
36
|
const streamRNVideoSDKGlobals: StreamRNVideoSDKGlobals = {
|
|
37
|
+
callingX: {
|
|
38
|
+
startCall: startCallingxCall,
|
|
39
|
+
endCall: endCallingxCall,
|
|
40
|
+
},
|
|
7
41
|
callManager: {
|
|
8
|
-
setup: ({ defaultDevice }) => {
|
|
42
|
+
setup: ({ defaultDevice, isRingingTypeCall }) => {
|
|
43
|
+
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
9
46
|
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(
|
|
10
47
|
defaultDevice,
|
|
11
48
|
);
|
|
12
49
|
StreamInCallManagerNativeModule.setup();
|
|
13
50
|
},
|
|
14
|
-
start: () => {
|
|
51
|
+
start: ({ isRingingTypeCall }) => {
|
|
52
|
+
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
15
55
|
StreamInCallManagerNativeModule.start();
|
|
16
56
|
},
|
|
17
|
-
stop: () => {
|
|
57
|
+
stop: ({ isRingingTypeCall }) => {
|
|
58
|
+
if (shouldBypassForCallKit({ isRingingTypeCall })) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
18
61
|
StreamInCallManagerNativeModule.stop();
|
|
19
62
|
},
|
|
20
63
|
},
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AppRegistry, Platform } from 'react-native';
|
|
2
|
+
import type { Call } from '@stream-io/video-client';
|
|
3
|
+
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
4
|
+
import { StreamVideoRN } from './StreamVideoRN';
|
|
5
|
+
|
|
6
|
+
export const KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = 'StreamVideoKeepCallAlive';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The keep-alive headless task needs access to the active `Call` instance.
|
|
10
|
+
* The keep-alive hook will set this reference before starting the native service.
|
|
11
|
+
*/
|
|
12
|
+
export const keepCallAliveCallRef: { current: Call | undefined } = {
|
|
13
|
+
current: undefined,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function registerKeepCallAliveHeadlessTaskOnce() {
|
|
17
|
+
if (Platform.OS !== 'android') return;
|
|
18
|
+
|
|
19
|
+
AppRegistry.registerHeadlessTask(
|
|
20
|
+
KEEP_CALL_ALIVE_HEADLESS_TASK_NAME,
|
|
21
|
+
() => async (data: { callCid?: string } | undefined) => {
|
|
22
|
+
const logger = videoLoggerSystem.getLogger(
|
|
23
|
+
'KEEP_CALL_ALIVE_HEADLESS_TASK',
|
|
24
|
+
);
|
|
25
|
+
const callCid = data?.callCid;
|
|
26
|
+
|
|
27
|
+
const call = keepCallAliveCallRef.current;
|
|
28
|
+
if (!call) {
|
|
29
|
+
logger.warn(
|
|
30
|
+
'No active call instance available for keep-alive task; skipping.',
|
|
31
|
+
{ callCid },
|
|
32
|
+
);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (callCid && call.cid && call.cid !== callCid) {
|
|
36
|
+
logger.warn(
|
|
37
|
+
'Keep-alive task callCid does not match active call; skipping.',
|
|
38
|
+
{ callCid, activeCallCid: call.cid },
|
|
39
|
+
);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const config = StreamVideoRN.getConfig();
|
|
44
|
+
const taskToRun = config.foregroundService.android.taskToRun;
|
|
45
|
+
try {
|
|
46
|
+
await taskToRun(call);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
logger.error('Keep-alive headless task failed', e);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
registerKeepCallAliveHeadlessTaskOnce();
|