@stream-io/video-react-native-sdk 1.31.1 → 1.32.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.
Files changed (207) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/src/main/AndroidManifest.xml +8 -1
  3. package/android/src/main/AndroidManifestNew.xml +11 -0
  4. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +42 -5
  5. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +70 -6
  6. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +6 -4
  7. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +83 -0
  8. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +149 -0
  9. package/dist/commonjs/hooks/push/index.js +0 -2
  10. package/dist/commonjs/hooks/push/index.js.map +1 -1
  11. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +146 -0
  12. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  13. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  14. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  15. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +41 -106
  16. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  17. package/dist/commonjs/index.js +1 -0
  18. package/dist/commonjs/index.js.map +1 -1
  19. package/dist/commonjs/modules/call-manager/CallManager.js +26 -0
  20. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  21. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  22. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  23. package/dist/commonjs/utils/StreamVideoRN/index.js +35 -21
  24. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  25. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +68 -0
  26. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  27. package/dist/commonjs/utils/internal/callingx/callingx.js +150 -0
  28. package/dist/commonjs/utils/internal/callingx/callingx.js.map +1 -0
  29. package/dist/commonjs/utils/internal/registerSDKGlobals.js +53 -3
  30. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  31. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +48 -0
  32. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +1 -0
  33. package/dist/commonjs/utils/push/android.js +135 -202
  34. package/dist/commonjs/utils/push/android.js.map +1 -1
  35. package/dist/commonjs/utils/push/internal/ios.js +17 -34
  36. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  37. package/dist/commonjs/utils/push/internal/rxSubjects.js +1 -45
  38. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  39. package/dist/commonjs/utils/push/internal/utils.js +71 -53
  40. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  41. package/dist/commonjs/utils/push/ios.js.map +1 -1
  42. package/dist/commonjs/utils/push/libs/callingx.js +75 -0
  43. package/dist/commonjs/utils/push/libs/callingx.js.map +1 -0
  44. package/dist/commonjs/utils/push/libs/index.js +8 -19
  45. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  46. package/dist/commonjs/utils/push/libs/notifee/index.js +0 -23
  47. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  48. package/dist/commonjs/utils/push/setupCallingExpEvents.js +105 -0
  49. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +1 -0
  50. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +7 -6
  51. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  52. package/dist/commonjs/version.js +1 -1
  53. package/dist/module/hooks/push/index.js +0 -2
  54. package/dist/module/hooks/push/index.js.map +1 -1
  55. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +139 -0
  56. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +1 -0
  57. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +18 -31
  58. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  59. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +42 -107
  60. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  61. package/dist/module/index.js +1 -0
  62. package/dist/module/index.js.map +1 -1
  63. package/dist/module/modules/call-manager/CallManager.js +26 -0
  64. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  65. package/dist/module/providers/StreamCall/index.js +6 -6
  66. package/dist/module/providers/StreamCall/index.js.map +1 -1
  67. package/dist/module/utils/StreamVideoRN/index.js +35 -21
  68. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  69. package/dist/module/utils/internal/callingx/audioSessionPromise.js +61 -0
  70. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +1 -0
  71. package/dist/module/utils/internal/callingx/callingx.js +140 -0
  72. package/dist/module/utils/internal/callingx/callingx.js.map +1 -0
  73. package/dist/module/utils/internal/registerSDKGlobals.js +53 -3
  74. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  75. package/dist/module/utils/keepCallAliveHeadlessTask.js +42 -0
  76. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +1 -0
  77. package/dist/module/utils/push/android.js +137 -204
  78. package/dist/module/utils/push/android.js.map +1 -1
  79. package/dist/module/utils/push/internal/ios.js +17 -34
  80. package/dist/module/utils/push/internal/ios.js.map +1 -1
  81. package/dist/module/utils/push/internal/rxSubjects.js +0 -44
  82. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  83. package/dist/module/utils/push/internal/utils.js +67 -50
  84. package/dist/module/utils/push/internal/utils.js.map +1 -1
  85. package/dist/module/utils/push/ios.js.map +1 -1
  86. package/dist/module/utils/push/libs/callingx.js +67 -0
  87. package/dist/module/utils/push/libs/callingx.js.map +1 -0
  88. package/dist/module/utils/push/libs/index.js +1 -2
  89. package/dist/module/utils/push/libs/index.js.map +1 -1
  90. package/dist/module/utils/push/libs/notifee/index.js +0 -21
  91. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  92. package/dist/module/utils/push/setupCallingExpEvents.js +99 -0
  93. package/dist/module/utils/push/setupCallingExpEvents.js.map +1 -0
  94. package/dist/module/utils/push/setupIosVoipPushEvents.js +7 -6
  95. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  96. package/dist/module/version.js +1 -1
  97. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  98. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +5 -0
  99. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +1 -0
  100. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  101. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  102. package/dist/typescript/index.d.ts +1 -0
  103. package/dist/typescript/index.d.ts.map +1 -1
  104. package/dist/typescript/modules/call-manager/CallManager.d.ts +5 -0
  105. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  106. package/dist/typescript/utils/StreamVideoRN/index.d.ts +22 -2
  107. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  108. package/dist/typescript/utils/StreamVideoRN/types.d.ts +59 -25
  109. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  110. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +16 -0
  111. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +1 -0
  112. package/dist/typescript/utils/internal/callingx/callingx.d.ts +18 -0
  113. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +1 -0
  114. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  115. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +10 -0
  116. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +1 -0
  117. package/dist/typescript/utils/push/android.d.ts +1 -2
  118. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  119. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  120. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +0 -33
  121. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  122. package/dist/typescript/utils/push/internal/utils.d.ts +14 -8
  123. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  124. package/dist/typescript/utils/push/ios.d.ts +1 -2
  125. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  126. package/dist/typescript/utils/push/libs/callingx.d.ts +9 -0
  127. package/dist/typescript/utils/push/libs/callingx.d.ts.map +1 -0
  128. package/dist/typescript/utils/push/libs/index.d.ts +1 -2
  129. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  130. package/dist/typescript/utils/push/libs/notifee/index.d.ts +0 -2
  131. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  132. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +8 -0
  133. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +1 -0
  134. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  135. package/dist/typescript/version.d.ts +1 -1
  136. package/expo-config-plugin/dist/withAndroidManifest.js +1 -33
  137. package/expo-config-plugin/dist/withAndroidPermissions.js +2 -7
  138. package/expo-config-plugin/dist/withAppDelegate.js +19 -197
  139. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  140. package/expo-config-plugin/dist/withiOSInfoPlist.js +2 -3
  141. package/ios/StreamInCallManager.m +2 -0
  142. package/ios/StreamInCallManager.swift +19 -7
  143. package/ios/StreamVideoReactNative-Bridging-Header.h +3 -1
  144. package/ios/StreamVideoReactNative.h +7 -4
  145. package/ios/StreamVideoReactNative.m +199 -84
  146. package/package.json +11 -16
  147. package/src/hooks/push/index.ts +0 -2
  148. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +193 -0
  149. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +21 -34
  150. package/src/hooks/useAndroidKeepCallAliveEffect.ts +63 -129
  151. package/src/index.ts +1 -0
  152. package/src/modules/call-manager/CallManager.ts +36 -0
  153. package/src/modules/call-manager/native-module.d.ts +7 -0
  154. package/src/providers/StreamCall/index.tsx +6 -6
  155. package/src/utils/StreamVideoRN/index.ts +42 -30
  156. package/src/utils/StreamVideoRN/types.ts +61 -25
  157. package/src/utils/internal/callingx/audioSessionPromise.ts +65 -0
  158. package/src/utils/internal/callingx/callingx.ts +197 -0
  159. package/src/utils/internal/registerSDKGlobals.ts +52 -4
  160. package/src/utils/keepCallAliveHeadlessTask.ts +54 -0
  161. package/src/utils/push/android.ts +198 -311
  162. package/src/utils/push/internal/ios.ts +28 -44
  163. package/src/utils/push/internal/rxSubjects.ts +0 -61
  164. package/src/utils/push/internal/utils.ts +108 -64
  165. package/src/utils/push/ios.ts +1 -6
  166. package/src/utils/push/libs/callingx.ts +89 -0
  167. package/src/utils/push/libs/index.ts +1 -2
  168. package/src/utils/push/libs/notifee/index.ts +0 -31
  169. package/src/utils/push/setupCallingExpEvents.ts +135 -0
  170. package/src/utils/push/setupIosVoipPushEvents.ts +11 -7
  171. package/src/version.ts +1 -1
  172. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +0 -95
  173. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -160
  174. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  175. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +0 -67
  176. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +0 -1
  177. package/dist/commonjs/utils/push/libs/callkeep.js +0 -17
  178. package/dist/commonjs/utils/push/libs/callkeep.js.map +0 -1
  179. package/dist/commonjs/utils/push/libs/voipPushNotification.js +0 -17
  180. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +0 -1
  181. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +0 -205
  182. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +0 -1
  183. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +0 -153
  184. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +0 -1
  185. package/dist/module/hooks/push/useProcessPushCallEffect.js +0 -60
  186. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +0 -1
  187. package/dist/module/utils/push/libs/callkeep.js +0 -11
  188. package/dist/module/utils/push/libs/callkeep.js.map +0 -1
  189. package/dist/module/utils/push/libs/voipPushNotification.js +0 -11
  190. package/dist/module/utils/push/libs/voipPushNotification.js.map +0 -1
  191. package/dist/module/utils/push/setupIosCallKeepEvents.js +0 -199
  192. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +0 -1
  193. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +0 -5
  194. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +0 -1
  195. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +0 -8
  196. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +0 -1
  197. package/dist/typescript/utils/push/libs/callkeep.d.ts +0 -3
  198. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +0 -1
  199. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +0 -3
  200. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +0 -1
  201. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +0 -6
  202. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +0 -1
  203. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +0 -235
  204. package/src/hooks/push/useProcessPushCallEffect.ts +0 -108
  205. package/src/utils/push/libs/callkeep.ts +0 -16
  206. package/src/utils/push/libs/voipPushNotification.ts +0 -17
  207. package/src/utils/push/setupIosCallKeepEvents.ts +0 -252
