@stream-io/video-react-native-sdk 1.28.1 → 1.29.0-beta.0
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/keepalive/KeepAliveNotification.kt +83 -0
- package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +134 -0
- package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +235 -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 +60 -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 +20 -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/registerSDKGlobals.js +47 -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 +75 -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/module/hooks/push/useCallingExpWithCallingStateEffect.js +228 -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 +62 -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 +20 -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/registerSDKGlobals.js +48 -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 +69 -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/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.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/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/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.swift +4 -0
- package/ios/StreamVideoReactNative.h +7 -4
- package/ios/StreamVideoReactNative.m +191 -82
- package/package.json +10 -15
- package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +361 -0
- package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
- package/src/hooks/useAndroidKeepCallAliveEffect.ts +95 -120
- package/src/index.ts +1 -0
- package/src/modules/call-manager/CallManager.ts +30 -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/registerSDKGlobals.ts +42 -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 +100 -0
- package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
- package/CHANGELOG.md +0 -3089
- 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
|
@@ -1,93 +1,58 @@
|
|
|
1
1
|
import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
|
|
2
2
|
import { useEffect, useRef } from 'react';
|
|
3
3
|
import { StreamVideoRN } from '../utils';
|
|
4
|
-
import { AppState, NativeModules, Platform } from 'react-native';
|
|
4
|
+
import { AppState, NativeModules, PermissionsAndroid, Platform } from 'react-native';
|
|
5
5
|
import { CallingState, videoLoggerSystem } from '@stream-io/video-client';
|
|
6
|
-
import {
|
|
6
|
+
import { keepCallAliveCallRef } from '../utils/keepCallAliveHeadlessTask';
|
|
7
|
+
import { getNotifeeLibNoThrowForKeepCallAlive } from '../utils/push/libs/notifee';
|
|
8
|
+
import { getCallingxLibIfAvailable } from '../utils/push/libs';
|
|
7
9
|
const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const logger = videoLoggerSystem.getLogger('setForegroundService method');
|
|
16
|
-
logger.info('KeepCallAlive is not configured. Skipping foreground service setup.');
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
notifeeLib.default.registerForegroundService(() => {
|
|
20
|
-
const task = new Promise(resolve => {
|
|
21
|
-
const logger = videoLoggerSystem.getLogger('setForegroundService method');
|
|
22
|
-
logger.info('Foreground service running for call in progress');
|
|
23
|
-
// any task to run from SDK in the foreground service must be added
|
|
24
|
-
resolve(true);
|
|
25
|
-
});
|
|
26
|
-
const videoConfig = StreamVideoRN.getConfig();
|
|
27
|
-
const foregroundServiceConfig = videoConfig.foregroundService;
|
|
28
|
-
const {
|
|
29
|
-
taskToRun
|
|
30
|
-
} = foregroundServiceConfig.android;
|
|
31
|
-
const call = callToPassToForegroundService.current;
|
|
32
|
-
if (!call) {
|
|
33
|
-
const logger = videoLoggerSystem.getLogger('setForegroundService method');
|
|
34
|
-
logger.warn('No call to pass to foreground service');
|
|
35
|
-
return task.then(() => new Promise(() => {}));
|
|
36
|
-
}
|
|
37
|
-
callToPassToForegroundService.current = undefined;
|
|
38
|
-
return task.then(() => taskToRun(call));
|
|
39
|
-
});
|
|
40
|
-
});
|
|
10
|
+
async function stopForegroundServiceNoThrow() {
|
|
11
|
+
const logger = videoLoggerSystem.getLogger('stopForegroundServiceNoThrow');
|
|
12
|
+
try {
|
|
13
|
+
await NativeModules.StreamVideoReactNative.stopKeepCallAliveService();
|
|
14
|
+
} catch (e) {
|
|
15
|
+
logger.warn('Failed to stop keep-call-alive foreground service', e);
|
|
16
|
+
}
|
|
41
17
|
}
|
|
42
18
|
async function startForegroundService(call_cid) {
|
|
43
|
-
const
|
|
19
|
+
const logger = videoLoggerSystem.getLogger('startForegroundService');
|
|
20
|
+
const isCallAliveConfigured = await (async () => {
|
|
21
|
+
try {
|
|
22
|
+
return await NativeModules.StreamVideoReactNative.isCallAliveConfigured();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
logger.warn('Failed to check whether KeepCallAlive is configured', e);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
})();
|
|
44
28
|
if (!isCallAliveConfigured) {
|
|
45
|
-
const logger = videoLoggerSystem.getLogger('startForegroundService');
|
|
46
29
|
logger.info('KeepCallAlive is not configured. Skipping foreground service setup.');
|
|
47
30
|
return;
|
|
48
31
|
}
|
|
49
|
-
//
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED) {
|
|
53
|
-
const logger = videoLoggerSystem.getLogger('startForegroundService');
|
|
32
|
+
// Check for notification permission (Android 13+) before starting the service.
|
|
33
|
+
const hasPostNotificationsPermission = Number(Platform.Version) < 33 || (await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS));
|
|
34
|
+
if (!hasPostNotificationsPermission) {
|
|
54
35
|
logger.info('Notification permission not granted, can not start foreground service to keep the call alive');
|
|
55
36
|
return;
|
|
56
37
|
}
|
|
57
38
|
const videoConfig = StreamVideoRN.getConfig();
|
|
58
39
|
const foregroundServiceConfig = videoConfig.foregroundService;
|
|
59
40
|
const notificationTexts = foregroundServiceConfig.android.notificationTexts;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
const channel = foregroundServiceConfig.android.channel;
|
|
42
|
+
const smallIconName = videoConfig.push?.android.smallIcon;
|
|
43
|
+
|
|
63
44
|
// NOTE: we use requestAnimationFrame to ensure that the foreground service is started after all the current UI operations are done
|
|
64
45
|
// this is a workaround for the crash - android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground()
|
|
65
46
|
// this crash was reproducible only in some android devices
|
|
66
|
-
requestAnimationFrame(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
channelId,
|
|
73
|
-
smallIcon: videoConfig.push?.android.smallIcon,
|
|
74
|
-
foregroundServiceTypes,
|
|
75
|
-
asForegroundService: true,
|
|
76
|
-
ongoing: true,
|
|
77
|
-
// user cannot dismiss the notification
|
|
78
|
-
colorized: true,
|
|
79
|
-
pressAction: {
|
|
80
|
-
id: 'default',
|
|
81
|
-
launchActivity: 'default' // open the app when the notification is pressed
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
});
|
|
47
|
+
requestAnimationFrame(async () => {
|
|
48
|
+
try {
|
|
49
|
+
await NativeModules.StreamVideoReactNative.startKeepCallAliveService(call_cid, channel.id, channel.name, notificationTexts.title, notificationTexts.body, smallIconName ?? null);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
logger.warn('Failed to start keep-call-alive foreground service', e);
|
|
52
|
+
}
|
|
85
53
|
});
|
|
86
54
|
}
|
|
87
55
|
|
|
88
|
-
// flag to check if setForegroundService has already been run once
|
|
89
|
-
let isSetForegroundServiceRan = false;
|
|
90
|
-
|
|
91
56
|
/**
|
|
92
57
|
* This hook is used to keep the call alive in the background for Android.
|
|
93
58
|
* It starts a foreground service to keep the call alive as soon as the call is joined
|
|
@@ -97,7 +62,7 @@ let isSetForegroundServiceRan = false;
|
|
|
97
62
|
export const useAndroidKeepCallAliveEffect = () => {
|
|
98
63
|
const foregroundServiceStartedRef = useRef(false);
|
|
99
64
|
const call = useCall();
|
|
100
|
-
|
|
65
|
+
keepCallAliveCallRef.current = call;
|
|
101
66
|
const activeCallCid = call?.cid;
|
|
102
67
|
const {
|
|
103
68
|
useCallCallingState
|
|
@@ -107,10 +72,10 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
107
72
|
const isCallJoined = callingState === CallingState.JOINED;
|
|
108
73
|
const shouldStartForegroundService = !foregroundServiceStartedRef.current && (isOutgoingCall || isCallJoined);
|
|
109
74
|
useEffect(() => {
|
|
110
|
-
|
|
75
|
+
const callingx = getCallingxLibIfAvailable();
|
|
76
|
+
if (Platform.OS === 'ios' || !activeCallCid || callingx?.isSetup) {
|
|
111
77
|
return undefined;
|
|
112
78
|
}
|
|
113
|
-
if (!notifeeLib) return undefined;
|
|
114
79
|
|
|
115
80
|
// start foreground service as soon as the call is joined
|
|
116
81
|
if (shouldStartForegroundService) {
|
|
@@ -118,21 +83,18 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
118
83
|
if (foregroundServiceStartedRef.current) {
|
|
119
84
|
return;
|
|
120
85
|
}
|
|
121
|
-
if
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
notifee.cancelDisplayedNotification(activeCallCid);
|
|
86
|
+
// Optional compatibility cleanup: if the app uses Notifee for ringing push,
|
|
87
|
+
// we might have an incoming call notification running as a foreground service.
|
|
88
|
+
if (notifeeLib) {
|
|
89
|
+
const notifee = notifeeLib.default;
|
|
90
|
+
const displayedNotifications = await notifee.getDisplayedNotifications();
|
|
91
|
+
const activeCallNotification = displayedNotifications.find(notification => notification.id === activeCallCid);
|
|
92
|
+
if (activeCallNotification) {
|
|
93
|
+
// this means that we have a incoming call notification shown as foreground service and we must stop it
|
|
94
|
+
notifee.stopForegroundService();
|
|
95
|
+
notifee.cancelDisplayedNotification(activeCallCid);
|
|
96
|
+
}
|
|
133
97
|
}
|
|
134
|
-
// check for notification permission and then start the foreground service
|
|
135
|
-
|
|
136
98
|
await startForegroundService(activeCallCid);
|
|
137
99
|
foregroundServiceStartedRef.current = true;
|
|
138
100
|
};
|
|
@@ -140,7 +102,6 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
140
102
|
// ensure that app is active before running the function
|
|
141
103
|
if (AppState.currentState === 'active') {
|
|
142
104
|
run();
|
|
143
|
-
return undefined;
|
|
144
105
|
}
|
|
145
106
|
const sub = AppState.addEventListener('change', nextAppState => {
|
|
146
107
|
if (nextAppState === 'active') {
|
|
@@ -155,23 +116,26 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
155
116
|
return () => {
|
|
156
117
|
// cancel any notifee displayed notification when the call has transitioned out of ringing
|
|
157
118
|
// NOTE: cancels only the non fg service notifications
|
|
158
|
-
notifeeLib
|
|
119
|
+
if (notifeeLib) {
|
|
120
|
+
notifeeLib.default.cancelDisplayedNotification(activeCallCid);
|
|
121
|
+
}
|
|
159
122
|
};
|
|
160
123
|
} else if (callingState === CallingState.IDLE || callingState === CallingState.LEFT) {
|
|
161
124
|
if (foregroundServiceStartedRef.current) {
|
|
162
|
-
|
|
125
|
+
keepCallAliveCallRef.current = undefined;
|
|
163
126
|
// stop foreground service when the call is not active
|
|
164
|
-
|
|
127
|
+
stopForegroundServiceNoThrow();
|
|
165
128
|
foregroundServiceStartedRef.current = false;
|
|
166
129
|
} else {
|
|
167
|
-
notifeeLib
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
130
|
+
if (notifeeLib) {
|
|
131
|
+
notifeeLib.default.getDisplayedNotifications().then(displayedNotifications => {
|
|
132
|
+
const activeCallNotification = displayedNotifications.find(notification => notification.id === activeCallCid);
|
|
133
|
+
if (activeCallNotification) {
|
|
134
|
+
// this means that we have a incoming call notification shown as foreground service and we must stop it
|
|
135
|
+
notifeeLib.default.stopForegroundService();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
175
139
|
}
|
|
176
140
|
}
|
|
177
141
|
return undefined;
|
|
@@ -180,9 +144,8 @@ export const useAndroidKeepCallAliveEffect = () => {
|
|
|
180
144
|
return () => {
|
|
181
145
|
// stop foreground service when this effect is unmounted
|
|
182
146
|
if (foregroundServiceStartedRef.current) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
notifeeLib.default.stopForegroundService();
|
|
147
|
+
keepCallAliveCallRef.current = undefined;
|
|
148
|
+
stopForegroundServiceNoThrow();
|
|
186
149
|
foregroundServiceStartedRef.current = false;
|
|
187
150
|
}
|
|
188
151
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","AppState","NativeModules","Platform","CallingState","videoLoggerSystem","
|
|
1
|
+
{"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","AppState","NativeModules","PermissionsAndroid","Platform","CallingState","videoLoggerSystem","keepCallAliveCallRef","getNotifeeLibNoThrowForKeepCallAlive","getCallingxLibIfAvailable","notifeeLib","stopForegroundServiceNoThrow","logger","getLogger","StreamVideoReactNative","stopKeepCallAliveService","e","warn","startForegroundService","call_cid","isCallAliveConfigured","info","hasPostNotificationsPermission","Number","Version","check","PERMISSIONS","POST_NOTIFICATIONS","videoConfig","getConfig","foregroundServiceConfig","foregroundService","notificationTexts","android","channel","smallIconName","push","smallIcon","requestAnimationFrame","startKeepCallAliveService","id","name","title","body","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","call","current","activeCallCid","cid","useCallCallingState","callingState","isOutgoingCall","RINGING","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","callingx","OS","isSetup","undefined","run","notifee","default","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT","then"],"sourceRoot":"../../../src","sources":["hooks/useAndroidKeepCallAliveEffect.ts"],"mappings":"AAAA,SAASA,OAAO,EAAEC,iBAAiB,QAAQ,iCAAiC;AAC5E,SAASC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,aAAa,QAAQ,UAAU;AACxC,SACEC,QAAQ,EAERC,aAAa,EACbC,kBAAkB,EAClBC,QAAQ,QACH,cAAc;AACrB,SAASC,YAAY,EAAEC,iBAAiB,QAAQ,yBAAyB;AACzE,SAASC,oBAAoB,QAAQ,oCAAoC;AACzE,SAASC,oCAAoC,QAAQ,4BAA4B;AACjF,SAASC,yBAA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sD,OAAO,CAACO,2BAA2B,CAACvB,aAAa,CAAC;QAC/D;MACF,CAAC;IACH,CAAC,MAAM,IACLG,YAAY,KAAK9C,YAAY,CAACwE,IAAI,IAClC1B,YAAY,KAAK9C,YAAY,CAACyE,IAAI,EAClC;MACA,IAAIjC,2BAA2B,CAACE,OAAO,EAAE;QACvCxC,oBAAoB,CAACwC,OAAO,GAAGc,SAAS;QACxC;QACAlD,4BAA4B,CAAC,CAAC;QAC9BkC,2BAA2B,CAACE,OAAO,GAAG,KAAK;MAC7C,CAAC,MAAM;QACL,IAAIrC,UAAU,EAAE;UACdA,UAAU,CAACsD,OAAO,CACfE,yBAAyB,CAAC,CAAC,CAC3Ba,IAAI,CAAEd,sBAAsB,IAAK;YAChC,MAAME,sBAAsB,GAAGF,sBAAsB,CAACG,IAAI,CACvDC,YAAY,IAAKA,YAAY,CAAC7B,EAAE,KAAKQ,aACxC,CAAC;YACD,IAAImB,sBAAsB,EAAE;cAC1B;cACAzD,UAAU,CAACsD,OAAO,CAACM,qBAAqB,CAAC,CAAC;YAC5C;UACF,CAAC,CAAC;QACN;MACF;IACF;IACA,OAAOT,SAAS;EAClB,CAAC,EAAE,CAACb,aAAa,EAAEG,YAAY,EAAEM,4BAA4B,CAAC,CAAC;EAE/D3D,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAI+C,2BAA2B,CAACE,OAAO,EAAE;QACvCxC,oBAAoB,CAACwC,OAAO,GAAGc,SAAS;QACxClD,4BAA4B,CAAC,CAAC;QAC9BkC,2BAA2B,CAACE,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
|
package/dist/module/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { registerGlobals } from '@stream-io/react-native-webrtc';
|
|
|
9
9
|
import Logger from '@stream-io/react-native-webrtc/src/Logger';
|
|
10
10
|
import { Platform } from 'react-native';
|
|
11
11
|
import { registerSDKGlobals } from './utils/internal/registerSDKGlobals';
|
|
12
|
+
import './utils/keepCallAliveHeadlessTask';
|
|
12
13
|
|
|
13
14
|
// We're registering globals, because our video JS client is serving SDKs that use browser based webRTC functions.
|
|
14
15
|
// This will result in creation of 2 global objects: `window` and `navigator`
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["setClientDetails","registerGlobals","Logger","Platform","registerSDKGlobals","OS","enable","ROOT_PREFIX","StreamVideo","StreamCall"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAC3D;AACA,OAAO,wBAAwB;AAC/B;AACA,OAAO,gCAAgC;AACvC;AACA,OAAO,kBAAkB;AACzB,SAASC,eAAe,QAAQ,gCAAgC;AAChE,OAAOC,MAAM,MAAM,2CAA2C;AAC9D,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,qCAAqC;;
|
|
1
|
+
{"version":3,"names":["setClientDetails","registerGlobals","Logger","Platform","registerSDKGlobals","OS","enable","ROOT_PREFIX","StreamVideo","StreamCall"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,0BAA0B;AAC3D;AACA,OAAO,wBAAwB;AAC/B;AACA,OAAO,gCAAgC;AACvC;AACA,OAAO,kBAAkB;AACzB,SAASC,eAAe,QAAQ,gCAAgC;AAChE,OAAOC,MAAM,MAAM,2CAA2C;AAC9D,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAO,mCAAmC;;AAE1C;AACA;AACA;AACA,IAAID,QAAQ,CAACE,EAAE,KAAK,KAAK,EAAE;EACzBJ,eAAe,CAAC,CAAC;EACjBG,kBAAkB,CAAC,CAAC;AACtB;;AAEA;AACAF,MAAM,CAACI,MAAM,CAAC,GAAGJ,MAAM,CAACK,WAAW,eAAe,CAAC;AAEnD,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,cAAc;AAC5B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;;AAEtC;AACA;AACA,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,UAAU,QAAQ,wBAAwB;AACnD,cAAc,+BAA+B;AAE7CT,gBAAgB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
+
import { getCallingxLibIfAvailable } from '../../utils/push/libs/callingx';
|
|
3
|
+
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
2
4
|
const NativeManager = NativeModules.StreamInCallManager;
|
|
5
|
+
const CallingxModule = getCallingxLibIfAvailable();
|
|
3
6
|
const invariant = (condition, message) => {
|
|
4
7
|
if (!condition) throw new Error(message);
|
|
5
8
|
};
|
|
@@ -61,6 +64,15 @@ class SpeakerManager {
|
|
|
61
64
|
NativeManager.setForceSpeakerphoneOn(force);
|
|
62
65
|
};
|
|
63
66
|
}
|
|
67
|
+
const shouldBypassForCallKit = () => {
|
|
68
|
+
if (Platform.OS !== 'ios') {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
if (!CallingxModule) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return CallingxModule.isSetup && (CallingxModule.hasRegisteredCall() || CallingxModule.isOngoingCallsEnabled);
|
|
75
|
+
};
|
|
64
76
|
export class CallManager {
|
|
65
77
|
android = new AndroidCallManager();
|
|
66
78
|
ios = new IOSCallManager();
|
|
@@ -84,6 +96,10 @@ export class CallManager {
|
|
|
84
96
|
* @param config.enableStereoAudioOutput Whether to enable stereo audio output. Only supported for listener audio role.
|
|
85
97
|
*/
|
|
86
98
|
start = config => {
|
|
99
|
+
if (shouldBypassForCallKit()) {
|
|
100
|
+
videoLoggerSystem.getLogger('CallManager').debug('start: skipping start as callkit is handling the audio session');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
87
103
|
NativeManager.setAudioRole(config?.audioRole ?? 'communicator');
|
|
88
104
|
if (config?.audioRole === 'communicator') {
|
|
89
105
|
const type = config.deviceEndpointType ?? 'speaker';
|
|
@@ -99,6 +115,10 @@ export class CallManager {
|
|
|
99
115
|
* Stops the in call manager.
|
|
100
116
|
*/
|
|
101
117
|
stop = () => {
|
|
118
|
+
if (shouldBypassForCallKit()) {
|
|
119
|
+
videoLoggerSystem.getLogger('CallManager').debug('stop: skipping stop as callkit is handling the audio session');
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
102
122
|
NativeManager.stop();
|
|
103
123
|
};
|
|
104
124
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","NativeManager","StreamInCallManager","invariant","condition","message","Error","AndroidCallManager","getAudioDeviceStatus","OS","selectAudioDevice","endpointName","chooseAudioDeviceEndpoint","addAudioDeviceChangeListener","onChange","eventEmitter","s","addListener","remove","IOSCallManager","showDeviceSelector","showAudioRoutePicker","SpeakerManager","setMute","mute","muteAudioOutput","unmuteAudioOutput","setForceSpeakerphoneOn","force","CallManager","android","ios","speaker","start","config","setAudioRole","audioRole","type","deviceEndpointType","setDefaultAudioDeviceEndpointType","enableStereoAudioOutput","setEnableStereoAudioOutput","stop","logAudioState"],"sourceRoot":"../../../../src","sources":["modules/call-manager/CallManager.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","getCallingxLibIfAvailable","videoLoggerSystem","NativeManager","StreamInCallManager","CallingxModule","invariant","condition","message","Error","AndroidCallManager","getAudioDeviceStatus","OS","selectAudioDevice","endpointName","chooseAudioDeviceEndpoint","addAudioDeviceChangeListener","onChange","eventEmitter","s","addListener","remove","IOSCallManager","showDeviceSelector","showAudioRoutePicker","SpeakerManager","setMute","mute","muteAudioOutput","unmuteAudioOutput","setForceSpeakerphoneOn","force","shouldBypassForCallKit","isSetup","hasRegisteredCall","isOngoingCallsEnabled","CallManager","android","ios","speaker","start","config","getLogger","debug","setAudioRole","audioRole","type","deviceEndpointType","setDefaultAudioDeviceEndpointType","enableStereoAudioOutput","setEnableStereoAudioOutput","stop","logAudioState"],"sourceRoot":"../../../../src","sources":["modules/call-manager/CallManager.ts"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAE1E,SAASC,yBAAyB,QAAQ,gCAAgC;AAC1E,SAASC,iBAAiB,QAAQ,yBAAyB;AAE3D,MAAMC,aAAa,GAAGJ,aAAa,CAACK,mBAAmB;AACvD,MAAMC,cAAc,GAAGJ,yBAAyB,CAAC,CAAC;AAElD,MAAMK,SAAS,GAAGA,CAACC,SAAkB,EAAEC,OAAe,KAAK;EACzD,IAAI,CAACD,SAAS,EAAE,MAAM,IAAIE,KAAK,CAACD,OAAO,CAAC;AAC1C,CAAC;AAED,MAAME,kBAAkB,CAAC;EAGvB;AACF;AACA;EACEC,oBAAoB,GAAG,MAAAA,CAAA,KAAwC;IAC7DL,SAAS,CAACN,QAAQ,CAACY,EAAE,KAAK,SAAS,EAAE,2BAA2B,CAAC;IACjE,OAAOT,aAAa,CAACQ,oBAAoB,CAAC,CAAC;EAC7C,CAAC;;EAED;AACF;AACA;AACA;AACA;EACEE,iBAAiB,GAAIC,YAAoB,IAAW;IAClDR,SAAS,CAACN,QAAQ,CAACY,EAAE,KAAK,SAAS,EAAE,2BAA2B,CAAC;IACjET,aAAa,CAACY,yBAAyB,CAACD,YAAY,CAAC;EACvD,CAAC;;EAED;AACF;AACA;AACA;EACEE,4BAA4B,GAC1BC,QAAwD,IACvC;IACjBX,SAAS,CAACN,QAAQ,CAACY,EAAE,KAAK,SAAS,EAAE,2BAA2B,CAAC;IACjE,IAAI,CAACM,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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEe,KAAK,GAAIC,MAAkC,IAAW;IACpD,IAAIT,sBAAsB,CAAC,CAAC,EAAE;MAC5B9B,iBAAiB,CACdwC,SAAS,CAAC,aAAa,CAAC,CACxBC,KAAK,CACJ,gEACF,CAAC;MACH;IACF;IACAxC,aAAa,CAACyC,YAAY,CAACH,MAAM,EAAEI,SAAS,IAAI,cAAc,CAAC;IAC/D,IAAIJ,MAAM,EAAEI,SAAS,KAAK,cAAc,EAAE;MACxC,MAAMC,IAAI,GAAGL,MAAM,CAACM,kBAAkB,IAAI,SAAS;MACnD5C,aAAa,CAAC6C,iCAAiC,CAACF,IAAI,CAAC;IACvD;IACA,IAAIL,MAAM,EAAEI,SAAS,KAAK,UAAU,IAAIJ,MAAM,CAACQ,uBAAuB,EAAE;MACtE9C,aAAa,CAAC+C,0BAA0B,CAAC,IAAI,CAAC;IAChD;IACA/C,aAAa,CAACqC,KAAK,CAAC,CAAC;EACvB,CAAC;;EAED;AACF;AACA;EACEW,IAAI,GAAGA,CAAA,KAAY;IACjB,IAAInB,sBAAsB,CAAC,CAAC,EAAE;MAC5B9B,iBAAiB,CACdwC,SAAS,CAAC,aAAa,CAAC,CACxBC,KAAK,CAAC,8DAA8D,CAAC;MACxE;IACF;IACAxC,aAAa,CAACgD,IAAI,CAAC,CAAC;EACtB,CAAC;;EAED;AACF;AACA;AACA;EACEC,aAAa,GAAGA,CAAA,KAAYjD,aAAa,CAACiD,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { StreamCallProvider } from '@stream-io/video-react-bindings';
|
|
2
2
|
import React, { useEffect } from 'react';
|
|
3
|
-
import { useIosCallkeepWithCallingStateEffect } from '../../hooks/push/useIosCallkeepWithCallingStateEffect';
|
|
4
3
|
import { canAddPushWSSubscriptionsRef } from '../../utils/push/internal/utils';
|
|
5
4
|
import { useAndroidKeepCallAliveEffect } from '../../hooks/useAndroidKeepCallAliveEffect';
|
|
6
5
|
import { AppStateListener } from './AppStateListener';
|
|
7
6
|
import { DeviceStats } from './DeviceStats';
|
|
8
7
|
import { pushUnsubscriptionCallbacks } from '../../utils/push/internal/constants';
|
|
8
|
+
import { useCallingExpWithCallingStateEffect } from '../../hooks/push/useCallingExpWithCallingStateEffect';
|
|
9
9
|
|
|
10
10
|
// const PIP_CHANGE_EVENT = 'StreamVideoReactNative_PIP_CHANGE_EVENT';
|
|
11
11
|
|
|
@@ -24,7 +24,7 @@ export const StreamCall = ({
|
|
|
24
24
|
}) => {
|
|
25
25
|
return /*#__PURE__*/React.createElement(StreamCallProvider, {
|
|
26
26
|
call: call
|
|
27
|
-
}, /*#__PURE__*/React.createElement(AppStateListener, null), /*#__PURE__*/React.createElement(AndroidKeepCallAlive, null), /*#__PURE__*/React.createElement(
|
|
27
|
+
}, /*#__PURE__*/React.createElement(AppStateListener, null), /*#__PURE__*/React.createElement(AndroidKeepCallAlive, null), /*#__PURE__*/React.createElement(CallingExpWithCallingState, null), /*#__PURE__*/React.createElement(ClearPushWSSubscriptions, null), /*#__PURE__*/React.createElement(DeviceStats, null), children);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
/**
|
|
@@ -37,11 +37,11 @@ const AndroidKeepCallAlive = () => {
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* This is a renderless component to
|
|
41
|
-
*
|
|
40
|
+
* This is a renderless component to sync state between stream call and CallKit/Telecom.
|
|
41
|
+
* useCallingExpWithCallingStateEffect needs to called inside a child of StreamCallProvider.
|
|
42
42
|
*/
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const CallingExpWithCallingState = () => {
|
|
44
|
+
useCallingExpWithCallingStateEffect();
|
|
45
45
|
return null;
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StreamCallProvider","React","useEffect","
|
|
1
|
+
{"version":3,"names":["StreamCallProvider","React","useEffect","canAddPushWSSubscriptionsRef","useAndroidKeepCallAliveEffect","AppStateListener","DeviceStats","pushUnsubscriptionCallbacks","useCallingExpWithCallingStateEffect","StreamCall","call","children","createElement","AndroidKeepCallAlive","CallingExpWithCallingState","ClearPushWSSubscriptions","forEach","cbArray","cb","clear","current"],"sourceRoot":"../../../../src","sources":["providers/StreamCall/index.tsx"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,iCAAiC;AACpE,OAAOC,KAAK,IAA4BC,SAAS,QAAQ,OAAO;AAEhE,SAASC,4BAA4B,QAAQ,iCAAiC;AAC9E,SAASC,6BAA6B,QAAQ,2CAA2C;AACzF,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,2BAA2B,QAAQ,qCAAqC;AACjF,SAASC,mCAAmC,QAAQ,sDAAsD;;AAE1G;;AAEA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,GAAGA,CAAC;EACzBC,IAAI;EACJC;AACkC,CAAC,KAAK;EACxC,oBACEV,KAAA,CAAAW,aAAA,CAACZ,kBAAkB;IAACU,IAAI,EAAEA;EAAK,gBAC7BT,KAAA,CAAAW,aAAA,CAACP,gBAAgB,MAAE,CAAC,eACpBJ,KAAA,CAAAW,aAAA,CAACC,oBAAoB,MAAE,CAAC,eACxBZ,KAAA,CAAAW,aAAA,CAACE,0BAA0B,MAAE,CAAC,eAC9Bb,KAAA,CAAAW,aAAA,CAACG,wBAAwB,MAAE,CAAC,eAC5Bd,KAAA,CAAAW,aAAA,CAACN,WAAW,MAAE,CAAC,EACdK,QACiB,CAAC;AAEzB,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACjCT,6BAA6B,CAAC,CAAC;EAC/B,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMU,0BAA0B,GAAGA,CAAA,KAAM;EACvCN,mCAAmC,CAAC,CAAC;EACrC,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMO,wBAAwB,GAAGA,CAAA,KAAM;EACrCb,SAAS,CAAC,MAAM;IACd;IACAK,2BAA2B,CAACS,OAAO,CAAEC,OAAO,IAC1CA,OAAO,CAACD,OAAO,CAAEE,EAAE,IAAKA,EAAE,CAAC,CAAC,CAC9B,CAAC;IACDX,2BAA2B,CAACY,KAAK,CAAC,CAAC;IACnChB,4BAA4B,CAACiB,OAAO,GAAG,KAAK;IAC5C,OAAO,MAAM;MACXjB,4BAA4B,CAACiB,OAAO,GAAG,IAAI;IAC7C,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import pushLogoutCallbacks from '../internal/pushLogoutCallback';
|
|
2
2
|
import newNotificationCallbacks from '../internal/newNotificationCallbacks';
|
|
3
|
-
import { setupIosCallKeepEvents } from '../push/setupIosCallKeepEvents';
|
|
4
3
|
import { setupIosVoipPushEvents } from '../push/setupIosVoipPushEvents';
|
|
4
|
+
import { setupCallingExpEvents } from '../push/setupCallingExpEvents';
|
|
5
|
+
import { extractCallingExpOptions, getCallingxLib } from '../push/libs/callingx';
|
|
5
6
|
import { NativeModules, Platform } from 'react-native';
|
|
7
|
+
import { videoLoggerSystem } from '@stream-io/video-client';
|
|
6
8
|
|
|
7
9
|
// Utility type for deep partial
|
|
8
10
|
|
|
@@ -27,10 +29,7 @@ const DEFAULT_STREAM_VIDEO_CONFIG = {
|
|
|
27
29
|
android: {
|
|
28
30
|
channel: {
|
|
29
31
|
id: 'stream_call_foreground_service',
|
|
30
|
-
name: '
|
|
31
|
-
lights: false,
|
|
32
|
-
vibration: false,
|
|
33
|
-
importance: 3
|
|
32
|
+
name: 'Ongoing calls'
|
|
34
33
|
},
|
|
35
34
|
notificationTexts: {
|
|
36
35
|
title: 'Call in progress',
|
|
@@ -52,15 +51,6 @@ export class StreamVideoRN {
|
|
|
52
51
|
static updateConfig(updateConfig) {
|
|
53
52
|
this.config = deepMerge(this.config, updateConfig);
|
|
54
53
|
}
|
|
55
|
-
static updateAndroidIncomingCallChannel(updateChannel) {
|
|
56
|
-
const prevChannel = this.config.push?.android?.incomingCallChannel;
|
|
57
|
-
if (prevChannel) {
|
|
58
|
-
this.config.push.android.incomingCallChannel = {
|
|
59
|
-
...prevChannel,
|
|
60
|
-
...updateChannel
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
54
|
|
|
65
55
|
/**
|
|
66
56
|
* Set the push config for StreamVideoRN.
|
|
@@ -74,7 +64,26 @@ export class StreamVideoRN {
|
|
|
74
64
|
* import App from './App';
|
|
75
65
|
* // Set push config
|
|
76
66
|
* const pushConfig = {}; // construct your config
|
|
77
|
-
*
|
|
67
|
+
* // Set CallKit/Android Telecom API integration options. All params are optional. If not provided, the default values will be used.
|
|
68
|
+
* const callingExpOptions = {
|
|
69
|
+
* ios: {
|
|
70
|
+
* callsHistory: true,
|
|
71
|
+
* displayCallTimeout: 60000,
|
|
72
|
+
* sound: 'ringtone',
|
|
73
|
+
* imageName: 'callkit_icon',
|
|
74
|
+
* },
|
|
75
|
+
* android: {
|
|
76
|
+
* incomingChannel: {
|
|
77
|
+
* id: 'stream_incoming_call_notifications',
|
|
78
|
+
* name: 'Call notifications',
|
|
79
|
+
* vibration: true,
|
|
80
|
+
* sound: 'default',
|
|
81
|
+
* },
|
|
82
|
+
* titleTransformer: (text: string) => text,
|
|
83
|
+
* subtitleTransformer: (text: string) => text,
|
|
84
|
+
* },
|
|
85
|
+
* };
|
|
86
|
+
* StreamVideoRN.setPushConfig(pushConfig, callingExpOptions);
|
|
78
87
|
* AppRegistry.registerComponent('app', () => App);
|
|
79
88
|
*/
|
|
80
89
|
static setPushConfig(pushConfig) {
|
|
@@ -82,13 +91,16 @@ export class StreamVideoRN {
|
|
|
82
91
|
// Ignoring this config as push config was already set
|
|
83
92
|
return;
|
|
84
93
|
}
|
|
85
|
-
if (__DEV__ && (pushConfig.navigateAcceptCall || pushConfig.navigateToIncomingCall)) {
|
|
86
|
-
throw new Error(`Support for navigateAcceptCall or navigateToIncomingCall in pushConfig has been removed.
|
|
87
|
-
Please watch for incoming and outgoing calls in the root component of your app.
|
|
88
|
-
Please see https://getstream.io/video/docs/react-native/advanced/ringing-calls/#watch-for-incoming-and-outgoing-calls for more information.`);
|
|
89
|
-
}
|
|
90
94
|
this.config.push = pushConfig;
|
|
91
|
-
|
|
95
|
+
try {
|
|
96
|
+
const callingx = getCallingxLib();
|
|
97
|
+
videoLoggerSystem.getLogger('StreamVideoRN.setPushConfig').info(JSON.stringify(this.config));
|
|
98
|
+
const options = extractCallingExpOptions(this.config);
|
|
99
|
+
callingx.setup(options);
|
|
100
|
+
} catch {
|
|
101
|
+
throw new Error('react-native-callingx library is not installed. Please check the installation instructions: https://getstream.io/video/docs/react-native/incoming-calls/ringing-setup/react-native/.');
|
|
102
|
+
}
|
|
103
|
+
setupCallingExpEvents(pushConfig);
|
|
92
104
|
setupIosVoipPushEvents(pushConfig);
|
|
93
105
|
}
|
|
94
106
|
static getConfig() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["pushLogoutCallbacks","newNotificationCallbacks","
|
|
1
|
+
{"version":3,"names":["pushLogoutCallbacks","newNotificationCallbacks","setupIosVoipPushEvents","setupCallingExpEvents","extractCallingExpOptions","getCallingxLib","NativeModules","Platform","videoLoggerSystem","deepMerge","target","source","result","key","undefined","Array","isArray","DEFAULT_STREAM_VIDEO_CONFIG","foregroundService","android","channel","id","name","notificationTexts","title","body","taskToRun","Promise","StreamVideoRN","config","busyToneTimeout","updateConfig","setPushConfig","pushConfig","push","callingx","getLogger","info","JSON","stringify","options","setup","Error","getConfig","onPushLogout","current","all","map","callback","then","resolve","clearPushLogoutCallbacks","addOnNewCallNotificationListener","filter","cb","playBusyTone","StreamVideoReactNative","stopBusyTone","androidHasAudioOutputHardware","OS","hasAudioOutputHardware","androidHasMicrophoneHardware","hasMicrophoneHardware","androidHasCameraHardware","hasCameraHardware"],"sourceRoot":"../../../../src","sources":["utils/StreamVideoRN/index.ts"],"mappings":"AACA,OAAOA,mBAAmB,MAAM,gCAAgC;AAChE,OAAOC,wBAAwB,MAExB,sCAAsC;AAC7C,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SACEC,wBAAwB,EACxBC,cAAc,QACT,uBAAuB;AAC9B,SAASC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,iBAAiB,QAAQ,yBAAyB;;AAE3D;;AAKA;AACA,SAASC,SAASA,CAChBC,MAAS,EACTC,MAAsB,EACnB;EACH,MAAMC,MAAM,GAAG;IAAE,GAAGF;EAAO,CAAC;EAE5B,KAAK,MAAMG,GAAG,IAAIF,MAAM,EAAE;IACxB,IAAIA,MAAM,CAACE,GAAG,CAAC,KAAKC,SAAS,EAAE;MAC7B,IACE,OAAOH,MAAM,CAACE,GAAG,CAAC,KAAK,QAAQ,IAC/BF,MAAM,CAACE,GAAG,CAAC,KAAK,IAAI,IACpB,CAACE,KAAK,CAACC,OAAO,CAACL,MAAM,CAACE,GAAG,CAAC,CAAC,IAC3B,OAAOH,MAAM,CAACG,GAAG,CAAC,KAAK,QAAQ,IAC/BH,MAAM,CAACG,GAAG,CAAC,KAAK,IAAI,IACpB,CAACE,KAAK,CAACC,OAAO,CAACN,MAAM,CAACG,GAAG,CAAC,CAAC,EAC3B;QACAD,MAAM,CAACC,GAAG,CAAC,GAAGJ,SAAS,CACrBC,MAAM,CAACG,GAAG,CAAC,EACXF,MAAM,CAACE,GAAG,CACZ,CAAC;MACH,CAAC,MAAM;QACLD,MAAM,CAACC,GAAG,CAAC,GAAGF,MAAM,CAACE,GAAG,CAAkB;MAC5C;IACF;EACF;EAEA,OAAOD,MAAM;AACf;AAEA,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;AACA;AACA;EACE,aAAaC,6BAA6BA,CAAA,EAAqB;IAC7D,IAAInD,QAAQ,CAACoD,EAAE,KAAK,SAAS,EAC3B,MAAM,IAAIjB,KAAK,CACb,qEACF,CAAC;IACH,OAAOpC,aAAa,CAACkD,sBAAsB,CAACI,sBAAsB,CAAC,CAAC;EACtE;;EAEA;AACF;AACA;AACA;EACE,aAAaC,4BAA4BA,CAAA,EAAqB;IAC5D,IAAItD,QAAQ,CAACoD,EAAE,KAAK,SAAS,EAC3B,MAAM,IAAIjB,KAAK,CACb,oEACF,CAAC;IACH,OAAOpC,aAAa,CAACkD,sBAAsB,CAACM,qBAAqB,CAAC,CAAC;EACrE;;EAEA;AACF;AACA;AACA;EACE,aAAaC,wBAAwBA,CAAA,EAAqB;IACxD,IAAIxD,QAAQ,CAACoD,EAAE,KAAK,SAAS,EAC3B,MAAM,IAAIjB,KAAK,CACb,gEACF,CAAC;IACH,OAAOpC,aAAa,CAACkD,sBAAsB,CAACQ,iBAAiB,CAAC,CAAC;EACjE;AACF","ignoreList":[]}
|
|
@@ -1,17 +1,61 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import { getCallingxLibIfAvailable } from '../push/libs/callingx';
|
|
2
3
|
const StreamInCallManagerNativeModule = NativeModules.StreamInCallManager;
|
|
4
|
+
const CallingxModule = getCallingxLibIfAvailable();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Checks if StreamInCallManager should be bypassed because CallKit is handling
|
|
8
|
+
* the audio session via CallingX.
|
|
9
|
+
*
|
|
10
|
+
* On iOS, when CallingX is set up and has a registered call, the audio session
|
|
11
|
+
* is managed by CallKit through CallingxImpl.swift.
|
|
12
|
+
* In this case, StreamInCallManager should not run to avoid conflicting audio
|
|
13
|
+
* session configurations.
|
|
14
|
+
*/
|
|
15
|
+
const shouldBypassForCallKit = ({
|
|
16
|
+
isRingingTypeCall
|
|
17
|
+
}) => {
|
|
18
|
+
if (Platform.OS !== 'ios') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (!CallingxModule) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
const bypass = CallingxModule.isSetup && (isRingingTypeCall || CallingxModule.isOngoingCallsEnabled);
|
|
25
|
+
return bypass;
|
|
26
|
+
};
|
|
3
27
|
const streamRNVideoSDKGlobals = {
|
|
4
28
|
callManager: {
|
|
5
29
|
setup: ({
|
|
6
|
-
defaultDevice
|
|
30
|
+
defaultDevice,
|
|
31
|
+
isRingingTypeCall
|
|
7
32
|
}) => {
|
|
33
|
+
if (shouldBypassForCallKit({
|
|
34
|
+
isRingingTypeCall
|
|
35
|
+
})) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
8
38
|
StreamInCallManagerNativeModule.setDefaultAudioDeviceEndpointType(defaultDevice);
|
|
9
39
|
StreamInCallManagerNativeModule.setup();
|
|
10
40
|
},
|
|
11
|
-
start: (
|
|
41
|
+
start: ({
|
|
42
|
+
isRingingTypeCall
|
|
43
|
+
}) => {
|
|
44
|
+
if (shouldBypassForCallKit({
|
|
45
|
+
isRingingTypeCall
|
|
46
|
+
})) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
12
49
|
StreamInCallManagerNativeModule.start();
|
|
13
50
|
},
|
|
14
|
-
stop: (
|
|
51
|
+
stop: ({
|
|
52
|
+
isRingingTypeCall
|
|
53
|
+
}) => {
|
|
54
|
+
if (shouldBypassForCallKit({
|
|
55
|
+
isRingingTypeCall
|
|
56
|
+
})) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
15
59
|
StreamInCallManagerNativeModule.stop();
|
|
16
60
|
}
|
|
17
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","StreamInCallManagerNativeModule","StreamInCallManager","streamRNVideoSDKGlobals","callManager","setup","defaultDevice","setDefaultAudioDeviceEndpointType","start","stop","registerSDKGlobals","global","streamRNVideoSDK"],"sourceRoot":"../../../../src","sources":["utils/internal/registerSDKGlobals.ts"],"mappings":"AACA,SAASA,aAAa,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","getCallingxLibIfAvailable","StreamInCallManagerNativeModule","StreamInCallManager","CallingxModule","shouldBypassForCallKit","isRingingTypeCall","OS","bypass","isSetup","isOngoingCallsEnabled","streamRNVideoSDKGlobals","callManager","setup","defaultDevice","setDefaultAudioDeviceEndpointType","start","stop","registerSDKGlobals","global","streamRNVideoSDK"],"sourceRoot":"../../../../src","sources":["utils/internal/registerSDKGlobals.ts"],"mappings":"AACA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AACtD,SAASC,yBAAyB,QAAQ,uBAAuB;AAEjE,MAAMC,+BAA+B,GAAGH,aAAa,CAACI,mBAAmB;AAEzE,MAAMC,cAAc,GAAGH,yBAAyB,CAAC,CAAC;;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMI,sBAAsB,GAAGA,CAAC;EAC9BC;AAGF,CAAC,KAAc;EACb,IAAIN,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,KAAK;EACd;EACA,IAAI,CAACH,cAAc,EAAE;IACnB,OAAO,KAAK;EACd;EACA,MAAMI,MAAM,GACVJ,cAAc,CAACK,OAAO,KACrBH,iBAAiB,IAAIF,cAAc,CAACM,qBAAqB,CAAC;EAC7D,OAAOF,MAAM;AACf,CAAC;AAED,MAAMG,uBAAgD,GAAG;EACvDC,WAAW,EAAE;IACXC,KAAK,EAAEA,CAAC;MAAEC,aAAa;MAAER;IAAkB,CAAC,KAAK;MAC/C,IAAID,sBAAsB,CAAC;QAAEC;MAAkB,CAAC,CAAC,EAAE;QACjD;MACF;MACAJ,+BAA+B,CAACa,iCAAiC,CAC/DD,aACF,CAAC;MACDZ,+BAA+B,CAACW,KAAK,CAAC,CAAC;IACzC,CAAC;IACDG,KAAK,EAAEA,CAAC;MAAEV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