@stream-io/video-react-native-sdk 1.29.4-beta.0 → 1.30.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 (276) hide show
  1. package/CHANGELOG.md +3162 -0
  2. package/android/src/main/AndroidManifest.xml +1 -8
  3. package/android/src/main/AndroidManifestNew.xml +0 -11
  4. package/android/src/main/java/com/streamvideo/reactnative/StreamVideoReactNativeModule.kt +5 -42
  5. package/android/src/main/java/com/streamvideo/reactnative/audio/utils/WebRtcAudioUtils.kt +6 -70
  6. package/android/src/main/java/com/streamvideo/reactnative/callmanager/StreamInCallManagerModule.kt +4 -6
  7. package/android/src/main/java/com/streamvideo/reactnative/util/CallAliveServiceChecker.kt +95 -0
  8. package/dist/commonjs/components/Call/CallContent/CallContent.js +13 -7
  9. package/dist/commonjs/components/Call/CallContent/CallContent.js.map +1 -1
  10. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js +50 -14
  11. package/dist/commonjs/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  12. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js +27 -0
  13. package/dist/commonjs/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  14. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js +19 -10
  15. package/dist/commonjs/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  16. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js +12 -9
  17. package/dist/commonjs/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  18. package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js +19 -4
  19. package/dist/commonjs/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
  20. package/dist/commonjs/hooks/push/index.js +2 -0
  21. package/dist/commonjs/hooks/push/index.js.map +1 -1
  22. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js +160 -0
  23. package/dist/commonjs/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  24. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  25. package/dist/commonjs/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  26. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js +67 -0
  27. package/dist/commonjs/hooks/push/useProcessPushCallEffect.js.map +1 -0
  28. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js +97 -64
  29. package/dist/commonjs/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  30. package/dist/commonjs/index.js +0 -1
  31. package/dist/commonjs/index.js.map +1 -1
  32. package/dist/commonjs/modules/call-manager/CallManager.js +0 -26
  33. package/dist/commonjs/modules/call-manager/CallManager.js.map +1 -1
  34. package/dist/commonjs/providers/StreamCall/index.js +6 -6
  35. package/dist/commonjs/providers/StreamCall/index.js.map +1 -1
  36. package/dist/commonjs/utils/StreamVideoRN/index.js +21 -33
  37. package/dist/commonjs/utils/StreamVideoRN/index.js.map +1 -1
  38. package/dist/commonjs/utils/hooks/index.js +0 -11
  39. package/dist/commonjs/utils/hooks/index.js.map +1 -1
  40. package/dist/commonjs/utils/internal/registerSDKGlobals.js +3 -52
  41. package/dist/commonjs/utils/internal/registerSDKGlobals.js.map +1 -1
  42. package/dist/commonjs/utils/push/android.js +202 -151
  43. package/dist/commonjs/utils/push/android.js.map +1 -1
  44. package/dist/commonjs/utils/push/internal/ios.js +34 -17
  45. package/dist/commonjs/utils/push/internal/ios.js.map +1 -1
  46. package/dist/commonjs/utils/push/internal/rxSubjects.js +45 -1
  47. package/dist/commonjs/utils/push/internal/rxSubjects.js.map +1 -1
  48. package/dist/commonjs/utils/push/internal/utils.js +20 -32
  49. package/dist/commonjs/utils/push/internal/utils.js.map +1 -1
  50. package/dist/commonjs/utils/push/ios.js.map +1 -1
  51. package/dist/commonjs/utils/push/libs/callkeep.js +17 -0
  52. package/dist/commonjs/utils/push/libs/callkeep.js.map +1 -0
  53. package/dist/commonjs/utils/push/libs/index.js +19 -8
  54. package/dist/commonjs/utils/push/libs/index.js.map +1 -1
  55. package/dist/commonjs/utils/push/libs/notifee/index.js +19 -0
  56. package/dist/commonjs/utils/push/libs/notifee/index.js.map +1 -1
  57. package/dist/commonjs/utils/push/libs/voipPushNotification.js +17 -0
  58. package/dist/commonjs/utils/push/libs/voipPushNotification.js.map +1 -0
  59. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js +205 -0
  60. package/dist/commonjs/utils/push/setupIosCallKeepEvents.js.map +1 -0
  61. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js +6 -7
  62. package/dist/commonjs/utils/push/setupIosVoipPushEvents.js.map +1 -1
  63. package/dist/commonjs/version.js +1 -1
  64. package/dist/commonjs/version.js.map +1 -1
  65. package/dist/module/components/Call/CallContent/CallContent.js +10 -4
  66. package/dist/module/components/Call/CallContent/CallContent.js.map +1 -1
  67. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js +52 -16
  68. package/dist/module/components/Call/CallContent/RTCViewPipIOS.js.map +1 -1
  69. package/dist/module/components/Call/CallContent/RTCViewPipNative.js +27 -0
  70. package/dist/module/components/Call/CallContent/RTCViewPipNative.js.map +1 -1
  71. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js +19 -10
  72. package/dist/module/components/Call/CallLayout/CallParticipantsGrid.js.map +1 -1
  73. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js +15 -12
  74. package/dist/module/components/Call/CallLayout/CallParticipantsSpotlight.js.map +1 -1
  75. package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js +20 -5
  76. package/dist/module/components/Call/CallParticipantsList/CallParticipantsList.js.map +1 -1
  77. package/dist/module/hooks/push/index.js +2 -0
  78. package/dist/module/hooks/push/index.js.map +1 -1
  79. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js +153 -0
  80. package/dist/module/hooks/push/useIosCallkeepWithCallingStateEffect.js.map +1 -0
  81. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js +31 -18
  82. package/dist/module/hooks/push/useIosVoipPushEventsSetupEffect.js.map +1 -1
  83. package/dist/module/hooks/push/useProcessPushCallEffect.js +60 -0
  84. package/dist/module/hooks/push/useProcessPushCallEffect.js.map +1 -0
  85. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js +99 -66
  86. package/dist/module/hooks/useAndroidKeepCallAliveEffect.js.map +1 -1
  87. package/dist/module/index.js +0 -1
  88. package/dist/module/index.js.map +1 -1
  89. package/dist/module/modules/call-manager/CallManager.js +0 -26
  90. package/dist/module/modules/call-manager/CallManager.js.map +1 -1
  91. package/dist/module/providers/StreamCall/index.js +6 -6
  92. package/dist/module/providers/StreamCall/index.js.map +1 -1
  93. package/dist/module/utils/StreamVideoRN/index.js +21 -33
  94. package/dist/module/utils/StreamVideoRN/index.js.map +1 -1
  95. package/dist/module/utils/hooks/index.js +0 -1
  96. package/dist/module/utils/hooks/index.js.map +1 -1
  97. package/dist/module/utils/internal/registerSDKGlobals.js +3 -52
  98. package/dist/module/utils/internal/registerSDKGlobals.js.map +1 -1
  99. package/dist/module/utils/push/android.js +204 -153
  100. package/dist/module/utils/push/android.js.map +1 -1
  101. package/dist/module/utils/push/internal/ios.js +34 -17
  102. package/dist/module/utils/push/internal/ios.js.map +1 -1
  103. package/dist/module/utils/push/internal/rxSubjects.js +44 -0
  104. package/dist/module/utils/push/internal/rxSubjects.js.map +1 -1
  105. package/dist/module/utils/push/internal/utils.js +19 -29
  106. package/dist/module/utils/push/internal/utils.js.map +1 -1
  107. package/dist/module/utils/push/ios.js.map +1 -1
  108. package/dist/module/utils/push/libs/callkeep.js +11 -0
  109. package/dist/module/utils/push/libs/callkeep.js.map +1 -0
  110. package/dist/module/utils/push/libs/index.js +2 -1
  111. package/dist/module/utils/push/libs/index.js.map +1 -1
  112. package/dist/module/utils/push/libs/notifee/index.js +18 -0
  113. package/dist/module/utils/push/libs/notifee/index.js.map +1 -1
  114. package/dist/module/utils/push/libs/voipPushNotification.js +11 -0
  115. package/dist/module/utils/push/libs/voipPushNotification.js.map +1 -0
  116. package/dist/module/utils/push/setupIosCallKeepEvents.js +199 -0
  117. package/dist/module/utils/push/setupIosCallKeepEvents.js.map +1 -0
  118. package/dist/module/utils/push/setupIosVoipPushEvents.js +6 -7
  119. package/dist/module/utils/push/setupIosVoipPushEvents.js.map +1 -1
  120. package/dist/module/version.js +1 -1
  121. package/dist/module/version.js.map +1 -1
  122. package/dist/typescript/components/Call/CallContent/CallContent.d.ts.map +1 -1
  123. package/dist/typescript/components/Call/CallContent/RTCViewPipIOS.d.ts.map +1 -1
  124. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts +18 -0
  125. package/dist/typescript/components/Call/CallContent/RTCViewPipNative.d.ts.map +1 -1
  126. package/dist/typescript/components/Call/CallLayout/CallParticipantsGrid.d.ts.map +1 -1
  127. package/dist/typescript/components/Call/CallLayout/CallParticipantsSpotlight.d.ts.map +1 -1
  128. package/dist/typescript/components/Call/CallParticipantsList/CallParticipantsList.d.ts.map +1 -1
  129. package/dist/typescript/hooks/push/index.d.ts.map +1 -1
  130. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts +5 -0
  131. package/dist/typescript/hooks/push/useIosCallkeepWithCallingStateEffect.d.ts.map +1 -0
  132. package/dist/typescript/hooks/push/useIosVoipPushEventsSetupEffect.d.ts.map +1 -1
  133. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts +8 -0
  134. package/dist/typescript/hooks/push/useProcessPushCallEffect.d.ts.map +1 -0
  135. package/dist/typescript/hooks/useAndroidKeepCallAliveEffect.d.ts.map +1 -1
  136. package/dist/typescript/index.d.ts +0 -1
  137. package/dist/typescript/index.d.ts.map +1 -1
  138. package/dist/typescript/modules/call-manager/CallManager.d.ts +0 -5
  139. package/dist/typescript/modules/call-manager/CallManager.d.ts.map +1 -1
  140. package/dist/typescript/utils/StreamVideoRN/index.d.ts +2 -20
  141. package/dist/typescript/utils/StreamVideoRN/index.d.ts.map +1 -1
  142. package/dist/typescript/utils/StreamVideoRN/types.d.ts +29 -54
  143. package/dist/typescript/utils/StreamVideoRN/types.d.ts.map +1 -1
  144. package/dist/typescript/utils/hooks/index.d.ts +0 -1
  145. package/dist/typescript/utils/hooks/index.d.ts.map +1 -1
  146. package/dist/typescript/utils/internal/registerSDKGlobals.d.ts.map +1 -1
  147. package/dist/typescript/utils/push/android.d.ts +2 -1
  148. package/dist/typescript/utils/push/android.d.ts.map +1 -1
  149. package/dist/typescript/utils/push/internal/ios.d.ts.map +1 -1
  150. package/dist/typescript/utils/push/internal/rxSubjects.d.ts +33 -0
  151. package/dist/typescript/utils/push/internal/rxSubjects.d.ts.map +1 -1
  152. package/dist/typescript/utils/push/internal/utils.d.ts +1 -8
  153. package/dist/typescript/utils/push/internal/utils.d.ts.map +1 -1
  154. package/dist/typescript/utils/push/ios.d.ts +2 -1
  155. package/dist/typescript/utils/push/ios.d.ts.map +1 -1
  156. package/dist/typescript/utils/push/libs/callkeep.d.ts +3 -0
  157. package/dist/typescript/utils/push/libs/callkeep.d.ts.map +1 -0
  158. package/dist/typescript/utils/push/libs/index.d.ts +2 -1
  159. package/dist/typescript/utils/push/libs/index.d.ts.map +1 -1
  160. package/dist/typescript/utils/push/libs/notifee/index.d.ts +1 -0
  161. package/dist/typescript/utils/push/libs/notifee/index.d.ts.map +1 -1
  162. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts +3 -0
  163. package/dist/typescript/utils/push/libs/voipPushNotification.d.ts.map +1 -0
  164. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts +6 -0
  165. package/dist/typescript/utils/push/setupIosCallKeepEvents.d.ts.map +1 -0
  166. package/dist/typescript/utils/push/setupIosVoipPushEvents.d.ts.map +1 -1
  167. package/dist/typescript/version.d.ts +1 -1
  168. package/dist/typescript/version.d.ts.map +1 -1
  169. package/expo-config-plugin/dist/withAndroidManifest.js +33 -1
  170. package/expo-config-plugin/dist/withAndroidPermissions.js +7 -2
  171. package/expo-config-plugin/dist/withAppDelegate.js +197 -19
  172. package/expo-config-plugin/dist/withMainActivity.js +1 -1
  173. package/expo-config-plugin/dist/withiOSInfoPlist.js +3 -2
  174. package/ios/PictureInPicture/PictureInPictureAvatarView.swift +273 -0
  175. package/ios/PictureInPicture/PictureInPictureConnectionQualityIndicator.swift +162 -0
  176. package/ios/PictureInPicture/PictureInPictureContent.swift +173 -0
  177. package/ios/PictureInPicture/PictureInPictureContentState.swift +123 -0
  178. package/ios/PictureInPicture/PictureInPictureDelegateProxy.swift +89 -0
  179. package/ios/PictureInPicture/PictureInPictureEnforcedStopAdapter.swift +166 -0
  180. package/ios/PictureInPicture/PictureInPictureLogger.swift +16 -0
  181. package/ios/PictureInPicture/PictureInPictureParticipantOverlayView.swift +217 -0
  182. package/ios/PictureInPicture/PictureInPictureReconnectionView.swift +193 -0
  183. package/ios/PictureInPicture/StreamAVPictureInPictureVideoCallViewController.swift +125 -7
  184. package/ios/PictureInPicture/StreamPictureInPictureController.swift +237 -63
  185. package/ios/PictureInPicture/StreamPictureInPictureControllerProtocol.swift +30 -0
  186. package/ios/PictureInPicture/StreamPictureInPictureVideoRenderer.swift +384 -12
  187. package/ios/RTCViewPip.swift +187 -21
  188. package/ios/RTCViewPipManager.mm +9 -0
  189. package/ios/RTCViewPipManager.swift +3 -3
  190. package/ios/StreamInCallManager.m +0 -2
  191. package/ios/StreamInCallManager.swift +7 -19
  192. package/ios/StreamVideoReactNative.h +4 -7
  193. package/ios/StreamVideoReactNative.m +82 -189
  194. package/package.json +19 -14
  195. package/src/components/Call/CallContent/CallContent.tsx +16 -8
  196. package/src/components/Call/CallContent/RTCViewPipIOS.tsx +81 -15
  197. package/src/components/Call/CallContent/RTCViewPipNative.tsx +36 -0
  198. package/src/components/Call/CallLayout/CallParticipantsGrid.tsx +28 -14
  199. package/src/components/Call/CallLayout/CallParticipantsSpotlight.tsx +19 -10
  200. package/src/components/Call/CallParticipantsList/CallParticipantsList.tsx +20 -5
  201. package/src/hooks/push/index.ts +2 -0
  202. package/src/hooks/push/useIosCallkeepWithCallingStateEffect.ts +235 -0
  203. package/src/hooks/push/useIosVoipPushEventsSetupEffect.ts +34 -21
  204. package/src/hooks/push/useProcessPushCallEffect.ts +108 -0
  205. package/src/hooks/useAndroidKeepCallAliveEffect.ts +120 -94
  206. package/src/index.ts +0 -1
  207. package/src/modules/call-manager/CallManager.ts +0 -36
  208. package/src/modules/call-manager/native-module.d.ts +0 -7
  209. package/src/providers/StreamCall/index.tsx +6 -6
  210. package/src/utils/StreamVideoRN/index.ts +30 -40
  211. package/src/utils/StreamVideoRN/types.ts +29 -56
  212. package/src/utils/hooks/index.ts +0 -1
  213. package/src/utils/internal/registerSDKGlobals.ts +4 -47
  214. package/src/utils/push/android.ts +309 -227
  215. package/src/utils/push/internal/ios.ts +44 -28
  216. package/src/utils/push/internal/rxSubjects.ts +61 -0
  217. package/src/utils/push/internal/utils.ts +26 -45
  218. package/src/utils/push/ios.ts +6 -1
  219. package/src/utils/push/libs/callkeep.ts +16 -0
  220. package/src/utils/push/libs/index.ts +2 -1
  221. package/src/utils/push/libs/notifee/index.ts +27 -0
  222. package/src/utils/push/libs/voipPushNotification.ts +17 -0
  223. package/src/utils/push/setupIosCallKeepEvents.ts +252 -0
  224. package/src/utils/push/setupIosVoipPushEvents.ts +7 -11
  225. package/src/version.ts +1 -1
  226. package/android/src/main/java/com/streamvideo/reactnative/keepalive/KeepAliveNotification.kt +0 -83
  227. package/android/src/main/java/com/streamvideo/reactnative/keepalive/StreamCallKeepAliveHeadlessService.kt +0 -149
  228. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js +0 -121
  229. package/dist/commonjs/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  230. package/dist/commonjs/utils/hooks/useDebouncedValue.js +0 -24
  231. package/dist/commonjs/utils/hooks/useDebouncedValue.js.map +0 -1
  232. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js +0 -58
  233. package/dist/commonjs/utils/internal/callingx/audioSessionPromise.js.map +0 -1
  234. package/dist/commonjs/utils/internal/callingx/callingx.js +0 -109
  235. package/dist/commonjs/utils/internal/callingx/callingx.js.map +0 -1
  236. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js +0 -48
  237. package/dist/commonjs/utils/keepCallAliveHeadlessTask.js.map +0 -1
  238. package/dist/commonjs/utils/push/libs/callingx.js +0 -75
  239. package/dist/commonjs/utils/push/libs/callingx.js.map +0 -1
  240. package/dist/commonjs/utils/push/setupCallingExpEvents.js +0 -108
  241. package/dist/commonjs/utils/push/setupCallingExpEvents.js.map +0 -1
  242. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js +0 -114
  243. package/dist/module/hooks/push/useCallingExpWithCallingStateEffect.js.map +0 -1
  244. package/dist/module/utils/hooks/useDebouncedValue.js +0 -19
  245. package/dist/module/utils/hooks/useDebouncedValue.js.map +0 -1
  246. package/dist/module/utils/internal/callingx/audioSessionPromise.js +0 -51
  247. package/dist/module/utils/internal/callingx/audioSessionPromise.js.map +0 -1
  248. package/dist/module/utils/internal/callingx/callingx.js +0 -100
  249. package/dist/module/utils/internal/callingx/callingx.js.map +0 -1
  250. package/dist/module/utils/keepCallAliveHeadlessTask.js +0 -42
  251. package/dist/module/utils/keepCallAliveHeadlessTask.js.map +0 -1
  252. package/dist/module/utils/push/libs/callingx.js +0 -67
  253. package/dist/module/utils/push/libs/callingx.js.map +0 -1
  254. package/dist/module/utils/push/setupCallingExpEvents.js +0 -102
  255. package/dist/module/utils/push/setupCallingExpEvents.js.map +0 -1
  256. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts +0 -5
  257. package/dist/typescript/hooks/push/useCallingExpWithCallingStateEffect.d.ts.map +0 -1
  258. package/dist/typescript/utils/hooks/useDebouncedValue.d.ts +0 -8
  259. package/dist/typescript/utils/hooks/useDebouncedValue.d.ts.map +0 -1
  260. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts +0 -16
  261. package/dist/typescript/utils/internal/callingx/audioSessionPromise.d.ts.map +0 -1
  262. package/dist/typescript/utils/internal/callingx/callingx.d.ts +0 -14
  263. package/dist/typescript/utils/internal/callingx/callingx.d.ts.map +0 -1
  264. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts +0 -10
  265. package/dist/typescript/utils/keepCallAliveHeadlessTask.d.ts.map +0 -1
  266. package/dist/typescript/utils/push/libs/callingx.d.ts +0 -9
  267. package/dist/typescript/utils/push/libs/callingx.d.ts.map +0 -1
  268. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts +0 -8
  269. package/dist/typescript/utils/push/setupCallingExpEvents.d.ts.map +0 -1
  270. package/src/hooks/push/useCallingExpWithCallingStateEffect.ts +0 -147
  271. package/src/utils/hooks/useDebouncedValue.ts +0 -21
  272. package/src/utils/internal/callingx/audioSessionPromise.ts +0 -53
  273. package/src/utils/internal/callingx/callingx.ts +0 -146
  274. package/src/utils/keepCallAliveHeadlessTask.ts +0 -54
  275. package/src/utils/push/libs/callingx.ts +0 -90
  276. package/src/utils/push/setupCallingExpEvents.ts +0 -130