@@ -1,93 +1,56 @@
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 { getKeepCallAliveForegroundServiceTypes, getNotifeeLibNoThrowForKeepCallAlive } from '../utils/push/libs/notifee';
7
- const notifeeLib = getNotifeeLibNoThrowForKeepCallAlive();
8
- const callToPassToForegroundService = {
9
- current: undefined
10
- };
11
- function setForegroundService() {
12
- if (Platform.OS === 'ios' || !notifeeLib) return;
13
- NativeModules.StreamVideoReactNative.isCallAliveConfigured().then(isConfigured => {
14
- if (!isConfigured) {
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
- });
6
+ import { keepCallAliveCallRef } from '../utils/keepCallAliveHeadlessTask';
7
+ import { getCallingxLibIfAvailable } from '../utils/push/libs';
8
+ async function stopForegroundServiceNoThrow() {
9
+ const logger = videoLoggerSystem.getLogger('stopForegroundServiceNoThrow');
10
+ try {
11
+ await NativeModules.StreamVideoReactNative.stopKeepCallAliveService();
12
+ } catch (e) {
13
+ logger.warn('Failed to stop keep-call-alive foreground service', e);
14
+ }
41
15
  }
42
16
  async function startForegroundService(call_cid) {
43
- const isCallAliveConfigured = await NativeModules.StreamVideoReactNative.isCallAliveConfigured();
17
+ const logger = videoLoggerSystem.getLogger('startForegroundService');
18
+ const isCallAliveConfigured = await (async () => {
19
+ try {
20
+ return await NativeModules.StreamVideoReactNative.isCallAliveConfigured();
21
+ } catch (e) {
22
+ logger.warn('Failed to check whether KeepCallAlive is configured', e);
23
+ return false;
24
+ }
25
+ })();
44
26
  if (!isCallAliveConfigured) {
45
- const logger = videoLoggerSystem.getLogger('startForegroundService');
46
27
  logger.info('KeepCallAlive is not configured. Skipping foreground service setup.');
47
28
  return;
48
29
  }
49
- // check for notification permission and then start the foreground service
50
- if (!notifeeLib) return;
51
- const settings = await notifeeLib.default.getNotificationSettings();
52
- if (settings.authorizationStatus !== notifeeLib.AuthorizationStatus.AUTHORIZED) {
53
- const logger = videoLoggerSystem.getLogger('startForegroundService');
30
+ // Check for notification permission (Android 13+) before starting the service.
31
+ const hasPostNotificationsPermission = Number(Platform.Version) < 33 || (await PermissionsAndroid.check(PermissionsAndroid.PERMISSIONS.POST_NOTIFICATIONS));
32
+ if (!hasPostNotificationsPermission) {
54
33
  logger.info('Notification permission not granted, can not start foreground service to keep the call alive');
55
34
  return;
56
35
  }
57
36
  const videoConfig = StreamVideoRN.getConfig();
58
37
  const foregroundServiceConfig = videoConfig.foregroundService;
59
38
  const notificationTexts = foregroundServiceConfig.android.notificationTexts;
60
- const channelId = foregroundServiceConfig.android.channel.id;
61
- await notifeeLib.default.createChannel(foregroundServiceConfig.android.channel);
62
- const foregroundServiceTypes = await getKeepCallAliveForegroundServiceTypes();
39
+ const channel = foregroundServiceConfig.android.channel;
40
+ const smallIconName = videoConfig.push?.android.smallIcon;
41
+
63
42
  // NOTE: we use requestAnimationFrame to ensure that the foreground service is started after all the current UI operations are done
64
43
  // this is a workaround for the crash - android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground()
65
44
  // this crash was reproducible only in some android devices
66
- requestAnimationFrame(() => {
67
- notifeeLib.default.displayNotification({
68
- id: call_cid,
69
- title: notificationTexts.title,
70
- body: notificationTexts.body,
71
- android: {
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
- });
45
+ requestAnimationFrame(async () => {
46
+ try {
47
+ await NativeModules.StreamVideoReactNative.startKeepCallAliveService(call_cid, channel.id, channel.name, notificationTexts.title, notificationTexts.body, smallIconName ?? null);
48
+ } catch (e) {
49
+ logger.warn('Failed to start keep-call-alive foreground service', e);
50
+ }
85
51
  });
86
52
  }
87
53
 
88
- // flag to check if setForegroundService has already been run once
89
- let isSetForegroundServiceRan = false;
90
-
91
54
  /**
92
55
  * This hook is used to keep the call alive in the background for Android.
93
56
  * It starts a foreground service to keep the call alive as soon as the call is joined
@@ -97,7 +60,7 @@ let isSetForegroundServiceRan = false;
97
60
  export const useAndroidKeepCallAliveEffect = () => {
98
61
  const foregroundServiceStartedRef = useRef(false);
99
62
  const call = useCall();
100
- callToPassToForegroundService.current = call;
63
+ keepCallAliveCallRef.current = call;
101
64
  const activeCallCid = call?.cid;
102
65
  const {
103
66
  useCallCallingState
@@ -105,12 +68,16 @@ export const useAndroidKeepCallAliveEffect = () => {
105
68
  const callingState = useCallCallingState();
106
69
  const isOutgoingCall = callingState === CallingState.RINGING && call?.isCreatedByMe;
107
70
  const isCallJoined = callingState === CallingState.JOINED;
71
+ const isRingingCall = call?.ringing;
108
72
  const shouldStartForegroundService = !foregroundServiceStartedRef.current && (isOutgoingCall || isCallJoined);
109
73
  useEffect(() => {
110
74
  if (Platform.OS === 'ios' || !activeCallCid) {
111
75
  return undefined;
112
76
  }
113
- if (!notifeeLib) return undefined;
77
+ const callingx = getCallingxLibIfAvailable();
78
+ if (callingx?.isSetup && (isRingingCall || !isRingingCall && callingx?.isOngoingCallsEnabled)) {
79
+ return undefined;
80
+ }
114
81
 
115
82
  // start foreground service as soon as the call is joined
116
83
  if (shouldStartForegroundService) {
@@ -118,21 +85,6 @@ export const useAndroidKeepCallAliveEffect = () => {
118
85
  if (foregroundServiceStartedRef.current) {
119
86
  return;
120
87
  }
121
- if (!isSetForegroundServiceRan) {
122
- isSetForegroundServiceRan = true;
123
- setForegroundService();
124
- }
125
- const notifee = notifeeLib.default;
126
- const displayedNotifications = await notifee.getDisplayedNotifications();
127
- const activeCallNotification = displayedNotifications.find(notification => notification.id === activeCallCid);
128
- if (activeCallNotification) {
129
- callToPassToForegroundService.current = undefined;
130
- // this means that we have a incoming call notification shown as foreground service and we must stop it
131
- notifee.stopForegroundService();
132
- notifee.cancelDisplayedNotification(activeCallCid);
133
- }
134
- // check for notification permission and then start the foreground service
135
-
136
88
  await startForegroundService(activeCallCid);
137
89
  foregroundServiceStartedRef.current = true;
138
90
  };
@@ -140,7 +92,6 @@ export const useAndroidKeepCallAliveEffect = () => {
140
92
  // ensure that app is active before running the function
141
93
  if (AppState.currentState === 'active') {
142
94
  run();
143
- return undefined;
144
95
  }
145
96
  const sub = AppState.addEventListener('change', nextAppState => {
146
97
  if (nextAppState === 'active') {
@@ -151,38 +102,22 @@ export const useAndroidKeepCallAliveEffect = () => {
151
102
  return () => {
152
103
  sub.remove();
153
104
  };
154
- } else if (callingState === CallingState.RINGING) {
155
- return () => {
156
- // cancel any notifee displayed notification when the call has transitioned out of ringing
157
- // NOTE: cancels only the non fg service notifications
158
- notifeeLib.default.cancelDisplayedNotification(activeCallCid);
159
- };
160
105
  } else if (callingState === CallingState.IDLE || callingState === CallingState.LEFT) {
161
106
  if (foregroundServiceStartedRef.current) {
162
- callToPassToForegroundService.current = undefined;
107
+ keepCallAliveCallRef.current = undefined;
163
108
  // stop foreground service when the call is not active
164
- notifeeLib.default.stopForegroundService();
109
+ stopForegroundServiceNoThrow();
165
110
  foregroundServiceStartedRef.current = false;
166
- } else {
167
- notifeeLib.default.getDisplayedNotifications().then(displayedNotifications => {
168
- const activeCallNotification = displayedNotifications.find(notification => notification.id === activeCallCid);
169
- if (activeCallNotification) {
170
- callToPassToForegroundService.current = undefined;
171
- // this means that we have a incoming call notification shown as foreground service and we must stop it
172
- notifeeLib.default.stopForegroundService();
173
- }
174
- });
175
111
  }
176
112
  }
177
113
  return undefined;
178
- }, [activeCallCid, callingState, shouldStartForegroundService]);
114
+ }, [activeCallCid, callingState, shouldStartForegroundService, isRingingCall]);
179
115
  useEffect(() => {
180
116
  return () => {
181
117
  // stop foreground service when this effect is unmounted
182
118
  if (foregroundServiceStartedRef.current) {
183
- if (!notifeeLib) return;
184
- callToPassToForegroundService.current = undefined;
185
- notifeeLib.default.stopForegroundService();
119
+ keepCallAliveCallRef.current = undefined;
120
+ stopForegroundServiceNoThrow();
186
121
  foregroundServiceStartedRef.current = false;
187
122
  }
188
123
  };
@@ -1 +1 @@
1
- {"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","AppState","NativeModules","Platform","CallingState","videoLoggerSystem","getKeepCallAliveForegroundServiceTypes","getNotifeeLibNoThrowForKeepCallAlive","notifeeLib","callToPassToForegroundService","current","undefined","setForegroundService","OS","StreamVideoReactNative","isCallAliveConfigured","then","isConfigured","logger","getLogger","info","default","registerForegroundService","task","Promise","resolve","videoConfig","getConfig","foregroundServiceConfig","foregroundService","taskToRun","android","call","warn","startForegroundService","call_cid","settings","getNotificationSettings","authorizationStatus","AuthorizationStatus","AUTHORIZED","notificationTexts","channelId","channel","id","createChannel","foregroundServiceTypes","requestAnimationFrame","displayNotification","title","body","smallIcon","push","asForegroundService","ongoing","colorized","pressAction","launchActivity","isSetForegroundServiceRan","useAndroidKeepCallAliveEffect","foregroundServiceStartedRef","activeCallCid","cid","useCallCallingState","callingState","isOutgoingCall","RINGING","isCreatedByMe","isCallJoined","JOINED","shouldStartForegroundService","run","notifee","displayedNotifications","getDisplayedNotifications","activeCallNotification","find","notification","stopForegroundService","cancelDisplayedNotification","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT"],"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,QAAQ,QACH,cAAc;AACrB,SAAeC,YAAY,EAAEC,iBAAiB,QAAQ,yBAAyB;AAC/E,SACEC,sCAAsC,EACtCC,oCAAoC,QAC/B,4BAA4B;AAEnC,MAAMC,UAAU,GAAGD,oCAAoC,CAAC,CAAC;AACzD,MAAME,6BAA4D,GAAG;EACnEC,OAAO,EAAEC;AACX,CAAC;AAED,SAASC,oBAAoBA,CAAA,EAAG;EAC9B,IAAIT,QAAQ,CAACU,EAAE,KAAK,KAAK,IAAI,CAACL,UAAU,EAAE;EAC1CN,aAAa,CAACY,sBAAsB,CAACC,qBAAqB,CAAC,CAAC,CAACC,IAAI,CAC9DC,YAAqB,IAAK;IACzB,IAAI,CAACA,YAAY,EAAE;MACjB,MAAMC,MAAM,GAAGb,iBAAiB,CAACc,SAAS,CACxC,6BACF,CAAC;MACDD,MAAM,CAACE,IAAI,CACT,qEACF,CAAC;MACD;IACF;IACAZ,UAAU,CAACa,OAAO,CAACC,yBAAyB,CAAC,MAAM;MACjD,MAAMC,IAAI,GAAG,IAAIC,OAAO,CAAEC,OAAO,IAAK;QACpC,MAAMP,MAAM,GAAGb,iBAAiB,CAACc,SAAS,CACxC,6BACF,CAAC;QACDD,MAAM,CAACE,IAAI,CAAC,iDAAiD,CAAC;QAC9D;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;QACF,CAAC,CAAC;MACN;IACF;IACA,OAAOnE,SAAS;EAClB,CAAC,EAAE,CAACkD,aAAa,EAAEG,YAAY,EAAEM,4BAA4B,CAAC,CAAC;EAE/DxE,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAI8D,2BAA2B,CAAClD,OAAO,EAAE;QACvC,IAAI,CAACF,UAAU,EAAE;QACjBC,6BAA6B,CAACC,OAAO,GAAGC,SAAS;QACjDH,UAAU,CAACa,OAAO,CAACyD,qBAAqB,CAAC,CAAC;QAC1ClB,2BAA2B,CAAClD,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useCall","useCallStateHooks","useEffect","useRef","StreamVideoRN","AppState","NativeModules","PermissionsAndroid","Platform","CallingState","videoLoggerSystem","keepCallAliveCallRef","getCallingxLibIfAvailable","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","isRingingCall","ringing","shouldStartForegroundService","OS","undefined","callingx","isSetup","isOngoingCallsEnabled","run","currentState","sub","addEventListener","nextAppState","remove","IDLE","LEFT"],"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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;MAC7C;IACF;IACA,OAAOc,SAAS;EAClB,CAAC,EAAE,CACDb,aAAa,EACbG,YAAY,EACZQ,4BAA4B,EAC5BF,aAAa,CACd,CAAC;EAEFzD,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX;MACA,IAAI6C,2BAA2B,CAACE,OAAO,EAAE;QACvCtC,oBAAoB,CAACsC,OAAO,GAAGc,SAAS;QACxClD,4BAA4B,CAAC,CAAC;QAC9BkC,2BAA2B,CAACE,OAAO,GAAG,KAAK;MAC7C;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
@@ -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`
@@ -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;;AAExE;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
+ {"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
 
@@ -107,5 +127,11 @@ export class CallManager {
107
127
  * in the native layer.
108
128
  */
109
129
  logAudioState = () => NativeManager.logAudioState();
130
+
131
+ /**
132
+ * For debugging purposes, returns the current audio state as a string.
133
+ * @returns A string containing the current audio state information.
134
+ */
135
+ getAudioStateLog = () => NativeManager.getAudioStateLog();
110
136
  }
111
137
  //# sourceMappingURL=CallManager.js.map
@@ -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;AAG1E,MAAMC,aAAa,GAAGF,aAAa,CAACG,mBAAmB;AAEvD,MAAMC,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,CAACH,QAAQ,CAACS,EAAE,KAAK,SAAS,EAAE,2BAA2B,CAAC;IACjE,OAAOR,aAAa,CAACO,oBAAoB,CAAC,CAAC;EAC7C,CAAC;;EAED;AACF;AACA;AACA;AACA;EACEE,iBAAiB,GAAIC,YAAoB,IAAW;IAClDR,SAAS,CAACH,QAAQ,CAACS,EAAE,KAAK,SAAS,EAAE,2BAA2B,CAAC;IACjER,aAAa,CAACW,yBAAyB,CAACD,YAAY,CAAC;EACvD,CAAC;;E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AAc,CAAC;IAC/D,IAAIF,MAAM,EAAEE,SAAS,KAAK,cAAc,EAAE;MACxC,MAAMC,IAAI,GAAGH,MAAM,CAACI,kBAAkB,IAAI,SAAS;MACnDrC,aAAa,CAACsC,iCAAiC,CAACF,IAAI,CAAC;IACvD;IACA,IAAIH,MAAM,EAAEE,SAAS,KAAK,UAAU,IAAIF,MAAM,CAACM,uBAAuB,EAAE;MACtEvC,aAAa,CAACwC,0BAA0B,CAAC,IAAI,CAAC;IAChD;IACAxC,aAAa,CAACgC,KAAK,CAAC,CAAC;EACvB,CAAC;;EAED;AACF;AACA;EACES,IAAI,GAAGA,CAAA,KAAY;IACjBzC,aAAa,CAACyC,IAAI,CAAC,CAAC;EACtB,CAAC;;EAED;AACF;AACA;AACA;EACEC,aAAa,GAAGA,CAAA,KAAY1C,aAAa,CAAC0C,aAAa,CAAC,CAAC;AAC3D","ignoreList":[]}
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","getAudioStateLog"],"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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F,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;;EAEzD;AACF;AACA;AACA;EACEC,gBAAgB,GAAGA,CAAA,KAAclD,aAAa,CAACkD,gBAAgB,CAAC,CAAC;AACnE","ignoreList":[]}
@@ -1,12 +1,12 @@
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 { useScreenShareAudioMixing } from '../../hooks/useScreenShareAudioMixing';
7
6
  import { AppStateListener } from './AppStateListener';
8
7
  import { DeviceStats } from './DeviceStats';
9
8
  import { pushUnsubscriptionCallbacks } from '../../utils/push/internal/constants';
9
+ import { useCallingExpWithCallingStateEffect } from '../../hooks/push/useCallingExpWithCallingStateEffect';
10
10
 
11
11
  // const PIP_CHANGE_EVENT = 'StreamVideoReactNative_PIP_CHANGE_EVENT';
12
12
 
@@ -25,7 +25,7 @@ export const StreamCall = ({
25
25
  }) => {
26
26
  return /*#__PURE__*/React.createElement(StreamCallProvider, {
27
27
  call: call
28
- }, /*#__PURE__*/React.createElement(AppStateListener, null), /*#__PURE__*/React.createElement(AndroidKeepCallAlive, null), /*#__PURE__*/React.createElement(IosInformCallkeepCallEnd, null), /*#__PURE__*/React.createElement(ClearPushWSSubscriptions, null), /*#__PURE__*/React.createElement(ScreenShareAudioMixer, null), /*#__PURE__*/React.createElement(DeviceStats, null), children);
28
+ }, /*#__PURE__*/React.createElement(AppStateListener, null), /*#__PURE__*/React.createElement(AndroidKeepCallAlive, null), /*#__PURE__*/React.createElement(CallingExpWithCallingState, null), /*#__PURE__*/React.createElement(ClearPushWSSubscriptions, null), /*#__PURE__*/React.createElement(ScreenShareAudioMixer, null), /*#__PURE__*/React.createElement(DeviceStats, null), children);
29
29
  };
30
30
 
31
31
  /**
@@ -38,11 +38,11 @@ const AndroidKeepCallAlive = () => {
38
38
  };
39
39
 
40
40
  /**
41
- * This is a renderless component to end the call in callkeep for ios.
42
- * useAndroidKeepCallAliveEffect needs to called inside a child of StreamCallProvider.
41
+ * This is a renderless component to sync state between stream call and CallKit/Telecom.
42
+ * useCallingExpWithCallingStateEffect needs to called inside a child of StreamCallProvider.
43
43
  */
44
- const IosInformCallkeepCallEnd = () => {
45
- useIosCallkeepWithCallingStateEffect();
44
+ const CallingExpWithCallingState = () => {
45
+ useCallingExpWithCallingStateEffect();
46
46
  return null;
47
47
  };
48
48
 
@@ -1 +1 @@
1
- {"version":3,"names":["StreamCallProvider","React","useEffect","useIosCallkeepWithCallingStateEffect","canAddPushWSSubscriptionsRef","useAndroidKeepCallAliveEffect","useScreenShareAudioMixing","AppStateListener","DeviceStats","pushUnsubscriptionCallbacks","StreamCall","call","children","createElement","AndroidKeepCallAlive","IosInformCallkeepCallEnd","ClearPushWSSubscriptions","ScreenShareAudioMixer","forEach","cbArray","cb","clear","current"],"sourceRoot":"../../../../src","sources":["providers/StreamCall/index.tsx"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,iC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ACA,MAAMU,wBAAwB,GAAGA,CAAA,KAAM;EACrCd,SAAS,CAAC,MAAM;IACd;IACAO,2BAA2B,CAACS,OAAO,CAAEC,OAAO,IAC1CA,OAAO,CAACD,OAAO,CAAEE,EAAE,IAAKA,EAAE,CAAC,CAAC,CAC9B,CAAC;IACDX,2BAA2B,CAACY,KAAK,CAAC,CAAC;IACnCjB,4BAA4B,CAACkB,OAAO,GAAG,KAAK;IAC5C,OAAO,MAAM;MACXlB,4BAA4B,CAACkB,OAAO,GAAG,IAAI;IAC7C,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EACN,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["StreamCallProvider","React","useEffect","canAddPushWSSubscriptionsRef","useAndroidKeepCallAliveEffect","useScreenShareAudioMixing","AppStateListener","DeviceStats","pushUnsubscriptionCallbacks","useCallingExpWithCallingStateEffect","StreamCall","call","children","createElement","AndroidKeepCallAlive","CallingExpWithCallingState","ClearPushWSSubscriptions","ScreenShareAudioMixer","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,yBAAyB,QAAQ,uCAAuC;AACjF,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,oBACEX,KAAA,CAAAY,aAAA,CAACb,kBAAkB;IAACW,IAAI,EAAEA;EAAK,gBAC7BV,KAAA,CAAAY,aAAA,CAACP,gBAAgB,MAAE,CAAC,eACpBL,KAAA,CAAAY,aAAA,CAACC,oBAAoB,MAAE,CAAC,eACxBb,KAAA,CAAAY,aAAA,CAACE,0BAA0B,MAAE,CAAC,eAC9Bd,KAAA,CAAAY,aAAA,CAACG,wBAAwB,MAAE,CAAC,eAC5Bf,KAAA,CAAAY,aAAA,CAACI,qBAAqB,MAAE,CAAC,eACzBhB,KAAA,CAAAY,aAAA,CAACN,WAAW,MAAE,CAAC,EACdK,QACiB,CAAC;AAEzB,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,oBAAoB,GAAGA,CAAA,KAAM;EACjCV,6BAA6B,CAAC,CAAC;EAC/B,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMW,0BAA0B,GAAGA,CAAA,KAAM;EACvCN,mCAAmC,CAAC,CAAC;EACrC,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMQ,qBAAqB,GAAGA,CAAA,KAAM;EAClCZ,yBAAyB,CAAC,CAAC;EAC3B,OAAO,IAAI;AACb,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMW,wBAAwB,GAAGA,CAAA,KAAM;EACrCd,SAAS,CAAC,MAAM;IACd;IACAM,2BAA2B,CAACU,OAAO,CAAEC,OAAO,IAC1CA,OAAO,CAACD,OAAO,CAAEE,EAAE,IAAKA,EAAE,CAAC,CAAC,CAC9B,CAAC;IACDZ,2BAA2B,CAACa,KAAK,CAAC,CAAC;IACnClB,4BAA4B,CAACmB,OAAO,GAAG,KAAK;IAC5C,OAAO,MAAM;MACXnB,4BAA4B,CAACmB,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: 'To keep calls alive',
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,28 @@ export class StreamVideoRN {
74
64
  * import App from './App';
75
65
  * // Set push config
76
66
  * const pushConfig = {}; // construct your config
77
- * StreamVideoRN.setPushConfig(pushConfig);
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: (memberName: string, incoming: boolean) =>
83
+ * incoming
84
+ * ? `${memberName} is calling you`
85
+ * : `You are calling ${memberName}`,
86
+ * },
87
+ * };
88
+ * StreamVideoRN.setPushConfig(pushConfig, callingExpOptions);
78
89
  * AppRegistry.registerComponent('app', () => App);
79
90
  */
80
91
  static setPushConfig(pushConfig) {
@@ -82,13 +93,16 @@ export class StreamVideoRN {
82
93
  // Ignoring this config as push config was already set
83
94
  return;
84
95
  }
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
96
  this.config.push = pushConfig;
91
- setupIosCallKeepEvents(pushConfig);
97
+ try {
98
+ const callingx = getCallingxLib();
99
+ videoLoggerSystem.getLogger('StreamVideoRN.setPushConfig').info(JSON.stringify(this.config));
100
+ const options = extractCallingExpOptions(this.config);
101
+ callingx.setup(options);
102
+ } catch {
103
+ throw new Error('react-native-callingx library is not installed. Please check our migration instructions: https://getstream.io/video/docs/react-native/migration-guides/1.32.0/.');
104
+ }
105
+ setupCallingExpEvents(pushConfig);
92
106
  setupIosVoipPushEvents(pushConfig);
93
107
  }
94
108
  static getConfig() {
@@ -1 +1 @@
1
- {"version":3,"names":["pushLogoutCallbacks","newNotificationCallbacks","setupIosCallKeepEvents","setupIosVoipPushEvents","NativeModules","Platform","deepMerge","target","source","result","key","undefined","Array","isArray","DEFAULT_STREAM_VIDEO_CONFIG","foregroundService","android","channel","id","name","lights","vibration","importance","notificationTexts","title","body","taskToRun","Promise","StreamVideoRN","config","busyToneTimeout","updateConfig","updateAndroidIncomingCallChannel","updateChannel","prevChannel","push","incomingCallChannel","setPushConfig","pushConfig","__DEV__","navigateAcceptCall","navigateToIncomingCall","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,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;;AAEtD;;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,MAAMK,2BAA8C,GAAG;E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;;EAEA;AACF;AACA;AACA;EACE,aAAaC,6BAA6BA,CAAA,EAAqB;IAC7D,IAAIrD,QAAQ,CAACsD,EAAE,KAAK,SAAS,EAC3B,MAAM,IAAIjB,KAAK,CACb,qEACF,CAAC;IACH,OAAOtC,aAAa,CAACoD,sBAAsB,CAACI,sBAAsB,CAAC,CAAC;EACtE;;EAEA;AACF;AACA;AACA;EACE,aAAaC,4BAA4BA,CAAA,EAAqB;IAC5D,IAAIxD,QAAQ,CAACsD,EAAE,KAAK,SAAS,EAC3B,MAAM,IAAIjB,KAAK,CACb,oEACF,CAAC;IACH,OAAOtC,aAAa,CAACoD,sBAAsB,CAACM,qBAAqB,CAAC,CAAC;EACrE;;EAEA;AACF;AACA;AACA;EACE,aAAaC,wBAAwBA,CAAA,EAAqB;IACxD,IAAI1D,QAAQ,CAACsD,EAAE,KAAK,SAAS,EAC3B,MAAM,IAAIjB,KAAK,CACb,gEACF,CAAC;IACH,OAAOtC,aAAa,CAACoD,sBAAsB,CAACQ,iBAAiB,CAAC,CAAC;EACjE;AACF","ignoreList":[]}
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,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sB,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":[]}
@@ -0,0 +1,61 @@
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
+ import { videoLoggerSystem } from '@stream-io/video-client';
7
+ const logger = videoLoggerSystem.getLogger('callingx');
8
+ let pendingResolve = null;
9
+ let pendingTimeout = null;
10
+ let resolveSetTime = null;
11
+ /**
12
+ * Flag to check if the audio session is already activated.
13
+ * This solves race condition for a cold start case, when the audio session is activated before the promise is created.
14
+ */
15
+ let isAudioSessionAlreadyActivated = false;
16
+ const AUDIO_SESSION_TIMEOUT_MS = 5000;
17
+
18
+ /**
19
+ * Creates a promise that resolves when the audio session is activated,
20
+ * or after a timeout to prevent hanging indefinitely.
21
+ * @returns Promise that resolves when audio session is activated or timeout occurs
22
+ */
23
+ export function waitForAudioSessionActivation() {
24
+ if (isAudioSessionAlreadyActivated) {
25
+ isAudioSessionAlreadyActivated = false;
26
+ return Promise.resolve();
27
+ }
28
+ resolveSetTime = Date.now();
29
+ return new Promise(resolve => {
30
+ pendingResolve = resolve;
31
+ pendingTimeout = setTimeout(() => {
32
+ // Resolve on timeout to prevent hanging
33
+ logger.debug('audioSessionPromise timed out');
34
+ resolvePendingAudioSession();
35
+ }, AUDIO_SESSION_TIMEOUT_MS);
36
+ });
37
+ }
38
+
39
+ /**
40
+ * Resolves the pending audio session activation promise.
41
+ * Called when the didActivateAudioSession event fires or on timeout.
42
+ */
43
+ export function resolvePendingAudioSession() {
44
+ if (pendingTimeout) {
45
+ clearTimeout(pendingTimeout);
46
+ pendingTimeout = null;
47
+ }
48
+ if (pendingResolve) {
49
+ pendingResolve();
50
+ if (resolveSetTime) {
51
+ const elapsedTime = Date.now() - resolveSetTime;
52
+ resolveSetTime = null;
53
+ logger.debug(`audioSessionPromise resolved in ${elapsedTime}ms`);
54
+ }
55
+ pendingResolve = null;
56
+ isAudioSessionAlreadyActivated = false;
57
+ } else {
58
+ isAudioSessionAlreadyActivated = true;
59
+ }
60
+ }
61
+ //# sourceMappingURL=audioSessionPromise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["videoLoggerSystem","logger","getLogger","pendingResolve","pendingTimeout","resolveSetTime","isAudioSessionAlreadyActivated","AUDIO_SESSION_TIMEOUT_MS","waitForAudioSessionActivation","Promise","resolve","Date","now","setTimeout","debug","resolvePendingAudioSession","clearTimeout","elapsedTime"],"sourceRoot":"../../../../../src","sources":["utils/internal/callingx/audioSessionPromise.ts"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,yBAAyB;AAE3D,MAAMC,MAAM,GAAGD,iBAAiB,CAACE,SAAS,CAAC,UAAU,CAAC;AAEtD,IAAIC,cAAmC,GAAG,IAAI;AAC9C,IAAIC,cAAoD,GAAG,IAAI;AAC/D,IAAIC,cAA6B,GAAG,IAAI;AACxC;AACA;AACA;AACA;AACA,IAAIC,8BAA8B,GAAG,KAAK;AAE1C,MAAMC,wBAAwB,GAAG,IAAI;;AAErC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,6BAA6BA,CAAA,EAAkB;EAC7D,IAAIF,8BAA8B,EAAE;IAClCA,8BAA8B,GAAG,KAAK;IACtC,OAA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