@@ -1,102 +0,0 @@
1
- import { videoLoggerSystem } from '@stream-io/video-client';
2
- import { clearPushWSEventSubscriptions, processCallFromPushInBackground } from './internal/utils';
3
- import { setPushLogoutCallback } from '../internal/pushLogoutCallback';
4
- import { resolvePendingAudioSession } from '../internal/callingx/audioSessionPromise';
5
- import { getCallingxLib } from './libs/callingx';
6
- import { Platform } from 'react-native';
7
- const logger = videoLoggerSystem.getLogger('callingx');
8
-
9
- /**
10
- * Sets up callingx event listeners for handling call actions from the native calling UI.
11
- */
12
- export function setupCallingExpEvents(pushConfig) {
13
- const hasPushProvider = Platform.OS === 'android' && pushConfig.android?.pushProviderName || Platform.OS === 'ios' && pushConfig.ios?.pushProviderName;
14
- if (!hasPushProvider) {
15
- return;
16
- }
17
- const callingx = getCallingxLib();
18
- const {
19
- remove: removeAnswerCall
20
- } = callingx.addEventListener('answerCall', params => {
21
- onAcceptCall(pushConfig)(params).catch(err => {
22
- logger.error('Failed to process answerCall event', err);
23
- });
24
- });
25
- const {
26
- remove: removeEndCall
27
- } = callingx.addEventListener('endCall', params => {
28
- onEndCall(pushConfig)(params).catch(err => {
29
- logger.error('Failed to process endCall event', err);
30
- });
31
- });
32
- const {
33
- remove: removeDidActivateAudioSession
34
- } = callingx.addEventListener('didActivateAudioSession', onDidActivateAudioSession);
35
- const {
36
- remove: removeDidDeactivateAudioSession
37
- } = callingx.addEventListener('didDeactivateAudioSession', onDidDeactivateAudioSession);
38
-
39
- //NOTE: until getInitialEvents invocation, events are delayed and won't be sent to event listeners, this is a way to make sure none of required events are missed
40
- //in most cases there will be no delayed answers or ends, but it we don't want to miss any of them
41
- const events = callingx.getInitialEvents();
42
- events.forEach(event => {
43
- const {
44
- eventName,
45
- params
46
- } = event;
47
- if (eventName === 'answerCall') {
48
- logger.debug(`answerCall delayed event callId: ${params?.callId}`);
49
- onAcceptCall(pushConfig)(params).catch(err => {
50
- logger.error('Failed to process delayed answerCall event', err);
51
- });
52
- } else if (eventName === 'endCall') {
53
- logger.debug(`endCall delayed event callId: ${params?.callId}`);
54
- onEndCall(pushConfig)(params).catch(err => {
55
- logger.error('Failed to process delayed endCall event', err);
56
- });
57
- } else if (eventName === 'didActivateAudioSession') {
58
- onDidActivateAudioSession();
59
- } else if (eventName === 'didDeactivateAudioSession') {
60
- onDidDeactivateAudioSession();
61
- }
62
- });
63
- setPushLogoutCallback(async () => {
64
- removeAnswerCall();
65
- removeEndCall();
66
- removeDidActivateAudioSession();
67
- removeDidDeactivateAudioSession();
68
- });
69
- }
70
- const onDidActivateAudioSession = () => {
71
- logger.debug('callingExpDidActivateAudioSession');
72
- resolvePendingAudioSession();
73
- };
74
- const onDidDeactivateAudioSession = () => {
75
- logger.debug('callingExpDidDeactivateAudioSession');
76
- };
77
- const onAcceptCall = pushConfig => async ({
78
- callId: call_cid,
79
- source
80
- }) => {
81
- logger.debug(`onAcceptCall event callId: ${call_cid} source: ${source}`);
82
- if (source === 'app' || !call_cid) {
83
- //we only need to process the call if the call was answered from the system
84
- return;
85
- }
86
- clearPushWSEventSubscriptions(call_cid);
87
- // to process the call in the app
88
- await processCallFromPushInBackground(pushConfig, call_cid, 'accept');
89
- };
90
- const onEndCall = pushConfig => async ({
91
- callId: call_cid,
92
- source
93
- }) => {
94
- logger.debug(`onEndCall event callId: ${call_cid} source: ${source}`);
95
- if (source === 'app' || !call_cid) {
96
- //we only need to process the call if the call was rejected from the system
97
- return;
98
- }
99
- clearPushWSEventSubscriptions(call_cid);
100
- await processCallFromPushInBackground(pushConfig, call_cid, 'decline');
101
- };
102
- //# sourceMappingURL=setupCallingExpEvents.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["videoLoggerSystem","clearPushWSEventSubscriptions","processCallFromPushInBackground","setPushLogoutCallback","resolvePendingAudioSession","getCallingxLib","Platform","logger","getLogger","setupCallingExpEvents","pushConfig","hasPushProvider","OS","android","pushProviderName","ios","callingx","remove","removeAnswerCall","addEventListener","params","onAcceptCall","catch","err","error","removeEndCall","onEndCall","removeDidActivateAudioSession","onDidActivateAudioSession","removeDidDeactivateAudioSession","onDidDeactivateAudioSession","events","getInitialEvents","forEach","event","eventName","debug","callId","call_cid","source"],"sourceRoot":"../../../../src","sources":["utils/push/setupCallingExpEvents.ts"],"mappings":"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","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- /**
2
- * This hook is used to inform sync call state with CallKit/Telecom (i.e. start call, end call, mute/unmute call).
3
- */
4
- export declare const useCallingExpWithCallingStateEffect: () => void;
5
- //# sourceMappingURL=useCallingExpWithCallingStateEffect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCallingExpWithCallingStateEffect.d.ts","sourceRoot":"","sources":["../../../../src/hooks/push/useCallingExpWithCallingStateEffect.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,mCAAmC,YAuI/C,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * this is a custom hook that takes a value and a delay and returns a debounced value
3
- * @param {T} value
4
- * @param {number} delay
5
- * @returns {T}
6
- */
7
- export declare function useDebouncedValue<T>(value: T, delay: number): T;
8
- //# sourceMappingURL=useDebouncedValue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useDebouncedValue.d.ts","sourceRoot":"","sources":["../../../../src/utils/hooks/useDebouncedValue.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAY/D"}
@@ -1,16 +0,0 @@
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
- * Creates a promise that resolves when the audio session is activated,
7
- * or after a timeout to prevent hanging indefinitely.
8
- * @returns Promise that resolves when audio session is activated or timeout occurs
9
- */
10
- export declare function waitForAudioSessionActivation(): Promise<void>;
11
- /**
12
- * Resolves the pending audio session activation promise.
13
- * Called when the didActivateAudioSession event fires or on timeout.
14
- */
15
- export declare function resolvePendingAudioSession(): void;
16
- //# sourceMappingURL=audioSessionPromise.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audioSessionPromise.d.ts","sourceRoot":"","sources":["../../../../../src/utils/internal/callingx/audioSessionPromise.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;GAIG;AACH,wBAAgB,6BAA6B,IAAI,OAAO,CAAC,IAAI,CAAC,CAa7D;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,IAAI,CAajD"}
@@ -1,14 +0,0 @@
1
- import type { EndCallReason } from '@stream-io/react-native-callingx';
2
- import type { Call, MemberResponse, StreamVideoParticipant } from '@stream-io/video-client';
3
- /**
4
- * Gets the call display name. To be used for display in native call screen.
5
- */
6
- export declare function getCallDisplayName(callMembers: MemberResponse[] | undefined, participants: StreamVideoParticipant[] | undefined, currentUserId: string | undefined): string;
7
- /**
8
- * Starts the call in the callingx library.
9
- * Must be called for all outgoing calls
10
- * and optionally for non-ringing calls when ongoing calls are enabled.
11
- */
12
- export declare function startCallingxCall(call: Call): Promise<void>;
13
- export declare function endCallingxCall(call: Call, reason?: EndCallReason): Promise<void>;
14
- //# sourceMappingURL=callingx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../../src/utils/internal/callingx/callingx.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AAIjC;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,cAAc,EAAE,GAAG,SAAS,EACzC,YAAY,EAAE,sBAAsB,EAAE,GAAG,SAAS,EAClD,aAAa,EAAE,MAAM,GAAG,SAAS,UA+BlC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,iBAgEjD;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE,aAAa,iBAmBvE"}
@@ -1,10 +0,0 @@
1
- import type { Call } from '@stream-io/video-client';
2
- export declare const KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = "StreamVideoKeepCallAlive";
3
- /**
4
- * The keep-alive headless task needs access to the active `Call` instance.
5
- * The keep-alive hook will set this reference before starting the native service.
6
- */
7
- export declare const keepCallAliveCallRef: {
8
- current: Call | undefined;
9
- };
10
- //# sourceMappingURL=keepCallAliveHeadlessTask.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keepCallAliveHeadlessTask.d.ts","sourceRoot":"","sources":["../../../src/utils/keepCallAliveHeadlessTask.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAIpD,eAAO,MAAM,kCAAkC,6BAA6B,CAAC;AAE7E;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE;IAAE,OAAO,EAAE,IAAI,GAAG,SAAS,CAAA;CAE7D,CAAC"}
@@ -1,9 +0,0 @@
1
- import { StreamVideoConfig } from '../../StreamVideoRN/types';
2
- export type RNCallingxType = import('@stream-io/react-native-callingx').ICallingxModule;
3
- export type EventData = import('@stream-io/react-native-callingx').EventData;
4
- export type EventParams = import('@stream-io/react-native-callingx').EventParams;
5
- export type CallingExpOptions = import('@stream-io/react-native-callingx').CallingExpOptions;
6
- export declare function getCallingxLib(): import("@stream-io/react-native-callingx").ICallingxModule;
7
- export declare function getCallingxLibIfAvailable(): import("@stream-io/react-native-callingx").ICallingxModule | undefined;
8
- export declare function extractCallingExpOptions(config: StreamVideoConfig): CallingExpOptions;
9
- //# sourceMappingURL=callingx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callingx.d.ts","sourceRoot":"","sources":["../../../../../src/utils/push/libs/callingx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,MAAM,cAAc,GACxB,OAAO,kCAAkC,EAAE,eAAe,CAAC;AAC7D,MAAM,MAAM,SAAS,GAAG,OAAO,kCAAkC,EAAE,SAAS,CAAC;AAC7E,MAAM,MAAM,WAAW,GACrB,OAAO,kCAAkC,EAAE,WAAW,CAAC;AACzD,MAAM,MAAM,iBAAiB,GAC3B,OAAO,kCAAkC,EAAE,iBAAiB,CAAC;AAQ/D,wBAAgB,cAAc,+DAK7B;AAED,wBAAgB,yBAAyB,2EAExC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,iBAAiB,GACxB,iBAAiB,CA4DnB"}
@@ -1,8 +0,0 @@
1
- import type { StreamVideoConfig } from '../StreamVideoRN/types';
2
- type PushConfig = NonNullable<StreamVideoConfig['push']>;
3
- /**
4
- * Sets up callingx event listeners for handling call actions from the native calling UI.
5
- */
6
- export declare function setupCallingExpEvents(pushConfig: NonNullable<PushConfig>): void;
7
- export {};
8
- //# sourceMappingURL=setupCallingExpEvents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setupCallingExpEvents.d.ts","sourceRoot":"","sources":["../../../../src/utils/push/setupCallingExpEvents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAchE,KAAK,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC;AAIzD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,QAoExE"}
@@ -1,147 +0,0 @@
1
- import { videoLoggerSystem } from '@stream-io/video-client';
2
- import { useCall, useCallStateHooks } from '@stream-io/video-react-bindings';
3
- import { useEffect, useMemo } from 'react';
4
- import { getCallDisplayName } from '../../utils/internal/callingx/callingx';
5
- import { getCallingxLibIfAvailable } from '../../utils/push/libs/callingx';
6
-
7
- const logger = videoLoggerSystem.getLogger('callingx');
8
-
9
- /**
10
- * This hook is used to inform sync call state with CallKit/Telecom (i.e. start call, end call, mute/unmute call).
11
- */
12
- export const useCallingExpWithCallingStateEffect = () => {
13
- const { useMicrophoneState, useParticipants, useCallMembers } =
14
- useCallStateHooks();
15
-
16
- const activeCall = useCall();
17
- const { isMute, microphone } = useMicrophoneState();
18
- const callMembers = useCallMembers();
19
- const participants = useParticipants();
20
-
21
- const activeCallCid = activeCall?.cid;
22
- const currentUserId = activeCall?.currentUserId;
23
-
24
- const callDisplayName = useMemo(
25
- () => getCallDisplayName(callMembers, participants, currentUserId),
26
- [callMembers, participants, currentUserId],
27
- );
28
-
29
- useEffect(() => {
30
- return () => {
31
- const callingx = getCallingxLibIfAvailable();
32
- if (!callingx?.isSetup || !activeCallCid) {
33
- return;
34
- }
35
-
36
- const isCallTracked = callingx.isCallTracked(activeCallCid);
37
- if (!isCallTracked) {
38
- logger.debug(
39
- `useCallingExpWithCallingStateEffect:No active call cid to end in calling exp: ${activeCallCid} isCallTracked: ${isCallTracked}`,
40
- );
41
- return;
42
- }
43
- //if incoming stream call was unmounted, we need to end the call in CallKit/Telecom
44
- logger.debug(
45
- `useCallingExpWithCallingStateEffect: Ending call in callingx: ${activeCallCid}`,
46
- );
47
- callingx
48
- .endCallWithReason(activeCallCid, 'local')
49
- .catch((error: unknown) => {
50
- logger.error(
51
- `useCallingExpWithCallingStateEffect: Error ending call in callingx: ${activeCallCid}`,
52
- error,
53
- );
54
- });
55
- };
56
- }, [activeCallCid]);
57
-
58
- useEffect(() => {
59
- const callingx = getCallingxLibIfAvailable();
60
- if (!callingx?.isSetup || !activeCallCid) {
61
- return;
62
- }
63
-
64
- const isCallTracked = callingx.isCallTracked(activeCallCid);
65
- if (!isCallTracked) {
66
- logger.debug(
67
- `useCallingExpWithCallingStateEffect:No active call cid to update callingx: ${activeCallCid} isCallTracked: ${isCallTracked}`,
68
- );
69
- return;
70
- }
71
-
72
- callingx.updateDisplay(activeCallCid, activeCallCid, callDisplayName);
73
- }, [activeCallCid, callDisplayName]);
74
-
75
- // Sync microphone mute state from app → CallKit
76
- useEffect(() => {
77
- const callingx = getCallingxLibIfAvailable();
78
- if (!callingx?.isSetup || !activeCallCid) {
79
- return;
80
- }
81
-
82
- const isCallTracked = callingx.isCallTracked(activeCallCid);
83
- if (!isCallTracked) {
84
- logger.debug(
85
- `useCallingExpWithCallingStateEffect: No active call cid to set muted in calling exp: ${activeCallCid} isCallTracked: ${isCallTracked}`,
86
- );
87
- return;
88
- }
89
-
90
- callingx.setMutedCall(activeCallCid, isMute);
91
- }, [activeCallCid, isMute]);
92
-
93
- // Sync mute state from CallKit → app (only for system-initiated mute actions)
94
- useEffect(() => {
95
- const callingx = getCallingxLibIfAvailable();
96
- if (!callingx?.isSetup || !activeCallCid) {
97
- logger.debug(
98
- `useCallingExpWithCallingStateEffect: No active call cid to set muted in calling exp: ${activeCallCid} callingx isSetup: ${callingx?.isSetup}`,
99
- );
100
- return;
101
- }
102
-
103
- // Listen to mic toggle events from CallKit/Telecom and update stream call microphone state.
104
- // Only system-initiated mute actions (e.g. user tapped mute on the native CallKit UI)
105
- // are sent here — app-initiated actions are filtered out on the native side to prevent
106
- // the feedback loop: app mutes mic → setMutedCall → CallKit delegate → event to JS → loop.
107
- const subscription = callingx.addEventListener(
108
- 'didPerformSetMutedCallAction',
109
- async (event: { callId: string; muted: boolean }) => {
110
- const { callId, muted } = event;
111
-
112
- const isCallTracked = callingx.isCallTracked(activeCallCid);
113
- if (!isCallTracked || callId !== activeCallCid) {
114
- logger.debug(
115
- `useCallingExpWithCallingStateEffect: No active call cid to set muted in calling exp: ${activeCallCid} isCallTracked: ${isCallTracked} callId: ${callId}`,
116
- );
117
- return;
118
- }
119
-
120
- const isCurrentlyMuted = microphone.state.status === 'disabled';
121
- if (isCurrentlyMuted === muted) {
122
- logger.debug(
123
- `useCallingExpWithCallingStateEffect: Mic toggle is already in the desired state: ${muted} for call: ${activeCallCid}`,
124
- );
125
- return;
126
- }
127
-
128
- try {
129
- if (muted) {
130
- await microphone.disable();
131
- } else {
132
- await microphone.enable();
133
- }
134
- } catch (error: unknown) {
135
- logger.error(
136
- `useCallingExpWithCallingStateEffect: Error toggling mic in calling exp: ${activeCallCid}`,
137
- error,
138
- );
139
- }
140
- },
141
- );
142
-
143
- return () => {
144
- subscription.remove();
145
- };
146
- }, [activeCallCid, microphone]);
147
- };
@@ -1,21 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
-
3
- /**
4
- * this is a custom hook that takes a value and a delay and returns a debounced value
5
- * @param {T} value
6
- * @param {number} delay
7
- * @returns {T}
8
- */
9
- export function useDebouncedValue<T>(value: T, delay: number): T {
10
- const [debouncedValue, setDebouncedValue] = useState<T>(value);
11
-
12
- useEffect(() => {
13
- const timer = setTimeout(() => setDebouncedValue(value), delay);
14
-
15
- return () => {
16
- clearTimeout(timer);
17
- };
18
- }, [value, delay]);
19
-
20
- return debouncedValue;
21
- }
@@ -1,53 +0,0 @@
1
- /**
2
- * Module to manage pending promise for audio session activation.
3
- * Used to wait for iOS CallKit's didActivateAudioSession event after starting a call.
4
- */
5
-
6
- let pendingResolve: (() => void) | null = null;
7
- let pendingTimeout: ReturnType<typeof setTimeout> | null = null;
8
- /**
9
- * Flag to check if the audio session is already activated.
10
- * This solves race condition for a cold start case, when the audio session is activated before the promise is created.
11
- */
12
- let isAudioSessionAlreadyActivated = false;
13
-
14
- const AUDIO_SESSION_TIMEOUT_MS = 5000;
15
-
16
- /**
17
- * Creates a promise that resolves when the audio session is activated,
18
- * or after a timeout to prevent hanging indefinitely.
19
- * @returns Promise that resolves when audio session is activated or timeout occurs
20
- */
21
- export function waitForAudioSessionActivation(): Promise<void> {
22
- if (isAudioSessionAlreadyActivated) {
23
- isAudioSessionAlreadyActivated = false;
24
- return Promise.resolve();
25
- }
26
-
27
- return new Promise((resolve) => {
28
- pendingResolve = resolve;
29
- pendingTimeout = setTimeout(() => {
30
- // Resolve on timeout to prevent hanging
31
- resolvePendingAudioSession();
32
- }, AUDIO_SESSION_TIMEOUT_MS);
33
- });
34
- }
35
-
36
- /**
37
- * Resolves the pending audio session activation promise.
38
- * Called when the didActivateAudioSession event fires or on timeout.
39
- */
40
- export function resolvePendingAudioSession(): void {
41
- if (pendingTimeout) {
42
- clearTimeout(pendingTimeout);
43
- pendingTimeout = null;
44
- }
45
-
46
- if (pendingResolve) {
47
- pendingResolve();
48
- pendingResolve = null;
49
- isAudioSessionAlreadyActivated = false;
50
- } else {
51
- isAudioSessionAlreadyActivated = true;
52
- }
53
- }
@@ -1,146 +0,0 @@
1
- /***
2
- * Internal utils for callingx library usage from video-client.
3
- * See @./registerSDKGlobals.ts for more usage details.
4
- */
5
- import { Platform } from 'react-native';
6
- import type { EndCallReason } from '@stream-io/react-native-callingx';
7
- import { getCallingxLibIfAvailable } from '../../push/libs/callingx';
8
- import { waitForAudioSessionActivation } from './audioSessionPromise';
9
- import type {
10
- Call,
11
- MemberResponse,
12
- StreamVideoParticipant,
13
- } from '@stream-io/video-client';
14
- import { videoLoggerSystem } from '@stream-io/video-client';
15
- const CallingxModule = getCallingxLibIfAvailable();
16
-
17
- /**
18
- * Gets the call display name. To be used for display in native call screen.
19
- */
20
- export function getCallDisplayName(
21
- callMembers: MemberResponse[] | undefined,
22
- participants: StreamVideoParticipant[] | undefined,
23
- currentUserId: string | undefined,
24
- ) {
25
- if (!callMembers || !participants || !currentUserId) {
26
- return 'Call';
27
- }
28
-
29
- let names: string[] = [];
30
-
31
- if (callMembers.length > 0) {
32
- // for ringing calls, members array contains all call members from the very early state and participants array is empty in the beginning
33
- names = callMembers
34
- .filter((member) => member.user.id !== currentUserId)
35
- .map((member) => member.user.name)
36
- .filter((name): name is string => name !== undefined);
37
- } else if (participants.length > 0) {
38
- // for non-ringing calls, members array is empty and we rely on participants array there
39
- names = participants
40
- .filter((participant) => participant.userId !== currentUserId)
41
- .map((participant) => participant.name)
42
- .filter(Boolean);
43
- }
44
-
45
- // if no names are found, we use the name of the current user
46
- if (names.length === 0) {
47
- names = [
48
- participants.find((participant) => participant.userId === currentUserId)
49
- ?.name ?? 'Call',
50
- ];
51
- }
52
-
53
- return names.sort().join(', ');
54
- }
55
-
56
- /**
57
- * Starts the call in the callingx library.
58
- * Must be called for all outgoing calls
59
- * and optionally for non-ringing calls when ongoing calls are enabled.
60
- */
61
- export async function startCallingxCall(call: Call) {
62
- if (!CallingxModule || !CallingxModule.isSetup) {
63
- return;
64
- }
65
-
66
- const logger = videoLoggerSystem.getLogger('callingx');
67
- const isOutcomingCall = call.ringing && call.isCreatedByMe;
68
- const isIncomingCall = call.ringing && !call.isCreatedByMe;
69
-
70
- const callDisplayName = getCallDisplayName(
71
- call.state.members,
72
- call.state.participants,
73
- call.currentUserId,
74
- );
75
-
76
- if (
77
- !CallingxModule.isCallTracked(call.cid) &&
78
- (isOutcomingCall || (!call.ringing && CallingxModule.isOngoingCallsEnabled))
79
- ) {
80
- try {
81
- await CallingxModule.startCall(
82
- call.cid, // unique id for call
83
- call.id, // phone number for display in dialer (we use call id as phone number)
84
- callDisplayName, // display name for display in call screen
85
- call.state.settings?.video?.enabled ?? false, // is video call?
86
- );
87
-
88
- // Wait for audio session activation on iOS only
89
- if (Platform.OS === 'ios') {
90
- await waitForAudioSessionActivation();
91
- }
92
-
93
- // TODO: this must be done after join call is complete
94
- CallingxModule.setCurrentCallActive(call.cid);
95
- } catch (error) {
96
- logger.error(
97
- `startCallingxCall: Error starting call in callingx: ${call.cid}`,
98
- error,
99
- );
100
- }
101
- } else if (isIncomingCall) {
102
- try {
103
- // Awaits native CallKit/Telecom registration before answering.
104
- // Safe to call even if the call is already registered (e.g. from VoIP push) --
105
- // iOS early-returns with no error, Android sends the registered broadcast.
106
- await CallingxModule.displayIncomingCall(
107
- call.cid, // unique id for call
108
- call.id, // phone number for display in dialer (we use call id as phone number)
109
- callDisplayName, // display name for display in call screen
110
- call.state.settings?.video?.enabled ?? false, // is video call?
111
- );
112
-
113
- await CallingxModule.answerIncomingCall(call.cid);
114
-
115
- if (Platform.OS === 'ios') {
116
- await waitForAudioSessionActivation();
117
- }
118
- } catch (error) {
119
- logger.error(
120
- `Error displaying incoming call in callingx: ${call.cid}`,
121
- error,
122
- );
123
- }
124
- }
125
- }
126
-
127
- export async function endCallingxCall(call: Call, reason?: EndCallReason) {
128
- if (
129
- !CallingxModule ||
130
- !CallingxModule.isSetup ||
131
- !CallingxModule.isCallTracked(call.cid)
132
- ) {
133
- return;
134
- }
135
-
136
- try {
137
- await CallingxModule.endCallWithReason(call.cid, reason ?? 'local');
138
- } catch (error) {
139
- videoLoggerSystem
140
- .getLogger('callingx')
141
- .error(
142
- `endCallingxCall: Error ending call in callingx: ${call.cid}`,
143
- error,
144
- );
145
- }
146
- }
@@ -1,54 +0,0 @@
1
- import { AppRegistry, Platform } from 'react-native';
2
- import type { Call } from '@stream-io/video-client';
3
- import { videoLoggerSystem } from '@stream-io/video-client';
4
- import { StreamVideoRN } from './StreamVideoRN';
5
-
6
- export const KEEP_CALL_ALIVE_HEADLESS_TASK_NAME = 'StreamVideoKeepCallAlive';
7
-
8
- /**
9
- * The keep-alive headless task needs access to the active `Call` instance.
10
- * The keep-alive hook will set this reference before starting the native service.
11
- */
12
- export const keepCallAliveCallRef: { current: Call | undefined } = {
13
- current: undefined,
14
- };
15
-
16
- function registerKeepCallAliveHeadlessTaskOnce() {
17
- if (Platform.OS !== 'android') return;
18
-
19
- AppRegistry.registerHeadlessTask(
20
- KEEP_CALL_ALIVE_HEADLESS_TASK_NAME,
21
- () => async (data: { callCid?: string } | undefined) => {
22
- const logger = videoLoggerSystem.getLogger(
23
- 'KEEP_CALL_ALIVE_HEADLESS_TASK',
24
- );
25
- const callCid = data?.callCid;
26
-
27
- const call = keepCallAliveCallRef.current;
28
- if (!call) {
29
- logger.warn(
30
- 'No active call instance available for keep-alive task; skipping.',
31
- { callCid },
32
- );
33
- return;
34
- }
35
- if (callCid && call.cid && call.cid !== callCid) {
36
- logger.warn(
37
- 'Keep-alive task callCid does not match active call; skipping.',
38
- { callCid, activeCallCid: call.cid },
39
- );
40
- return;
41
- }
42
-
43
- const config = StreamVideoRN.getConfig();
44
- const taskToRun = config.foregroundService.android.taskToRun;
45
- try {
46
- await taskToRun(call);
47
- } catch (e) {
48
- logger.error('Keep-alive headless task failed', e);
49
- }
50
- },
51
- );
52
- }
53
-
54
- registerKeepCallAliveHeadlessTaskOnce();